Merge commit 'snapstart' into stable
authorIan Beckwith <ianb@erislabs.net>
Mon, 11 Apr 2011 22:32:46 +0000 (23:32 +0100)
committerIan Beckwith <ianb@erislabs.net>
Mon, 11 Apr 2011 22:32:46 +0000 (23:32 +0100)
403 files changed:
ChangeLog
Makefile
NEWS
build-aux/bootstrap
build-aux/config.rpath
build-aux/config.sub
build-aux/git-version-gen
build-aux/texinfo.tex
doc/gendocs_template
doc/gendocs_template_min
doc/glibc-functions/getloadavg.texi
doc/gnulib-tool.texi
doc/posix-functions/getaddrinfo.texi
doc/posix-functions/mbtowc.texi
doc/posix-functions/realloc.texi
doc/posix-functions/setlocale.texi
doc/posix-functions/wctomb.texi
doc/posix-headers/netdb.texi
doc/posix-headers/stdint.texi
doc/posix-headers/sys_socket.texi
doc/standards.texi
gnulib-tool
lib/argp-namefrob.h
lib/arpa_inet.in.h
lib/at-func.c
lib/at-func2.c
lib/dirname.h
lib/dosname.h [new file with mode: 0644]
lib/dup3.c
lib/fbufmode.c
lib/fchownat.c
lib/flock.c
lib/fpurge.c
lib/freadable.c
lib/freading.c
lib/fsync.c
lib/fts.c
lib/fwritable.c
lib/fwriting.c
lib/gen-uni-tables.c
lib/getloadavg.c
lib/getopt_int.h
lib/getpass.c
lib/gettext.h
lib/gettimeofday.c
lib/ioctl.c
lib/linkat.c
lib/localcharset.c
lib/locale.in.h
lib/mbrtowc.c
lib/mbswidth.c
lib/mbtowc-impl.h [new file with mode: 0644]
lib/mbtowc.c [new file with mode: 0644]
lib/nanosleep.c
lib/netdb.in.h
lib/nonblocking.c [new file with mode: 0644]
lib/nonblocking.h [new file with mode: 0644]
lib/openat-die.c
lib/openat-proc.c
lib/openat.c
lib/parse-duration.c
lib/passfd.c [new file with mode: 0644]
lib/passfd.h [new file with mode: 0644]
lib/progreloc.c
lib/regex-quote.c
lib/regex-quote.h
lib/relocatable.c
lib/rmdir.c
lib/savewd.c
lib/setlocale.c [new file with mode: 0644]
lib/sigaction.c
lib/stat.c
lib/stdint.in.h
lib/stdio.in.h
lib/stdlib.in.h
lib/str-two-way.h
lib/strftime.c
lib/strptime.c
lib/sys_socket.in.h
lib/sys_stat.in.h
lib/unictype.in.h
lib/unictype/bidi_byname.c
lib/unictype/bidi_byname.gperf [new file with mode: 0644]
lib/unictype/bidi_longname.c [new file with mode: 0644]
lib/unictype/bidi_name.c
lib/unictype/bidi_of.c
lib/unictype/bidi_test.c
lib/unictype/categ_LC.c [new file with mode: 0644]
lib/unictype/categ_LC.h [new file with mode: 0644]
lib/unictype/categ_byname.c
lib/unictype/categ_byname.gperf [new file with mode: 0644]
lib/unictype/categ_longname.c [new file with mode: 0644]
lib/unictype/categ_name.c
lib/unictype/combining.c [deleted file]
lib/unictype/combining.h [deleted file]
lib/unictype/combiningclass.c [new file with mode: 0644]
lib/unictype/combiningclass.h [new file with mode: 0644]
lib/unictype/combiningclass_byname.c [new file with mode: 0644]
lib/unictype/combiningclass_byname.gperf [new file with mode: 0644]
lib/unictype/combiningclass_longname.c [new file with mode: 0644]
lib/unictype/combiningclass_name.c [new file with mode: 0644]
lib/unictype/joininggroup_byname.c [new file with mode: 0644]
lib/unictype/joininggroup_byname.gperf [new file with mode: 0644]
lib/unictype/joininggroup_name.c [new file with mode: 0644]
lib/unictype/joininggroup_name.h [new file with mode: 0644]
lib/unictype/joininggroup_of.c [new file with mode: 0644]
lib/unictype/joininggroup_of.h [new file with mode: 0644]
lib/unictype/joiningtype_byname.c [new file with mode: 0644]
lib/unictype/joiningtype_byname.gperf [new file with mode: 0644]
lib/unictype/joiningtype_longname.c [new file with mode: 0644]
lib/unictype/joiningtype_name.c [new file with mode: 0644]
lib/unictype/joiningtype_of.c [new file with mode: 0644]
lib/unictype/joiningtype_of.h [new file with mode: 0644]
lib/unictype/pr_byname.c
lib/unictype/pr_byname.gperf
lib/unictype/scripts_byname.gperf
lib/unlink.c
lib/unlinkat.c
lib/userspec.c
lib/vasnprintf.c
lib/verror.h
lib/wcswidth-impl.h
lib/wcswidth.c
lib/wctomb-impl.h [new file with mode: 0644]
lib/wctomb.c [new file with mode: 0644]
lib/xmalloc.c
m4/afunix.m4 [new file with mode: 0644]
m4/backupfile.m4
m4/dirname.m4
m4/dos.m4 [deleted file]
m4/fseeko.m4
m4/getloadavg.m4
m4/gnulib-common.m4
m4/lib-link.m4
m4/locale-ar.m4
m4/locale-fr.m4
m4/locale-ja.m4
m4/locale-tr.m4
m4/locale-zh.m4
m4/locale_h.m4
m4/longlong.m4
m4/mbtowc.m4 [new file with mode: 0644]
m4/openmp.m4
m4/printf-posix-rpl.m4
m4/remove.m4
m4/rmdir.m4
m4/setlocale.m4 [new file with mode: 0644]
m4/socklen.m4
m4/sockpfaf.m4
m4/stat.m4
m4/stdint.m4
m4/stdio_h.m4
m4/stdlib_h.m4
m4/sys_socket_h.m4
m4/unlink.m4
m4/valgrind-tests.m4
m4/wctomb.m4 [new file with mode: 0644]
modules/array-mergesort
modules/backupfile
modules/btowc
modules/btowc-tests
modules/c-strcase-tests
modules/c-strcaseeq
modules/c-strcasestr
modules/dirname-lgpl
modules/dosname [new file with mode: 0644]
modules/filenamecat
modules/ftello
modules/getloadavg
modules/getloadavg-tests [new file with mode: 0644]
modules/getopt-gnu
modules/inet_ntop
modules/inet_pton
modules/lib-symbol-visibility
modules/locale
modules/lstat
modules/mbmemcasecmp-tests
modules/mbmemcasecoll
modules/mbmemcasecoll-tests
modules/mbrtowc-tests
modules/mbscasecmp-tests
modules/mbscasestr-tests
modules/mbschr-tests
modules/mbscspn-tests
modules/mbsinit-tests
modules/mbsncasecmp-tests
modules/mbsnrtowcs-tests
modules/mbspbrk-tests
modules/mbspcasecmp-tests
modules/mbsrchr-tests
modules/mbsrtowcs-tests
modules/mbsspn-tests
modules/mbsstr-tests
modules/mbtowc [new file with mode: 0644]
modules/netdb
modules/nl_langinfo-tests
modules/nonblocking [new file with mode: 0644]
modules/nonblocking-tests [new file with mode: 0644]
modules/openat
modules/parse-duration
modules/passfd [new file with mode: 0644]
modules/passfd-tests [new file with mode: 0644]
modules/printf-posix
modules/quotearg-tests
modules/regex-quote
modules/remove
modules/rmdir
modules/savewd
modules/setlocale [new file with mode: 0644]
modules/setlocale-tests [new file with mode: 0644]
modules/sigpipe
modules/socklen
modules/stat
modules/stdint
modules/stdio
modules/stdlib
modules/strftime-tests [new file with mode: 0644]
modules/striconveh
modules/striconveha
modules/unicase/locale-language-tests
modules/unicase/ulc-casecmp-tests
modules/unicase/ulc-casecoll-tests
modules/uniconv/base
modules/uniconv/u8-conv-from-enc
modules/uniconv/u8-strconv-from-enc
modules/uniconv/u8-strconv-from-locale
modules/unictype/base
modules/unictype/bidicategory-all
modules/unictype/bidicategory-byname
modules/unictype/bidicategory-byname-tests [deleted file]
modules/unictype/bidicategory-name
modules/unictype/bidicategory-name-tests [deleted file]
modules/unictype/bidicategory-of
modules/unictype/bidicategory-of-tests [deleted file]
modules/unictype/bidicategory-test
modules/unictype/bidicategory-test-tests [deleted file]
modules/unictype/bidiclass-all [new file with mode: 0644]
modules/unictype/bidiclass-byname [new file with mode: 0644]
modules/unictype/bidiclass-byname-tests [new file with mode: 0644]
modules/unictype/bidiclass-longname [new file with mode: 0644]
modules/unictype/bidiclass-longname-tests [new file with mode: 0644]
modules/unictype/bidiclass-name [new file with mode: 0644]
modules/unictype/bidiclass-name-tests [new file with mode: 0644]
modules/unictype/bidiclass-of [new file with mode: 0644]
modules/unictype/bidiclass-of-tests [new file with mode: 0644]
modules/unictype/bidiclass-test [new file with mode: 0644]
modules/unictype/bidiclass-test-tests [new file with mode: 0644]
modules/unictype/category-LC [new file with mode: 0644]
modules/unictype/category-LC-tests [new file with mode: 0644]
modules/unictype/category-M
modules/unictype/category-all
modules/unictype/category-byname
modules/unictype/category-longname [new file with mode: 0644]
modules/unictype/category-longname-tests [new file with mode: 0644]
modules/unictype/category-none
modules/unictype/category-of
modules/unictype/category-test
modules/unictype/category-test-withtable
modules/unictype/combining-class
modules/unictype/combining-class-all [new file with mode: 0644]
modules/unictype/combining-class-byname [new file with mode: 0644]
modules/unictype/combining-class-byname-tests [new file with mode: 0644]
modules/unictype/combining-class-longname [new file with mode: 0644]
modules/unictype/combining-class-longname-tests [new file with mode: 0644]
modules/unictype/combining-class-name [new file with mode: 0644]
modules/unictype/combining-class-name-tests [new file with mode: 0644]
modules/unictype/combining-class-tests
modules/unictype/joininggroup-all [new file with mode: 0644]
modules/unictype/joininggroup-byname [new file with mode: 0644]
modules/unictype/joininggroup-byname-tests [new file with mode: 0644]
modules/unictype/joininggroup-name [new file with mode: 0644]
modules/unictype/joininggroup-name-tests [new file with mode: 0644]
modules/unictype/joininggroup-of [new file with mode: 0644]
modules/unictype/joininggroup-of-tests [new file with mode: 0644]
modules/unictype/joiningtype-all [new file with mode: 0644]
modules/unictype/joiningtype-byname [new file with mode: 0644]
modules/unictype/joiningtype-byname-tests [new file with mode: 0644]
modules/unictype/joiningtype-longname [new file with mode: 0644]
modules/unictype/joiningtype-longname-tests [new file with mode: 0644]
modules/unictype/joiningtype-name [new file with mode: 0644]
modules/unictype/joiningtype-name-tests [new file with mode: 0644]
modules/unictype/joiningtype-of [new file with mode: 0644]
modules/unictype/joiningtype-of-tests [new file with mode: 0644]
modules/unictype/property-bidi-arabic-digit
modules/unictype/property-bidi-arabic-right-to-left
modules/unictype/property-bidi-block-separator
modules/unictype/property-bidi-boundary-neutral
modules/unictype/property-bidi-common-separator
modules/unictype/property-bidi-control
modules/unictype/property-bidi-embedding-or-override
modules/unictype/property-bidi-eur-num-separator
modules/unictype/property-bidi-eur-num-terminator
modules/unictype/property-bidi-european-digit
modules/unictype/property-bidi-hebrew-right-to-left
modules/unictype/property-bidi-left-to-right
modules/unictype/property-bidi-non-spacing-mark
modules/unictype/property-bidi-other-neutral
modules/unictype/property-bidi-pdf
modules/unictype/property-bidi-segment-separator
modules/unictype/property-bidi-whitespace
modules/unictype/scripts
modules/unigbrk/ulc-grapheme-breaks-tests
modules/uninorm/base
modules/uninorm/canonical-decomposition
modules/uninorm/composition
modules/uninorm/decompose-internal
modules/uninorm/decomposition-table
modules/uninorm/nfc
modules/uninorm/nfd
modules/uninorm/u32-normalize
modules/unistdio/u-printf-args
modules/unistdio/u16-vasnprintf-tests
modules/unistdio/u32-vasnprintf-tests
modules/unistdio/u8-vasnprintf-tests
modules/unistdio/ulc-vasnprintf-tests
modules/unistr/base
modules/unistr/u32-cpy
modules/unistr/u32-mbtouc-unsafe
modules/unistr/u32-to-u8
modules/unistr/u32-uctomb
modules/unistr/u8-check
modules/unistr/u8-mblen
modules/unistr/u8-mbtouc
modules/unistr/u8-mbtouc-unsafe
modules/unistr/u8-mbtoucr
modules/unistr/u8-prev
modules/unistr/u8-strlen
modules/unistr/u8-to-u32
modules/unistr/u8-uctomb
modules/unitypes
modules/uniwbrk/ulc-wordbreaks-tests
modules/unlink
modules/vasnprintf
modules/vasnprintf-posix-tests
modules/wcrtomb-tests
modules/wcsnrtombs-tests
modules/wcsrtombs-tests
modules/wctob
modules/wctomb [new file with mode: 0644]
posix-modules
tests/test-areadlink.h
tests/test-argmatch.c
tests/test-c-strcasestr.c
tests/test-dirname.c
tests/test-exclude.c
tests/test-getloadavg.c [new file with mode: 0644]
tests/test-ignore-value.c
tests/test-link.h
tests/test-locale-c++.cc
tests/test-mbrtowc-w32-1.sh [new file with mode: 0755]
tests/test-mbrtowc-w32-2.sh [new file with mode: 0755]
tests/test-mbrtowc-w32-3.sh [new file with mode: 0755]
tests/test-mbrtowc-w32-4.sh [new file with mode: 0755]
tests/test-mbrtowc-w32-5.sh [new file with mode: 0755]
tests/test-mbrtowc-w32-6.sh [new file with mode: 0755]
tests/test-mbrtowc-w32-7.sh [new file with mode: 0755]
tests/test-mbrtowc-w32.c [new file with mode: 0644]
tests/test-memmem.c
tests/test-nonblocking.c [new file with mode: 0644]
tests/test-passfd.c [new file with mode: 0644]
tests/test-readlink.h
tests/test-regex-quote.c
tests/test-setlocale1.c [new file with mode: 0644]
tests/test-setlocale1.sh [new file with mode: 0755]
tests/test-setlocale2.c [new file with mode: 0644]
tests/test-setlocale2.sh [new file with mode: 0755]
tests/test-stdlib-c++.cc
tests/test-strcasestr.c
tests/test-strftime.c [new file with mode: 0644]
tests/test-strstr.c
tests/test-wcrtomb-w32-1.sh [new file with mode: 0755]
tests/test-wcrtomb-w32-2.sh [new file with mode: 0755]
tests/test-wcrtomb-w32-3.sh [new file with mode: 0755]
tests/test-wcrtomb-w32-4.sh [new file with mode: 0755]
tests/test-wcrtomb-w32-5.sh [new file with mode: 0755]
tests/test-wcrtomb-w32-6.sh [new file with mode: 0755]
tests/test-wcrtomb-w32-7.sh [new file with mode: 0755]
tests/test-wcrtomb-w32.c [new file with mode: 0644]
tests/test-wcrtomb.c
tests/unictype/test-bidi_byname.c
tests/unictype/test-bidi_longname.c [new file with mode: 0644]
tests/unictype/test-bidi_name.c
tests/unictype/test-bidi_of.c
tests/unictype/test-bidi_test.c
tests/unictype/test-categ_LC.c [new file with mode: 0644]
tests/unictype/test-categ_byname.c
tests/unictype/test-categ_longname.c [new file with mode: 0644]
tests/unictype/test-combining.c [deleted file]
tests/unictype/test-combiningclass.c [new file with mode: 0644]
tests/unictype/test-combiningclass_byname.c [new file with mode: 0644]
tests/unictype/test-combiningclass_longname.c [new file with mode: 0644]
tests/unictype/test-combiningclass_name.c [new file with mode: 0644]
tests/unictype/test-joininggroup_byname.c [new file with mode: 0644]
tests/unictype/test-joininggroup_name.c [new file with mode: 0644]
tests/unictype/test-joininggroup_of.c [new file with mode: 0644]
tests/unictype/test-joininggroup_of.h [new file with mode: 0644]
tests/unictype/test-joiningtype_byname.c [new file with mode: 0644]
tests/unictype/test-joiningtype_longname.c [new file with mode: 0644]
tests/unictype/test-joiningtype_name.c [new file with mode: 0644]
tests/unictype/test-joiningtype_of.c [new file with mode: 0644]
tests/unictype/test-joiningtype_of.h [new file with mode: 0644]
top/maint.mk
users.txt

index dbda2c7..9f58471 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2011-03-31  Eric Blake  <eblake@redhat.com>
+
+       nonblocking: fix mingw test failures
+       * lib/nonblocking.c (set_nonblocking_flag): Succeed when clearing
+       non-blocking flag on regular file.
+       (get_nonblocking_flag): Set errno on invalid fd.
+       * tests/test-nonblocking.c (main): Avoid test failure on
+       directories if fchdir is not active.
+       * modules/nonblocking-tests (Depends-on): Drop unused dependency.
+
+2011-03-31  Bruno Haible  <bruno@clisp.org>
+
+       Fix bug with gl_WARN_ON_USE_PREPARE, introduced on 2011-01-23.
+       * m4/gnulib-common.m4 (gl_ASSERT_NO_GNULIB_POSIXCHECK): Hide the
+       gl_WARN_ON_USE_PREPARE definition from 'aclocal'.
+       Reported by Simon Josefsson <simon@josefsson.org>.
+
+2011-03-31  Bruno Haible  <bruno@clisp.org>
+       and Eric Blake  <eblake@redhat.com>
+
+       nonblocking: new module
+       * modules/nonblocking: New module.
+       * modules/nonblocking-tests: Likewise.
+       * lib/nonblocking.h: New file.
+       * lib/nonblocking.c: Likewise.
+       * tests/test-nonblocking.c: New test.
+       * lib/ioctl.c (ioctl) [mingw]: Update comment.
+
+2011-03-30  Bruno Haible  <bruno@clisp.org>
+
+       stdio: Avoid GCC >= 4.4 warnings when using %lld and similar on mingw.
+       * lib/stdio.in.h (_GL_ATTRIBUTE_FORMAT_PRINTF): Use 'gnu_printf' format
+       instead of 'printf' format for GCC >= 4.4.
+       (_GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM): New macro.
+       (fprintf, printf, vfprintf, vprintf): Declare with
+       _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM when the function ends up calling
+       the system's vfprintf() function.
+       Reported by Daniel P. Berrange <berrange@redhat.com> via Eric Blake.
+
+2011-03-30  Eric Blake  <eblake@redhat.com>
+
+       passfd: fix scoping bug
+       * lib/passfd.c (sendfd, recvfd): Don't let buf go out of scope
+       before sendmsg/recvmsg.
+
+       passfd: standardize coding conventions
+       * m4/afunix.m4 (gl_SOCKET_AFUNIX): Drop check for something that
+       can be learned at compile time.
+       * lib/passfd.c (MSG_CMSG_CLOEXEC): Reduce number of in-function
+       ifdefs.
+       (sendfd, recvfd): Follow gnulib code conventions.
+
+       passfd: fix incorrect sendmsg arguments
+       * lib/passfd.c (sendfd): Avoid uninitialized msg_flags field, and
+       incorrect msg_controllen value.
+       * modules/passfd-tests (Depends-on): Check for alarm.
+       * tests/test-passfd.c (main) [HAVE_DECL_ALARM]: Avoid hanging test.
+       Reported by Bastien ROUCARIES.
+
+2011-03-30  Bruno Haible  <bruno@clisp.org>
+
+       c-strcasestr: Relicense under LGPLv2+.
+       * modules/c-strcasestr (License): Change to LGPLv2+.
+       Requested by Eric Blake, for libvirt.
+
+2011-03-30  Simon Josefsson  <simon@josefsson.org>
+
+       * users.txt: Add libidn2.  Fix libtasn1 link.
+
+2011-03-30  Jim Meyering  <meyering@redhat.com>
+
+       tests: readlink* ("",... fails with EINVAL on newer kernels
+       readlink and readlinkat have typically failed with ENOENT for
+       the invalid, empty file name,  "".  However, with the advent
+       of linux-2.6.39, they fail with EINVAL.
+       * tests/test-areadlink.h (test_areadlink): Also accept EINVAL
+       when operating on the empty file name.
+       * tests/test-readlink.h (test_readlink): Likewise.
+
+2011-03-29  Bruno Haible  <bruno@clisp.org>
+
+       Relicense some modules under LGPLv2+, for libidn2.
+       * modules/array-mergesort (License): Change to LGPLv2+.
+       * modules/c-strcaseeq (License): Likewise.
+       * modules/striconveh (License): Likewise.
+       * modules/striconveha (License): Likewise.
+       * modules/uniconv/base (License): Likewise.
+       * modules/uniconv/u8-conv-from-enc (License): Likewise.
+       * modules/uniconv/u8-strconv-from-enc (License): Likewise.
+       * modules/uniconv/u8-strconv-from-locale (License): Likewise.
+       * modules/unictype/base (License): Likewise.
+       * modules/unictype/bidiclass-of (License): Likewise.
+       * modules/unictype/category-M (License): Likewise.
+       * modules/unictype/category-none (License): Likewise.
+       * modules/unictype/category-of (License): Likewise.
+       * modules/unictype/category-test (License): Likewise.
+       * modules/unictype/category-test-withtable (License): Likewise.
+       * modules/unictype/combining-class (License): Likewise.
+       * modules/unictype/joiningtype-of (License): Likewise.
+       * modules/unictype/scripts (License): Likewise.
+       * modules/uninorm/base (License): Likewise.
+       * modules/uninorm/canonical-decomposition (License): Likewise.
+       * modules/uninorm/composition (License): Likewise.
+       * modules/uninorm/decompose-internal (License): Likewise.
+       * modules/uninorm/decomposition-table (License): Likewise.
+       * modules/uninorm/nfc (License): Likewise.
+       * modules/uninorm/nfd (License): Likewise.
+       * modules/uninorm/u32-normalize (License): Likewise.
+       * modules/unistr/base (License): Likewise.
+       * modules/unistr/u32-cpy (License): Likewise.
+       * modules/unistr/u32-mbtouc-unsafe (License): Likewise.
+       * modules/unistr/u32-to-u8 (License): Likewise.
+       * modules/unistr/u32-uctomb (License): Likewise.
+       * modules/unistr/u8-check (License): Likewise.
+       * modules/unistr/u8-mblen (License): Likewise.
+       * modules/unistr/u8-mbtouc (License): Likewise.
+       * modules/unistr/u8-mbtouc-unsafe (License): Likewise.
+       * modules/unistr/u8-mbtoucr (License): Likewise.
+       * modules/unistr/u8-prev (License): Likewise.
+       * modules/unistr/u8-strlen (License): Likewise.
+       * modules/unistr/u8-to-u32 (License): Likewise.
+       * modules/unistr/u8-uctomb (License): Likewise.
+       * modules/unitypes (License): Likewise.
+       Requested by Simon Josefsson.
+
+2011-03-29  Simon Josefsson  <simon@josefsson.org>
+
+       lib-symbol-visibility: Add a notice.
+       * modules/lib-symbol-visibility (Notice): New field.
+
+2011-03-29  Bruno Haible  <bruno@clisp.org>
+
+       getaddrinfo: Doc fix.
+       * doc/posix-functions/getaddrinfo.texi: Mention Windows problem in the
+       section "fixed in Gnulib".
+
+2011-03-28  Simon Josefsson  <simon@josefsson.org>
+
+       * doc/posix-functions/getaddrinfo.texi: Drop netdb.h discussion.
+       Reported by Bastien ROUCARIES <roucaries.bastien@gmail.com>.
+
+2011-03-26  Bruno Haible  <bruno@clisp.org>
+
+       unictype/property-byname: Reduce the number of load-time relocations.
+       * lib/unictype/pr_byname.c: Include <stdlib.h>.
+       (UC_PROPERTY_INDEX_*): New enumeration values.
+       (uc_property_byname): Convert an index from the lookup table to an
+       uc_property_t.
+       * lib/unictype/pr_byname.gperf: Store indices instead of uc_property_t
+       values.
+
+2011-03-26  Bruno Haible  <bruno@clisp.org>
+
+       unictype/property-byname: Allow omitted word separators and aliases.
+       * lib/unictype/pr_byname.gperf: Add property names without word
+       separators. Add aliases from Unicode 6.0 PropertyAliases.txt, except
+       for 'space'.
+
+2011-03-26  Bruno Haible  <bruno@clisp.org>
+
+       unictype/joininggroup-byname: Allow hyphens, omitted word separators.
+       * lib/unictype/joininggroup_byname.c (uc_joining_group_byname): Convert
+       also hyphens to space.
+       * lib/unictype/joininggroup_byname.gperf: Recognize the names also
+       without spaces.
+       * tests/unictype/test-joininggroup_byname.c (main): Add more tests.
+
+2011-03-26  Bruno Haible  <bruno@clisp.org>
+
+       unictype/joiningtype-byname: Recognize long names as well.
+       * lib/unictype.in.h (uc_joiningtype_class_byname): Allow argument to be
+       a long name.
+       * lib/unictype/joiningtype_byname.c: Include <string.h>,
+       unictype/joiningtype_byname.h.
+       (uc_joiningtype_class_byname): Use uc_joining_type_lookup.
+       * lib/unictype/joiningtype_byname.gperf: New file.
+       * modules/unictype/joiningtype-byname (Files): Add
+       lib/unictype/joiningtype_byname.gperf.
+       (Depends-on): Add gperf.
+       (Makefile.am): Add rule for generating unictype/joiningtype_byname.h.
+       * tests/unictype/test-joiningtype_byname.c (main): Test the recognition of
+       long names.
+
+       Tests for module 'unictype/joiningtype-longname'.
+       * modules/unictype/joiningtype-longname-tests: New file.
+       * tests/unictype/test-joiningtype_longname.c: New file.
+
+       New module 'unictype/joiningtype-longname'.
+       * lib/unictype.in.h (uc_joiningtype_class_long_name): New declaration.
+       * lib/unictype/joiningtype_longname.c: New file.
+       * modules/unictype/joiningtype-longname: New file.
+       * modules/unictype/joiningtype-all (Depends-on): Add
+       unictype/joiningtype-longname.
+
+2011-03-26  Bruno Haible  <bruno@clisp.org>
+
+       unictype/bidiclass-byname: Recognize long names as well.
+       * lib/unictype.in.h (uc_bidi_class_byname): Allow argument to be a long
+       name.
+       * lib/unictype/bidi_byname.c: Include <string.h>,
+       unictype/bidi_byname.h.
+       (uc_bidi_class_byname): Use uc_bidi_class_lookup.
+       * lib/unictype/bidi_byname.gperf: New file.
+       * modules/unictype/bidiclass-byname (Files): Add
+       lib/unictype/bidi_byname.gperf.
+       (Depends-on): Add gperf.
+       (Makefile.am): Add rule for generating unictype/bidi_byname.h.
+       * tests/unictype/test-bidi_byname.c (main): Test the recognition of
+       long names.
+
+       Tests for module 'unictype/bidiclass-longname'.
+       * modules/unictype/bidiclass-longname-tests: New file.
+       * tests/unictype/test-bidi_longname.c: New file.
+
+       New module 'unictype/bidiclass-longname'.
+       * lib/unictype.in.h (uc_bidi_class_long_name): New declaration.
+       * lib/unictype/bidi_longname.c: New file.
+       * modules/unictype/bidiclass-longname: New file.
+       * modules/unictype/bidiclass-all (Depends-on): Add
+       unictype/bidiclass-longname.
+
+2011-03-26  Bruno Haible  <bruno@clisp.org>
+
+       unictype/bidi*: Rename modules.
+       * modules/unictype/bidiclass-all: Renamed from
+       modules/unictype/bidicategory-all.
+       * modules/unictype/bidiclass-name: Renamed from
+       modules/unictype/bidiclass-name.
+       (Description): Update.
+       * modules/unictype/bidiclass-name-tests: Renamed from
+       modules/unictype/bidicategory-name-tests.
+       * modules/unictype/bidiclass-byname: Renamed from
+       modules/unictype/bidicategory-byname.
+       (Description): Update.
+       * modules/unictype/bidiclass-byname-tests: Renamed from
+       modules/unictype/bidicategory-byname-tests.
+       * modules/unictype/bidiclass-of: Renamed from
+       modules/unictype/bidicategory-of.
+       (Description): Update.
+       * modules/unictype/bidiclass-of-tests: Renamed from
+       modules/unictype/bidicategory-of-tests.
+       * modules/unictype/bidiclass-test: Renamed from
+       modules/unictype/bidicategory-test.
+       (Description): Update.
+       * modules/unictype/bidiclass-test-tests: Renamed from
+       modules/unictype/bidicategory-test-tests.
+       * modules/unictype/bidicategory-all: New file, a simple redirection.
+       * modules/unictype/bidicategory-name: Likewise.
+       * modules/unictype/bidicategory-byname: Likewise.
+       * modules/unictype/bidicategory-of: Likewise.
+       * modules/unictype/bidicategory-test: Likewise.
+       * modules/unictype/property-bidi-* (Dependencies): Update.
+       * lib/unictype/bidi_*.c: Update comment.
+
+2011-03-26  Bruno Haible  <bruno@clisp.org>
+
+       unictype/bidi*: Rename functions, part 2.
+       * modules/unictype/bidicategory-name (configure.ac): Update required
+       libunistring version.
+       * modules/unictype/bidicategory-byname (configure.ac): Likewise.
+
+2011-03-25  Bruno Haible  <bruno@clisp.org>
+
+       New module 'unictype/combining-class-all'.
+       * modules/unictype/combining-class-all: New file.
+
+       Tests for module 'unictype/combining-class-byname'.
+       * modules/unictype/combining-class-byname-tests: New file.
+       * tests/unictype/test-combiningclass_byname.c: New file.
+
+       New module 'unictype/combining-class-byname'.
+       * lib/unictype.in.h (uc_combining_class_byname): New declaration.
+       * lib/unictype/combiningclass_byname.c: New file.
+       * lib/unictype/combiningclass_byname.gperf: New file.
+       * modules/unictype/combining-class-byname: New file.
+
+       Tests for module 'unictype/combining-class-longname'.
+       * modules/unictype/combining-class-longname-tests: New file.
+       * tests/unictype/test-combiningclass_longname.c: New file.
+
+       New module 'unictype/combining-class-longname'.
+       * lib/unictype.in.h (uc_combining_class_long_name): New declaration.
+       * lib/unictype/combiningclass_longname.c: New file.
+       * modules/unictype/combining-class-longname: New file.
+
+       Tests for module 'unictype/combining-class-name'.
+       * modules/unictype/combining-class-name-tests: New file.
+       * tests/unictype/test-combiningclass_name.c: New file.
+
+       New module 'unictype/combining-class-name'.
+       * lib/unictype.in.h (uc_combining_class_name): New declaration.
+       * lib/unictype/combiningclass_name.c: New file.
+       * modules/unictype/combining-class-name: New file.
+
+2011-03-25  Bruno Haible  <bruno@clisp.org>
+
+       unictype/combining-class: Rename source files.
+       * lib/gen-uni-tables.c (main): Emit unictype/combiningclass.h instead
+       of unictype/combining.h.
+       * lib/unictype/combiningclass.c: Renamed from lib/unictype/combining.c.
+       Update.
+       * lib/unictype/combiningclass.h: Renamed from lib/unictype/combining.h.
+       * modules/unictype/combining-class (Description): Fix.
+       (Files, Makefile.am): Update.
+       * tests/unictype/test-combiningclass.c: Renamed from
+       tests/unictype/test-combining.c.
+       * modules/unictype/combining-class-tests (Files, Makefile.am): Update.
+
+2011-03-25  Bruno Haible  <bruno@clisp.org>
+
+       unictype: Update list of canonical combining classes.
+       * lib/unictype.in.h (UC_CCC_ATA): New enumeration value.
+
+2011-03-25  Bruno Haible  <bruno@clisp.org>
+
+       unictype/category-byname: Recognize long names as well.
+       * lib/unictype.in.h (uc_general_category_byname): Allow argument to be
+       a long name.
+       * lib/unictype/categ_byname.c: Include <stdlib.h>, <string.h>,
+       unictype/categ_byname.h.
+       (UC_CATEGORY_INDEX_*): New enumeration values.
+       (uc_general_category_byname): Use uc_general_category_lookup and
+       convert from index to value.
+       * lib/unictype/categ_byname.gperf: New file.
+       * modules/unictype/category-byname (Files): Add
+       lib/unictype/categ_byname.gperf.
+       (Depends-on): Add gperf.
+       (Makefile.am): Add rule for generating unictype/categ_byname.h.
+       * tests/unictype/test-categ_byname.c (main): Test the recognition of
+       long names.
+
+       Tests for module 'unictype/category-longname'.
+       * modules/unictype/category-longname-tests: New file.
+       * tests/unictype/test-categ_longname.c: New file.
+
+       New module 'unictype/category-longname'.
+       * lib/unictype.in.h (uc_general_category_long_name): New declaration.
+       * lib/unictype/categ_longname.c: New file.
+       * modules/unictype/category-longname: New file.
+       * modules/unictype/category-all (Depends-on): Add it.
+
+2011-03-25  Bruno Haible  <bruno@clisp.org>
+
+       Tests for module 'unictype/category-LC'.
+       * modules/unictype/category-LC-tests: New file.
+       * tests/unictype/test-categ_LC.c: New file, automatically generated.
+
+       New module 'unictype/category-LC'.
+       * lib/unictype.in.h (UC_CATEGORY_MASK_LC): New enumeration value.
+       (UC_CATEGORY_LC): New declaration.
+       (UC_CASED_LETTER): New macro.
+       * lib/gen-uni-tables.c (is_category_LC): New function.
+       (output_categories): Also handle category LC.
+       (UC_CATEGORY_MASK_LC): New enumeration value.
+       (general_category_byname): Also handle category LC.
+       * lib/unictype/categ_LC.c: New file.
+       * lib/unictype/categ_LC.h: New file, automatically generated.
+       * lib/unictype/categ_name.c (uc_general_category_name): Also handle
+       category LC.
+       * lib/unictype/categ_byname.c (uc_general_category_byname): Likewise.
+       * modules/unictype/category-LC: New file.
+       * modules/unictype/category-byname (Depends-on): Add
+       unictype/category-LC.
+       * modules/unictype/category-all (Depends-on): Likewise.
+
+2011-03-25  Eric Blake  <eblake@redhat.com>
+
+       xmalloc: revert yesterday's regression
+       * lib/xmalloc.c (xrealloc): Once again forward xrealloc(NULL,0) to
+       realloc's underlying behavior (allowing allocation of zero-size
+       objects, especially if malloc-gnu is also in use).
+
+2011-03-25  Reuben Thomas  <rrt@sc3d.org>
+
+       maint.mk: add missing version to VC-tag
+       * top/maint.mk: git tag was missing actual tag name; add it.
+
+       valgrind: do leak checking, and exit with code 1 on error (not 0)
+       * m4/valgrind-tests.m4: Add `--error-exitcode=1 --leak-check=full'
+       to VALGRIND.
+
+2010-11-30  Reuben Thomas  <rrt@sc3d.org>
+
+       posix-modules: say what it does.
+       * posix-modules: Add a line to the --help output saying what it does.
+
+2011-03-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       xmalloc: Do not leak if underlying realloc is C99 compatible.
+       * lib/xmalloc.c (xrealloc): If N is zero, call 'free' directly.
+       This avoids a leak on C99-based systems.  See
+       <http://lists.gnu.org/archive/html/bug-gnulib/2011-03/msg00243.html>.
+
+2011-03-24  Eric Blake  <eblake@redhat.com>
+
+       realloc: document portability problem
+       * doc/posix-functions/realloc.texi (realloc): Mention pitfalls of
+       passing 0 size to realloc.
+
+2011-03-23  Ben Walton  <bwalton@artsci.utoronto.ca>
+
+       doc: update users.txt
+       * users.txt: Add cvsps, tmpwatch
+
+2011-03-23  Matt Rice  <ratmice@gmail.com>
+
+       doc: update users.txt
+       * users.txt: Add gdb.
+
+2011-03-23  Jim Meyering  <meyering@redhat.com>
+
+       doc: update users.txt
+       Looking through matches up to the following URL (there are still
+       several more pages), I found several projects that use gnulib:
+       http://codesearch.google.com/codesearch?start=50&q=gnulib-cache\.m4
+       * users.txt: Add nagios plugins (nagiosplug), acct, gengetopt,
+       gmediaserver, gtkreindeer, jugtail, libunistring, mini-httpd, reindeer.
+
+2011-03-22  Bruno Haible  <bruno@clisp.org>
+
+       unictype/bidi*: Rename functions.
+       * lib/unictype.in.h (uc_bidi_class_name, uc_bidi_class_byname,
+       uc_bidi_class, uc_is_bidi_class): New declarations.
+       * lib/unictype/bidi_byname.c (uc_bidi_class_byname): Renamed from
+       uc_bidi_category_byname.
+       (uc_bidi_category_byname): New function.
+       * lib/unictype/bidi_name.c (u_bidi_class_name): Renamed from
+       u_bidi_category_name.
+       (uc_bidi_class_name): Renamed from uc_bidi_category_name.
+       (uc_bidi_category_name): New function.
+       * lib/unictype/bidi_of.c (uc_bidi_class): Renamed from
+       uc_bidi_category.
+       (uc_bidi_category): New function.
+       * lib/unictype/bidi_test.c (uc_is_bidi_class): Renamed from
+       uc_is_bidi_category. Invoke uc_bidi_class.
+       (uc_is_bidi_category): New function.
+       * tests/unictype/test-bidi_byname.c (main): Test uc_bidi_class_byname
+       instead of uc_bidi_category_byname.
+       * tests/unictype/test-bidi_name.c (main): Test uc_bidi_class_name
+       instead of uc_bidi_category_name.
+       * tests/unictype/test-bidi_of.c (main): Test uc_bidi_class instead of
+       uc_bidi_category.
+       * tests/unictype/test-bidi_test.c (main): Test uc_is_bidi_class
+       instead of uc_is_bidi_category.
+
+2011-03-21  Bruno Haible  <bruno@clisp.org>
+
+       New module 'unictype/joininggroup-all'.
+       * modules/unictype/joininggroup-all: New file.
+
+       Tests for module 'unictype/joininggroup-of'.
+       * modules/unictype/joininggroup-of-tests: New file.
+       * tests/unictype/test-joininggroup_of.c: New file.
+       * tests/unictype/test-joininggroup_of.h: New file, automatically
+       generated by gen-uni-tables.
+
+       New module 'unictype/joininggroup-of'.
+       * modules/unictype/joininggroup-of: New file.
+       * lib/unictype/joininggroup_of.c: New file.
+       * lib/unictype/joininggroup_of.h: New file, automatically generated by
+       gen-uni-tables.
+
+       Tests for module 'unictype/joininggroup-byname'.
+       * modules/unictype/joininggroup-byname-tests: New file.
+       * tests/unictype/test-joininggroup_byname.c: New file.
+
+       New module 'unictype/joininggroup-byname'.
+       * modules/unictype/joininggroup-byname: New file.
+       * lib/unictype/joininggroup_byname.c: New file.
+       * lib/unictype/joininggroup_byname.gperf: New file.
+
+       Tests for module 'unictype/joininggroup-name'.
+       * modules/unictype/joininggroup-name-tests: New file.
+       * tests/unictype/test-joininggroup_name.c: New file.
+
+       New module 'unictype/joininggroup-name'.
+       * modules/unictype/joininggroup-name: New file.
+       * lib/unictype/joininggroup_name.c: New file.
+       * lib/unictype/joininggroup_name.h: New file.
+
+       New module 'unictype/joiningtype-all'.
+       * modules/unictype/joiningtype-all: New file.
+
+       Tests for module 'unictype/joiningtype-of'.
+       * modules/unictype/joiningtype-of-tests: New file.
+       * tests/unictype/test-joiningtype_of.c: New file.
+       * tests/unictype/test-joiningtype_of.h: New file, automatically
+       generated by gen-uni-tables.
+
+       New module 'unictype/joiningtype-of'.
+       * modules/unictype/joiningtype-of: New file.
+       * lib/unictype/joiningtype_of.c: New file.
+       * lib/unictype/joiningtype_of.h: New file, automatically generated by
+       gen-uni-tables.
+
+       Tests for module 'unictype/joiningtype-byname'.
+       * modules/unictype/joiningtype-byname-tests: New file.
+       * tests/unictype/test-joiningtype_byname.c: New file.
+
+       New module 'unictype/joiningtype-byname'.
+       * modules/unictype/joiningtype-byname: New file.
+       * lib/unictype/joiningtype_byname.c: New file.
+
+       Tests for module 'unictype/joiningtype-name'.
+       * modules/unictype/joiningtype-name-tests: New file.
+       * tests/unictype/test-joiningtype_name.c: New file.
+
+       New module 'unictype/joiningtype-name'.
+       * modules/unictype/joiningtype-name: New file.
+       * lib/unictype/joiningtype_name.c: New file.
+
+       unictype: Add support for Arabic shaping properties.
+       * lib/unictype.in.h (UC_JOINING_TYPE_*): New enumeration values.
+       (uc_joining_type_name, uc_joining_type_byname, uc_joining_type): New
+       declarations.
+       (UC_JOINING_GROUP_*): New enumeration values.
+       (uc_joining_group_name, uc_joining_group_byname, uc_joining_group): New
+       declarations.
+       * lib/gen-uni-tables.c (UC_JOINING_TYPE_*): New enumeration values.
+       (unicode_joining_type): New variable.
+       (UC_JOINING_GROUP_*): New enumeration values.
+       (unicode_joining_group): New variable.
+       (fill_arabicshaping, joining_type_as_c_identifier,
+       output_joining_type_test, output_joining_type,
+       joining_group_as_c_identifier, output_joining_group_test,
+       output_joining_group): New functions.
+       (main); Add an argument denoting the ArabicShaping.txt file. Invoke
+       fill_arabicshaping and output_joining_type_test, output_joining_type,
+       output_joining_group_test, output_joining_group.
+       Reported by Simon Josefsson.
+
+2011-03-21  Jim Meyering  <meyering@redhat.com>
+
+       strftime: fix a bug in yesterday's change
+       * lib/strftime.c (add): Accommodate width's initial value of -1.
+       Otherwise, nstrftime would copy uninitialized data into
+       the result buffer.
+
+2011-03-21  Jim Meyering  <meyering@redhat.com>
+
+       tests: add strftime-tests module
+       * tests/test-strftime.c: New file.
+       * modules/strftime-tests: New module.
+
+2011-03-20  Paul Eggert  <eggert@cs.ucla.edu>
+
+       strftime: don't assume a byte count fits in 'int'
+       * lib/strftime.c (add): Don't assume first arg fits in 'int'.  I
+       found this problem by static analysis, using gcc -Wstrict-overflow
+       (GCC 4.5.2, x86-64).  This reported an optimization that depended
+       on an integer overflow having undefined behavior, but it turns out
+       that the argument is a size, which might not fit in 'int' anyway,
+
+2011-03-20  Paul Eggert  <eggert@cs.ucla.edu>
+
+       stdio: don't require ignore_value around fwrite
+
+       This patch works around libc bug 11959
+       <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>.
+       Without this patch, applications must often write
+       ignore_value (fwrite (...)) even though the ignore_value is
+       not helpful here.  It's common to write many objects, using
+       fwrite/printf/etc., and then use ferror to detect output error.
+
+       I considered making this patch optional, but decided against it,
+       because libc is obviously being inconsistent here: there is no
+       reason libc should insist that user code must inspect fwrite
+       return's value without also insisting that it inspect printf's,
+       putchar's, etc.  If user code wants to have a strict style where
+       all these functions' values are checked (so that ferror need not
+       be checked), we could add support for that style in a new gnulib
+       module, but in the meantime it's better to be consistent and to
+       support common usage.
+
+       * lib/stdio.in.h (rpl_fwrite): Define this wrapper around fwrite,
+       to work around libc bug 11959, if __USE_FORTIFY_LEVEL indicates
+       that we are compiling in checking mode, and if not C++, and
+       if not already wrapping fwrite for some other reason.
+       (fwrite): #define to rpl_fwrite if the latter is defined.
+
+2011-03-20  Bruno Haible  <bruno@clisp.org>
+
+       verror: Fix compilation error introduced on 2011-02-13.
+       * lib/verror.h (verror, verror_at_line): Use _GL_ATTRIBUTE_FORMAT macro
+       instead of __attribute__.
+       Reported by Tom G. Christensen <tgc@jupiterrise.com>.
+
+2011-03-20  Paul Eggert  <eggert@cs.ucla.edu>
+            Bruno Haible  <bruno@clisp.org>
+
+       socklen: do not depend on sys_socket
+       While trying to modify Emacs to use gnulib's socklen module,
+       I discovered a circular dependency: socklen depends on sys_socket
+       and vice versa.  Emacs can use socklen, but it does not need
+       sys_socket because it has its own substitute for sys/socket.h.
+       * m4/socklen.m4 (gl_SOCKET_HEADERS): New macro, extracted from
+       gl_TYPE_SOCKLEN_T.
+       (gl_CHECK_SOCKET_HEADERS): New macro, taken from parts of
+       gl_PREREQ_SYS_H_SOCKET.
+       (gl_TYPE_SOCKLEN_T): Require it instead of requiring
+       gl_PREREQ_SYS_H_SOCKET.
+       * m4/sys_socket_h.m4 (gl_PREREQ_SYS_H_SOCKET): Require
+       gl_CHECK_SOCKET_HEADERS instead of doing its work ourselves.
+       * modules/socklen (Depends-on): Do not depend on sys_socket.
+       (Include): Adjust to match the code used in gl_SOCKET_HEADERS.
+
+2011-03-20  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: sort file names *after* new transformation
+       * top/maint.mk (sc_po_check): Sorting before removing the $(srcdir)/
+       prefix would have led to an unwarranted failure in GNU parted.
+       Sort after that transformation.
+
+2011-03-19  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: fix po-file syntax-check rule
+       * top/maint.mk (sc_po_check): Fix fatal typo in yesterday's change.
+       Patch by Bruno Haible.
+
+2011-03-19  Bruno Haible  <bruno@clisp.org>
+
+       socklen: Update comment.
+       * m4/socklen.m4: Update comment about platforms.
+
+2011-03-19  Paul Eggert  <eggert@cs.ucla.edu>
+            Bruno Haible  <bruno@clisp.org>
+
+       inet_ntop, inet_pton: Simplify.
+       * modules/inet_ntop (Depends-on): Remove socklen, since sys_socket is
+       documented to provide socklen_t and we already depend on sys_socket.
+       * modules/inet_pton (Depends-on): Likewise.
+       * lib/arpa_inet.in.h: Adjust comment.
+
+2011-03-19  Paul Eggert  <eggert@cs.ucla.edu>
+            Bruno Haible  <bruno@clisp.org>
+
+       netdb: Simplify.
+       * modules/netdb (Depends-on): Remove socklen, since sys_socket is
+       documented to provide socklen_t and we already depend on sys_socket.
+       * lib/netdb.in.h: Adjust comment.
+
+2011-03-19  Bruno Haible  <bruno@clisp.org>
+
+       sys_socket, netdb: Document problem with socklen_t.
+       * doc/posix-headers/sys_socket.texi: Mention lack of socklen_t on some
+       platforms.
+       * doc/posix-headers/netdb.texi: Likewise.
+
+2011-03-18  Eric Blake  <eblake@redhat.com>
+
+       maint.mk: let po check work in VPATH build
+       * top/maint.mk (po_file): Allow cfg.mk override.
+       (sc_po_check): Allow VPATH use.
+       Reported by Jiri Denemark.
+
+2011-03-16  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: allow fine-grained syntax-check exclusion via Make variables
+       Before, you would have had to create one .x-sc_ file per rule in order
+       to exempt offending files.  Now, you may instead use a Make variable --
+       usually defined in cfg.mk -- whose name identifies the affected rule.
+       * top/maint.mk (_sc_excl): Define.
+       (VC_LIST_EXCEPT): Use it to exclude names on a per-rule basis.
+       (_sc_search_regexp): When not using VC_LIST_EXCEPT, exclude here, too.
+
+2011-03-13  Bruno Haible  <bruno@clisp.org>
+
+       ignore-value tests: Avoid warnings.
+       * tests/test-ignore-value.c (_GL_ATTRIBUTE_RETURN_CHECK): Define to
+       empty for gcc < 3.4.
+
+2011-03-13  Bruno Haible  <bruno@clisp.org>
+
+       passfd: Fix link error on Solaris.
+       * modules/passfd (Description): Correct.
+       (Depends-on): Add socketlib.
+       (Link): New section.
+       * modules/passfd-tests (Makefile.am): Link test-passfd with LIBSOCKET.
+
+2011-03-13  Bruno Haible  <bruno@clisp.org>
+
+       passfd: Fix link error on AIX 5.2.
+       * m4/afunix.m4 (gl_SOCKET_AFUNIX): Define _LINUX_SOURCE_COMPAT.
+
+2011-03-13  Bruno Haible  <bruno@clisp.org>
+
+       passfd: Work around bug with CMSG_FIRSTHDR on FreeBSD 6.4.
+       * lib/sys_socket.in.h: Include <stddef.h>.
+       * m4/afunix.m4 (gl_SOCKET_AFUNIX): Include <stddef.h> before using
+       CMSG_FIRSTHDR. Remove unused variable.
+
+2011-03-13  Bruno Haible  <bruno@clisp.org>
+
+       passfd: Fix compilation error on OpenBSD.
+       * lib/passfd.c: Include <sys/uio.h>.
+
+2011-03-13  Bruno Haible  <bruno@clisp.org>
+
+       passfd test: Fix warnings.
+       * tests/test-passfd.c: Include <sys/wait.h>.
+       (main): Fix typo.
+
+2011-03-13  Bruno Haible  <bruno@clisp.org>
+
+       passfd module, part 4, tweaks.
+       * tests/test-passfd.c: Reorder includes.
+       (main): Fix perror and printf calls.
+
+2011-03-07  Bastien Roucariès  <roucaries.bastien@gmail.com>
+
+       passfd module, part 4.
+       * modules/passfd-tests: New file.
+       * tests/test-passfd.c: New file.
+
+2011-03-13  Jim Meyering  <meyering@redhat.com>
+
+       Makefile: rely on GNU make; derive syntax-check rule names
+       Rather than requiring that each sc_ rule be listed as a dependent
+       of "check", use features of GNU make to derive the list.
+       * Makefile (syntax-check-rules): Define.
+       (check): Depend on the new variable, not the hard-coded list.
+
+2011-03-13  Bastien Roucariès  <roucaries.bastien@gmail.com>
+            Bruno Haible  <bruno@clisp.org>
+
+       passfd module, part 3.
+       * lib/passfd.h (recvfd): Add a flags argument.
+       * lib/passfd.c: Include <fcntl.h>, cloexec.h.
+       (recvfd): Add a flags argument.
+       * m4/afunix.m4 (gl_SOCKET_AFUNIX): Test whether MSG_CMSG_CLOEXEC
+       exists.
+       * modules/passfd (Depends-on): Add cloexec.
+       Suggested by Eric Blake.
+
+2011-03-13  Bruno Haible  <bruno@clisp.org>
+
+       passfd module, part 2, tweaks.
+       * modules/passfd (Files): Reorder.
+       (Depends-on): Remove errno.
+       (Include): Remove <sys/socket.h>, <sys/un.h>.
+       * lib/passfd.h: Use a GPLv3+ header. Make C++ safe.
+       * lib/passfd.c: Untabify. Use a GPLv3+ header. Really include the
+       specification header. Include <sys/socket.h> always. Don't include
+       <winsock2.h>. Use "#if HAVE_..." instead of "#ifdef HAVE_...".
+       (sendfd): Clarify that it sets errno when it fails.
+       (recvfd): Fix specification.
+
+2011-03-07  Bastien Roucariès  <roucaries.bastien@gmail.com>
+
+       passfd module, part 2.
+       * modules/passfd: New file.
+       * lib/passfd.h: New file.
+       * lib/passfd.c: New file.
+
+2011-03-12  Bruno Haible  <bruno@clisp.org>
+
+       wcswidth, mbswidth: Avoid integer overflow.
+       * lib/wcswidth.c: Include <limits.h>.
+       * lib/wcswidth-impl.h (wcswidth): Avoid 'int' overflow.
+       * lib/mbswidth.c: Include <limits.h>.
+       (mbsnwidth): Avoid 'int' overflow.
+       Reported by Jim Meyering.
+
+2011-03-12  Bruno Haible  <bruno@clisp.org>
+
+       futimens, utimensat: Avoid endless recursion on Solaris 10.
+       * lib/sys_stat.in.h (futimens, utimensat): Define with rpl_ prefix on
+       Solaris.
+       Reported by Ben Walton <bwalton@artsci.utoronto.ca> via Eric Blake
+       in <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8230>.
+
+2011-03-11  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: relax a regexp to accommodate other formatting styles
+       * top/maint.mk (sc_unmarked_diagnostics): Allow 0 or 1 space
+       between "ngettext" and the following "(".
+
+2011-03-11  Pádraig Brady <P@draigBrady.com>
+
+       maint.mk: suppress a false positive warning
+       * top/maint.mk ((sc_unmarked_diagnostics): Don't warn when
+       diagnostics are marked with ngettext.
+
+2011-03-10  Eric Blake  <eblake@redhat.com>
+
+       wchar: add explicit dependencies, for Tru64
+       * modules/mbmemcasecoll (Depends-on): Add wchar.
+       * modules/mbtowc (Depends-on): Likewise.
+       * modules/vasnprintf (Depends-on): Likewise.
+       * modules/unistdio/u-printf-args (Depends-on): Likewise.
+       * modules/wctomb (Depends-on): Likewise.
+       Reported by Peter O'Gorman.
+
+2011-03-08  Bruno Haible  <bruno@clisp.org>
+
+       passfd module, part 1, tweaks.
+       * m4/afunix.m4 (gl_SOCKET_AFUNIX): Update AC_REQUIRE invocation.
+       Improve indentation. Improve AC_MSG_CHECKING messages.
+       * m4/sockpfaf.m4 (gl_SOCKET_FAMILY_UNIX): New macro, extracted from
+       gl_SOCKET_FAMILIES.
+
+2011-03-07  Bastien Roucariès  <roucaries.bastien@gmail.com>
+
+       passfd module, part 1.
+       * m4/afunix.m4: New file.
+       * m4/sockpfaf.m4 (gl_SOCKET_FAMILIES): Also test for UNIX domain
+       sockets.
+
+2011-03-08  Bruno Haible  <bruno@clisp.org>
+
+       regex-quote: New API.
+       * lib/regex-quote.h: Include <stdbool.h>.
+       (struct regex_quote_spec): New type.
+       (regex_quote_spec_posix, regex_quote_spec_gnu, regex_quote_spec_pcre):
+       New declarations.
+       (regex_quote_length, regex_quote_copy, regex_quote): Take a
+       'const struct regex_quote_spec *' argument.
+       * lib/regex-quote.c (RE_*, PCRE_*): New macros.
+       (pcre_special): New constant.
+       (regex_quote_spec_posix, regex_quote_spec_gnu, regex_quote_spec_pcre):
+       New functions.
+       (regex_quote_length, regex_quote_copy, regex_quote): Take a
+       'const struct regex_quote_spec *' argument.
+       * modules/regex-quote (Depends-on): Add stdbool.
+       * tests/test-regex-quote.c (check): Update for new API. Add test for
+       anchored results.
+       * NEWS: Mention the API change.
+       Reported by Reuben Thomas and Eric Blake.
+
+2011-03-06  Bruno Haible  <bruno@clisp.org>
+
+       regex-quote: Fix creation of POSIX extended regular expressions.
+       * lib/regex-quote.c (ere_special): Add grouping and alternation
+       operators.
+
+2011-03-05  Bruno Haible  <bruno@clisp.org>
+
+       doc: Improve doc regarding autopoint vs. gnulib.
+       * doc/gnulib-tool.texi (gettextize and autopoint): Recommend to
+       disable autopoint while running autoreconf.
+       Suggested by Ralf Wildenhues.
+
+2011-03-05  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Update AC_OPENMP macro for Lahey compiler on GNU/Linux.
+       * m4/openmp.m4 (AC_OPENMP): Sync from Autoconf.
+
+2011-03-03  Bruce Korb  <bkorb@gnu.org>
+
+       parse-duration: remove xalloc.h dependency
+       * lib/parse-duration.c (parse_period): handle NULL return from
+       strdup instead of calling xstrdup().
+       * modules/parse-duration: remove "xalloc" dependency
+
+2011-03-03  Matthew Booth  <mbooth@redhat.com>
+
+       bootstrap: honor m4_base when running aclocal
+       * build-aux/bootstrap: Fix hard-coded use of m4 directory name.
+
+2011-03-02  Jim Meyering  <meyering@redhat.com>
+
+       getopt-gnu: relax license from LGPLv3+ to LGPLv2+
+       * modules/getopt-gnu (License): Relax to LGPLv2+, for augeas,
+       on request from Matt Booth.
+
+2011-03-01  Eric Blake  <eblake@redhat.com>
+
+       test-link: work on Hurd
+       * tests/test-link.h (test_link): Hurd rejects linking directories
+       with EISDIR instead of the POSIX-mandated EPERM.
+
+2011-02-28  Paul Eggert  <eggert@cs.ucla.edu>
+
+       stdio: simplify by moving files to printf-posix, sigpipe
+       * m4/stdio_h.m4 (gl_STDIO_H): Do not require gl_ASM_SYMBOL_PREFIX,
+       since this symbol is needed only if printf is replaced.
+       * m4/printf-posix-rpl.m4 (gl_REPLACE_PRINTF):
+       Require gl_ASM_SYMBOL_PREFIX.
+       * modules/printf-posix (Files): Add m4/asm-underscore.m4.
+       * modules/sigpipe (Files): Likewise.  Also, add m4/stdio-write.c.
+       (Depends-on): Add 'raise'.
+       (configure.ac): Require gl_ASM_SYMBOL_PREFIX.
+       * modules/stdio (Files): Remove lib/stdio-write.c,
+       m4/asm-underscore.m4.
+       (Depends-on): Remove 'raise'.
+
+       stdio: simplify by moving gl_STDIN_LARGE_OFFSET to fseeko, ftello
+       * m4/fseeko.m4 (gl_STDIN_LARGE_OFFSET): Moved here, from ...
+       * m4/stdio_h.m4 (gl_STDIN_LARGE_OFFSET): ... here, because
+       * modules/ftello (Files): Add m4/fseeko.m4, for gl_STDIN_LARGE_OFFSET.
+
+2011-02-28  Bruno Haible  <bruno@clisp.org>
+
+       localcharset: Assume ANSI C behaviour of free().
+       * lib/localcharset.c (get_charset_aliases): Remove NULL test before
+       calling free().
+       Suggested by Simon Josefsson <simon@josefsson.org>.
+
+2011-02-28  Corinna Vinschen  <vinschen@redhat.com>  (tiny change)
+            Charles Wilson  <cygwin@cwilson.fastmail.fm>  (tiny change)
+            Bruno Haible  <bruno@clisp.org>  (tiny change)
+
+       On Cygwin, use /proc file system instead of win32 API.
+       * lib/relocatable.c: On Cygwin, use file names from /proc, rather than
+       Win32 file names.
+       (DllMain): Simplify by removing Cygwin specific code.
+       (find_shared_library_fullname): Use Linux specific implementation also
+       for Cygwin.
+       (get_shared_library_fullname): Update accordingly.
+       * lib/progreloc.c: On Cygwin, use file names from /proc, rather than
+       Win32 file names.
+       (find_executable): On Cygwin, use /proc, like on Linux. Remove previous
+       Cygwin specific code.
+
+2011-02-28  Christian Rössel  <christian.roessel@gmx.de>  (tiny change)
+           Markus Geimer  <m.geimer@fz-juelich.de>  (tiny change)
+
+       Fix OpenMP flag detection for various Fortran compilers.
+       * m4/openmp.m4 (_AC_LANG_OPENMP(Fortran 77)): Use '!$'
+       OpenMP-conditional compilation construct, to force compile
+       failure with missing OpenMP flag.
+       (AC_OPENMP): Add flags for Cray CCE and NEC SX compilers.
+
+2011-02-25  Eric Blake  <eblake@redhat.com>
+
+       strstr: expand test coverage
+       * tests/test-strstr.c (main): Add much shorter trigger.  Fix C89
+       compilation.
+       * tests/test-memmem.c (main): Duplicate tests.
+       * tests/test-strcasestr.c (main): Likewise.
+       * tests/test-c-strcasestr.c (main): Likewise.
+
+2011-02-25  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: detect missing-NL-at-EOF, too
+       * top/maint.mk (sc_prohibit_empty_lines_at_EOF): Adjust so that
+       it also detects when a file lacks a newline at EOF.
+       (require_exactly_one_NL_at_EOF_): Renamed from
+       detect_empty_lines_at_EOF_.  I opted not to rename the rule,
+       since people may well have .x-sc_... file names tied to the
+       existing name.  Suggested by Eric Blake.
+
+2011-02-25  Paul Eggert  <eggert@cs.ucla.edu>
+
+       dirname: move m4/dos.m4 functionality into lib/dosname.h
+
+       m4/dos.m4 needs to go.  It laboriously invokes the C compiler, and
+       extracts symbols from it, puts them into config.h; but it's much
+       easier to use the symbols directly.  filename.h already does this,
+       but it disagrees with dos.m4 in some respects.  This patch
+       introduces a different include file dosname.h that packages up
+       dos.m4, and then later we can work on merging filename.h and
+       dosname.h.  Applications that need only the easy-to-configure
+       symbols should consider including dosname.h rather than dirname.h.
+       * NEWS: Mention incompatible changes.
+       * m4/dos.m4: Remove.
+       * lib/dosname.h, modules/dosname: New files.
+       * lib/dirname.h (ISSLASH, FILE_SYSTEM_PREFIX_LEN):
+       (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE):
+       (IS_ABSOLUTE_FILE_NAME, IS_RELATIVE_FILE_NAME): Move to lib/dosname.h.
+       * lib/at-func.c, lib/at-func2.c, lib/openat.c, lib/savewd.c:
+       Include dosname.h, not dirname.h.
+       * lib/rmdir.c, lib/stat.c, lib/unlink.c, lib/unlinkat.c:
+       Include dosname.h, for definitions of symbols like ISSLASH
+       that used to be in config.h.
+       * m4/dirname.m4 (gl_DIRNAME_LGPL): Do not require gl_AC_DOS.
+       * m4/rmdir.m4 (gl_FUNC_RMDIR): Likewise.
+       * m4/stat.m4 (gl_FUNC_STAT): Likewise.
+       * m4/unlink.m4 (gl_FUNC_UNLINK): Likewise.
+       * modules/dirname-lgpl (Files): Omit m4/dos.m4.
+       * modules/rmdir (Files): Likewise.
+       * modules/stat (Files): Likewise.
+       * modules/unlink (Files): Likewise.
+       * modules/dirname-lgpl (Depends-on): Add dosname.
+       * modules/lstat (Depends-on): Likewise.
+       * modules/openat (Depends-on): Likewise.
+       * modules/rmdir (Depends-on): Likewise.
+       * modules/savewd (Depends-on): Likewise.
+       * modules/stat (Depends-on): Likewise.
+       * modules/unlink (Depends-on): Likewise.
+       * modules/openat (Depends-on): Remove dirname-lgpl.
+       * modules/savewd (Depends-on): Likewise.
+       * tests/test-dirname.c: Do not use removed symbols like
+       FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR.  Instead, use
+       the remaining symbols, e.g., ISSLASH ('\\').
+
+2011-02-25  Eric Blake  <eblake@redhat.com>
+
+       strstr: revert patches that introduced bug and pessimization
+       * lib/str-two-way.h: Add another reference.
+       (two_way_short_needle, two_way_long_needle): Revert changes from
+       2011-02-24; they pessimize search speed.
+       (critical_factorization): Partially revert changes from
+       2010-06-22; they violate the requirement that the left half of the
+       needle be smaller than the period of the needle.
+
+2011-02-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       filenamecat: remove unnecessary dependency on dirname-lgpl
+       * modules/filenamecat (Depends-on): Remove dirname-lgpl, as there
+       is no direct dependency, just an indirect one via filenamecat-lgpl.
+
+       remove: remove unnecessary use of m4/dos.m4
+       * m4/remove.m4 (gl_FUNC_REMOVE): Don't require gl_AC_DOS; not needed.
+       * modules/remove (FILES): Remove m4/dos.m4.
+
+       * lib/openat-proc.c: Don't include dirname.h; not needed.
+
+       backupfile: remove unnecessary use of m4/dos.m4
+       * m4/backupfile.m4 (gl_BACKUPFILE): Don't require gl_AC_DOS; none
+       of its symbols are used by the backupfile code.  backupfile.c does
+       use a symbol HAVE_DOS_FILE_NAMES, but that symbol is meant only
+       for the rare case of programs that want all their backup file
+       names to live within 8+3 limits, and dos.m4 doesn't address that.
+       * modules/backupfile (Files): Remove m4/dos.m4.
+
+2011-02-24  Jim Meyering  <meyering@redhat.com>
+
+       strstr: fix a bug whereby strstr would mistakenly return NULL
+       * lib/str-two-way.h (two_way_short_needle): Correct off-by-one error
+       in period calculation.
+       (two_way_long_needle): Likewise.
+       The original problem was reported by Mike Stump in
+       http://thread.gmane.org/gmane.comp.sysutils.autoconf.bugs/7834
+       Ralf Wildenhues provided the short needle and haystack.
+       * tests/test-strstr.c: Add Ralf's test case to trigger the bug.
+       Add a more involved test to trigger the bug in two_way_long_needle.
+
+2011-02-24  Stefano Lattarini  <stefano.lattarini@gmail.com>  (tiny change)
+
+       gnulib-tool: remove use of bold display in help screen
+       * gnulib-tool (func_usage): Do not use bold display anymore in the
+       help screen.  That was just meant to be a temporary emphasis for a
+       backward-incompatible change.
+
+2011-02-23  Bruno Haible  <bruno@clisp.org>
+
+       Fix misindentation of preprocessor directives.
+       * lib/argp-namefrob.h: Reindent preprocessor directives.
+       * lib/getopt_int.h (struct _getopt_data): Likewise.
+       * lib/progreloc.c (maybe_executable, find_executable): Likewise.
+       * lib/vasnprintf.c (decode_long_double): Likewise.
+       * tests/test-argmatch.c: Insert blank lines, for clarity.
+       * tests/test-exclude.c: Likewise.
+
+2011-02-22  Bruno Haible  <bruno@clisp.org>
+
+       ioctl: Fix for MacOS X in 64-bit mode.
+       * lib/ioctl.c (rpl_ioctl): Zero-extend, not sign-extend, the request
+       value.
+       Suggested by Eric Blake.
+       Reported by Markus Gothe <nietzsche@lysator.liu.se>.
+
+2011-02-22  Jim Meyering  <meyering@redhat.com>
+
+       maint: sc_cpp_indent_check: remove the "only in lib/" restriction
+       * Makefile (sc_cpp_indent_check): Don't limit the check to files
+       in lib/.
+
+2011-02-22  Eric Blake  <eblake@redhat.com>
+
+       maint: avoid any CDPATH issue
+       * Makefile (sc_cpp_indent_check): Anchor cd argument.
+
+       maint: adjust cpp indentation for my modules, as well
+       * Makefile (sc_cpp_indent_check): Add my name.
+       * lib/fbufmode.c: Filter through cppi.
+       * lib/fpurge.c: Likewise.
+       * lib/freadable.c: Likewise.
+       * lib/freading.c: Likewise.
+       * lib/fwritable.c: Likewise.
+       * lib/fwriting.c: Likewise.
+       * lib/sigaction.c: Likewise.
+
+2011-02-22  Jim Meyering  <meyering@redhat.com>
+
+       maint: adjust cpp indentation to reflect nesting depth
+       I.e., in a block of code that begins with an unnested "#if",
+       put one space between the "#" in column 1 and following token.
+       For example,
+       -#include <sys/vfs.h>
+       +# include <sys/vfs.h>
+       Do this only in .c files that are part of a module I maintain.
+       * lib/linkat.c: Filter through cppi.
+       * lib/nanosleep.c: Likewise.
+       * lib/openat.c: Likewise.
+       * lib/openat-die.c: Likewise.
+       * lib/dup3.c: Likewise.
+       * lib/fchownat.c: Likewise.
+       * lib/flock.c: Likewise.
+       * lib/fsync.c: Likewise.
+       * lib/fts.c: Likewise.
+       * lib/getpass.c: Likewise.
+       * lib/gettimeofday.c: Likewise.
+       * lib/userspec.c: Likewise.
+       * Makefile (sc_cpp_indent_check): New rule, to check this.
+
+2011-02-22  Bruno Haible  <bruno@clisp.org>
+
+       New module 'wctomb'.
+       * lib/stdlib.in.h (wctomb): New declaration.
+       * lib/wctomb.c: New file.
+       * lib/wctomb-impl.h: New file.
+       * m4/wctomb.m4: New file.
+       * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize GNULIB_WCTOMB,
+       REPLACE_WCTOMB.
+       * modules/stdlib (Makefile.am): Substitute GNULIB_WCTOMB,
+       REPLACE_WCTOMB.
+       * modules/wctomb: New file.
+       * tests/test-stdlib-c++.cc: Test signature of wctomb.
+       * doc/posix-functions/wctomb.texi: Mention the new module.
+       * modules/wctob (Depends-on): Add wctomb.
+
+2011-02-22  Bruno Haible  <bruno@clisp.org>
+
+       New module 'mbtowc'.
+       * lib/stdlib.in.h (mbtowc): New declaration.
+       * lib/mbtowc.c: New file.
+       * lib/mbtowc-impl.h: New file, from libutf8 with modifications.
+       * m4/mbtowc.m4: New file.
+       * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize GNULIB_MBTOWC,
+       REPLACE_MBTOWC.
+       * modules/stdlib (Makefile.am): Substitute GNULIB_MBTOWC,
+       REPLACE_MBTOWC.
+       * modules/mbtowc: New file.
+       * tests/test-stdlib-c++.cc: Test signature of mbtowc.
+       * doc/posix-functions/mbtowc.texi: Mention the new module.
+       * modules/btowc (Depends-on): Add mbtowc.
+
+2011-02-22  Bruno Haible  <bruno@clisp.org>
+
+       wcrtomb: Add more tests for native Windows platforms.
+       * tests/test-wcrtomb-w32-1.sh: New file.
+       * tests/test-wcrtomb-w32-2.sh: New file.
+       * tests/test-wcrtomb-w32-3.sh: New file.
+       * tests/test-wcrtomb-w32-4.sh: New file.
+       * tests/test-wcrtomb-w32-5.sh: New file.
+       * tests/test-wcrtomb-w32.c: New file.
+       * modules/wcrtomb-tests (Files): Add them.
+       (Makefile.am): Arrange to run these tests.
+       * tests/test-wcrtomb-w32-6.sh: New file, currently unused.
+       * tests/test-wcrtomb-w32-7.sh: New file, currently unused.
+
+2011-02-20  Bruno Haible  <bruno@clisp.org>
+
+       wcrtomb: Enhance test.
+       * tests/test-wcrtomb.c (main): Add test against bug with NULL argument.
+
+2011-02-20  Bruno Haible  <bruno@clisp.org>
+
+       mbrtowc: Tiny optimization.
+       * lib/mbrtowc.c (mbrtowc): Delay pstate assignment until it is needed.
+
+2011-02-20  Jim Meyering  <meyering@redhat.com>
+
+       test-exclude.c: remove unmatched #endif
+       * tests/test-exclude.c: Remove stray #endif, left over from
+       the change of a week ago.
+
+2011-02-19  Jim Meyering  <meyering@redhat.com>
+
+       git-version-gen: skip "-dirty" check when appropriate
+       * build-aux/git-version-gen: Don't run any git commands when the
+       version string comes from .tarball-version.  Prior to this, we
+       would run git update-index --refresh even from a just-unpacked
+       tarball directory, and that could affect a .git/ directory in a
+       parent of the build directory.  Reported by Mike Frysinger.
+
+2011-02-19  Bruno Haible  <bruno@clisp.org>
+
+       unictype/property-byname: Reduce the size of the 'data' segment.
+       * lib/unictype/pr_byname.gperf: Add gperf option '%pic'.
+
+2011-02-19  Bruno Haible  <bruno@clisp.org>
+
+       unictype/scripts: Reduce the size of the 'data' segment.
+       * lib/gen-uni-tables.c (output_scripts_byname): Emit gperf option
+       '%pic'.
+       * lib/unictype/scripts_byname.gperf: Regenerated.
+
+2011-02-19  Bruno Haible  <bruno@clisp.org>
+
+       stdint: Update documentation.
+       * doc/posix-headers/stdint.texi: Mention WCHAR_MIN, WCHAR_MAX problem.
+
+2011-02-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+       stdint: omit redundant check for wchar.h
+       * m4/stdint.m4 (gl_STDINT_H): The earlier part of this macro now
+       always tests whether wchar.h exists, so remove the now-redundant test.
+
+2011-02-18  Bruno Haible  <bruno@clisp.org>
+
+       stdint: Cut dependency to module 'wchar'.
+       * lib/stdint.in.h: Include wchar.h only when HAVE_WCHAR_H is 1. Also
+       include the necessary prerequisites.
+       * m4/stdint.m4 (gl_STDINT_H): Test whether wchar.h exists.
+       * modules/stdint (Depends-on): Remove wchar.
+       (Makefile.am): Substitute HAVE_WCHAR_H.
+       This reverts part of a 2007-01-06 commit. Reported by Paul Eggert.
+
+2011-02-18  Eric Blake  <eblake@redhat.com>
+
+       longlong: skip, rather than fail, on cross-compilation
+       * m4/longlong.m4 (AC_TYPE_LONG_LONG_INT): Avoid aborting configure
+       when cross-compiling; regression from 2011-02-16.
+
+2011-02-17  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * NEWS: Mention 2011-02-08 change to stdlib.
+
+2011-02-17  Bruno Haible  <bruno@clisp.org>
+
+       getloadavg: Add comments about platforms.
+       * m4/getloadavg.m4: Add comment.
+       * lib/getloadavg.c: Likewise.
+
+2011-02-17  Bruno Haible  <bruno@clisp.org>
+
+       getloadavg: Fix link error on Solaris 2.6.
+       * modules/getloadavg (Link): New section.
+       * modules/getloadavg-tests (Makefile.am): Use GETLOADAVG_LIBS for
+       linking test-getloadavg.
+       * doc/glibc-functions/getloadavg.texi: Mention that Solaris 2.6 lacks
+       getloadavg.
+
+2011-02-17  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * lib/getloadavg.c (getloadavg) [sgi]: Make ldav_off of type ptrdiff_t.
+       It was 'int', but this doesn't match the IRIX 6.5 manual.
+       Suggested by Bruno Haible in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2011-02/msg00207.html>.
+
+2011-02-17  Bruno Haible  <bruno@clisp.org>
+
+       havelib: Fix comments.
+       * m4/lib-link.m4 (AC_LIB_RPATH): Update comments after 2007-01-02
+       change.
+
+2011-02-17  Bruno Haible  <bruno@clisp.org>
+
+       havelib: Update config.rpath.
+       * build-aux/config.rpath: Update to match libtool.m4 from libtool-2.4.
+
+2011-02-17  Bruno Haible  <bruno@clisp.org>
+
+       getloadavg test: Add some plausibility checks.
+       * tests/test-getloadavg.c (check_avg): Print a warning when the value
+       is improbable.
+
+2011-02-16  Eric Blake  <eblake@redhat.com>
+
+       maintainer-makefile: make syntax-check a no-op from tarballs
+       * top/maint.mk (no-vc-detected): New rule.
+       (local-checks-available): Use it to avoid hanging if someone tries
+       'make syntax-check' from a tarball.  Also append to any non-syntax
+       checks already defined in cfg.mk.
+
+2011-02-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       longlong: tune, particularly for common case of c99
+
+       * m4/longlong.m4 (AC_TYPE_LONG_LONG_INT): Don't bother compiling
+       or running anything if c99, or if unsigned long long int does not
+       work.  In either case, we know the answer without further tests.
+       Do not compile _AC_TYPE_LONG_LONG_SNIPPET twice.  Instead, compile
+       it at most once, and use its results for both long long int and
+       unsigned long long int.  This is more likely to be efficient in
+       the common case where the program wants to check for both long
+       long int and unsigned long long int.
+       (AC_TYPE_UNSIGNED_LONG_LONG_INT): Don't bother compiling if c99,
+       since the answer is already known.
+
+2011-02-15  Paul Eggert  <eggert@cs.ucla.edu>
+
+       getloadavg: set errno
+       * lib/getloadavg.c: Set errno when returning -1.  If no other
+       error number looks appropriate, set it to ENOSYS if the getloadavg
+       looks like it can't possibly ever work, ENOTSUP otherwise.
+       Suggested by Bruno Haible in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2011-02/msg00187.html>.
+
+       getloadavg: trim unused parts and speed up 'configure'
+       * NEWS: Document this.
+       * lib/getloadavg.c: Ignore HAVE_GETLOADAVG; this file is now
+       always compiled if getloadavg is absent.
+       Move test code to ...
+       * tests/test-getloadavg.c: New file, containing previous
+       contents of test from lib/getloadavg.c.  It also contains
+       suggestions by Bruno Haible in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2011-02/msg00186.html>.
+       * modules/getloadavg-tests: New file.
+       * m4/getloadavg.m4 (gl_GETLOADAVG): Do not check for getloadavg twice.
+       Do tests in the same order as they're needed for getloadavg.c.
+       Omit setgid-related tests that generate symbols KMEM_GROUP,
+       NEET_SETGID, GETLOADAVG_PRIVILEGED; nobody seems to use those any more.
+       Do only the tests that are needed to see whether the system has
+       getloadavg, moving the other tests into ...
+       (gl_PREREQ_GETLOADAVG): ... here.  Do not define obsolete symbol
+       NLIST_NAME_UNION; nobody should be using it.  Do not define
+       symbols C_GETLOADAVG and HAVE_GETLOADAVG; they're no longer
+       relevant, as the user of this module shouldn't care how getloadavg
+       is implemented.
+
+       getloadavg: omit unused var
+       * lib/getloadavg.c (getloadavg): Omit unused local variable.
+
 2011-02-15  Jim Meyering  <meyering@redhat.com>
 
        doc: update users.txt
 
 2011-02-13  Bruno Haible  <bruno@clisp.org>
 
+       mbrtowc: Add more tests for native Windows platforms.
+       * tests/test-mbrtowc-w32-1.sh: New file.
+       * tests/test-mbrtowc-w32-2.sh: New file.
+       * tests/test-mbrtowc-w32-3.sh: New file.
+       * tests/test-mbrtowc-w32-4.sh: New file.
+       * tests/test-mbrtowc-w32-5.sh: New file.
+       * tests/test-mbrtowc-w32.c: New file.
+       * modules/mbrtowc-tests (Files): Add them.
+       (Makefile.am): Arrange to run these tests.
+       * tests/test-mbrtowc-w32-6.sh: New file, currently unused.
+       * tests/test-mbrtowc-w32-7.sh: New file, currently unused.
+
+2011-02-13  Bruno Haible  <bruno@clisp.org>
+
        mbrtowc: Work around native Windows bug.
        * m4/mbrtowc.m4 (gl_MBRTOWC_RETVAL): Detect native Windows bug. Use the
        guess when no suitable locale for testing was found.
        * tests/test-quotearg.sh: Convert the locale identifier from native
        Windows syntax to Unix syntax.
 
+2011-02-12  Bruno Haible  <bruno@clisp.org>
+
+       setlocale: Prefer gnulib's override over libintl's override.
+       * lib/locale.in.h (GNULIB_defined_setlocale): New macro.
+       * lib/gettext.h (setlocale): Redefine to rpl_setlocale if
+       GNULIB_defined_setlocale is set.
+
 2011-02-12  Paul Eggert  <eggert@cs.ucla.edu>
 
        stdlib: support non-GCC __attribute__
        against mingw bug.
        * doc/posix-functions/mbsrtowcs.texi: Document mingw bug.
 
+2011-02-12  Bruno Haible  <bruno@clisp.org>
+
+       Avoid setlocale bugs in tests.
+       * modules/btowc (Dependencies): Add setlocale.
+       * modules/c-strcase (Dependencies): Likewise.
+       * modules/mbmemcasecmp (Dependencies): Likewise.
+       * modules/mbmemcasecoll (Dependencies): Likewise.
+       * modules/mbrtowc (Dependencies): Likewise.
+       * modules/mbscasecmp (Dependencies): Likewise.
+       * modules/mbscasestr (Dependencies): Likewise.
+       * modules/mbschr (Dependencies): Likewise.
+       * modules/mbscspn (Dependencies): Likewise.
+       * modules/mbsinit (Dependencies): Likewise.
+       * modules/mbsncasecmp (Dependencies): Likewise.
+       * modules/mbsnrtowcs (Dependencies): Likewise.
+       * modules/mbspbrk (Dependencies): Likewise.
+       * modules/mbspcasecmp (Dependencies): Likewise.
+       * modules/mbsrchr (Dependencies): Likewise.
+       * modules/mbsrtowcs (Dependencies): Likewise.
+       * modules/mbsspn (Dependencies): Likewise.
+       * modules/mbsstr (Dependencies): Likewise.
+       * modules/nl_langinfo (Dependencies): Likewise.
+       * modules/quotearg (Dependencies): Likewise.
+       * modules/unicase/locale-language (Dependencies): Likewise.
+       * modules/unicase/ulc-casecmp (Dependencies): Likewise.
+       * modules/unicase/ulc-casecoll (Dependencies): Likewise.
+       * modules/unigbrk/ulc-grapheme-breaks (Dependencies): Likewise.
+       * modules/unistdio/u8-vasnprintf (Dependencies): Likewise.
+       * modules/unistdio/u16-vasnprintf (Dependencies): Likewise.
+       * modules/unistdio/u32-vasnprintf (Dependencies): Likewise.
+       * modules/unistdio/ulc-vasnprintf (Dependencies): Likewise.
+       * modules/uniwbrk/ulc-wordbreaks (Dependencies): Likewise.
+       * modules/vasnprintf-posix (Dependencies): Likewise.
+       * modules/wcrtomb (Dependencies): Likewise.
+       * modules/wcsnrtombs (Dependencies): Likewise.
+       * modules/wcsrtombs (Dependencies): Likewise.
+
+2011-02-12  Bruno Haible  <bruno@clisp.org>
+
+       setlocale: Workaround native Windows bug.
+       * lib/setlocale.c (rpl_setlocale): On native Windows, when setlocale
+       succeeds but sets LC_CTYPE to "C", report a failure.
+       * tests/test-setlocale2.sh: New file.
+       * tests/test-setlocale2.c: New file.
+       * modules/setlocale-tests (Files): Add the new files.
+       (Makefile.am): Enable test-setlocale2.sh test.
+       * doc/posix-functions/setlocale.texi: Mention workaround.
+
+2011-02-11  Bruno Haible  <bruno@clisp.org>
+
+       Tests for module 'setlocale'.
+       * modules/setlocale-tests: New file.
+       * tests/test-setlocale1.sh: New file.
+       * tests/test-setlocale1.c: New file.
+
+       New module 'setlocale'.
+       * lib/locale.in.h (setlocale): New declaration.
+       * lib/setlocale.c: New file, based on
+       gettext/gettext-runtime/intl/setlocale.c.
+       * m4/setlocale.m4: New file.
+       * m4/locale_h.m4 (gl_LOCALE_H): Test whether setlocale is declared.
+       (gl_LOCALE_H_DEFAULTS): Initialize GNULIB_SETLOCALE, REPLACE_SETLOCALE.
+       * modules/locale (Makefile.am): Substitute GNULIB_SETLOCALE,
+       REPLACE_SETLOCALE.
+       * modules/setlocale: New file.
+       * tests/test-locale-c++.cc: Test the declaration of setlocale.
+       * doc/posix-functions/setlocale.texi: Mention the new module.
+
+2011-02-11  Bruno Haible  <bruno@clisp.org>
+
+       Prepare for locale dependent tests on mingw.
+       * m4/locale-ar.m4 (gt_LOCALE_AR): On native Windows, don't try "ar"
+       because it has the wrong locale encoding.
+       * m4/locale-fr.m4 (gt_LOCALE_FR): On native Windows, try
+       French_France.1252 instead of "fr".
+       (gt_LOCALE_FR_UTF8): On native Windows, try French_France.65001.
+       * m4/locale-ja.m4 (gt_LOCALE_JA): On native Windows, don't try "ja"
+       because it has the wrong locale encoding.
+       * m4/locale-tr.m4 (gt_LOCALE_TR_UTF8): Require AC_CANONICAL_HOST. On
+       native Windows, try Turkish_Turkey.65001.
+       * m4/locale-zh.m4 (gt_LOCALE_ZH_CN): On native Windows, try
+       Chinese_China.54936.
+
+       Prepare for locale dependent tests on mingw.
+       * m4/locale-ar.m4 (gt_LOCALE_AR): On native Windows, call setlocale
+       differently.
+       * m4/locale-fr.m4 (gt_LOCALE_FR, gt_LOCALE_FR_UTF8): Likewise.
+       * m4/locale-ja.m4 (gt_LOCALE_JA): Likewise.
+       * m4/locale-tr.m4 (gt_LOCALE_TR_UTF8): Likewise.
+       * m4/locale-zh.m4 (gt_LOCALE_ZH_CN): Likewise.
+
+2011-02-11  Eric Blake  <eblake@redhat.com>
+
+       strptime: avoid compiler warnings
+       * lib/strptime.c (__strptime_internal) [!_NL_CURRENT]: Avoid
+       compiler warnings about dead code.
+       Reported by Daniel P. Berrange.
+
 2011-02-11  Thien-Thi Nguyen  <ttn@gnuvola.org>
 
        doc: update users.txt
 
 2011-01-23  Paul Eggert  <eggert@cs.ucla.edu>
 
-       Allow the user to avoid the GNULIB_TEST_* macros.
+       Allow the user to avoid the HAVE_RAW_DECL_* macros.
        * m4/gnulib-common.m4 (gl_ASSERT_NO_GNULIB_POSIXCHECK): New macro.
 
 2011-01-23  Bruno Haible  <bruno@clisp.org>
index c3bf4a9..c9bfc16 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,13 @@
-# Makefile for gnulib central.
+# GNU Makefile for gnulib central.
 # Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # in any medium, are permitted without royalty provided the copyright
 # notice and this notice are preserved.
 
+# This Makefile requires the use of GNU make.  Some targets require
+# that you have tools like git, makeinfo and cppi installed.
+
 # Produce some files that are not stored in the repository.
 all:
 
@@ -12,11 +15,12 @@ all:
 info html dvi pdf:
        cd doc && $(MAKE) $@ && $(MAKE) mostlyclean
 
+# Collect the names of rules starting with `sc_'.
+syntax-check-rules := $(sort $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p'\
+                       Makefile))
+
 # Perform some platform independent checks on the gnulib code.
-check: \
-  sc_prohibit_augmenting_PATH_via_TESTS_ENVIRONMENT                    \
-  sc_pragma_columns                                                    \
-  sc_prefer_ac_check_funcs_once
+check: $(syntax-check-rules)
 
 sc_prefer_ac_check_funcs_once:
        if test -d .git; then                                           \
@@ -45,6 +49,16 @@ sc_pragma_columns:
                 exit 1; } || :;                                        \
        else :; fi
 
+# Verify that certain (for now, only Jim Meyering and Eric Blake's)
+# *.c files are consistently cpp indented.
+sc_cpp_indent_check:
+       ./gnulib-tool --extract-filelist \
+            $$(cd ./modules; grep -ilrE '(meyering|blake)' .) \
+          | sort -u \
+          | grep '\.c$$' \
+          | grep -v '/getloadavg\.c$$' \
+          | xargs cppi -c
+
 # Regenerate some files that are stored in the repository.
 regen: MODULES.html
 
diff --git a/NEWS b/NEWS
index 13197f7..767d0ab 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,37 @@ User visible incompatible changes
 
 Date        Modules         Changes
 
+2011-03-08  regex-quote     The last argument is no longer an 'int cflags'
+                            but instead a pointer to a previously constructed
+                            'struct regex_quote_spec'.
+
+2011-02-25  dirname         These modules no longer put #defines for the
+            dirname-lgpl    following symbols into <config.h>: ISSLASH,
+            backupfile      FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX,
+            lstat           FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR,
+            openat          FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE.
+            remove          Applications that need ISSLASH can include the new
+            rmdir           header dosname.h.
+            savewd
+            stat
+            unlink
+
+2011-02-14  getloadavg      This module no longer #defines C_GETLOADAVG or
+                            HAVE_GETLOADAVG, as the application no longer needs
+                            to worry about how getloadavg is defined.  It no
+                            longer defines the obsolete symbol NLIST_NAME_UNION
+                            (which should have been internal to the module
+                            anyway).  Also, support for setgid use has been
+                            removed, as nobody seems to be using it; thus
+                            GETLOADAVG_PRIVILEGED is no longer #defined and
+                            KMEM_GROUP and NEED_SETGID are no longer
+                            substituted for.
+
+2011-02-08  stdlib          Unless the random_r module is also used, this
+                            module no longer guarantees that the following are
+                            defined: struct random_data, RAND_MAX, random_r,
+                            srandom_r, initstate_r, setstate_r.
+
 2011-02-08  wctype-h        This module no longer provides the iswblank()
                             function. If you need this function, you now need
                             to request the 'iswblank' module.
index e9ec11e..f004ad3 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2011-01-21.16; # UTC
+scriptversion=2011-03-03.12; # UTC
 
 # Bootstrap this package from checked-out sources.
 
@@ -874,7 +874,7 @@ grep -E '^[  ]*AC_CONFIG_HEADERS?\>' configure.ac >/dev/null ||
 
 for command in \
   libtool \
-  "${ACLOCAL-aclocal} --force -I m4 $ACLOCAL_FLAGS" \
+  "${ACLOCAL-aclocal} --force -I '$m4_base' $ACLOCAL_FLAGS" \
   "${AUTOCONF-autoconf} --force" \
   "${AUTOHEADER-autoheader} --force" \
   "${AUTOMAKE-automake} --add-missing --copy --force-missing"
@@ -885,7 +885,7 @@ do
     command="${LIBTOOLIZE-libtoolize} -c -f"
   fi
   echo "$0: $command ..."
-  $command || exit
+  eval "$command" || exit
 done
 
 
index 0e87769..8bd7f5d 100755 (executable)
@@ -57,13 +57,6 @@ else
     aix*)
       wl='-Wl,'
       ;;
-    darwin*)
-      case $cc_basename in
-        xlc*)
-          wl='-Wl,'
-          ;;
-      esac
-      ;;
     mingw* | cygwin* | pw32* | os2* | cegcc*)
       ;;
     hpux9* | hpux10* | hpux11*)
@@ -72,9 +65,7 @@ else
     irix5* | irix6* | nonstopux*)
       wl='-Wl,'
       ;;
-    newsos6)
-      ;;
-    linux* | k*bsd*-gnu)
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
       case $cc_basename in
         ecc*)
           wl='-Wl,'
@@ -85,17 +76,26 @@ else
         lf95*)
           wl='-Wl,'
           ;;
-        pgcc | pgf77 | pgf90)
+        nagfor*)
+          wl='-Wl,-Wl,,'
+          ;;
+        pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
           wl='-Wl,'
           ;;
         ccc*)
           wl='-Wl,'
           ;;
+        xl* | bgxl* | bgf* | mpixl*)
+          wl='-Wl,'
+          ;;
         como)
           wl='-lopt='
           ;;
         *)
           case `$CC -V 2>&1 | sed 5q` in
+            *Sun\ F* | *Sun*Fortran*)
+              wl=
+              ;;
             *Sun\ C*)
               wl='-Wl,'
               ;;
@@ -103,13 +103,24 @@ else
           ;;
       esac
       ;;
+    newsos6)
+      ;;
+    *nto* | *qnx*)
+      ;;
     osf3* | osf4* | osf5*)
       wl='-Wl,'
       ;;
     rdos*)
       ;;
     solaris*)
-      wl='-Wl,'
+      case $cc_basename in
+        f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+          wl='-Qoption ld '
+          ;;
+        *)
+          wl='-Wl,'
+          ;;
+      esac
       ;;
     sunos4*)
       wl='-Qoption ld '
@@ -171,15 +182,14 @@ if test "$with_gnu_ld" = yes; then
       fi
       ;;
     amigaos*)
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_minus_L=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 cannot use
-      # them.
-      ld_shlibs=no
+      case "$host_cpu" in
+        powerpc)
+          ;;
+        m68k)
+          hardcode_libdir_flag_spec='-L$libdir'
+          hardcode_minus_L=yes
+          ;;
+      esac
       ;;
     beos*)
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
@@ -198,11 +208,13 @@ if test "$with_gnu_ld" = yes; then
         ld_shlibs=no
       fi
       ;;
+    haiku*)
+      ;;
     interix[3-9]*)
       hardcode_direct=no
       hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
       ;;
-    gnu* | linux* | k*bsd*-gnu)
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
         :
       else
@@ -325,10 +337,14 @@ else
       fi
       ;;
     amigaos*)
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_minus_L=yes
-      # see comment about different semantics on the GNU ld section
-      ld_shlibs=no
+      case "$host_cpu" in
+        powerpc)
+          ;;
+        m68k)
+          hardcode_libdir_flag_spec='-L$libdir'
+          hardcode_minus_L=yes
+          ;;
+      esac
       ;;
     bsdi[45]*)
       ;;
@@ -342,16 +358,10 @@ else
       ;;
     darwin* | rhapsody*)
       hardcode_direct=no
-      if test "$GCC" = yes ; then
+      if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then
         :
       else
-        case $cc_basename in
-          xlc*)
-            ;;
-          *)
-            ld_shlibs=no
-            ;;
-        esac
+        ld_shlibs=no
       fi
       ;;
     dgux*)
@@ -417,6 +427,8 @@ else
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
       hardcode_libdir_separator=:
       ;;
+    *nto* | *qnx*)
+      ;;
     openbsd*)
       if test -f /usr/libexec/ld.so; then
         hardcode_direct=yes
@@ -512,7 +524,12 @@ case "$host_os" in
     library_names_spec='$libname$shrext'
     ;;
   amigaos*)
-    library_names_spec='$libname.a'
+    case "$host_cpu" in
+      powerpc*)
+        library_names_spec='$libname$shrext' ;;
+      m68k)
+        library_names_spec='$libname.a' ;;
+    esac
     ;;
   beos*)
     library_names_spec='$libname$shrext'
@@ -542,6 +559,9 @@ case "$host_os" in
   gnu*)
     library_names_spec='$libname$shrext'
     ;;
+  haiku*)
+    library_names_spec='$libname$shrext'
+    ;;
   hpux9* | hpux10* | hpux11*)
     case $host_cpu in
       ia64*)
@@ -577,7 +597,7 @@ case "$host_os" in
     ;;
   linux*oldld* | linux*aout* | linux*coff*)
     ;;
-  linux* | k*bsd*-gnu)
+  linux* | k*bsd*-gnu | kopensolaris*-gnu)
     library_names_spec='$libname$shrext'
     ;;
   knetbsd*-gnu)
@@ -589,7 +609,7 @@ case "$host_os" in
   newsos6)
     library_names_spec='$libname$shrext'
     ;;
-  nto-qnx*)
+  *nto* | *qnx*)
     library_names_spec='$libname$shrext'
     ;;
   openbsd*)
@@ -620,6 +640,9 @@ case "$host_os" in
   sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
     library_names_spec='$libname$shrext'
     ;;
+  tpf*)
+    library_names_spec='$libname$shrext'
+    ;;
   uts4*)
     library_names_spec='$libname$shrext'
     ;;
index 83da356..18b17aa 100755 (executable)
@@ -4,7 +4,7 @@
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
 #   2011 Free Software Foundation, Inc.
 
-timestamp='2011-02-02'
+timestamp='2011-03-23'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -76,7 +76,7 @@ version="\
 GNU config.sub ($timestamp)
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
 Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
@@ -288,7 +288,7 @@ case $basic_machine in
        | ns16k | ns32k \
        | or32 \
        | pdp10 | pdp11 | pj | pjl \
-       | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+       | powerpc | powerpc64 | powerpc64le | powerpcle \
        | pyramid \
        | rx \
        | score \
@@ -296,12 +296,12 @@ case $basic_machine in
        | sh64 | sh64le \
        | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
        | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-       | spu | strongarm \
-       | tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+       | spu \
+       | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
        | ubicom32 \
        | v850 | v850e \
        | we32k \
-       | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+       | x86 | xc16x | xstormy16 | xtensa \
        | z8k | z80)
                basic_machine=$basic_machine-unknown
                ;;
@@ -325,6 +325,18 @@ case $basic_machine in
                basic_machine=mt-unknown
                ;;
 
+       strongarm | thumb | xscale)
+               basic_machine=arm-unknown
+               ;;
+
+       xscaleeb)
+               basic_machine=armeb-unknown
+               ;;
+
+       xscaleel)
+               basic_machine=armel-unknown
+               ;;
+
        # We use `pc' rather than `unknown'
        # because (1) that's what they normally are, and
        # (2) the word "unknown" tends to confuse beginning users.
@@ -384,22 +396,22 @@ case $basic_machine in
        | none-* | np1-* | ns16k-* | ns32k-* \
        | orion-* \
        | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
        | pyramid-* \
        | 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-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+       | tahoe-* \
        | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
        | tile-* | tilegx-* \
        | tron-* \
        | ubicom32-* \
        | v850-* | v850e-* | vax-* \
        | we32k-* \
-       | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+       | x86-* | x86_64-* | xc16x-* | xps100-* \
        | xstormy16-* | xtensa*-* \
        | ymp-* \
        | z8k-* | z80-*)
@@ -950,9 +962,10 @@ case $basic_machine in
                ;;
        power)  basic_machine=power-ibm
                ;;
-       ppc)    basic_machine=powerpc-unknown
+       ppc | ppcbe)    basic_machine=powerpc-unknown
                ;;
-       ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+       ppc-* | ppcbe-*)
+               basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
        ppcle | powerpclittle | ppc-le | powerpc-little)
                basic_machine=powerpcle-unknown
@@ -1046,6 +1059,9 @@ case $basic_machine in
                basic_machine=i860-stratus
                os=-sysv4
                ;;
+       strongarm-* | thumb-*)
+               basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
        sun2)
                basic_machine=m68000-sun
                ;;
@@ -1178,6 +1194,9 @@ case $basic_machine in
        xps | xps100)
                basic_machine=xps100-honeywell
                ;;
+       xscale-* | xscalee[bl]-*)
+               basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+               ;;
        ymp)
                basic_machine=ymp-cray
                os=-unicos
index 68c7d64..686f703 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Print a version string.
-scriptversion=2011-01-04.17; # UTC
+scriptversion=2011-02-19.19; # UTC
 
 # Copyright (C) 2007-2011 Free Software Foundation, Inc.
 #
@@ -80,6 +80,7 @@ nl='
 
 # Avoid meddling by environment variable of the same name.
 v=
+v_from_git=
 
 # First see if there is a tarball-only version file.
 # then try "git describe", then default.
@@ -134,24 +135,30 @@ then
     # Change the first '-' to a '.', so version-comparing tools work properly.
     # Remove the "g" in git describe's output string, to save a byte.
     v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
+    v_from_git=1
 else
     v=UNKNOWN
 fi
 
 v=`echo "$v" |sed 's/^v//'`
 
-# Don't declare a version "dirty" merely because a time stamp has changed.
-git update-index --refresh > /dev/null 2>&1
+# Test whether to append the "-dirty" suffix only if the version
+# string we're using came from git.  I.e., skip the test if it's "UNKNOWN"
+# or if it came from .tarball-version.
+if test -n "$v_from_git"; then
+  # Don't declare a version "dirty" merely because a time stamp has changed.
+  git update-index --refresh > /dev/null 2>&1
 
-dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty=
-case "$dirty" in
-    '') ;;
-    *) # Append the suffix only if there isn't one already.
-        case $v in
-          *-dirty) ;;
-          *) v="$v-dirty" ;;
-        esac ;;
-esac
+  dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty=
+  case "$dirty" in
+      '') ;;
+      *) # Append the suffix only if there isn't one already.
+          case $v in
+            *-dirty) ;;
+            *) v="$v-dirty" ;;
+          esac ;;
+  esac
+fi
 
 # Omit the trailing newline, so that m4_esyscmd can use the result directly.
 echo "$v" | tr -d "$nl"
index 1fe8a18..7b94389 100644 (file)
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2011-02-07.16}
+\def\texinfoversion{2011-02-24.09}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
 \def\spaceisspace{\catcode`\ =\spacecat}
 
 % sometimes characters are active, so we need control sequences.
+\chardef\ampChar   = `\&
 \chardef\colonChar = `\:
 \chardef\commaChar = `\,
 \chardef\dashChar  = `\-
   \tracingmacros2
   \tracingrestores1
   \showboxbreadth\maxdimen \showboxdepth\maxdimen
-  \ifx\eTeXversion\undefined\else % etex gives us more logging
+  \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
     \tracingscantokens1
     \tracingifs1
     \tracinggroups1
 }
 \def\inenvironment#1{%
   \ifx#1\empty
-    out of any environment%
+    outside of any environment%
   \else
     in environment \expandafter\string#1%
   \fi
   \else\ifx\temp\offword \plainnonfrenchspacing
   \else
     \errhelp = \EMsimple
-    \errmessage{Unknown @frenchspacing option `\temp', must be on/off}%
+    \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
   \fi\fi
 }
 
@@ -1081,9 +1082,8 @@ where each line of input produces a line of output.}
 \newif\ifpdfmakepagedest
 
 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
-% can be set).  So we test for \relax and 0 as well as \undefined,
-% borrowed from ifpdf.sty.
-\ifx\pdfoutput\undefined
+% can be set).  So we test for \relax and 0 as well as being undefined.
+\ifx\pdfoutput\thisisundefined
 \else
   \ifx\pdfoutput\relax
   \else
@@ -1515,7 +1515,7 @@ output) for that.)}
 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
 % (\pdffontattr was introduced many years ago, but people still run
 % older pdftex's; it's easy to conditionalize, so we do.)
-\ifpdf \ifx\pdffontattr\undefined \else
+\ifpdf \ifx\pdffontattr\thisisundefined \else
   \begingroup
     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
@@ -1782,7 +1782,7 @@ end
 % Use cm as the default font prefix.
 % To specify the font prefix, you must define \fontprefix
 % before you read in texinfo.tex.
-\ifx\fontprefix\undefined
+\ifx\fontprefix\thisisundefined
 \def\fontprefix{cm}
 \fi
 % Support font families that don't use the same naming scheme as CM.
@@ -2296,12 +2296,11 @@ end
 
 \let\markupsetuplqkbd \markupsetnoligaturesquoteleft
 
-% Allow an option to not replace quotes with a regular directed right
-% quote/apostrophe (char 0x27), but instead use the undirected quote
-% from cmtt (char 0x0d).  The undirected quote is ugly, so don't make it
-% the default, but it works for pasting with more pdf viewers (at least
-% evince), the lilypond developers report.  xpdf does work with the
-% regular 0x27.
+% Allow an option to not use regular directed right quote/apostrophe
+% (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
+% The undirected quote is ugly, so don't make it the default, but it
+% works for pasting with more pdf viewers (at least evince), the
+% lilypond developers report.  xpdf does work with the regular 0x27.
 %
 \def\codequoteright{%
   \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
@@ -2325,6 +2324,36 @@ end
   \else \char'22 \fi
 }
 
+% Commands to set the quote options.
+% 
+\parseargdef\codequoteundirected{%
+  \def\temp{#1}%
+  \ifx\temp\onword
+    \expandafter\let\csname SETtxicodequoteundirected\endcsname
+      = t%
+  \else\ifx\temp\offword
+    \expandafter\let\csname SETtxicodequoteundirected\endcsname
+      = \relax
+  \else
+    \errhelp = \EMsimple
+    \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
+  \fi\fi
+}
+%
+\parseargdef\codequotebacktick{%
+  \def\temp{#1}%
+  \ifx\temp\onword
+    \expandafter\let\csname SETtxicodequotebacktick\endcsname
+      = t%
+  \else\ifx\temp\offword
+    \expandafter\let\csname SETtxicodequotebacktick\endcsname
+      = \relax
+  \else
+    \errhelp = \EMsimple
+    \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
+  \fi\fi
+}
+
 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
 \def\noligaturesquoteleft{\relax\lq}
 
@@ -2491,22 +2520,8 @@ end
     \codex
   }
 }
-% Handle @url similarly to \code, but allows line breaks after .#?/ (only).
-{
-  \catcode`\.=\active \catcode`\#=\active
-  \catcode`\?=\active \catcode`\/=\active
-  %
-  \global\def\urefcode{\begingroup
-    \setupmarkupstyle{code}%
-    \catcode\dotChar=\active   \catcode\hashChar=\active
-    \catcode\questChar=\active \catcode\slashChar=\active
-    \let.\urefcodedot
-    \let#\urefcodehash
-    \let?\urefcodequestion
-    \let/\urefcodeslash
-    \codex
-  }
-}
+
+\def\codex #1{\tclose{#1}\endgroup}
 
 \def\realdash{-}
 \def\codedash{-\discretionary{}{}{}}
@@ -2521,25 +2536,6 @@ end
              \discretionary{}{}{}}%
             {\_}%
 }
-% we put a little stretch before and after the breakable chars, to help
-% line breaking of long url's.  The unequal skips make look better in
-% cmtt at least, especially for dots.
-\def\urefprestretch{\nobreak \hskip0pt plus.13em }
-\def\urefpoststretch{\allowbreak \hskip0pt plus.1em }
-\def\urefcodedot{\urefprestretch .\urefpoststretch}
-\def\urefcodehash{\urefprestretch \#\urefpoststretch}
-\def\urefcodequestion{\urefprestretch ?\urefpoststretch}
-\def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
-{
-  \catcode`\/=\active
-  \global\def\urefcodeslashfinish{%
-    \urefprestretch \slashChar
-    % Allow line break only after the final / in a sequence of
-    % slashes, to avoid line break between the slashes in http://.
-    \ifx\next/\else \urefpoststretch \fi
-  }
-}
-\def\codex #1{\tclose{#1}\endgroup}
 
 % An additional complication: the above will allow breaks after, e.g.,
 % each of the four underscores in __typeof__.  This is undesirable in
@@ -2559,63 +2555,18 @@ end
     \allowcodebreaksfalse
   \else
     \errhelp = \EMsimple
-    \errmessage{Unknown @allowcodebreaks option `\txiarg'}%
+    \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
   \fi\fi
 }
 
-% @kbd is like @code, except that if the argument is just one @key command,
-% then @kbd has no effect.
-\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}}
-
-% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
-%   `example' (@kbd uses ttsl only inside of @example and friends),
-%   or `code' (@kbd uses normal tty font always).
-\parseargdef\kbdinputstyle{%
-  \def\txiarg{#1}%
-  \ifx\txiarg\worddistinct
-    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
-  \else\ifx\txiarg\wordexample
-    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
-  \else\ifx\txiarg\wordcode
-    \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
-  \else
-    \errhelp = \EMsimple
-    \errmessage{Unknown @kbdinputstyle option `\txiarg'}%
-  \fi\fi\fi
-}
-\def\worddistinct{distinct}
-\def\wordexample{example}
-\def\wordcode{code}
-
-% Default is `distinct'.
-\kbdinputstyle distinct
-
-\def\xkey{\key}
-\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
-\ifx\one\xkey\ifx\threex\three \key{#2}%
-\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
-\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi}
-
-% For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
-\let\indicateurl=\code
-\let\env=\code
-\let\command=\code
-
-% @clicksequence{File @click{} Open ...}
-\def\clicksequence#1{\begingroup #1\endgroup}
-
-% @clickstyle @arrow   (by default)
-\parseargdef\clickstyle{\def\click{#1}}
-\def\click{\arrow}
-
 % @uref (abbreviation for `urlref') takes an optional (comma-separated)
 % second argument specifying the text to display and an optional third
 % arg as text to display instead of (rather than in addition to) the url
-% itself.  First (mandatory) arg is the url.  Perhaps eventually put in
-% a hypertex \special here.
-%
-\def\uref#1{\douref #1,,,\finish}
-\def\douref#1,#2,#3,#4\finish{\begingroup
+% itself.  First (mandatory) arg is the url.
+% (This \urefnobreak definition isn't used now, leaving it for a while
+% for comparison.)
+\def\urefnobreak#1{\dourefnobreak #1,,,\finish}
+\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup
   \unsepspaces
   \pdfurl{#1}%
   \setbox0 = \hbox{\ignorespaces #3}%
@@ -2636,7 +2587,11 @@ end
   \endlink
 \endgroup}
 
-\def\nouref#1,#2,#3,#4\finish{\begingroup  % doesn't work in @example
+% This \urefbreak definition is the active one.
+\def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
+\let\uref=\urefbreak
+\def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
+\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
   \unsepspaces
   \pdfurl{#1}%
   \setbox0 = \hbox{\ignorespaces #3}%
@@ -2648,18 +2603,87 @@ end
       \ifpdf
         \unhbox0             % PDF: 2nd arg given, show only it
       \else
-        % \empty at the end of \scantokens arg gets rid of
-        % trailing newline (and ultimate spurious whitespace).
-        \unhbox0\ (\urefcode{\scantokens{#1\empty}})% DVI: 2nd arg given,
-                                                    % show both it and url
+        \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url
       \fi
     \else
-      \urefcode{\scantokens{#1\empty}}% only url given, so show it
+      \urefcode{#1}% only url given, so show it
     \fi
   \fi
   \endlink
 \endgroup}
 
+% Allow line breaks around only a few characters (only).
+\def\urefcatcodes{%
+  \catcode\ampChar=\active   \catcode\dotChar=\active
+  \catcode\hashChar=\active  \catcode\questChar=\active
+  \catcode\slashChar=\active
+}
+{
+  \urefcatcodes
+  %
+  \global\def\urefcode{\begingroup
+    \setupmarkupstyle{code}%
+    \urefcatcodes
+    \let&\urefcodeamp
+    \let.\urefcodedot
+    \let#\urefcodehash
+    \let?\urefcodequest
+    \let/\urefcodeslash
+    \codex
+  }
+  %
+  % By default, they are just regular characters.
+  \global\def&{\normalamp}
+  \global\def.{\normaldot}
+  \global\def#{\normalhash}
+  \global\def?{\normalquest}
+  \global\def/{\normalslash}
+}
+
+% we put a little stretch before and after the breakable chars, to help
+% line breaking of long url's.  The unequal skips make look better in
+% cmtt at least, especially for dots.
+\def\urefprestretch{\urefprebreak \hskip0pt plus.13em }
+\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em }
+%
+\def\urefcodeamp{\urefprestretch \&\urefpoststretch}
+\def\urefcodedot{\urefprestretch .\urefpoststretch}
+\def\urefcodehash{\urefprestretch \#\urefpoststretch}
+\def\urefcodequest{\urefprestretch ?\urefpoststretch}
+\def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
+{
+  \catcode`\/=\active
+  \global\def\urefcodeslashfinish{%
+    \urefprestretch \slashChar
+    % Allow line break only after the final / in a sequence of
+    % slashes, to avoid line break between the slashes in http://.
+    \ifx\next/\else \urefpoststretch \fi
+  }
+}
+
+% One more complication: by default we'll break after the special
+% characters, but some people like to break before the special chars, so
+% allow that.  Also allow no breaking at all, for manual control.
+% 
+\parseargdef\urefbreakstyle{%
+  \def\txiarg{#1}%
+  \ifx\txiarg\wordnone
+    \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
+  \else\ifx\txiarg\wordbefore
+    \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
+  \else\ifx\txiarg\wordafter
+    \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
+  \else
+    \errhelp = \EMsimple
+    \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
+  \fi\fi\fi
+}
+\def\wordafter{after}
+\def\wordbefore{before}
+\def\wordnone{none}
+
+\urefbreakstyle after
+
 % @url synonym for @uref, since that's how everyone uses it.
 %
 \let\url=\uref
@@ -2681,6 +2705,51 @@ end
   \let\email=\uref
 \fi
 
+% @kbd is like @code, except that if the argument is just one @key command,
+% then @kbd has no effect.
+\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}}
+
+% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
+%   `example' (@kbd uses ttsl only inside of @example and friends),
+%   or `code' (@kbd uses normal tty font always).
+\parseargdef\kbdinputstyle{%
+  \def\txiarg{#1}%
+  \ifx\txiarg\worddistinct
+    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
+  \else\ifx\txiarg\wordexample
+    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
+  \else\ifx\txiarg\wordcode
+    \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
+  \else
+    \errhelp = \EMsimple
+    \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
+  \fi\fi\fi
+}
+\def\worddistinct{distinct}
+\def\wordexample{example}
+\def\wordcode{code}
+
+% Default is `distinct'.
+\kbdinputstyle distinct
+
+\def\xkey{\key}
+\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
+\ifx\one\xkey\ifx\threex\three \key{#2}%
+\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
+\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi}
+
+% For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
+\let\indicateurl=\code
+\let\env=\code
+\let\command=\code
+
+% @clicksequence{File @click{} Open ...}
+\def\clicksequence#1{\begingroup #1\endgroup}
+
+% @clickstyle @arrow   (by default)
+\parseargdef\clickstyle{\def\click{#1}}
+\def\click{\arrow}
+
 % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
 %
@@ -3068,7 +3137,7 @@ end
 %  Textures 1.7.7 (preloaded format=plain 93.10.14)  (68K)  16 APR 2004 02:38
 % so we'll define it if necessary.
 %
-\ifx\Orb\undefined
+\ifx\Orb\thisisundefined
 \def\Orb{\mathhexbox20D}
 \fi
 
@@ -3343,7 +3412,7 @@ end
 % This produces Day Month Year style of output.
 % Only define if not already defined, in case a txi-??.tex file has set
 % up a different format (e.g., txi-cs.tex does this).
-\ifx\today\undefined
+\ifx\today\thisisundefined
 \def\today{%
   \number\day\space
   \ifcase\month
@@ -5677,6 +5746,8 @@ end
 %
 \def\sectionheading#1#2#3#4{%
   {%
+    \checkenv{}% should not be in an environment.
+    %
     % Switch to the right set of fonts.
     \csname #2fonts\endcsname \rmisbold
     %
@@ -6422,7 +6493,7 @@ end
 %
 \def\Equotation{%
   \par
-  \ifx\quotationauthor\undefined\else
+  \ifx\quotationauthor\thisisundefined\else
     % indent a bit.
     \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
   \fi
@@ -6957,7 +7028,7 @@ end
 
 % To do this right we need a feature of e-TeX, \scantokens,
 % which we arrange to emulate with a temporary file in ordinary TeX.
-\ifx\eTeXversion\undefined
+\ifx\eTeXversion\thisisundefined
   \newwrite\macscribble
   \def\scantokens#1{%
     \toks0={#1}%
@@ -7379,6 +7450,27 @@ end
   \fi
 }
 
+% @xrefautosectiontitle on|off says whether @section(ing) names are used
+% automatically in xrefs, if the third arg is not explicitly specified.
+% This was provided as a "secret" @set xref-automatic-section-title
+% variable, now it's official.
+% 
+\parseargdef\xrefautomaticsectiontitle{%
+  \def\temp{#1}%
+  \ifx\temp\onword
+    \expandafter\let\csname SETxref-automatic-section-title\endcsname
+      = \empty
+  \else\ifx\temp\offword
+    \expandafter\let\csname SETxref-automatic-section-title\endcsname
+      = \relax
+  \else
+    \errhelp = \EMsimple
+    \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
+                must be on|off}%
+  \fi\fi
+}
+
+
 % @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
 % the node name, #2 the name of the Info cross-reference, #3 the printed
 % node name, #4 the name of the Info file, #5 the name of the printed
@@ -7395,7 +7487,7 @@ end
   \setbox0=\hbox{\printedrefname\unskip}%
   \ifdim \wd0 = 0pt
     % No printed node name was explicitly given.
-    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
+    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
       % Use the node name inside the square brackets.
       \def\printedrefname{\ignorespaces #1}%
     \else
@@ -7865,7 +7957,7 @@ end
   it from ftp://tug.org/tex/epsf.tex.}
 %
 \def\image#1{%
-  \ifx\epsfbox\undefined
+  \ifx\epsfbox\thisiundefined
     \ifwarnednoepsf \else
       \errhelp = \noepsfhelp
       \errmessage{epsf.tex not found, images will be ignored}%
@@ -9305,24 +9397,15 @@ directory should work if nowhere else does.}
 \catcode`\^^? = 14
 
 % Define macros to output various characters with catcode for normal text.
-\catcode`\"=\other
-\catcode`\~=\other
-\catcode`\^=\other
-\catcode`\_=\other
-\catcode`\|=\other
-\catcode`\<=\other
-\catcode`\>=\other
-\catcode`\+=\other
-\catcode`\$=\other
-\def\normaldoublequote{"}
-\def\normaltilde{~}
-\def\normalcaret{^}
-\def\normalunderscore{_}
-\def\normalverticalbar{|}
-\def\normalless{<}
-\def\normalgreater{>}
-\def\normalplus{+}
-\def\normaldollar{$}%$ font-lock fix
+\catcode`\"=\other \def\normaldoublequote{"}
+\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
+\catcode`\+=\other \def\normalplus{+}
+\catcode`\<=\other \def\normalless{<}
+\catcode`\>=\other \def\normalgreater{>}
+\catcode`\^=\other \def\normalcaret{^}
+\catcode`\_=\other \def\normalunderscore{_}
+\catcode`\|=\other \def\normalverticalbar{|}
+\catcode`\~=\other \def\normaltilde{~}
 
 % This macro is used to make a character print one way in \tt
 % (where it can probably be output as-is), and another way in other fonts,
@@ -9415,16 +9498,16 @@ directory should work if nowhere else does.}
 % the literal character `\'.
 %
 @def@normalturnoffactive{%
-  @let\=@normalbackslash
   @let"=@normaldoublequote
-  @let~=@normaltilde
+  @let$=@normaldollar %$ font-lock fix
+  @let+=@normalplus
+  @let<=@normalless
+  @let>=@normalgreater
+  @let\=@normalbackslash
   @let^=@normalcaret
   @let_=@normalunderscore
   @let|=@normalverticalbar
-  @let<=@normalless
-  @let>=@normalgreater
-  @let+=@normalplus
-  @let$=@normaldollar %$ font-lock fix
+  @let~=@normaltilde
   @markupsetuplqdefault
   @markupsetuprqdefault
   @unsepspaces
@@ -9456,10 +9539,16 @@ directory should work if nowhere else does.}
 % Say @foo, not \foo, in error messages.
 @escapechar = `@@
 
+% These (along with & and #) are made active for url-breaking, so need
+% active definitions as the normal characters.
+@def@normaldot{.}
+@def@normalquest{?}
+@def@normalslash{/}
+
 % These look ok in all fonts, so just make them not special.
-@catcode`@& = @other
-@catcode`@# = @other
-@catcode`@% = @other
+@catcode`@& = @other @def@normalamp{&}
+@catcode`@# = @other @def@normalhash{#}
+@catcode`@% = @other @def@normalpercent{%}
 
 @c Finally, make ` and ' active, so that txicodequoteundirected and
 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}.  If we
index ccce0be..0c55724 100644 (file)
@@ -3,12 +3,6 @@
 <!--#include virtual="/server/banner.html" -->
 <h2>%%TITLE%%</h2>
 
-<!-- This document is in XML, and xhtml 1.0 -->
-<!-- Please make sure to properly nest your tags -->
-<!-- and ensure that your final document validates -->
-<!-- consistent with W3C xhtml 1.0 and CSS standards -->
-<!-- See validator.w3.org -->
-
 <address>Free Software Foundation</address>
 <address>last updated %%DATE%%</address>
 
@@ -66,29 +60,28 @@ this helps support FSF activities.</p>
 <p>(This page generated by the <a href="%%SCRIPTURL%%">%%SCRIPTNAME%%
 script</a>.)</p>
 
-<!-- If needed, change the copyright block at the bottom. In general, -->
-<!-- all pages on the GNU web server should have the section about    -->
-<!-- verbatim copying.  Please do NOT remove this without talking     -->
-<!-- with the webmasters first. -->
-<!-- Please make sure the copyright date is consistent with the document -->
-<!-- and that it is like this "2001, 2002" not this "2001-2002." -->
+<!-- If needed, change the copyright block at the bottom. In general,
+     all pages on the GNU web server should have the section about
+     verbatim copying.  Please do NOT remove this without talking
+     with the webmasters first.
+     Please make sure the copyright date is consistent with the document
+     and that it is like this: "2001, 2002", not this: "2001-2002". -->
 </div><!-- for id="content", starts in the include above -->
 <!--#include virtual="/server/footer.html" -->
 <div id="footer">
 
-<p>
-Please send FSF &amp; GNU inquiries to
+<p>Please send general FSF &amp; GNU inquiries to
 <a href="mailto:gnu@gnu.org">&lt;gnu@gnu.org&gt;</a>.
 There are also <a href="/contact/">other ways to contact</a>
 the FSF.<br />
 Please send broken links and other corrections or suggestions to
-<a href="mailto:%%EMAIL%%">&lt;%%EMAIL%%&gt;</a>.
-</p>
+<a href="mailto:%%EMAIL%%">&lt;%%EMAIL%%&gt;</a>.</p>
 
-<p>Copyright &copy; 2010 Free Software Foundation, Inc.</p>
+<p>Copyright &copy; 2011 Free Software Foundation, Inc.</p>
 
-<p>Verbatim copying and distribution of this entire article is
-permitted in any medium, provided this notice is preserved.</p>
+<p>Verbatim copying and distribution of this entire article are
+permitted worldwide, without royalty, in any medium, provided this
+notice, and the copyright notice, are preserved.</p>
 
 </div>
 </div>
index a541284..109487a 100644 (file)
 <link rev="made" href="webmasters@gnu.org" />
 </head>
 
-<!-- This document is in XML, and xhtml 1.0 -->
-<!-- Please make sure to properly nest your tags -->
-<!-- and ensure that your final document validates -->
-<!-- consistent with W3C xhtml 1.0 and CSS standards -->
-<!-- See validator.w3.org -->
-
 <body>
 
 <h3>%%TITLE%%</h3>
 <p>(This page generated by the <a href="%%SCRIPTURL%%">%%SCRIPTNAME%%
 script</a>.)</p>
 
-<div class="copyright">
-<p>
-Please send FSF &amp; GNU inquiries to
+<div id="footer" class="copyright">
+
+<p>Please send general FSF &amp; GNU inquiries to
 <a href="mailto:gnu@gnu.org">&lt;gnu@gnu.org&gt;</a>.
 There are also <a href="/contact/">other ways to contact</a>
 the FSF.<br />
-Please send broken links and other corrections (or suggestions) to
-<a href="mailto:%%EMAIL%%">&lt;%%EMAIL%%&gt;</a>.
-</p>
+Please send broken links and other corrections or suggestions to
+<a href="mailto:%%EMAIL%%">&lt;%%EMAIL%%&gt;</a>.</p>
 
-<p>Copyright &copy; 2010 Free Software Foundation, Inc.</p>
+<p>Copyright &copy; 2011 Free Software Foundation, Inc.</p>
 
-<p>Verbatim copying and distribution of this entire article is
-permitted in any medium, provided this notice is preserved.</p>
+<p>Verbatim copying and distribution of this entire article are
+permitted worldwide, without royalty, in any medium, provided this
+notice, and the copyright notice, are preserved.</p>
 
 </div>
-
 </body>
 </html>
index df166f1..652257a 100644 (file)
@@ -8,7 +8,7 @@ Portability problems fixed by Gnulib:
 @itemize
 @item
 This function is missing on some platforms:
-AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Cygwin, mingw, Interix 3.5, BeOS.
+AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 2.6, Cygwin, mingw, Interix 3.5, BeOS.
 @item
 This function is declared in @code{<sys/loadavg.h>}, not @code{<stdlib.h>},
 on some platforms:
index a483d03..8e38c38 100644 (file)
@@ -483,6 +483,14 @@ it means that a new GNU gettext release was made, and its autoconf macros
 were integrated into Gnulib and now mismatch the @file{po/} infrastructure.
 In this case, fetch and install the new GNU gettext release and run
 @code{gettextize} followed by @code{gnulib-tool}.
+
+@item
+When you invoke @code{autoreconf} after @code{gnulib-tool}, make sure to
+not invoke @code{autopoint} a second time, by setting the @code{AUTOPOINT}
+environment variable, like this:
+@smallexample
+$ env AUTOPOINT=true autoreconf --install
+@end smallexample
 @end enumerate
 
 
index 1578f21..a95ca7f 100644 (file)
@@ -11,11 +11,11 @@ Portability problems fixed by Gnulib:
 @item
 This function is missing on some platforms:
 HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 7, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
+@item
+On Windows, this function is declared in @code{<ws2tcpip.h>} rather than in
+@code{<netdb.h>}.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-On Windows, this function is declared in @code{<ws2tcpip.h>} rather than in
-@code{<netdb.h>}.
 @end itemize
index 1e90906..2359480 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/mbtowc.html}
 
-Gnulib module: ---
+Gnulib module: mbtowc
 
 Portability problems fixed by Gnulib:
 @itemize
index 2ff4e16..12a9dc7 100644 (file)
@@ -16,6 +16,19 @@ mingw.
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+It is not portable to call @code{realloc} with a size of 0.  With a
+NULL pointer argument, this is the same ambiguity as @code{malloc (0)}
+on whether a unique zero-size object is created.  With a non-NULL
+pointer argument, C99 requires that if @code{realloc (p, 0)} returns
+@code{NULL} then @code{p} is still valid.  Among implementations that
+obey C99, behavior varies on whether @code{realloc (p, 0)} always
+fails and leaves @code{p} valid, or usually succeeds and returns a
+unique zero-size object; either way, a program not suspecting these
+semantics will leak memory (either the still-valid @code{p}, or the
+non-NULL return value).  Meanwhile, several implementations violate
+C99, by always calling @code{free (p)} but returning NULL:
+glibc, Cygwin
 @end itemize
 
 Extension: Gnulib provides a module @samp{realloc-gnu} that substitutes a
index f722df0..c54018e 100644 (file)
@@ -4,10 +4,22 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/setlocale.html}
 
-Gnulib module: ---
+Gnulib module: setlocale
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+On Windows platforms (excluding Cygwin), @code{setlocale(@var{category},NULL)}
+ignores the environment variables @code{LC_ALL}, @code{@var{category}}, and
+@code{LANG}.
+@item
+On Windows platforms (excluding Cygwin), @code{setlocale(LC_ALL,@var{name})}
+succeeds and sets the LC_CTYPE category to @samp{C} when it does not support
+the encoding, instead of failing.
+@item
+On Windows platforms (excluding Cygwin), @code{setlocale} understands different
+locale names, that are not based on ISO 639 language names and ISO 3166 country
+names.
 @end itemize
 
 Portability problems not fixed by Gnulib:
@@ -15,7 +27,6 @@ Portability problems not fixed by Gnulib:
 @item
 On Cygwin 1.5.x, which doesn't have locales,
 @code{setlocale(LC_ALL,NULL)} always returns @code{"C"}.
-
 @item
 On Cygwin 1.7.0, only the charset portion of a locale designation is honored.
 @end itemize
index 9106cce..2f8cfce 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/wctomb.html}
 
-Gnulib module: ---
+Gnulib module: wctomb
 
 Portability problems fixed by Gnulib:
 @itemize
index dd152be..c53dcfb 100644 (file)
@@ -16,6 +16,10 @@ This header file is incomplete on some platforms:
 Cygwin 1.5.x, Haiku.
 
 @item
+This header file does not define the type @code{socklen_t} on some platforms:
+HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS.
+
+@item
 This header file does not define @code{AI_ALL}, @code{AI_V4MAPPED},
 @code{AI_ADDRCONFIG} on some platforms:
 NetBSD 5.0.
index 55e4ebf..a9c36df 100644 (file)
@@ -23,6 +23,10 @@ mingw.
 The values of @code{INT8_MAX}, @code{UINT8_MAX} etc. are not usable in
 preprocessor expressions on some platforms:
 HP-UX 11.23.
+@item
+The macros @code{WCHAR_MIN} and @code{WCHAR_MAX} are not defined in
+@code{<stdint.h>} (only in @code{<wchar.h>}) on some platforms:
+Dragonfly, BSDI.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index dc975b6..c8e4228 100644 (file)
@@ -14,6 +14,9 @@ mingw.
 This header file is not self-contained on some platforms: it requires
 @code{<sys/types.h>} to be included first.
 @item
+This header file does not define the type @code{socklen_t} on some platforms:
+HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS.
+@item
 This header file is lacking the @code{SHUT_RD}, @code{SHUT_WR},
 @code{SHUT_RDWR} macros on some platforms, despite having the @code{shutdown}
 functions:
index 8101989..1847370 100644 (file)
@@ -3,7 +3,7 @@
 @setfilename standards.info
 @settitle GNU Coding Standards
 @c This date is automagically updated when you save this file:
-@set lastupdate January 27, 2011
+@set lastupdate March 28, 2011
 @c %**end of header
 
 @dircategory GNU organization
@@ -50,8 +50,8 @@ Texts.  A copy of the license is included in the section entitled
 @contents
 
 @ifnottex
-@node Top, Preface, (dir), (dir)
-@top Version
+@node Top
+@top GNU Coding Standards
 
 @insertcopying
 @end ifnottex
@@ -701,7 +701,8 @@ fd = open (filename, O_WRONLY | O_CREAT | O_EXCL, 0600);
 @end example
 
 @noindent
-or by using the @code{mkstemps} function from libiberty.
+or by using the @code{mkstemps} function from Gnulib
+(@pxref{mkstemps,,, gnulib, Gnulib}).
 
 In bash, use @code{set -C} (long name @code{noclobber}) to avoid this
 problem.  In addition, the @code{mktemp} utility is a more general
@@ -2831,6 +2832,7 @@ GNU programs that have it, but there is no need to do this in new GNU
 programs.  @code{doschk} also reports file names longer than 14
 characters.
 
+
 @node System Portability
 @section Portability between System Types
 @cindex portability, between system types
@@ -2912,9 +2914,9 @@ printf ("diff = %ld\n", (long) (pointer2 - pointer1));
 @end example
 
 1989 Standard C requires this to work, and we know of only one
-counterexample: 64-bit programs on Microsoft Windows.  We will
-leave it to those who want to port GNU programs to that environment
-to figure out how to do it.
+counterexample: 64-bit programs on Microsoft Windows.  We will leave
+it to those who want to port GNU programs to that environment to
+figure out how to do it.
 
 Predefined file-size types like @code{off_t} are an exception: they are
 longer than @code{long} on many platforms, so code like the above won't
@@ -2945,51 +2947,6 @@ while ((c = getchar ()) != EOF)
   @}
 @end example
 
-It used to be ok to not worry about the difference between pointers
-and integers when passing arguments to functions.  However, on most
-modern 64-bit machines pointers are wider than @code{int}.
-Conversely, integer types like @code{long long int} and @code{off_t}
-are wider than pointers on most modern 32-bit machines.  Hence it's
-often better nowadays to use prototypes to define functions whose
-argument types are not trivial.
-
-In particular, if functions accept varying argument counts or types
-they should be declared using prototypes containing @samp{...} and
-defined using @file{stdarg.h}.  For an example of this, please see the
-@uref{http://www.gnu.org/software/gnulib/, Gnulib} error module, which
-declares and defines the following function:
-
-@example
-/* Print a message with `fprintf (stderr, FORMAT, ...)';
-   if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
-   If STATUS is nonzero, terminate the program with `exit (STATUS)'.  */
-
-void error (int status, int errnum, const char *format, ...);
-@end example
-
-A simple way to use the Gnulib error module is to obtain the two
-source files @file{error.c} and @file{error.h} from the Gnulib library
-source code repository at
-@uref{http://git.savannah.gnu.org/@/gitweb/@/?p=gnulib.git}.
-Here's a sample use:
-
-@example
-#include "error.h"
-#include <errno.h>
-#include <stdio.h>
-
-char *program_name = "myprogram";
-
-FILE *
-xfopen (char const *name)
-@{
-  FILE *fp = fopen (name, "r");
-  if (! fp)
-    error (1, errno, "cannot read %s", name);
-  return fp;
-@}
-@end example
-
 @cindex casting pointers to integers
 Avoid casting pointers to integers if you can.  Such casts greatly
 reduce portability, and in most programs they are easy to avoid.  In the
@@ -3000,133 +2957,75 @@ sizes.  You will also need to make provision for systems in which the
 normal range of addresses you can get from @code{malloc} starts far away
 from zero.
 
+
 @node System Functions
 @section Calling System Functions
+
+@cindex C library functions, and portability
+@cindex POSIX functions, and portability
 @cindex library functions, and portability
 @cindex portability, and library functions
 
-C implementations differ substantially.  Standard C reduces but does
-not eliminate the incompatibilities; meanwhile, many GNU packages still
-support pre-standard compilers because this is not hard to do.  This
-chapter gives recommendations for how to use the more-or-less standard C
-library functions to avoid unnecessary loss of portability.
-
-@itemize @bullet
-@item
-Don't use the return value of @code{sprintf}.  It returns the number of
-characters written on some systems, but not on all systems.
-
-@item
-Be aware that @code{vfprintf} is not always available.
-
-@item
-@code{main} should be declared to return type @code{int}.  It should
-terminate either by calling @code{exit} or by returning the integer
-status code; make sure it cannot ever return an undefined value.
-
-@cindex declaration for system functions
-@item
-Don't declare system functions explicitly.
-
-Almost any declaration for a system function is wrong on some system.
-To minimize conflicts, leave it to the system header files to declare
-system functions.  If the headers don't declare a function, let it
-remain undeclared.
-
-While it may seem unclean to use a function without declaring it, in
-practice this works fine for most system library functions on the
-systems where this really happens; thus, the disadvantage is only
-theoretical.  By contrast, actual declarations have frequently caused
-actual conflicts.
-
-@item
-If you must declare a system function, don't specify the argument types.
-Use an old-style declaration, not a Standard C prototype.  The more you
-specify about the function, the more likely a conflict.
-
-@item
-In particular, don't unconditionally declare @code{malloc} or
-@code{realloc}.
-
-Most GNU programs use those functions just once, in functions
-conventionally named @code{xmalloc} and @code{xrealloc}.  These
-functions call @code{malloc} and @code{realloc}, respectively, and
-check the results.
-
-Because @code{xmalloc} and @code{xrealloc} are defined in your program,
-you can declare them in other files without any risk of type conflict.
-
-On most systems, @code{int} is the same length as a pointer; thus, the
-calls to @code{malloc} and @code{realloc} work fine.  For the few
-exceptional systems (mostly 64-bit machines), you can use
-@strong{conditionalized} declarations of @code{malloc} and
-@code{realloc}---or put these declarations in configuration files
-specific to those systems.
-
-@cindex string library functions
-@item
-The string functions require special treatment.  Some Unix systems have
-a header file @file{string.h}; others have @file{strings.h}.  Neither
-file name is portable.  There are two things you can do: use Autoconf to
-figure out which file to include, or don't include either file.
-
-@item
-If you don't include either strings file, you can't get declarations for
-the string functions from the header file in the usual way.
-
-That causes less of a problem than you might think.  The newer standard
-string functions should be avoided anyway because many systems still
-don't support them.  The string functions you can use are these:
-
-@example
-strcpy   strncpy   strcat   strncat
-strlen   strcmp    strncmp
-strchr   strrchr
-@end example
-
-The copy and concatenate functions work fine without a declaration as
-long as you don't use their values.  Using their values without a
-declaration fails on systems where the width of a pointer differs from
-the width of @code{int}, and perhaps in other cases.  It is trivial to
-avoid using their values, so do that.
-
-The compare functions and @code{strlen} work fine without a declaration
-on most systems, possibly all the ones that GNU software runs on.
-You may find it necessary to declare them @strong{conditionally} on a
-few systems.
-
-The search functions must be declared to return @code{char *}.  Luckily,
-there is no variation in the data type they return.  But there is
-variation in their names.  Some systems give these functions the names
-@code{index} and @code{rindex}; other systems use the names
-@code{strchr} and @code{strrchr}.  Some systems support both pairs of
-names, but neither pair works on all systems.
-
-You should pick a single pair of names and use it throughout your
-program.  (Nowadays, it is better to choose @code{strchr} and
-@code{strrchr} for new programs, since those are the standard
-names.)  Declare both of those names as functions returning @code{char
-*}.  On systems which don't support those names, define them as macros
-in terms of the other pair.  For example, here is what to put at the
-beginning of your file (or in a header) if you want to use the names
-@code{strchr} and @code{strrchr} throughout:
-
-@example
-#ifndef HAVE_STRCHR
-#define strchr index
-#endif
-#ifndef HAVE_STRRCHR
-#define strrchr rindex
-#endif
+Historically, C implementations differed substantially, and many
+systems lacked a full implementation of ANSI/ISO C89.  Nowadays,
+however, very few systems lack a C89 compiler and GNU C supports
+almost all of C99.  Similarly, most systems implement POSIX.1-1993
+libraries and tools, and many have POSIX.1-2001.
+
+Hence, there is little reason to support old C or non-POSIX systems,
+and you may want to take advantage of C99 and POSIX-1.2001 to write
+clearer, more portable, or faster code.  You should use standard
+interfaces where possible; but if GNU extensions make your program
+more maintainable, powerful, or otherwise better, don't hesitate to
+use them.  In any case, don't make your own declaration of system
+functions; that's a recipe for conflict.
+
+Despite the standards, nearly every library function has some sort of
+portability issue on some system or another.  Here are some examples:
+
+@table @code
+@item open
+Names with trailing @code{/}'s are mishandled on many platforms.
+
+@item printf
+@code{long double} may be unimplemented; floating values Infinity and
+NaN are often mishandled; output for large precisions may be
+incorrect.
+
+@item readlink
+May return @code{int} instead of @code{ssize_t}.
+
+@item scanf
+On Windows, @code{errno} is not set on failure.
+@end table
 
-char *strchr ();
-char *strrchr ();
-@end example
-@end itemize
+@cindex Gnulib
+@uref{http://www.gnu.org/software/gnulib/, Gnulib} is a big help in
+this regard.  Gnulib provides implementations of standard interfaces
+on many of the systems that lack them, including portable
+implementations of enhanced GNU interfaces, thereby making their use
+portable, and of POSIX-1.2008 interfaces, some of which are missing
+even on up-to-date GNU systems.
+
+@findex xmalloc, in Gnulib
+@findex error messages, in Gnulib
+@findex data structures, in Gnulib
+Gnulib also provides many useful non-standard interfaces; for example,
+C implementations of standard data structures (hash tables, binary
+trees), error-checking type-safe wrappers for memory allocation
+functions (@code{xmalloc}, @code{xrealloc}), and output of error
+messages.
+
+Gnulib integrates with GNU Autoconf and Automake to remove much of the
+burden of writing portable code from the programmer: Gnulib makes your
+configure script automatically determine what features are missing and
+use the Gnulib code to supply the missing pieces.
+
+The Gnulib and Autoconf manuals have extensive sections on
+portability: @ref{Top,, Introduction, gnulib, Gnulib} and
+@pxref{Portable C and C++,,, autoconf, Autoconf}.  Please consult them
+for many more details.
 
-Here we assume that @code{HAVE_STRCHR} and @code{HAVE_STRRCHR} are
-macros defined in systems where the corresponding functions exist.
-One way to get them properly defined is to use Autoconf.
 
 @node Internationalization
 @section Internationalization
index 3cf697f..9461027 100755 (executable)
@@ -123,24 +123,12 @@ fi
 # outputs to stdout the --help usage message.
 func_usage ()
 {
-  # This use of bold display can be removed on 2011-01-01.
-  if case "$TERM" in
-       xterm*) test -t 1;;
-       *) false;;
-     esac; then
-    # Assume xterm compatible escape sequences.
-    bold_on=`printf '\x1b[1m'`
-    bold_off=`printf '\x1b[0m'`
-  else
-    bold_on=
-    bold_off=
-  fi
   echo "\
 Usage: gnulib-tool --list
-       gnulib-tool --find filename${bold_on}
+       gnulib-tool --find filename
        gnulib-tool --import [module1 ... moduleN]
        gnulib-tool --add-import [module1 ... moduleN]
-       gnulib-tool --remove-import [module1 ... moduleN]${bold_off}
+       gnulib-tool --remove-import [module1 ... moduleN]
        gnulib-tool --update
        gnulib-tool --create-testdir --dir=directory [module1 ... moduleN]
        gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
@@ -165,14 +153,14 @@ Usage: gnulib-tool --list
 Operation modes:
 
       --list                print the available module names
-      --find                find the modules which contain the specified file${bold_on}
+      --find                find the modules which contain the specified file
       --import              import the given modules into the current package
       --add-import          augment the list of imports from gnulib into the
                             current package, by adding the given modules;
                             if no modules are specified, update the current
                             package from the current gnulib
       --remove-import       reduce the list of imports from gnulib into the
-                            current package, by removing the given modules${bold_off}
+                            current package, by removing the given modules
       --update              update the current package, restore files omitted
                             from version control
       --create-testdir      create a scratch package with the given modules
index 3ce1585..5f6b020 100644 (file)
 #endif
 #if defined(HAVE_DECL_FEOF_UNLOCKED) && !HAVE_DECL_FEOF_UNLOCKED
 # define feof_unlocked(x) feof (x)
-# endif
+#endif
 #if defined(HAVE_DECL_FERROR_UNLOCKED) && !HAVE_DECL_FERROR_UNLOCKED
 # define ferror_unlocked(x) ferror (x)
-# endif
+#endif
 #if defined(HAVE_DECL_FFLUSH_UNLOCKED) && !HAVE_DECL_FFLUSH_UNLOCKED
 # define fflush_unlocked(x) fflush (x)
-# endif
+#endif
 #if defined(HAVE_DECL_FGETS_UNLOCKED) && !HAVE_DECL_FGETS_UNLOCKED
 # define fgets_unlocked(x,y,z) fgets (x,y,z)
-# endif
+#endif
 #if defined(HAVE_DECL_FPUTC_UNLOCKED) && !HAVE_DECL_FPUTC_UNLOCKED
 # define fputc_unlocked(x,y) fputc (x,y)
-# endif
+#endif
 #if defined(HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
 # define fputs_unlocked(x,y) fputs (x,y)
-# endif
+#endif
 #if defined(HAVE_DECL_FREAD_UNLOCKED) && !HAVE_DECL_FREAD_UNLOCKED
 # define fread_unlocked(w,x,y,z) fread (w,x,y,z)
-# endif
+#endif
 #if defined(HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED
 # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
-# endif
+#endif
 #if defined(HAVE_DECL_GETC_UNLOCKED) && !HAVE_DECL_GETC_UNLOCKED
 # define getc_unlocked(x) getc (x)
-# endif
+#endif
 #if defined(HAVE_DECL_GETCHAR_UNLOCKED) && !HAVE_DECL_GETCHAR_UNLOCKED
 #  define getchar_unlocked() getchar ()
-# endif
+#endif
 #if defined(HAVE_DECL_PUTC_UNLOCKED) && !HAVE_DECL_PUTC_UNLOCKED
 # define putc_unlocked(x,y) putc (x,y)
-# endif
+#endif
 #if defined(HAVE_DECL_PUTCHAR_UNLOCKED) && !HAVE_DECL_PUTCHAR_UNLOCKED
 # define putchar_unlocked(x) putchar (x)
-# endif
+#endif
 
 #endif /* !_LIBC */
 
 #ifndef __set_errno
-#define __set_errno(e) (errno = (e))
+# define __set_errno(e) (errno = (e))
 #endif
 
 #if defined GNULIB_ARGP_DISABLE_DIRNAME
index 6533c8f..80dcb84 100644 (file)
@@ -27,8 +27,8 @@
 # include <features.h> /* for __GLIBC__ */
 #endif
 
-/* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc
-   under MinGW.
+/* Gnulib's sys/socket.h is responsible for defining socklen_t (used below) and
+   for pulling in winsock2.h etc. under MinGW.
    But avoid namespace pollution on glibc systems.  */
 #ifndef __GLIBC__
 # include <sys/socket.h>
index 31a75f1..52868bc 100644 (file)
@@ -16,7 +16,7 @@
 
 /* written by Jim Meyering */
 
-#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+#include "dosname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
 #include "openat.h"
 #include "openat-priv.h"
 #include "save-cwd.h"
index 29e6772..da691fe 100644 (file)
@@ -25,7 +25,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+#include "dosname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
 #include "filenamecat.h"
 #include "openat.h"
 #include "same-inode.h"
index f089955..2ef9882 100644 (file)
 
 # include <stdbool.h>
 # include <stddef.h>
+# include "dosname.h"
 
 # ifndef DIRECTORY_SEPARATOR
 #  define DIRECTORY_SEPARATOR '/'
 # endif
 
-# ifndef ISSLASH
-#  define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
-# endif
-
-# ifndef FILE_SYSTEM_PREFIX_LEN
-#  if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
-    /* This internal macro assumes ASCII, but all hosts that support drive
-       letters use ASCII.  */
-#   define _IS_DRIVE_LETTER(c) (((unsigned int) (c) | ('a' - 'A')) - 'a' \
-                                <= 'z' - 'a')
-#   define FILE_SYSTEM_PREFIX_LEN(Filename) \
-           (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0)
-#  else
-#   define FILE_SYSTEM_PREFIX_LEN(Filename) 0
-#  endif
-# endif
-
-# ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
-#  define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
-# endif
-
 # ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT
 #  define DOUBLE_SLASH_IS_DISTINCT_ROOT 0
 # endif
 
-# if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
-#  define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)])
-# else
-#  define IS_ABSOLUTE_FILE_NAME(F) \
-          (ISSLASH ((F)[0]) || 0 < FILE_SYSTEM_PREFIX_LEN (F))
-# endif
-# define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F))
-
 # if GNULIB_DIRNAME
 char *base_name (char const *file);
 char *dir_name (char const *file);
diff --git a/lib/dosname.h b/lib/dosname.h
new file mode 100644 (file)
index 0000000..acdd03b
--- /dev/null
@@ -0,0 +1,53 @@
+/* File names on MS-DOS/Windows systems.
+
+   Copyright (C) 2000-2001, 2004-2006, 2009-2011 Free Software Foundation, Inc.
+
+   This 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/>.
+
+   From Paul Eggert and Jim Meyering.  */
+
+#ifndef _DOSNAME_H
+#define _DOSNAME_H
+
+#if (defined _WIN32 || defined __WIN32__ ||     \
+     defined __MSDOS__ || defined __CYGWIN__ || \
+     defined __EMX__ || defined __DJGPP__)
+   /* This internal macro assumes ASCII, but all hosts that support drive
+      letters use ASCII.  */
+# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a'  \
+                              <= 'z' - 'a')
+# define FILE_SYSTEM_PREFIX_LEN(Filename) \
+          (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0)
+# ifndef __CYGWIN__
+#  define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1
+# endif
+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
+#else
+# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
+# define ISSLASH(C) ((C) == '/')
+#endif
+
+#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
+# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
+#endif
+
+#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
+#  define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)])
+# else
+#  define IS_ABSOLUTE_FILE_NAME(F)                              \
+     (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0)
+#endif
+#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F))
+
+#endif /* DOSNAME_H_ */
index 60d3f76..2f87da6 100644 (file)
@@ -56,10 +56,10 @@ dup3 (int oldfd, int newfd, int flags)
         if (!(result < 0 && errno == ENOSYS))
           {
             have_dup3_really = 1;
-#if REPLACE_FCHDIR
+# if REPLACE_FCHDIR
             if (0 <= result)
               result = _gl_register_dup (oldfd, newfd);
-#endif
+# endif
             return result;
           }
         have_dup3_really = -1;
index 7b4100e..01b0881 100644 (file)
@@ -78,6 +78,6 @@ fbufmode (FILE *fp)
     return _IOLBF;
   return (fp->__bufsize > 0 ? _IOFBF : _IONBF);
 #else
- #error "Please port gnulib fbufmode.c to your platform! Look at the setvbuf implementation."
+error "Please port gnulib fbufmode.c to your platform! Look at the setvbuf implementation."
 #endif
 }
index 8884b97..303d0fd 100644 (file)
 static int
 local_lchownat (int fd, char const *file, uid_t owner, gid_t group);
 
-# define AT_FUNC_NAME local_lchownat
-# define AT_FUNC_F1 lchown
-# define AT_FUNC_POST_FILE_PARAM_DECLS , uid_t owner, gid_t group
-# define AT_FUNC_POST_FILE_ARGS        , owner, group
-# include "at-func.c"
-# undef AT_FUNC_NAME
-# undef AT_FUNC_F1
-# undef AT_FUNC_POST_FILE_PARAM_DECLS
-# undef AT_FUNC_POST_FILE_ARGS
+#  define AT_FUNC_NAME local_lchownat
+#  define AT_FUNC_F1 lchown
+#  define AT_FUNC_POST_FILE_PARAM_DECLS , uid_t owner, gid_t group
+#  define AT_FUNC_POST_FILE_ARGS        , owner, group
+#  include "at-func.c"
+#  undef AT_FUNC_NAME
+#  undef AT_FUNC_F1
+#  undef AT_FUNC_POST_FILE_PARAM_DECLS
+#  undef AT_FUNC_POST_FILE_ARGS
 
 # endif
 
index bdec6d4..8f018e5 100644 (file)
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 
 /* _get_osfhandle */
-#include <io.h>
+# include <io.h>
 
 /* LockFileEx */
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
 
-#include <errno.h>
+# include <errno.h>
 
 /* Determine the current size of a file.  Because the other braindead
  * APIs we'll call need lower/upper 32 bit pairs, keep the file size
@@ -47,9 +47,9 @@ file_size (HANDLE h, DWORD * lower, DWORD * upper)
 }
 
 /* LOCKFILE_FAIL_IMMEDIATELY is undefined on some Windows systems. */
-#ifndef LOCKFILE_FAIL_IMMEDIATELY
-# define LOCKFILE_FAIL_IMMEDIATELY 1
-#endif
+# ifndef LOCKFILE_FAIL_IMMEDIATELY
+#  define LOCKFILE_FAIL_IMMEDIATELY 1
+# endif
 
 /* Acquire a lock. */
 static BOOL
@@ -160,17 +160,17 @@ flock (int fd, int operation)
 
 #else /* !Windows */
 
-#ifdef HAVE_STRUCT_FLOCK_L_TYPE
+# ifdef HAVE_STRUCT_FLOCK_L_TYPE
 /* We know how to implement flock in terms of fcntl. */
 
-#include <fcntl.h>
+#  include <fcntl.h>
 
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
+#  ifdef HAVE_UNISTD_H
+#   include <unistd.h>
+#  endif
 
-#include <errno.h>
-#include <string.h>
+#  include <errno.h>
+#  include <string.h>
 
 int
 flock (int fd, int operation)
@@ -211,10 +211,10 @@ flock (int fd, int operation)
   return r;
 }
 
-#else /* !HAVE_STRUCT_FLOCK_L_TYPE */
+# else /* !HAVE_STRUCT_FLOCK_L_TYPE */
 
-#error "This platform lacks flock function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib."
+#  error "This platform lacks flock function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib."
 
-#endif /* !HAVE_STRUCT_FLOCK_L_TYPE */
+# endif /* !HAVE_STRUCT_FLOCK_L_TYPE */
 
 #endif /* !Windows */
index 93ebfb0..7e69fb4 100644 (file)
@@ -130,7 +130,7 @@ fpurge (FILE *fp)
   fp->__put_limit = fp->__buffer;
   return 0;
 # else
- #error "Please port gnulib fpurge.c to your platform! Look at the definitions of fflush, setvbuf and ungetc on your system, then report this to bug-gnulib."
+#  error "Please port gnulib fpurge.c to your platform! Look at the definitions of fflush, setvbuf and ungetc on your system, then report this to bug-gnulib."
 # endif
 
 #endif
index e1420f0..065eb3f 100644 (file)
@@ -40,6 +40,6 @@ freadable (FILE *fp)
 #elif defined __MINT__              /* Atari FreeMiNT */
   return fp->__mode.__read;
 #else
- #error "Please port gnulib freadable.c to your platform! Look at the definition of fopen, fdopen on your system, then report this to bug-gnulib."
+error "Please port gnulib freadable.c to your platform! Look at the definition of fopen, fdopen on your system, then report this to bug-gnulib."
 #endif
 }
index 2f2babf..51aed0e 100644 (file)
@@ -31,38 +31,38 @@ freading (FILE *fp)
   /* Most systems provide FILE as a struct and the necessary bitmask in
      <stdio.h>, because they need it for implementing getc() and putc() as
      fast macros.  */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   return ((fp->_flags & _IO_NO_WRITES) != 0
           || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
               && fp->_IO_read_base != NULL));
-#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+# elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
   return (fp_->_flags & __SRD) != 0;
-#elif defined __EMX__               /* emx+gcc */
+# elif defined __EMX__               /* emx+gcc */
   return (fp->_flags & _IOREAD) != 0;
-#elif defined _IOERR                /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
-# if defined __sun                  /* Solaris */
+# elif defined _IOERR                /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
+#  if defined __sun                  /* Solaris */
   return (fp->_flag & _IOREAD) != 0 && (fp->_flag & _IOWRT) == 0;
-# else
+#  else
   return (fp->_flag & _IOREAD) != 0;
-# endif
-#elif defined __UCLIBC__            /* uClibc */
+#  endif
+# elif defined __UCLIBC__            /* uClibc */
   return (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) != 0;
-#elif defined __QNX__               /* QNX */
+# elif defined __QNX__               /* QNX */
   return ((fp->_Mode & 0x2 /* _MOPENW */) == 0
           || (fp->_Mode & 0x1000 /* _MREAD */) != 0);
-#elif defined __MINT__              /* Atari FreeMiNT */
+# elif defined __MINT__              /* Atari FreeMiNT */
   if (!fp->__mode.__write)
     return 1;
   if (!fp->__mode.__read)
     return 0;
-# ifdef _IO_CURRENTLY_GETTING /* Flag added on 2009-02-28 */
+#  ifdef _IO_CURRENTLY_GETTING /* Flag added on 2009-02-28 */
   return (fp->__flags & _IO_CURRENTLY_GETTING) != 0;
-# else
+#  else
   return (fp->__buffer < fp->__get_limit /*|| fp->__bufp == fp->__put_limit ??*/);
+#  endif
+# else
+#  error "Please port gnulib freading.c to your platform!"
 # endif
-#else
- #error "Please port gnulib freading.c to your platform!"
-#endif
 }
 
 #endif
index 8dea41a..f0fc8e5 100644 (file)
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 
 /* _get_osfhandle */
-#include <io.h>
+# include <io.h>
 
 /* FlushFileBuffers */
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
 
-#include <errno.h>
+# include <errno.h>
 
 int
 fsync (int fd)
@@ -73,6 +73,6 @@ fsync (int fd)
 
 #else /* !Windows */
 
-#error "This platform lacks fsync function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib."
+# error "This platform lacks fsync function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib."
 
 #endif /* !Windows */
index c44f628..ad762dd 100644 (file)
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -628,7 +628,7 @@ fts_close (FTS *sp)
 #if defined __linux__ \
   && HAVE_SYS_VFS_H && HAVE_FSTATFS && HAVE_STRUCT_STATFS_F_TYPE
 
-#include <sys/vfs.h>
+# include <sys/vfs.h>
 
 /* Linux-specific constants from coreutils' src/fs.h */
 # define S_MAGIC_TMPFS 0x1021994
index fdda290..04bc97c 100644 (file)
@@ -40,6 +40,6 @@ fwritable (FILE *fp)
 #elif defined __MINT__              /* Atari FreeMiNT */
   return fp->__mode.__write;
 #else
- #error "Please port gnulib fwritable.c to your platform! Look at the definition of fopen, fdopen on your system, then report this to bug-gnulib."
+error "Please port gnulib fwritable.c to your platform! Look at the definition of fopen, fdopen on your system, then report this to bug-gnulib."
 #endif
 }
index a8078df..fd40f51 100644 (file)
@@ -51,6 +51,6 @@ fwriting (FILE *fp)
   return (fp->__buffer < fp->__put_limit /*|| fp->__bufp == fp->__get_limit ??*/);
 # endif
 #else
- #error "Please port gnulib fwriting.c to your platform!"
+error "Please port gnulib fwriting.c to your platform!"
 #endif
 }
index 762d995..e63a18d 100644 (file)
@@ -21,6 +21,7 @@
      $ gen-uni-tables /usr/local/share/Unidata/UnicodeData.txt \
                       /usr/local/share/Unidata/PropList.txt \
                       /usr/local/share/Unidata/DerivedCoreProperties.txt \
+                      /usr/local/share/Unidata/ArabicShaping.txt \
                       /usr/local/share/Unidata/Scripts.txt \
                       /usr/local/share/Unidata/Blocks.txt \
                       /usr/local/share/Unidata/PropList-3.0.1.txt \
@@ -259,6 +260,7 @@ fill_attributes (const char *unicodedata_filename)
                              field11, field12, field13, field14);
         }
     }
+
   if (ferror (stream) || fclose (stream))
     {
       fprintf (stderr, "error reading from '%s'\n", unicodedata_filename);
@@ -280,6 +282,17 @@ is_category_L (unsigned int ch)
 }
 
 static bool
+is_category_LC (unsigned int ch)
+{
+  /* See PropertyValueAliases.txt.  */
+  return (unicode_attributes[ch].name != NULL
+          && unicode_attributes[ch].category[0] == 'L'
+          && (unicode_attributes[ch].category[1] == 'u'
+              || unicode_attributes[ch].category[1] == 'l'
+              || unicode_attributes[ch].category[1] == 't'));
+}
+
+static bool
 is_category_Lu (unsigned int ch)
 {
   return (unicode_attributes[ch].name != NULL
@@ -803,6 +816,7 @@ output_categories (const char *version)
   output_predicate_test ("../tests/unictype/test-categ_" #C ".c", is_category_ ## C, "uc_is_general_category (c, UC_CATEGORY_" #C ")"); \
   output_predicate ("unictype/categ_" #C ".h", is_category_ ## C, "u_categ_" #C, "Categories", version);
   CATEGORY (L)
+  CATEGORY (LC)
   CATEGORY (Lu)
   CATEGORY (Ll)
   CATEGORY (Lt)
@@ -845,6 +859,7 @@ output_categories (const char *version)
 enum
 {
   UC_CATEGORY_MASK_L  = 0x0000001f,
+  UC_CATEGORY_MASK_LC = 0x00000007,
   UC_CATEGORY_MASK_Lu = 0x00000001,
   UC_CATEGORY_MASK_Ll = 0x00000002,
   UC_CATEGORY_MASK_Lt = 0x00000004,
@@ -894,6 +909,7 @@ general_category_byname (const char *category_name)
         switch (category_name[1])
           {
           case '\0': return UC_CATEGORY_MASK_L;
+          case 'C': return UC_CATEGORY_MASK_LC;
           case 'u': return UC_CATEGORY_MASK_Lu;
           case 'l': return UC_CATEGORY_MASK_Ll;
           case 't': return UC_CATEGORY_MASK_Lt;
@@ -2760,6 +2776,7 @@ fill_property30 (char array[0x110000], const char *proplist_filename, const char
       for (i = i1; i <= i2; i++)
         array[i] = 1;
     }
+
   if (ferror (stream) || fclose (stream))
     {
       fprintf (stderr, "error reading from '%s'\n", proplist_filename);
@@ -3651,6 +3668,616 @@ output_properties (const char *version)
 
 /* ========================================================================= */
 
+/* Arabic Shaping.  */
+
+enum
+{
+  UC_JOINING_TYPE_U, /* Non_Joining */
+  UC_JOINING_TYPE_T, /* Transparent */
+  UC_JOINING_TYPE_C, /* Join_Causing */
+  UC_JOINING_TYPE_L, /* Left_Joining */
+  UC_JOINING_TYPE_R, /* Right_Joining */
+  UC_JOINING_TYPE_D  /* Dual_Joining */
+};
+
+static uint8_t unicode_joining_type[0x110000];
+
+enum
+{
+  UC_JOINING_GROUP_NONE,                  /* No_Joining_Group */
+  UC_JOINING_GROUP_AIN,                   /* Ain */
+  UC_JOINING_GROUP_ALAPH,                 /* Alaph */
+  UC_JOINING_GROUP_ALEF,                  /* Alef */
+  UC_JOINING_GROUP_BEH,                   /* Beh */
+  UC_JOINING_GROUP_BETH,                  /* Beth */
+  UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE, /* Burushaski_Yeh_Barree */
+  UC_JOINING_GROUP_DAL,                   /* Dal */
+  UC_JOINING_GROUP_DALATH_RISH,           /* Dalath_Rish */
+  UC_JOINING_GROUP_E,                     /* E */
+  UC_JOINING_GROUP_FARSI_YEH,             /* Farsi_Yeh */
+  UC_JOINING_GROUP_FE,                    /* Fe */
+  UC_JOINING_GROUP_FEH,                   /* Feh */
+  UC_JOINING_GROUP_FINAL_SEMKATH,         /* Final_Semkath */
+  UC_JOINING_GROUP_GAF,                   /* Gaf */
+  UC_JOINING_GROUP_GAMAL,                 /* Gamal */
+  UC_JOINING_GROUP_HAH,                   /* Hah */
+  UC_JOINING_GROUP_HE,                    /* He */
+  UC_JOINING_GROUP_HEH,                   /* Heh */
+  UC_JOINING_GROUP_HEH_GOAL,              /* Heh_Goal */
+  UC_JOINING_GROUP_HETH,                  /* Heth */
+  UC_JOINING_GROUP_KAF,                   /* Kaf */
+  UC_JOINING_GROUP_KAPH,                  /* Kaph */
+  UC_JOINING_GROUP_KHAPH,                 /* Khaph */
+  UC_JOINING_GROUP_KNOTTED_HEH,           /* Knotted_Heh */
+  UC_JOINING_GROUP_LAM,                   /* Lam */
+  UC_JOINING_GROUP_LAMADH,                /* Lamadh */
+  UC_JOINING_GROUP_MEEM,                  /* Meem */
+  UC_JOINING_GROUP_MIM,                   /* Mim */
+  UC_JOINING_GROUP_NOON,                  /* Noon */
+  UC_JOINING_GROUP_NUN,                   /* Nun */
+  UC_JOINING_GROUP_NYA,                   /* Nya */
+  UC_JOINING_GROUP_PE,                    /* Pe */
+  UC_JOINING_GROUP_QAF,                   /* Qaf */
+  UC_JOINING_GROUP_QAPH,                  /* Qaph */
+  UC_JOINING_GROUP_REH,                   /* Reh */
+  UC_JOINING_GROUP_REVERSED_PE,           /* Reversed_Pe */
+  UC_JOINING_GROUP_SAD,                   /* Sad */
+  UC_JOINING_GROUP_SADHE,                 /* Sadhe */
+  UC_JOINING_GROUP_SEEN,                  /* Seen */
+  UC_JOINING_GROUP_SEMKATH,               /* Semkath */
+  UC_JOINING_GROUP_SHIN,                  /* Shin */
+  UC_JOINING_GROUP_SWASH_KAF,             /* Swash_Kaf */
+  UC_JOINING_GROUP_SYRIAC_WAW,            /* Syriac_Waw */
+  UC_JOINING_GROUP_TAH,                   /* Tah */
+  UC_JOINING_GROUP_TAW,                   /* Taw */
+  UC_JOINING_GROUP_TEH_MARBUTA,           /* Teh_Marbuta */
+  UC_JOINING_GROUP_TEH_MARBUTA_GOAL,      /* Teh_Marbuta_Goal */
+  UC_JOINING_GROUP_TETH,                  /* Teth */
+  UC_JOINING_GROUP_WAW,                   /* Waw */
+  UC_JOINING_GROUP_YEH,                   /* Yeh */
+  UC_JOINING_GROUP_YEH_BARREE,            /* Yeh_Barree */
+  UC_JOINING_GROUP_YEH_WITH_TAIL,         /* Yeh_With_Tail */
+  UC_JOINING_GROUP_YUDH,                  /* Yudh */
+  UC_JOINING_GROUP_YUDH_HE,               /* Yudh_He */
+  UC_JOINING_GROUP_ZAIN,                  /* Zain */
+  UC_JOINING_GROUP_ZHAIN                  /* Zhain */
+};
+
+static uint8_t unicode_joining_group[0x110000];
+
+static void
+fill_arabicshaping (const char *arabicshaping_filename)
+{
+  FILE *stream;
+  unsigned int i;
+  int lineno;
+
+  stream = fopen (arabicshaping_filename, "r");
+  if (stream == NULL)
+    {
+      fprintf (stderr, "error during fopen of '%s'\n", arabicshaping_filename);
+      exit (1);
+    }
+
+  for (i = 0; i < 0x110000; i++)
+    {
+      unicode_joining_type[i] = (uint8_t)~(uint8_t)0;
+      unicode_joining_group[i] = UC_JOINING_GROUP_NONE;
+    }
+
+  lineno = 0;
+  for (;;)
+    {
+      char buf[100+1];
+      char separator1[100+1];
+      char padding1[100+1];
+      char schematic_name[100+1];
+      char separator2[100+1];
+      char padding2[100+1];
+      char joining_type_name[100+1];
+      char separator3[100+1];
+      char padding3[100+1];
+      char joining_group_name[100+1];
+      int joining_type;
+      int joining_group;
+
+      lineno++;
+      if (fscanf (stream, "%100[^\n]\n", buf) < 1)
+        break;
+
+      if (buf[0] == '\0' || buf[0] == '#')
+        continue;
+
+      if (sscanf (buf, "%X%[;]%[ ]%[^;]%[;]%[ ]%[^;]%[;]%[ ]%100[^\n]",
+                  &i, separator1, padding1, schematic_name, separator2,
+                  padding2, joining_type_name, separator3, padding3,
+                  joining_group_name) != 10)
+        {
+          fprintf (stderr, "parse error in '%s':%d\n",
+                   arabicshaping_filename, lineno);
+          exit (1);
+        }
+      if (i >= 0x110000)
+        abort ();
+
+#define TRY(name) else if (strcmp (joining_type_name, #name + 16) == 0) joining_type = name;
+      if (false) {}
+      TRY(UC_JOINING_TYPE_U)
+      TRY(UC_JOINING_TYPE_T)
+      TRY(UC_JOINING_TYPE_C)
+      TRY(UC_JOINING_TYPE_L)
+      TRY(UC_JOINING_TYPE_R)
+      TRY(UC_JOINING_TYPE_D)
+#undef TRY
+      else
+        {
+          fprintf (stderr, "unknown joining type value \"%s\" in '%s':%d\n",
+                   joining_type_name, arabicshaping_filename, lineno);
+          exit (1);
+        }
+
+      /* Remove trailing spaces.  */
+      while (joining_group_name[0] != '\0'
+             && joining_group_name[strlen (joining_group_name) - 1] == ' ')
+        joining_group_name[strlen (joining_group_name) - 1] = '\0';
+
+#define TRY(value,name) else if (strcmp (joining_group_name, name) == 0) joining_group = value;
+      if (false) {}
+      TRY(UC_JOINING_GROUP_NONE,                  "No_Joining_Group")
+      TRY(UC_JOINING_GROUP_AIN,                   "AIN")
+      TRY(UC_JOINING_GROUP_ALAPH,                 "ALAPH")
+      TRY(UC_JOINING_GROUP_ALEF,                  "ALEF")
+      TRY(UC_JOINING_GROUP_BEH,                   "BEH")
+      TRY(UC_JOINING_GROUP_BETH,                  "BETH")
+      TRY(UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE, "BURUSHASKI YEH BARREE")
+      TRY(UC_JOINING_GROUP_DAL,                   "DAL")
+      TRY(UC_JOINING_GROUP_DALATH_RISH,           "DALATH RISH")
+      TRY(UC_JOINING_GROUP_E,                     "E")
+      TRY(UC_JOINING_GROUP_FARSI_YEH,             "FARSI YEH")
+      TRY(UC_JOINING_GROUP_FE,                    "FE")
+      TRY(UC_JOINING_GROUP_FEH,                   "FEH")
+      TRY(UC_JOINING_GROUP_FINAL_SEMKATH,         "FINAL SEMKATH")
+      TRY(UC_JOINING_GROUP_GAF,                   "GAF")
+      TRY(UC_JOINING_GROUP_GAMAL,                 "GAMAL")
+      TRY(UC_JOINING_GROUP_HAH,                   "HAH")
+      TRY(UC_JOINING_GROUP_HE,                    "HE")
+      TRY(UC_JOINING_GROUP_HEH,                   "HEH")
+      TRY(UC_JOINING_GROUP_HEH_GOAL,              "HEH GOAL")
+      TRY(UC_JOINING_GROUP_HETH,                  "HETH")
+      TRY(UC_JOINING_GROUP_KAF,                   "KAF")
+      TRY(UC_JOINING_GROUP_KAPH,                  "KAPH")
+      TRY(UC_JOINING_GROUP_KHAPH,                 "KHAPH")
+      TRY(UC_JOINING_GROUP_KNOTTED_HEH,           "KNOTTED HEH")
+      TRY(UC_JOINING_GROUP_LAM,                   "LAM")
+      TRY(UC_JOINING_GROUP_LAMADH,                "LAMADH")
+      TRY(UC_JOINING_GROUP_MEEM,                  "MEEM")
+      TRY(UC_JOINING_GROUP_MIM,                   "MIM")
+      TRY(UC_JOINING_GROUP_NOON,                  "NOON")
+      TRY(UC_JOINING_GROUP_NUN,                   "NUN")
+      TRY(UC_JOINING_GROUP_NYA,                   "NYA")
+      TRY(UC_JOINING_GROUP_PE,                    "PE")
+      TRY(UC_JOINING_GROUP_QAF,                   "QAF")
+      TRY(UC_JOINING_GROUP_QAPH,                  "QAPH")
+      TRY(UC_JOINING_GROUP_REH,                   "REH")
+      TRY(UC_JOINING_GROUP_REVERSED_PE,           "REVERSED PE")
+      TRY(UC_JOINING_GROUP_SAD,                   "SAD")
+      TRY(UC_JOINING_GROUP_SADHE,                 "SADHE")
+      TRY(UC_JOINING_GROUP_SEEN,                  "SEEN")
+      TRY(UC_JOINING_GROUP_SEMKATH,               "SEMKATH")
+      TRY(UC_JOINING_GROUP_SHIN,                  "SHIN")
+      TRY(UC_JOINING_GROUP_SWASH_KAF,             "SWASH KAF")
+      TRY(UC_JOINING_GROUP_SYRIAC_WAW,            "SYRIAC WAW")
+      TRY(UC_JOINING_GROUP_TAH,                   "TAH")
+      TRY(UC_JOINING_GROUP_TAW,                   "TAW")
+      TRY(UC_JOINING_GROUP_TEH_MARBUTA,           "TEH MARBUTA")
+      TRY(UC_JOINING_GROUP_TEH_MARBUTA_GOAL,      "TEH MARBUTA GOAL")
+      TRY(UC_JOINING_GROUP_TETH,                  "TETH")
+      TRY(UC_JOINING_GROUP_WAW,                   "WAW")
+      TRY(UC_JOINING_GROUP_YEH,                   "YEH")
+      TRY(UC_JOINING_GROUP_YEH_BARREE,            "YEH BARREE")
+      TRY(UC_JOINING_GROUP_YEH_WITH_TAIL,         "YEH WITH TAIL")
+      TRY(UC_JOINING_GROUP_YUDH,                  "YUDH")
+      TRY(UC_JOINING_GROUP_YUDH_HE,               "YUDH HE")
+      TRY(UC_JOINING_GROUP_ZAIN,                  "ZAIN")
+      TRY(UC_JOINING_GROUP_ZHAIN,                 "ZHAIN")
+#undef TRY
+      else
+        {
+          fprintf (stderr, "unknown joining group value \"%s\" in '%s':%d\n",
+                   joining_group_name, arabicshaping_filename, lineno);
+          exit (1);
+        }
+
+      unicode_joining_type[i] = joining_type;
+      unicode_joining_group[i] = joining_group;
+    }
+
+  if (ferror (stream) || fclose (stream))
+    {
+      fprintf (stderr, "error reading from '%s'\n", arabicshaping_filename);
+      exit (1);
+    }
+}
+
+/* Convert a Joining_Type value to a C identifier.  */
+static const char *
+joining_type_as_c_identifier (int joining_type)
+{
+#define TRY(value) if (joining_type == value) return #value;
+  TRY(UC_JOINING_TYPE_U)
+  TRY(UC_JOINING_TYPE_T)
+  TRY(UC_JOINING_TYPE_C)
+  TRY(UC_JOINING_TYPE_L)
+  TRY(UC_JOINING_TYPE_R)
+  TRY(UC_JOINING_TYPE_D)
+#undef TRY
+  abort ();
+}
+
+static void
+output_joining_type_test (const char *filename, const char *version)
+{
+  FILE *stream;
+  bool need_comma;
+  unsigned int ch;
+
+  stream = fopen (filename, "w");
+  if (stream == NULL)
+    {
+      fprintf (stderr, "cannot open '%s' for writing\n", filename);
+      exit (1);
+    }
+
+  fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n");
+  fprintf (stream, "/* Arabic joining type of Unicode characters.  */\n");
+  fprintf (stream, "/* Generated automatically by gen-uni-tables.c for Unicode %s.  */\n",
+           version);
+
+  need_comma = false;
+  for (ch = 0; ch < 0x110000; ch++)
+    {
+      int value = unicode_joining_type[ch];
+
+      if (value != (uint8_t)~(uint8_t)0)
+        {
+          if (need_comma)
+            fprintf (stream, ",\n");
+          fprintf (stream, "    { 0x%04X, %s }", ch, joining_type_as_c_identifier (value));
+          need_comma = true;
+        }
+    }
+  if (need_comma)
+    fprintf (stream, "\n");
+
+  if (ferror (stream) || fclose (stream))
+    {
+      fprintf (stderr, "error writing to '%s'\n", filename);
+      exit (1);
+    }
+}
+
+/* Construction of sparse 3-level tables.  */
+#define TABLE joining_type_table
+#define ELEMENT uint8_t
+#define DEFAULT (uint8_t)~(uint8_t)0
+#define xmalloc malloc
+#define xrealloc realloc
+#include "3level.h"
+
+static void
+output_joining_type (const char *filename, const char *version)
+{
+  FILE *stream;
+  unsigned int ch, i;
+  struct joining_type_table t;
+  unsigned int level1_offset, level2_offset, level3_offset;
+  uint8_t *level3_packed;
+
+  stream = fopen (filename, "w");
+  if (stream == NULL)
+    {
+      fprintf (stderr, "cannot open '%s' for writing\n", filename);
+      exit (1);
+    }
+
+  fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n");
+  fprintf (stream, "/* Arabic joining type of Unicode characters.  */\n");
+  fprintf (stream, "/* Generated automatically by gen-uni-tables.c for Unicode %s.  */\n",
+           version);
+
+  t.p = 7;
+  t.q = 9;
+  joining_type_table_init (&t);
+
+  for (ch = 0; ch < 0x110000; ch++)
+    {
+      uint8_t value = unicode_joining_type[ch];
+
+      joining_type_table_add (&t, ch, value);
+    }
+
+  joining_type_table_finalize (&t);
+
+  /* Offsets in t.result, in memory of this process.  */
+  level1_offset =
+    5 * sizeof (uint32_t);
+  level2_offset =
+    5 * sizeof (uint32_t)
+    + t.level1_size * sizeof (uint32_t);
+  level3_offset =
+    5 * sizeof (uint32_t)
+    + t.level1_size * sizeof (uint32_t)
+    + (t.level2_size << t.q) * sizeof (uint32_t);
+
+  for (i = 0; i < 5; i++)
+    fprintf (stream, "#define joining_type_header_%d %d\n", i,
+             ((uint32_t *) t.result)[i]);
+  fprintf (stream, "static const\n");
+  fprintf (stream, "struct\n");
+  fprintf (stream, "  {\n");
+  fprintf (stream, "    int level1[%zu];\n", t.level1_size);
+  fprintf (stream, "    short level2[%zu << %d];\n", t.level2_size, t.q);
+  fprintf (stream, "    unsigned char level3[%zu * %d];\n", t.level3_size,
+           (1 << t.p) * 4 / 8);
+  fprintf (stream, "  }\n");
+  fprintf (stream, "u_joining_type =\n");
+  fprintf (stream, "{\n");
+  fprintf (stream, "  {");
+  if (t.level1_size > 8)
+    fprintf (stream, "\n   ");
+  for (i = 0; i < t.level1_size; i++)
+    {
+      uint32_t offset;
+      if (i > 0 && (i % 8) == 0)
+        fprintf (stream, "\n   ");
+      offset = ((uint32_t *) (t.result + level1_offset))[i];
+      if (offset == 0)
+        fprintf (stream, " %5d", -1);
+      else
+        fprintf (stream, " %5zu",
+                 (offset - level2_offset) / sizeof (uint32_t));
+      if (i+1 < t.level1_size)
+        fprintf (stream, ",");
+    }
+  if (t.level1_size > 8)
+    fprintf (stream, "\n ");
+  fprintf (stream, " },\n");
+  fprintf (stream, "  {");
+  if (t.level2_size << t.q > 8)
+    fprintf (stream, "\n   ");
+  for (i = 0; i < t.level2_size << t.q; i++)
+    {
+      uint32_t offset;
+      if (i > 0 && (i % 8) == 0)
+        fprintf (stream, "\n   ");
+      offset = ((uint32_t *) (t.result + level2_offset))[i];
+      if (offset == 0)
+        fprintf (stream, " %5d", -1);
+      else
+        fprintf (stream, " %5zu",
+                 (offset - level3_offset) / sizeof (uint8_t));
+      if (i+1 < t.level2_size << t.q)
+        fprintf (stream, ",");
+    }
+  if (t.level2_size << t.q > 8)
+    fprintf (stream, "\n ");
+  fprintf (stream, " },\n");
+  /* Pack the level3 array.  Each entry needs 4 bits only.  */
+  level3_packed =
+    (uint8_t *) calloc ((t.level3_size << t.p) * 4 / 8, sizeof (uint8_t));
+  for (i = 0; i < t.level3_size << t.p; i++)
+    {
+      unsigned int j = (i * 4) / 8;
+      unsigned int k = (i * 4) % 8;
+      uint32_t value = ((unsigned char *) (t.result + level3_offset))[i] & 0x0f;
+      level3_packed[j] |= (value << k);
+    }
+  fprintf (stream, "  {");
+  if ((t.level3_size << t.p) * 4 / 8 > 8)
+    fprintf (stream, "\n   ");
+  for (i = 0; i < (t.level3_size << t.p) * 4 / 8; i++)
+    {
+      if (i > 0 && (i % 8) == 0)
+        fprintf (stream, "\n   ");
+      fprintf (stream, " 0x%02x", level3_packed[i]);
+      if (i+1 < (t.level3_size << t.p) * 4 / 8)
+        fprintf (stream, ",");
+    }
+  if ((t.level3_size << t.p) * 4 / 8 > 8)
+    fprintf (stream, "\n ");
+  fprintf (stream, " }\n");
+  free (level3_packed);
+  fprintf (stream, "};\n");
+
+  if (ferror (stream) || fclose (stream))
+    {
+      fprintf (stderr, "error writing to '%s'\n", filename);
+      exit (1);
+    }
+}
+
+/* Convert a Joining_Group value to a C identifier.  */
+static const char *
+joining_group_as_c_identifier (int joining_group)
+{
+#define TRY(value) if (joining_group == value) return #value;
+  TRY(UC_JOINING_GROUP_NONE)
+  TRY(UC_JOINING_GROUP_AIN)
+  TRY(UC_JOINING_GROUP_ALAPH)
+  TRY(UC_JOINING_GROUP_ALEF)
+  TRY(UC_JOINING_GROUP_BEH)
+  TRY(UC_JOINING_GROUP_BETH)
+  TRY(UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE)
+  TRY(UC_JOINING_GROUP_DAL)
+  TRY(UC_JOINING_GROUP_DALATH_RISH)
+  TRY(UC_JOINING_GROUP_E)
+  TRY(UC_JOINING_GROUP_FARSI_YEH)
+  TRY(UC_JOINING_GROUP_FE)
+  TRY(UC_JOINING_GROUP_FEH)
+  TRY(UC_JOINING_GROUP_FINAL_SEMKATH)
+  TRY(UC_JOINING_GROUP_GAF)
+  TRY(UC_JOINING_GROUP_GAMAL)
+  TRY(UC_JOINING_GROUP_HAH)
+  TRY(UC_JOINING_GROUP_HE)
+  TRY(UC_JOINING_GROUP_HEH)
+  TRY(UC_JOINING_GROUP_HEH_GOAL)
+  TRY(UC_JOINING_GROUP_HETH)
+  TRY(UC_JOINING_GROUP_KAF)
+  TRY(UC_JOINING_GROUP_KAPH)
+  TRY(UC_JOINING_GROUP_KHAPH)
+  TRY(UC_JOINING_GROUP_KNOTTED_HEH)
+  TRY(UC_JOINING_GROUP_LAM)
+  TRY(UC_JOINING_GROUP_LAMADH)
+  TRY(UC_JOINING_GROUP_MEEM)
+  TRY(UC_JOINING_GROUP_MIM)
+  TRY(UC_JOINING_GROUP_NOON)
+  TRY(UC_JOINING_GROUP_NUN)
+  TRY(UC_JOINING_GROUP_NYA)
+  TRY(UC_JOINING_GROUP_PE)
+  TRY(UC_JOINING_GROUP_QAF)
+  TRY(UC_JOINING_GROUP_QAPH)
+  TRY(UC_JOINING_GROUP_REH)
+  TRY(UC_JOINING_GROUP_REVERSED_PE)
+  TRY(UC_JOINING_GROUP_SAD)
+  TRY(UC_JOINING_GROUP_SADHE)
+  TRY(UC_JOINING_GROUP_SEEN)
+  TRY(UC_JOINING_GROUP_SEMKATH)
+  TRY(UC_JOINING_GROUP_SHIN)
+  TRY(UC_JOINING_GROUP_SWASH_KAF)
+  TRY(UC_JOINING_GROUP_SYRIAC_WAW)
+  TRY(UC_JOINING_GROUP_TAH)
+  TRY(UC_JOINING_GROUP_TAW)
+  TRY(UC_JOINING_GROUP_TEH_MARBUTA)
+  TRY(UC_JOINING_GROUP_TEH_MARBUTA_GOAL)
+  TRY(UC_JOINING_GROUP_TETH)
+  TRY(UC_JOINING_GROUP_WAW)
+  TRY(UC_JOINING_GROUP_YEH)
+  TRY(UC_JOINING_GROUP_YEH_BARREE)
+  TRY(UC_JOINING_GROUP_YEH_WITH_TAIL)
+  TRY(UC_JOINING_GROUP_YUDH)
+  TRY(UC_JOINING_GROUP_YUDH_HE)
+  TRY(UC_JOINING_GROUP_ZAIN)
+  TRY(UC_JOINING_GROUP_ZHAIN)
+#undef TRY
+  abort ();
+}
+
+static void
+output_joining_group_test (const char *filename, const char *version)
+{
+  FILE *stream;
+  bool need_comma;
+  unsigned int ch;
+
+  stream = fopen (filename, "w");
+  if (stream == NULL)
+    {
+      fprintf (stderr, "cannot open '%s' for writing\n", filename);
+      exit (1);
+    }
+
+  fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n");
+  fprintf (stream, "/* Arabic joining group of Unicode characters.  */\n");
+  fprintf (stream, "/* Generated automatically by gen-uni-tables.c for Unicode %s.  */\n",
+           version);
+
+  need_comma = false;
+  for (ch = 0; ch < 0x110000; ch++)
+    {
+      int value = unicode_joining_group[ch];
+
+      if (value != UC_JOINING_GROUP_NONE)
+        {
+          if (need_comma)
+            fprintf (stream, ",\n");
+          fprintf (stream, "    { 0x%04X, %s }", ch, joining_group_as_c_identifier (value));
+          need_comma = true;
+        }
+    }
+  if (need_comma)
+    fprintf (stream, "\n");
+
+  if (ferror (stream) || fclose (stream))
+    {
+      fprintf (stderr, "error writing to '%s'\n", filename);
+      exit (1);
+    }
+}
+
+static void
+output_joining_group (const char *filename, const char *version)
+{
+  FILE *stream;
+  unsigned int ch_min, ch_max, ch, i;
+
+  stream = fopen (filename, "w");
+  if (stream == NULL)
+    {
+      fprintf (stderr, "cannot open '%s' for writing\n", filename);
+      exit (1);
+    }
+
+  fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n");
+  fprintf (stream, "/* Arabic joining type of Unicode characters.  */\n");
+  fprintf (stream, "/* Generated automatically by gen-uni-tables.c for Unicode %s.  */\n",
+           version);
+
+  ch_min = 0x10FFFF;
+  for (ch = 0; ch < 0x110000; ch++)
+    if (unicode_joining_group[ch] != UC_JOINING_GROUP_NONE)
+      {
+        ch_min = ch;
+        break;
+      }
+
+  ch_max = 0;
+  for (ch = 0x10FFFF; ch > 0; ch--)
+    if (unicode_joining_group[ch] != UC_JOINING_GROUP_NONE)
+      {
+        ch_max = ch;
+        break;
+      }
+
+  if (!(ch_min <= ch_max))
+    abort ();
+
+  /* If the interval [ch_min, ch_max] is too large, we should better use a
+     3-level table.  */
+  if (!(ch_max - ch_min < 0x200))
+    abort ();
+
+  fprintf (stream, "#define joining_group_header_0 0x%x\n", ch_min);
+  fprintf (stream, "static const unsigned char u_joining_group[0x%x - 0x%x] =\n",
+           ch_max + 1, ch_min);
+  fprintf (stream, "{");
+  for (i = 0; i <= ch_max - ch_min; i++)
+    {
+      const char *s;
+
+      ch = ch_min + i;
+      if ((i % 2) == 0)
+        fprintf (stream, "\n ");
+      s = joining_group_as_c_identifier (unicode_joining_group[ch]);
+      fprintf (stream, " %s", s);
+      if (i+1 <= ch_max - ch_min)
+        {
+          fprintf (stream, ",");
+          if (((i+1) % 2) != 0)
+            fprintf (stream, "%*s", 38 - (int) strlen (s), "");
+        }
+    }
+  fprintf (stream, "\n");
+  fprintf (stream, "};\n");
+
+  if (ferror (stream) || fclose (stream))
+    {
+      fprintf (stderr, "error writing to '%s'\n", filename);
+      exit (1);
+    }
+}
+
+/* ========================================================================= */
+
 /* Scripts.  */
 
 static const char *scripts[256];
@@ -3943,7 +4570,7 @@ output_scripts_byname (const char *version)
   fprintf (stream, "/* Unicode scripts.  */\n");
   fprintf (stream, "/* Generated automatically by gen-uni-tables.c for Unicode %s.  */\n",
            version);
-  fprintf (stream, "struct named_script { const char *name; unsigned int index; };\n");
+  fprintf (stream, "struct named_script { int name; unsigned int index; };\n");
   fprintf (stream, "%%struct-type\n");
   fprintf (stream, "%%language=ANSI-C\n");
   fprintf (stream, "%%define hash-function-name scripts_hash\n");
@@ -3951,6 +4578,8 @@ output_scripts_byname (const char *version)
   fprintf (stream, "%%readonly-tables\n");
   fprintf (stream, "%%global-table\n");
   fprintf (stream, "%%define word-array-name script_names\n");
+  fprintf (stream, "%%pic\n");
+  fprintf (stream, "%%define string-pool-name script_stringpool\n");
   fprintf (stream, "%%%%\n");
   for (s = 0; s < numscripts; s++)
     fprintf (stream, "%s, %u\n", scripts[s], s);
@@ -5251,6 +5880,7 @@ fill_width (const char *width_filename)
           unicode_width[i] = strdup (field1);
         }
     }
+
   if (ferror (stream) || fclose (stream))
     {
       fprintf (stderr, "error reading from '%s'\n", width_filename);
@@ -6398,6 +7028,7 @@ fill_org_lbp (const char *linebreak_filename)
           unicode_org_lbp[i] = value;
         }
     }
+
   if (ferror (stream) || fclose (stream))
     {
       fprintf (stderr, "error reading from '%s'\n", linebreak_filename);
@@ -7478,6 +8109,7 @@ fill_org_gbp (const char *graphemebreakproperty_filename)
       for (i = i1; i <= i2; i++)
         unicode_org_gbp[i] = propvalue;
     }
+
   if (ferror (stream) || fclose (stream))
     {
       fprintf (stderr, "error reading from '%s'\n", graphemebreakproperty_filename);
@@ -9013,6 +9645,7 @@ main (int argc, char * argv[])
   const char *unicodedata_filename;
   const char *proplist_filename;
   const char *derivedproplist_filename;
+  const char *arabicshaping_filename;
   const char *scripts_filename;
   const char *blocks_filename;
   const char *proplist30_filename;
@@ -9025,9 +9658,9 @@ main (int argc, char * argv[])
   const char *casefolding_filename;
   const char *version;
 
-  if (argc != 15)
+  if (argc != 16)
     {
-      fprintf (stderr, "Usage: %s UnicodeData.txt PropList.txt DerivedCoreProperties.txt Scripts.txt Blocks.txt PropList-3.0.1.txt EastAsianWidth.txt LineBreak.txt WordBreakProperty.txt GraphemeBreakProperty.txt CompositionExclusions.txt SpecialCasing.txt CaseFolding.txt version\n",
+      fprintf (stderr, "Usage: %s UnicodeData.txt PropList.txt DerivedCoreProperties.txt ArabicShaping.txt Scripts.txt Blocks.txt PropList-3.0.1.txt EastAsianWidth.txt LineBreak.txt WordBreakProperty.txt GraphemeBreakProperty.txt CompositionExclusions.txt SpecialCasing.txt CaseFolding.txt version\n",
                argv[0]);
       exit (1);
     }
@@ -9035,23 +9668,25 @@ main (int argc, char * argv[])
   unicodedata_filename = argv[1];
   proplist_filename = argv[2];
   derivedproplist_filename = argv[3];
-  scripts_filename = argv[4];
-  blocks_filename = argv[5];
-  proplist30_filename = argv[6];
-  eastasianwidth_filename = argv[7];
-  linebreak_filename = argv[8];
-  wordbreakproperty_filename = argv[9];
-  graphemebreakproperty_filename = argv[10];
-  compositionexclusions_filename = argv[11];
-  specialcasing_filename = argv[12];
-  casefolding_filename = argv[13];
-  version = argv[14];
+  arabicshaping_filename = argv[4];
+  scripts_filename = argv[5];
+  blocks_filename = argv[6];
+  proplist30_filename = argv[7];
+  eastasianwidth_filename = argv[8];
+  linebreak_filename = argv[9];
+  wordbreakproperty_filename = argv[10];
+  graphemebreakproperty_filename = argv[11];
+  compositionexclusions_filename = argv[12];
+  specialcasing_filename = argv[13];
+  casefolding_filename = argv[14];
+  version = argv[15];
 
   fill_attributes (unicodedata_filename);
   clear_properties ();
   fill_properties (proplist_filename);
   fill_properties (derivedproplist_filename);
   fill_properties30 (proplist30_filename);
+  fill_arabicshaping (arabicshaping_filename);
   fill_scripts (scripts_filename);
   fill_blocks (blocks_filename);
   fill_width (eastasianwidth_filename);
@@ -9066,7 +9701,7 @@ main (int argc, char * argv[])
 
   output_categories (version);
   output_category ("unictype/categ_of.h", version);
-  output_combclass ("unictype/combining.h", version);
+  output_combclass ("unictype/combiningclass.h", version);
   output_bidi_category ("unictype/bidi_of.h", version);
   output_decimal_digit_test ("../tests/unictype/test-decdigit.h", version);
   output_decimal_digit ("unictype/decdigit.h", version);
@@ -9076,6 +9711,11 @@ main (int argc, char * argv[])
   output_numeric ("unictype/numeric.h", version);
   output_mirror ("unictype/mirror.h", version);
   output_properties (version);
+  output_joining_type_test ("../tests/unictype/test-joiningtype_of.h", version);
+  output_joining_type ("unictype/joiningtype_of.h", version);
+  output_joining_group_test ("../tests/unictype/test-joininggroup_of.h", version);
+  output_joining_group ("unictype/joininggroup_of.h", version);
+
   output_scripts (version);
   output_scripts_byname (version);
   output_blocks (version);
@@ -9121,6 +9761,7 @@ main (int argc, char * argv[])
         /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/6.0.0/ucd/UnicodeData.txt \
         /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/6.0.0/ucd/PropList.txt \
         /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/6.0.0/ucd/DerivedCoreProperties.txt \
+        /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/6.0.0/ucd/ArabicShaping.txt \
         /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/6.0.0/ucd/Scripts.txt \
         /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/6.0.0/ucd/Blocks.txt \
         /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/3.0.1/PropList-3.0.1.txt \
index 96a6aa4..d324451 100644 (file)
 #include <errno.h>
 #include <stdio.h>
 
-/* Exclude all the code except the test program at the end
-   if the system has its own `getloadavg' function.  */
-
-#ifndef HAVE_GETLOADAVG
-
 # include <sys/types.h>
 
 /* Both the Emacs and non-Emacs sections want this.  Some
@@ -500,7 +495,7 @@ static kvm_t *kd;
 /* Put the 1 minute, 5 minute and 15 minute load averages
    into the first NELEM elements of LOADAVG.
    Return the number written (never more than 3, but may be less than NELEM),
-   or -1 if an error occurred.  */
+   or -1 (setting errno) if an error occurred.  */
 
 int
 getloadavg (double loadavg[], int nelem)
@@ -509,18 +504,17 @@ getloadavg (double loadavg[], int nelem)
 
 # ifdef NO_GET_LOAD_AVG
 #  define LDAV_DONE
-  /* Set errno to zero to indicate that there was no particular error;
-     this function just can't work at all on this system.  */
-  errno = 0;
+  errno = ENOSYS;
   elem = -1;
 # endif
 
-# if !defined (LDAV_DONE) && defined (HAVE_LIBKSTAT)
+# if !defined (LDAV_DONE) && defined (HAVE_LIBKSTAT)       /* Solaris <= 2.6 */
 /* Use libkstat because we don't have to be root.  */
 #  define LDAV_DONE
   kstat_ctl_t *kc;
   kstat_t *ksp;
   kstat_named_t *kn;
+  int saved_errno;
 
   kc = kstat_open ();
   if (kc == 0)
@@ -559,10 +553,13 @@ getloadavg (double loadavg[], int nelem)
         }
     }
 
+  saved_errno = errno;
   kstat_close (kc);
+  errno = saved_errno;
 # endif /* HAVE_LIBKSTAT */
 
 # if !defined (LDAV_DONE) && defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
+                                                           /* HP-UX */
 /* Use pstat_getdynamic() because we don't have to be root.  */
 #  define LDAV_DONE
 #  undef LOAD_AVE_TYPE
@@ -579,7 +576,7 @@ getloadavg (double loadavg[], int nelem)
 
 # endif /* hpux && HAVE_PSTAT_GETDYNAMIC */
 
-# if ! defined LDAV_DONE && defined HAVE_LIBPERFSTAT
+# if ! defined LDAV_DONE && defined HAVE_LIBPERFSTAT       /* AIX */
 #  define LDAV_DONE
 #  undef LOAD_AVE_TYPE
 /* Use perfstat_cpu_total because we don't have to be root. */
@@ -596,6 +593,7 @@ getloadavg (double loadavg[], int nelem)
 # endif
 
 # if !defined (LDAV_DONE) && (defined (__linux__) || defined (__CYGWIN__))
+                                              /* Linux without glibc, Cygwin */
 #  define LDAV_DONE
 #  undef LOAD_AVE_TYPE
 
@@ -605,13 +603,15 @@ getloadavg (double loadavg[], int nelem)
 
   char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")];
   char const *ptr = ldavgbuf;
-  int fd, count;
+  int fd, count, saved_errno;
 
   fd = open (LINUX_LDAV_FILE, O_RDONLY);
   if (fd == -1)
     return -1;
   count = read (fd, ldavgbuf, sizeof ldavgbuf - 1);
+  saved_errno = errno;
   (void) close (fd);
+  errno = saved_errno;
   if (count <= 0)
     return -1;
   ldavgbuf[count] = '\0';
@@ -620,7 +620,6 @@ getloadavg (double loadavg[], int nelem)
     {
       double numerator = 0;
       double denominator = 1;
-      bool have_digit = false;
 
       while (*ptr == ' ')
         ptr++;
@@ -630,7 +629,10 @@ getloadavg (double loadavg[], int nelem)
       if (! ('0' <= *ptr && *ptr <= '9'))
         {
           if (elem == 0)
-            return -1;
+            {
+              errno = ENOTSUP;
+              return -1;
+            }
           break;
         }
 
@@ -648,7 +650,7 @@ getloadavg (double loadavg[], int nelem)
 
 # endif /* __linux__ || __CYGWIN__ */
 
-# if !defined (LDAV_DONE) && defined (__NetBSD__)
+# if !defined (LDAV_DONE) && defined (__NetBSD__)          /* NetBSD < 0.9 */
 #  define LDAV_DONE
 #  undef LOAD_AVE_TYPE
 
@@ -668,7 +670,10 @@ getloadavg (double loadavg[], int nelem)
                   &scale);
   (void) fclose (fp);
   if (count != 4)
-    return -1;
+    {
+      errno = ENOTSUP;
+      return -1;
+    }
 
   for (elem = 0; elem < nelem; elem++)
     loadavg[elem] = (double) load_ave[elem] / (double) scale;
@@ -677,7 +682,7 @@ getloadavg (double loadavg[], int nelem)
 
 # endif /* __NetBSD__ */
 
-# if !defined (LDAV_DONE) && defined (NeXT)
+# if !defined (LDAV_DONE) && defined (NeXT)                /* NeXTStep */
 #  define LDAV_DONE
   /* The NeXT code was adapted from iscreen 3.2.  */
 
@@ -709,7 +714,10 @@ getloadavg (double loadavg[], int nelem)
     }
 
   if (!getloadavg_initialized)
-    return -1;
+    {
+      errno = ENOTSUP;
+      return -1;
+    }
 # endif /* NeXT */
 
 # if !defined (LDAV_DONE) && defined (UMAX)
@@ -836,6 +844,7 @@ getloadavg (double loadavg[], int nelem)
 # endif /* OSF_MIPS */
 
 # if !defined (LDAV_DONE) && (defined (__MSDOS__) || defined (WINDOWS32))
+                                                           /* DJGPP */
 #  define LDAV_DONE
 
   /* A faithful emulation is going to have to be saved for a rainy day.  */
@@ -845,7 +854,7 @@ getloadavg (double loadavg[], int nelem)
     }
 # endif  /* __MSDOS__ || WINDOWS32 */
 
-# if !defined (LDAV_DONE) && defined (OSF_ALPHA)
+# if !defined (LDAV_DONE) && defined (OSF_ALPHA)           /* OSF/1 */
 #  define LDAV_DONE
 
   struct tbl_loadavg load_ave;
@@ -857,7 +866,7 @@ getloadavg (double loadavg[], int nelem)
          : (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale));
 # endif /* OSF_ALPHA */
 
-# if ! defined LDAV_DONE && defined __VMS
+# if ! defined LDAV_DONE && defined __VMS                  /* VMS */
   /* VMS specific code -- read from the Load Ave driver.  */
 
   LOAD_AVE_TYPE load_ave[3];
@@ -894,10 +903,14 @@ getloadavg (double loadavg[], int nelem)
     }
 
   if (!getloadavg_initialized)
-    return -1;
+    {
+      errno = ENOTSUP;
+      return -1;
+    }
 # endif /* ! defined LDAV_DONE && defined __VMS */
 
 # if ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS
+                                                  /* IRIX, other old systems */
 
   /* UNIX-specific code -- read the average from /dev/kmem.  */
 
@@ -939,9 +952,7 @@ getloadavg (double loadavg[], int nelem)
           }
 #   endif /* !SUNOS_5 */
 #  else  /* sgi */
-      int ldav_off;
-
-      ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
+      ptrdiff_t ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
       if (ldav_off != -1)
         offset = (long int) ldav_off & 0x7fffffff;
 #  endif /* sgi */
@@ -1010,7 +1021,10 @@ getloadavg (double loadavg[], int nelem)
     }
 
   if (offset == 0 || !getloadavg_initialized)
-    return -1;
+    {
+      errno = ENOTSUP;
+      return -1;
+    }
 # endif /* ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS */
 
 # if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) /* Including VMS.  */
@@ -1025,51 +1039,8 @@ getloadavg (double loadavg[], int nelem)
 # endif /* !LDAV_DONE && LOAD_AVE_TYPE */
 
 # if !defined LDAV_DONE
-  /* Set errno to zero to indicate that there was no particular error;
-     this function just can't work at all on this system.  */
-  errno = 0;
+  errno = ENOSYS;
   elem = -1;
 # endif
   return elem;
 }
-
-#endif /* ! HAVE_GETLOADAVG */
-\f
-#ifdef TEST
-int
-main (int argc, char **argv)
-{
-  int naptime = 0;
-
-  if (argc > 1)
-    naptime = atoi (argv[1]);
-
-  while (1)
-    {
-      double avg[3];
-      int loads;
-
-      errno = 0;                /* Don't be misled if it doesn't set errno.  */
-      loads = getloadavg (avg, 3);
-      if (loads == -1)
-        {
-          perror ("Error getting load average");
-          return EXIT_FAILURE;
-        }
-      if (loads > 0)
-        printf ("1-minute: %f  ", avg[0]);
-      if (loads > 1)
-        printf ("5-minute: %f  ", avg[1]);
-      if (loads > 2)
-        printf ("15-minute: %f  ", avg[2]);
-      if (loads > 0)
-        putchar ('\n');
-
-      if (naptime == 0)
-        break;
-      sleep (naptime);
-    }
-
-  return EXIT_SUCCESS;
-}
-#endif /* TEST */
index 7a01a6a..9f0c713 100644 (file)
@@ -108,7 +108,7 @@ struct _getopt_data
 #if defined _LIBC && defined USE_NONOPTION_FLAGS
   int __nonoption_flags_max_len;
   int __nonoption_flags_len;
-# endif
+#endif
 };
 
 /* The initializer is necessary to set OPTIND and OPTERR to their
index 226be15..c747f35 100644 (file)
 
 #if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
 
-#include <stdbool.h>
-
-#if HAVE_DECL___FSETLOCKING && HAVE___FSETLOCKING
-# if HAVE_STDIO_EXT_H
-#  include <stdio_ext.h>
+# include <stdbool.h>
+
+# if HAVE_DECL___FSETLOCKING && HAVE___FSETLOCKING
+#  if HAVE_STDIO_EXT_H
+#   include <stdio_ext.h>
+#  endif
+# else
+#  define __fsetlocking(stream, type)    /* empty */
 # endif
-#else
-# define __fsetlocking(stream, type)    /* empty */
-#endif
 
-#if HAVE_TERMIOS_H
-# include <termios.h>
-#endif
-
-#if USE_UNLOCKED_IO
-# include "unlocked-io.h"
-#else
-# if !HAVE_DECL_FFLUSH_UNLOCKED
-#  undef fflush_unlocked
-#  define fflush_unlocked(x) fflush (x)
-# endif
-# if !HAVE_DECL_FLOCKFILE
-#  undef flockfile
-#  define flockfile(x) ((void) 0)
+# if HAVE_TERMIOS_H
+#  include <termios.h>
 # endif
-# if !HAVE_DECL_FUNLOCKFILE
-#  undef funlockfile
-#  define funlockfile(x) ((void) 0)
-# endif
-# if !HAVE_DECL_FPUTS_UNLOCKED
-#  undef fputs_unlocked
-#  define fputs_unlocked(str,stream) fputs (str, stream)
-# endif
-# if !HAVE_DECL_PUTC_UNLOCKED
-#  undef putc_unlocked
-#  define putc_unlocked(c,stream) putc (c, stream)
+
+# if USE_UNLOCKED_IO
+#  include "unlocked-io.h"
+# else
+#  if !HAVE_DECL_FFLUSH_UNLOCKED
+#   undef fflush_unlocked
+#   define fflush_unlocked(x) fflush (x)
+#  endif
+#  if !HAVE_DECL_FLOCKFILE
+#   undef flockfile
+#   define flockfile(x) ((void) 0)
+#  endif
+#  if !HAVE_DECL_FUNLOCKFILE
+#   undef funlockfile
+#   define funlockfile(x) ((void) 0)
+#  endif
+#  if !HAVE_DECL_FPUTS_UNLOCKED
+#   undef fputs_unlocked
+#   define fputs_unlocked(str,stream) fputs (str, stream)
+#  endif
+#  if !HAVE_DECL_PUTC_UNLOCKED
+#   undef putc_unlocked
+#   define putc_unlocked(c,stream) putc (c, stream)
+#  endif
 # endif
-#endif
 
 /* It is desirable to use this bit on systems that have it.
    The only bit of terminal state we want to twiddle is echoing, which is
    done in software; there is no need to change the state of the terminal
    hardware.  */
 
-#ifndef TCSASOFT
-# define TCSASOFT 0
-#endif
+# ifndef TCSASOFT
+#  define TCSASOFT 0
+# endif
 
 static void
 call_fclose (void *arg)
@@ -112,7 +112,7 @@ getpass (const char *prompt)
   flockfile (out);
 
   /* Turn echoing off if it is on now.  */
-#if HAVE_TCGETATTR
+# if HAVE_TCGETATTR
   if (tcgetattr (fileno (in), &t) == 0)
     {
       /* Save the old one. */
@@ -121,7 +121,7 @@ getpass (const char *prompt)
       t.c_lflag &= ~(ECHO | ISIG);
       tty_changed = (tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &t) == 0);
     }
-#endif
+# endif
 
   /* Write the prompt.  */
   fputs_unlocked (prompt, out);
@@ -158,10 +158,10 @@ getpass (const char *prompt)
     }
 
   /* Restore the original setting.  */
-#if HAVE_TCSETATTR
+# if HAVE_TCSETATTR
   if (tty_changed)
     tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &s);
-#endif
+# endif
 
   funlockfile (out);
 
@@ -176,15 +176,15 @@ getpass (const char *prompt)
    improved by Simon Josefsson. */
 
 /* For PASS_MAX. */
-#include <limits.h>
+# include <limits.h>
 /* For _getch(). */
-#include <conio.h>
+# include <conio.h>
 /* For strdup(). */
-#include <string.h>
+# include <string.h>
 
-#ifndef PASS_MAX
-# define PASS_MAX 512
-#endif
+# ifndef PASS_MAX
+#  define PASS_MAX 512
+# endif
 
 char *
 getpass (const char *prompt)
index 4715c9f..65777e6 100644 (file)
 
 #endif
 
+/* Prefer gnulib's setlocale override over libintl's setlocale override.  */
+#ifdef GNULIB_defined_setlocale
+# undef setlocale
+# define setlocale rpl_setlocale
+#endif
+
 /* A pseudo function call that serves as a marker for the automated
    extraction of messages, but does not call gettext().  The run-time
    translation is done at a different place in the code.
index bbad88e..ae2a6f1 100644 (file)
 static struct tm tm_zero_buffer;
 static struct tm *localtime_buffer_addr = &tm_zero_buffer;
 
-#undef localtime
+# undef localtime
 extern struct tm *localtime (time_t const *);
 
-#undef gmtime
+# undef gmtime
 extern struct tm *gmtime (time_t const *);
 
 /* This is a wrapper for localtime.  It is used only on systems for which
@@ -79,7 +79,7 @@ rpl_gmtime (time_t const *timep)
 
 #if TZSET_CLOBBERS_LOCALTIME
 
-#undef tzset
+# undef tzset
 extern void tzset (void);
 
 /* This is a wrapper for tzset, for systems on which tzset may clobber
index 72f9f37..4bbed76 100644 (file)
@@ -37,7 +37,9 @@ rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */)
   buf = va_arg (args, void *);
   va_end (args);
 
-  return ioctl (fd, request, buf);
+  /* Cast 'request' so that when the system's ioctl function takes a 64-bit
+     request argument, the value gets zero-extended, not sign-extended.  */
+  return ioctl (fd, (unsigned int) request, buf);
 }
 
 #else /* mingw */
@@ -61,6 +63,10 @@ ioctl (int fd, int req, ...)
   buf = va_arg (args, void *);
   va_end (args);
 
+  /* We don't support FIONBIO on pipes here.  If you want to make pipe
+     fds non-blocking, use the gnulib 'nonblocking' module, until
+     gnulib implements fcntl F_GETFL / F_SETFL with O_NONBLOCK.  */
+
   sock = FD_TO_SOCKET (fd);
   r = ioctlsocket (sock, req, buf);
   if (r < 0)
index ec89050..77b6345 100644 (file)
@@ -298,7 +298,7 @@ rpl_linkat (int fd1, char const *file1, int fd2, char const *file2, int flag)
       return -1;
     }
 
-#if LINKAT_TRAILING_SLASH_BUG
+# if LINKAT_TRAILING_SLASH_BUG
   /* Reject trailing slashes on non-directories.  */
   {
     size_t len1 = strlen (file1);
@@ -319,7 +319,7 @@ rpl_linkat (int fd1, char const *file1, int fd2, char const *file2, int flag)
           }
       }
   }
-#endif
+# endif
 
   if (!flag)
     return linkat (fd1, file1, fd2, file2, flag);
index e96188b..38e36ef 100644 (file)
@@ -228,8 +228,7 @@ get_charset_aliases (void)
                         {
                           /* Out of memory. */
                           res_size = 0;
-                          if (old_res_ptr != NULL)
-                            free (old_res_ptr);
+                          free (old_res_ptr);
                           break;
                         }
                       strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
index 6fa1acc..1f9bafd 100644 (file)
 # define LC_MESSAGES 1729
 #endif
 
+#if @GNULIB_SETLOCALE@
+# if @REPLACE_SETLOCALE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef setlocale
+#   define setlocale rpl_setlocale
+#   define GNULIB_defined_setlocale 1
+#  endif
+_GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale));
+_GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale));
+# else
+_GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale));
+# endif
+_GL_CXXALIASWARN (setlocale);
+#elif defined GNULIB_POSIXCHECK
+# undef setlocale
+# if HAVE_RAW_DECL_SETLOCALE
+_GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - "
+                 "use gnulib module setlocale for portability");
+# endif
+#endif
+
 #if @GNULIB_DUPLOCALE@
 # if @REPLACE_DUPLOCALE@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
index 0546f6d..d9c25cc 100644 (file)
@@ -40,9 +40,6 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
 {
   char *pstate = (char *)ps;
 
-  if (pstate == NULL)
-    pstate = internal_state;
-
   if (s == NULL)
     {
       pwc = NULL;
@@ -54,6 +51,10 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
     return (size_t)(-2);
 
   /* Here n > 0.  */
+
+  if (pstate == NULL)
+    pstate = internal_state;
+
   {
     size_t nstate = pstate[0];
     char buf[4];
index 95f98dc..ad0eae0 100644 (file)
 /* Get iswcntrl().  */
 #include <wctype.h>
 
+/* Get INT_MAX.  */
+#include <limits.h>
+
 /* Returns the number of columns needed to represent the multibyte
    character string pointed to by STRING.  If a non-printable character
    occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned.
    With flags = MBSW_REJECT_INVALID | MBSW_REJECT_UNPRINTABLE, this is
-   the multibyte analogue of the wcswidth function.
-   If STRING is not of length < INT_MAX / 2, integer overflow can occur.  */
+   the multibyte analogue of the wcswidth function.  */
 int
 mbswidth (const char *string, int flags)
 {
@@ -50,8 +52,7 @@ mbswidth (const char *string, int flags)
 /* Returns the number of columns needed to represent the multibyte
    character string pointed to by STRING of length NBYTES.  If a
    non-printable character occurs, and MBSW_REJECT_UNPRINTABLE is
-   specified, -1 is returned.
-   If NBYTES is not < INT_MAX / 2, integer overflow can occur.  */
+   specified, -1 is returned.  */
 int
 mbsnwidth (const char *string, size_t nbytes, int flags)
 {
@@ -135,11 +136,22 @@ mbsnwidth (const char *string, size_t nbytes, int flags)
                     w = wcwidth (wc);
                     if (w >= 0)
                       /* A printable multibyte character.  */
-                      width += w;
+                      {
+                        if (w > INT_MAX - width)
+                          goto overflow;
+                        width += w;
+                      }
                     else
                       /* An unprintable multibyte character.  */
                       if (!(flags & MBSW_REJECT_UNPRINTABLE))
-                        width += (iswcntrl (wc) ? 0 : 1);
+                        {
+                          if (!iswcntrl (wc))
+                            {
+                              if (width == INT_MAX)
+                                goto overflow;
+                              width++;
+                            }
+                        }
                       else
                         return -1;
 
@@ -157,11 +169,25 @@ mbsnwidth (const char *string, size_t nbytes, int flags)
       unsigned char c = (unsigned char) *p++;
 
       if (isprint (c))
-        width++;
+        {
+          if (width == INT_MAX)
+            goto overflow;
+          width++;
+        }
       else if (!(flags & MBSW_REJECT_UNPRINTABLE))
-        width += (iscntrl (c) ? 0 : 1);
+        {
+          if (!iscntrl (c))
+            {
+              if (width == INT_MAX)
+                goto overflow;
+              width++;
+            }
+        }
       else
         return -1;
     }
   return width;
+
+ overflow:
+  return INT_MAX;
 }
diff --git a/lib/mbtowc-impl.h b/lib/mbtowc-impl.h
new file mode 100644 (file)
index 0000000..1645eb5
--- /dev/null
@@ -0,0 +1,44 @@
+/* Convert multibyte character to wide character.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This 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/>.  */
+
+/* We don't need a static internal state, because the encoding is not state
+   dependent, and when mbrtowc returns (size_t)(-2). we throw the result
+   away. */
+
+int
+mbtowc (wchar_t *pwc, const char *s, size_t n)
+{
+  if (s == NULL)
+    return 0;
+  else
+    {
+      mbstate_t state;
+      wchar_t wc;
+      size_t result;
+
+      memset (&state, 0, sizeof (mbstate_t));
+      result = mbrtowc (&wc, s, n, &state);
+      if (result == (size_t)-1 || result == (size_t)-2)
+        {
+          errno = EILSEQ;
+          return -1;
+        }
+      if (pwc != NULL)
+        *pwc = wc;
+      return (wc == 0 ? 0 : result);
+    }
+}
diff --git a/lib/mbtowc.c b/lib/mbtowc.c
new file mode 100644 (file)
index 0000000..b3848a1
--- /dev/null
@@ -0,0 +1,26 @@
+/* Convert multibyte character to wide character.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This 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>
+
+#include <stdlib.h>
+
+#include <errno.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "mbtowc-impl.h"
index d584975..ab5cc89 100644 (file)
@@ -45,7 +45,7 @@ enum { BILLION = 1000 * 1000 * 1000 };
 int
 nanosleep (const struct timespec *requested_delay,
            struct timespec *remaining_delay)
-#undef nanosleep
+# undef nanosleep
 {
   /* nanosleep mishandles large sleeps due to internal overflow problems.
      The worst known case of this is Linux 2.6.9 with glibc 2.3.4, which
index cdf07f2..d789e34 100644 (file)
@@ -37,7 +37,8 @@
 #ifndef _GL_NETDB_H
 #define _GL_NETDB_H
 
-/* Get netdb.h definitions such as struct hostent for MinGW.  */
+/* Get <netdb.h> definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and
+   'struct hostent' on MinGW.  */
 #include <sys/socket.h>
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */
diff --git a/lib/nonblocking.c b/lib/nonblocking.c
new file mode 100644 (file)
index 0000000..f28e423
--- /dev/null
@@ -0,0 +1,151 @@
+/* Non-blocking I/O for pipe or socket descriptors.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This 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>
+
+/* Specification.  */
+#include "nonblocking.h"
+
+#include <errno.h>
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Native Woe32 API.  */
+
+# include <sys/ioctl.h>
+# include <sys/socket.h>
+# include <unistd.h>
+
+/* Get declarations of the Win32 API functions.  */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+int
+get_nonblocking_flag (int desc)
+{
+  HANDLE h = (HANDLE) _get_osfhandle (desc);
+  if (h == INVALID_HANDLE_VALUE)
+    {
+      errno = EBADF;
+      return -1;
+    }
+  if (GetFileType (h) == FILE_TYPE_PIPE)
+    {
+      /* h is a pipe or socket.  */
+      DWORD state;
+      if (GetNamedPipeHandleState (h, &state, NULL, NULL, NULL, NULL, 0))
+        /* h is a pipe.  */
+        return (state & PIPE_NOWAIT) != 0;
+      else
+        /* h is a socket.  */
+        errno = ENOSYS;
+        return -1;
+    }
+  else
+    /* Win32 does not support non-blocking on regular files.  */
+    return 0;
+}
+
+int
+set_nonblocking_flag (int desc, bool value)
+{
+  HANDLE h = (HANDLE) _get_osfhandle (desc);
+  if (h == INVALID_HANDLE_VALUE)
+    {
+      errno = EBADF;
+      return -1;
+    }
+  if (GetFileType (h) == FILE_TYPE_PIPE)
+    {
+      /* h is a pipe or socket.  */
+      DWORD state;
+      if (GetNamedPipeHandleState (h, &state, NULL, NULL, NULL, NULL, 0))
+        {
+          /* h is a pipe.  */
+          if ((state & PIPE_NOWAIT) != 0)
+            {
+              if (value)
+                return 0;
+              state &= ~PIPE_NOWAIT;
+            }
+          else
+            {
+              if (!value)
+                return 0;
+              state |= PIPE_NOWAIT;
+            }
+          if (SetNamedPipeHandleState (h, &state, NULL, NULL))
+            return 0;
+          errno = EINVAL;
+          return -1;
+        }
+      else
+        {
+          /* h is a socket.  */
+          int v = value;
+          return ioctl (desc, FIONBIO, &v);
+        }
+    }
+  else
+    {
+      /* Win32 does not support non-blocking on regular files.  */
+      if (!value)
+        return 0;
+      errno = ENOTSUP;
+      return -1;
+    }
+}
+
+#else
+/* Unix API.  */
+
+# include <fcntl.h>
+
+# if !O_NONBLOCK
+#  error Please port nonblocking to your platform
+# endif
+
+/* We don't need the gnulib replacement of fcntl() here.  */
+# undef fcntl
+
+int
+get_nonblocking_flag (int desc)
+{
+  int fcntl_flags;
+
+  fcntl_flags = fcntl (desc, F_GETFL, 0);
+  if (fcntl_flags < 0)
+    return -1;
+  return (fcntl_flags & O_NONBLOCK) != 0;
+}
+
+int
+set_nonblocking_flag (int desc, bool value)
+{
+  int fcntl_flags;
+
+  fcntl_flags = fcntl (desc, F_GETFL, 0);
+  if (fcntl_flags < 0)
+    return -1;
+  if (((fcntl_flags & O_NONBLOCK) != 0) == value)
+    return 0;
+  if (value)
+    fcntl_flags |= O_NONBLOCK;
+  else
+    fcntl_flags &= ~O_NONBLOCK;
+  return fcntl (desc, F_SETFL, fcntl_flags);
+}
+
+#endif
diff --git a/lib/nonblocking.h b/lib/nonblocking.h
new file mode 100644 (file)
index 0000000..48a2da8
--- /dev/null
@@ -0,0 +1,62 @@
+/* Non-blocking I/O for pipe or socket descriptors.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This 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 _NONBLOCKING_H
+#define _NONBLOCKING_H
+
+#include <stdbool.h>
+
+/* Non-blocking I/O is an I/O mode by which read(), write() calls avoid
+   blocking the current thread.  When non-blocking is enabled:
+   - A read() call returns -1 with errno set to EAGAIN when no data or EOF
+     information is immediately available.
+   - A write() call returns -1 with errno set to EAGAIN when it cannot
+     transport the requested amount of data (but at most one pipe buffer)
+     without blocking.
+   Non-blocking I/O is most useful for character devices, pipes, and sockets.
+   Whether it also works on regular files and block devices is platform
+   dependent.
+
+   There are three modern alternatives to non-blocking I/O:
+     - use select() or poll() followed by read() or write() if the descriptor
+       is ready,
+     - call read() or write() in separate threads,
+     - use <aio.h> interfaces.  */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Return 1 if I/O to the descriptor DESC is currently non-blocking, 0
+   it is blocking, or -1 with errno set if fd is invalid or blocking
+   status cannot be determined (such as with sockets on mingw).  */
+extern int get_nonblocking_flag (int desc);
+
+/* Specify the non-blocking flag for the descriptor DESC.
+   Return 0 upon success, or -1 with errno set upon failure.
+   The default depends on the presence of the O_NONBLOCK flag for files
+   or pipes opened with open() or on the presence of the SOCK_NONBLOCK
+   flag for sockets.  */
+extern int set_nonblocking_flag (int desc, bool value);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NONBLOCKING_H */
index b10e627..ea36dda 100644 (file)
@@ -22,7 +22,7 @@
 #include <stdlib.h>
 
 #ifndef GNULIB_LIBPOSIX
-#include "error.h"
+# include "error.h"
 #endif
 
 #include "exitfail.h"
index 34c74a7..4a470c5 100644 (file)
@@ -30,7 +30,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "dirname.h"
 #include "intprops.h"
 #include "same-inode.h"
 
index 55e12e2..18491a6 100644 (file)
@@ -25,7 +25,7 @@
 #include <string.h>
 #include <sys/stat.h>
 
-#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+#include "dosname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
 #include "openat-priv.h"
 #include "save-cwd.h"
 
@@ -53,7 +53,7 @@ rpl_openat (int dfd, char const *filename, int flags, ...)
       va_end (arg);
     }
 
-#if OPEN_TRAILING_SLASH_BUG
+# 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>
@@ -84,11 +84,11 @@ rpl_openat (int dfd, char const *filename, int flags, ...)
           return -1;
         }
     }
-#endif
+# endif
 
   fd = openat (dfd, filename, flags, mode);
 
-#if OPEN_TRAILING_SLASH_BUG
+# 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>
@@ -117,7 +117,7 @@ rpl_openat (int dfd, char const *filename, int flags, ...)
             }
         }
     }
-#endif
+# endif
 
   return fd;
 }
index 8c28133..0a8c4ad 100644 (file)
@@ -26,7 +26,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "xalloc.h"
 
 #ifndef NUL
 #define NUL '\0'
@@ -381,7 +380,7 @@ parse_time (cch_t * pz)
 }
 
 /* Returns a substring of the given string, with spaces at the beginning and at
-   the end destructively removed.  */
+   the end destructively removed, per SNOBOL.  */
 static char *
 trim (char * pz)
 {
@@ -406,13 +405,20 @@ trim (char * pz)
 static time_t
 parse_period (cch_t * in_pz)
 {
-  char * pz   = xstrdup (in_pz);
-  char * pT   = strchr (pz, 'T');
+  char * pT;
   char * ps;
+  char * pz   = strdup (in_pz);
   void * fptr = pz;
   time_t res  = 0;
 
-  if (pT != NUL)
+  if (pz == NULL)
+    {
+      errno = ENOMEM;
+      return BAD_TIME;
+    }
+
+  pT = strchr (pz, 'T');
+  if (pT != NULL)
     {
       *(pT++) = NUL;
       pz = trim (pz);
diff --git a/lib/passfd.c b/lib/passfd.c
new file mode 100644 (file)
index 0000000..1ab94b4
--- /dev/null
@@ -0,0 +1,181 @@
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This 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>
+
+/* Specification.  */
+#include "passfd.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+#include <sys/socket.h>
+#if HAVE_SYS_UN_H
+# include <sys/un.h>
+#endif
+
+#include "cloexec.h"
+
+#ifndef MSG_CMSG_CLOEXEC
+# define MSG_CMSG_CLOEXEC 0
+#endif
+
+/* sendfd sends the file descriptor fd along the socket
+   to a process calling recvfd on the other end.
+
+   Return 0 on success, or -1 with errno set in case of error.
+*/
+int
+sendfd (int sock, int fd)
+{
+  char send = 0;
+  struct iovec iov;
+  struct msghdr msg;
+#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY
+  struct cmsghdr *cmsg;
+  char buf[CMSG_SPACE (sizeof fd)];
+#endif
+
+  /* send at least one char */
+  memset (&msg, 0, sizeof msg);
+  iov.iov_base = &send;
+  iov.iov_len = 1;
+  msg.msg_iov = &iov;
+  msg.msg_iovlen = 1;
+  msg.msg_name = NULL;
+  msg.msg_namelen = 0;
+
+#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY
+  msg.msg_control = buf;
+  msg.msg_controllen = sizeof buf;
+  cmsg = CMSG_FIRSTHDR (&msg);
+  cmsg->cmsg_level = SOL_SOCKET;
+  cmsg->cmsg_type = SCM_RIGHTS;
+  cmsg->cmsg_len = CMSG_LEN (sizeof fd);
+  /* Initialize the payload: */
+  memcpy (CMSG_DATA (cmsg), &fd, sizeof fd);
+#elif HAVE_UNIXSOCKET_SCM_RIGHTS_BSD43_WAY
+  msg.msg_accrights = &fd;
+  msg.msg_accrightslen = sizeof fd;
+#else
+  errno = ENOSYS;
+  return -1;
+#endif
+
+  if (sendmsg (sock, &msg, 0) != iov.iov_len)
+    return -1;
+  return 0;
+}
+
+/* recvfd receives a file descriptor through the socket.
+   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>).
+
+   Return 0 on success, or -1 with errno set in case of error.
+*/
+int
+recvfd (int sock, int flags)
+{
+  char recv = 0;
+  struct iovec iov;
+  struct msghdr msg;
+  int fd = -1;
+#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY
+  struct cmsghdr *cmsg;
+  char buf[CMSG_SPACE (sizeof fd)];
+  int flags_recvmsg = flags & O_CLOEXEC ? MSG_CMSG_CLOEXEC : 0;
+#endif
+
+  if ((flags & ~O_CLOEXEC) != 0)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  /* send at least one char */
+  memset (&msg, 0, sizeof msg);
+  iov.iov_base = &recv;
+  iov.iov_len = 1;
+  msg.msg_iov = &iov;
+  msg.msg_iovlen = 1;
+  msg.msg_name = NULL;
+  msg.msg_namelen = 0;
+
+#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY
+  msg.msg_control = buf;
+  msg.msg_controllen = sizeof buf;
+  cmsg = CMSG_FIRSTHDR (&msg);
+  cmsg->cmsg_level = SOL_SOCKET;
+  cmsg->cmsg_type = SCM_RIGHTS;
+  cmsg->cmsg_len = CMSG_LEN (sizeof fd);
+  /* Initialize the payload: */
+  memcpy (CMSG_DATA (cmsg), &fd, sizeof fd);
+  msg.msg_controllen = cmsg->cmsg_len;
+
+  if (recvmsg (sock, &msg, flags_recvmsg) < 0)
+    return -1;
+
+  cmsg = CMSG_FIRSTHDR (&msg);
+  /* be paranoiac */
+  if (cmsg == NULL || cmsg->cmsg_len != CMSG_LEN (sizeof fd)
+      || cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS)
+    {
+      /* fake errno: at end the file is not available */
+      errno = EACCES;
+      return -1;
+    }
+
+  memcpy (&fd, CMSG_DATA (cmsg), sizeof fd);
+
+  /* set close-on-exec flag */
+  if (!MSG_CMSG_CLOEXEC && (flags & O_CLOEXEC))
+    {
+      if (set_cloexec_flag (fd, true) < 0)
+        {
+          int saved_errno = errno;
+          (void) close (fd);
+          errno = saved_errno;
+          return -1;
+        }
+    }
+
+#elif HAVE_UNIXSOCKET_SCM_RIGHTS_BSD43_WAY
+  msg.msg_accrights = &fd;
+  msg.msg_accrightslen = sizeof fd;
+  if (recvmsg (sock, &msg, 0) < 0)
+    return -1;
+
+  /* set close-on-exec flag */
+  if (flags & O_CLOEXEC)
+    {
+      if (set_cloexec_flag (fd, true) < 0)
+        {
+          int saved_errno = errno;
+          close (fd);
+          errno = saved_errno;
+          return -1;
+        }
+    }
+#else
+  errno = ENOSYS;
+#endif
+
+  return fd;
+}
diff --git a/lib/passfd.h b/lib/passfd.h
new file mode 100644 (file)
index 0000000..048d9c8
--- /dev/null
@@ -0,0 +1,32 @@
+/* passfd.h -- definitions and prototypes for passfd.c
+
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This 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 PASSFD_H_
+#define PASSFD_H_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int sendfd (int sock, int fd);
+extern int recvfd (int sock, int flags);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
index 7a480c8..0769c5e 100644 (file)
 # include <mach-o/dyld.h>
 #endif
 
-#if defined _WIN32 || defined __WIN32__
+#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
 # define WIN32_NATIVE
 #endif
 
-#if defined WIN32_NATIVE || defined __CYGWIN__
+#ifdef WIN32_NATIVE
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 #endif
@@ -72,8 +72,8 @@ extern char * canonicalize_file_name (const char *name);
    ISSLASH(C)           tests whether C is a directory separator character.
    IS_PATH_WITH_DIR(P)  tests whether P contains a directory specification.
  */
-#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
-  /* Win32, Cygwin, OS/2, DOS */
+#if ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __EMX__ || defined __DJGPP__
+  /* Win32, OS/2, DOS */
 # define ISSLASH(C) ((C) == '/' || (C) == '\\')
 # define HAS_DEVICE(P) \
     ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
@@ -102,7 +102,7 @@ extern char * canonicalize_file_name (const char *name);
 
 #if ENABLE_RELOCATABLE
 
-#ifdef __linux__
+#if defined __linux__ || defined __CYGWIN__
 /* File descriptor of the executable.
    (Only used to verify that we find the correct executable.)  */
 static int executable_fd = -1;
@@ -112,12 +112,13 @@ static int executable_fd = -1;
 static bool
 maybe_executable (const char *filename)
 {
-  /* Woe32 lacks the access() function, but Cygwin doesn't.  */
-#if !(defined WIN32_NATIVE && !defined __CYGWIN__)
+  /* Woe32 lacks the access() function.  */
+#if !defined WIN32_NATIVE
   if (access (filename, X_OK) < 0)
     return false;
+#endif
 
-#ifdef __linux__
+#if defined __linux__ || defined __CYGWIN__
   if (executable_fd >= 0)
     {
       /* If we already have an executable_fd, check that filename points to
@@ -136,7 +137,6 @@ maybe_executable (const char *filename)
         }
     }
 #endif
-#endif
 
   return true;
 }
@@ -148,7 +148,12 @@ maybe_executable (const char *filename)
 static char *
 find_executable (const char *argv0)
 {
-#if defined WIN32_NATIVE || defined __CYGWIN__
+#if defined WIN32_NATIVE
+  /* Native Win32 only.
+     On Cygwin, it is better to use the Cygwin provided /proc interface, than
+     to use native Win32 API and cygwin_conv_to_posix_path, because it supports
+     longer file names
+     (see <http://cygwin.com/ml/cygwin/2011-01/msg00410.html>).  */
   char location[MAX_PATH];
   int length = GetModuleFileName (NULL, location, sizeof (location));
   if (length < 0)
@@ -156,32 +161,9 @@ find_executable (const char *argv0)
   if (!IS_PATH_WITH_DIR (location))
     /* Shouldn't happen.  */
     return NULL;
-  {
-#if defined __CYGWIN__
-    /* cygwin-1.5.13 (2005-03-01) or newer would also allow a Linux-like
-       implementation: readlink of "/proc/self/exe".  But using the
-       result of the Win32 system call is simpler and is consistent with the
-       code in relocatable.c.  */
-    /* 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 NULL;
-    /* Call canonicalize_file_name, because Cygwin supports symbolic links.  */
-    return canonicalize_file_name (location_as_posix_path);
-#else
-    return xstrdup (location);
-#endif
-  }
-#else /* Unix && !Cygwin */
-#ifdef __linux__
+  return xstrdup (location);
+#else /* Unix */
+# ifdef __linux__
   /* The executable is accessible as /proc/<pid>/exe.  In newer Linux
      versions, also as /proc/self/exe.  Linux >= 2.1 provides a symlink
      to the true pathname; older Linux versions give only device and ino,
@@ -205,8 +187,21 @@ find_executable (const char *argv0)
         executable_fd = open (buf, O_EXEC, 0);
     }
   }
-#endif
-#if HAVE_MACH_O_DYLD_H && HAVE__NSGETEXECUTABLEPATH
+# endif
+# ifdef __CYGWIN__
+  /* The executable is accessible as /proc/<pid>/exe, at least in
+     Cygwin >= 1.5.  */
+  {
+    char *link;
+
+    link = xreadlink ("/proc/self/exe");
+    if (link != NULL)
+      return link;
+    if (executable_fd < 0)
+      executable_fd = open ("/proc/self/exe", O_EXEC, 0);
+  }
+# endif
+# if HAVE_MACH_O_DYLD_H && HAVE__NSGETEXECUTABLEPATH
   /* On MacOS X 10.2 or newer, the function
        int _NSGetExecutablePath (char *buf, uint32_t *bufsize);
      can be used to retrieve the executable's full path.  */
@@ -215,7 +210,7 @@ find_executable (const char *argv0)
   if (_NSGetExecutablePath (location, &length) == 0
       && location[0] == '/')
     return canonicalize_file_name (location);
-#endif
+# endif
   /* Guess the executable's full path.  We assume the executable has been
      called via execlp() or execvp() with properly set up argv[0].  The
      login(1) convention to add a '-' prefix to argv[0] is not supported.  */
@@ -256,10 +251,10 @@ find_executable (const char *argv0)
                 /* We have a path item at p, of length p_len.
                    Now concatenate the path item and argv0.  */
                 concat_name = (char *) xmalloc (p_len + strlen (argv0) + 2);
-#ifdef NO_XMALLOC
+# ifdef NO_XMALLOC
                 if (concat_name == NULL)
                   return NULL;
-#endif
+# endif
                 if (p_len == 0)
                   /* An empty PATH element designates the current directory.  */
                   strcpy (concat_name, argv0);
index 9e43733..8b4cdb7 100644 (file)
 static const char bre_special[] = "$^.*[]\\";
 
 /* Characters that are special in an ERE.  */
-static const char ere_special[] = "$^.*[]\\+?()";
+static const char ere_special[] = "$^.*[]\\+?{}()|";
+
+struct regex_quote_spec
+regex_quote_spec_posix (int cflags, bool anchored)
+{
+  struct regex_quote_spec result;
+
+  strcpy (result.special, cflags != 0 ? ere_special : bre_special);
+  result.multibyte = true;
+  result.anchored = anchored;
+
+  return result;
+}
+
+/* Syntax bit values, defined in GNU <regex.h>.  We don't include it here,
+   otherwise this module would need to depend on gnulib module 'regex'.  */
+#define RE_BK_PLUS_QM    0x00000002
+#define RE_INTERVALS     0x00000200
+#define RE_LIMITED_OPS   0x00000400
+#define RE_NEWLINE_ALT   0x00000800
+#define RE_NO_BK_BRACES  0x00001000
+#define RE_NO_BK_PARENS  0x00002000
+#define RE_NO_BK_VBAR    0x00008000
+
+struct regex_quote_spec
+regex_quote_spec_gnu (unsigned long /*reg_syntax_t*/ syntax, bool anchored)
+{
+  struct regex_quote_spec result;
+  char *p;
+
+  p = result.special;
+  memcpy (p, bre_special, sizeof (bre_special) - 1);
+  p += sizeof (bre_special) - 1;
+  if ((syntax & RE_LIMITED_OPS) == 0 && (syntax & RE_BK_PLUS_QM) == 0)
+    {
+      *p++ = '+';
+      *p++ = '?';
+    }
+  if ((syntax & RE_INTERVALS) != 0 && (syntax & RE_NO_BK_BRACES) != 0)
+    {
+      *p++ = '{';
+      *p++ = '}';
+    }
+  if ((syntax & RE_NO_BK_PARENS) != 0)
+    {
+      *p++ = '(';
+      *p++ = ')';
+    }
+  if ((syntax & RE_LIMITED_OPS) == 0 && (syntax & RE_NO_BK_VBAR) != 0)
+    *p++ = '|';
+  if ((syntax & RE_NEWLINE_ALT) != 0)
+    *p++ = '\n';
+  *p = '\0';
+
+  result.multibyte = true;
+  result.anchored = anchored;
+
+  return result;
+}
+
+/* Characters that are special in a PCRE.  */
+static const char pcre_special[] = "$^.*[]\\+?{}()|";
+
+/* Options bit values, defined in <pcre.h>.  We don't include it here, because
+   it is not a standard header.  */
+#define PCRE_ANCHORED 0x00000010
+#define PCRE_EXTENDED 0x00000008
+
+struct regex_quote_spec
+regex_quote_spec_pcre (int options, bool anchored)
+{
+  struct regex_quote_spec result;
+  char *p;
+
+  p = result.special;
+  memcpy (p, bre_special, sizeof (pcre_special) - 1);
+  p += sizeof (pcre_special) - 1;
+  if (options & PCRE_EXTENDED)
+    {
+      *p++ = ' ';
+      *p++ = '\t';
+      *p++ = '\n';
+      *p++ = '\v';
+      *p++ = '\f';
+      *p++ = '\r';
+      *p++ = '#';
+    }
+  *p = '\0';
+
+  /* PCRE regular expressions consist of UTF-8 characters of options contains
+     PCRE_UTF8 and of single bytes otherwise.  */
+  result.multibyte = false;
+  /* If options contains PCRE_ANCHORED, the anchoring is implicit.  */
+  result.anchored = (options & PCRE_ANCHORED ? 0 : anchored);
+
+  return result;
+}
 
 size_t
-regex_quote_length (const char *string, int cflags)
+regex_quote_length (const char *string, const struct regex_quote_spec *spec)
 {
-  const char *special = (cflags != 0 ? ere_special : bre_special);
+  const char *special = spec->special;
   size_t length;
-  mbui_iterator_t iter;
 
   length = 0;
-  for (mbui_init (iter, string); mbui_avail (iter); mbui_advance (iter))
+  if (spec->anchored)
+    length += 2; /* for '^' at the beginning and '$' at the end */
+  if (spec->multibyte)
+    {
+      mbui_iterator_t iter;
+
+      for (mbui_init (iter, string); mbui_avail (iter); mbui_advance (iter))
+        {
+          /* We know that special contains only ASCII characters.  */
+          if (mb_len (mbui_cur (iter)) == 1
+              && strchr (special, * mbui_cur_ptr (iter)))
+            length += 1;
+          length += mb_len (mbui_cur (iter));
+        }
+    }
+  else
     {
-      /* We know that special contains only ASCII characters.  */
-      if (mb_len (mbui_cur (iter)) == 1
-          && strchr (special, * mbui_cur_ptr (iter)))
-        length += 1;
-      length += mb_len (mbui_cur (iter));
+      const char *iter;
+
+      for (iter = string; *iter != '\0'; iter++)
+        {
+          if (strchr (special, *iter))
+            length += 1;
+          length += 1;
+        }
     }
+
   return length;
 }
 
-/* Copies the quoted string to p and returns the incremented p.
-   There must be room for regex_quote_length (string, cflags) + 1 bytes at p.
- */
 char *
-regex_quote_copy (char *p, const char *string, int cflags)
+regex_quote_copy (char *p, const char *string, const struct regex_quote_spec *spec)
 {
-  const char *special = (cflags != 0 ? ere_special : bre_special);
-  mbui_iterator_t iter;
+  const char *special = spec->special;
 
-  for (mbui_init (iter, string); mbui_avail (iter); mbui_advance (iter))
+  if (spec->anchored)
+    *p++ = '^';
+  if (spec->multibyte)
     {
-      /* We know that special contains only ASCII characters.  */
-      if (mb_len (mbui_cur (iter)) == 1
-          && strchr (special, * mbui_cur_ptr (iter)))
-        *p++ = '\\';
-      memcpy (p, mbui_cur_ptr (iter), mb_len (mbui_cur (iter)));
-      p += mb_len (mbui_cur (iter));
+      mbui_iterator_t iter;
+
+      for (mbui_init (iter, string); mbui_avail (iter); mbui_advance (iter))
+        {
+          /* We know that special contains only ASCII characters.  */
+          if (mb_len (mbui_cur (iter)) == 1
+              && strchr (special, * mbui_cur_ptr (iter)))
+            *p++ = '\\';
+          memcpy (p, mbui_cur_ptr (iter), mb_len (mbui_cur (iter)));
+          p += mb_len (mbui_cur (iter));
+        }
     }
+  else
+    {
+      const char *iter;
+
+      for (iter = string; *iter != '\0'; iter++)
+        {
+          if (strchr (special, *iter))
+            *p++ = '\\';
+          *p++ = *iter++;
+        }
+    }
+  if (spec->anchored)
+    *p++ = '$';
+
   return p;
 }
 
-/* Returns the freshly allocated quoted string.  */
 char *
-regex_quote (const char *string, int cflags)
+regex_quote (const char *string, const struct regex_quote_spec *spec)
 {
-  size_t length = regex_quote_length (string, cflags);
+  size_t length = regex_quote_length (string, spec);
   char *result = XNMALLOC (length + 1, char);
   char *p;
 
   p = result;
-  p = regex_quote_copy (p, string, cflags);
+  p = regex_quote_copy (p, string, spec);
   *p = '\0';
   return result;
 }
index e1e2a64..402dfaa 100644 (file)
    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 _REGEX_QUOTE_H
+#define _REGEX_QUOTE_H
+
 #include <stddef.h>
+#include <stdbool.h>
+
+
+/* Specifies a quotation task for converting a fixed string to a regular
+   expression pattern.  */
+struct regex_quote_spec
+{
+  /* True if the regular expression pattern consists of multibyte characters
+     (in the encoding given by the LC_CTYPE category of the locale),
+     false if it consists of single bytes or UTF-8 characters.  */
+  unsigned int /*bool*/ multibyte : 1;
+  /* True if the regular expression pattern shall match only entire lines.  */
+  unsigned int /*bool*/ anchored : 1;
+  /* Set of characters that need to be escaped (all ASCII), as a
+     NUL-terminated string.  */
+  char special[30 + 1];
+};
 
-/* regex_quote converts a literal string to a regular expression that will
-   look for this literal string.
-   cflags can be 0 or REG_EXTENDED.
+
+/* Creates a quotation task that produces a POSIX regular expression, that is,
+   a pattern that can be compiled with regcomp().
+   CFLAGS can be 0 or REG_EXTENDED.
    If it is 0, the result is a Basic Regular Expression (BRE)
    <http://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03>.
    If it is REG_EXTENDED, the result is an Extended Regular Expression (ERE)
    <http://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04>.
-   The result is not anchored; if you want it to match only complete lines,
-   you need to add "^" at the beginning of the result and "$" at the end of the
-   result.
- */
+   If ANCHORED is false, the regular expression will match substrings of lines.
+   If ANCHORED is true, it will match only complete lines,  */
+extern struct regex_quote_spec
+       regex_quote_spec_posix (int cflags, bool anchored);
+
+/* Creates a quotation task that produces a regular expression that can be
+   compiled with the GNU API function re_compile_pattern().
+   SYNTAX describes the syntax of the regular expression (such as
+   RE_SYNTAX_POSIX_BASIC, RE_SYNTAX_POSIX_EXTENDED, RE_SYNTAX_EMACS, all
+   defined in <regex.h>).  It must be the same value as 're_syntax_options'
+   at the moment of the re_compile_pattern() call.
+   If ANCHORED is false, the regular expression will match substrings of lines.
+   If ANCHORED is true, it will match only complete lines,  */
+extern struct regex_quote_spec
+       regex_quote_spec_gnu (unsigned long /*reg_syntax_t*/ syntax, bool anchored);
+
+/* Creates a quotation task that produces a PCRE regular expression, that is,
+   a pattern that can be compiled with pcre_compile().
+   OPTIONS is the same value as the second argument passed to pcre_compile().
+   If ANCHORED is false, the regular expression will match substrings of lines.
+   If ANCHORED is true, it will match only complete lines,  */
+extern struct regex_quote_spec
+       regex_quote_spec_pcre (int options, bool anchored);
+
 
 /* Returns the number of bytes needed for the quoted string.  */
-extern size_t regex_quote_length (const char *string, int cflags);
+extern size_t
+       regex_quote_length (const char *string, const struct regex_quote_spec *spec);
 
 /* Copies the quoted string to p and returns the incremented p.
-   There must be room for regex_quote_length (string, cflags) + 1 bytes at p.
- */
-extern char * regex_quote_copy (char *p, const char *string, int cflags);
+   There must be room for regex_quote_length (string, spec) + 1 bytes at p.  */
+extern char *
+       regex_quote_copy (char *p,
+                         const char *string, const struct regex_quote_spec *spec);
 
 /* Returns the freshly allocated quoted string.  */
-extern char * regex_quote (const char *string, int cflags);
+extern char *
+       regex_quote (const char *string, const struct regex_quote_spec *spec);
+
+
+#endif /* _REGEX_QUOTE_H */
index 3fc666b..cbff85f 100644 (file)
@@ -43,7 +43,7 @@
 # include "xalloc.h"
 #endif
 
-#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__
+#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 #endif
@@ -70,8 +70,8 @@
    ISSLASH(C)           tests whether C is a directory separator character.
    IS_PATH_WITH_DIR(P)  tests whether P contains a directory specification.
  */
-#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
-  /* Win32, Cygwin, OS/2, DOS */
+#if ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __EMX__ || defined __DJGPP__
+  /* Win32, OS/2, DOS */
 # define ISSLASH(C) ((C) == '/' || (C) == '\\')
 # define HAS_DEVICE(P) \
     ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
@@ -293,7 +293,12 @@ compute_curr_prefix (const char *orig_installprefix,
 /* Full pathname of shared library, or NULL.  */
 static char *shared_library_fullname;
 
-#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__
+#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+/* Native Win32 only.
+   On Cygwin, it is better to use the Cygwin provided /proc interface, than
+   to use native Win32 API and cygwin_conv_to_posix_path, because it supports
+   longer file names
+   (see <http://cygwin.com/ml/cygwin/2011-01/msg00410.html>).  */
 
 /* Determine the full pathname of the shared library when it is loaded.  */
 
@@ -315,38 +320,21 @@ DllMain (HINSTANCE module_handle, DWORD event, LPVOID reserved)
         /* 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);
-#else
-        shared_library_fullname = strdup (location);
-#endif
-      }
+      shared_library_fullname = strdup (location);
     }
 
   return TRUE;
 }
 
-#else /* Unix except Cygwin */
+#else /* Unix */
 
 static void
 find_shared_library_fullname ()
 {
-#if defined __linux__ && (__GLIBC__ >= 2 || defined __UCLIBC__)
+#if (defined __linux__ && (__GLIBC__ >= 2 || defined __UCLIBC__)) || defined __CYGWIN__
   /* Linux has /proc/self/maps. glibc 2 and uClibc have the getline()
-     function.  */
+     function.
+     Cygwin >= 1.5 has /proc/self/maps and the getline() function too.  */
   FILE *fp;
 
   /* Open the current process' maps file.  It describes one VMA per line.  */
@@ -391,7 +379,7 @@ find_shared_library_fullname ()
 #endif
 }
 
-#endif /* (WIN32 or Cygwin) / (Unix except Cygwin) */
+#endif /* WIN32 / Unix */
 
 /* Return the full pathname of the current shared library.
    Return NULL if unknown.
@@ -399,7 +387,7 @@ find_shared_library_fullname ()
 static char *
 get_shared_library_fullname ()
 {
-#if !(defined _WIN32 || defined __WIN32__ || defined __CYGWIN__)
+#if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
   static bool tried_find_shared_library_fullname;
   if (!tried_find_shared_library_fullname)
     {
index 8e02c37..d7395a5 100644 (file)
@@ -23,6 +23,8 @@
 #include <errno.h>
 #include <string.h>
 
+#include "dosname.h"
+
 #undef rmdir
 
 /* Remove directory DIR.
index 982e73f..f19e98e 100644 (file)
@@ -31,7 +31,7 @@
 #include <sys/wait.h>
 #include <unistd.h>
 
-#include "dirname.h"
+#include "dosname.h"
 #include "fcntl-safer.h"
 
 /* Save the working directory into *WD, if it hasn't been saved
diff --git a/lib/setlocale.c b/lib/setlocale.c
new file mode 100644 (file)
index 0000000..0cef00f
--- /dev/null
@@ -0,0 +1,938 @@
+/* Set the current locale.
+   Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+
+   This 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>, 2009.  */
+
+#include <config.h>
+
+/* Override setlocale() so that when the default locale is requested
+   (locale = ""), the environment variables LC_ALL, LC_*, and LANG are
+   considered.
+   Also include all the functionality from libintl's setlocale() override.  */
+
+/* Please keep this file in sync with
+   gettext/gettext-runtime/intl/setlocale.c !  */
+
+/* Specification.  */
+#include <locale.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "localename.h"
+
+#if 1
+
+# undef setlocale
+
+/* Return string representation of locale category CATEGORY.  */
+static const char *
+category_to_name (int category)
+{
+  const char *retval;
+
+  switch (category)
+  {
+  case LC_COLLATE:
+    retval = "LC_COLLATE";
+    break;
+  case LC_CTYPE:
+    retval = "LC_CTYPE";
+    break;
+  case LC_MONETARY:
+    retval = "LC_MONETARY";
+    break;
+  case LC_NUMERIC:
+    retval = "LC_NUMERIC";
+    break;
+  case LC_TIME:
+    retval = "LC_TIME";
+    break;
+  case LC_MESSAGES:
+    retval = "LC_MESSAGES";
+    break;
+  default:
+    /* If you have a better idea for a default value let me know.  */
+    retval = "LC_XXX";
+  }
+
+  return retval;
+}
+
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+
+/* The native Win32 setlocale() function expects locale names of the form
+   "German" or "German_Germany" or "DEU", but not "de" or "de_DE".  We need
+   to convert the names from the form with ISO 639 language code and ISO 3166
+   country code to the form with English names or with three-letter identifier.
+   The three-letter identifiers known by a Windows XP SP2 or SP3 are:
+     AFK  Afrikaans_South Africa.1252
+     ARA  Arabic_Saudi Arabia.1256
+     ARB  Arabic_Lebanon.1256
+     ARE  Arabic_Egypt.1256
+     ARG  Arabic_Algeria.1256
+     ARH  Arabic_Bahrain.1256
+     ARI  Arabic_Iraq.1256
+     ARJ  Arabic_Jordan.1256
+     ARK  Arabic_Kuwait.1256
+     ARL  Arabic_Libya.1256
+     ARM  Arabic_Morocco.1256
+     ARO  Arabic_Oman.1256
+     ARQ  Arabic_Qatar.1256
+     ARS  Arabic_Syria.1256
+     ART  Arabic_Tunisia.1256
+     ARU  Arabic_U.A.E..1256
+     ARY  Arabic_Yemen.1256
+     AZE  Azeri (Latin)_Azerbaijan.1254
+     BEL  Belarusian_Belarus.1251
+     BGR  Bulgarian_Bulgaria.1251
+     BSB  Bosnian_Bosnia and Herzegovina.1250
+     BSC  Bosnian (Cyrillic)_Bosnia and Herzegovina.1250  (wrong encoding!)
+     CAT  Catalan_Spain.1252
+     CHH  Chinese_Hong Kong S.A.R..950
+     CHI  Chinese_Singapore.936
+     CHS  Chinese_People's Republic of China.936
+     CHT  Chinese_Taiwan.950
+     CSY  Czech_Czech Republic.1250
+     CYM  Welsh_United Kingdom.1252
+     DAN  Danish_Denmark.1252
+     DEA  German_Austria.1252
+     DEC  German_Liechtenstein.1252
+     DEL  German_Luxembourg.1252
+     DES  German_Switzerland.1252
+     DEU  German_Germany.1252
+     ELL  Greek_Greece.1253
+     ENA  English_Australia.1252
+     ENB  English_Caribbean.1252
+     ENC  English_Canada.1252
+     ENG  English_United Kingdom.1252
+     ENI  English_Ireland.1252
+     ENJ  English_Jamaica.1252
+     ENL  English_Belize.1252
+     ENP  English_Republic of the Philippines.1252
+     ENS  English_South Africa.1252
+     ENT  English_Trinidad and Tobago.1252
+     ENU  English_United States.1252
+     ENW  English_Zimbabwe.1252
+     ENZ  English_New Zealand.1252
+     ESA  Spanish_Panama.1252
+     ESB  Spanish_Bolivia.1252
+     ESC  Spanish_Costa Rica.1252
+     ESD  Spanish_Dominican Republic.1252
+     ESE  Spanish_El Salvador.1252
+     ESF  Spanish_Ecuador.1252
+     ESG  Spanish_Guatemala.1252
+     ESH  Spanish_Honduras.1252
+     ESI  Spanish_Nicaragua.1252
+     ESL  Spanish_Chile.1252
+     ESM  Spanish_Mexico.1252
+     ESN  Spanish_Spain.1252
+     ESO  Spanish_Colombia.1252
+     ESP  Spanish_Spain.1252
+     ESR  Spanish_Peru.1252
+     ESS  Spanish_Argentina.1252
+     ESU  Spanish_Puerto Rico.1252
+     ESV  Spanish_Venezuela.1252
+     ESY  Spanish_Uruguay.1252
+     ESZ  Spanish_Paraguay.1252
+     ETI  Estonian_Estonia.1257
+     EUQ  Basque_Spain.1252
+     FAR  Farsi_Iran.1256
+     FIN  Finnish_Finland.1252
+     FOS  Faroese_Faroe Islands.1252
+     FPO  Filipino_Philippines.1252
+     FRA  French_France.1252
+     FRB  French_Belgium.1252
+     FRC  French_Canada.1252
+     FRL  French_Luxembourg.1252
+     FRM  French_Principality of Monaco.1252
+     FRS  French_Switzerland.1252
+     FYN  Frisian_Netherlands.1252
+     GLC  Galician_Spain.1252
+     HEB  Hebrew_Israel.1255
+     HRB  Croatian_Bosnia and Herzegovina.1250
+     HRV  Croatian_Croatia.1250
+     HUN  Hungarian_Hungary.1250
+     IND  Indonesian_Indonesia.1252
+     IRE  Irish_Ireland.1252
+     ISL  Icelandic_Iceland.1252
+     ITA  Italian_Italy.1252
+     ITS  Italian_Switzerland.1252
+     IUK  Inuktitut (Latin)_Canada.1252
+     JPN  Japanese_Japan.932
+     KKZ  Kazakh_Kazakhstan.1251
+     KOR  Korean_Korea.949
+     KYR  Kyrgyz_Kyrgyzstan.1251
+     LBX  Luxembourgish_Luxembourg.1252
+     LTH  Lithuanian_Lithuania.1257
+     LVI  Latvian_Latvia.1257
+     MKI  FYRO Macedonian_Former Yugoslav Republic of Macedonia.1251
+     MON  Mongolian_Mongolia.1251
+     MPD  Mapudungun_Chile.1252
+     MSB  Malay_Brunei Darussalam.1252
+     MSL  Malay_Malaysia.1252
+     MWK  Mohawk_Canada.1252
+     NLB  Dutch_Belgium.1252
+     NLD  Dutch_Netherlands.1252
+     NON  Norwegian-Nynorsk_Norway.1252
+     NOR  Norwegian (BokmÃ¥l)_Norway.1252
+     NSO  Northern Sotho_South Africa.1252
+     PLK  Polish_Poland.1250
+     PTB  Portuguese_Brazil.1252
+     PTG  Portuguese_Portugal.1252
+     QUB  Quechua_Bolivia.1252
+     QUE  Quechua_Ecuador.1252
+     QUP  Quechua_Peru.1252
+     RMC  Romansh_Switzerland.1252
+     ROM  Romanian_Romania.1250
+     RUS  Russian_Russia.1251
+     SKY  Slovak_Slovakia.1250
+     SLV  Slovenian_Slovenia.1250
+     SMA  Sami (Southern)_Norway.1252
+     SMB  Sami (Southern)_Sweden.1252
+     SME  Sami (Northern)_Norway.1252
+     SMF  Sami (Northern)_Sweden.1252
+     SMG  Sami (Northern)_Finland.1252
+     SMJ  Sami (Lule)_Norway.1252
+     SMK  Sami (Lule)_Sweden.1252
+     SMN  Sami (Inari)_Finland.1252
+     SMS  Sami (Skolt)_Finland.1252
+     SQI  Albanian_Albania.1250
+     SRB  Serbian (Cyrillic)_Serbia and Montenegro.1251
+     SRL  Serbian (Latin)_Serbia and Montenegro.1250
+     SRN  Serbian (Cyrillic)_Bosnia and Herzegovina.1251
+     SRS  Serbian (Latin)_Bosnia and Herzegovina.1250
+     SVE  Swedish_Sweden.1252
+     SVF  Swedish_Finland.1252
+     SWK  Swahili_Kenya.1252
+     THA  Thai_Thailand.874
+     TRK  Turkish_Turkey.1254
+     TSN  Tswana_South Africa.1252
+     TTT  Tatar_Russia.1251
+     UKR  Ukrainian_Ukraine.1251
+     URD  Urdu_Islamic Republic of Pakistan.1256
+     USA  English_United States.1252
+     UZB  Uzbek (Latin)_Uzbekistan.1254
+     VIT  Vietnamese_Viet Nam.1258
+     XHO  Xhosa_South Africa.1252
+     ZHH  Chinese_Hong Kong S.A.R..950
+     ZHI  Chinese_Singapore.936
+     ZHM  Chinese_Macau S.A.R..950
+     ZUL  Zulu_South Africa.1252
+ */
+
+/* Table from ISO 639 language code, optionally with country or script suffix,
+   to English name.
+   Keep in sync with the gl_locale_name_from_win32_LANGID function in
+   localename.c!  */
+struct table_entry
+{
+  const char *code;
+  const char *english;
+};
+static const struct table_entry language_table[] =
+  {
+    { "af", "Afrikaans" },
+    { "am", "Amharic" },
+    { "ar", "Arabic" },
+    { "arn", "Mapudungun" },
+    { "as", "Assamese" },
+    { "az@cyrillic", "Azeri (Cyrillic)" },
+    { "az@latin", "Azeri (Latin)" },
+    { "ba", "Bashkir" },
+    { "be", "Belarusian" },
+    { "ber", "Tamazight" },
+    { "ber@arabic", "Tamazight (Arabic)" },
+    { "ber@latin", "Tamazight (Latin)" },
+    { "bg", "Bulgarian" },
+    { "bin", "Edo" },
+    { "bn", "Bengali" },
+    { "bn_BD", "Bengali (Bangladesh)" },
+    { "bn_IN", "Bengali (India)" },
+    { "bnt", "Sutu" },
+    { "bo", "Tibetan" },
+    { "br", "Breton" },
+    { "bs", "BSB" }, /* "Bosnian (Latin)" */
+    { "bs@cyrillic", "BSC" }, /* Bosnian (Cyrillic) */
+    { "ca", "Catalan" },
+    { "chr", "Cherokee" },
+    { "co", "Corsican" },
+    { "cpe", "Hawaiian" },
+    { "cs", "Czech" },
+    { "cy", "Welsh" },
+    { "da", "Danish" },
+    { "de", "German" },
+    { "dsb", "Lower Sorbian" },
+    { "dv", "Divehi" },
+    { "el", "Greek" },
+    { "en", "English" },
+    { "es", "Spanish" },
+    { "et", "Estonian" },
+    { "eu", "Basque" },
+    { "fa", "Farsi" },
+    { "ff", "Fulfulde" },
+    { "fi", "Finnish" },
+    { "fo", "Faroese" }, /* "Faeroese" does not work */
+    { "fr", "French" },
+    { "fy", "Frisian" },
+    { "ga", "IRE" }, /* Gaelic (Ireland) */
+    { "gd", "Gaelic (Scotland)" },
+    { "gd", "Scottish Gaelic" },
+    { "gl", "Galician" },
+    { "gn", "Guarani" },
+    { "gsw", "Alsatian" },
+    { "gu", "Gujarati" },
+    { "ha", "Hausa" },
+    { "he", "Hebrew" },
+    { "hi", "Hindi" },
+    { "hr", "Croatian" },
+    { "hsb", "Upper Sorbian" },
+    { "hu", "Hungarian" },
+    { "hy", "Armenian" },
+    { "id", "Indonesian" },
+    { "ig", "Igbo" },
+    { "ii", "Yi" },
+    { "is", "Icelandic" },
+    { "it", "Italian" },
+    { "iu", "IUK" }, /* Inuktitut */
+    { "ja", "Japanese" },
+    { "ka", "Georgian" },
+    { "kk", "Kazakh" },
+    { "kl", "Greenlandic" },
+    { "km", "Cambodian" },
+    { "km", "Khmer" },
+    { "kn", "Kannada" },
+    { "ko", "Korean" },
+    { "kok", "Konkani" },
+    { "kr", "Kanuri" },
+    { "ks", "Kashmiri" },
+    { "ks_IN", "Kashmiri_India" },
+    { "ks_PK", "Kashmiri (Arabic)_Pakistan" },
+    { "ky", "Kyrgyz" },
+    { "la", "Latin" },
+    { "lb", "Luxembourgish" },
+    { "lo", "Lao" },
+    { "lt", "Lithuanian" },
+    { "lv", "Latvian" },
+    { "mi", "Maori" },
+    { "mk", "FYRO Macedonian" },
+    { "mk", "Macedonian" },
+    { "ml", "Malayalam" },
+    { "mn", "Mongolian" },
+    { "mni", "Manipuri" },
+    { "moh", "Mohawk" },
+    { "mr", "Marathi" },
+    { "ms", "Malay" },
+    { "mt", "Maltese" },
+    { "my", "Burmese" },
+    { "nb", "NOR" }, /* Norwegian BokmÃ¥l */
+    { "ne", "Nepali" },
+    { "nic", "Ibibio" },
+    { "nl", "Dutch" },
+    { "nn", "NON" }, /* Norwegian Nynorsk */
+    { "no", "Norwegian" },
+    { "nso", "Northern Sotho" },
+    { "nso", "Sepedi" },
+    { "oc", "Occitan" },
+    { "om", "Oromo" },
+    { "or", "Oriya" },
+    { "pa", "Punjabi" },
+    { "pap", "Papiamentu" },
+    { "pl", "Polish" },
+    { "prs", "Dari" },
+    { "ps", "Pashto" },
+    { "pt", "Portuguese" },
+    { "qu", "Quechua" },
+    { "qut", "K'iche'" },
+    { "rm", "Romansh" },
+    { "ro", "Romanian" },
+    { "ru", "Russian" },
+    { "rw", "Kinyarwanda" },
+    { "sa", "Sanskrit" },
+    { "sah", "Yakut" },
+    { "sd", "Sindhi" },
+    { "se", "Sami (Northern)" },
+    { "se", "Northern Sami" },
+    { "si", "Sinhalese" },
+    { "sk", "Slovak" },
+    { "sl", "Slovenian" },
+    { "sma", "Sami (Southern)" },
+    { "sma", "Southern Sami" },
+    { "smj", "Sami (Lule)" },
+    { "smj", "Lule Sami" },
+    { "smn", "Sami (Inari)" },
+    { "smn", "Inari Sami" },
+    { "sms", "Sami (Skolt)" },
+    { "sms", "Skolt Sami" },
+    { "so", "Somali" },
+    { "sq", "Albanian" },
+    { "sr", "Serbian (Latin)" },
+    { "sr@cyrillic", "SRB" }, /* Serbian (Cyrillic) */
+    { "sw", "Swahili" },
+    { "syr", "Syriac" },
+    { "ta", "Tamil" },
+    { "te", "Telugu" },
+    { "tg", "Tajik" },
+    { "th", "Thai" },
+    { "ti", "Tigrinya" },
+    { "tk", "Turkmen" },
+    { "tl", "Filipino" },
+    { "tn", "Tswana" },
+    { "tr", "Turkish" },
+    { "ts", "Tsonga" },
+    { "tt", "Tatar" },
+    { "ug", "Uighur" },
+    { "uk", "Ukrainian" },
+    { "ur", "Urdu" },
+    { "uz", "Uzbek" },
+    { "uz", "Uzbek (Latin)" },
+    { "uz@cyrillic", "Uzbek (Cyrillic)" },
+    { "ve", "Venda" },
+    { "vi", "Vietnamese" },
+    { "wen", "Sorbian" },
+    { "wo", "Wolof" },
+    { "xh", "Xhosa" },
+    { "yi", "Yiddish" },
+    { "yo", "Yoruba" },
+    { "zh", "Chinese" },
+    { "zu", "Zulu" }
+  };
+
+/* Table from ISO 3166 country code to English name.
+   Keep in sync with the gl_locale_name_from_win32_LANGID function in
+   localename.c!  */
+static const struct table_entry country_table[] =
+  {
+    { "AE", "U.A.E." },
+    { "AF", "Afghanistan" },
+    { "AL", "Albania" },
+    { "AM", "Armenia" },
+    { "AN", "Netherlands Antilles" },
+    { "AR", "Argentina" },
+    { "AT", "Austria" },
+    { "AU", "Australia" },
+    { "AZ", "Azerbaijan" },
+    { "BA", "Bosnia and Herzegovina" },
+    { "BD", "Bangladesh" },
+    { "BE", "Belgium" },
+    { "BG", "Bulgaria" },
+    { "BH", "Bahrain" },
+    { "BN", "Brunei Darussalam" },
+    { "BO", "Bolivia" },
+    { "BR", "Brazil" },
+    { "BT", "Bhutan" },
+    { "BY", "Belarus" },
+    { "BZ", "Belize" },
+    { "CA", "Canada" },
+    { "CG", "Congo" },
+    { "CH", "Switzerland" },
+    { "CI", "Cote d'Ivoire" },
+    { "CL", "Chile" },
+    { "CM", "Cameroon" },
+    { "CN", "People's Republic of China" },
+    { "CO", "Colombia" },
+    { "CR", "Costa Rica" },
+    { "CS", "Serbia and Montenegro" },
+    { "CZ", "Czech Republic" },
+    { "DE", "Germany" },
+    { "DK", "Denmark" },
+    { "DO", "Dominican Republic" },
+    { "DZ", "Algeria" },
+    { "EC", "Ecuador" },
+    { "EE", "Estonia" },
+    { "EG", "Egypt" },
+    { "ER", "Eritrea" },
+    { "ES", "Spain" },
+    { "ET", "Ethiopia" },
+    { "FI", "Finland" },
+    { "FO", "Faroe Islands" },
+    { "FR", "France" },
+    { "GB", "United Kingdom" },
+    { "GD", "Caribbean" },
+    { "GE", "Georgia" },
+    { "GL", "Greenland" },
+    { "GR", "Greece" },
+    { "GT", "Guatemala" },
+    { "HK", "Hong Kong" },
+    { "HK", "Hong Kong S.A.R." },
+    { "HN", "Honduras" },
+    { "HR", "Croatia" },
+    { "HT", "Haiti" },
+    { "HU", "Hungary" },
+    { "ID", "Indonesia" },
+    { "IE", "Ireland" },
+    { "IL", "Israel" },
+    { "IN", "India" },
+    { "IQ", "Iraq" },
+    { "IR", "Iran" },
+    { "IS", "Iceland" },
+    { "IT", "Italy" },
+    { "JM", "Jamaica" },
+    { "JO", "Jordan" },
+    { "JP", "Japan" },
+    { "KE", "Kenya" },
+    { "KG", "Kyrgyzstan" },
+    { "KH", "Cambodia" },
+    { "KR", "South Korea" },
+    { "KW", "Kuwait" },
+    { "KZ", "Kazakhstan" },
+    { "LA", "Laos" },
+    { "LB", "Lebanon" },
+    { "LI", "Liechtenstein" },
+    { "LK", "Sri Lanka" },
+    { "LT", "Lithuania" },
+    { "LU", "Luxembourg" },
+    { "LV", "Latvia" },
+    { "LY", "Libya" },
+    { "MA", "Morocco" },
+    { "MC", "Principality of Monaco" },
+    { "MD", "Moldava" },
+    { "MD", "Moldova" },
+    { "ME", "Montenegro" },
+    { "MK", "Former Yugoslav Republic of Macedonia" },
+    { "ML", "Mali" },
+    { "MM", "Myanmar" },
+    { "MN", "Mongolia" },
+    { "MO", "Macau S.A.R." },
+    { "MT", "Malta" },
+    { "MV", "Maldives" },
+    { "MX", "Mexico" },
+    { "MY", "Malaysia" },
+    { "NG", "Nigeria" },
+    { "NI", "Nicaragua" },
+    { "NL", "Netherlands" },
+    { "NO", "Norway" },
+    { "NP", "Nepal" },
+    { "NZ", "New Zealand" },
+    { "OM", "Oman" },
+    { "PA", "Panama" },
+    { "PE", "Peru" },
+    { "PH", "Philippines" },
+    { "PK", "Islamic Republic of Pakistan" },
+    { "PL", "Poland" },
+    { "PR", "Puerto Rico" },
+    { "PT", "Portugal" },
+    { "PY", "Paraguay" },
+    { "QA", "Qatar" },
+    { "RE", "Reunion" },
+    { "RO", "Romania" },
+    { "RS", "Serbia" },
+    { "RU", "Russia" },
+    { "RW", "Rwanda" },
+    { "SA", "Saudi Arabia" },
+    { "SE", "Sweden" },
+    { "SG", "Singapore" },
+    { "SI", "Slovenia" },
+    { "SK", "Slovak" },
+    { "SN", "Senegal" },
+    { "SO", "Somalia" },
+    { "SR", "Suriname" },
+    { "SV", "El Salvador" },
+    { "SY", "Syria" },
+    { "TH", "Thailand" },
+    { "TJ", "Tajikistan" },
+    { "TM", "Turkmenistan" },
+    { "TN", "Tunisia" },
+    { "TR", "Turkey" },
+    { "TT", "Trinidad and Tobago" },
+    { "TW", "Taiwan" },
+    { "TZ", "Tanzania" },
+    { "UA", "Ukraine" },
+    { "US", "United States" },
+    { "UY", "Uruguay" },
+    { "VA", "Vatican" },
+    { "VE", "Venezuela" },
+    { "VN", "Viet Nam" },
+    { "YE", "Yemen" },
+    { "ZA", "South Africa" },
+    { "ZW", "Zimbabwe" }
+  };
+
+/* Given a string STRING, find the set of indices i such that TABLE[i].code is
+   the given STRING.  It is a range [lo,hi-1].  */
+typedef struct { size_t lo; size_t hi; } range_t;
+static void
+search (const struct table_entry *table, size_t table_size, const char *string,
+        range_t *result)
+{
+  /* The table is sorted.  Perform a binary search.  */
+  size_t hi = table_size;
+  size_t lo = 0;
+  while (lo < hi)
+    {
+      /* Invariant:
+         for i < lo, strcmp (table[i].code, string) < 0,
+         for i >= hi, strcmp (table[i].code, string) > 0.  */
+      size_t mid = (hi + lo) >> 1; /* >= lo, < hi */
+      int cmp = strcmp (table[mid].code, string);
+      if (cmp < 0)
+        lo = mid + 1;
+      else if (cmp > 0)
+        hi = mid;
+      else
+        {
+          /* Found an i with
+               strcmp (language_table[i].code, string) == 0.
+             Find the entire interval of such i.  */
+          {
+            size_t i;
+
+            for (i = mid; i > lo; )
+              {
+                i--;
+                if (strcmp (table[i].code, string) < 0)
+                  {
+                    lo = i + 1;
+                    break;
+                  }
+              }
+          }
+          {
+            size_t i;
+
+            for (i = mid; i < hi; i++)
+              {
+                if (strcmp (table[i].code, string) > 0)
+                  {
+                    hi = i;
+                    break;
+                  }
+              }
+          }
+          /* The set of i with
+               strcmp (language_table[i].code, string) == 0
+             is the interval [lo, hi-1].  */
+          break;
+        }
+    }
+  result->lo = lo;
+  result->hi = hi;
+}
+
+/* Like setlocale, but accept also locale names in the form ll or ll_CC,
+   where ll is an ISO 639 language code and CC is an ISO 3166 country code.  */
+static char *
+setlocale_unixlike (int category, const char *locale)
+{
+  char *result;
+  char llCC_buf[64];
+  char ll_buf[64];
+  char CC_buf[64];
+
+  /* First, try setlocale with the original argument unchanged.  */
+  result = setlocale (category, locale);
+  if (result != NULL)
+    return result;
+
+  /* Otherwise, assume the argument is in the form
+       language[_territory][.codeset][@modifier]
+     and try to map it using the tables.  */
+  if (strlen (locale) < sizeof (llCC_buf))
+    {
+      /* Second try: Remove the codeset part.  */
+      {
+        const char *p = locale;
+        char *q = llCC_buf;
+
+        /* Copy the part before the dot.  */
+        for (; *p != '\0' && *p != '.'; p++, q++)
+          *q = *p;
+        if (*p == '.')
+          /* Skip the part up to the '@', if any.  */
+          for (; *p != '\0' && *p != '@'; p++)
+            ;
+        /* Copy the part starting with '@', if any.  */
+        for (; *p != '\0'; p++, q++)
+          *q = *p;
+        *q = '\0';
+      }
+      /* llCC_buf now contains
+           language[_territory][@modifier]
+       */
+      if (strcmp (llCC_buf, locale) != 0)
+        {
+          result = setlocale (category, llCC_buf);
+          if (result != NULL)
+            return result;
+        }
+      /* Look it up in language_table.  */
+      {
+        range_t range;
+        size_t i;
+
+        search (language_table,
+                sizeof (language_table) / sizeof (language_table[0]),
+                llCC_buf,
+                &range);
+
+        for (i = range.lo; i < range.hi; i++)
+          {
+            /* Try the replacement in language_table[i].  */
+            result = setlocale (category, language_table[i].english);
+            if (result != NULL)
+              return result;
+          }
+      }
+      /* Split language[_territory][@modifier]
+         into  ll_buf = language[@modifier]
+         and   CC_buf = territory
+       */
+      {
+        const char *underscore = strchr (llCC_buf, '_');
+        if (underscore != NULL)
+          {
+            const char *territory_start = underscore + 1;
+            const char *territory_end = strchr (territory_start, '@');
+            if (territory_end == NULL)
+              territory_end = territory_start + strlen (territory_start);
+
+            memcpy (ll_buf, llCC_buf, underscore - llCC_buf);
+            strcpy (ll_buf + (underscore - llCC_buf), territory_end);
+
+            memcpy (CC_buf, territory_start, territory_end - territory_start);
+            CC_buf[territory_end - territory_start] = '\0';
+
+            {
+              /* Look up ll_buf in language_table
+                 and CC_buf in country_table.  */
+              range_t language_range;
+
+              search (language_table,
+                      sizeof (language_table) / sizeof (language_table[0]),
+                      ll_buf,
+                      &language_range);
+              if (language_range.lo < language_range.hi)
+                {
+                  range_t country_range;
+
+                  search (country_table,
+                          sizeof (country_table) / sizeof (country_table[0]),
+                          CC_buf,
+                          &country_range);
+                  if (country_range.lo < country_range.hi)
+                    {
+                      size_t i;
+                      size_t j;
+
+                      for (i = language_range.lo; i < language_range.hi; i++)
+                        for (j = country_range.lo; j < country_range.hi; j++)
+                          {
+                            /* Concatenate the replacements.  */
+                            const char *part1 = language_table[i].english;
+                            size_t part1_len = strlen (part1);
+                            const char *part2 = country_table[j].english;
+                            size_t part2_len = strlen (part2) + 1;
+                            char buf[64+64];
+
+                            if (!(part1_len + 1 + part2_len <= sizeof (buf)))
+                              abort ();
+                            memcpy (buf, part1, part1_len);
+                            buf[part1_len] = '_';
+                            memcpy (buf + part1_len + 1, part2, part2_len);
+
+                            /* Try the concatenated replacements.  */
+                            result = setlocale (category, buf);
+                            if (result != NULL)
+                              return result;
+                          }
+                    }
+
+                  /* Try omitting the country entirely.  This may set a locale
+                     corresponding to the wrong country, but is better than
+                     failing entirely.  */
+                  {
+                    size_t i;
+
+                    for (i = language_range.lo; i < language_range.hi; i++)
+                      {
+                        /* Try only the language replacement.  */
+                        result =
+                          setlocale (category, language_table[i].english);
+                        if (result != NULL)
+                          return result;
+                      }
+                  }
+                }
+            }
+          }
+      }
+    }
+
+  /* Failed.  */
+  return NULL;
+}
+
+# else
+#  define setlocale_unixlike setlocale
+# endif
+
+# if LC_MESSAGES == 1729
+
+/* The system does not store an LC_MESSAGES locale category.  Do it here.  */
+static char lc_messages_name[64] = "C";
+
+/* Like setlocale, but support also LC_MESSAGES.  */
+static char *
+setlocale_single (int category, const char *locale)
+{
+  if (category == LC_MESSAGES)
+    {
+      if (locale != NULL)
+        {
+          lc_messages_name[sizeof (lc_messages_name) - 1] = '\0';
+          strncpy (lc_messages_name, locale, sizeof (lc_messages_name) - 1);
+        }
+      return lc_messages_name;
+    }
+  else
+    return setlocale_unixlike (category, locale);
+}
+
+# else
+#  define setlocale_single setlocale_unixlike
+# endif
+
+char *
+rpl_setlocale (int category, const char *locale)
+{
+  if (locale != NULL && locale[0] == '\0')
+    {
+      /* A request to the set the current locale to the default locale.  */
+      if (category == LC_ALL)
+        {
+          /* Set LC_CTYPE first.  Then the other categories.  */
+          static int const categories[] =
+            {
+              LC_NUMERIC,
+              LC_TIME,
+              LC_COLLATE,
+              LC_MONETARY,
+              LC_MESSAGES
+            };
+          char *saved_locale;
+          const char *base_name;
+          unsigned int i;
+
+          /* Back up the old locale, in case one of the steps fails.  */
+          saved_locale = setlocale (LC_ALL, NULL);
+          if (saved_locale == NULL)
+            return NULL;
+          saved_locale = strdup (saved_locale);
+          if (saved_locale == NULL)
+            return NULL;
+
+          /* Set LC_CTYPE category.  Set all other categories (except possibly
+             LC_MESSAGES) to the same value in the same call; this is likely to
+             save calls.  */
+          base_name =
+            gl_locale_name_environ (LC_CTYPE, category_to_name (LC_CTYPE));
+          if (base_name == NULL)
+            base_name = gl_locale_name_default ();
+
+          if (setlocale_unixlike (LC_ALL, base_name) == NULL)
+            goto fail;
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+          /* On native Windows, setlocale(LC_ALL,...) may succeed but set the
+             LC_CTYPE category to an invalid value ("C") when it does not
+             support the specified encoding.  Report a failure instead.  */
+          if (strchr (base_name, '.') != NULL
+              && strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+            goto fail;
+# endif
+
+          for (i = 0; i < sizeof (categories) / sizeof (categories[0]); i++)
+            {
+              int cat = categories[i];
+              const char *name;
+
+              name = gl_locale_name_environ (cat, category_to_name (cat));
+              if (name == NULL)
+                name = gl_locale_name_default ();
+
+              /* If name is the same as base_name, it has already been set
+                 through the setlocale call before the loop.  */
+              if (strcmp (name, base_name) != 0
+# if LC_MESSAGES == 1729
+                  || cat == LC_MESSAGES
+# endif
+                 )
+                if (setlocale_single (cat, name) == NULL)
+                  goto fail;
+            }
+
+          /* All steps were successful.  */
+          free (saved_locale);
+          return setlocale (LC_ALL, NULL);
+
+        fail:
+          if (saved_locale[0] != '\0') /* don't risk an endless recursion */
+            setlocale (LC_ALL, saved_locale);
+          free (saved_locale);
+          return NULL;
+        }
+      else
+        {
+          const char *name =
+            gl_locale_name_environ (category, category_to_name (category));
+          if (name == NULL)
+            name = gl_locale_name_default ();
+
+          return setlocale_single (category, name);
+        }
+    }
+  else
+    {
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+      if (category == LC_ALL && locale != NULL && strchr (locale, '.') != NULL)
+        {
+          char *saved_locale;
+
+          /* Back up the old locale.  */
+          saved_locale = setlocale (LC_ALL, NULL);
+          if (saved_locale == NULL)
+            return NULL;
+          saved_locale = strdup (saved_locale);
+          if (saved_locale == NULL)
+            return NULL;
+
+          if (setlocale_unixlike (LC_ALL, locale) == NULL)
+            {
+              free (saved_locale);
+              return NULL;
+            }
+
+          /* On native Windows, setlocale(LC_ALL,...) may succeed but set the
+             LC_CTYPE category to an invalid value ("C") when it does not
+             support the specified encoding.  Report a failure instead.  */
+          if (strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+            {
+              if (saved_locale[0] != '\0') /* don't risk an endless recursion */
+                setlocale (LC_ALL, saved_locale);
+              free (saved_locale);
+              return NULL;
+            }
+
+          /* It was really successful.  */
+          free (saved_locale);
+          return setlocale (LC_ALL, NULL);
+        }
+      else
+# endif
+        return setlocale_single (category, locale);
+    }
+}
+
+#endif
index 298895b..e6a55da 100644 (file)
@@ -142,10 +142,10 @@ sigaction (int sig, const struct sigaction *restrict act,
       return -1;
     }
 
-  #ifdef SIGABRT_COMPAT
+#ifdef SIGABRT_COMPAT
   if (sig == SIGABRT_COMPAT)
     sig = SIGABRT;
-  #endif
+#endif
 
   /* POSIX requires sigaction() to be async-signal-safe.  In other
      words, if an asynchronous signal can occur while we are anywhere
index f16d914..cbc9100 100644 (file)
@@ -37,6 +37,7 @@ orig_stat (const char *filename, struct stat *buf)
 #include <limits.h>
 #include <stdbool.h>
 #include <string.h>
+#include "dosname.h"
 
 /* Store information about NAME into ST.  Work around bugs with
    trailing slashes.  Mingw has other bugs (such as st_ino always
index c48be52..c518f3b 100644 (file)
@@ -497,7 +497,12 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
    sequence of nested includes
    <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
    <stdint.h> and assumes its types are already defined.  */
-#if ! (defined WCHAR_MIN && defined WCHAR_MAX)
+#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
+  /* 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>
 # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
 # include <wchar.h>
 # undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
index b5083d1..f12d3be 100644 (file)
 #else
 # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
 #endif
-#define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
+
+/* _GL_ATTRIBUTE_FORMAT_PRINTF
+   indicates to GCC that the function takes a format string and arguments,
+   where the format string directives are the ones standardized by ISO C99
+   and POSIX.  */
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
+   _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument))
+#else
+# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
+   _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
+#endif
+
+/* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF,
+   except that it indicates to GCC that the supported format string directives
+   are the ones of the system printf(), rather than the ones standardized by
+   ISO C99 and POSIX.  */
+#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
   _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
 
 /* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>.  */
@@ -191,9 +208,15 @@ _GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
 #   define fprintf rpl_fprintf
 #  endif
 #  define GNULIB_overrides_fprintf 1
+#  if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
 _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
                                 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
                                 _GL_ARG_NONNULL ((1, 2)));
+#  else
+_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
+                                _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
+                                _GL_ARG_NONNULL ((1, 2)));
+#  endif
 _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
 # else
 _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
@@ -496,6 +519,23 @@ _GL_CXXALIAS_RPL (fwrite, size_t,
 # else
 _GL_CXXALIAS_SYS (fwrite, size_t,
                   (const void *ptr, size_t s, size_t n, FILE *stream));
+
+/* Work around glibc bug 11959
+   <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>,
+   which sometimes causes an unwanted diagnostic for fwrite calls.
+   This affects only function declaration attributes, so it's not
+   needed for C++.  */
+#  if !defined __cplusplus && 0 < __USE_FORTIFY_LEVEL
+static inline size_t _GL_ARG_NONNULL ((1, 4))
+rpl_fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
+{
+  size_t r = fwrite (ptr, s, n, stream);
+  (void) r;
+  return r;
+}
+#   undef fwrite
+#   define fwrite rpl_fwrite
+#  endif
 # endif
 _GL_CXXALIASWARN (fwrite);
 #endif
@@ -677,12 +717,21 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
 /* Don't break __attribute__((format(printf,M,N))).  */
 #    define printf __printf__
 #   endif
+#   if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
 _GL_FUNCDECL_RPL_1 (__printf__, int,
                     (const char *format, ...)
                     __asm__ (@ASM_SYMBOL_PREFIX@
                              _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
                     _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
                     _GL_ARG_NONNULL ((1)));
+#   else
+_GL_FUNCDECL_RPL_1 (__printf__, int,
+                    (const char *format, ...)
+                    __asm__ (@ASM_SYMBOL_PREFIX@
+                             _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
+                    _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
+                    _GL_ARG_NONNULL ((1)));
+#   endif
 _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
 #  else
 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -987,9 +1036,15 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
 #   define vfprintf rpl_vfprintf
 #  endif
 #  define GNULIB_overrides_vfprintf 1
+#  if @GNULIB_VFPRINTF_POSIX@
 _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
                                  _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
                                  _GL_ARG_NONNULL ((1, 2)));
+#  else
+_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
+                                 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
+                                 _GL_ARG_NONNULL ((1, 2)));
+#  endif
 _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
 # else
 /* Need to cast, because on Solaris, the third parameter is
@@ -1017,9 +1072,15 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
 #   define vprintf rpl_vprintf
 #  endif
 #  define GNULIB_overrides_vprintf 1
+#  if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
 _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
                                 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0)
                                 _GL_ARG_NONNULL ((1)));
+#  else
+_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
+                                _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
+                                _GL_ARG_NONNULL ((1)));
+#  endif
 _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
 # else
 /* Need to cast, because on Solaris, the second parameter is
index 62d18c6..2697a4b 100644 (file)
@@ -274,6 +274,21 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
                  "use gnulib module malloc-posix for portability");
 #endif
 
+/* Convert a multibyte character to a wide character.  */
+#if @GNULIB_MBTOWC@
+# if @REPLACE_MBTOWC@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mbtowc
+#   define mbtowc rpl_mbtowc
+#  endif
+_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
+_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
+# else
+_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
+# endif
+_GL_CXXALIASWARN (mbtowc);
+#endif
+
 #if @GNULIB_MKDTEMP@
 /* Create a unique temporary directory from TEMPLATE.
    The last six characters of TEMPLATE must be "XXXXXX";
@@ -723,6 +738,21 @@ _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
 # endif
 #endif
 
+/* Convert a wide character to a multibyte character.  */
+#if @GNULIB_WCTOMB@
+# if @REPLACE_WCTOMB@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wctomb
+#   define wctomb rpl_wctomb
+#  endif
+_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
+_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
+# else
+_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
+# endif
+_GL_CXXALIASWARN (wctomb);
+#endif
+
 
 #endif /* _GL_STDLIB_H */
 #endif /* _GL_STDLIB_H */
index dd80976..7dcb387 100644 (file)
 #include <limits.h>
 #include <stdint.h>
 
-/* We use the Two-Way string matching algorithm, which guarantees
-   linear complexity with constant space.  Additionally, for long
-   needles, we also use a bad character shift table similar to the
-   Boyer-Moore algorithm to achieve improved (potentially sub-linear)
-   performance.
-
-   See http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260
-   and http://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm
+/* We use the Two-Way string matching algorithm (also known as
+   Chrochemore-Perrin), which guarantees linear complexity with
+   constant space.  Additionally, for long needles, we also use a bad
+   character shift table similar to the Boyer-Moore algorithm to
+   achieve improved (potentially sub-linear) performance.
+
+   See http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260,
+   http://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm,
+   http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.34.6641&rep=rep1&type=pdf
 */
 
 /* Point at which computing a bad-byte shift table is likely to be
@@ -108,7 +109,7 @@ static size_t
 critical_factorization (const unsigned char *needle, size_t needle_len,
                         size_t *period)
 {
-  /* Index of last byte of left half.  */
+  /* Index of last byte of left half, or SIZE_MAX.  */
   size_t max_suffix, max_suffix_rev;
   size_t j; /* Index into NEEDLE for current candidate suffix.  */
   size_t k; /* Offset into current period.  */
@@ -124,8 +125,8 @@ critical_factorization (const unsigned char *needle, size_t needle_len,
     }
 
   /* Invariants:
-     1 <= j < NEEDLE_LEN - 1
-     0 <= max_suffix{,_rev} < j
+     0 <= j < NEEDLE_LEN - 1
+     -1 <= max_suffix{,_rev} < j (treating SIZE_MAX as if it were signed)
      min(max_suffix, max_suffix_rev) < global period of NEEDLE
      1 <= p <= global period of NEEDLE
      p == global period of the substring NEEDLE[max_suffix{,_rev}+1...j]
@@ -133,8 +134,9 @@ critical_factorization (const unsigned char *needle, size_t needle_len,
   */
 
   /* Perform lexicographic search.  */
-  max_suffix = 0;
-  j = k = p = 1;
+  max_suffix = SIZE_MAX;
+  j = 0;
+  k = p = 1;
   while (j + k < needle_len)
     {
       a = CANON_ELEMENT (needle[j + k]);
@@ -167,8 +169,9 @@ critical_factorization (const unsigned char *needle, size_t needle_len,
   *period = p;
 
   /* Perform reverse lexicographic search.  */
-  max_suffix_rev = 0;
-  j = k = p = 1;
+  max_suffix_rev = SIZE_MAX;
+  j = 0;
+  k = p = 1;
   while (j + k < needle_len)
     {
       a = CANON_ELEMENT (needle[j + k]);
index 0a02b50..acebc9a 100644 (file)
@@ -172,15 +172,16 @@ extern char *tzname[];
 #define add(n, f)                                                             \
   do                                                                          \
     {                                                                         \
-      int _n = (n);                                                           \
-      int _delta = width - _n;                                                \
-      int _incr = _n + (_delta > 0 ? _delta : 0);                             \
-      if ((size_t) _incr >= maxsize - i)                                      \
+      size_t _n = (n);                                                        \
+      size_t _w = (width < 0 ? 0 : width);                                    \
+      size_t _incr = _n < _w ? _w : _n;                                       \
+      if (_incr >= maxsize - i)                                               \
         return 0;                                                             \
       if (p)                                                                  \
         {                                                                     \
-          if (digits == 0 && _delta > 0)                                      \
+          if (digits == 0 && _n < _w)                                         \
             {                                                                 \
+              size_t _delta = width - _n;                                     \
               if (pad == L_('0'))                                             \
                 memset_zero (p, _delta);                                      \
               else                                                            \
index c0e0c35..9e4394b 100644 (file)
@@ -251,7 +251,9 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
   int have_mon, have_mday;
   int have_uweek, have_wweek;
   int week_no;
+#ifdef _NL_CURRENT
   size_t num_eras;
+#endif
   struct era_entry *era;
 
   have_I = is_pm = 0;
@@ -408,7 +410,9 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
           break;
         case 'C':
           /* Match century number.  */
+#ifdef _NL_CURRENT
         match_century:
+#endif
           get_number (0, 99, 2);
           century = val;
           want_xday = 1;
@@ -644,7 +648,9 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
           have_wday = 1;
           break;
         case 'y':
+#ifdef _NL_CURRENT
         match_year_in_century:
+#endif
           /* Match year within century.  */
           get_number (0, 99, 2);
           /* The "Year 2000: The Millennium Rollover" paper suggests that
index 55f36ef..b60789f 100644 (file)
    <sys/types.h>.  */
 # include <sys/types.h>
 
+/* On FreeBSD 6.4, <sys/socket.h> defines some macros that assume that NULL
+   is defined.  */
+# include <stddef.h>
+
 /* The include_next requires a split double-inclusion guard.  */
 # @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
 
index 2853287..4122613 100644 (file)
@@ -355,7 +355,11 @@ _GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
 
 
 #if @GNULIB_FUTIMENS@
-# if @REPLACE_FUTIMENS@
+/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
+   implementation relies on futimesat, which on Solaris 10 makes an invocation
+   to futimens that is meant to invoke the libc's futimens(), not gnulib's
+   futimens().  */
+# if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef futimens
 #   define futimens rpl_futimens
@@ -368,7 +372,9 @@ _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
 #  endif
 _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
 # endif
+# if @HAVE_FUTIMENS@
 _GL_CXXALIASWARN (futimens);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef futimens
 # if HAVE_RAW_DECL_FUTIMENS
@@ -612,7 +618,11 @@ _GL_WARN_ON_USE (stat, "stat is unportable - "
 
 
 #if @GNULIB_UTIMENSAT@
-# if @REPLACE_UTIMENSAT@
+/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
+   implementation relies on futimesat, which on Solaris 10 makes an invocation
+   to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
+   utimensat().  */
+# if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef utimensat
 #   define utimensat rpl_utimensat
@@ -631,7 +641,9 @@ _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
 _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
                                    struct timespec const times[2], int flag));
 # endif
+# if @HAVE_UTIMENSAT@
 _GL_CXXALIASWARN (utimensat);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef utimensat
 # if HAVE_RAW_DECL_UTIMENSAT
index fa3539f..19faea1 100644 (file)
@@ -61,6 +61,7 @@ uc_general_category_t;
 enum
 {
   UC_CATEGORY_MASK_L  = 0x0000001f,
+  UC_CATEGORY_MASK_LC = 0x00000007,
   UC_CATEGORY_MASK_Lu = 0x00000001,
   UC_CATEGORY_MASK_Ll = 0x00000002,
   UC_CATEGORY_MASK_Lt = 0x00000004,
@@ -101,6 +102,7 @@ enum
 
 /* Predefined General category values.  */
 extern const uc_general_category_t UC_CATEGORY_L;
+extern const uc_general_category_t UC_CATEGORY_LC;
 extern const uc_general_category_t UC_CATEGORY_Lu;
 extern const uc_general_category_t UC_CATEGORY_Ll;
 extern const uc_general_category_t UC_CATEGORY_Lt;
@@ -142,6 +144,7 @@ extern const uc_general_category_t _UC_CATEGORY_NONE;
 
 /* Alias names for predefined General category values.  */
 #define UC_LETTER                    UC_CATEGORY_L
+#define UC_CASED_LETTER              UC_CATEGORY_LC
 #define UC_UPPERCASE_LETTER          UC_CATEGORY_Lu
 #define UC_LOWERCASE_LETTER          UC_CATEGORY_Ll
 #define UC_TITLECASE_LETTER          UC_CATEGORY_Lt
@@ -204,7 +207,12 @@ extern uc_general_category_t
 extern const char *
        uc_general_category_name (uc_general_category_t category);
 
-/* Return the general category given by name, e.g. "Lu".  */
+/* Return the long name of a general category.  */
+extern const char *
+       uc_general_category_long_name (uc_general_category_t category);
+
+/* Return the general category given by name, e.g. "Lu", or by long name,
+   e.g. "Uppercase Letter".  */
 extern uc_general_category_t
        uc_general_category_byname (const char *category_name);
 
@@ -237,6 +245,7 @@ enum
   UC_CCC_VR   =   9, /* Virama */
   UC_CCC_ATBL = 200, /* Attached Below Left */
   UC_CCC_ATB  = 202, /* Attached Below */
+  UC_CCC_ATA  = 214, /* Attached Above */
   UC_CCC_ATAR = 216, /* Attached Above Right */
   UC_CCC_BL   = 218, /* Below Left */
   UC_CCC_B    = 220, /* Below */
@@ -255,9 +264,23 @@ enum
 extern int
        uc_combining_class (ucs4_t uc);
 
+/* Return the name of a canonical combining class.  */
+extern const char *
+       uc_combining_class_name (int ccc);
+
+/* Return the long name of a canonical combining class.  */
+extern const char *
+       uc_combining_class_long_name (int ccc);
+
+/* Return the canonical combining class given by name, e.g. "BL", or by long
+   name, e.g. "Below Left".  */
+extern int
+       uc_combining_class_byname (const char *ccc_name);
+
 /* ========================================================================= */
 
-/* Field 4 of Unicode Character Database: Bidirectional category.  */
+/* Field 4 of Unicode Character Database: Bidi class.
+   Before Unicode 4.0, this field was called "Bidirectional category".  */
 
 enum
 {
@@ -282,20 +305,36 @@ enum
   UC_BIDI_ON   /* Other Neutral */
 };
 
-/* Return the name of a bidirectional category.  */
+/* Return the name of a bidi class.  */
+extern const char *
+       uc_bidi_class_name (int bidi_class);
+/* Same; obsolete function name.  */
 extern const char *
        uc_bidi_category_name (int category);
 
-/* Return the bidirectional category given by name, e.g. "LRE".  */
+/* Return the long name of a bidi class.  */
+extern const char *
+       uc_bidi_class_long_name (int bidi_class);
+
+/* Return the bidi class given by name, e.g. "LRE", or by long name, e.g.
+   "Left-to-Right Embedding".  */
+extern int
+       uc_bidi_class_byname (const char *bidi_class_name);
+/* Same; obsolete function name.  */
 extern int
        uc_bidi_category_byname (const char *category_name);
 
-/* Return the bidirectional category of a Unicode character.  */
+/* Return the bidi class of a Unicode character.  */
+extern int
+       uc_bidi_class (ucs4_t uc);
+/* Same; obsolete function name.  */
 extern int
        uc_bidi_category (ucs4_t uc);
 
-/* Test whether a Unicode character belongs to a given bidirectional
-   category.  */
+/* Test whether a Unicode character belongs to a given bidi class.  */
+extern bool
+       uc_is_bidi_class (ucs4_t uc, int bidi_class);
+/* Same; obsolete function name.  */
 extern bool
        uc_is_bidi_category (ucs4_t uc, int category);
 
@@ -359,6 +398,117 @@ extern bool
 
 /* ========================================================================= */
 
+/* Field 2 of the file ArabicShaping.txt in the Unicode Character Database.  */
+
+/* Possible joining types.  */
+enum
+{
+  UC_JOINING_TYPE_U, /* Non_Joining */
+  UC_JOINING_TYPE_T, /* Transparent */
+  UC_JOINING_TYPE_C, /* Join_Causing */
+  UC_JOINING_TYPE_L, /* Left_Joining */
+  UC_JOINING_TYPE_R, /* Right_Joining */
+  UC_JOINING_TYPE_D  /* Dual_Joining */
+};
+
+/* Return the name of a joining type.  */
+extern const char *
+       uc_joining_type_name (int joining_type);
+
+/* Return the long name of a joining type.  */
+extern const char *
+       uc_joining_type_long_name (int joining_type);
+
+/* Return the joining type given by name, e.g. "D", or by long name, e.g.
+   "Dual Joining".  */
+extern int
+       uc_joining_type_byname (const char *joining_type_name);
+
+/* Return the joining type of a Unicode character.  */
+extern int
+       uc_joining_type (ucs4_t uc);
+
+/* ========================================================================= */
+
+/* Field 3 of the file ArabicShaping.txt in the Unicode Character Database.  */
+
+/* Possible joining groups.
+   This enumeration may be extended in the future.  */
+enum
+{
+  UC_JOINING_GROUP_NONE,                  /* No_Joining_Group */
+  UC_JOINING_GROUP_AIN,                   /* Ain */
+  UC_JOINING_GROUP_ALAPH,                 /* Alaph */
+  UC_JOINING_GROUP_ALEF,                  /* Alef */
+  UC_JOINING_GROUP_BEH,                   /* Beh */
+  UC_JOINING_GROUP_BETH,                  /* Beth */
+  UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE, /* Burushaski_Yeh_Barree */
+  UC_JOINING_GROUP_DAL,                   /* Dal */
+  UC_JOINING_GROUP_DALATH_RISH,           /* Dalath_Rish */
+  UC_JOINING_GROUP_E,                     /* E */
+  UC_JOINING_GROUP_FARSI_YEH,             /* Farsi_Yeh */
+  UC_JOINING_GROUP_FE,                    /* Fe */
+  UC_JOINING_GROUP_FEH,                   /* Feh */
+  UC_JOINING_GROUP_FINAL_SEMKATH,         /* Final_Semkath */
+  UC_JOINING_GROUP_GAF,                   /* Gaf */
+  UC_JOINING_GROUP_GAMAL,                 /* Gamal */
+  UC_JOINING_GROUP_HAH,                   /* Hah */
+  UC_JOINING_GROUP_HE,                    /* He */
+  UC_JOINING_GROUP_HEH,                   /* Heh */
+  UC_JOINING_GROUP_HEH_GOAL,              /* Heh_Goal */
+  UC_JOINING_GROUP_HETH,                  /* Heth */
+  UC_JOINING_GROUP_KAF,                   /* Kaf */
+  UC_JOINING_GROUP_KAPH,                  /* Kaph */
+  UC_JOINING_GROUP_KHAPH,                 /* Khaph */
+  UC_JOINING_GROUP_KNOTTED_HEH,           /* Knotted_Heh */
+  UC_JOINING_GROUP_LAM,                   /* Lam */
+  UC_JOINING_GROUP_LAMADH,                /* Lamadh */
+  UC_JOINING_GROUP_MEEM,                  /* Meem */
+  UC_JOINING_GROUP_MIM,                   /* Mim */
+  UC_JOINING_GROUP_NOON,                  /* Noon */
+  UC_JOINING_GROUP_NUN,                   /* Nun */
+  UC_JOINING_GROUP_NYA,                   /* Nya */
+  UC_JOINING_GROUP_PE,                    /* Pe */
+  UC_JOINING_GROUP_QAF,                   /* Qaf */
+  UC_JOINING_GROUP_QAPH,                  /* Qaph */
+  UC_JOINING_GROUP_REH,                   /* Reh */
+  UC_JOINING_GROUP_REVERSED_PE,           /* Reversed_Pe */
+  UC_JOINING_GROUP_SAD,                   /* Sad */
+  UC_JOINING_GROUP_SADHE,                 /* Sadhe */
+  UC_JOINING_GROUP_SEEN,                  /* Seen */
+  UC_JOINING_GROUP_SEMKATH,               /* Semkath */
+  UC_JOINING_GROUP_SHIN,                  /* Shin */
+  UC_JOINING_GROUP_SWASH_KAF,             /* Swash_Kaf */
+  UC_JOINING_GROUP_SYRIAC_WAW,            /* Syriac_Waw */
+  UC_JOINING_GROUP_TAH,                   /* Tah */
+  UC_JOINING_GROUP_TAW,                   /* Taw */
+  UC_JOINING_GROUP_TEH_MARBUTA,           /* Teh_Marbuta */
+  UC_JOINING_GROUP_TEH_MARBUTA_GOAL,      /* Teh_Marbuta_Goal */
+  UC_JOINING_GROUP_TETH,                  /* Teth */
+  UC_JOINING_GROUP_WAW,                   /* Waw */
+  UC_JOINING_GROUP_YEH,                   /* Yeh */
+  UC_JOINING_GROUP_YEH_BARREE,            /* Yeh_Barree */
+  UC_JOINING_GROUP_YEH_WITH_TAIL,         /* Yeh_With_Tail */
+  UC_JOINING_GROUP_YUDH,                  /* Yudh */
+  UC_JOINING_GROUP_YUDH_HE,               /* Yudh_He */
+  UC_JOINING_GROUP_ZAIN,                  /* Zain */
+  UC_JOINING_GROUP_ZHAIN                  /* Zhain */
+};
+
+/* Return the name of a joining group.  */
+extern const char *
+       uc_joining_group_name (int joining_group);
+
+/* Return the joining group given by name, e.g. "Teh_Marbuta".  */
+extern int
+       uc_joining_group_byname (const char *joining_group_name);
+
+/* Return the joining group of a Unicode character.  */
+extern int
+       uc_joining_group (ucs4_t uc);
+
+/* ========================================================================= */
+
 /* Common API for properties.  */
 
 /* Data type denoting a property.  This is not just a number, but rather a
index 6126b95..4b3a92a 100644 (file)
@@ -1,5 +1,5 @@
-/* Bidi categories of Unicode characters.
-   Copyright (C) 2002, 2006, 2009-2011 Free Software Foundation, Inc.
+/* Bidi classes of Unicode characters.
+   Copyright (C) 2002, 2006, 2011 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software: you can redistribute it and/or modify it
 /* Specification.  */
 #include "unictype.h"
 
+#include <string.h>
+
+#include "unictype/bidi_byname.h"
+
 int
-uc_bidi_category_byname (const char *category_name)
+uc_bidi_class_byname (const char *bidi_class_name)
 {
-  switch (category_name[0])
+  size_t len;
+
+  len = strlen (bidi_class_name);
+  if (len <= MAX_WORD_LENGTH)
     {
-    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;
-        }
-      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;
-        }
-      break;
-    case 'C':
-      switch (category_name[1])
-        {
-        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;
-        }
-      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;
-        }
-      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;
-        }
-      break;
-    case 'O':
-      switch (category_name[1])
-        {
-        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;
-        }
-      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;
+      char buf[MAX_WORD_LENGTH + 1];
+      const struct named_bidi_class *found;
+
+      /* Copy bidi_class_name into buf, converting '_' and '-' to ' '.  */
+      {
+        const char *p = bidi_class_name;
+        char *q = buf;
+
+        for (;; p++, q++)
+          {
+            char c = *p;
+
+            if (c == '_' || c == '-')
+              c = ' ';
+            *q = c;
+            if (c == '\0')
               break;
-            }
-          break;
-        }
-      break;
-    case 'S':
-      if (category_name[1] == '\0')
-        return UC_BIDI_S;
-      break;
-    case 'W':
-      switch (category_name[1])
-        {
-        case 'S':
-          if (category_name[2] == '\0')
-            return UC_BIDI_WS;
-          break;
-        }
-      break;
+          }
+      }
+      /* Here q == buf + len.  */
+
+      /* Do a hash table lookup, with case-insensitive comparison.  */
+      found = uc_bidi_class_lookup (buf, len);
+      if (found != NULL)
+        return found->bidi_class;
     }
-  /* Invalid category name.  */
+  /* Invalid bidi class name.  */
   return -1;
 }
+
+int
+uc_bidi_category_byname (const char *category_name)
+{
+  return uc_bidi_class_byname (category_name);
+}
diff --git a/lib/unictype/bidi_byname.gperf b/lib/unictype/bidi_byname.gperf
new file mode 100644 (file)
index 0000000..9cacacf
--- /dev/null
@@ -0,0 +1,70 @@
+/* Bidi classes of Unicode characters.  */
+struct named_bidi_class { int name; int bidi_class; };
+%struct-type
+%ignore-case
+%language=ANSI-C
+%define hash-function-name bidi_class_hash
+%define lookup-function-name uc_bidi_class_lookup
+%readonly-tables
+%global-table
+%define word-array-name bidi_class_names
+%pic
+%define string-pool-name bidi_class_stringpool
+%%
+AL, UC_BIDI_AL
+AN, UC_BIDI_AN
+B, UC_BIDI_B
+BN, UC_BIDI_BN
+CS, UC_BIDI_CS
+EN, UC_BIDI_EN
+ES, UC_BIDI_ES
+ET, UC_BIDI_ET
+L, UC_BIDI_L
+LRE, UC_BIDI_LRE
+LRO, UC_BIDI_LRO
+NSM, UC_BIDI_NSM
+ON, UC_BIDI_ON
+PDF, UC_BIDI_PDF
+R, UC_BIDI_R
+RLE, UC_BIDI_RLE
+RLO, UC_BIDI_RLO
+S, UC_BIDI_S
+WS, UC_BIDI_WS
+Arabic Letter, UC_BIDI_AL
+ArabicLetter, UC_BIDI_AL
+Arabic Number, UC_BIDI_AN
+ArabicNumber, UC_BIDI_AN
+Paragraph Separator, UC_BIDI_B
+ParagraphSeparator, UC_BIDI_B
+Boundary Neutral, UC_BIDI_BN
+BoundaryNeutral, UC_BIDI_BN
+Common Separator, UC_BIDI_CS
+CommonSeparator, UC_BIDI_CS
+European Number, UC_BIDI_EN
+EuropeanNumber, UC_BIDI_EN
+European Separator, UC_BIDI_ES
+EuropeanSeparator, UC_BIDI_ES
+European Terminator, UC_BIDI_ET
+EuropeanTerminator, UC_BIDI_ET
+Left To Right, UC_BIDI_L
+LeftToRight, UC_BIDI_L
+Left To Right Embedding, UC_BIDI_LRE
+LeftToRightEmbedding, UC_BIDI_LRE
+Left To Right Override, UC_BIDI_LRO
+LeftToRightOverride, UC_BIDI_LRO
+Nonspacing Mark, UC_BIDI_NSM
+NonspacingMark, UC_BIDI_NSM
+Other Neutral, UC_BIDI_ON
+OtherNeutral, UC_BIDI_ON
+Pop Directional Format, UC_BIDI_PDF
+PopDirectionalFormat, UC_BIDI_PDF
+Right To Left, UC_BIDI_R
+RightToLeft, UC_BIDI_R
+Right To Left Embedding, UC_BIDI_RLE
+RightToLeftEmbedding, UC_BIDI_RLE
+Right To Left Override, UC_BIDI_RLO
+RightToLeftOverride, UC_BIDI_RLO
+Segment Separator, UC_BIDI_S
+SegmentSeparator, UC_BIDI_S
+White Space, UC_BIDI_WS
+WhiteSpace, UC_BIDI_WS
diff --git a/lib/unictype/bidi_longname.c b/lib/unictype/bidi_longname.c
new file mode 100644 (file)
index 0000000..a40080d
--- /dev/null
@@ -0,0 +1,53 @@
+/* Bidi classes of Unicode characters.
+   Copyright (C) 2002, 2006, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+static const char u_bidi_class_long_name[19][24] =
+{
+  "Left To Right",
+  "Left To Right Embedding",
+  "Left To Right Override",
+  "Right To Left",
+  "Arabic Letter",
+  "Right To Left Embedding",
+  "Right To Left Override",
+  "Pop Directional Format",
+  "European Number",
+  "European Separator",
+  "European Terminator",
+  "Arabic Number",
+  "Common Separator",
+  "Nonspacing Mark",
+  "Boundary Neutral",
+  "Paragraph Separator",
+  "Segment Separator",
+  "White Space",
+  "Other Neutral"
+};
+
+const char *
+uc_bidi_class_long_name (int bidi_class)
+{
+  if (bidi_class >= 0
+      && bidi_class < sizeof (u_bidi_class_long_name) / sizeof (u_bidi_class_long_name[0]))
+    return u_bidi_class_long_name[bidi_class];
+  return NULL;
+}
index 1e8fab8..eca74f6 100644 (file)
@@ -1,5 +1,5 @@
-/* Bidi categories of Unicode characters.
-   Copyright (C) 2002, 2006, 2009-2011 Free Software Foundation, Inc.
+/* Bidi classes of Unicode characters.
+   Copyright (C) 2002, 2006, 2011 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software: you can redistribute it and/or modify it
 /* Specification.  */
 #include "unictype.h"
 
-static const char u_bidi_category_name[19][4] =
+static const char u_bidi_class_name[19][4] =
 {
   "L",  "LRE", "LRO", "R",   "AL", "RLE", "RLO", "PDF", "EN", "ES",
   "ET", "AN",  "CS",  "NSM", "BN", "B",   "S",   "WS",  "ON"
 };
 
 const char *
-uc_bidi_category_name (int category)
+uc_bidi_class_name (int bidi_class)
 {
-  if (category >= 0 && category < sizeof (u_bidi_category_name) / sizeof (u_bidi_category_name[0]))
-    return u_bidi_category_name[category];
+  if (bidi_class >= 0 && bidi_class < sizeof (u_bidi_class_name) / sizeof (u_bidi_class_name[0]))
+    return u_bidi_class_name[bidi_class];
   return NULL;
 }
+
+const char *
+uc_bidi_category_name (int category)
+{
+  return uc_bidi_class_name (category);
+}
index c03070c..5c735fd 100644 (file)
@@ -1,5 +1,5 @@
-/* Bidi categories of Unicode characters.
-   Copyright (C) 2002, 2006, 2009-2011 Free Software Foundation, Inc.
+/* Bidi classes of Unicode characters.
+   Copyright (C) 2002, 2006, 2011 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software: you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 #include "bidi_of.h"
 
 int
-uc_bidi_category (ucs4_t uc)
+uc_bidi_class (ucs4_t uc)
 {
   unsigned int index1 = uc >> bidi_category_header_0;
   if (index1 < bidi_category_header_1)
@@ -50,3 +50,9 @@ uc_bidi_category (ucs4_t uc)
     }
   return UC_BIDI_L;
 }
+
+int
+uc_bidi_category (ucs4_t uc)
+{
+  return uc_bidi_class (uc);
+}
index 036030f..ffe93a6 100644 (file)
@@ -1,5 +1,5 @@
-/* Bidi categories of Unicode characters.
-   Copyright (C) 2002, 2006, 2009-2011 Free Software Foundation, Inc.
+/* Bidi classes of Unicode characters.
+   Copyright (C) 2002, 2006, 2011 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software: you can redistribute it and/or modify it
 #include "unictype.h"
 
 bool
+uc_is_bidi_class (ucs4_t uc, int bidi_class)
+{
+  return (uc_bidi_class (uc) == bidi_class);
+}
+
+bool
 uc_is_bidi_category (ucs4_t uc, int category)
 {
-  return (uc_bidi_category (uc) == category);
+  return uc_is_bidi_class (uc, category);
 }
diff --git a/lib/unictype/categ_LC.c b/lib/unictype/categ_LC.c
new file mode 100644 (file)
index 0000000..13801d9
--- /dev/null
@@ -0,0 +1,27 @@
+/* Categories of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+/* Define u_categ_LC table.  */
+#include "categ_LC.h"
+
+const uc_general_category_t UC_CATEGORY_LC =
+  { UC_CATEGORY_MASK_LC, 0, { &u_categ_LC } };
diff --git a/lib/unictype/categ_LC.h b/lib/unictype/categ_LC.h
new file mode 100644 (file)
index 0000000..454bf75
--- /dev/null
@@ -0,0 +1,339 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Categories of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 6.0.0.  */
+#define header_0 16
+#define header_2 9
+#define header_3 127
+#define header_4 15
+static const
+struct
+  {
+    int header[1];
+    int level1[2];
+    short level2[2 << 7];
+    /*unsigned*/ int level3[14 << 4];
+  }
+u_categ_LC =
+{
+  { 2 },
+  {
+        3 * sizeof (int) / sizeof (short) +     0,
+        3 * sizeof (int) / sizeof (short) +   128
+  },
+  {
+        3 +   256 * sizeof (short) / sizeof (int) +     0,
+        3 +   256 * sizeof (short) / sizeof (int) +    16,
+        3 +   256 * sizeof (short) / sizeof (int) +    32,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +    48,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +    64,
+        3 +   256 * sizeof (short) / sizeof (int) +    80,
+        3 +   256 * sizeof (short) / sizeof (int) +    96,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   112,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   128,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   144,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   160,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   176,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   192,
+        3 +   256 * sizeof (short) / sizeof (int) +   208,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1
+  },
+  {
+    0x00000000, 0x00000000, 0x07FFFFFE, 0x07FFFFFE,
+    0x00000000, 0x04200400, 0xFF7FFFFF, 0xFF7FFFFF,
+    0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+    0xFFFFFFFF, 0xF7FFFFFF, 0xFFFFFFF0, 0xFFFFFFFF,
+    0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+    0xFFEFFFFF, 0x0000FFFF, 0x00000000, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x38CF0000,
+    0xFFFFD740, 0xFFFFFFFB, 0xFFFFFFFF, 0xFFBFFFFF,
+    0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+    0xFFFFFC03, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+    0xFFFFFFFF, 0xFFFE00FF, 0x007FFFFF, 0xFFFFFFFE,
+    0x000000FF, 0x00000000, 0x00000000, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0x00000000, 0xFFFFFFFF, 0x0000003F, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0xFFFFFFFF, 0x00000FFF, 0x00000000, 0xFEFFFFFC,
+    0x07FFFFFF, 0x00000000, 0x00000000, 0x00000000,
+    0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+    0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+    0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
+    0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0x3E2FFC84, 0xF21FBD50, 0x000043E0, 0x00000000,
+    0x00000018, 0x00000000, 0x00000000, 0x00000000,
+    0xFFFFFFFF, 0xFFFF7FFF, 0x7FFFFFFF, 0xDFFFFFFF,
+    0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000781F,
+    0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0x00000000, 0x00000000, 0xFFFFFFFF, 0x00003FFF,
+    0x00FFFFFF, 0x00000000, 0x00000000, 0x00000000,
+    0x00000000, 0xFFFFFFFC, 0xFFFFFFFF, 0xFFFEFFFF,
+    0x000378FF, 0x000003FF, 0x00000000, 0x04000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0x00F8007F, 0x00000000, 0x00000000, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0x00000000, 0x07FFFFFE, 0x07FFFFFE, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0xFFFFFFFF, 0xFFFFFFFF, 0x0000FFFF, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0x00000000, 0x00000000, 0x00000000, 0x00000000,
+    0xFFFFFFFF, 0xFFFFFFFF, 0xFFDFFFFF, 0xFFFFFFFF,
+    0xDFFFFFFF, 0xEBFFDE64, 0xFFFFFFEF, 0xFFFFFFFF,
+    0xDFDFE7BF, 0x7BFFFFFF, 0xFFFDFC5F, 0xFFFFFFFF,
+    0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+    0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+    0xFFFFFFFF, 0xFFFFFF3F, 0xF7FFFFFD, 0xF7FFFFFF,
+    0xFFDFFFFF, 0xFFDFFFFF, 0xFFFF7FFF, 0xFFFF7FFF,
+    0xFFFFFDFF, 0xFFFFFDFF, 0x00000FF7, 0x00000000
+  }
+};
index f3342ed..80e97ab 100644 (file)
@@ -1,5 +1,5 @@
 /* Categories of Unicode characters.
-   Copyright (C) 2002, 2006-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2006-2007, 2011 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software: you can redistribute it and/or modify it
 /* Specification.  */
 #include "unictype.h"
 
+#include <stdlib.h>
+#include <string.h>
+
+/* Indices stored in the 'struct named_category' elements of the perfect hash
+   table.  We don't use uc_general_category_t values or their addresses
+   directly, because this would introduce load-time relocations.  */
+enum
+{
+  UC_CATEGORY_INDEX_L,
+  UC_CATEGORY_INDEX_LC,
+  UC_CATEGORY_INDEX_Lu,
+  UC_CATEGORY_INDEX_Ll,
+  UC_CATEGORY_INDEX_Lt,
+  UC_CATEGORY_INDEX_Lm,
+  UC_CATEGORY_INDEX_Lo,
+  UC_CATEGORY_INDEX_M,
+  UC_CATEGORY_INDEX_Mn,
+  UC_CATEGORY_INDEX_Mc,
+  UC_CATEGORY_INDEX_Me,
+  UC_CATEGORY_INDEX_N,
+  UC_CATEGORY_INDEX_Nd,
+  UC_CATEGORY_INDEX_Nl,
+  UC_CATEGORY_INDEX_No,
+  UC_CATEGORY_INDEX_P,
+  UC_CATEGORY_INDEX_Pc,
+  UC_CATEGORY_INDEX_Pd,
+  UC_CATEGORY_INDEX_Ps,
+  UC_CATEGORY_INDEX_Pe,
+  UC_CATEGORY_INDEX_Pi,
+  UC_CATEGORY_INDEX_Pf,
+  UC_CATEGORY_INDEX_Po,
+  UC_CATEGORY_INDEX_S,
+  UC_CATEGORY_INDEX_Sm,
+  UC_CATEGORY_INDEX_Sc,
+  UC_CATEGORY_INDEX_Sk,
+  UC_CATEGORY_INDEX_So,
+  UC_CATEGORY_INDEX_Z,
+  UC_CATEGORY_INDEX_Zs,
+  UC_CATEGORY_INDEX_Zl,
+  UC_CATEGORY_INDEX_Zp,
+  UC_CATEGORY_INDEX_C,
+  UC_CATEGORY_INDEX_Cc,
+  UC_CATEGORY_INDEX_Cf,
+  UC_CATEGORY_INDEX_Cs,
+  UC_CATEGORY_INDEX_Co,
+  UC_CATEGORY_INDEX_Cn
+};
+
+#include "unictype/categ_byname.h"
+
 uc_general_category_t
 uc_general_category_byname (const char *category_name)
 {
-  if (category_name[0] != '\0'
-      && (category_name[1] == '\0' || category_name[2] == '\0'))
-    switch (category_name[0])
+  size_t len;
+
+  len = strlen (category_name);
+  if (len <= MAX_WORD_LENGTH)
+    {
+      char buf[MAX_WORD_LENGTH + 1];
+      const struct named_category *found;
+
+      /* Copy category_name into buf, converting '_' and '-' to ' '.  */
       {
-      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;
-      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;
-      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;
-      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;
-      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;
-      case 'Z':
-        switch (category_name[1])
+        const char *p = category_name;
+        char *q = buf;
+
+        for (;; p++, q++)
           {
-          case '\0': return UC_CATEGORY_Z;
-          case 's': return UC_CATEGORY_Zs;
-          case 'l': return UC_CATEGORY_Zl;
-          case 'p': return UC_CATEGORY_Zp;
+            char c = *p;
+
+            if (c == '_' || c == '-')
+              c = ' ';
+            *q = c;
+            if (c == '\0')
+              break;
           }
-        break;
-      case 'C':
-        switch (category_name[1])
+      }
+      /* Here q == buf + len.  */
+
+      /* Do a hash table lookup, with case-insensitive comparison.  */
+      found = uc_general_category_lookup (buf, len);
+      if (found != NULL)
+        /* Use a 'switch' statement here, because a table would introduce
+           load-time relocations.  */
+        switch (found->category_index)
           {
-          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;
+          case UC_CATEGORY_INDEX_L:
+            return UC_CATEGORY_L;
+          case UC_CATEGORY_INDEX_LC:
+            return UC_CATEGORY_LC;
+          case UC_CATEGORY_INDEX_Lu:
+            return UC_CATEGORY_Lu;
+          case UC_CATEGORY_INDEX_Ll:
+            return UC_CATEGORY_Ll;
+          case UC_CATEGORY_INDEX_Lt:
+            return UC_CATEGORY_Lt;
+          case UC_CATEGORY_INDEX_Lm:
+            return UC_CATEGORY_Lm;
+          case UC_CATEGORY_INDEX_Lo:
+            return UC_CATEGORY_Lo;
+          case UC_CATEGORY_INDEX_M:
+            return UC_CATEGORY_M;
+          case UC_CATEGORY_INDEX_Mn:
+            return UC_CATEGORY_Mn;
+          case UC_CATEGORY_INDEX_Mc:
+            return UC_CATEGORY_Mc;
+          case UC_CATEGORY_INDEX_Me:
+            return UC_CATEGORY_Me;
+          case UC_CATEGORY_INDEX_N:
+            return UC_CATEGORY_N;
+          case UC_CATEGORY_INDEX_Nd:
+            return UC_CATEGORY_Nd;
+          case UC_CATEGORY_INDEX_Nl:
+            return UC_CATEGORY_Nl;
+          case UC_CATEGORY_INDEX_No:
+            return UC_CATEGORY_No;
+          case UC_CATEGORY_INDEX_P:
+            return UC_CATEGORY_P;
+          case UC_CATEGORY_INDEX_Pc:
+            return UC_CATEGORY_Pc;
+          case UC_CATEGORY_INDEX_Pd:
+            return UC_CATEGORY_Pd;
+          case UC_CATEGORY_INDEX_Ps:
+            return UC_CATEGORY_Ps;
+          case UC_CATEGORY_INDEX_Pe:
+            return UC_CATEGORY_Pe;
+          case UC_CATEGORY_INDEX_Pi:
+            return UC_CATEGORY_Pi;
+          case UC_CATEGORY_INDEX_Pf:
+            return UC_CATEGORY_Pf;
+          case UC_CATEGORY_INDEX_Po:
+            return UC_CATEGORY_Po;
+          case UC_CATEGORY_INDEX_S:
+            return UC_CATEGORY_S;
+          case UC_CATEGORY_INDEX_Sm:
+            return UC_CATEGORY_Sm;
+          case UC_CATEGORY_INDEX_Sc:
+            return UC_CATEGORY_Sc;
+          case UC_CATEGORY_INDEX_Sk:
+            return UC_CATEGORY_Sk;
+          case UC_CATEGORY_INDEX_So:
+            return UC_CATEGORY_So;
+          case UC_CATEGORY_INDEX_Z:
+            return UC_CATEGORY_Z;
+          case UC_CATEGORY_INDEX_Zs:
+            return UC_CATEGORY_Zs;
+          case UC_CATEGORY_INDEX_Zl:
+            return UC_CATEGORY_Zl;
+          case UC_CATEGORY_INDEX_Zp:
+            return UC_CATEGORY_Zp;
+          case UC_CATEGORY_INDEX_C:
+            return UC_CATEGORY_C;
+          case UC_CATEGORY_INDEX_Cc:
+            return UC_CATEGORY_Cc;
+          case UC_CATEGORY_INDEX_Cf:
+            return UC_CATEGORY_Cf;
+          case UC_CATEGORY_INDEX_Cs:
+            return UC_CATEGORY_Cs;
+          case UC_CATEGORY_INDEX_Co:
+            return UC_CATEGORY_Co;
+          case UC_CATEGORY_INDEX_Cn:
+            return UC_CATEGORY_Cn;
+          default:
+            abort ();
           }
-        break;
-      }
+    }
   /* Invalid category name.  */
   return _UC_CATEGORY_NONE;
 }
diff --git a/lib/unictype/categ_byname.gperf b/lib/unictype/categ_byname.gperf
new file mode 100644 (file)
index 0000000..54d1996
--- /dev/null
@@ -0,0 +1,116 @@
+/* Categories of Unicode characters.  */
+struct named_category { int name; unsigned int category_index; };
+%struct-type
+%ignore-case
+%language=ANSI-C
+%define hash-function-name general_category_hash
+%define lookup-function-name uc_general_category_lookup
+%readonly-tables
+%global-table
+%define word-array-name general_category_names
+%pic
+%define string-pool-name general_category_stringpool
+%%
+L, UC_CATEGORY_INDEX_L
+LC, UC_CATEGORY_INDEX_LC
+Lu, UC_CATEGORY_INDEX_Lu
+Ll, UC_CATEGORY_INDEX_Ll
+Lt, UC_CATEGORY_INDEX_Lt
+Lm, UC_CATEGORY_INDEX_Lm
+Lo, UC_CATEGORY_INDEX_Lo
+M, UC_CATEGORY_INDEX_M
+Mn, UC_CATEGORY_INDEX_Mn
+Mc, UC_CATEGORY_INDEX_Mc
+Me, UC_CATEGORY_INDEX_Me
+N, UC_CATEGORY_INDEX_N
+Nd, UC_CATEGORY_INDEX_Nd
+Nl, UC_CATEGORY_INDEX_Nl
+No, UC_CATEGORY_INDEX_No
+P, UC_CATEGORY_INDEX_P
+Pc, UC_CATEGORY_INDEX_Pc
+Pd, UC_CATEGORY_INDEX_Pd
+Ps, UC_CATEGORY_INDEX_Ps
+Pe, UC_CATEGORY_INDEX_Pe
+Pi, UC_CATEGORY_INDEX_Pi
+Pf, UC_CATEGORY_INDEX_Pf
+Po, UC_CATEGORY_INDEX_Po
+S, UC_CATEGORY_INDEX_S
+Sm, UC_CATEGORY_INDEX_Sm
+Sc, UC_CATEGORY_INDEX_Sc
+Sk, UC_CATEGORY_INDEX_Sk
+So, UC_CATEGORY_INDEX_So
+Z, UC_CATEGORY_INDEX_Z
+Zs, UC_CATEGORY_INDEX_Zs
+Zl, UC_CATEGORY_INDEX_Zl
+Zp, UC_CATEGORY_INDEX_Zp
+C, UC_CATEGORY_INDEX_C
+Cc, UC_CATEGORY_INDEX_Cc
+Cf, UC_CATEGORY_INDEX_Cf
+Cs, UC_CATEGORY_INDEX_Cs
+Co, UC_CATEGORY_INDEX_Co
+Cn, UC_CATEGORY_INDEX_Cn
+Letter, UC_CATEGORY_INDEX_L
+Cased Letter, UC_CATEGORY_INDEX_LC
+CasedLetter, UC_CATEGORY_INDEX_LC
+Uppercase Letter, UC_CATEGORY_INDEX_Lu
+UppercaseLetter, UC_CATEGORY_INDEX_Lu
+Lowercase Letter, UC_CATEGORY_INDEX_Ll
+LowercaseLetter, UC_CATEGORY_INDEX_Ll
+Titlecase Letter, UC_CATEGORY_INDEX_Lt
+TitlecaseLetter, UC_CATEGORY_INDEX_Lt
+Modifier Letter, UC_CATEGORY_INDEX_Lm
+ModifierLetter, UC_CATEGORY_INDEX_Lm
+Other Letter, UC_CATEGORY_INDEX_Lo
+OtherLetter, UC_CATEGORY_INDEX_Lo
+Mark, UC_CATEGORY_INDEX_M
+Nonspacing Mark, UC_CATEGORY_INDEX_Mn
+NonspacingMark, UC_CATEGORY_INDEX_Mn
+Spacing Mark, UC_CATEGORY_INDEX_Mc
+SpacingMark, UC_CATEGORY_INDEX_Mc
+Enclosing Mark, UC_CATEGORY_INDEX_Me
+EnclosingMark, UC_CATEGORY_INDEX_Me
+Number, UC_CATEGORY_INDEX_N
+Decimal Number, UC_CATEGORY_INDEX_Nd
+DecimalNumber, UC_CATEGORY_INDEX_Nd
+Letter Number, UC_CATEGORY_INDEX_Nl
+LetterNumber, UC_CATEGORY_INDEX_Nl
+Other Number, UC_CATEGORY_INDEX_No
+OtherNumber, UC_CATEGORY_INDEX_No
+Punctuation, UC_CATEGORY_INDEX_P
+Connector Punctuation, UC_CATEGORY_INDEX_Pc
+ConnectorPunctuation, UC_CATEGORY_INDEX_Pc
+Dash Punctuation, UC_CATEGORY_INDEX_Pd
+DashPunctuation, UC_CATEGORY_INDEX_Pd
+Open Punctuation, UC_CATEGORY_INDEX_Ps
+OpenPunctuation, UC_CATEGORY_INDEX_Ps
+Close Punctuation, UC_CATEGORY_INDEX_Pe
+ClosePunctuation, UC_CATEGORY_INDEX_Pe
+Initial Punctuation, UC_CATEGORY_INDEX_Pi
+InitialPunctuation, UC_CATEGORY_INDEX_Pi
+Final Punctuation, UC_CATEGORY_INDEX_Pf
+FinalPunctuation, UC_CATEGORY_INDEX_Pf
+Other Punctuation, UC_CATEGORY_INDEX_Po
+OtherPunctuation, UC_CATEGORY_INDEX_Po
+Symbol, UC_CATEGORY_INDEX_S
+Math Symbol, UC_CATEGORY_INDEX_Sm
+MathSymbol, UC_CATEGORY_INDEX_Sm
+Currency Symbol, UC_CATEGORY_INDEX_Sc
+CurrencySymbol, UC_CATEGORY_INDEX_Sc
+Modifier Symbol, UC_CATEGORY_INDEX_Sk
+ModifierSymbol, UC_CATEGORY_INDEX_Sk
+Other Symbol, UC_CATEGORY_INDEX_So
+OtherSymbol, UC_CATEGORY_INDEX_So
+Separator, UC_CATEGORY_INDEX_Z
+Space Separator, UC_CATEGORY_INDEX_Zs
+SpaceSeparator, UC_CATEGORY_INDEX_Zs
+Line Separator, UC_CATEGORY_INDEX_Zl
+LineSeparator, UC_CATEGORY_INDEX_Zl
+Paragraph Separator, UC_CATEGORY_INDEX_Zp
+ParagraphSeparator, UC_CATEGORY_INDEX_Zp
+Other, UC_CATEGORY_INDEX_C
+Control, UC_CATEGORY_INDEX_Cc
+Format, UC_CATEGORY_INDEX_Cf
+Surrogate, UC_CATEGORY_INDEX_Cs
+Private Use, UC_CATEGORY_INDEX_Co
+PrivateUse, UC_CATEGORY_INDEX_Co
+Unassigned, UC_CATEGORY_INDEX_Cn
diff --git a/lib/unictype/categ_longname.c b/lib/unictype/categ_longname.c
new file mode 100644 (file)
index 0000000..58a653b
--- /dev/null
@@ -0,0 +1,106 @@
+/* Categories of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+static const char u_category_long_name[30][22] =
+{
+  "Uppercase Letter",
+  "Lowercase Letter",
+  "Titlecase Letter",
+  "Modifier Letter",
+  "Other Letter",
+  "Nonspacing Mark",
+  "Spacing Mark",
+  "Enclosing Mark",
+  "Decimal Number",
+  "Letter Number",
+  "Other Number",
+  "Connector Punctuation",
+  "Dash Punctuation",
+  "Open Punctuation",
+  "Close Punctuation",
+  "Initial Punctuation",
+  "Final Punctuation",
+  "Other Punctuation",
+  "Math Symbol",
+  "Currency Symbol",
+  "Modifier Symbol",
+  "Other Symbol",
+  "Space Separator",
+  "Line Separator",
+  "Paragraph Separator",
+  "Control",
+  "Format",
+  "Surrogate",
+  "Private Use",
+  "Unassigned"
+};
+
+const char *
+uc_general_category_long_name (uc_general_category_t category)
+{
+  uint32_t bitmask = category.bitmask;
+  /* bitmask should consist of a single bit.  */
+  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];
+
+          if (bit < sizeof (u_category_long_name) / sizeof (u_category_long_name[0]))
+            return u_category_long_name[bit];
+        }
+      else
+        {
+          if (bitmask == UC_CATEGORY_MASK_L)
+            return "Letter";
+          if (bitmask == UC_CATEGORY_MASK_LC)
+            return "Cased Letter";
+          if (bitmask == UC_CATEGORY_MASK_M)
+            return "Mark";
+          if (bitmask == UC_CATEGORY_MASK_N)
+            return "Number";
+          if (bitmask == UC_CATEGORY_MASK_P)
+            return "Punctuation";
+          if (bitmask == UC_CATEGORY_MASK_S)
+            return "Symbol";
+          if (bitmask == UC_CATEGORY_MASK_Z)
+            return "Separator";
+          if (bitmask == UC_CATEGORY_MASK_C)
+            return "Other";
+        }
+    }
+  return NULL;
+}
index fcbdbee..40ecb92 100644 (file)
@@ -1,5 +1,5 @@
 /* Categories of Unicode characters.
-   Copyright (C) 2002, 2006-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2006-2007, 2011 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software: you can redistribute it and/or modify it
@@ -59,6 +59,8 @@ uc_general_category_name (uc_general_category_t category)
         {
           if (bitmask == UC_CATEGORY_MASK_L)
             return "L";
+          if (bitmask == UC_CATEGORY_MASK_LC)
+            return "LC";
           if (bitmask == UC_CATEGORY_MASK_M)
             return "M";
           if (bitmask == UC_CATEGORY_MASK_N)
diff --git a/lib/unictype/combining.c b/lib/unictype/combining.c
deleted file mode 100644 (file)
index a98b4e5..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Combining classes of Unicode characters.
-   Copyright (C) 2002, 2006, 2009-2011 Free 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 "unictype.h"
-
-/* Define u_combclass table.  */
-#include "combining.h"
-
-int
-uc_combining_class (ucs4_t uc)
-{
-  unsigned int index1 = uc >> combclass_header_0;
-  if (index1 < combclass_header_1)
-    {
-      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;
-            }
-        }
-    }
-  return 0;
-}
diff --git a/lib/unictype/combining.h b/lib/unictype/combining.h
deleted file mode 100644 (file)
index a87e75b..0000000
+++ /dev/null
@@ -1,999 +0,0 @@
-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
-/* Combining class of Unicode characters.  */
-/* Generated automatically by gen-uni-tables.c for Unicode 6.0.0.  */
-#define combclass_header_0 16
-#define combclass_header_1 2
-#define combclass_header_2 7
-#define combclass_header_3 511
-#define combclass_header_4 127
-static const
-struct
-  {
-    int level1[2];
-    short level2[2 << 9];
-    unsigned char level3[53 << 7];
-  }
-u_combclass =
-{
-  {     0,   512 },
-  {
-       -1,    -1,    -1,    -1,    -1,    -1,     0,    -1,
-       -1,   128,    -1,   256,   384,   512,   640,   768,
-      896,    -1,  1024,  1152,  1152,  1152,  1152,  1280,
-     1408,  1152,  1280,  1536,  1664,  1792,  1920,  2048,
-     2176,  2304,    -1,    -1,    -1,    -1,  2432,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,  2560,  2688,
-       -1,  2816,  2944,    -1,  3072,    -1,  3200,  3328,
-     3456,  3584,    -1,  3712,    -1,    -1,    -1,    -1,
-       -1,  3840,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,  3968,  4096,  4224,    -1,    -1,    -1,    -1,
-     4352,  4480,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,  4608,  4736,    -1,    -1,
-     4864,  4992,  5120,  5248,    -1,  5376,    -1,  5504,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,  5632,    -1,
-       -1,    -1,    -1,    -1,  5760,    -1,    -1,    -1,
-       -1,    -1,    -1,  5888,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,  6016,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-     6144,  6272,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,  6400,  6528,  6656,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1
-  },
-  {
-    230, 230, 230, 230, 230, 230, 230, 230,
-    230, 230, 230, 230, 230, 230, 230, 230,
-    230, 230, 230, 230, 230, 232, 220, 220,
-    220, 220, 232, 216, 220, 220, 220, 220,
-    220, 202, 202, 220, 220, 220, 220, 202,
-    202, 220, 220, 220, 220, 220, 220, 220,
-    220, 220, 220, 220,   1,   1,   1,   1,
-      1, 220, 220, 220, 220, 230, 230, 230,
-    230, 230, 230, 230, 230, 240, 230, 220,
-    220, 220, 230, 230, 230, 220, 220,   0,
-    230, 230, 230, 220, 220, 220, 220, 230,
-    232, 220, 220, 230, 233, 234, 234, 233,
-    234, 234, 233, 230, 230, 230, 230, 230,
-    230, 230, 230, 230, 230, 230, 230, 230,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0, 230, 230, 230, 230, 230,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0, 220, 230, 230, 230, 230, 220, 230,
-    230, 230, 222, 220, 230, 230, 230, 230,
-    230, 230, 220, 220, 220, 220, 220, 220,
-    230, 230, 220, 230, 230, 222, 228, 230,
-     10,  11,  12,  13,  14,  15,  16,  17,
-     18,  19,  19,  20,  21,  22,   0,  23,
-      0,  24,  25,   0, 230, 220,   0,  18,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    230, 230, 230, 230, 230, 230, 230, 230,
-     30,  31,  32,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,  27,  28,  29,  30,  31,
-     32,  33,  34, 230, 230, 220, 220, 230,
-    230, 230, 230, 230, 220, 230, 230, 220,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-     35,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0, 230, 230,
-    230, 230, 230, 230, 230,   0,   0, 230,
-    230, 230, 230, 220, 230,   0,   0, 230,
-    230,   0, 220, 230, 230, 220,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,  36,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    230, 220, 230, 230, 220, 230, 230, 220,
-    220, 220, 230, 220, 220, 230, 220, 230,
-    230, 230, 220, 230, 220, 230, 220, 230,
-    220, 230, 230,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0, 230, 230, 230, 230, 230,
-    230, 230, 220, 230,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0, 230, 230,
-    230, 230,   0, 230, 230, 230, 230, 230,
-    230, 230, 230, 230,   0, 230, 230, 230,
-      0, 230, 230, 230, 230, 230,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0, 220, 220, 220,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   7,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   9,   0,   0,
-      0, 230, 220, 230, 230,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   7,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   9,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   9,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   9,   0,   0,
-      0,   0,   0,   0,   0,  84,  91,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   9,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    103, 103,   9,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    107, 107, 107, 107,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    118, 118,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    122, 122, 122, 122,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    220, 220,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0, 220,   0, 220,
-      0, 216,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0, 129, 130,   0, 132,   0,   0,   0,
-      0,   0, 130, 130, 130, 130,   0,   0,
-    130,   0, 230, 230,   9,   0, 230, 230,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0, 220,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   7,
-      0,   9,   9,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0, 220,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0, 230, 230, 230,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   9,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   9,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   9,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0, 230,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0, 228,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0, 222, 230, 220,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0, 230,
-    220,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      9,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0, 230, 230, 230,
-    230, 230, 230, 230, 230,   0,   0, 220,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   7,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   9,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0, 230, 220, 230, 230, 230,
-    230, 230, 230, 230,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   9,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   7,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   9,   9,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   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,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    230, 230, 230,   0,   1, 220, 220, 220,
-    220, 220, 230, 230, 220, 220, 220, 220,
-    230,   0,   1,   1,   1,   1,   1,   1,
-      1,   0,   0,   0,   0, 220,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    230, 230, 220, 230, 230, 230, 230, 230,
-    230, 230, 220, 230, 230, 234, 214, 220,
-    202, 230, 230, 230, 230, 230, 230, 230,
-    230, 230, 230, 230, 230, 230, 230, 230,
-    230, 230, 230, 230, 230, 230, 230,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0, 233, 220, 230, 220,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    230, 230,   1,   1, 230, 230, 230, 230,
-      1,   1,   1, 230, 230,   0,   0,   0,
-      0, 230,   0,   0,   0,   1,   1, 230,
-    220, 230,   1,   1, 220, 220, 220, 220,
-    230,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0, 230,
-    230, 230,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   9,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    230, 230, 230, 230, 230, 230, 230, 230,
-    230, 230, 230, 230, 230, 230, 230, 230,
-    230, 230, 230, 230, 230, 230, 230, 230,
-    230, 230, 230, 230, 230, 230, 230, 230,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0, 218, 228, 232, 222, 224, 224,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   8,   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,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0, 230,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0, 230, 230,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    230, 230,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   9,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   9,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    230, 230, 230, 230, 230, 230, 230, 230,
-    230, 230, 230, 230, 230, 230, 230, 230,
-    230, 230,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0, 220, 220, 220,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   9,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   7,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      9,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    230,   0, 230, 230, 220,   0,   0, 230,
-    230,   0,   0,   0,   0,   0, 230, 230,
-      0, 230,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   9,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,  26,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    230, 230, 230, 230, 230, 230, 230,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0, 220,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0, 220,   0, 230,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-    230,   1, 220,   0,   0,   0,   0,   9,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   9,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   9,   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,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0, 216, 216,   1,
-      1,   1,   0,   0,   0, 226, 216, 216,
-    216, 216, 216,   0,   0,   0,   0,   0,
-      0,   0,   0, 220, 220, 220, 220, 220,
-    220, 220, 220,   0,   0, 230, 230, 230,
-    230, 230, 220, 220,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0, 230, 230, 230, 230,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0, 230, 230, 230,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0,
-      0,   0,   0,   0,   0,   0,   0,   0
-  }
-};
diff --git a/lib/unictype/combiningclass.c b/lib/unictype/combiningclass.c
new file mode 100644 (file)
index 0000000..66b090b
--- /dev/null
@@ -0,0 +1,47 @@
+/* Combining classes of Unicode characters.
+   Copyright (C) 2002, 2006, 2009-2011 Free 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 "unictype.h"
+
+/* Define u_combclass table.  */
+#include "combiningclass.h"
+
+int
+uc_combining_class (ucs4_t uc)
+{
+  unsigned int index1 = uc >> combclass_header_0;
+  if (index1 < combclass_header_1)
+    {
+      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;
+            }
+        }
+    }
+  return 0;
+}
diff --git a/lib/unictype/combiningclass.h b/lib/unictype/combiningclass.h
new file mode 100644 (file)
index 0000000..a87e75b
--- /dev/null
@@ -0,0 +1,999 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Combining class of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 6.0.0.  */
+#define combclass_header_0 16
+#define combclass_header_1 2
+#define combclass_header_2 7
+#define combclass_header_3 511
+#define combclass_header_4 127
+static const
+struct
+  {
+    int level1[2];
+    short level2[2 << 9];
+    unsigned char level3[53 << 7];
+  }
+u_combclass =
+{
+  {     0,   512 },
+  {
+       -1,    -1,    -1,    -1,    -1,    -1,     0,    -1,
+       -1,   128,    -1,   256,   384,   512,   640,   768,
+      896,    -1,  1024,  1152,  1152,  1152,  1152,  1280,
+     1408,  1152,  1280,  1536,  1664,  1792,  1920,  2048,
+     2176,  2304,    -1,    -1,    -1,    -1,  2432,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,  2560,  2688,
+       -1,  2816,  2944,    -1,  3072,    -1,  3200,  3328,
+     3456,  3584,    -1,  3712,    -1,    -1,    -1,    -1,
+       -1,  3840,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,  3968,  4096,  4224,    -1,    -1,    -1,    -1,
+     4352,  4480,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,  4608,  4736,    -1,    -1,
+     4864,  4992,  5120,  5248,    -1,  5376,    -1,  5504,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,  5632,    -1,
+       -1,    -1,    -1,    -1,  5760,    -1,    -1,    -1,
+       -1,    -1,    -1,  5888,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,  6016,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+     6144,  6272,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,  6400,  6528,  6656,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1
+  },
+  {
+    230, 230, 230, 230, 230, 230, 230, 230,
+    230, 230, 230, 230, 230, 230, 230, 230,
+    230, 230, 230, 230, 230, 232, 220, 220,
+    220, 220, 232, 216, 220, 220, 220, 220,
+    220, 202, 202, 220, 220, 220, 220, 202,
+    202, 220, 220, 220, 220, 220, 220, 220,
+    220, 220, 220, 220,   1,   1,   1,   1,
+      1, 220, 220, 220, 220, 230, 230, 230,
+    230, 230, 230, 230, 230, 240, 230, 220,
+    220, 220, 230, 230, 230, 220, 220,   0,
+    230, 230, 230, 220, 220, 220, 220, 230,
+    232, 220, 220, 230, 233, 234, 234, 233,
+    234, 234, 233, 230, 230, 230, 230, 230,
+    230, 230, 230, 230, 230, 230, 230, 230,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0, 230, 230, 230, 230, 230,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0, 220, 230, 230, 230, 230, 220, 230,
+    230, 230, 222, 220, 230, 230, 230, 230,
+    230, 230, 220, 220, 220, 220, 220, 220,
+    230, 230, 220, 230, 230, 222, 228, 230,
+     10,  11,  12,  13,  14,  15,  16,  17,
+     18,  19,  19,  20,  21,  22,   0,  23,
+      0,  24,  25,   0, 230, 220,   0,  18,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    230, 230, 230, 230, 230, 230, 230, 230,
+     30,  31,  32,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,  27,  28,  29,  30,  31,
+     32,  33,  34, 230, 230, 220, 220, 230,
+    230, 230, 230, 230, 220, 230, 230, 220,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+     35,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0, 230, 230,
+    230, 230, 230, 230, 230,   0,   0, 230,
+    230, 230, 230, 220, 230,   0,   0, 230,
+    230,   0, 220, 230, 230, 220,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,  36,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    230, 220, 230, 230, 220, 230, 230, 220,
+    220, 220, 230, 220, 220, 230, 220, 230,
+    230, 230, 220, 230, 220, 230, 220, 230,
+    220, 230, 230,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0, 230, 230, 230, 230, 230,
+    230, 230, 220, 230,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0, 230, 230,
+    230, 230,   0, 230, 230, 230, 230, 230,
+    230, 230, 230, 230,   0, 230, 230, 230,
+      0, 230, 230, 230, 230, 230,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0, 220, 220, 220,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   7,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   9,   0,   0,
+      0, 230, 220, 230, 230,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   7,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   9,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   9,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   9,   0,   0,
+      0,   0,   0,   0,   0,  84,  91,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   9,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    103, 103,   9,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    107, 107, 107, 107,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    118, 118,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    122, 122, 122, 122,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    220, 220,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0, 220,   0, 220,
+      0, 216,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0, 129, 130,   0, 132,   0,   0,   0,
+      0,   0, 130, 130, 130, 130,   0,   0,
+    130,   0, 230, 230,   9,   0, 230, 230,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0, 220,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   7,
+      0,   9,   9,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0, 220,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0, 230, 230, 230,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   9,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   9,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   9,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0, 230,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0, 228,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0, 222, 230, 220,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0, 230,
+    220,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      9,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0, 230, 230, 230,
+    230, 230, 230, 230, 230,   0,   0, 220,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   7,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   9,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0, 230, 220, 230, 230, 230,
+    230, 230, 230, 230,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   9,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   7,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   9,   9,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   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,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    230, 230, 230,   0,   1, 220, 220, 220,
+    220, 220, 230, 230, 220, 220, 220, 220,
+    230,   0,   1,   1,   1,   1,   1,   1,
+      1,   0,   0,   0,   0, 220,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    230, 230, 220, 230, 230, 230, 230, 230,
+    230, 230, 220, 230, 230, 234, 214, 220,
+    202, 230, 230, 230, 230, 230, 230, 230,
+    230, 230, 230, 230, 230, 230, 230, 230,
+    230, 230, 230, 230, 230, 230, 230,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0, 233, 220, 230, 220,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    230, 230,   1,   1, 230, 230, 230, 230,
+      1,   1,   1, 230, 230,   0,   0,   0,
+      0, 230,   0,   0,   0,   1,   1, 230,
+    220, 230,   1,   1, 220, 220, 220, 220,
+    230,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0, 230,
+    230, 230,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   9,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    230, 230, 230, 230, 230, 230, 230, 230,
+    230, 230, 230, 230, 230, 230, 230, 230,
+    230, 230, 230, 230, 230, 230, 230, 230,
+    230, 230, 230, 230, 230, 230, 230, 230,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0, 218, 228, 232, 222, 224, 224,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   8,   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,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0, 230,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0, 230, 230,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    230, 230,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   9,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   9,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    230, 230, 230, 230, 230, 230, 230, 230,
+    230, 230, 230, 230, 230, 230, 230, 230,
+    230, 230,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0, 220, 220, 220,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   9,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   7,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      9,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    230,   0, 230, 230, 220,   0,   0, 230,
+    230,   0,   0,   0,   0,   0, 230, 230,
+      0, 230,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   9,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,  26,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    230, 230, 230, 230, 230, 230, 230,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0, 220,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0, 220,   0, 230,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+    230,   1, 220,   0,   0,   0,   0,   9,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   9,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   9,   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,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0, 216, 216,   1,
+      1,   1,   0,   0,   0, 226, 216, 216,
+    216, 216, 216,   0,   0,   0,   0,   0,
+      0,   0,   0, 220, 220, 220, 220, 220,
+    220, 220, 220,   0,   0, 230, 230, 230,
+    230, 230, 220, 220,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0, 230, 230, 230, 230,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0, 230, 230, 230,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0,
+      0,   0,   0,   0,   0,   0,   0,   0
+  }
+};
diff --git a/lib/unictype/combiningclass_byname.c b/lib/unictype/combiningclass_byname.c
new file mode 100644 (file)
index 0000000..3880523
--- /dev/null
@@ -0,0 +1,63 @@
+/* Canonical combining classes of Unicode characters.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+#include <string.h>
+
+#include "unictype/combiningclass_byname.h"
+
+int
+uc_combining_class_byname (const char *ccc_name)
+{
+  size_t len;
+
+  len = strlen (ccc_name);
+  if (len <= MAX_WORD_LENGTH)
+    {
+      char buf[MAX_WORD_LENGTH + 1];
+      const struct named_combining_class *found;
+
+      /* Copy ccc_name into buf, converting '_' and '-' to ' '.  */
+      {
+        const char *p = ccc_name;
+        char *q = buf;
+
+        for (;; p++, q++)
+          {
+            char c = *p;
+
+            if (c == '_' || c == '-')
+              c = ' ';
+            *q = c;
+            if (c == '\0')
+              break;
+          }
+      }
+      /* Here q == buf + len.  */
+
+      /* Do a hash table lookup, with case-insensitive comparison.  */
+      found = uc_combining_class_lookup (buf, len);
+      if (found != NULL)
+        return found->combining_class;
+    }
+  /* Invalid combining class name.  */
+  return -1;
+}
diff --git a/lib/unictype/combiningclass_byname.gperf b/lib/unictype/combiningclass_byname.gperf
new file mode 100644 (file)
index 0000000..4096850
--- /dev/null
@@ -0,0 +1,66 @@
+/* Categories of Unicode characters.  */
+struct named_combining_class { int name; int combining_class; };
+%struct-type
+%ignore-case
+%language=ANSI-C
+%define hash-function-name combining_class_hash
+%define lookup-function-name uc_combining_class_lookup
+%readonly-tables
+%global-table
+%define word-array-name combining_class_names
+%pic
+%define string-pool-name combining_class_stringpool
+%%
+NR, UC_CCC_NR
+OV, UC_CCC_OV
+NK, UC_CCC_NK
+KV, UC_CCC_KV
+VR, UC_CCC_VR
+ATBL, UC_CCC_ATBL
+ATB, UC_CCC_ATB
+ATA, UC_CCC_ATA
+ATAR, UC_CCC_ATAR
+BL, UC_CCC_BL
+B, UC_CCC_B
+BR, UC_CCC_BR
+L, UC_CCC_L
+R, UC_CCC_R
+AL, UC_CCC_AL
+A, UC_CCC_A
+AR, UC_CCC_AR
+DB, UC_CCC_DB
+DA, UC_CCC_DA
+IS, UC_CCC_IS
+Not Reordered, UC_CCC_NR
+NotReordered, UC_CCC_NR
+Overlay, UC_CCC_OV
+Nukta, UC_CCC_NK
+Kana Voicing, UC_CCC_KV
+KanaVoicing, UC_CCC_KV
+Virama, UC_CCC_VR
+Attached Below Left, UC_CCC_ATBL
+AttachedBelowLeft, UC_CCC_ATBL
+Attached Below, UC_CCC_ATB
+AttachedBelow, UC_CCC_ATB
+Attached Above, UC_CCC_ATA
+AttachedAbove, UC_CCC_ATA
+Attached Above Right, UC_CCC_ATAR
+AttachedAboveRight, UC_CCC_ATAR
+Below Left, UC_CCC_BL
+BelowLeft, UC_CCC_BL
+Below, UC_CCC_B
+Below Right, UC_CCC_BR
+BelowRight, UC_CCC_BR
+Left, UC_CCC_L
+Right, UC_CCC_R
+Above Left, UC_CCC_AL
+AboveLeft, UC_CCC_AL
+Above, UC_CCC_A
+Above Right, UC_CCC_AR
+AboveRight, UC_CCC_AR
+Double Below, UC_CCC_DB
+DoubleBelow, UC_CCC_DB
+Double Above, UC_CCC_DA
+DoubleAbove, UC_CCC_DA
+Iota Subscript, UC_CCC_IS
+IotaSubscript, UC_CCC_IS
diff --git a/lib/unictype/combiningclass_longname.c b/lib/unictype/combiningclass_longname.c
new file mode 100644 (file)
index 0000000..d328279
--- /dev/null
@@ -0,0 +1,130 @@
+/* Canonical combining classes of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+#include <stdlib.h>
+
+static const signed char u_combining_class_index_part1[10] =
+{
+   0, /* Not Reordered */
+   1, /* Overlay */
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+   2, /* Nukta */
+   3, /* Kana Voicing */
+   4  /* Virama */
+};
+static const signed char u_combining_class_index_part2[241 - 200] =
+{
+   5, /* Attached Below Left */
+  -1,
+   6, /* Attached Below */
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+   7, /* Attached Above */
+  -1,
+   8, /* Attached Above Right */
+  -1,
+   9, /* Below Left */
+  -1,
+  10, /* Below */
+  -1,
+  11, /* Below Right */
+  -1,
+  12, /* Left */
+  -1,
+  13, /* Right */
+  -1,
+  14, /* Above Left */
+  -1,
+  15, /* Above */
+  -1,
+  16, /* Above Right */
+  17, /* Double Below */
+  18, /* Double Above */
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+  19  /* Iota Subscript */
+};
+
+static const char u_combining_class_long_name[20][21] =
+{
+  "Not Reordered",
+  "Overlay",
+  "Nukta",
+  "Kana Voicing",
+  "Virama",
+  "Attached Below Left",
+  "Attached Below",
+  "Attached Above",
+  "Attached Above Right",
+  "Below Left",
+  "Below",
+  "Below Right",
+  "Left",
+  "Right",
+  "Above Left",
+  "Above",
+  "Above Right",
+  "Double Below",
+  "Double Above",
+  "Iota Subscript"
+};
+
+const char *
+uc_combining_class_long_name (int ccc)
+{
+  if (ccc >= 0)
+    {
+      int index;
+
+      if (ccc < 10)
+        index = u_combining_class_index_part1[ccc];
+      else if (ccc >= 200 && ccc < 241)
+        index = u_combining_class_index_part2[ccc - 200];
+      else
+        return NULL;
+
+      if (index >= 0)
+        {
+          if (index < sizeof (u_combining_class_long_name) / sizeof (u_combining_class_long_name[0]))
+            return u_combining_class_long_name[index];
+          else
+            abort ();
+        }
+    }
+  return NULL;
+}
diff --git a/lib/unictype/combiningclass_name.c b/lib/unictype/combiningclass_name.c
new file mode 100644 (file)
index 0000000..0cf2bb8
--- /dev/null
@@ -0,0 +1,130 @@
+/* Canonical combining classes of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+#include <stdlib.h>
+
+static const signed char u_combining_class_index_part1[10] =
+{
+   0, /* Not Reordered */
+   1, /* Overlay */
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+   2, /* Nukta */
+   3, /* Kana Voicing */
+   4  /* Virama */
+};
+static const signed char u_combining_class_index_part2[241 - 200] =
+{
+   5, /* Attached Below Left */
+  -1,
+   6, /* Attached Below */
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+   7, /* Attached Above */
+  -1,
+   8, /* Attached Above Right */
+  -1,
+   9, /* Below Left */
+  -1,
+  10, /* Below */
+  -1,
+  11, /* Below Right */
+  -1,
+  12, /* Left */
+  -1,
+  13, /* Right */
+  -1,
+  14, /* Above Left */
+  -1,
+  15, /* Above */
+  -1,
+  16, /* Above Right */
+  17, /* Double Below */
+  18, /* Double Above */
+  -1,
+  -1,
+  -1,
+  -1,
+  -1,
+  19  /* Iota Subscript */
+};
+
+static const char u_combining_class_name[20][5] =
+{
+  "NR",   /* Not Reordered */
+  "OV",   /* Overlay */
+  "NK",   /* Nukta */
+  "KV",   /* Kana Voicing */
+  "VR",   /* Virama */
+  "ATBL", /* Attached Below Left */
+  "ATB",  /* Attached Below */
+  "ATA",  /* Attached Above */
+  "ATAR", /* Attached Above Right */
+  "BL",   /* Below Left */
+  "B",    /* Below */
+  "BR",   /* Below Right */
+  "L",    /* Left */
+  "R",    /* Right */
+  "AL",   /* Above Left */
+  "A",    /* Above */
+  "AR",   /* Above Right */
+  "DB",   /* Double Below */
+  "DA",   /* Double Above */
+  "IS"    /* Iota Subscript */
+};
+
+const char *
+uc_combining_class_name (int ccc)
+{
+  if (ccc >= 0)
+    {
+      int index;
+
+      if (ccc < 10)
+        index = u_combining_class_index_part1[ccc];
+      else if (ccc >= 200 && ccc < 241)
+        index = u_combining_class_index_part2[ccc - 200];
+      else
+        return NULL;
+
+      if (index >= 0)
+        {
+          if (index < sizeof (u_combining_class_name) / sizeof (u_combining_class_name[0]))
+            return u_combining_class_name[index];
+          else
+            abort ();
+        }
+    }
+  return NULL;
+}
diff --git a/lib/unictype/joininggroup_byname.c b/lib/unictype/joininggroup_byname.c
new file mode 100644 (file)
index 0000000..063ec2d
--- /dev/null
@@ -0,0 +1,63 @@
+/* Arabic joining group of Unicode characters.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+#include <string.h>
+
+#include "unictype/joininggroup_byname.h"
+
+int
+uc_joining_group_byname (const char *joining_group_name)
+{
+  size_t len;
+
+  len = strlen (joining_group_name);
+  if (len <= MAX_WORD_LENGTH)
+    {
+      char buf[MAX_WORD_LENGTH + 1];
+      const struct named_joining_group *found;
+
+      /* Copy joining_group_name into buf, converting '_' and '-' to ' '.  */
+      {
+        const char *p = joining_group_name;
+        char *q = buf;
+
+        for (;; p++, q++)
+          {
+            char c = *p;
+
+            if (c == '_' || c == '-')
+              c = ' ';
+            *q = c;
+            if (c == '\0')
+              break;
+          }
+      }
+      /* Here q == buf + len.  */
+
+      /* Do a hash table lookup, with case-insensitive comparison.  */
+      found = uc_joining_group_lookup (buf, len);
+      if (found != NULL)
+        return found->joining_group;
+    }
+  /* Invalid joining group name.  */
+  return -1;
+}
diff --git a/lib/unictype/joininggroup_byname.gperf b/lib/unictype/joininggroup_byname.gperf
new file mode 100644 (file)
index 0000000..bc2fbc8
--- /dev/null
@@ -0,0 +1,85 @@
+/* Arabic joining group of Unicode characters.  */
+struct named_joining_group { int name; int joining_group; };
+%struct-type
+%ignore-case
+%language=ANSI-C
+%define hash-function-name joining_group_hash
+%define lookup-function-name uc_joining_group_lookup
+%readonly-tables
+%global-table
+%define word-array-name joining_group_names
+%pic
+%define string-pool-name joining_group_stringpool
+%%
+No Joining Group, UC_JOINING_GROUP_NONE
+NoJoiningGroup, UC_JOINING_GROUP_NONE
+Ain, UC_JOINING_GROUP_AIN
+Alaph, UC_JOINING_GROUP_ALAPH
+Alef, UC_JOINING_GROUP_ALEF
+Beh, UC_JOINING_GROUP_BEH
+Beth, UC_JOINING_GROUP_BETH
+Burushaski Yeh Barree, UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE
+BurushaskiYehBarree, UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE
+Dal, UC_JOINING_GROUP_DAL
+Dalath Rish, UC_JOINING_GROUP_DALATH_RISH
+DalathRish, UC_JOINING_GROUP_DALATH_RISH
+E, UC_JOINING_GROUP_E
+Farsi Yeh, UC_JOINING_GROUP_FARSI_YEH
+FarsiYeh, UC_JOINING_GROUP_FARSI_YEH
+Fe, UC_JOINING_GROUP_FE
+Feh, UC_JOINING_GROUP_FEH
+Final Semkath, UC_JOINING_GROUP_FINAL_SEMKATH
+FinalSemkath, UC_JOINING_GROUP_FINAL_SEMKATH
+Gaf, UC_JOINING_GROUP_GAF
+Gamal, UC_JOINING_GROUP_GAMAL
+Hah, UC_JOINING_GROUP_HAH
+He, UC_JOINING_GROUP_HE
+Heh, UC_JOINING_GROUP_HEH
+Heh Goal, UC_JOINING_GROUP_HEH_GOAL
+HehGoal, UC_JOINING_GROUP_HEH_GOAL
+Heth, UC_JOINING_GROUP_HETH
+Kaf, UC_JOINING_GROUP_KAF
+Kaph, UC_JOINING_GROUP_KAPH
+Khaph, UC_JOINING_GROUP_KHAPH
+Knotted Heh, UC_JOINING_GROUP_KNOTTED_HEH
+KnottedHeh, UC_JOINING_GROUP_KNOTTED_HEH
+Lam, UC_JOINING_GROUP_LAM
+Lamadh, UC_JOINING_GROUP_LAMADH
+Meem, UC_JOINING_GROUP_MEEM
+Mim, UC_JOINING_GROUP_MIM
+Noon, UC_JOINING_GROUP_NOON
+Nun, UC_JOINING_GROUP_NUN
+Nya, UC_JOINING_GROUP_NYA
+Pe, UC_JOINING_GROUP_PE
+Qaf, UC_JOINING_GROUP_QAF
+Qaph, UC_JOINING_GROUP_QAPH
+Reh, UC_JOINING_GROUP_REH
+Reversed Pe, UC_JOINING_GROUP_REVERSED_PE
+ReversedPe, UC_JOINING_GROUP_REVERSED_PE
+Sad, UC_JOINING_GROUP_SAD
+Sadhe, UC_JOINING_GROUP_SADHE
+Seen, UC_JOINING_GROUP_SEEN
+Semkath, UC_JOINING_GROUP_SEMKATH
+Shin, UC_JOINING_GROUP_SHIN
+Swash Kaf, UC_JOINING_GROUP_SWASH_KAF
+SwashKaf, UC_JOINING_GROUP_SWASH_KAF
+Syriac Waw, UC_JOINING_GROUP_SYRIAC_WAW
+SyriacWaw, UC_JOINING_GROUP_SYRIAC_WAW
+Tah, UC_JOINING_GROUP_TAH
+Taw, UC_JOINING_GROUP_TAW
+Teh Marbuta, UC_JOINING_GROUP_TEH_MARBUTA
+TehMarbuta, UC_JOINING_GROUP_TEH_MARBUTA
+Teh Marbuta Goal, UC_JOINING_GROUP_TEH_MARBUTA_GOAL
+TehMarbutaGoal, UC_JOINING_GROUP_TEH_MARBUTA_GOAL
+Teth, UC_JOINING_GROUP_TETH
+Waw, UC_JOINING_GROUP_WAW
+Yeh, UC_JOINING_GROUP_YEH
+Yeh Barree, UC_JOINING_GROUP_YEH_BARREE
+YehBarree, UC_JOINING_GROUP_YEH_BARREE
+Yeh with tail, UC_JOINING_GROUP_YEH_WITH_TAIL
+YehWithTail, UC_JOINING_GROUP_YEH_WITH_TAIL
+Yudh, UC_JOINING_GROUP_YUDH
+Yudh He, UC_JOINING_GROUP_YUDH_HE
+YudhHe, UC_JOINING_GROUP_YUDH_HE
+Zain, UC_JOINING_GROUP_ZAIN
+Zhain, UC_JOINING_GROUP_ZHAIN
diff --git a/lib/unictype/joininggroup_name.c b/lib/unictype/joininggroup_name.c
new file mode 100644 (file)
index 0000000..373a3c4
--- /dev/null
@@ -0,0 +1,55 @@
+/* Arabic joining group of Unicode characters.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+/* Use a string pool, rather than a two-dimensional array, because the strings
+   have very different lengths.  */
+
+struct joining_group_stringpool_t
+  {
+#define ELEM(tag,string) char tag[sizeof (string)];
+#include "unictype/joininggroup_name.h"
+#undef ELEM
+  };
+
+static const struct joining_group_stringpool_t joining_group_stringpool_contents =
+  {
+#define ELEM(tag,string) string,
+#include "unictype/joininggroup_name.h"
+#undef ELEM
+  };
+#define joining_group_stringpool ((const char *) &joining_group_stringpool_contents)
+
+static const int joining_group_index[] =
+  {
+#define ELEM(tag,string) (int)(long)&((struct joining_group_stringpool_t *)0)->tag,
+#include "unictype/joininggroup_name.h"
+#undef ELEM
+  };
+
+const char *
+uc_joining_group_name (int joining_group)
+{
+  if (joining_group >= 0
+      && joining_group < sizeof (joining_group_index) / sizeof (joining_group_index[0]))
+    return joining_group_stringpool + joining_group_index[joining_group];
+  return NULL;
+}
diff --git a/lib/unictype/joininggroup_name.h b/lib/unictype/joininggroup_name.h
new file mode 100644 (file)
index 0000000..12436a4
--- /dev/null
@@ -0,0 +1,74 @@
+/* Arabic joining group of Unicode characters.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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/>.  */
+
+ELEM (NONE,                  "No Joining Group")
+ELEM (AIN,                   "Ain")
+ELEM (ALAPH,                 "Alaph")
+ELEM (ALEF,                  "Alef")
+ELEM (BEH,                   "Beh")
+ELEM (BETH,                  "Beth")
+ELEM (BURUSHASKI_YEH_BARREE, "Burushaski Yeh Barree")
+ELEM (DAL,                   "Dal")
+ELEM (DALATH_RISH,           "Dalath Rish")
+ELEM (E,                     "E")
+ELEM (FARSI_YEH,             "Farsi Yeh")
+ELEM (FE,                    "Fe")
+ELEM (FEH,                   "Feh")
+ELEM (FINAL_SEMKATH,         "Final Semkath")
+ELEM (GAF,                   "Gaf")
+ELEM (GAMAL,                 "Gamal")
+ELEM (HAH,                   "Hah")
+ELEM (HE,                    "He")
+ELEM (HEH,                   "Heh")
+ELEM (HEH_GOAL,              "Heh Goal")
+ELEM (HETH,                  "Heth")
+ELEM (KAF,                   "Kaf")
+ELEM (KAPH,                  "Kaph")
+ELEM (KHAPH,                 "Khaph")
+ELEM (KNOTTED_HEH,           "Knotted Heh")
+ELEM (LAM,                   "Lam")
+ELEM (LAMADH,                "Lamadh")
+ELEM (MEEM,                  "Meem")
+ELEM (MIM,                   "Mim")
+ELEM (NOON,                  "Noon")
+ELEM (NUN,                   "Nun")
+ELEM (NYA,                   "Nya")
+ELEM (PE,                    "Pe")
+ELEM (QAF,                   "Qaf")
+ELEM (QAPH,                  "Qaph")
+ELEM (REH,                   "Reh")
+ELEM (REVERSED_PE,           "Reversed Pe")
+ELEM (SAD,                   "Sad")
+ELEM (SADHE,                 "Sadhe")
+ELEM (SEEN,                  "Seen")
+ELEM (SEMKATH,               "Semkath")
+ELEM (SHIN,                  "Shin")
+ELEM (SWASH_KAF,             "Swash Kaf")
+ELEM (SYRIAC_WAW,            "Syriac Waw")
+ELEM (TAH,                   "Tah")
+ELEM (TAW,                   "Taw")
+ELEM (TEH_MARBUTA,           "Teh Marbuta")
+ELEM (TEH_MARBUTA_GOAL,      "Teh Marbuta Goal")
+ELEM (TETH,                  "Teth")
+ELEM (WAW,                   "Waw")
+ELEM (YEH,                   "Yeh")
+ELEM (YEH_BARREE,            "Yeh Barree")
+ELEM (YEH_WITH_TAIL,         "Yeh With Tail")
+ELEM (YUDH,                  "Yudh")
+ELEM (YUDH_HE,               "Yudh He")
+ELEM (ZAIN,                  "Zain")
+ELEM (ZHAIN,                 "Zhain")
diff --git a/lib/unictype/joininggroup_of.c b/lib/unictype/joininggroup_of.c
new file mode 100644 (file)
index 0000000..5dc393e
--- /dev/null
@@ -0,0 +1,33 @@
+/* Arabic joining group of Unicode characters.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+#include "unictype/joininggroup_of.h"
+
+int
+uc_joining_group (ucs4_t uc)
+{
+  if (uc >= joining_group_header_0
+      && uc < joining_group_header_0
+              + sizeof (u_joining_group) / sizeof (u_joining_group[0]))
+    return u_joining_group[uc - joining_group_header_0];
+  return UC_JOINING_GROUP_NONE;
+}
diff --git a/lib/unictype/joininggroup_of.h b/lib/unictype/joininggroup_of.h
new file mode 100644 (file)
index 0000000..1dd4804
--- /dev/null
@@ -0,0 +1,183 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Arabic joining type of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 6.0.0.  */
+#define joining_group_header_0 0x620
+static const unsigned char u_joining_group[0x780 - 0x620] =
+{
+  UC_JOINING_GROUP_YEH,                   UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_ALEF,                  UC_JOINING_GROUP_ALEF,
+  UC_JOINING_GROUP_WAW,                   UC_JOINING_GROUP_ALEF,
+  UC_JOINING_GROUP_YEH,                   UC_JOINING_GROUP_ALEF,
+  UC_JOINING_GROUP_BEH,                   UC_JOINING_GROUP_TEH_MARBUTA,
+  UC_JOINING_GROUP_BEH,                   UC_JOINING_GROUP_BEH,
+  UC_JOINING_GROUP_HAH,                   UC_JOINING_GROUP_HAH,
+  UC_JOINING_GROUP_HAH,                   UC_JOINING_GROUP_DAL,
+  UC_JOINING_GROUP_DAL,                   UC_JOINING_GROUP_REH,
+  UC_JOINING_GROUP_REH,                   UC_JOINING_GROUP_SEEN,
+  UC_JOINING_GROUP_SEEN,                  UC_JOINING_GROUP_SAD,
+  UC_JOINING_GROUP_SAD,                   UC_JOINING_GROUP_TAH,
+  UC_JOINING_GROUP_TAH,                   UC_JOINING_GROUP_AIN,
+  UC_JOINING_GROUP_AIN,                   UC_JOINING_GROUP_GAF,
+  UC_JOINING_GROUP_GAF,                   UC_JOINING_GROUP_FARSI_YEH,
+  UC_JOINING_GROUP_FARSI_YEH,             UC_JOINING_GROUP_FARSI_YEH,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_FEH,
+  UC_JOINING_GROUP_QAF,                   UC_JOINING_GROUP_KAF,
+  UC_JOINING_GROUP_LAM,                   UC_JOINING_GROUP_MEEM,
+  UC_JOINING_GROUP_NOON,                  UC_JOINING_GROUP_HEH,
+  UC_JOINING_GROUP_WAW,                   UC_JOINING_GROUP_YEH,
+  UC_JOINING_GROUP_YEH,                   UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_BEH,                   UC_JOINING_GROUP_QAF,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_ALEF,
+  UC_JOINING_GROUP_ALEF,                  UC_JOINING_GROUP_ALEF,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_ALEF,
+  UC_JOINING_GROUP_WAW,                   UC_JOINING_GROUP_WAW,
+  UC_JOINING_GROUP_YEH,                   UC_JOINING_GROUP_BEH,
+  UC_JOINING_GROUP_BEH,                   UC_JOINING_GROUP_BEH,
+  UC_JOINING_GROUP_BEH,                   UC_JOINING_GROUP_BEH,
+  UC_JOINING_GROUP_BEH,                   UC_JOINING_GROUP_BEH,
+  UC_JOINING_GROUP_BEH,                   UC_JOINING_GROUP_HAH,
+  UC_JOINING_GROUP_HAH,                   UC_JOINING_GROUP_HAH,
+  UC_JOINING_GROUP_HAH,                   UC_JOINING_GROUP_HAH,
+  UC_JOINING_GROUP_HAH,                   UC_JOINING_GROUP_HAH,
+  UC_JOINING_GROUP_DAL,                   UC_JOINING_GROUP_DAL,
+  UC_JOINING_GROUP_DAL,                   UC_JOINING_GROUP_DAL,
+  UC_JOINING_GROUP_DAL,                   UC_JOINING_GROUP_DAL,
+  UC_JOINING_GROUP_DAL,                   UC_JOINING_GROUP_DAL,
+  UC_JOINING_GROUP_DAL,                   UC_JOINING_GROUP_REH,
+  UC_JOINING_GROUP_REH,                   UC_JOINING_GROUP_REH,
+  UC_JOINING_GROUP_REH,                   UC_JOINING_GROUP_REH,
+  UC_JOINING_GROUP_REH,                   UC_JOINING_GROUP_REH,
+  UC_JOINING_GROUP_REH,                   UC_JOINING_GROUP_REH,
+  UC_JOINING_GROUP_SEEN,                  UC_JOINING_GROUP_SEEN,
+  UC_JOINING_GROUP_SEEN,                  UC_JOINING_GROUP_SAD,
+  UC_JOINING_GROUP_SAD,                   UC_JOINING_GROUP_TAH,
+  UC_JOINING_GROUP_AIN,                   UC_JOINING_GROUP_FEH,
+  UC_JOINING_GROUP_FEH,                   UC_JOINING_GROUP_FEH,
+  UC_JOINING_GROUP_FEH,                   UC_JOINING_GROUP_FEH,
+  UC_JOINING_GROUP_FEH,                   UC_JOINING_GROUP_QAF,
+  UC_JOINING_GROUP_QAF,                   UC_JOINING_GROUP_GAF,
+  UC_JOINING_GROUP_SWASH_KAF,             UC_JOINING_GROUP_GAF,
+  UC_JOINING_GROUP_KAF,                   UC_JOINING_GROUP_KAF,
+  UC_JOINING_GROUP_KAF,                   UC_JOINING_GROUP_GAF,
+  UC_JOINING_GROUP_GAF,                   UC_JOINING_GROUP_GAF,
+  UC_JOINING_GROUP_GAF,                   UC_JOINING_GROUP_GAF,
+  UC_JOINING_GROUP_GAF,                   UC_JOINING_GROUP_LAM,
+  UC_JOINING_GROUP_LAM,                   UC_JOINING_GROUP_LAM,
+  UC_JOINING_GROUP_LAM,                   UC_JOINING_GROUP_NOON,
+  UC_JOINING_GROUP_NOON,                  UC_JOINING_GROUP_NOON,
+  UC_JOINING_GROUP_NOON,                  UC_JOINING_GROUP_NYA,
+  UC_JOINING_GROUP_KNOTTED_HEH,           UC_JOINING_GROUP_HAH,
+  UC_JOINING_GROUP_TEH_MARBUTA,           UC_JOINING_GROUP_HEH_GOAL,
+  UC_JOINING_GROUP_HEH_GOAL,              UC_JOINING_GROUP_TEH_MARBUTA_GOAL,
+  UC_JOINING_GROUP_WAW,                   UC_JOINING_GROUP_WAW,
+  UC_JOINING_GROUP_WAW,                   UC_JOINING_GROUP_WAW,
+  UC_JOINING_GROUP_WAW,                   UC_JOINING_GROUP_WAW,
+  UC_JOINING_GROUP_WAW,                   UC_JOINING_GROUP_WAW,
+  UC_JOINING_GROUP_FARSI_YEH,             UC_JOINING_GROUP_YEH_WITH_TAIL,
+  UC_JOINING_GROUP_FARSI_YEH,             UC_JOINING_GROUP_WAW,
+  UC_JOINING_GROUP_YEH,                   UC_JOINING_GROUP_YEH,
+  UC_JOINING_GROUP_YEH_BARREE,            UC_JOINING_GROUP_YEH_BARREE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_TEH_MARBUTA,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_DAL,                   UC_JOINING_GROUP_REH,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_SEEN,                  UC_JOINING_GROUP_SAD,
+  UC_JOINING_GROUP_AIN,                   UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_KNOTTED_HEH,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_ALAPH,                 UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_BETH,                  UC_JOINING_GROUP_GAMAL,
+  UC_JOINING_GROUP_GAMAL,                 UC_JOINING_GROUP_DALATH_RISH,
+  UC_JOINING_GROUP_DALATH_RISH,           UC_JOINING_GROUP_HE,
+  UC_JOINING_GROUP_SYRIAC_WAW,            UC_JOINING_GROUP_ZAIN,
+  UC_JOINING_GROUP_HETH,                  UC_JOINING_GROUP_TETH,
+  UC_JOINING_GROUP_TETH,                  UC_JOINING_GROUP_YUDH,
+  UC_JOINING_GROUP_YUDH_HE,               UC_JOINING_GROUP_KAPH,
+  UC_JOINING_GROUP_LAMADH,                UC_JOINING_GROUP_MIM,
+  UC_JOINING_GROUP_NUN,                   UC_JOINING_GROUP_SEMKATH,
+  UC_JOINING_GROUP_FINAL_SEMKATH,         UC_JOINING_GROUP_E,
+  UC_JOINING_GROUP_PE,                    UC_JOINING_GROUP_REVERSED_PE,
+  UC_JOINING_GROUP_SADHE,                 UC_JOINING_GROUP_QAPH,
+  UC_JOINING_GROUP_DALATH_RISH,           UC_JOINING_GROUP_SHIN,
+  UC_JOINING_GROUP_TAW,                   UC_JOINING_GROUP_BETH,
+  UC_JOINING_GROUP_GAMAL,                 UC_JOINING_GROUP_DALATH_RISH,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_NONE,
+  UC_JOINING_GROUP_NONE,                  UC_JOINING_GROUP_ZHAIN,
+  UC_JOINING_GROUP_KHAPH,                 UC_JOINING_GROUP_FE,
+  UC_JOINING_GROUP_BEH,                   UC_JOINING_GROUP_BEH,
+  UC_JOINING_GROUP_BEH,                   UC_JOINING_GROUP_BEH,
+  UC_JOINING_GROUP_BEH,                   UC_JOINING_GROUP_BEH,
+  UC_JOINING_GROUP_BEH,                   UC_JOINING_GROUP_HAH,
+  UC_JOINING_GROUP_HAH,                   UC_JOINING_GROUP_DAL,
+  UC_JOINING_GROUP_DAL,                   UC_JOINING_GROUP_REH,
+  UC_JOINING_GROUP_SEEN,                  UC_JOINING_GROUP_AIN,
+  UC_JOINING_GROUP_AIN,                   UC_JOINING_GROUP_AIN,
+  UC_JOINING_GROUP_FEH,                   UC_JOINING_GROUP_FEH,
+  UC_JOINING_GROUP_GAF,                   UC_JOINING_GROUP_GAF,
+  UC_JOINING_GROUP_GAF,                   UC_JOINING_GROUP_MEEM,
+  UC_JOINING_GROUP_MEEM,                  UC_JOINING_GROUP_NOON,
+  UC_JOINING_GROUP_NOON,                  UC_JOINING_GROUP_NOON,
+  UC_JOINING_GROUP_LAM,                   UC_JOINING_GROUP_REH,
+  UC_JOINING_GROUP_REH,                   UC_JOINING_GROUP_SEEN,
+  UC_JOINING_GROUP_HAH,                   UC_JOINING_GROUP_HAH,
+  UC_JOINING_GROUP_SEEN,                  UC_JOINING_GROUP_REH,
+  UC_JOINING_GROUP_HAH,                   UC_JOINING_GROUP_ALEF,
+  UC_JOINING_GROUP_ALEF,                  UC_JOINING_GROUP_FARSI_YEH,
+  UC_JOINING_GROUP_FARSI_YEH,             UC_JOINING_GROUP_YEH,
+  UC_JOINING_GROUP_WAW,                   UC_JOINING_GROUP_WAW,
+  UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE, UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE,
+  UC_JOINING_GROUP_HAH,                   UC_JOINING_GROUP_SEEN,
+  UC_JOINING_GROUP_SEEN,                  UC_JOINING_GROUP_KAF
+};
diff --git a/lib/unictype/joiningtype_byname.c b/lib/unictype/joiningtype_byname.c
new file mode 100644 (file)
index 0000000..11b4f69
--- /dev/null
@@ -0,0 +1,63 @@
+/* Arabic joining type of Unicode characters.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+#include <string.h>
+
+#include "unictype/joiningtype_byname.h"
+
+int
+uc_joining_type_byname (const char *joining_type_name)
+{
+  size_t len;
+
+  len = strlen (joining_type_name);
+  if (len <= MAX_WORD_LENGTH)
+    {
+      char buf[MAX_WORD_LENGTH + 1];
+      const struct named_joining_type *found;
+
+      /* Copy joining_type_name into buf, converting '_' and '-' to ' '.  */
+      {
+        const char *p = joining_type_name;
+        char *q = buf;
+
+        for (;; p++, q++)
+          {
+            char c = *p;
+
+            if (c == '_' || c == '-')
+              c = ' ';
+            *q = c;
+            if (c == '\0')
+              break;
+          }
+      }
+      /* Here q == buf + len.  */
+
+      /* Do a hash table lookup, with case-insensitive comparison.  */
+      found = uc_joining_type_lookup (buf, len);
+      if (found != NULL)
+        return found->joining_type;
+    }
+  /* Invalid joining type name.  */
+  return -1;
+}
diff --git a/lib/unictype/joiningtype_byname.gperf b/lib/unictype/joiningtype_byname.gperf
new file mode 100644 (file)
index 0000000..6b1e7d7
--- /dev/null
@@ -0,0 +1,30 @@
+/* Arabic joining type of Unicode characters.  */
+struct named_joining_type { int name; int joining_type; };
+%struct-type
+%ignore-case
+%language=ANSI-C
+%define hash-function-name joining_type_hash
+%define lookup-function-name uc_joining_type_lookup
+%readonly-tables
+%global-table
+%define word-array-name joining_type_names
+%pic
+%define string-pool-name joining_type_stringpool
+%%
+C, UC_JOINING_TYPE_C
+D, UC_JOINING_TYPE_D
+L, UC_JOINING_TYPE_L
+R, UC_JOINING_TYPE_R
+T, UC_JOINING_TYPE_T
+U, UC_JOINING_TYPE_U
+Join Causing, UC_JOINING_TYPE_C
+JoinCausing, UC_JOINING_TYPE_C
+Dual Joining, UC_JOINING_TYPE_D
+DualJoining, UC_JOINING_TYPE_D
+Left Joining, UC_JOINING_TYPE_L
+LeftJoining, UC_JOINING_TYPE_L
+Right Joining, UC_JOINING_TYPE_R
+RightJoining, UC_JOINING_TYPE_R
+Transparent, UC_JOINING_TYPE_T
+Non Joining, UC_JOINING_TYPE_U
+NonJoining, UC_JOINING_TYPE_U
diff --git a/lib/unictype/joiningtype_longname.c b/lib/unictype/joiningtype_longname.c
new file mode 100644 (file)
index 0000000..3948b0c
--- /dev/null
@@ -0,0 +1,40 @@
+/* Arabic joining type of Unicode characters.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+static const char u_joining_type_long_name[6][14] =
+{
+  "Non Joining",
+  "Transparent",
+  "Join Causing",
+  "Left Joining",
+  "Right Joining",
+  "Dual Joining"
+};
+
+const char *
+uc_joining_type_long_name (int joining_type)
+{
+  if (joining_type >= 0
+      && joining_type < sizeof (u_joining_type_long_name) / sizeof (u_joining_type_long_name[0]))
+    return u_joining_type_long_name[joining_type];
+  return NULL;
+}
diff --git a/lib/unictype/joiningtype_name.c b/lib/unictype/joiningtype_name.c
new file mode 100644 (file)
index 0000000..f1166ef
--- /dev/null
@@ -0,0 +1,35 @@
+/* Arabic joining type of Unicode characters.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+static const char u_joining_type_name[6][2] =
+{
+  "U", "T", "C", "L", "R", "D"
+};
+
+const char *
+uc_joining_type_name (int joining_type)
+{
+  if (joining_type >= 0
+      && joining_type < sizeof (u_joining_type_name) / sizeof (u_joining_type_name[0]))
+    return u_joining_type_name[joining_type];
+  return NULL;
+}
diff --git a/lib/unictype/joiningtype_of.c b/lib/unictype/joiningtype_of.c
new file mode 100644 (file)
index 0000000..74a7855
--- /dev/null
@@ -0,0 +1,54 @@
+/* Arabic joining type of Unicode characters.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+/* Define u_joining_type table.  */
+#include "joiningtype_of.h"
+
+int
+uc_joining_type (ucs4_t uc)
+{
+  unsigned int index1 = uc >> joining_type_header_0;
+  if (index1 < joining_type_header_1)
+    {
+      int lookup1 = u_joining_type.level1[index1];
+      if (lookup1 >= 0)
+        {
+          unsigned int index2 = (uc >> joining_type_header_2) & joining_type_header_3;
+          int lookup2 = u_joining_type.level2[lookup1 + index2];
+          if (lookup2 >= 0)
+            {
+              unsigned int index3 = (uc & joining_type_header_4) + lookup2;
+              /* level3 contains 4-bit values.  */
+              unsigned int lookup3 =
+                (u_joining_type.level3[index3>>1] >> ((index3 % 2) * 4))
+                & 0x0f;
+
+              if (lookup3 != 0x0f)
+                return lookup3;
+            }
+        }
+    }
+  if (uc_is_general_category_withtable
+       (uc, UC_CATEGORY_MASK_Mn | UC_CATEGORY_MASK_Me | UC_CATEGORY_MASK_Cf))
+    return UC_JOINING_TYPE_T;
+  return UC_JOINING_TYPE_U;
+}
diff --git a/lib/unictype/joiningtype_of.h b/lib/unictype/joiningtype_of.h
new file mode 100644 (file)
index 0000000..7e2c8bc
--- /dev/null
@@ -0,0 +1,127 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Arabic joining type of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 6.0.0.  */
+#define joining_type_header_0 16
+#define joining_type_header_1 1
+#define joining_type_header_2 7
+#define joining_type_header_3 511
+#define joining_type_header_4 127
+static const
+struct
+  {
+    int level1[1];
+    short level2[1 << 9];
+    unsigned char level3[5 * 64];
+  }
+u_joining_type =
+{
+  {     0 },
+  {
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,     0,   128,   256,   384,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      512,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1
+  },
+  {
+    0x00, 0x00, 0xff, 0xff, 0xf0, 0x0f, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0x05, 0x44, 0x44, 0x45, 0x45, 0x55, 0x55, 0x45,
+    0x44, 0x54, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+    0x52, 0x55, 0x55, 0x55, 0x54, 0xf5, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x55,
+    0x4f, 0x44, 0x40, 0x44, 0x55, 0x55, 0x55, 0x55,
+    0x55, 0x55, 0x55, 0x55, 0x44, 0x44, 0x44, 0x44,
+    0x44, 0x44, 0x44, 0x44, 0x44, 0x55, 0x55, 0x55,
+    0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+    0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+    0x54, 0x45, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45,
+    0x55, 0x44, 0x4f, 0xff, 0xff, 0xff, 0x0f, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x44,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0x55, 0xf5, 0x5f,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xf4, 0x55, 0x45, 0x44, 0x44, 0x55, 0x55, 0x54,
+    0x55, 0x55, 0x55, 0x55, 0x54, 0x54, 0x54, 0x45,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4f, 0x55,
+    0x55, 0x55, 0x55, 0x55, 0x45, 0x44, 0x55, 0x55,
+    0x55, 0x55, 0x55, 0x55, 0x55, 0x45, 0x54, 0x55,
+    0x45, 0x45, 0x54, 0x55, 0x44, 0x55, 0x55, 0x55,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55,
+    0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+    0x55, 0x55, 0x55, 0x55, 0x55, 0xf5, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xf2, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x20, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
+  }
+};
index 7f44a8c..94753ab 100644 (file)
@@ -1,5 +1,5 @@
 /* Properties of Unicode characters.
-   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2011 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
 /* Specification.  */
 #include "unictype.h"
 
+#include <stdlib.h>
 #include <string.h>
 
+/* Indices stored in the 'struct named_category' elements of the perfect hash
+   table.  We don't use uc_general_category_t values or their addresses
+   directly, because this would introduce load-time relocations.  */
+enum
+{
+  /* General.  */
+  UC_PROPERTY_INDEX_WHITE_SPACE,
+  UC_PROPERTY_INDEX_ALPHABETIC,
+  UC_PROPERTY_INDEX_OTHER_ALPHABETIC,
+  UC_PROPERTY_INDEX_NOT_A_CHARACTER,
+  UC_PROPERTY_INDEX_DEFAULT_IGNORABLE_CODE_POINT,
+  UC_PROPERTY_INDEX_OTHER_DEFAULT_IGNORABLE_CODE_POINT,
+  UC_PROPERTY_INDEX_DEPRECATED,
+  UC_PROPERTY_INDEX_LOGICAL_ORDER_EXCEPTION,
+  UC_PROPERTY_INDEX_VARIATION_SELECTOR,
+  UC_PROPERTY_INDEX_PRIVATE_USE,
+  UC_PROPERTY_INDEX_UNASSIGNED_CODE_VALUE,
+  /* Case.  */
+  UC_PROPERTY_INDEX_UPPERCASE,
+  UC_PROPERTY_INDEX_OTHER_UPPERCASE,
+  UC_PROPERTY_INDEX_LOWERCASE,
+  UC_PROPERTY_INDEX_OTHER_LOWERCASE,
+  UC_PROPERTY_INDEX_TITLECASE,
+  UC_PROPERTY_INDEX_CASED,
+  UC_PROPERTY_INDEX_CASE_IGNORABLE,
+  UC_PROPERTY_INDEX_CHANGES_WHEN_LOWERCASED,
+  UC_PROPERTY_INDEX_CHANGES_WHEN_UPPERCASED,
+  UC_PROPERTY_INDEX_CHANGES_WHEN_TITLECASED,
+  UC_PROPERTY_INDEX_CHANGES_WHEN_CASEFOLDED,
+  UC_PROPERTY_INDEX_CHANGES_WHEN_CASEMAPPED,
+  UC_PROPERTY_INDEX_SOFT_DOTTED,
+  /* Identifiers.  */
+  UC_PROPERTY_INDEX_ID_START,
+  UC_PROPERTY_INDEX_OTHER_ID_START,
+  UC_PROPERTY_INDEX_ID_CONTINUE,
+  UC_PROPERTY_INDEX_OTHER_ID_CONTINUE,
+  UC_PROPERTY_INDEX_XID_START,
+  UC_PROPERTY_INDEX_XID_CONTINUE,
+  UC_PROPERTY_INDEX_PATTERN_WHITE_SPACE,
+  UC_PROPERTY_INDEX_PATTERN_SYNTAX,
+  /* Shaping and rendering.  */
+  UC_PROPERTY_INDEX_JOIN_CONTROL,
+  UC_PROPERTY_INDEX_GRAPHEME_BASE,
+  UC_PROPERTY_INDEX_GRAPHEME_EXTEND,
+  UC_PROPERTY_INDEX_OTHER_GRAPHEME_EXTEND,
+  UC_PROPERTY_INDEX_GRAPHEME_LINK,
+  /* Bidi.  */
+  UC_PROPERTY_INDEX_BIDI_CONTROL,
+  UC_PROPERTY_INDEX_BIDI_LEFT_TO_RIGHT,
+  UC_PROPERTY_INDEX_BIDI_HEBREW_RIGHT_TO_LEFT,
+  UC_PROPERTY_INDEX_BIDI_ARABIC_RIGHT_TO_LEFT,
+  UC_PROPERTY_INDEX_BIDI_EUROPEAN_DIGIT,
+  UC_PROPERTY_INDEX_BIDI_EUR_NUM_SEPARATOR,
+  UC_PROPERTY_INDEX_BIDI_EUR_NUM_TERMINATOR,
+  UC_PROPERTY_INDEX_BIDI_ARABIC_DIGIT,
+  UC_PROPERTY_INDEX_BIDI_COMMON_SEPARATOR,
+  UC_PROPERTY_INDEX_BIDI_BLOCK_SEPARATOR,
+  UC_PROPERTY_INDEX_BIDI_SEGMENT_SEPARATOR,
+  UC_PROPERTY_INDEX_BIDI_WHITESPACE,
+  UC_PROPERTY_INDEX_BIDI_NON_SPACING_MARK,
+  UC_PROPERTY_INDEX_BIDI_BOUNDARY_NEUTRAL,
+  UC_PROPERTY_INDEX_BIDI_PDF,
+  UC_PROPERTY_INDEX_BIDI_EMBEDDING_OR_OVERRIDE,
+  UC_PROPERTY_INDEX_BIDI_OTHER_NEUTRAL,
+  /* Numeric.  */
+  UC_PROPERTY_INDEX_HEX_DIGIT,
+  UC_PROPERTY_INDEX_ASCII_HEX_DIGIT,
+  /* CJK.  */
+  UC_PROPERTY_INDEX_IDEOGRAPHIC,
+  UC_PROPERTY_INDEX_UNIFIED_IDEOGRAPH,
+  UC_PROPERTY_INDEX_RADICAL,
+  UC_PROPERTY_INDEX_IDS_BINARY_OPERATOR,
+  UC_PROPERTY_INDEX_IDS_TRINARY_OPERATOR,
+  /* Misc.  */
+  UC_PROPERTY_INDEX_ZERO_WIDTH,
+  UC_PROPERTY_INDEX_SPACE,
+  UC_PROPERTY_INDEX_NON_BREAK,
+  UC_PROPERTY_INDEX_ISO_CONTROL,
+  UC_PROPERTY_INDEX_FORMAT_CONTROL,
+  UC_PROPERTY_INDEX_DASH,
+  UC_PROPERTY_INDEX_HYPHEN,
+  UC_PROPERTY_INDEX_PUNCTUATION,
+  UC_PROPERTY_INDEX_LINE_SEPARATOR,
+  UC_PROPERTY_INDEX_PARAGRAPH_SEPARATOR,
+  UC_PROPERTY_INDEX_QUOTATION_MARK,
+  UC_PROPERTY_INDEX_SENTENCE_TERMINAL,
+  UC_PROPERTY_INDEX_TERMINAL_PUNCTUATION,
+  UC_PROPERTY_INDEX_CURRENCY_SYMBOL,
+  UC_PROPERTY_INDEX_MATH,
+  UC_PROPERTY_INDEX_OTHER_MATH,
+  UC_PROPERTY_INDEX_PAIRED_PUNCTUATION,
+  UC_PROPERTY_INDEX_LEFT_OF_PAIR,
+  UC_PROPERTY_INDEX_COMBINING,
+  UC_PROPERTY_INDEX_COMPOSITE,
+  UC_PROPERTY_INDEX_DECIMAL_DIGIT,
+  UC_PROPERTY_INDEX_NUMERIC,
+  UC_PROPERTY_INDEX_DIACRITIC,
+  UC_PROPERTY_INDEX_EXTENDER,
+  UC_PROPERTY_INDEX_IGNORABLE_CONTROL
+};
+
 /* Get gperf generated lookup function.  */
 #include "unictype/pr_byname.h"
 
@@ -53,7 +155,185 @@ uc_property_byname (const char *property_name)
     }
   found = uc_property_lookup (buf, bp - buf);
   if (found != NULL)
-    return found->property;
+    /* Use a 'switch' statement here, because a table would introduce load-time
+       relocations.  */
+    switch (found->property_index)
+      {
+      case UC_PROPERTY_INDEX_WHITE_SPACE:
+        return UC_PROPERTY_WHITE_SPACE;
+      case UC_PROPERTY_INDEX_ALPHABETIC:
+        return UC_PROPERTY_ALPHABETIC;
+      case UC_PROPERTY_INDEX_OTHER_ALPHABETIC:
+        return UC_PROPERTY_OTHER_ALPHABETIC;
+      case UC_PROPERTY_INDEX_NOT_A_CHARACTER:
+        return UC_PROPERTY_NOT_A_CHARACTER;
+      case UC_PROPERTY_INDEX_DEFAULT_IGNORABLE_CODE_POINT:
+        return UC_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT;
+      case UC_PROPERTY_INDEX_OTHER_DEFAULT_IGNORABLE_CODE_POINT:
+        return UC_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT;
+      case UC_PROPERTY_INDEX_DEPRECATED:
+        return UC_PROPERTY_DEPRECATED;
+      case UC_PROPERTY_INDEX_LOGICAL_ORDER_EXCEPTION:
+        return UC_PROPERTY_LOGICAL_ORDER_EXCEPTION;
+      case UC_PROPERTY_INDEX_VARIATION_SELECTOR:
+        return UC_PROPERTY_VARIATION_SELECTOR;
+      case UC_PROPERTY_INDEX_PRIVATE_USE:
+        return UC_PROPERTY_PRIVATE_USE;
+      case UC_PROPERTY_INDEX_UNASSIGNED_CODE_VALUE:
+        return UC_PROPERTY_UNASSIGNED_CODE_VALUE;
+      case UC_PROPERTY_INDEX_UPPERCASE:
+        return UC_PROPERTY_UPPERCASE;
+      case UC_PROPERTY_INDEX_OTHER_UPPERCASE:
+        return UC_PROPERTY_OTHER_UPPERCASE;
+      case UC_PROPERTY_INDEX_LOWERCASE:
+        return UC_PROPERTY_LOWERCASE;
+      case UC_PROPERTY_INDEX_OTHER_LOWERCASE:
+        return UC_PROPERTY_OTHER_LOWERCASE;
+      case UC_PROPERTY_INDEX_TITLECASE:
+        return UC_PROPERTY_TITLECASE;
+      case UC_PROPERTY_INDEX_CASED:
+        return UC_PROPERTY_CASED;
+      case UC_PROPERTY_INDEX_CASE_IGNORABLE:
+        return UC_PROPERTY_CASE_IGNORABLE;
+      case UC_PROPERTY_INDEX_CHANGES_WHEN_LOWERCASED:
+        return UC_PROPERTY_CHANGES_WHEN_LOWERCASED;
+      case UC_PROPERTY_INDEX_CHANGES_WHEN_UPPERCASED:
+        return UC_PROPERTY_CHANGES_WHEN_UPPERCASED;
+      case UC_PROPERTY_INDEX_CHANGES_WHEN_TITLECASED:
+        return UC_PROPERTY_CHANGES_WHEN_TITLECASED;
+      case UC_PROPERTY_INDEX_CHANGES_WHEN_CASEFOLDED:
+        return UC_PROPERTY_CHANGES_WHEN_CASEFOLDED;
+      case UC_PROPERTY_INDEX_CHANGES_WHEN_CASEMAPPED:
+        return UC_PROPERTY_CHANGES_WHEN_CASEMAPPED;
+      case UC_PROPERTY_INDEX_SOFT_DOTTED:
+        return UC_PROPERTY_SOFT_DOTTED;
+      case UC_PROPERTY_INDEX_ID_START:
+        return UC_PROPERTY_ID_START;
+      case UC_PROPERTY_INDEX_OTHER_ID_START:
+        return UC_PROPERTY_OTHER_ID_START;
+      case UC_PROPERTY_INDEX_ID_CONTINUE:
+        return UC_PROPERTY_ID_CONTINUE;
+      case UC_PROPERTY_INDEX_OTHER_ID_CONTINUE:
+        return UC_PROPERTY_OTHER_ID_CONTINUE;
+      case UC_PROPERTY_INDEX_XID_START:
+        return UC_PROPERTY_XID_START;
+      case UC_PROPERTY_INDEX_XID_CONTINUE:
+        return UC_PROPERTY_XID_CONTINUE;
+      case UC_PROPERTY_INDEX_PATTERN_WHITE_SPACE:
+        return UC_PROPERTY_PATTERN_WHITE_SPACE;
+      case UC_PROPERTY_INDEX_PATTERN_SYNTAX:
+        return UC_PROPERTY_PATTERN_SYNTAX;
+      case UC_PROPERTY_INDEX_JOIN_CONTROL:
+        return UC_PROPERTY_JOIN_CONTROL;
+      case UC_PROPERTY_INDEX_GRAPHEME_BASE:
+        return UC_PROPERTY_GRAPHEME_BASE;
+      case UC_PROPERTY_INDEX_GRAPHEME_EXTEND:
+        return UC_PROPERTY_GRAPHEME_EXTEND;
+      case UC_PROPERTY_INDEX_OTHER_GRAPHEME_EXTEND:
+        return UC_PROPERTY_OTHER_GRAPHEME_EXTEND;
+      case UC_PROPERTY_INDEX_GRAPHEME_LINK:
+        return UC_PROPERTY_GRAPHEME_LINK;
+      case UC_PROPERTY_INDEX_BIDI_CONTROL:
+        return UC_PROPERTY_BIDI_CONTROL;
+      case UC_PROPERTY_INDEX_BIDI_LEFT_TO_RIGHT:
+        return UC_PROPERTY_BIDI_LEFT_TO_RIGHT;
+      case UC_PROPERTY_INDEX_BIDI_HEBREW_RIGHT_TO_LEFT:
+        return UC_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT;
+      case UC_PROPERTY_INDEX_BIDI_ARABIC_RIGHT_TO_LEFT:
+        return UC_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT;
+      case UC_PROPERTY_INDEX_BIDI_EUROPEAN_DIGIT:
+        return UC_PROPERTY_BIDI_EUROPEAN_DIGIT;
+      case UC_PROPERTY_INDEX_BIDI_EUR_NUM_SEPARATOR:
+        return UC_PROPERTY_BIDI_EUR_NUM_SEPARATOR;
+      case UC_PROPERTY_INDEX_BIDI_EUR_NUM_TERMINATOR:
+        return UC_PROPERTY_BIDI_EUR_NUM_TERMINATOR;
+      case UC_PROPERTY_INDEX_BIDI_ARABIC_DIGIT:
+        return UC_PROPERTY_BIDI_ARABIC_DIGIT;
+      case UC_PROPERTY_INDEX_BIDI_COMMON_SEPARATOR:
+        return UC_PROPERTY_BIDI_COMMON_SEPARATOR;
+      case UC_PROPERTY_INDEX_BIDI_BLOCK_SEPARATOR:
+        return UC_PROPERTY_BIDI_BLOCK_SEPARATOR;
+      case UC_PROPERTY_INDEX_BIDI_SEGMENT_SEPARATOR:
+        return UC_PROPERTY_BIDI_SEGMENT_SEPARATOR;
+      case UC_PROPERTY_INDEX_BIDI_WHITESPACE:
+        return UC_PROPERTY_BIDI_WHITESPACE;
+      case UC_PROPERTY_INDEX_BIDI_NON_SPACING_MARK:
+        return UC_PROPERTY_BIDI_NON_SPACING_MARK;
+      case UC_PROPERTY_INDEX_BIDI_BOUNDARY_NEUTRAL:
+        return UC_PROPERTY_BIDI_BOUNDARY_NEUTRAL;
+      case UC_PROPERTY_INDEX_BIDI_PDF:
+        return UC_PROPERTY_BIDI_PDF;
+      case UC_PROPERTY_INDEX_BIDI_EMBEDDING_OR_OVERRIDE:
+        return UC_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE;
+      case UC_PROPERTY_INDEX_BIDI_OTHER_NEUTRAL:
+        return UC_PROPERTY_BIDI_OTHER_NEUTRAL;
+      case UC_PROPERTY_INDEX_HEX_DIGIT:
+        return UC_PROPERTY_HEX_DIGIT;
+      case UC_PROPERTY_INDEX_ASCII_HEX_DIGIT:
+        return UC_PROPERTY_ASCII_HEX_DIGIT;
+      case UC_PROPERTY_INDEX_IDEOGRAPHIC:
+        return UC_PROPERTY_IDEOGRAPHIC;
+      case UC_PROPERTY_INDEX_UNIFIED_IDEOGRAPH:
+        return UC_PROPERTY_UNIFIED_IDEOGRAPH;
+      case UC_PROPERTY_INDEX_RADICAL:
+        return UC_PROPERTY_RADICAL;
+      case UC_PROPERTY_INDEX_IDS_BINARY_OPERATOR:
+        return UC_PROPERTY_IDS_BINARY_OPERATOR;
+      case UC_PROPERTY_INDEX_IDS_TRINARY_OPERATOR:
+        return UC_PROPERTY_IDS_TRINARY_OPERATOR;
+      case UC_PROPERTY_INDEX_ZERO_WIDTH:
+        return UC_PROPERTY_ZERO_WIDTH;
+      case UC_PROPERTY_INDEX_SPACE:
+        return UC_PROPERTY_SPACE;
+      case UC_PROPERTY_INDEX_NON_BREAK:
+        return UC_PROPERTY_NON_BREAK;
+      case UC_PROPERTY_INDEX_ISO_CONTROL:
+        return UC_PROPERTY_ISO_CONTROL;
+      case UC_PROPERTY_INDEX_FORMAT_CONTROL:
+        return UC_PROPERTY_FORMAT_CONTROL;
+      case UC_PROPERTY_INDEX_DASH:
+        return UC_PROPERTY_DASH;
+      case UC_PROPERTY_INDEX_HYPHEN:
+        return UC_PROPERTY_HYPHEN;
+      case UC_PROPERTY_INDEX_PUNCTUATION:
+        return UC_PROPERTY_PUNCTUATION;
+      case UC_PROPERTY_INDEX_LINE_SEPARATOR:
+        return UC_PROPERTY_LINE_SEPARATOR;
+      case UC_PROPERTY_INDEX_PARAGRAPH_SEPARATOR:
+        return UC_PROPERTY_PARAGRAPH_SEPARATOR;
+      case UC_PROPERTY_INDEX_QUOTATION_MARK:
+        return UC_PROPERTY_QUOTATION_MARK;
+      case UC_PROPERTY_INDEX_SENTENCE_TERMINAL:
+        return UC_PROPERTY_SENTENCE_TERMINAL;
+      case UC_PROPERTY_INDEX_TERMINAL_PUNCTUATION:
+        return UC_PROPERTY_TERMINAL_PUNCTUATION;
+      case UC_PROPERTY_INDEX_CURRENCY_SYMBOL:
+        return UC_PROPERTY_CURRENCY_SYMBOL;
+      case UC_PROPERTY_INDEX_MATH:
+        return UC_PROPERTY_MATH;
+      case UC_PROPERTY_INDEX_OTHER_MATH:
+        return UC_PROPERTY_OTHER_MATH;
+      case UC_PROPERTY_INDEX_PAIRED_PUNCTUATION:
+        return UC_PROPERTY_PAIRED_PUNCTUATION;
+      case UC_PROPERTY_INDEX_LEFT_OF_PAIR:
+        return UC_PROPERTY_LEFT_OF_PAIR;
+      case UC_PROPERTY_INDEX_COMBINING:
+        return UC_PROPERTY_COMBINING;
+      case UC_PROPERTY_INDEX_COMPOSITE:
+        return UC_PROPERTY_COMPOSITE;
+      case UC_PROPERTY_INDEX_DECIMAL_DIGIT:
+        return UC_PROPERTY_DECIMAL_DIGIT;
+      case UC_PROPERTY_INDEX_NUMERIC:
+        return UC_PROPERTY_NUMERIC;
+      case UC_PROPERTY_INDEX_DIACRITIC:
+        return UC_PROPERTY_DIACRITIC;
+      case UC_PROPERTY_INDEX_EXTENDER:
+        return UC_PROPERTY_EXTENDER;
+      case UC_PROPERTY_INDEX_IGNORABLE_CONTROL:
+        return UC_PROPERTY_IGNORABLE_CONTROL;
+      default:
+        abort ();
+      }
  invalid:
   return UC_PROPERTY_NONE;
 }
index 79de6e8..9c2031b 100644 (file)
@@ -1,4 +1,4 @@
-struct named_property { const char *name; uc_property_t property; };
+struct named_property { int name; int property_index; };
 %struct-type
 %language=ANSI-C
 %define hash-function-name properties_hash
@@ -7,90 +7,212 @@ struct named_property { const char *name; uc_property_t property; };
 %readonly-tables
 %global-table
 %define word-array-name properties
+%pic
+%define string-pool-name properties_stringpool
 %%
-white_space, { &uc_is_property_white_space }
-alphabetic, { &uc_is_property_alphabetic }
-other_alphabetic, { &uc_is_property_other_alphabetic }
-not_a_character, { &uc_is_property_not_a_character }
-default_ignorable_code_point, { &uc_is_property_default_ignorable_code_point }
-other_default_ignorable_code_point, { &uc_is_property_other_default_ignorable_code_point }
-deprecated, { &uc_is_property_deprecated }
-logical_order_exception, { &uc_is_property_logical_order_exception }
-variation_selector, { &uc_is_property_variation_selector }
-private_use, { &uc_is_property_private_use }
-unassigned_code_value, { &uc_is_property_unassigned_code_value }
-uppercase, { &uc_is_property_uppercase }
-other_uppercase, { &uc_is_property_other_uppercase }
-lowercase, { &uc_is_property_lowercase }
-other_lowercase, { &uc_is_property_other_lowercase }
-titlecase, { &uc_is_property_titlecase }
-cased, { &uc_is_property_cased }
-case_ignorable, { &uc_is_property_case_ignorable }
-changes_when_lowercased, { &uc_is_property_changes_when_lowercased }
-changes_when_uppercased, { &uc_is_property_changes_when_uppercased }
-changes_when_titlecased, { &uc_is_property_changes_when_titlecased }
-changes_when_casefolded, { &uc_is_property_changes_when_casefolded }
-changes_when_casemapped, { &uc_is_property_changes_when_casemapped }
-soft_dotted, { &uc_is_property_soft_dotted }
-id_start, { &uc_is_property_id_start }
-other_id_start, { &uc_is_property_other_id_start }
-id_continue, { &uc_is_property_id_continue }
-other_id_continue, { &uc_is_property_other_id_continue }
-xid_start, { &uc_is_property_xid_start }
-xid_continue, { &uc_is_property_xid_continue }
-pattern_white_space, { &uc_is_property_pattern_white_space }
-pattern_syntax, { &uc_is_property_pattern_syntax }
-join_control, { &uc_is_property_join_control }
-grapheme_base, { &uc_is_property_grapheme_base }
-grapheme_extend, { &uc_is_property_grapheme_extend }
-other_grapheme_extend, { &uc_is_property_other_grapheme_extend }
-grapheme_link, { &uc_is_property_grapheme_link }
-bidi_control, { &uc_is_property_bidi_control }
-bidi_left_to_right, { &uc_is_property_bidi_left_to_right }
-bidi_hebrew_right_to_left, { &uc_is_property_bidi_hebrew_right_to_left }
-bidi_arabic_right_to_left, { &uc_is_property_bidi_arabic_right_to_left }
-bidi_european_digit, { &uc_is_property_bidi_european_digit }
-bidi_eur_num_separator, { &uc_is_property_bidi_eur_num_separator }
-bidi_eur_num_terminator, { &uc_is_property_bidi_eur_num_terminator }
-bidi_arabic_digit, { &uc_is_property_bidi_arabic_digit }
-bidi_common_separator, { &uc_is_property_bidi_common_separator }
-bidi_block_separator, { &uc_is_property_bidi_block_separator }
-bidi_segment_separator, { &uc_is_property_bidi_segment_separator }
-bidi_whitespace, { &uc_is_property_bidi_whitespace }
-bidi_non_spacing_mark, { &uc_is_property_bidi_non_spacing_mark }
-bidi_boundary_neutral, { &uc_is_property_bidi_boundary_neutral }
-bidi_pdf, { &uc_is_property_bidi_pdf }
-bidi_embedding_or_override, { &uc_is_property_bidi_embedding_or_override }
-bidi_other_neutral, { &uc_is_property_bidi_other_neutral }
-hex_digit, { &uc_is_property_hex_digit }
-ascii_hex_digit, { &uc_is_property_ascii_hex_digit }
-ideographic, { &uc_is_property_ideographic }
-unified_ideograph, { &uc_is_property_unified_ideograph }
-radical, { &uc_is_property_radical }
-ids_binary_operator, { &uc_is_property_ids_binary_operator }
-ids_trinary_operator, { &uc_is_property_ids_trinary_operator }
-zero_width, { &uc_is_property_zero_width }
-space, { &uc_is_property_space }
-non_break, { &uc_is_property_non_break }
-iso_control, { &uc_is_property_iso_control }
-format_control, { &uc_is_property_format_control }
-dash, { &uc_is_property_dash }
-hyphen, { &uc_is_property_hyphen }
-punctuation, { &uc_is_property_punctuation }
-line_separator, { &uc_is_property_line_separator }
-paragraph_separator, { &uc_is_property_paragraph_separator }
-quotation_mark, { &uc_is_property_quotation_mark }
-sentence_terminal, { &uc_is_property_sentence_terminal }
-terminal_punctuation, { &uc_is_property_terminal_punctuation }
-currency_symbol, { &uc_is_property_currency_symbol }
-math, { &uc_is_property_math }
-other_math, { &uc_is_property_other_math }
-paired_punctuation, { &uc_is_property_paired_punctuation }
-left_of_pair, { &uc_is_property_left_of_pair }
-combining, { &uc_is_property_combining }
-composite, { &uc_is_property_composite }
-decimal_digit, { &uc_is_property_decimal_digit }
-numeric, { &uc_is_property_numeric }
-diacritic, { &uc_is_property_diacritic }
-extender, { &uc_is_property_extender }
-ignorable_control, { &uc_is_property_ignorable_control }
+white_space, UC_PROPERTY_INDEX_WHITE_SPACE
+whitespace, UC_PROPERTY_INDEX_WHITE_SPACE
+wspace, UC_PROPERTY_INDEX_WHITE_SPACE
+alphabetic, UC_PROPERTY_INDEX_ALPHABETIC
+alpha, UC_PROPERTY_INDEX_ALPHABETIC
+other_alphabetic, UC_PROPERTY_INDEX_OTHER_ALPHABETIC
+otheralphabetic, UC_PROPERTY_INDEX_OTHER_ALPHABETIC
+oalpha, UC_PROPERTY_INDEX_OTHER_ALPHABETIC
+not_a_character, UC_PROPERTY_INDEX_NOT_A_CHARACTER
+notacharacter, UC_PROPERTY_INDEX_NOT_A_CHARACTER
+default_ignorable_code_point, UC_PROPERTY_INDEX_DEFAULT_IGNORABLE_CODE_POINT
+defaultignorablecodepoint, UC_PROPERTY_INDEX_DEFAULT_IGNORABLE_CODE_POINT
+di, UC_PROPERTY_INDEX_DEFAULT_IGNORABLE_CODE_POINT
+other_default_ignorable_code_point, UC_PROPERTY_INDEX_OTHER_DEFAULT_IGNORABLE_CODE_POINT
+otherdefaultignorablecodepoint, UC_PROPERTY_INDEX_OTHER_DEFAULT_IGNORABLE_CODE_POINT
+odi, UC_PROPERTY_INDEX_OTHER_DEFAULT_IGNORABLE_CODE_POINT
+deprecated, UC_PROPERTY_INDEX_DEPRECATED
+dep, UC_PROPERTY_INDEX_DEPRECATED
+logical_order_exception, UC_PROPERTY_INDEX_LOGICAL_ORDER_EXCEPTION
+logicalorderexception, UC_PROPERTY_INDEX_LOGICAL_ORDER_EXCEPTION
+loe, UC_PROPERTY_INDEX_LOGICAL_ORDER_EXCEPTION
+variation_selector, UC_PROPERTY_INDEX_VARIATION_SELECTOR
+variationselector, UC_PROPERTY_INDEX_VARIATION_SELECTOR
+vs, UC_PROPERTY_INDEX_VARIATION_SELECTOR
+private_use, UC_PROPERTY_INDEX_PRIVATE_USE
+privateuse, UC_PROPERTY_INDEX_PRIVATE_USE
+unassigned_code_value, UC_PROPERTY_INDEX_UNASSIGNED_CODE_VALUE
+unassignedcodevalue, UC_PROPERTY_INDEX_UNASSIGNED_CODE_VALUE
+uppercase, UC_PROPERTY_INDEX_UPPERCASE
+upper, UC_PROPERTY_INDEX_UPPERCASE
+other_uppercase, UC_PROPERTY_INDEX_OTHER_UPPERCASE
+otheruppercase, UC_PROPERTY_INDEX_OTHER_UPPERCASE
+oupper, UC_PROPERTY_INDEX_OTHER_UPPERCASE
+lowercase, UC_PROPERTY_INDEX_LOWERCASE
+lower, UC_PROPERTY_INDEX_LOWERCASE
+other_lowercase, UC_PROPERTY_INDEX_OTHER_LOWERCASE
+otherlowercase, UC_PROPERTY_INDEX_OTHER_LOWERCASE
+olower, UC_PROPERTY_INDEX_OTHER_LOWERCASE
+titlecase, UC_PROPERTY_INDEX_TITLECASE
+cased, UC_PROPERTY_INDEX_CASED
+case_ignorable, UC_PROPERTY_INDEX_CASE_IGNORABLE
+caseignorable, UC_PROPERTY_INDEX_CASE_IGNORABLE
+ci, UC_PROPERTY_INDEX_CASE_IGNORABLE
+changes_when_lowercased, UC_PROPERTY_INDEX_CHANGES_WHEN_LOWERCASED
+changeswhenlowercased, UC_PROPERTY_INDEX_CHANGES_WHEN_LOWERCASED
+cwl, UC_PROPERTY_INDEX_CHANGES_WHEN_LOWERCASED
+changes_when_uppercased, UC_PROPERTY_INDEX_CHANGES_WHEN_UPPERCASED
+changeswhenuppercased, UC_PROPERTY_INDEX_CHANGES_WHEN_UPPERCASED
+cwu, UC_PROPERTY_INDEX_CHANGES_WHEN_UPPERCASED
+changes_when_titlecased, UC_PROPERTY_INDEX_CHANGES_WHEN_TITLECASED
+changeswhentitlecased, UC_PROPERTY_INDEX_CHANGES_WHEN_TITLECASED
+cwt, UC_PROPERTY_INDEX_CHANGES_WHEN_TITLECASED
+changes_when_casefolded, UC_PROPERTY_INDEX_CHANGES_WHEN_CASEFOLDED
+changeswhencasefolded, UC_PROPERTY_INDEX_CHANGES_WHEN_CASEFOLDED
+cwcf, UC_PROPERTY_INDEX_CHANGES_WHEN_CASEFOLDED
+changes_when_casemapped, UC_PROPERTY_INDEX_CHANGES_WHEN_CASEMAPPED
+changeswhencasemapped, UC_PROPERTY_INDEX_CHANGES_WHEN_CASEMAPPED
+cwcm, UC_PROPERTY_INDEX_CHANGES_WHEN_CASEMAPPED
+soft_dotted, UC_PROPERTY_INDEX_SOFT_DOTTED
+softdotted, UC_PROPERTY_INDEX_SOFT_DOTTED
+sd, UC_PROPERTY_INDEX_SOFT_DOTTED
+id_start, UC_PROPERTY_INDEX_ID_START
+idstart, UC_PROPERTY_INDEX_ID_START
+ids, UC_PROPERTY_INDEX_ID_START
+other_id_start, UC_PROPERTY_INDEX_OTHER_ID_START
+otheridstart, UC_PROPERTY_INDEX_OTHER_ID_START
+oids, UC_PROPERTY_INDEX_OTHER_ID_START
+id_continue, UC_PROPERTY_INDEX_ID_CONTINUE
+idcontinue, UC_PROPERTY_INDEX_ID_CONTINUE
+idc, UC_PROPERTY_INDEX_ID_CONTINUE
+other_id_continue, UC_PROPERTY_INDEX_OTHER_ID_CONTINUE
+otheridcontinue, UC_PROPERTY_INDEX_OTHER_ID_CONTINUE
+oidc, UC_PROPERTY_INDEX_OTHER_ID_CONTINUE
+xid_start, UC_PROPERTY_INDEX_XID_START
+xidstart, UC_PROPERTY_INDEX_XID_START
+xids, UC_PROPERTY_INDEX_XID_START
+xid_continue, UC_PROPERTY_INDEX_XID_CONTINUE
+xidcontinue, UC_PROPERTY_INDEX_XID_CONTINUE
+xidc, UC_PROPERTY_INDEX_XID_CONTINUE
+pattern_white_space, UC_PROPERTY_INDEX_PATTERN_WHITE_SPACE
+patternwhitespace, UC_PROPERTY_INDEX_PATTERN_WHITE_SPACE
+pat_ws, UC_PROPERTY_INDEX_PATTERN_WHITE_SPACE
+patws, UC_PROPERTY_INDEX_PATTERN_WHITE_SPACE
+pattern_syntax, UC_PROPERTY_INDEX_PATTERN_SYNTAX
+patternsyntax, UC_PROPERTY_INDEX_PATTERN_SYNTAX
+pat_syn, UC_PROPERTY_INDEX_PATTERN_SYNTAX
+patsyn, UC_PROPERTY_INDEX_PATTERN_SYNTAX
+join_control, UC_PROPERTY_INDEX_JOIN_CONTROL
+joincontrol, UC_PROPERTY_INDEX_JOIN_CONTROL
+join_c, UC_PROPERTY_INDEX_JOIN_CONTROL
+joinc, UC_PROPERTY_INDEX_JOIN_CONTROL
+grapheme_base, UC_PROPERTY_INDEX_GRAPHEME_BASE
+graphemebase, UC_PROPERTY_INDEX_GRAPHEME_BASE
+gr_base, UC_PROPERTY_INDEX_GRAPHEME_BASE
+grbase, UC_PROPERTY_INDEX_GRAPHEME_BASE
+grapheme_extend, UC_PROPERTY_INDEX_GRAPHEME_EXTEND
+graphemeextend, UC_PROPERTY_INDEX_GRAPHEME_EXTEND
+gr_ext, UC_PROPERTY_INDEX_GRAPHEME_EXTEND
+grext, UC_PROPERTY_INDEX_GRAPHEME_EXTEND
+other_grapheme_extend, UC_PROPERTY_INDEX_OTHER_GRAPHEME_EXTEND
+othergraphemeextend, UC_PROPERTY_INDEX_OTHER_GRAPHEME_EXTEND
+ogr_ext, UC_PROPERTY_INDEX_OTHER_GRAPHEME_EXTEND
+ogrext, UC_PROPERTY_INDEX_OTHER_GRAPHEME_EXTEND
+grapheme_link, UC_PROPERTY_INDEX_GRAPHEME_LINK
+graphemelink, UC_PROPERTY_INDEX_GRAPHEME_LINK
+gr_link, UC_PROPERTY_INDEX_GRAPHEME_LINK
+grlink, UC_PROPERTY_INDEX_GRAPHEME_LINK
+bidi_control, UC_PROPERTY_INDEX_BIDI_CONTROL
+bidicontrol, UC_PROPERTY_INDEX_BIDI_CONTROL
+bidi_c, UC_PROPERTY_INDEX_BIDI_CONTROL
+bidic, UC_PROPERTY_INDEX_BIDI_CONTROL
+bidi_left_to_right, UC_PROPERTY_INDEX_BIDI_LEFT_TO_RIGHT
+bidilefttoright, UC_PROPERTY_INDEX_BIDI_LEFT_TO_RIGHT
+bidi_hebrew_right_to_left, UC_PROPERTY_INDEX_BIDI_HEBREW_RIGHT_TO_LEFT
+bidihebrewrighttoleft, UC_PROPERTY_INDEX_BIDI_HEBREW_RIGHT_TO_LEFT
+bidi_arabic_right_to_left, UC_PROPERTY_INDEX_BIDI_ARABIC_RIGHT_TO_LEFT
+bidiarabicrighttoleft, UC_PROPERTY_INDEX_BIDI_ARABIC_RIGHT_TO_LEFT
+bidi_european_digit, UC_PROPERTY_INDEX_BIDI_EUROPEAN_DIGIT
+bidieuropeandigit, UC_PROPERTY_INDEX_BIDI_EUROPEAN_DIGIT
+bidi_eur_num_separator, UC_PROPERTY_INDEX_BIDI_EUR_NUM_SEPARATOR
+bidieurnumseparator, UC_PROPERTY_INDEX_BIDI_EUR_NUM_SEPARATOR
+bidi_eur_num_terminator, UC_PROPERTY_INDEX_BIDI_EUR_NUM_TERMINATOR
+bidieurnumterminator, UC_PROPERTY_INDEX_BIDI_EUR_NUM_TERMINATOR
+bidi_arabic_digit, UC_PROPERTY_INDEX_BIDI_ARABIC_DIGIT
+bidiarabicdigit, UC_PROPERTY_INDEX_BIDI_ARABIC_DIGIT
+bidi_common_separator, UC_PROPERTY_INDEX_BIDI_COMMON_SEPARATOR
+bidicommonseparator, UC_PROPERTY_INDEX_BIDI_COMMON_SEPARATOR
+bidi_block_separator, UC_PROPERTY_INDEX_BIDI_BLOCK_SEPARATOR
+bidiblockseparator, UC_PROPERTY_INDEX_BIDI_BLOCK_SEPARATOR
+bidi_segment_separator, UC_PROPERTY_INDEX_BIDI_SEGMENT_SEPARATOR
+bidisegmentseparator, UC_PROPERTY_INDEX_BIDI_SEGMENT_SEPARATOR
+bidi_whitespace, UC_PROPERTY_INDEX_BIDI_WHITESPACE
+bidiwhitespace, UC_PROPERTY_INDEX_BIDI_WHITESPACE
+bidi_non_spacing_mark, UC_PROPERTY_INDEX_BIDI_NON_SPACING_MARK
+bidinonspacingmark, UC_PROPERTY_INDEX_BIDI_NON_SPACING_MARK
+bidi_boundary_neutral, UC_PROPERTY_INDEX_BIDI_BOUNDARY_NEUTRAL
+bidiboundaryneutral, UC_PROPERTY_INDEX_BIDI_BOUNDARY_NEUTRAL
+bidi_pdf, UC_PROPERTY_INDEX_BIDI_PDF
+bidipdf, UC_PROPERTY_INDEX_BIDI_PDF
+bidi_embedding_or_override, UC_PROPERTY_INDEX_BIDI_EMBEDDING_OR_OVERRIDE
+bidiembeddingoroverride, UC_PROPERTY_INDEX_BIDI_EMBEDDING_OR_OVERRIDE
+bidi_other_neutral, UC_PROPERTY_INDEX_BIDI_OTHER_NEUTRAL
+bidiotherneutral, UC_PROPERTY_INDEX_BIDI_OTHER_NEUTRAL
+hex_digit, UC_PROPERTY_INDEX_HEX_DIGIT
+hexdigit, UC_PROPERTY_INDEX_HEX_DIGIT
+hex, UC_PROPERTY_INDEX_HEX_DIGIT
+ascii_hex_digit, UC_PROPERTY_INDEX_ASCII_HEX_DIGIT
+asciihexdigit, UC_PROPERTY_INDEX_ASCII_HEX_DIGIT
+ahex, UC_PROPERTY_INDEX_ASCII_HEX_DIGIT
+ideographic, UC_PROPERTY_INDEX_IDEOGRAPHIC
+ideo, UC_PROPERTY_INDEX_IDEOGRAPHIC
+unified_ideograph, UC_PROPERTY_INDEX_UNIFIED_IDEOGRAPH
+unifiedideograph, UC_PROPERTY_INDEX_UNIFIED_IDEOGRAPH
+uideo, UC_PROPERTY_INDEX_UNIFIED_IDEOGRAPH
+radical, UC_PROPERTY_INDEX_RADICAL
+ids_binary_operator, UC_PROPERTY_INDEX_IDS_BINARY_OPERATOR
+idsbinaryoperator, UC_PROPERTY_INDEX_IDS_BINARY_OPERATOR
+idsb, UC_PROPERTY_INDEX_IDS_BINARY_OPERATOR
+ids_trinary_operator, UC_PROPERTY_INDEX_IDS_TRINARY_OPERATOR
+idstrinaryoperator, UC_PROPERTY_INDEX_IDS_TRINARY_OPERATOR
+idst, UC_PROPERTY_INDEX_IDS_TRINARY_OPERATOR
+zero_width, UC_PROPERTY_INDEX_ZERO_WIDTH
+zerowidth, UC_PROPERTY_INDEX_ZERO_WIDTH
+space, UC_PROPERTY_INDEX_SPACE
+non_break, UC_PROPERTY_INDEX_NON_BREAK
+nonbreak, UC_PROPERTY_INDEX_NON_BREAK
+iso_control, UC_PROPERTY_INDEX_ISO_CONTROL
+isocontrol, UC_PROPERTY_INDEX_ISO_CONTROL
+format_control, UC_PROPERTY_INDEX_FORMAT_CONTROL
+formatcontrol, UC_PROPERTY_INDEX_FORMAT_CONTROL
+dash, UC_PROPERTY_INDEX_DASH
+hyphen, UC_PROPERTY_INDEX_HYPHEN
+punctuation, UC_PROPERTY_INDEX_PUNCTUATION
+line_separator, UC_PROPERTY_INDEX_LINE_SEPARATOR
+lineseparator, UC_PROPERTY_INDEX_LINE_SEPARATOR
+paragraph_separator, UC_PROPERTY_INDEX_PARAGRAPH_SEPARATOR
+paragraphseparator, UC_PROPERTY_INDEX_PARAGRAPH_SEPARATOR
+quotation_mark, UC_PROPERTY_INDEX_QUOTATION_MARK
+quotationmark, UC_PROPERTY_INDEX_QUOTATION_MARK
+qmark, UC_PROPERTY_INDEX_QUOTATION_MARK
+sentence_terminal, UC_PROPERTY_INDEX_SENTENCE_TERMINAL
+sentenceterminal, UC_PROPERTY_INDEX_SENTENCE_TERMINAL
+terminal_punctuation, UC_PROPERTY_INDEX_TERMINAL_PUNCTUATION
+terminalpunctuation, UC_PROPERTY_INDEX_TERMINAL_PUNCTUATION
+term, UC_PROPERTY_INDEX_TERMINAL_PUNCTUATION
+currency_symbol, UC_PROPERTY_INDEX_CURRENCY_SYMBOL
+currencysymbol, UC_PROPERTY_INDEX_CURRENCY_SYMBOL
+math, UC_PROPERTY_INDEX_MATH
+other_math, UC_PROPERTY_INDEX_OTHER_MATH
+othermath, UC_PROPERTY_INDEX_OTHER_MATH
+omath, UC_PROPERTY_INDEX_OTHER_MATH
+paired_punctuation, UC_PROPERTY_INDEX_PAIRED_PUNCTUATION
+pairedpunctuation, UC_PROPERTY_INDEX_PAIRED_PUNCTUATION
+left_of_pair, UC_PROPERTY_INDEX_LEFT_OF_PAIR
+leftofpair, UC_PROPERTY_INDEX_LEFT_OF_PAIR
+combining, UC_PROPERTY_INDEX_COMBINING
+composite, UC_PROPERTY_INDEX_COMPOSITE
+decimal_digit, UC_PROPERTY_INDEX_DECIMAL_DIGIT
+decimaldigit, UC_PROPERTY_INDEX_DECIMAL_DIGIT
+numeric, UC_PROPERTY_INDEX_NUMERIC
+diacritic, UC_PROPERTY_INDEX_DIACRITIC
+dia, UC_PROPERTY_INDEX_DIACRITIC
+extender, UC_PROPERTY_INDEX_EXTENDER
+ext, UC_PROPERTY_INDEX_EXTENDER
+ignorable_control, UC_PROPERTY_INDEX_IGNORABLE_CONTROL
+ignorablecontrol, UC_PROPERTY_INDEX_IGNORABLE_CONTROL
index c0c3002..6352fdf 100644 (file)
@@ -1,7 +1,7 @@
 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
 /* Unicode scripts.  */
 /* Generated automatically by gen-uni-tables.c for Unicode 6.0.0.  */
-struct named_script { const char *name; unsigned int index; };
+struct named_script { int name; unsigned int index; };
 %struct-type
 %language=ANSI-C
 %define hash-function-name scripts_hash
@@ -9,6 +9,8 @@ struct named_script { const char *name; unsigned int index; };
 %readonly-tables
 %global-table
 %define word-array-name script_names
+%pic
+%define string-pool-name script_stringpool
 %%
 Common, 0
 Latin, 1
index 7b14d80..677d584 100644 (file)
@@ -24,6 +24,8 @@
 #include <string.h>
 #include <sys/stat.h>
 
+#include "dosname.h"
+
 #undef unlink
 
 /* Remove file NAME.
index 9f1894a..fd1c69e 100644 (file)
@@ -26,6 +26,7 @@
 #include <string.h>
 #include <sys/stat.h>
 
+#include "dosname.h"
 #include "openat.h"
 
 #if HAVE_UNLINKAT
index 9d910de..bf3b792 100644 (file)
@@ -80,7 +80,7 @@
    POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
    isdigit unless it's important to use the locale's definition
    of `digit' even when the host does not conform to POSIX.  */
-#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
+# define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
 
 /* Return true if STR represents an unsigned decimal integer.  */
 
index 8f07308..d1eeaa5 100644 (file)
@@ -935,11 +935,11 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
         abort ();
       m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
     }
-#if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess
-         precision.  */
+#  if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess
+           precision.  */
   if (!(y == 0.0L))
     abort ();
-#endif
+#  endif
   /* Normalise.  */
   while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0)
     m.nlimbs--;
index 8cb511c..ec4ff1d 100644 (file)
 #ifndef _VERROR_H
 #define _VERROR_H 1
 
-#include "error.h"
 #include <stdarg.h>
 
+#include "error.h" /* for _GL_ATTRIBUTE_FORMAT */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -32,7 +33,7 @@ extern "C" {
 
 extern void verror (int __status, int __errnum, const char *__format,
                     va_list __args)
-     __attribute__ ((__format__ (__printf__, 3, 0)));
+     _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 0));
 
 /* Print a message with `vfprintf (stderr, FORMAT, ARGS)';
    if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
@@ -44,7 +45,7 @@ extern void verror (int __status, int __errnum, const char *__format,
 extern void verror_at_line (int __status, int __errnum, const char *__fname,
                             unsigned int __lineno, const char *__format,
                             va_list __args)
-     __attribute__ ((__format__ (__printf__, 5, 0)));
+     _GL_ATTRIBUTE_FORMAT ((__printf__, 5, 0));
 
 #ifdef __cplusplus
 }
index dc1a60c..865390c 100644 (file)
@@ -28,6 +28,8 @@ wcswidth (const wchar_t *s, size_t n)
         int width = wcwidth (c);
         if (width < 0)
           goto found_nonprinting;
+        if (width > INT_MAX - count)
+          goto overflow;
         count += width;
       }
     }
@@ -35,4 +37,7 @@ wcswidth (const wchar_t *s, size_t n)
 
  found_nonprinting:
   return -1;
+
+ overflow:
+  return INT_MAX;
 }
index 3133c84..cdedf73 100644 (file)
@@ -20,4 +20,6 @@
 /* Specification.  */
 #include <wchar.h>
 
+#include <limits.h>
+
 #include "wcswidth-impl.h"
diff --git a/lib/wctomb-impl.h b/lib/wctomb-impl.h
new file mode 100644 (file)
index 0000000..4e95de6
--- /dev/null
@@ -0,0 +1,34 @@
+/* Convert wide character to multibyte character.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This 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/>.  */
+
+int
+wctomb (char *s, wchar_t wc)
+{
+  if (s == NULL)
+    return 0;
+  else
+    {
+      mbstate_t state;
+      size_t result;
+
+      memset (&state, 0, sizeof (mbstate_t));
+      result = wcrtomb (s, wc, &state);
+      if (result == (size_t)-1)
+        return -1;
+      return result;
+    }
+}
diff --git a/lib/wctomb.c b/lib/wctomb.c
new file mode 100644 (file)
index 0000000..889a3c6
--- /dev/null
@@ -0,0 +1,25 @@
+/* Convert wide character to multibyte character.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This 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>
+
+#include <stdlib.h>
+
+#include <string.h>
+#include <wchar.h>
+
+#include "wctomb-impl.h"
index 74a8614..08c30fb 100644 (file)
@@ -52,8 +52,16 @@ xmalloc (size_t n)
 void *
 xrealloc (void *p, size_t n)
 {
+  if (!n && p)
+    {
+      /* The GNU and C99 realloc behaviors disagree here.  Act like
+         GNU, even if the underlying realloc is C99.  */
+      free (p);
+      return NULL;
+    }
+
   p = realloc (p, n);
-  if (!p && n != 0)
+  if (!p && n)
     xalloc_die ();
   return p;
 }
diff --git a/m4/afunix.m4 b/m4/afunix.m4
new file mode 100644 (file)
index 0000000..13f7583
--- /dev/null
@@ -0,0 +1,116 @@
+# afunix.m4 serial 6
+dnl Copyright (C) 2011 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_SOCKET_AFUNIX],
+[
+  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+  AC_REQUIRE([gl_SOCKET_FAMILY_UNIX])
+
+  AC_MSG_CHECKING([for UNIX domain sockets SCM_RIGHTS])
+  AC_CACHE_VAL([gl_cv_socket_unix_scm_rights],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <sys/types.h>
+            #ifdef HAVE_SYS_SOCKET_H
+            #include <sys/socket.h>
+            #endif
+            #ifdef HAVE_SYS_UN_H
+            #include <sys/un.h>
+            #endif
+            #ifdef HAVE_WINSOCK2_H
+            #include <winsock2.h>
+            #endif
+          ]],
+          [[struct cmsghdr cmh;
+            cmh.cmsg_level = SOL_SOCKET;
+            cmh.cmsg_type = SCM_RIGHTS;
+            if (&cmh) return 0;
+          ]])],
+       [gl_cv_socket_unix_scm_rights=yes],
+       [gl_cv_socket_unix_scm_rights=no])
+    ])
+  AC_MSG_RESULT([$gl_cv_socket_unix_scm_rights])
+  if test $gl_cv_socket_unix_scm_rights = yes; then
+    AC_DEFINE([HAVE_UNIXSOCKET_SCM_RIGHTS], [1],
+      [Define to 1 if <sys/socket.h> defines SCM_RIGHTS.])
+  fi
+
+  dnl Persuade AIX 5.2 <sys/socket.h> to declare CMSG_SPACE, CMSG_LEN.
+  AC_DEFINE([_LINUX_SOURCE_COMPAT], [1],
+    [Define in order to get some macros on AIX systems.])
+
+  AC_MSG_CHECKING([for UNIX domain sockets SCM_RIGHTS that behave in BSD4.4 way])
+  AC_CACHE_VAL([gl_cv_socket_unix_scm_rights_bsd44_way],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <sys/types.h>
+            #include <stddef.h>
+            #ifdef HAVE_SYS_SOCKET_H
+            #include <sys/socket.h>
+            #endif
+            #ifdef HAVE_SYS_UN_H
+            #include <sys/un.h>
+            #endif
+            #ifdef HAVE_WINSOCK2_H
+            #include <winsock2.h>
+            #endif
+            ]],
+            [[struct msghdr msg = {0};
+              struct cmsghdr *cmsg;
+              int myfds[1] = {0};
+              char buf[CMSG_SPACE (sizeof (myfds))];
+
+              msg.msg_control = buf;
+              msg.msg_controllen = sizeof buf;
+              cmsg = CMSG_FIRSTHDR (&msg);
+              cmsg->cmsg_level = SOL_SOCKET;
+              cmsg->cmsg_type = SCM_RIGHTS;
+              cmsg->cmsg_len = CMSG_LEN (sizeof (int));
+              /* fake Initialize the payload: */
+              (void) CMSG_DATA (cmsg);
+              /* Sum of the length of all control messages in the buffer: */
+              msg.msg_controllen = cmsg->cmsg_len;
+              return 0;
+            ]])],
+       [gl_cv_socket_unix_scm_rights_bsd44_way=yes],
+       [gl_cv_socket_unix_scm_rights_bsd44_way=no])
+    ])
+  AC_MSG_RESULT([$gl_cv_socket_unix_scm_rights_bsd44_way])
+  if test $gl_cv_socket_unix_scm_rights_bsd44_way = yes; then
+    AC_DEFINE([HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY], [1],
+      [Define to 1 if fd can be sent/received in the BSD4.4 way.])
+  fi
+
+  AC_MSG_CHECKING([for UNIX domain sockets SCM_RIGHTS that behave in BSD4.3 way])
+  AC_CACHE_VAL([gl_cv_socket_unix_scm_rights_bsd43_way],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <sys/types.h>
+            #ifdef HAVE_SYS_SOCKET_H
+            #include <sys/socket.h>
+            #endif
+            #ifdef HAVE_SYS_UN_H
+            #include <sys/un.h>
+            #endif
+            #ifdef HAVE_WINSOCK2_H
+            #include <winsock2.h>
+            #endif
+            ]],
+            [[struct msghdr msg;
+              int fd = 0;
+              msg.msg_accrights = &fd;
+              msg.msg_accrightslen = sizeof (fd);
+              if (&msg) return 0;
+            ]])],
+       [gl_cv_socket_unix_scm_rights_bsd43_way=yes],
+       [gl_cv_socket_unix_scm_rights_bsd43_way=no])
+    ])
+  AC_MSG_RESULT([$gl_cv_socket_unix_scm_rights_bsd43_way])
+  if test $gl_cv_socket_unix_scm_rights_bsd43_way = yes; then
+    AC_DEFINE([HAVE_UNIXSOCKET_SCM_RIGHTS_BSD43_WAY], [1],
+      [Define to 1 if fd can be sent/received in the BSD4.3 way.])
+  fi
+])
index 1dce383..ac9559e 100644 (file)
@@ -1,4 +1,4 @@
-# backupfile.m4 serial 12
+# backupfile.m4 serial 13
 dnl Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,7 +10,6 @@ AC_DEFUN([gl_BACKUPFILE],
 
   dnl Prerequisites of lib/backupfile.c.
   AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO])
-  AC_REQUIRE([gl_AC_DOS])
   AC_REQUIRE([AC_SYS_LONG_FILE_NAMES])
   AC_CHECK_FUNCS_ONCE([pathconf])
 ])
index d0b439f..9d5f40d 100644 (file)
@@ -1,4 +1,4 @@
-#serial 8   -*- autoconf -*-
+#serial 9   -*- autoconf -*-
 dnl Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -18,7 +18,6 @@ AC_DEFUN([gl_DIRNAME_LGPL],
   AC_LIBOBJ([stripslash])
 
   dnl Prerequisites of lib/dirname.h.
-  AC_REQUIRE([gl_AC_DOS])
   AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
 
   dnl No prerequisites of lib/basename-lgpl.c, lib/dirname-lgpl.c,
diff --git a/m4/dos.m4 b/m4/dos.m4
deleted file mode 100644 (file)
index ed9c4ce..0000000
--- a/m4/dos.m4
+++ /dev/null
@@ -1,71 +0,0 @@
-#serial 11   -*- autoconf -*-
-
-# Define some macros required for proper operation of code in lib/*.c
-# on MSDOS/Windows systems.
-
-# Copyright (C) 2000-2001, 2004-2006, 2009-2011 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.
-
-# From Jim Meyering.
-
-AC_DEFUN([gl_AC_DOS],
-  [
-    AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
-      [
-        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
-#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__
-neither MSDOS nor Windows
-#endif]])],
-        [ac_cv_win_or_dos=yes],
-        [ac_cv_win_or_dos=no])
-      ])
-
-    if test x"$ac_cv_win_or_dos" = xyes; then
-      ac_fs_accepts_drive_letter_prefix=1
-      ac_fs_backslash_is_file_name_separator=1
-      AC_CACHE_CHECK([whether drive letter can start relative path],
-                     [ac_cv_drive_letter_can_be_relative],
-        [
-          AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
-#if defined __CYGWIN__
-drive letters are always absolute
-#endif]])],
-          [ac_cv_drive_letter_can_be_relative=yes],
-          [ac_cv_drive_letter_can_be_relative=no])
-        ])
-      if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then
-        ac_fs_drive_letter_can_be_relative=1
-      else
-        ac_fs_drive_letter_can_be_relative=0
-      fi
-    else
-      ac_fs_accepts_drive_letter_prefix=0
-      ac_fs_backslash_is_file_name_separator=0
-      ac_fs_drive_letter_can_be_relative=0
-    fi
-
-    AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
-      $ac_fs_accepts_drive_letter_prefix,
-      [Define on systems for which file names may have a so-called
-       `drive letter' prefix, define this to compute the length of that
-       prefix, including the colon.])
-
-    AH_VERBATIM(ISSLASH,
-    [#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
-# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-#else
-# define ISSLASH(C) ((C) == '/')
-#endif])
-
-    AC_DEFINE_UNQUOTED([FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
-      $ac_fs_backslash_is_file_name_separator,
-      [Define if the backslash character may also serve as a file name
-       component separator.])
-
-    AC_DEFINE_UNQUOTED([FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE],
-      $ac_fs_drive_letter_can_be_relative,
-      [Define if a drive letter prefix denotes a relative path if it is
-       not followed by a file name component separator.])
-  ])
index 4a67260..76507d1 100644 (file)
@@ -1,4 +1,4 @@
-# fseeko.m4 serial 10
+# fseeko.m4 serial 11
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -53,3 +53,23 @@ AC_DEFUN([gl_REPLACE_FSEEKO],
   dnl If we are also using the fseek module, then fseek needs replacing, too.
   m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK])
 ])
+
+dnl Code shared by fseeko and ftello.  Determine if large files are supported,
+dnl but stdin does not start as a large file by default.
+AC_DEFUN([gl_STDIN_LARGE_OFFSET],
+  [
+    AC_CACHE_CHECK([whether stdin defaults to large file offsets],
+      [gl_cv_var_stdin_large_offset],
+      [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
+[[#if defined __SL64 && defined __SCLE /* cygwin */
+  /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
+     fseeko/ftello needlessly fail.  This bug was fixed in 1.5.25, and
+     it is easier to do a version check than building a runtime test.  */
+# include <cygwin/version.h>
+# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
+  choke me
+# endif
+#endif]])],
+        [gl_cv_var_stdin_large_offset=yes],
+        [gl_cv_var_stdin_large_offset=no])])
+])
index d25ad34..e58d29b 100644 (file)
@@ -20,90 +20,46 @@ AC_DEFUN([gl_GETLOADAVG],
 # Persuade glibc <stdlib.h> to declare getloadavg().
 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
-gl_have_func=no # yes means we've found a way to get the load average.
-
 # Make sure getloadavg.c is where it belongs, at configure-time.
 test -f "$srcdir/$1/getloadavg.c" ||
   AC_MSG_ERROR([$srcdir/$1/getloadavg.c is missing])
 
 gl_save_LIBS=$LIBS
 
-# Check for getloadavg, but be sure not to touch the cache variable.
-(AC_CHECK_FUNC([getloadavg], [exit 0], [exit 1])) && gl_have_func=yes
-
-# On HPUX9, an unprivileged user can get load averages through this function.
-AC_CHECK_FUNCS([pstat_getdynamic])
-
-# Solaris has libkstat which does not require root.
-AC_CHECK_LIB([kstat], [kstat_open])
-test $ac_cv_lib_kstat_kstat_open = yes && gl_have_func=yes
+# getloadvg is present in libc on glibc >= 2.2, MacOS X, FreeBSD >= 2.0,
+# NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7.
+AC_CHECK_FUNC([getloadavg], [],
+  [gl_have_func=no
+
+   # Some systems with -lutil have (and need) -lkvm as well, some do not.
+   # On Solaris, -lkvm requires nlist from -lelf, so check that first
+   # to get the right answer into the cache.
+   # For kstat on solaris, we need to test for libelf and libkvm to force the
+   # definition of SVR4 below.
+   if test $gl_have_func = no; then
+     AC_CHECK_LIB([elf], [elf_begin], [LIBS="-lelf $LIBS"])
+     AC_CHECK_LIB([kvm], [kvm_open], [LIBS="-lkvm $LIBS"])
+     # Check for the 4.4BSD definition of getloadavg.
+     AC_CHECK_LIB([util], [getloadavg],
+       [LIBS="-lutil $LIBS" gl_have_func=yes])
+   fi
+
+   if test $gl_have_func = no; then
+     # There is a commonly available library for RS/6000 AIX.
+     # Since it is not a standard part of AIX, it might be installed locally.
+     gl_getloadavg_LIBS=$LIBS
+     LIBS="-L/usr/local/lib $LIBS"
+     AC_CHECK_LIB([getloadavg], [getloadavg],
+                  [LIBS="-lgetloadavg $LIBS" gl_have_func=yes],
+                  [LIBS=$gl_getloadavg_LIBS])
+   fi
+
+   # Set up the replacement function if necessary.
+   if test $gl_have_func = no; then
+     AC_LIBOBJ([getloadavg])
+     gl_PREREQ_GETLOADAVG
+   fi])
 
-# AIX has libperfstat which does not require root
-AC_CHECK_LIB([perfstat], [perfstat_cpu_total])
-test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_have_func=yes
-
-# Some systems with -lutil have (and need) -lkvm as well, some do not.
-# On Solaris, -lkvm requires nlist from -lelf, so check that first
-# to get the right answer into the cache.
-# For kstat on solaris, we need to test for libelf and libkvm to force the
-# definition of SVR4 below.
-if test $gl_have_func = no; then
-  AC_CHECK_LIB([elf], [elf_begin], [LIBS="-lelf $LIBS"])
-  AC_CHECK_LIB([kvm], [kvm_open], [LIBS="-lkvm $LIBS"])
-  # Check for the 4.4BSD definition of getloadavg.
-  AC_CHECK_LIB([util], [getloadavg],
-    [LIBS="-lutil $LIBS" gl_have_func=yes gl_cv_func_getloadavg_setgid=yes])
-fi
-
-if test $gl_have_func = no; then
-  # There is a commonly available library for RS/6000 AIX.
-  # Since it is not a standard part of AIX, it might be installed locally.
-  gl_getloadavg_LIBS=$LIBS
-  LIBS="-L/usr/local/lib $LIBS"
-  AC_CHECK_LIB([getloadavg], [getloadavg],
-               [LIBS="-lgetloadavg $LIBS"], [LIBS=$gl_getloadavg_LIBS])
-fi
-
-# Make sure it is really in the library, if we think we found it,
-# otherwise set up the replacement function.
-AC_CHECK_FUNCS([getloadavg], [],
-               [gl_PREREQ_GETLOADAVG])
-
-# Some definitions of getloadavg require that the program be installed setgid.
-AC_CACHE_CHECK([whether getloadavg requires setgid],
-               gl_cv_func_getloadavg_setgid,
-[AC_EGREP_CPP([Yowza Am I SETGID yet],
-[#define CONFIGURING_GETLOADAVG
-#include "$srcdir/$1/getloadavg.c"
-#ifdef LDAV_PRIVILEGED
-Yowza Am I SETGID yet
-#endif
-],
-              gl_cv_func_getloadavg_setgid=yes,
-              gl_cv_func_getloadavg_setgid=no)])
-if test $gl_cv_func_getloadavg_setgid = yes; then
-  NEED_SETGID=true
-  AC_DEFINE([GETLOADAVG_PRIVILEGED], [1],
-            [Define to 1 if the `getloadavg' function needs to be run setuid
-             or setgid.])
-else
-  NEED_SETGID=false
-fi
-AC_SUBST([NEED_SETGID])dnl
-
-if test $gl_cv_func_getloadavg_setgid = yes; then
-  AC_CACHE_CHECK([group of /dev/kmem], [gl_cv_group_kmem],
-[ # On Solaris, /dev/kmem is a symlink.  Get info on the real file.
-  ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
-  # If we got an error (system does not support symlinks), try without -L.
-  test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
-  gl_cv_group_kmem=`echo $ac_ls_output \
-    | sed -ne ['s/[     ][      ]*/ /g
-               s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\)  *.*/\1/
-               / /s/.* //;p']`
-])
-  AC_SUBST([KMEM_GROUP], [$gl_cv_group_kmem])dnl
-fi
 if test "x$gl_save_LIBS" = x; then
   GETLOADAVG_LIBS=$LIBS
 else
@@ -133,14 +89,30 @@ AC_CHECK_DECL([getloadavg], [], [HAVE_DECL_GETLOADAVG=0],
 # --------------------
 # Set up the AC_LIBOBJ replacement of `getloadavg'.
 AC_DEFUN([gl_PREREQ_GETLOADAVG],
-[AC_LIBOBJ([getloadavg])
-AC_DEFINE([C_GETLOADAVG], [1], [Define to 1 if using `getloadavg.c'.])
+[
 # Figure out what our getloadavg.c needs.
-gl_have_func=no
-AC_CHECK_HEADER([sys/dg_sys_info.h],
-[gl_have_func=yes
- AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.])
- AC_CHECK_LIB([dgc], [dg_sys_info])])
+
+# Solaris has libkstat which does not require root.
+AC_CHECK_LIB([kstat], [kstat_open])
+test $ac_cv_lib_kstat_kstat_open = yes && gl_have_func=yes
+
+# On HPUX9, an unprivileged user can get load averages this way.
+if test $gl_have_func = no; then
+  AC_CHECK_FUNCS([pstat_getdynamic], [gl_have_func=yes])
+fi
+
+# AIX has libperfstat which does not require root
+if test $gl_have_func = no; then
+  AC_CHECK_LIB([perfstat], [perfstat_cpu_total])
+  test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_have_func=yes
+fi
+
+if test $gl_have_func = no; then
+  AC_CHECK_HEADER([sys/dg_sys_info.h],
+    [gl_have_func=yes
+     AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.])
+     AC_CHECK_LIB([dgc], [dg_sys_info])])
+fi
 
 # We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
 # uses stabs), but it is still SVR4.  We cannot check for <elf.h> because
@@ -171,10 +143,7 @@ fi
 
 AC_CHECK_HEADERS([nlist.h],
 [AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
-                  [AC_DEFINE([NLIST_NAME_UNION], [1],
-                             [Define to 1 if your `struct nlist' has an
-                              `n_un' member.  Obsolete, depend on
-                              `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [],
+                  [], [],
                   [@%:@include <nlist.h>])
  AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
                    [[struct nlist x;
index ecbf336..c4d7a20 100644 (file)
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 23
+# gnulib-common.m4 serial 24
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -109,7 +109,8 @@ AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS],
 AC_DEFUN([gl_ASSERT_NO_GNULIB_POSIXCHECK],
 [
   dnl Override gl_WARN_ON_USE_PREPARE.
-  AC_DEFUN([gl_WARN_ON_USE_PREPARE], [])
+  dnl But hide this definition from 'aclocal'.
+  AC_DEFUN([gl_W][ARN_ON_USE_PREPARE], [])
 ])
 
 # gl_ASSERT_NO_GNULIB_TESTS
index b024dd4..e7c9ba9 100644 (file)
@@ -1,4 +1,4 @@
-# lib-link.m4 serial 25 (gettext-0.18.2)
+# lib-link.m4 serial 26 (gettext-0.18.2)
 dnl Copyright (C) 2001-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -116,6 +116,8 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
 dnl Determine the platform dependent parameters needed to use rpath:
 dnl   acl_libext,
 dnl   acl_shlibext,
+dnl   acl_libname_spec,
+dnl   acl_library_names_spec,
 dnl   acl_hardcode_libdir_flag_spec,
 dnl   acl_hardcode_libdir_separator,
 dnl   acl_hardcode_direct,
index 1ac23d2..bbf7505 100644 (file)
@@ -1,4 +1,4 @@
-# locale-ar.m4 serial 2
+# locale-ar.m4 serial 3
 dnl Copyright (C) 2003, 2005-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -25,7 +25,17 @@ struct tm t;
 char buf[16];
 int main () {
   /* Check whether the given locale name is recognized by the system.  */
+#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+  /* On native Win32, setlocale(category, "") looks at the system settings,
+     not at the environment variables.  Also, when an encoding suffix such
+     as ".65001" or ".54936" is speficied, it succeeds but sets the LC_CTYPE
+     category of the locale to "C".  */
+  if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
+      || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+    return 1;
+#else
   if (setlocale (LC_ALL, "") == NULL) return 1;
+#endif
   /* Check that nl_langinfo(CODESET) is nonempty and not "ASCII" or "646"
      and ends in "6". */
 #if HAVE_LANGINFO_CODESET
@@ -47,24 +57,40 @@ int main () {
 changequote([,])dnl
       ])])
     if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
-      # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
-      # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
-      # configure script would override the LC_ALL setting. Likewise for
-      # LC_CTYPE, which is also set at the beginning of the configure script.
-      # Values tested:
-      #   - The usual locale name:                         ar_SA
-      #   - The locale name with explicit encoding suffix: ar_SA.ISO-8859-6
-      #   - The HP-UX locale name:                         ar_SA.iso88596
-      #   - The Solaris 7 locale name:                     ar
-      # Also try ar_EG instead of ar_SA because Egypt is a large country too.
-      for gt_cv_locale_ar in ar_SA ar_SA.ISO-8859-6 ar_SA.iso88596 ar_EG ar_EG.ISO-8859-6 ar_EG.iso88596 ar none; do
-        if test $gt_cv_locale_ar = none; then
-          break
-        fi
-        if (LC_ALL=$gt_cv_locale_ar LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-         break
-       fi
-      done
+      case "$host_os" in
+        # Handle native Windows specially, because there setlocale() interprets
+        # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+        # "fr" or "fra" as "French" or "French_France.1252",
+        # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+        # "ja" as "Japanese" or "Japanese_Japan.932",
+        # and similar.
+        mingw*)
+          # Note that on native Win32, the Arabic locale is
+          # "Arabic_Saudi Arabia.1256", and CP1256 is very different from
+          # ISO-8859-6, so we cannot use it here.
+          gt_cv_locale_ar=none
+          ;;
+        *)
+          # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+          # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+          # configure script would override the LC_ALL setting. Likewise for
+          # LC_CTYPE, which is also set at the beginning of the configure script.
+          # Values tested:
+          #   - The usual locale name:                         ar_SA
+          #   - The locale name with explicit encoding suffix: ar_SA.ISO-8859-6
+          #   - The HP-UX locale name:                         ar_SA.iso88596
+          #   - The Solaris 7 locale name:                     ar
+          # Also try ar_EG instead of ar_SA because Egypt is a large country too.
+          for gt_cv_locale_ar in ar_SA ar_SA.ISO-8859-6 ar_SA.iso88596 ar_EG ar_EG.ISO-8859-6 ar_EG.iso88596 ar none; do
+            if test $gt_cv_locale_ar = none; then
+              break
+            fi
+            if (LC_ALL=$gt_cv_locale_ar LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+              break
+            fi
+          done
+          ;;
+      esac
     fi
     rm -fr conftest*
   ])
index 2616f91..3f4f954 100644 (file)
@@ -1,4 +1,4 @@
-# locale-fr.m4 serial 12
+# locale-fr.m4 serial 13
 dnl Copyright (C) 2003, 2005-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -25,7 +25,17 @@ struct tm t;
 char buf[16];
 int main () {
   /* Check whether the given locale name is recognized by the system.  */
+#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+  /* On native Win32, setlocale(category, "") looks at the system settings,
+     not at the environment variables.  Also, when an encoding suffix such
+     as ".65001" or ".54936" is speficied, it succeeds but sets the LC_CTYPE
+     category of the locale to "C".  */
+  if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
+      || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+    return 1;
+#else
   if (setlocale (LC_ALL, "") == NULL) return 1;
+#endif
   /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
      On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
      is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
@@ -62,37 +72,56 @@ int main () {
 changequote([,])dnl
       ])])
     if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
-      # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
-      # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
-      # configure script would override the LC_ALL setting. Likewise for
-      # LC_CTYPE, which is also set at the beginning of the configure script.
-      # Test for the usual locale name.
-      if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-        gt_cv_locale_fr=fr_FR
-      else
-        # Test for the locale name with explicit encoding suffix.
-        if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-          gt_cv_locale_fr=fr_FR.ISO-8859-1
-        else
-          # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name.
-          if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-            gt_cv_locale_fr=fr_FR.ISO8859-1
+      case "$host_os" in
+        # Handle native Windows specially, because there setlocale() interprets
+        # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+        # "fr" or "fra" as "French" or "French_France.1252",
+        # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+        # "ja" as "Japanese" or "Japanese_Japan.932",
+        # and similar.
+        mingw*)
+          # Test for the native Win32 locale name.
+          if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_fr=French_France.1252
+          else
+            # None found.
+            gt_cv_locale_fr=none
+          fi
+          ;;
+        *)
+          # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+          # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+          # configure script would override the LC_ALL setting. Likewise for
+          # LC_CTYPE, which is also set at the beginning of the configure script.
+          # Test for the usual locale name.
+          if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_fr=fr_FR
           else
-            # Test for the HP-UX locale name.
-            if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-              gt_cv_locale_fr=fr_FR.iso88591
+            # Test for the locale name with explicit encoding suffix.
+            if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+              gt_cv_locale_fr=fr_FR.ISO-8859-1
             else
-              # Test for the Solaris 7 locale name.
-              if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-                gt_cv_locale_fr=fr
+              # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name.
+              if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                gt_cv_locale_fr=fr_FR.ISO8859-1
               else
-                # None found.
-                gt_cv_locale_fr=none
+                # Test for the HP-UX locale name.
+                if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                  gt_cv_locale_fr=fr_FR.iso88591
+                else
+                  # Test for the Solaris 7 locale name.
+                  if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                    gt_cv_locale_fr=fr
+                  else
+                    # None found.
+                    gt_cv_locale_fr=none
+                  fi
+                fi
               fi
             fi
           fi
-        fi
-      fi
+          ;;
+      esac
     fi
     rm -fr conftest*
   ])
@@ -122,7 +151,17 @@ int main () {
      variables, and all locales use the UTF-8 encoding.  */
 #if !(defined __BEOS__ || defined __HAIKU__)
   /* Check whether the given locale name is recognized by the system.  */
+# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+  /* On native Win32, setlocale(category, "") looks at the system settings,
+     not at the environment variables.  Also, when an encoding suffix such
+     as ".65001" or ".54936" is speficied, it succeeds but sets the LC_CTYPE
+     category of the locale to "C".  */
+  if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
+      || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+    return 1;
+# else
   if (setlocale (LC_ALL, "") == NULL) return 1;
+# endif
   /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
      On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
      is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
@@ -159,27 +198,46 @@ int main () {
 changequote([,])dnl
       ])])
     if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
-      # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
-      # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
-      # configure script would override the LC_ALL setting. Likewise for
-      # LC_CTYPE, which is also set at the beginning of the configure script.
-      # Test for the usual locale name.
-      if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-        gt_cv_locale_fr_utf8=fr_FR
-      else
-        # Test for the locale name with explicit encoding suffix.
-        if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-          gt_cv_locale_fr_utf8=fr_FR.UTF-8
-        else
-          # Test for the Solaris 7 locale name.
-          if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-            gt_cv_locale_fr_utf8=fr.UTF-8
+      case "$host_os" in
+        # Handle native Windows specially, because there setlocale() interprets
+        # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+        # "fr" or "fra" as "French" or "French_France.1252",
+        # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+        # "ja" as "Japanese" or "Japanese_Japan.932",
+        # and similar.
+        mingw*)
+          # Test for the hypothetical native Win32 locale name.
+          if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_fr_utf8=French_France.65001
           else
             # None found.
             gt_cv_locale_fr_utf8=none
           fi
-        fi
-      fi
+          ;;
+        *)
+          # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+          # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+          # configure script would override the LC_ALL setting. Likewise for
+          # LC_CTYPE, which is also set at the beginning of the configure script.
+          # Test for the usual locale name.
+          if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_fr_utf8=fr_FR
+          else
+            # Test for the locale name with explicit encoding suffix.
+            if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+              gt_cv_locale_fr_utf8=fr_FR.UTF-8
+            else
+              # Test for the Solaris 7 locale name.
+              if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                gt_cv_locale_fr_utf8=fr.UTF-8
+              else
+                # None found.
+                gt_cv_locale_fr_utf8=none
+              fi
+            fi
+          fi
+          ;;
+      esac
     fi
     rm -fr conftest*
   ])
index 40b4d65..d44c2c8 100644 (file)
@@ -1,4 +1,4 @@
-# locale-ja.m4 serial 8
+# locale-ja.m4 serial 9
 dnl Copyright (C) 2003, 2005-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -27,7 +27,17 @@ int main ()
 {
   const char *p;
   /* Check whether the given locale name is recognized by the system.  */
+#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+  /* On native Win32, setlocale(category, "") looks at the system settings,
+     not at the environment variables.  Also, when an encoding suffix such
+     as ".65001" or ".54936" is speficied, it succeeds but sets the LC_CTYPE
+     category of the locale to "C".  */
+  if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
+      || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+    return 1;
+#else
   if (setlocale (LC_ALL, "") == NULL) return 1;
+#endif
   /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
      On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
      is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
@@ -66,42 +76,57 @@ int main ()
 changequote([,])dnl
       ])])
     if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
-      # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
-      # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
-      # configure script would override the LC_ALL setting. Likewise for
-      # LC_CTYPE, which is also set at the beginning of the configure script.
-      # Test for the AIX locale name.
-      if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-        gt_cv_locale_ja=ja_JP
-      else
-        # Test for the locale name with explicit encoding suffix.
-        if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-          gt_cv_locale_ja=ja_JP.EUC-JP
-        else
-          # Test for the HP-UX, OSF/1, NetBSD locale name.
-          if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-            gt_cv_locale_ja=ja_JP.eucJP
+      case "$host_os" in
+        # Handle native Windows specially, because there setlocale() interprets
+        # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+        # "fr" or "fra" as "French" or "French_France.1252",
+        # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+        # "ja" as "Japanese" or "Japanese_Japan.932",
+        # and similar.
+        mingw*)
+          # Note that on native Win32, the Japanese locale is Japanese_Japan.932,
+          # and CP932 is very different from EUC-JP, so we cannot use it here.
+          gt_cv_locale_ja=none
+          ;;
+        *)
+          # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+          # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+          # configure script would override the LC_ALL setting. Likewise for
+          # LC_CTYPE, which is also set at the beginning of the configure script.
+          # Test for the AIX locale name.
+          if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_ja=ja_JP
           else
-            # Test for the IRIX, FreeBSD locale name.
-            if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-              gt_cv_locale_ja=ja_JP.EUC
+            # Test for the locale name with explicit encoding suffix.
+            if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+              gt_cv_locale_ja=ja_JP.EUC-JP
             else
-              # Test for the Solaris 7 locale name.
-              if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-                gt_cv_locale_ja=ja
+              # Test for the HP-UX, OSF/1, NetBSD locale name.
+              if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                gt_cv_locale_ja=ja_JP.eucJP
               else
-                # Special test for NetBSD 1.6.
-                if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then
-                  gt_cv_locale_ja=ja_JP.eucJP
+                # Test for the IRIX, FreeBSD locale name.
+                if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                  gt_cv_locale_ja=ja_JP.EUC
                 else
-                  # None found.
-                  gt_cv_locale_ja=none
+                  # Test for the Solaris 7 locale name.
+                  if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                    gt_cv_locale_ja=ja
+                  else
+                    # Special test for NetBSD 1.6.
+                    if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then
+                      gt_cv_locale_ja=ja_JP.eucJP
+                    else
+                      # None found.
+                      gt_cv_locale_ja=none
+                    fi
+                  fi
                 fi
               fi
             fi
           fi
-        fi
-      fi
+          ;;
+      esac
     fi
     rm -fr conftest*
   ])
index f1f71bb..19ded1b 100644 (file)
@@ -1,4 +1,4 @@
-# locale-tr.m4 serial 6
+# locale-tr.m4 serial 7
 dnl Copyright (C) 2003, 2005-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,6 +9,7 @@ dnl From Bruno Haible.
 dnl Determine the name of a turkish locale with UTF-8 encoding.
 AC_DEFUN([gt_LOCALE_TR_UTF8],
 [
+  AC_REQUIRE([AC_CANONICAL_HOST])
   AC_REQUIRE([AM_LANGINFO_CODESET])
   AC_CACHE_CHECK([for a turkish Unicode locale], [gt_cv_locale_tr_utf8], [
     AC_LANG_CONFTEST([AC_LANG_SOURCE([
@@ -29,7 +30,17 @@ int main () {
      implement the Turkish upper-/lowercase mappings.  Therefore, let this
      program return 1 on BeOS.  */
   /* Check whether the given locale name is recognized by the system.  */
+#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+  /* On native Win32, setlocale(category, "") looks at the system settings,
+     not at the environment variables.  Also, when an encoding suffix such
+     as ".65001" or ".54936" is speficied, it succeeds but sets the LC_CTYPE
+     category of the locale to "C".  */
+  if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
+      || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+    return 1;
+#else
   if (setlocale (LC_ALL, "") == NULL) return 1;
+#endif
   /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
      On MacOS X 10.3.5 (Darwin 7.5) in the tr_TR locale, nl_langinfo(CODESET)
      is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
@@ -66,27 +77,46 @@ int main () {
 changequote([,])dnl
       ])])
     if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
-      # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
-      # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
-      # configure script would override the LC_ALL setting. Likewise for
-      # LC_CTYPE, which is also set at the beginning of the configure script.
-      # Test for the usual locale name.
-      if (LC_ALL=tr_TR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-        gt_cv_locale_tr_utf8=tr_TR
-      else
-        # Test for the locale name with explicit encoding suffix.
-        if (LC_ALL=tr_TR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-          gt_cv_locale_tr_utf8=tr_TR.UTF-8
-        else
-          # Test for the Solaris 7 locale name.
-          if (LC_ALL=tr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-            gt_cv_locale_tr_utf8=tr.UTF-8
+      case "$host_os" in
+        # Handle native Windows specially, because there setlocale() interprets
+        # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+        # "fr" or "fra" as "French" or "French_France.1252",
+        # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+        # "ja" as "Japanese" or "Japanese_Japan.932",
+        # and similar.
+        mingw*)
+          # Test for the hypothetical native Win32 locale name.
+          if (LC_ALL=Turkish_Turkey.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_tr_utf8=Turkish_Turkey.65001
           else
             # None found.
             gt_cv_locale_tr_utf8=none
           fi
-        fi
-      fi
+          ;;
+        *)
+          # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+          # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+          # configure script would override the LC_ALL setting. Likewise for
+          # LC_CTYPE, which is also set at the beginning of the configure script.
+          # Test for the usual locale name.
+          if (LC_ALL=tr_TR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_tr_utf8=tr_TR
+          else
+            # Test for the locale name with explicit encoding suffix.
+            if (LC_ALL=tr_TR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+              gt_cv_locale_tr_utf8=tr_TR.UTF-8
+            else
+              # Test for the Solaris 7 locale name.
+              if (LC_ALL=tr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                gt_cv_locale_tr_utf8=tr.UTF-8
+              else
+                # None found.
+                gt_cv_locale_tr_utf8=none
+              fi
+            fi
+          fi
+          ;;
+      esac
     else
       gt_cv_locale_tr_utf8=none
     fi
index 81c2e2b..e03f91f 100644 (file)
@@ -1,4 +1,4 @@
-# locale-zh.m4 serial 7
+# locale-zh.m4 serial 8
 dnl Copyright (C) 2003, 2005-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -28,7 +28,17 @@ int main ()
 {
   const char *p;
   /* Check whether the given locale name is recognized by the system.  */
+#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+  /* On native Win32, setlocale(category, "") looks at the system settings,
+     not at the environment variables.  Also, when an encoding suffix such
+     as ".65001" or ".54936" is speficied, it succeeds but sets the LC_CTYPE
+     category of the locale to "C".  */
+  if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
+      || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+    return 1;
+#else
   if (setlocale (LC_ALL, "") == NULL) return 1;
+#endif
   /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
      On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
      is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
@@ -67,22 +77,41 @@ int main ()
 changequote([,])dnl
       ])])
     if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
-      # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
-      # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
-      # configure script would override the LC_ALL setting. Likewise for
-      # LC_CTYPE, which is also set at the beginning of the configure script.
-      # Test for the locale name without encoding suffix.
-      if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-        gt_cv_locale_zh_CN=zh_CN
-      else
-        # Test for the locale name with explicit encoding suffix.
-        if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
-          gt_cv_locale_zh_CN=zh_CN.GB18030
-        else
-          # None found.
-          gt_cv_locale_zh_CN=none
-        fi
-      fi
+      case "$host_os" in
+        # Handle native Windows specially, because there setlocale() interprets
+        # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+        # "fr" or "fra" as "French" or "French_France.1252",
+        # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+        # "ja" as "Japanese" or "Japanese_Japan.932",
+        # and similar.
+        mingw*)
+          # Test for the hypothetical native Win32 locale name.
+          if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_zh_CN=Chinese_China.54936
+          else
+            # None found.
+            gt_cv_locale_zh_CN=none
+          fi
+          ;;
+        *)
+          # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+          # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the
+          # configure script would override the LC_ALL setting. Likewise for
+          # LC_CTYPE, which is also set at the beginning of the configure script.
+          # Test for the locale name without encoding suffix.
+          if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_zh_CN=zh_CN
+          else
+            # Test for the locale name with explicit encoding suffix.
+            if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+              gt_cv_locale_zh_CN=zh_CN.GB18030
+            else
+              # None found.
+              gt_cv_locale_zh_CN=none
+            fi
+          fi
+          ;;
+      esac
     else
       # If there was a link error, due to mblen(), the system is so old that
       # it certainly doesn't have a chinese locale.
index a1a0870..4d0f894 100644 (file)
@@ -1,4 +1,4 @@
-# locale_h.m4 serial 12
+# locale_h.m4 serial 13
 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -70,7 +70,8 @@ AC_DEFUN([gl_LOCALE_H],
 #if HAVE_XLOCALE_H
 # include <xlocale.h>
 #endif
-   ]], [duplocale])
+    ]],
+    [setlocale duplocale])
 ])
 
 dnl Unconditionally enables the replacement of <locale.h>.
@@ -91,8 +92,10 @@ AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
 
 AC_DEFUN([gl_LOCALE_H_DEFAULTS],
 [
+  GNULIB_SETLOCALE=0;  AC_SUBST([GNULIB_SETLOCALE])
   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_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE])
   REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE])
 ])
index a4d95aa..aed816c 100644 (file)
@@ -1,4 +1,4 @@
-# longlong.m4 serial 14
+# longlong.m4 serial 16
 dnl Copyright (C) 1999-2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved.
 dnl From Paul Eggert.
 
 # Define HAVE_LONG_LONG_INT if 'long long int' works.
-# This fixes a bug in Autoconf 2.61, but can be removed once we
-# assume 2.62 everywhere.
+# This fixes a bug in Autoconf 2.61, and can be faster
+# than what's in Autoconf 2.62 through 2.68.
 
 # Note: If the type 'long long int' exists but is only 32 bits large
 # (as on some very old compilers), HAVE_LONG_LONG_INT will not be
@@ -16,35 +16,39 @@ dnl From Paul Eggert.
 
 AC_DEFUN([AC_TYPE_LONG_LONG_INT],
 [
+  AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
   AC_CACHE_CHECK([for long long int], [ac_cv_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])],
-       [ac_cv_type_long_long_int=no])])
+     [ac_cv_type_long_long_int=yes
+      if test "x${ac_cv_prog_cc_c99-no}" = xno; then
+        ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int
+        if test $ac_cv_type_long_long_int = yes; then
+          dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
+          dnl If cross compiling, assume the bug is not 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=no],
+            [:])
+        fi
+      fi])
   if test $ac_cv_type_long_long_int = yes; then
     AC_DEFINE([HAVE_LONG_LONG_INT], [1],
       [Define to 1 if the system has the type `long long int'.])
@@ -52,8 +56,8 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
 ])
 
 # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
-# This fixes a bug in Autoconf 2.61, but can be removed once we
-# assume 2.62 everywhere.
+# This fixes a bug in Autoconf 2.61, and can be faster
+# than what's in Autoconf 2.62 through 2.68.
 
 # Note: If the type 'unsigned long long int' exists but is only 32 bits
 # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
@@ -64,10 +68,13 @@ AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
 [
   AC_CACHE_CHECK([for unsigned long long int],
     [ac_cv_type_unsigned_long_long_int],
-    [AC_LINK_IFELSE(
-       [_AC_TYPE_LONG_LONG_SNIPPET],
-       [ac_cv_type_unsigned_long_long_int=yes],
-       [ac_cv_type_unsigned_long_long_int=no])])
+    [ac_cv_type_unsigned_long_long_int=yes
+     if test "x${ac_cv_prog_cc_c99-no}" = xno; then
+       AC_LINK_IFELSE(
+         [_AC_TYPE_LONG_LONG_SNIPPET],
+         [],
+         [ac_cv_type_unsigned_long_long_int=no])
+     fi])
   if test $ac_cv_type_unsigned_long_long_int = yes; then
     AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
       [Define to 1 if the system has the type `unsigned long long int'.])
diff --git a/m4/mbtowc.m4 b/m4/mbtowc.m4
new file mode 100644 (file)
index 0000000..9215892
--- /dev/null
@@ -0,0 +1,23 @@
+# mbtowc.m4 serial 1
+dnl Copyright (C) 2011 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_MBTOWC],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+
+  if false; then
+    REPLACE_MBTOWC=1
+  fi
+  if test $REPLACE_MBTOWC = 1; then
+    AC_LIBOBJ([mbtowc])
+    gl_PREREQ_MBTOWC
+  fi
+])
+
+# Prerequisites of lib/mbtowc.c.
+AC_DEFUN([gl_PREREQ_MBTOWC], [
+  :
+])
index f2424df..7930c07 100644 (file)
@@ -1,4 +1,4 @@
-# openmp.m4 serial 7
+# openmp.m4 serial 9
 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -35,7 +35,14 @@ m4_copy([_AC_LANG_OPENMP(C)], [_AC_LANG_OPENMP(C++)])
 # _AC_LANG_OPENMP(Fortran 77)
 # ---------------------------
 m4_define([_AC_LANG_OPENMP(Fortran 77)],
-[AC_LANG_FUNC_LINK_TRY([omp_get_num_threads])])
+[
+      program main
+      implicit none
+!$    integer tid
+      tid = 42
+      call omp_set_num_threads(2)
+      end
+])
 
 # _AC_LANG_OPENMP(Fortran)
 # ---------------------------
@@ -70,12 +77,16 @@ AC_DEFUN([AC_OPENMP],
           dnl   SGI C, PGI C         -mp
           dnl   Tru64 Compaq C       -omp
           dnl   IBM C (AIX, Linux)   -qsmp=omp
+          dnl   Cray CCE             -homp
+          dnl   NEC SX               -Popenmp
+          dnl   Lahey Fortran (Linux)  --openmp
           dnl If in this loop a compiler is passed an option that it doesn't
           dnl understand or that it misinterprets, the AC_LINK_IFELSE test
           dnl will fail (since we know that it failed without the option),
           dnl therefore the loop will continue searching for an option, and
           dnl no output file called 'penmp' or 'mp' is created.
-          for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp; do
+          for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \
+                           -Popenmp --openmp; do
             ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
             _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $ac_option"
             AC_LINK_IFELSE([_AC_LANG_OPENMP],
index c57f92d..b9f606d 100644 (file)
@@ -1,4 +1,4 @@
-# printf-posix-rpl.m4 serial 3
+# printf-posix-rpl.m4 serial 4
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_PRINTF_POSIX],
 AC_DEFUN([gl_REPLACE_PRINTF],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([gl_ASM_SYMBOL_PREFIX])
   AC_LIBOBJ([printf])
   REPLACE_PRINTF=1
   AC_DEFINE([REPLACE_PRINTF_POSIX], [1],
index 139d2fa..1c314ea 100644 (file)
@@ -1,4 +1,4 @@
-# remove.m4 serial 1
+# remove.m4 serial 2
 dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,7 +7,6 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_FUNC_REMOVE],
 [
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-  AC_REQUIRE([gl_AC_DOS])
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   AC_REQUIRE([gl_FUNC_RMDIR])
   AC_REQUIRE([gl_FUNC_UNLINK])
index 16402a5..41705a1 100644 (file)
@@ -1,4 +1,4 @@
-# rmdir.m4 serial 9
+# rmdir.m4 serial 10
 dnl Copyright (C) 2002, 2005, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,7 +6,6 @@ dnl with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([gl_FUNC_RMDIR],
 [
-  AC_REQUIRE([gl_AC_DOS])
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
   dnl Detect cygwin 1.5.x bug.
   AC_CACHE_CHECK([whether rmdir works], [gl_cv_func_rmdir_works],
diff --git a/m4/setlocale.m4 b/m4/setlocale.m4
new file mode 100644 (file)
index 0000000..6672c34
--- /dev/null
@@ -0,0 +1,27 @@
+# setlocale.m4 serial 1
+dnl Copyright (C) 2011 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_SETLOCALE],
+[
+  AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    dnl On native Windows systems, setlocale(category,NULL) does not look at
+    dnl the environment variables LC_ALL, category, and LANG.
+    mingw*) REPLACE_SETLOCALE=1 ;;
+  esac
+  if test $REPLACE_SETLOCALE = 1; then
+    gl_REPLACE_LOCALE_H
+    AC_LIBOBJ([setlocale])
+    gl_PREREQ_SETLOCALE
+  fi
+])
+
+# Prerequisites of lib/setlocale.c.
+AC_DEFUN([gl_PREREQ_SETLOCALE],
+[
+  :
+])
index 5e4c69e..4475154 100644 (file)
@@ -1,4 +1,4 @@
-# socklen.m4 serial 8
+# socklen.m4 serial 10
 dnl Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,15 +9,11 @@ dnl From Albert Chin, Windows fixes from Simon Josefsson.
 dnl Check for socklen_t: historically on BSD it is an int, and in
 dnl POSIX 1g it is a type of its own, but some platforms use different
 dnl types for the argument to getsockopt, getpeername, etc.:
-dnl HP-UX 10.20, IRIX 6.5, Interix 3.5, BeOS.
+dnl HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS.
 dnl So we have to test to find something that will work.
 
-dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
-dnl it there first.  That file is included by gnulib's sys_socket.in.h, which
-dnl all users of this module should include.  Cygwin must not include
-dnl ws2tcpip.h.
 AC_DEFUN([gl_TYPE_SOCKLEN_T],
-  [AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl
+  [AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])dnl
    AC_CHECK_TYPE([socklen_t], ,
      [AC_MSG_CHECKING([for socklen_t equivalent])
       AC_CACHE_VAL([gl_cv_socklen_t_equiv],
@@ -45,9 +41,37 @@ AC_DEFUN([gl_TYPE_SOCKLEN_T],
       AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
       AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
         [type to use in place of socklen_t if not defined])],
-     [#include <sys/types.h>
-      #if HAVE_SYS_SOCKET_H
-      # include <sys/socket.h>
-      #elif HAVE_WS2TCPIP_H
-      # include <ws2tcpip.h>
-      #endif])])
+     [gl_SOCKET_HEADERS])])
+
+dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
+dnl it there too.  But on Cygwin, wc2tcpip.h must not be included.  Users
+dnl of this module should use the same include pattern as gl_SOCKET_HEADERS.
+dnl When you change this macro, keep also in sync:
+dnl   - gl_CHECK_SOCKET_HEADERS,
+dnl   - the Include section of modules/socklen.
+AC_DEFUN([gl_SOCKET_HEADERS],
+[
+/* <sys/types.h> is not needed according to POSIX, but the
+   <sys/socket.h> in i386-unknown-freebsd4.10 and
+   powerpc-apple-darwin5.5 required it. */
+#include <sys/types.h>
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#elif HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+#endif
+])
+
+dnl Tests for the existence of the header for socket facilities.
+dnl Defines the C macros HAVE_SYS_SOCKET_H, HAVE_WS2TCPIP_H.
+dnl This macro must match gl_SOCKET_HEADERS.
+AC_DEFUN([gl_CHECK_SOCKET_HEADERS],
+  [AC_CHECK_HEADERS_ONCE([sys/socket.h])
+   if test $ac_cv_header_sys_socket_h = no; then
+     dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
+     dnl the check for those headers unconditional; yet cygwin reports
+     dnl that the headers are present but cannot be compiled (since on
+     dnl cygwin, all socket information should come from sys/socket.h).
+     AC_CHECK_HEADERS([ws2tcpip.h])
+   fi
+  ])
index 27899aa..c38daea 100644 (file)
@@ -1,4 +1,4 @@
-# sockpfaf.m4 serial 7
+# sockpfaf.m4 serial 8
 dnl Copyright (C) 2004, 2006, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -59,3 +59,29 @@ AC_DEFUN([gl_SOCKET_FAMILIES],
     AC_DEFINE([HAVE_IPV6], [1], [Define to 1 if <sys/socket.h> defines AF_INET6.])
   fi
 ])
+
+AC_DEFUN([gl_SOCKET_FAMILY_UNIX],
+[
+  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+  AC_CHECK_HEADERS_ONCE([sys/un.h])
+
+  AC_MSG_CHECKING([for UNIX domain sockets])
+  AC_CACHE_VAL([gl_cv_socket_unix],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif]],
+[[int x = AF_UNIX; struct sockaddr_un y;
+ if (&x && &y) return 0;]])],
+       gl_cv_socket_unix=yes, gl_cv_socket_unix=no)])
+  AC_MSG_RESULT([$gl_cv_socket_unix])
+  if test $gl_cv_socket_unix = yes; then
+    AC_DEFINE([HAVE_UNIXSOCKET], [1], [Define to 1 if <sys/socket.h> defines AF_UNIX.])
+  fi
+])
index 4883fe2..27f82d5 100644 (file)
@@ -1,4 +1,4 @@
-# serial 6
+# serial 7
 
 # Copyright (C) 2009-2011 Free Software Foundation, Inc.
 #
@@ -9,7 +9,6 @@
 AC_DEFUN([gl_FUNC_STAT],
 [
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-  AC_REQUIRE([gl_AC_DOS])
   AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
   AC_CHECK_FUNCS_ONCE([lstat])
   dnl mingw is the only known platform where stat(".") and stat("./") differ
index 26654c6..e7d0d07 100644 (file)
@@ -1,4 +1,4 @@
-# stdint.m4 serial 37
+# stdint.m4 serial 39
 dnl Copyright (C) 2001-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -27,6 +27,15 @@ AC_DEFUN([gl_STDINT_H],
   fi
   AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
 
+  dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does.
+  AC_CHECK_HEADERS_ONCE([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])
+
   dnl Check for <inttypes.h>.
   dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
   if test $ac_cv_header_inttypes_h = yes; then
@@ -292,10 +301,6 @@ static const char *macro_values[] =
     fi
     AC_SUBST([HAVE_SYS_BITYPES_H])
 
-    dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
-    dnl character support).
-    AC_CHECK_HEADERS_ONCE([wchar.h])
-
     gl_STDINT_TYPE_PROPERTIES
     STDINT_H=stdint.h
   fi
index b6163d6..7f3ae56 100644 (file)
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 32
+# stdio_h.m4 serial 33
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,7 +8,6 @@ AC_DEFUN([gl_STDIO_H],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   AC_REQUIRE([AC_C_INLINE])
-  AC_REQUIRE([gl_ASM_SYMBOL_PREFIX])
   gl_NEXT_HEADERS([stdio.h])
   dnl No need to create extra modules for these functions. Everyone who uses
   dnl <stdio.h> likely needs them.
@@ -139,23 +138,3 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   REPLACE_VSNPRINTF=0;           AC_SUBST([REPLACE_VSNPRINTF])
   REPLACE_VSPRINTF=0;            AC_SUBST([REPLACE_VSPRINTF])
 ])
-
-dnl Code shared by fseeko and ftello.  Determine if large files are supported,
-dnl but stdin does not start as a large file by default.
-AC_DEFUN([gl_STDIN_LARGE_OFFSET],
-  [
-    AC_CACHE_CHECK([whether stdin defaults to large file offsets],
-      [gl_cv_var_stdin_large_offset],
-      [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
-[[#if defined __SL64 && defined __SCLE /* cygwin */
-  /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
-     fseeko/ftello needlessly fail.  This bug was fixed in 1.5.25, and
-     it is easier to do a version check than building a runtime test.  */
-# include <cygwin/version.h>
-# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
-  choke me
-# endif
-#endif]])],
-        [gl_cv_var_stdin_large_offset=yes],
-        [gl_cv_var_stdin_large_offset=no])])
-])
index d28b552..25fdada 100644 (file)
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 36
+# stdlib_h.m4 serial 37
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -44,6 +44,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   GNULIB_GETSUBOPT=0;     AC_SUBST([GNULIB_GETSUBOPT])
   GNULIB_GRANTPT=0;       AC_SUBST([GNULIB_GRANTPT])
   GNULIB_MALLOC_POSIX=0;  AC_SUBST([GNULIB_MALLOC_POSIX])
+  GNULIB_MBTOWC=0;        AC_SUBST([GNULIB_MBTOWC])
   GNULIB_MKDTEMP=0;       AC_SUBST([GNULIB_MKDTEMP])
   GNULIB_MKOSTEMP=0;      AC_SUBST([GNULIB_MKOSTEMP])
   GNULIB_MKOSTEMPS=0;     AC_SUBST([GNULIB_MKOSTEMPS])
@@ -62,6 +63,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   GNULIB_SYSTEM_POSIX=0;  AC_SUBST([GNULIB_SYSTEM_POSIX])
   GNULIB_UNLOCKPT=0;      AC_SUBST([GNULIB_UNLOCKPT])
   GNULIB_UNSETENV=0;      AC_SUBST([GNULIB_UNSETENV])
+  GNULIB_WCTOMB=0;        AC_SUBST([GNULIB_WCTOMB])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE__EXIT=1;              AC_SUBST([HAVE__EXIT])
   HAVE_ATOLL=1;              AC_SUBST([HAVE_ATOLL])
@@ -91,6 +93,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   REPLACE_CALLOC=0;          AC_SUBST([REPLACE_CALLOC])
   REPLACE_CANONICALIZE_FILE_NAME=0;  AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
   REPLACE_MALLOC=0;          AC_SUBST([REPLACE_MALLOC])
+  REPLACE_MBTOWC=0;          AC_SUBST([REPLACE_MBTOWC])
   REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
   REPLACE_PUTENV=0;          AC_SUBST([REPLACE_PUTENV])
   REPLACE_REALLOC=0;         AC_SUBST([REPLACE_REALLOC])
@@ -98,4 +101,5 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   REPLACE_SETENV=0;          AC_SUBST([REPLACE_SETENV])
   REPLACE_STRTOD=0;          AC_SUBST([REPLACE_STRTOD])
   REPLACE_UNSETENV=0;        AC_SUBST([REPLACE_UNSETENV])
+  REPLACE_WCTOMB=0;          AC_SUBST([REPLACE_WCTOMB])
 ])
index 12dc05d..7da91a4 100644 (file)
@@ -1,4 +1,4 @@
-# sys_socket_h.m4 serial 21
+# sys_socket_h.m4 serial 22
 dnl Copyright (C) 2005-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -101,17 +101,13 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
 AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
 [
   dnl Check prerequisites of the <sys/socket.h> replacement.
+  AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
   gl_CHECK_NEXT_HEADERS([sys/socket.h])
   if test $ac_cv_header_sys_socket_h = yes; then
     HAVE_SYS_SOCKET_H=1
     HAVE_WS2TCPIP_H=0
   else
     HAVE_SYS_SOCKET_H=0
-    dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
-    dnl the check for those headers unconditional; yet cygwin reports
-    dnl that the headers are present but cannot be compiled (since on
-    dnl cygwin, all socket information should come from sys/socket.h).
-    AC_CHECK_HEADERS([ws2tcpip.h])
     if test $ac_cv_header_ws2tcpip_h = yes; then
       HAVE_WS2TCPIP_H=1
     else
index 6d5d3d3..a49a692 100644 (file)
@@ -1,4 +1,4 @@
-# unlink.m4 serial 6
+# unlink.m4 serial 7
 dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,7 +6,6 @@ dnl with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([gl_FUNC_UNLINK],
 [
-  AC_REQUIRE([gl_AC_DOS])
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
   AC_REQUIRE([AC_CANONICAL_HOST])
   dnl Detect FreeBSD 7.2, AIX 7.1, Solaris 9 bug.
index 8f90dac..ab9e25a 100644 (file)
@@ -1,4 +1,4 @@
-# valgrind-tests.m4 serial 1
+# valgrind-tests.m4 serial 2
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -23,7 +23,7 @@ AC_DEFUN([gl_VALGRIND_TESTS],
 
   if test -n "$VALGRIND" && $VALGRIND -q true > /dev/null 2>&1; then
     opt_valgrind_tests=yes
-    VALGRIND="$VALGRIND -q"
+    VALGRIND="$VALGRIND -q --error-exitcode=1 --leak-check=full"
   else
     opt_valgrind_tests=no
     VALGRIND=
diff --git a/m4/wctomb.m4 b/m4/wctomb.m4
new file mode 100644 (file)
index 0000000..bc21b5b
--- /dev/null
@@ -0,0 +1,23 @@
+# wctomb.m4 serial 1
+dnl Copyright (C) 2011 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_WCTOMB],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+
+  if false; then
+    REPLACE_WCTOMB=1
+  fi
+  if test $REPLACE_WCTOMB = 1; then
+    AC_LIBOBJ([wctomb])
+    gl_PREREQ_WCTOMB
+  fi
+])
+
+# Prerequisites of lib/wctomb.c.
+AC_DEFUN([gl_PREREQ_WCTOMB], [
+  :
+])
index 32e6eb8..facc605 100644 (file)
@@ -14,7 +14,7 @@ Include:
 "array-mergesort.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index fcfcce6..0258817 100644 (file)
@@ -5,7 +5,6 @@ variables.
 Files:
 lib/backupfile.h
 lib/backupfile.c
-m4/dos.m4
 m4/backupfile.m4
 
 Depends-on:
index 6b08366..10c5f3f 100644 (file)
@@ -8,6 +8,7 @@ m4/locale-fr.m4
 
 Depends-on:
 wchar
+mbtowc
 
 configure.ac:
 gl_FUNC_BTOWC
index cac7e61..66196b1 100644 (file)
@@ -8,6 +8,7 @@ m4/locale-fr.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index aec55d2..81d4220 100644 (file)
@@ -8,6 +8,7 @@ m4/locale-tr.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index 90db986..d7f2c02 100644 (file)
@@ -16,7 +16,7 @@ Include:
 "c-strcaseeq.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 757f63a..9e0dc2b 100644 (file)
@@ -22,7 +22,7 @@ Include:
 "c-strcasestr.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 38f779a..b380ff9 100644 (file)
@@ -7,9 +7,9 @@ lib/dirname-lgpl.c
 lib/basename-lgpl.c
 lib/stripslash.c
 m4/dirname.m4
-m4/dos.m4
 
 Depends-on:
+dosname
 double-slash-root
 malloc-posix
 stdbool
diff --git a/modules/dosname b/modules/dosname
new file mode 100644 (file)
index 0000000..0e8703c
--- /dev/null
@@ -0,0 +1,20 @@
+Description:
+Macros for porting to systems with DOS-style file names.
+
+Files:
+lib/dosname.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+
+Include:
+"dosname.h"
+
+License:
+LGPLv2+
+
+Maintainer:
+Eric Blake, Paul Eggert, Jim Meyering
index df90c2f..6a10f62 100644 (file)
@@ -6,7 +6,6 @@ lib/filenamecat.c
 m4/filenamecat.m4
 
 Depends-on:
-dirname-lgpl
 filenamecat-lgpl
 xalloc
 
index 99c7097..0cf160c 100644 (file)
@@ -4,6 +4,7 @@ ftello() function: Retrieve the position of a FILE stream.
 Files:
 lib/ftello.c
 lib/stdio-impl.h
+m4/fseeko.m4
 m4/ftello.m4
 
 Depends-on:
index fcbce4f..9db688b 100644 (file)
@@ -20,6 +20,9 @@ Makefile.am:
 Include:
 <stdlib.h>
 
+Link:
+$(GETLOADAVG_LIBS)
+
 License:
 GPL
 
diff --git a/modules/getloadavg-tests b/modules/getloadavg-tests
new file mode 100644 (file)
index 0000000..c653ae9
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/test-getloadavg.c
+tests/signature.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-getloadavg
+check_PROGRAMS += test-getloadavg
+test_getloadavg_LDADD = $(LDADD) @GETLOADAVG_LIBS@
index 54bbe42..92b37dd 100644 (file)
@@ -17,7 +17,7 @@ Include:
 <getopt.h>
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 all, glibc
index c6a1b80..3b00b62 100644 (file)
@@ -6,7 +6,6 @@ lib/inet_ntop.c
 m4/inet_ntop.m4
 
 Depends-on:
-socklen
 sys_socket
 arpa_inet
 errno
index 271d778..44c50b8 100644 (file)
@@ -7,7 +7,6 @@ m4/inet_pton.m4
 
 Depends-on:
 c-ctype
-socklen
 sys_socket
 arpa_inet
 errno
index a30249c..fc8984d 100644 (file)
@@ -1,6 +1,10 @@
 Description:
 Control of symbols exported by shared libraries.
 
+Notice:
+The value of $(CFLAG_VISIBILITY) needs to be added to the CFLAGS for the
+compilation of all sources that make up the library.
+
 Files:
 m4/visibility.m4
 
index b80b513..9c350cf 100644 (file)
@@ -28,9 +28,11 @@ locale.h: locale.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \
+             -e 's|@''GNULIB_SETLOCALE''@|$(GNULIB_SETLOCALE)|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_SETLOCALE''@|$(REPLACE_SETLOCALE)|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)' \
index e4eabb5..e53ac7e 100644 (file)
@@ -6,6 +6,7 @@ lib/lstat.c
 m4/lstat.m4
 
 Depends-on:
+dosname
 stat
 sys_stat
 
index 05d6c7f..e863f6d 100644 (file)
@@ -11,6 +11,7 @@ m4/codeset.m4
 
 Depends-on:
 stdbool
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index 9820097..941b646 100644 (file)
@@ -13,6 +13,7 @@ mbrtowc
 wcrtomb
 memcmp2
 memcoll
+wchar
 
 configure.ac:
 
index e2cc524..8c834d7 100644 (file)
@@ -11,6 +11,7 @@ m4/codeset.m4
 
 Depends-on:
 stdbool
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index d9c0d18..bbd2213 100644 (file)
@@ -4,6 +4,12 @@ tests/test-mbrtowc2.sh
 tests/test-mbrtowc3.sh
 tests/test-mbrtowc4.sh
 tests/test-mbrtowc.c
+tests/test-mbrtowc-w32-1.sh
+tests/test-mbrtowc-w32-2.sh
+tests/test-mbrtowc-w32-3.sh
+tests/test-mbrtowc-w32-4.sh
+tests/test-mbrtowc-w32-5.sh
+tests/test-mbrtowc-w32.c
 tests/signature.h
 tests/macros.h
 m4/locale-fr.m4
@@ -14,6 +20,7 @@ m4/codeset.m4
 Depends-on:
 mbsinit
 wctob
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
@@ -22,11 +29,14 @@ gt_LOCALE_JA
 gt_LOCALE_ZH_CN
 
 Makefile.am:
-TESTS += test-mbrtowc1.sh test-mbrtowc2.sh test-mbrtowc3.sh test-mbrtowc4.sh
+TESTS += \
+  test-mbrtowc1.sh test-mbrtowc2.sh test-mbrtowc3.sh test-mbrtowc4.sh \
+  test-mbrtowc-w32-1.sh test-mbrtowc-w32-2.sh test-mbrtowc-w32-3.sh \
+  test-mbrtowc-w32-4.sh test-mbrtowc-w32-5.sh
 TESTS_ENVIRONMENT += \
   LOCALE_FR='@LOCALE_FR@' \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
-check_PROGRAMS += test-mbrtowc
+check_PROGRAMS += test-mbrtowc test-mbrtowc-w32
 
index 9e89bfe..460e998 100644 (file)
@@ -6,6 +6,7 @@ m4/locale-tr.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_TR_UTF8
index 30f0919..15d5c97 100644 (file)
@@ -13,6 +13,7 @@ m4/locale-zh.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_FR_UTF8
index a26d8dd..773eb00 100644 (file)
@@ -6,6 +6,7 @@ m4/locale-zh.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_ZH_CN
index f31e347..3052a3b 100644 (file)
@@ -6,6 +6,7 @@ m4/locale-fr.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_FR_UTF8
index 3a8a7a0..5225c36 100644 (file)
@@ -8,6 +8,7 @@ m4/codeset.m4
 
 Depends-on:
 mbrtowc
+setlocale
 
 configure.ac:
 gt_LOCALE_FR_UTF8
index 81b8ba9..1844904 100644 (file)
@@ -6,6 +6,7 @@ m4/locale-tr.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_TR_UTF8
index 1d43beb..1a53405 100644 (file)
@@ -15,6 +15,7 @@ Depends-on:
 mbrtowc
 mbsinit
 wctob
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index d22cf19..77a305a 100644 (file)
@@ -6,6 +6,7 @@ m4/locale-fr.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_FR_UTF8
index 0b1c7d3..5f38e22 100644 (file)
@@ -6,6 +6,7 @@ m4/locale-tr.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_TR_UTF8
index 70d7c20..d848037 100644 (file)
@@ -6,6 +6,7 @@ m4/locale-zh.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_ZH_CN
index 4b05e52..74dcd63 100644 (file)
@@ -15,6 +15,7 @@ Depends-on:
 mbrtowc
 mbsinit
 wctob
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index ace5c76..ed7e47a 100644 (file)
@@ -6,6 +6,7 @@ m4/locale-fr.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_FR_UTF8
index 21a8590..01e605d 100644 (file)
@@ -10,6 +10,7 @@ m4/locale-zh.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_FR_UTF8
diff --git a/modules/mbtowc b/modules/mbtowc
new file mode 100644 (file)
index 0000000..f41d508
--- /dev/null
@@ -0,0 +1,27 @@
+Description:
+mbtowc() function: convert multibyte character to wide character.
+
+Files:
+lib/mbtowc.c
+lib/mbtowc-impl.h
+m4/mbtowc.m4
+
+Depends-on:
+stdlib
+mbrtowc
+wchar
+
+configure.ac:
+gl_FUNC_MBTOWC
+gl_STDLIB_MODULE_INDICATOR([mbtowc])
+
+Makefile.am:
+
+Include:
+<stdlib.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
index ea7dc63..9b95a6e 100644 (file)
@@ -10,7 +10,6 @@ include_next
 arg-nonnull
 warn-on-use
 sys_socket
-socklen
 
 configure.ac:
 gl_HEADER_NETDB
index dcb0af9..2d3fda0 100644 (file)
@@ -7,6 +7,7 @@ m4/locale-fr.m4
 
 Depends-on:
 c-strcase
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
diff --git a/modules/nonblocking b/modules/nonblocking
new file mode 100644 (file)
index 0000000..9528405
--- /dev/null
@@ -0,0 +1,26 @@
+Description:
+Read, set or clear the non-blocking file descriptor flag.
+
+Files:
+lib/nonblocking.c
+lib/nonblocking.h
+
+Depends-on:
+fcntl-h
+ioctl
+stdbool
+sys_socket
+
+configure.ac:
+
+Makefile.am:
+lib_SOURCES += nonblocking.c
+
+Include:
+"nonblocking.h"
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible, Eric Blake
diff --git a/modules/nonblocking-tests b/modules/nonblocking-tests
new file mode 100644 (file)
index 0000000..34d206d
--- /dev/null
@@ -0,0 +1,15 @@
+Files:
+tests/test-nonblocking.c
+tests/macros.h
+
+Depends-on:
+close
+pipe-posix
+socket
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-nonblocking
+check_PROGRAMS += test-nonblocking
+test_nonblocking_LDADD = $(LDADD) @LIBSOCKET@
index 37cae80..35917c5 100644 (file)
@@ -16,7 +16,7 @@ m4/openat.m4
 m4/mode_t.m4
 
 Depends-on:
-dirname-lgpl
+dosname
 errno
 extensions
 fchdir
index 2e8f3d1..e36c917 100644 (file)
@@ -6,7 +6,6 @@ lib/parse-duration.h
 lib/parse-duration.c
 
 Depends-on:
-xalloc
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
diff --git a/modules/passfd b/modules/passfd
new file mode 100644 (file)
index 0000000..74ef410
--- /dev/null
@@ -0,0 +1,32 @@
+Description:
+Pass file descriptors along Unix domain sockets
+
+Files:
+lib/passfd.h
+lib/passfd.c
+m4/afunix.m4
+m4/sockpfaf.m4
+
+Depends-on:
+cloexec
+sys_socket
+socketlib
+extensions
+
+configure.ac:
+gl_SOCKET_AFUNIX
+
+Makefile.am:
+lib_SOURCES += passfd.c
+
+Include:
+"passfd.h"
+
+Link:
+$(LIBSOCKET)
+
+License:
+LGPLv2+
+
+Maintainer:
+Bastien ROUCARIÈS
diff --git a/modules/passfd-tests b/modules/passfd-tests
new file mode 100644 (file)
index 0000000..477754b
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-passfd.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+AC_CHECK_DECLS_ONCE([alarm])
+
+Makefile.am:
+TESTS += test-passfd
+check_PROGRAMS += test-passfd
+test_passfd_LDADD = $(LDADD) @LIBSOCKET@
index b9884f4..0597ef9 100644 (file)
@@ -11,6 +11,7 @@ Files:
 lib/printf.c
 m4/printf-posix-rpl.m4
 m4/printf.m4
+m4/asm-underscore.m4
 
 Depends-on:
 stdio
index 5b71ef9..3c37428 100644 (file)
@@ -17,6 +17,7 @@ progname
 stdint
 setenv
 unsetenv
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index 2ca57b0..0f008cf 100644 (file)
@@ -6,6 +6,7 @@ lib/regex-quote.h
 lib/regex-quote.c
 
 Depends-on:
+stdbool
 xalloc
 mbuiter
 
index 63e06e0..886a039 100644 (file)
@@ -3,7 +3,6 @@ remove() function: remove a file or directory
 
 Files:
 lib/remove.c
-m4/dos.m4
 m4/remove.m4
 
 Depends-on:
index d047e4c..eaa5a68 100644 (file)
@@ -3,10 +3,10 @@ rmdir() function: delete a directory.
 
 Files:
 lib/rmdir.c
-m4/dos.m4
 m4/rmdir.m4
 
 Depends-on:
+dosname
 sys_stat
 unistd
 
index 41f51e3..1f32372 100644 (file)
@@ -7,7 +7,7 @@ lib/savewd.c
 m4/savewd.m4
 
 Depends-on:
-dirname-lgpl
+dosname
 errno
 exit
 fchdir
diff --git a/modules/setlocale b/modules/setlocale
new file mode 100644 (file)
index 0000000..5d3e58b
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+setlocale() function: set the current locale.
+
+Files:
+lib/setlocale.c
+m4/setlocale.m4
+
+Depends-on:
+locale
+localename
+
+configure.ac:
+gl_FUNC_SETLOCALE
+gl_LOCALE_MODULE_INDICATOR([setlocale])
+
+Makefile.am:
+
+Include:
+<locale.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/setlocale-tests b/modules/setlocale-tests
new file mode 100644 (file)
index 0000000..8c35c9d
--- /dev/null
@@ -0,0 +1,29 @@
+Files:
+tests/test-setlocale1.sh
+tests/test-setlocale1.c
+tests/test-setlocale2.sh
+tests/test-setlocale2.c
+tests/signature.h
+tests/macros.h
+m4/locale-fr.m4
+m4/locale-ja.m4
+m4/locale-zh.m4
+m4/codeset.m4
+
+Depends-on:
+strdup
+
+configure.ac:
+gt_LOCALE_FR
+gt_LOCALE_FR_UTF8
+gt_LOCALE_JA
+gt_LOCALE_ZH_CN
+
+Makefile.am:
+TESTS += test-setlocale1.sh test-setlocale2.sh
+TESTS_ENVIRONMENT += \
+  LOCALE_FR='@LOCALE_FR@' \
+  LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
+  LOCALE_JA='@LOCALE_JA@' \
+  LOCALE_ZH_CN='@LOCALE_ZH_CN@'
+check_PROGRAMS += test-setlocale1 test-setlocale2
index 99e3e9e..4f03c9e 100644 (file)
@@ -8,8 +8,11 @@ have side effects on the compilation of the main modules in lib/.
 
 Files:
 m4/sigpipe.m4
+lib/stdio-write.c
+m4/asm-underscore.m4
 
 Depends-on:
+raise
 signal
 sigprocmask
 stdio
@@ -24,6 +27,7 @@ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
 GNULIB_SIGNAL_H_SIGPIPE=1
 dnl Define the substituted variable GNULIB_STDIO_H_SIGPIPE to 1.
 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+AC_REQUIRE([gl_ASM_SYMBOL_PREFIX])
 GNULIB_STDIO_H_SIGPIPE=1
 dnl Define the substituted variable GNULIB_UNISTD_H_SIGPIPE to 1.
 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
index 4986f10..556336b 100644 (file)
@@ -5,7 +5,6 @@ Files:
 m4/socklen.m4
 
 Depends-on:
-sys_socket
 
 configure.ac:
 gl_TYPE_SOCKLEN_T
@@ -13,8 +12,12 @@ gl_TYPE_SOCKLEN_T
 Makefile.am:
 
 Include:
-<sys/types.h>
-<sys/socket.h>
+#include <sys/types.h>
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#elif HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+#endif
 
 License:
 unlimited
index 1ad5e90..744aa7a 100644 (file)
@@ -3,10 +3,10 @@ stat() function: query file information
 
 Files:
 lib/stat.c
-m4/dos.m4
 m4/stat.m4
 
 Depends-on:
+dosname
 stdbool
 sys_stat
 
index 9e5f7ad..45b02d4 100644 (file)
@@ -14,7 +14,6 @@ m4/longlong.m4
 Depends-on:
 include_next
 multiarch
-wchar
 
 configure.ac:
 gl_STDINT_H
@@ -36,6 +35,7 @@ stdint.h: stdint.in.h
              -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
              -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
              -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
+             -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
              -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
              -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
              -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
index 1a45909..2e6c726 100644 (file)
@@ -3,15 +3,12 @@ A GNU-like <stdio.h>.
 
 Files:
 lib/stdio.in.h
-lib/stdio-write.c
 m4/stdio_h.m4
-m4/asm-underscore.m4
 
 Depends-on:
 include_next
 arg-nonnull
 c++defs
-raise
 stddef
 warn-on-use
 
index 7d7e769..d666be7 100644 (file)
@@ -36,6 +36,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -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_MBTOWC''@|$(GNULIB_MBTOWC)|g' \
              -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
              -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \
              -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \
@@ -54,6 +55,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \
              -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \
              -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
+             -e 's|@''GNULIB_WCTOMB''@|$(GNULIB_WCTOMB)|g' \
              < $(srcdir)/stdlib.in.h | \
          sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
              -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
@@ -82,6 +84,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
              -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
              -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
+             -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
              -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
              -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
@@ -89,6 +92,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
              -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
              -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
+             -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|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)'; \
diff --git a/modules/strftime-tests b/modules/strftime-tests
new file mode 100644 (file)
index 0000000..96ad213
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/test-strftime.c
+tests/macros.h
+
+Depends-on:
+strftime
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-strftime
+check_PROGRAMS += test-strftime
index 8bdfb34..acfd963 100644 (file)
@@ -39,7 +39,7 @@ Link:
 $(LTLIBICONV) when linking with libtool, $(LIBICONV) otherwise
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 4867b8c..856514e 100644 (file)
@@ -22,7 +22,7 @@ Include:
 "striconveha.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 0b4d147..87f3eaf 100644 (file)
@@ -9,6 +9,7 @@ m4/locale-zh.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index 8056723..0d78fbe 100644 (file)
@@ -9,6 +9,7 @@ m4/codeset.m4
 
 Depends-on:
 uninorm/nfd
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index 4b263ea..bd2e59b 100644 (file)
@@ -9,6 +9,7 @@ m4/codeset.m4
 
 Depends-on:
 uninorm/nfc
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index 0c48c5a..c4046eb 100644 (file)
@@ -29,7 +29,7 @@ Include:
 "uniconv.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 5532150..659665e 100644 (file)
@@ -23,7 +23,7 @@ Include:
 "uniconv.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index c27b989..95227b5 100644 (file)
@@ -22,7 +22,7 @@ Include:
 "uniconv.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index e2a1f9d..e1dbb74 100644 (file)
@@ -21,7 +21,7 @@ Include:
 "uniconv.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index a491289..96390a6 100644 (file)
@@ -27,7 +27,7 @@ Include:
 "unictype.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 9e7aaa7..480f74e 100644 (file)
@@ -1,14 +1,16 @@
 Description:
-Complete API for Unicode character bidi categories.
+Unicode character bidi category functions.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete. Use the module 'unictype/bidiclass-all' instead.
 
 Files:
 
 Depends-on:
-unictype/base
-unictype/bidicategory-byname
-unictype/bidicategory-name
-unictype/bidicategory-of
-unictype/bidicategory-test
+unictype/bidiclass-all
 
 configure.ac:
 
@@ -22,4 +24,3 @@ LGPL
 
 Maintainer:
 Bruno Haible
-
index 8303b2b..0bff75d 100644 (file)
@@ -1,19 +1,20 @@
 Description:
 Find a Unicode character bidi category, given its name.
 
+Status:
+obsolete
+
+Notice:
+This module is obsolete. Use the module 'unictype/bidiclass-byname' instead.
+
 Files:
-lib/unictype/bidi_byname.c
 
 Depends-on:
-unictype/base
+unictype/bidiclass-byname
 
 configure.ac:
-gl_LIBUNISTRING_MODULE([0.9], [unictype/bidicategory-byname])
 
 Makefile.am:
-if LIBUNISTRING_COMPILE_UNICTYPE_BIDICATEGORY_BYNAME
-lib_SOURCES += unictype/bidi_byname.c
-endif
 
 Include:
 "unictype.h"
@@ -23,4 +24,3 @@ LGPL
 
 Maintainer:
 Bruno Haible
-
diff --git a/modules/unictype/bidicategory-byname-tests b/modules/unictype/bidicategory-byname-tests
deleted file mode 100644 (file)
index dd0f536..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-Files:
-tests/unictype/test-bidi_byname.c
-tests/macros.h
-
-Depends-on:
-
-configure.ac:
-
-Makefile.am:
-TESTS += test-bidi_byname
-check_PROGRAMS += test-bidi_byname
-test_bidi_byname_SOURCES = unictype/test-bidi_byname.c
-test_bidi_byname_LDADD = $(LDADD) $(LIBUNISTRING)
index 7e4a6a0..2f90ca7 100644 (file)
@@ -1,19 +1,20 @@
 Description:
 Name of Unicode character bidi category.
 
+Status:
+obsolete
+
+Notice:
+This module is obsolete. Use the module 'unictype/bidiclass-name' instead.
+
 Files:
-lib/unictype/bidi_name.c
 
 Depends-on:
-unictype/base
+unictype/bidiclass-name
 
 configure.ac:
-gl_LIBUNISTRING_MODULE([0.9], [unictype/bidicategory-name])
 
 Makefile.am:
-if LIBUNISTRING_COMPILE_UNICTYPE_BIDICATEGORY_NAME
-lib_SOURCES += unictype/bidi_name.c
-endif
 
 Include:
 "unictype.h"
@@ -23,4 +24,3 @@ LGPL
 
 Maintainer:
 Bruno Haible
-
diff --git a/modules/unictype/bidicategory-name-tests b/modules/unictype/bidicategory-name-tests
deleted file mode 100644 (file)
index 7f19888..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-Files:
-tests/unictype/test-bidi_name.c
-tests/macros.h
-
-Depends-on:
-
-configure.ac:
-
-Makefile.am:
-TESTS += test-bidi_name
-check_PROGRAMS += test-bidi_name
-test_bidi_name_SOURCES = unictype/test-bidi_name.c
-test_bidi_name_LDADD = $(LDADD) $(LIBUNISTRING)
index 98c0d5a..f1d2b48 100644 (file)
@@ -1,20 +1,20 @@
 Description:
 Determine bidi category of a Unicode character.
 
+Status:
+obsolete
+
+Notice:
+This module is obsolete. Use the module 'unictype/bidiclass-of' instead.
+
 Files:
-lib/unictype/bidi_of.c
-lib/unictype/bidi_of.h
 
 Depends-on:
-unictype/base
+unictype/bidiclass-of
 
 configure.ac:
-gl_LIBUNISTRING_MODULE([0.9.4], [unictype/bidicategory-of])
 
 Makefile.am:
-if LIBUNISTRING_COMPILE_UNICTYPE_BIDICATEGORY_OF
-lib_SOURCES += unictype/bidi_of.c
-endif
 
 Include:
 "unictype.h"
@@ -24,4 +24,3 @@ LGPL
 
 Maintainer:
 Bruno Haible
-
diff --git a/modules/unictype/bidicategory-of-tests b/modules/unictype/bidicategory-of-tests
deleted file mode 100644 (file)
index 2fbb2b4..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-Files:
-tests/unictype/test-bidi_of.c
-tests/macros.h
-
-Depends-on:
-
-configure.ac:
-
-Makefile.am:
-TESTS += test-bidi_of
-check_PROGRAMS += test-bidi_of
-test_bidi_of_SOURCES = unictype/test-bidi_of.c
-test_bidi_of_LDADD = $(LDADD) $(LIBUNISTRING)
index 9b0ab93..ee8c94b 100644 (file)
@@ -1,20 +1,20 @@
 Description:
 Test whether a Unicode character belongs to a given bidi category.
 
+Status:
+obsolete
+
+Notice:
+This module is obsolete. Use the module 'unictype/bidiclass-test' instead.
+
 Files:
-lib/unictype/bidi_test.c
 
 Depends-on:
-unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-test
 
 configure.ac:
-gl_LIBUNISTRING_MODULE([0.9.4], [unictype/bidicategory-test])
 
 Makefile.am:
-if LIBUNISTRING_COMPILE_UNICTYPE_BIDICATEGORY_TEST
-lib_SOURCES += unictype/bidi_test.c
-endif
 
 Include:
 "unictype.h"
@@ -24,4 +24,3 @@ LGPL
 
 Maintainer:
 Bruno Haible
-
diff --git a/modules/unictype/bidicategory-test-tests b/modules/unictype/bidicategory-test-tests
deleted file mode 100644 (file)
index c22db70..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-Files:
-tests/unictype/test-bidi_test.c
-tests/macros.h
-
-Depends-on:
-unictype/bidicategory-of
-
-configure.ac:
-
-Makefile.am:
-TESTS += test-bidi_test
-check_PROGRAMS += test-bidi_test
-test_bidi_test_SOURCES = unictype/test-bidi_test.c
-test_bidi_test_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unictype/bidiclass-all b/modules/unictype/bidiclass-all
new file mode 100644 (file)
index 0000000..500d843
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+Complete API for Unicode character bidi categories.
+
+Files:
+
+Depends-on:
+unictype/base
+unictype/bidiclass-byname
+unictype/bidiclass-longname
+unictype/bidiclass-name
+unictype/bidiclass-of
+unictype/bidiclass-test
+
+configure.ac:
+
+Makefile.am:
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/bidiclass-byname b/modules/unictype/bidiclass-byname
new file mode 100644 (file)
index 0000000..e0a06e7
--- /dev/null
@@ -0,0 +1,35 @@
+Description:
+Find a Unicode character bidi class, given its name.
+
+Files:
+lib/unictype/bidi_byname.c
+lib/unictype/bidi_byname.gperf
+
+Depends-on:
+unictype/base
+gperf
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/bidiclass-byname])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_BIDICLASS_BYNAME
+lib_SOURCES += unictype/bidi_byname.c
+endif
+
+unictype/bidi_byname.h: unictype/bidi_byname.gperf
+       $(GPERF) -m 10 $(srcdir)/unictype/bidi_byname.gperf > $(srcdir)/unictype/bidi_byname.h-t
+       mv $(srcdir)/unictype/bidi_byname.h-t $(srcdir)/unictype/bidi_byname.h
+BUILT_SOURCES        += unictype/bidi_byname.h
+MOSTLYCLEANFILES     += unictype/bidi_byname.h-t
+MAINTAINERCLEANFILES += unictype/bidi_byname.h
+EXTRA_DIST           += unictype/bidi_byname.h
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/bidiclass-byname-tests b/modules/unictype/bidiclass-byname-tests
new file mode 100644 (file)
index 0000000..dd0f536
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unictype/test-bidi_byname.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-bidi_byname
+check_PROGRAMS += test-bidi_byname
+test_bidi_byname_SOURCES = unictype/test-bidi_byname.c
+test_bidi_byname_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unictype/bidiclass-longname b/modules/unictype/bidiclass-longname
new file mode 100644 (file)
index 0000000..b2c9333
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+Name of Unicode character bidi class.
+
+Files:
+lib/unictype/bidi_longname.c
+
+Depends-on:
+unictype/base
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/bidiclass-longname])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_BIDICLASS_LONGNAME
+lib_SOURCES += unictype/bidi_longname.c
+endif
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/bidiclass-longname-tests b/modules/unictype/bidiclass-longname-tests
new file mode 100644 (file)
index 0000000..433fc89
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unictype/test-bidi_longname.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-bidi_longname
+check_PROGRAMS += test-bidi_longname
+test_bidi_longname_SOURCES = unictype/test-bidi_longname.c
+test_bidi_longname_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unictype/bidiclass-name b/modules/unictype/bidiclass-name
new file mode 100644 (file)
index 0000000..3616a13
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+Name of Unicode character bidi class.
+
+Files:
+lib/unictype/bidi_name.c
+
+Depends-on:
+unictype/base
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/bidiclass-name])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_BIDICLASS_NAME
+lib_SOURCES += unictype/bidi_name.c
+endif
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/bidiclass-name-tests b/modules/unictype/bidiclass-name-tests
new file mode 100644 (file)
index 0000000..7f19888
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unictype/test-bidi_name.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-bidi_name
+check_PROGRAMS += test-bidi_name
+test_bidi_name_SOURCES = unictype/test-bidi_name.c
+test_bidi_name_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unictype/bidiclass-of b/modules/unictype/bidiclass-of
new file mode 100644 (file)
index 0000000..33ca78c
--- /dev/null
@@ -0,0 +1,26 @@
+Description:
+Determine bidi class of a Unicode character.
+
+Files:
+lib/unictype/bidi_of.c
+lib/unictype/bidi_of.h
+
+Depends-on:
+unictype/base
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/bidiclass-of])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_BIDICLASS_OF
+lib_SOURCES += unictype/bidi_of.c
+endif
+
+Include:
+"unictype.h"
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/bidiclass-of-tests b/modules/unictype/bidiclass-of-tests
new file mode 100644 (file)
index 0000000..2fbb2b4
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unictype/test-bidi_of.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-bidi_of
+check_PROGRAMS += test-bidi_of
+test_bidi_of_SOURCES = unictype/test-bidi_of.c
+test_bidi_of_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unictype/bidiclass-test b/modules/unictype/bidiclass-test
new file mode 100644 (file)
index 0000000..1a03529
--- /dev/null
@@ -0,0 +1,26 @@
+Description:
+Test whether a Unicode character belongs to a given bidi class.
+
+Files:
+lib/unictype/bidi_test.c
+
+Depends-on:
+unictype/base
+unictype/bidiclass-of
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/bidiclass-test])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_BIDICLASS_TEST
+lib_SOURCES += unictype/bidi_test.c
+endif
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/bidiclass-test-tests b/modules/unictype/bidiclass-test-tests
new file mode 100644 (file)
index 0000000..dc73cb2
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/unictype/test-bidi_test.c
+tests/macros.h
+
+Depends-on:
+unictype/bidiclass-of
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-bidi_test
+check_PROGRAMS += test-bidi_test
+test_bidi_test_SOURCES = unictype/test-bidi_test.c
+test_bidi_test_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unictype/category-LC b/modules/unictype/category-LC
new file mode 100644 (file)
index 0000000..42ca0be
--- /dev/null
@@ -0,0 +1,26 @@
+Description:
+Test whether a Unicode character is of general category LC.
+
+Files:
+lib/unictype/categ_LC.c
+lib/unictype/categ_LC.h
+
+Depends-on:
+unictype/base
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/category-LC])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_CATEGORY_LC
+lib_SOURCES += unictype/categ_LC.c
+endif
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/category-LC-tests b/modules/unictype/category-LC-tests
new file mode 100644 (file)
index 0000000..71d15bd
--- /dev/null
@@ -0,0 +1,16 @@
+Files:
+tests/unictype/test-categ_LC.c
+tests/unictype/test-predicate-part1.h
+tests/unictype/test-predicate-part2.h
+tests/macros.h
+
+Depends-on:
+unictype/category-test
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-categ_LC
+check_PROGRAMS += test-categ_LC
+test_categ_LC_SOURCES = unictype/test-categ_LC.c
+test_categ_LC_LDADD = $(LDADD) $(LIBUNISTRING)
index d778472..ab28030 100644 (file)
@@ -20,7 +20,7 @@ Include:
 "unictype.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index c1b1448..2a5cbac 100644 (file)
@@ -11,6 +11,7 @@ unictype/category-Cn
 unictype/category-Co
 unictype/category-Cs
 unictype/category-L
+unictype/category-LC
 unictype/category-Ll
 unictype/category-Lm
 unictype/category-Lo
@@ -44,6 +45,7 @@ unictype/category-Zs
 unictype/category-and
 unictype/category-and-not
 unictype/category-byname
+unictype/category-longname
 unictype/category-name
 unictype/category-of
 unictype/category-or
index fe9fd2d..b9538fc 100644 (file)
@@ -3,6 +3,7 @@ Find a Unicode character category, given its name.
 
 Files:
 lib/unictype/categ_byname.c
+lib/unictype/categ_byname.gperf
 
 Depends-on:
 unictype/base
@@ -13,6 +14,7 @@ unictype/category-Cn
 unictype/category-Co
 unictype/category-Cs
 unictype/category-L
+unictype/category-LC
 unictype/category-Ll
 unictype/category-Lm
 unictype/category-Lo
@@ -44,6 +46,7 @@ unictype/category-Zl
 unictype/category-Zp
 unictype/category-Zs
 unictype/category-none
+gperf
 
 configure.ac:
 gl_LIBUNISTRING_MODULE([0.9.4], [unictype/category-byname])
@@ -53,6 +56,14 @@ if LIBUNISTRING_COMPILE_UNICTYPE_CATEGORY_BYNAME
 lib_SOURCES += unictype/categ_byname.c
 endif
 
+unictype/categ_byname.h: unictype/categ_byname.gperf
+       $(GPERF) -m 10 $(srcdir)/unictype/categ_byname.gperf > $(srcdir)/unictype/categ_byname.h-t
+       mv $(srcdir)/unictype/categ_byname.h-t $(srcdir)/unictype/categ_byname.h
+BUILT_SOURCES        += unictype/categ_byname.h
+MOSTLYCLEANFILES     += unictype/categ_byname.h-t
+MAINTAINERCLEANFILES += unictype/categ_byname.h
+EXTRA_DIST           += unictype/categ_byname.h
+
 Include:
 "unictype.h"
 
diff --git a/modules/unictype/category-longname b/modules/unictype/category-longname
new file mode 100644 (file)
index 0000000..76db6d9
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+Name of Unicode character category.
+
+Files:
+lib/unictype/categ_longname.c
+
+Depends-on:
+unictype/base
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/category-longname])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_CATEGORY_LONGNAME
+lib_SOURCES += unictype/categ_longname.c
+endif
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/category-longname-tests b/modules/unictype/category-longname-tests
new file mode 100644 (file)
index 0000000..196460a
--- /dev/null
@@ -0,0 +1,16 @@
+Files:
+tests/unictype/test-categ_longname.c
+tests/macros.h
+
+Depends-on:
+unictype/category-or
+unictype/category-Z
+unictype/category-Nl
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-categ_longname
+check_PROGRAMS += test-categ_longname
+test_categ_longname_SOURCES = unictype/test-categ_longname.c
+test_categ_longname_LDADD = $(LDADD) $(LIBUNISTRING)
index 9e1626f..fc23d92 100644 (file)
@@ -19,7 +19,7 @@ Include:
 "unictype.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 9d4d373..62389b6 100644 (file)
@@ -22,7 +22,7 @@ Include:
 "unictype.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 9991fc3..f826871 100644 (file)
@@ -21,7 +21,7 @@ Include:
 "unictype.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 73b7a33..cfe9f16 100644 (file)
@@ -15,7 +15,7 @@ Include:
 "unictype.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 9e115e6..e88c4ae 100644 (file)
@@ -1,9 +1,9 @@
 Description:
-Determine combining class of a Unicode character.
+Determine canonical combining class of a Unicode character.
 
 Files:
-lib/unictype/combining.c
-lib/unictype/combining.h
+lib/unictype/combiningclass.c
+lib/unictype/combiningclass.h
 
 Depends-on:
 unictype/base
@@ -13,14 +13,14 @@ gl_LIBUNISTRING_MODULE([0.9.4], [unictype/combining-class])
 
 Makefile.am:
 if LIBUNISTRING_COMPILE_UNICTYPE_COMBINING_CLASS
-lib_SOURCES += unictype/combining.c
+lib_SOURCES += unictype/combiningclass.c
 endif
 
 Include:
 "unictype.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
diff --git a/modules/unictype/combining-class-all b/modules/unictype/combining-class-all
new file mode 100644 (file)
index 0000000..9b001ec
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+Complete API for Unicode character canonical combining classes.
+
+Files:
+
+Depends-on:
+unictype/base
+unictype/combining-class
+unictype/combining-class-byname
+unictype/combining-class-longname
+unictype/combining-class-name
+
+configure.ac:
+
+Makefile.am:
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/combining-class-byname b/modules/unictype/combining-class-byname
new file mode 100644 (file)
index 0000000..a0524b8
--- /dev/null
@@ -0,0 +1,35 @@
+Description:
+Find a Unicode character canonical combining class, given its name.
+
+Files:
+lib/unictype/combiningclass_byname.c
+lib/unictype/combiningclass_byname.gperf
+
+Depends-on:
+unictype/base
+gperf
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/combining-class-byname])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_COMBINING_CLASS_BYNAME
+lib_SOURCES += unictype/combiningclass_byname.c
+endif
+
+unictype/combiningclass_byname.h: unictype/combiningclass_byname.gperf
+       $(GPERF) -m 10 $(srcdir)/unictype/combiningclass_byname.gperf > $(srcdir)/unictype/combiningclass_byname.h-t
+       mv $(srcdir)/unictype/combiningclass_byname.h-t $(srcdir)/unictype/combiningclass_byname.h
+BUILT_SOURCES        += unictype/combiningclass_byname.h
+MOSTLYCLEANFILES     += unictype/combiningclass_byname.h-t
+MAINTAINERCLEANFILES += unictype/combiningclass_byname.h
+EXTRA_DIST           += unictype/combiningclass_byname.h
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/combining-class-byname-tests b/modules/unictype/combining-class-byname-tests
new file mode 100644 (file)
index 0000000..9b3c9d1
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unictype/test-combiningclass_byname.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-combiningclass_byname
+check_PROGRAMS += test-combiningclass_byname
+test_combiningclass_byname_SOURCES = unictype/test-combiningclass_byname.c
+test_combiningclass_byname_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unictype/combining-class-longname b/modules/unictype/combining-class-longname
new file mode 100644 (file)
index 0000000..5f76eba
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+Name of Unicode character canonical combining class.
+
+Files:
+lib/unictype/combiningclass_longname.c
+
+Depends-on:
+unictype/base
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/combining-class-longname])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_COMBINING_CLASS_LONGNAME
+lib_SOURCES += unictype/combiningclass_longname.c
+endif
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/combining-class-longname-tests b/modules/unictype/combining-class-longname-tests
new file mode 100644 (file)
index 0000000..8e75b68
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unictype/test-combiningclass_longname.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-combiningclass_longname
+check_PROGRAMS += test-combiningclass_longname
+test_combiningclass_longname_SOURCES = unictype/test-combiningclass_longname.c
+test_combiningclass_longname_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unictype/combining-class-name b/modules/unictype/combining-class-name
new file mode 100644 (file)
index 0000000..1553875
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+Name of Unicode character canonical combining class.
+
+Files:
+lib/unictype/combiningclass_name.c
+
+Depends-on:
+unictype/base
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/combining-class-name])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_COMBINING_CLASS_NAME
+lib_SOURCES += unictype/combiningclass_name.c
+endif
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/combining-class-name-tests b/modules/unictype/combining-class-name-tests
new file mode 100644 (file)
index 0000000..4e3c866
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unictype/test-combiningclass_name.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-combiningclass_name
+check_PROGRAMS += test-combiningclass_name
+test_combiningclass_name_SOURCES = unictype/test-combiningclass_name.c
+test_combiningclass_name_LDADD = $(LDADD) $(LIBUNISTRING)
index a801436..438ef3f 100644 (file)
@@ -1,5 +1,5 @@
 Files:
-tests/unictype/test-combining.c
+tests/unictype/test-combiningclass.c
 tests/macros.h
 
 Depends-on:
@@ -7,7 +7,7 @@ Depends-on:
 configure.ac:
 
 Makefile.am:
-TESTS += test-combining
-check_PROGRAMS += test-combining
-test_combining_SOURCES = unictype/test-combining.c
-test_combining_LDADD = $(LDADD) $(LIBUNISTRING)
+TESTS += test-combiningclass
+check_PROGRAMS += test-combiningclass
+test_combiningclass_SOURCES = unictype/test-combiningclass.c
+test_combiningclass_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unictype/joininggroup-all b/modules/unictype/joininggroup-all
new file mode 100644 (file)
index 0000000..2c75394
--- /dev/null
@@ -0,0 +1,23 @@
+Description:
+Complete API for Unicode character Arabic joining groups.
+
+Files:
+
+Depends-on:
+unictype/base
+unictype/joininggroup-byname
+unictype/joininggroup-name
+unictype/joininggroup-of
+
+configure.ac:
+
+Makefile.am:
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/joininggroup-byname b/modules/unictype/joininggroup-byname
new file mode 100644 (file)
index 0000000..7aff01e
--- /dev/null
@@ -0,0 +1,35 @@
+Description:
+Find a Unicode character Arabic joining group, given its name.
+
+Files:
+lib/unictype/joininggroup_byname.c
+lib/unictype/joininggroup_byname.gperf
+
+Depends-on:
+unictype/base
+gperf
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/joininggroup-byname])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_JOININGGROUP_BYNAME
+lib_SOURCES += unictype/joininggroup_byname.c
+endif
+
+unictype/joininggroup_byname.h: unictype/joininggroup_byname.gperf
+       $(GPERF) -m 10 $(srcdir)/unictype/joininggroup_byname.gperf > $(srcdir)/unictype/joininggroup_byname.h-t
+       mv $(srcdir)/unictype/joininggroup_byname.h-t $(srcdir)/unictype/joininggroup_byname.h
+BUILT_SOURCES        += unictype/joininggroup_byname.h
+MOSTLYCLEANFILES     += unictype/joininggroup_byname.h-t
+MAINTAINERCLEANFILES += unictype/joininggroup_byname.h
+EXTRA_DIST           += unictype/joininggroup_byname.h
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/joininggroup-byname-tests b/modules/unictype/joininggroup-byname-tests
new file mode 100644 (file)
index 0000000..550b110
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unictype/test-joininggroup_byname.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-joininggroup_byname
+check_PROGRAMS += test-joininggroup_byname
+test_joininggroup_byname_SOURCES = unictype/test-joininggroup_byname.c
+test_joininggroup_byname_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unictype/joininggroup-name b/modules/unictype/joininggroup-name
new file mode 100644 (file)
index 0000000..8df11fb
--- /dev/null
@@ -0,0 +1,26 @@
+Description:
+Name of Unicode character Arabic joining group.
+
+Files:
+lib/unictype/joininggroup_name.c
+lib/unictype/joininggroup_name.h
+
+Depends-on:
+unictype/base
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/joininggroup-name])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_JOININGGROUP_NAME
+lib_SOURCES += unictype/joininggroup_name.c
+endif
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/joininggroup-name-tests b/modules/unictype/joininggroup-name-tests
new file mode 100644 (file)
index 0000000..93419e6
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unictype/test-joininggroup_name.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-joininggroup_name
+check_PROGRAMS += test-joininggroup_name
+test_joininggroup_name_SOURCES = unictype/test-joininggroup_name.c
+test_joininggroup_name_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unictype/joininggroup-of b/modules/unictype/joininggroup-of
new file mode 100644 (file)
index 0000000..94a3e38
--- /dev/null
@@ -0,0 +1,26 @@
+Description:
+Determine Arabic joining group of a Unicode character.
+
+Files:
+lib/unictype/joininggroup_of.c
+lib/unictype/joininggroup_of.h
+
+Depends-on:
+unictype/base
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/joininggroup-of])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_JOININGGROUP_OF
+lib_SOURCES += unictype/joininggroup_of.c
+endif
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/joininggroup-of-tests b/modules/unictype/joininggroup-of-tests
new file mode 100644 (file)
index 0000000..f2a601f
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/unictype/test-joininggroup_of.c
+tests/unictype/test-joininggroup_of.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-joininggroup_of
+check_PROGRAMS += test-joininggroup_of
+test_joininggroup_of_SOURCES = unictype/test-joininggroup_of.c
+test_joininggroup_of_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unictype/joiningtype-all b/modules/unictype/joiningtype-all
new file mode 100644 (file)
index 0000000..c895d5e
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+Complete API for Unicode character Arabic joining types.
+
+Files:
+
+Depends-on:
+unictype/base
+unictype/joiningtype-byname
+unictype/joiningtype-longname
+unictype/joiningtype-name
+unictype/joiningtype-of
+
+configure.ac:
+
+Makefile.am:
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/joiningtype-byname b/modules/unictype/joiningtype-byname
new file mode 100644 (file)
index 0000000..cff0f91
--- /dev/null
@@ -0,0 +1,35 @@
+Description:
+Find a Unicode character Arabic joining type, given its name.
+
+Files:
+lib/unictype/joiningtype_byname.c
+lib/unictype/joiningtype_byname.gperf
+
+Depends-on:
+unictype/base
+gperf
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/joiningtype-byname])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_JOININGTYPE_BYNAME
+lib_SOURCES += unictype/joiningtype_byname.c
+endif
+
+unictype/joiningtype_byname.h: unictype/joiningtype_byname.gperf
+       $(GPERF) -m 10 $(srcdir)/unictype/joiningtype_byname.gperf > $(srcdir)/unictype/joiningtype_byname.h-t
+       mv $(srcdir)/unictype/joiningtype_byname.h-t $(srcdir)/unictype/joiningtype_byname.h
+BUILT_SOURCES        += unictype/joiningtype_byname.h
+MOSTLYCLEANFILES     += unictype/joiningtype_byname.h-t
+MAINTAINERCLEANFILES += unictype/joiningtype_byname.h
+EXTRA_DIST           += unictype/joiningtype_byname.h
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/joiningtype-byname-tests b/modules/unictype/joiningtype-byname-tests
new file mode 100644 (file)
index 0000000..5163f04
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unictype/test-joiningtype_byname.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-joiningtype_byname
+check_PROGRAMS += test-joiningtype_byname
+test_joiningtype_byname_SOURCES = unictype/test-joiningtype_byname.c
+test_joiningtype_byname_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unictype/joiningtype-longname b/modules/unictype/joiningtype-longname
new file mode 100644 (file)
index 0000000..b218e8f
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+Name of Unicode character Arabic joining type.
+
+Files:
+lib/unictype/joiningtype_longname.c
+
+Depends-on:
+unictype/base
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/joiningtype-longname])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_JOININGTYPE_LONGNAME
+lib_SOURCES += unictype/joiningtype_longname.c
+endif
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/joiningtype-longname-tests b/modules/unictype/joiningtype-longname-tests
new file mode 100644 (file)
index 0000000..6270f6a
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unictype/test-joiningtype_longname.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-joiningtype_longname
+check_PROGRAMS += test-joiningtype_longname
+test_joiningtype_longname_SOURCES = unictype/test-joiningtype_longname.c
+test_joiningtype_longname_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unictype/joiningtype-name b/modules/unictype/joiningtype-name
new file mode 100644 (file)
index 0000000..87b3d07
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+Name of Unicode character Arabic joining type.
+
+Files:
+lib/unictype/joiningtype_name.c
+
+Depends-on:
+unictype/base
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/joiningtype-name])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_JOININGTYPE_NAME
+lib_SOURCES += unictype/joiningtype_name.c
+endif
+
+Include:
+"unictype.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/joiningtype-name-tests b/modules/unictype/joiningtype-name-tests
new file mode 100644 (file)
index 0000000..d46e8ae
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unictype/test-joiningtype_name.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-joiningtype_name
+check_PROGRAMS += test-joiningtype_name
+test_joiningtype_name_SOURCES = unictype/test-joiningtype_name.c
+test_joiningtype_name_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unictype/joiningtype-of b/modules/unictype/joiningtype-of
new file mode 100644 (file)
index 0000000..44a802f
--- /dev/null
@@ -0,0 +1,27 @@
+Description:
+Determine Arabic joining type of a Unicode character.
+
+Files:
+lib/unictype/joiningtype_of.c
+lib/unictype/joiningtype_of.h
+
+Depends-on:
+unictype/base
+unictype/category-test-withtable
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([0.9.4], [unictype/joiningtype-of])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNICTYPE_JOININGTYPE_OF
+lib_SOURCES += unictype/joiningtype_of.c
+endif
+
+Include:
+"unictype.h"
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
diff --git a/modules/unictype/joiningtype-of-tests b/modules/unictype/joiningtype-of-tests
new file mode 100644 (file)
index 0000000..300e583
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/unictype/test-joiningtype_of.c
+tests/unictype/test-joiningtype_of.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-joiningtype_of
+check_PROGRAMS += test-joiningtype_of
+test_joiningtype_of_SOURCES = unictype/test-joiningtype_of.c
+test_joiningtype_of_LDADD = $(LDADD) $(LIBUNISTRING)
index 02ec773..3eaa4eb 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index f2980b5..ef82b1f 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index 6d38c64..979dc81 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index 0d91962..71817dc 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index 70d9415..1ff104b 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index 5887904..ee04616 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index ccfad53..4605ecd 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index 7f26262..442ac71 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index 647a405..fd2f4fb 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index 4be10cc..eeb618a 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index f34119b..566abd5 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index 37a1b77..2671901 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index fab7b26..aad1fd5 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index 639add0..81bb3e7 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index 158523f..bd0f3c0 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index 511c30c..7f959e4 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index 910acc3..e21b33b 100644 (file)
@@ -8,7 +8,7 @@ lib/unictype/bitmap.h
 
 Depends-on:
 unictype/base
-unictype/bidicategory-of
+unictype/bidiclass-of
 
 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
index 3280242..7c4b03b 100644 (file)
@@ -30,7 +30,7 @@ Include:
 "unictype.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 60cd513..187e26f 100644 (file)
@@ -6,6 +6,7 @@ m4/locale-ar.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_AR
index aef10f5..a9a106b 100644 (file)
@@ -26,7 +26,7 @@ Include:
 "uninorm.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 9acd2bc..0c493d5 100644 (file)
@@ -20,7 +20,7 @@ Include:
 "uninorm.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 34b7cc7..285ef9d 100644 (file)
@@ -29,7 +29,7 @@ Include:
 "uninorm.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 575de10..640ac2f 100644 (file)
@@ -18,7 +18,7 @@ Include:
 "uninorm/decompose-internal.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 7aa21b7..3a2fda9 100644 (file)
@@ -20,7 +20,7 @@ Include:
 "uninorm/decomposition-table.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 32033b7..6c4d25e 100644 (file)
@@ -23,7 +23,7 @@ Include:
 "uninorm.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index a2904ab..cb3d946 100644 (file)
@@ -21,7 +21,7 @@ Include:
 "uninorm.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index e8f0e54..90dee6b 100644 (file)
@@ -27,7 +27,7 @@ Include:
 "uninorm.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index eb15f13..a115d2b 100644 (file)
@@ -13,6 +13,7 @@ m4/inttypes_h.m4
 
 Depends-on:
 unitypes
+wchar
 
 configure.ac:
 gl_PREREQ_PRINTF_ARGS
index cf8a929..3dc3cb0 100644 (file)
@@ -15,6 +15,7 @@ unistr/u16-cmp
 unistr/u16-cpy
 unistr/u16-strcmp
 unistr/u16-strlen
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index 1e9b1e5..555319b 100644 (file)
@@ -15,6 +15,7 @@ unistr/u32-cmp
 unistr/u32-cpy
 unistr/u32-strcmp
 unistr/u32-strlen
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index 4a29e09..8d5e295 100644 (file)
@@ -15,6 +15,7 @@ unistr/u8-cmp
 unistr/u8-cpy
 unistr/u8-strcmp
 unistr/u8-strlen
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index d2fae61..20e2f71 100644 (file)
@@ -11,6 +11,7 @@ m4/locale-fr.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index 41739ff..b76031e 100644 (file)
@@ -29,7 +29,7 @@ Include:
 "unistr.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 1b2c1bc..02e086e 100644 (file)
@@ -20,7 +20,7 @@ Include:
 "unistr.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 062f575..e684603 100644 (file)
@@ -20,7 +20,7 @@ Include:
 "unistr.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 4c8deb4..7db1d33 100644 (file)
@@ -20,7 +20,7 @@ Include:
 "unistr.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 86e7c35..eafff11 100644 (file)
@@ -20,7 +20,7 @@ Include:
 "unistr.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index dd6ce61..a0b4598 100644 (file)
@@ -19,7 +19,7 @@ Include:
 "unistr.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index e770c80..f1f279f 100644 (file)
@@ -19,7 +19,7 @@ Include:
 "unistr.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 7b5d6e5..27e5020 100644 (file)
@@ -21,7 +21,7 @@ Include:
 "unistr.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 268ab2f..fcf3949 100644 (file)
@@ -21,7 +21,7 @@ Include:
 "unistr.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index ebfb7ab..4718fa5 100644 (file)
@@ -20,7 +20,7 @@ Include:
 "unistr.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 6b8839a..eca53c1 100644 (file)
@@ -19,7 +19,7 @@ Include:
 "unistr.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index c48b26c..e206ba1 100644 (file)
@@ -19,7 +19,7 @@ Include:
 "unistr.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index d4d7911..cbbd9a2 100644 (file)
@@ -20,7 +20,7 @@ Include:
 "unistr.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 018be5b..03cb98f 100644 (file)
@@ -21,7 +21,7 @@ Include:
 "unistr.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 7cd1a19..96cbf7c 100644 (file)
@@ -26,7 +26,7 @@ Include:
 "unitypes.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 82d9ced..19f1ee6 100644 (file)
@@ -6,6 +6,7 @@ m4/locale-fr.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index 4c8c649..a27a308 100644 (file)
@@ -3,10 +3,10 @@ unlink() function: remove a file.
 
 Files:
 lib/unlink.c
-m4/dos.m4
 m4/unlink.m4
 
 Depends-on:
+dosname
 lstat
 unistd
 
index 6d266a1..35f5f3a 100644 (file)
@@ -27,6 +27,7 @@ xsize
 errno
 memchr
 verify
+wchar
 
 configure.ac:
 gl_FUNC_VASNPRINTF
index 5a4800d..01f0188 100644 (file)
@@ -12,6 +12,7 @@ m4/codeset.m4
 Depends-on:
 stdint
 float
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index abedd77..32f9d3a 100644 (file)
@@ -1,6 +1,12 @@
 Files:
 tests/test-wcrtomb.sh
 tests/test-wcrtomb.c
+tests/test-wcrtomb-w32-1.sh
+tests/test-wcrtomb-w32-2.sh
+tests/test-wcrtomb-w32-3.sh
+tests/test-wcrtomb-w32-4.sh
+tests/test-wcrtomb-w32-5.sh
+tests/test-wcrtomb-w32.c
 tests/signature.h
 tests/macros.h
 m4/locale-fr.m4
@@ -10,6 +16,7 @@ m4/codeset.m4
 
 Depends-on:
 btowc
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
@@ -18,11 +25,14 @@ gt_LOCALE_JA
 gt_LOCALE_ZH_CN
 
 Makefile.am:
-TESTS += test-wcrtomb.sh
+TESTS += \
+  test-wcrtomb.sh \
+  test-wcrtomb-w32-1.sh test-wcrtomb-w32-2.sh test-wcrtomb-w32-3.sh \
+  test-wcrtomb-w32-4.sh test-wcrtomb-w32-5.sh
 TESTS_ENVIRONMENT += \
   LOCALE_FR='@LOCALE_FR@' \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
-check_PROGRAMS += test-wcrtomb
+check_PROGRAMS += test-wcrtomb test-wcrtomb-w32
 
index 1745272..877dd17 100644 (file)
@@ -12,6 +12,7 @@ m4/locale-zh.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index 41ec997..4b6bf54 100644 (file)
@@ -12,6 +12,7 @@ m4/locale-zh.m4
 m4/codeset.m4
 
 Depends-on:
+setlocale
 
 configure.ac:
 gt_LOCALE_FR
index 500ce6c..eba2ebf 100644 (file)
@@ -9,6 +9,7 @@ m4/codeset.m4
 
 Depends-on:
 wchar
+wctomb
 
 configure.ac:
 gl_FUNC_WCTOB
diff --git a/modules/wctomb b/modules/wctomb
new file mode 100644 (file)
index 0000000..81d41c4
--- /dev/null
@@ -0,0 +1,27 @@
+Description:
+wctomb() function: convert wide character to multibyte character.
+
+Files:
+lib/wctomb.c
+lib/wctomb-impl.h
+m4/wctomb.m4
+
+Depends-on:
+stdlib
+wcrtomb
+wchar
+
+configure.ac:
+gl_FUNC_WCTOMB
+gl_STDLIB_MODULE_INDICATOR([wctomb])
+
+Makefile.am:
+
+Include:
+<stdlib.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
index 81e431f..5bb29f0 100755 (executable)
@@ -26,6 +26,8 @@ func_usage ()
   echo "\
 Usage: posix-modules
 
+Lists the gnulib modules that implement POSIX interfaces.
+
 Report bugs to <bug-gnulib@gnu.org>."
 }
 
index c7d8324..55b41c0 100644 (file)
@@ -36,7 +36,7 @@ test_areadlink (char * (*func) (char const *, size_t), bool print)
   ASSERT (errno == ENOENT);
   errno = 0;
   ASSERT (func ("", 1) == NULL);
-  ASSERT (errno == ENOENT);
+  ASSERT (errno == ENOENT || errno == EINVAL);
   errno = 0;
   ASSERT (func (".", 1) == NULL);
   ASSERT (errno == EINVAL);
index 7392f57..fa25a7c 100644 (file)
@@ -29,6 +29,7 @@
 /* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in <config.h>, and
    thus must link with a definition of that function.  Provide it here.  */
 #ifdef ARGMATCH_DIE_DECL
+
 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
 #  define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
 # else
@@ -37,6 +38,7 @@
 
 ARGMATCH_DIE_DECL _GL_ATTRIBUTE_NORETURN;
 ARGMATCH_DIE_DECL { exit (1); }
+
 #endif
 
 enum backup_type
index 8a9fc31..7d0d635 100644 (file)
@@ -149,5 +149,93 @@ main ()
     free (haystack);
   }
 
+  {
+    /* Ensure that with a barely periodic "short" needle, c_strcasestr's
+       search does not mistakenly skip just past the match point.
+       This use of c_strcasestr would mistakenly return NULL before
+       gnulib v0.0-4927.  */
+    const char *haystack =
+      "\n"
+      "with_build_libsubdir\n"
+      "with_local_prefix\n"
+      "with_gxx_include_dir\n"
+      "with_cpp_install_dir\n"
+      "enable_generated_files_in_srcdir\n"
+      "with_gnu_ld\n"
+      "with_ld\n"
+      "with_demangler_in_ld\n"
+      "with_gnu_as\n"
+      "with_as\n"
+      "enable_largefile\n"
+      "enable_werror_always\n"
+      "enable_checking\n"
+      "enable_coverage\n"
+      "enable_gather_detailed_mem_stats\n"
+      "enable_build_with_cxx\n"
+      "with_stabs\n"
+      "enable_multilib\n"
+      "enable___cxa_atexit\n"
+      "enable_decimal_float\n"
+      "enable_fixed_point\n"
+      "enable_threads\n"
+      "enable_tls\n"
+      "enable_objc_gc\n"
+      "with_dwarf2\n"
+      "enable_shared\n"
+      "with_build_sysroot\n"
+      "with_sysroot\n"
+      "with_specs\n"
+      "with_pkgversion\n"
+      "with_bugurl\n"
+      "enable_languages\n"
+      "with_multilib_list\n";
+    const char *needle = "\n"
+      "with_GNU_ld\n";
+    const char* p = c_strcasestr (haystack, needle);
+    ASSERT (p - haystack == 114);
+  }
+
+  {
+    /* Same bug, shorter trigger.  */
+    const char *haystack = "..wi.D.";
+    const char *needle = ".d.";
+    const char* p = c_strcasestr (haystack, needle);
+    ASSERT (p - haystack == 4);
+  }
+
+  {
+    /* Like the above, but trigger the flaw in two_way_long_needle
+       by using a needle of length LONG_NEEDLE_THRESHOLD (32) or greater.
+       Rather than trying to find the right alignment manually, I've
+       arbitrarily chosen the following needle and template for the
+       haystack, and ensure that for each placement of the needle in
+       that haystack, c_strcasestr finds it.  */
+    const char *needle = "\nwith_gnu_ld-extend-to-len-32-b\n";
+    const char *h =
+      "\n"
+      "with_build_libsubdir\n"
+      "with_local_prefix\n"
+      "with_gxx_include_dir\n"
+      "with_cpp_install_dir\n"
+      "with_e_\n"
+      "..............................\n"
+      "with_FGHIJKLMNOPQRSTUVWXYZ\n"
+      "with_567890123456789\n"
+      "with_multilib_list\n";
+    size_t h_len = strlen (h);
+    char *haystack = malloc (h_len + 1);
+    size_t i;
+    ASSERT (haystack);
+    for (i = 0; i < h_len - strlen (needle); i++)
+      {
+        const char *p;
+        memcpy (haystack, h, h_len + 1);
+        memcpy (haystack + i, needle, strlen (needle) + 1);
+        p = c_strcasestr (haystack, needle);
+        ASSERT (p);
+        ASSERT (p - haystack == i);
+      }
+  }
+
   return 0;
 }
index bda1ee8..1ddf229 100644 (file)
@@ -54,7 +54,7 @@ static struct test tests[] = {
   {"",          ".",    "",     "",     "",     false,  false},
   {".",         ".",    ".",    ".",    ".",    false,  false},
   {"..",        ".",    "..",   "..",   "..",   false,  false},
-#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
+#if ISSLASH ('\\')
   {"a\\",       ".",    "a\\",  "a\\",  "a",    true,   false},
   {"a\\b",      "a",    "b",    "b",    "a\\b", false,  false},
   {"\\",        "\\",   "",     "\\",   "\\",   false,  true},
@@ -75,7 +75,7 @@ static struct test tests[] = {
   {"//\\",      "/",    "\\",   "\\",   "//\\", false,  true},
 # endif
 #endif
-#if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
+#if ISSLASH ('\\')
 # if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
   {"c:",        "c:",   "",     "c:",   "c:",   false,  false},
   {"c:/",       "c:/",  "",     "c:/",  "c:/",  false,  true},
@@ -105,7 +105,7 @@ static struct test tests[] = {
   {"a/b:c",     "a",    "b:c",  "./b:c","a/b:c",false,  false},
   {"a/b:c/",    "a",    "b:c/", "./b:c/","a/b:c",true,  false},
 # endif
-#else /* ! FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX */
+#else /* ! ISSLASH ('\\') */
   {"c:",        ".",    "c:",   "c:",   "c:",   false,  false},
   {"c:/",       ".",    "c:/",  "c:/",  "c:",   true,   false},
   {"c://",      ".",    "c://", "c:/",  "c:",   true,   false},
index f0fb321..8b1164a 100644 (file)
@@ -63,15 +63,16 @@ ARGMATCH_VERIFY (exclude_keywords, exclude_flags);
 /* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in <config.h>, and
    thus must link with a definition of that function.  Provide it here.  */
 #ifdef ARGMATCH_DIE_DECL
+
 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
 #  define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
 # else
 #  define _GL_ATTRIBUTE_NORETURN /* empty */
 # endif
-#endif
 
 ARGMATCH_DIE_DECL _GL_ATTRIBUTE_NORETURN;
 ARGMATCH_DIE_DECL { exit (1); }
+
 #endif
 
 int
diff --git a/tests/test-getloadavg.c b/tests/test-getloadavg.c
new file mode 100644 (file)
index 0000000..f039776
--- /dev/null
@@ -0,0 +1,83 @@
+/* Test of getting load average.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This 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>
+
+#include <stdlib.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (getloadavg, int, (double [], int));
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+static void
+check_avg (int minutes, double avg, int printit)
+{
+  if (printit)
+    printf ("%d-minute: %f  ", minutes, avg);
+  else
+    {
+      /* Plausibility checks.  */
+      if (avg < 0.01)
+        printf ("suspiciously low %d-minute average: %f\n", minutes, avg);
+      if (avg > 1000000)
+        printf ("suspiciously high %d-minute average: %f\n", minutes, avg);
+    }
+  if (avg < 0 || avg != avg)
+    exit (minutes);
+}
+
+/* This program can also be used as a manual test, by invoking it with
+   an argument; it then prints the load average.  If the argument is
+   nonzero, the manual test repeats forever, sleeping for the stated
+   interval between each iteration.  */
+int
+main (int argc, char **argv)
+{
+  int naptime = 0;
+
+  if (argc > 1)
+    naptime = atoi (argv[1]);
+
+  while (1)
+    {
+      double avg[3];
+      int loads = getloadavg (avg, 3);
+      if (loads == -1)
+        {
+          if (! (errno == ENOSYS || errno == ENOTSUP))
+            return 1;
+          perror ("Skipping test; load average not supported");
+          return 77;
+        }
+      if (loads > 0)
+        check_avg (1, avg[0], argc > 1);
+      if (loads > 1)
+        check_avg (5, avg[1], argc > 1);
+      if (loads > 2)
+        check_avg (15, avg[1], argc > 1);
+      if (loads > 0 && argc > 1)
+        putchar ('\n');
+
+      if (naptime == 0)
+        break;
+      sleep (naptime);
+    }
+
+  return 0;
+}
index 501f79c..6953f4c 100644 (file)
@@ -24,7 +24,7 @@
 #include <stdio.h>
 
 #ifndef _GL_ATTRIBUTE_RETURN_CHECK
-# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1)
+# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
 #  define _GL_ATTRIBUTE_RETURN_CHECK
 # else
 #  define _GL_ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__))
index 5898285..44ede54 100644 (file)
@@ -136,13 +136,15 @@ test_link (int (*func) (char const *, char const *), bool print)
     else
       {
         /* Most everyone else.  */
-        ASSERT (errno == EPERM || errno == EACCES);
+        ASSERT (errno == EPERM || errno == EACCES || errno == EISDIR);
         errno = 0;
         ASSERT (func (BASE "d/.", BASE "c") == -1);
-        ASSERT (errno == EPERM || errno == EACCES || errno == EINVAL);
+        ASSERT (errno == EPERM || errno == EACCES || errno == EISDIR
+                || errno == EINVAL);
         errno = 0;
         ASSERT (func (BASE "d/.//", BASE "c") == -1);
-        ASSERT (errno == EPERM || errno == EACCES || errno == EINVAL);
+        ASSERT (errno == EPERM || errno == EACCES || errno == EISDIR
+                || errno == EINVAL);
       }
   }
   ASSERT (unlink (BASE "a") == 0);
index c9c39fe..06b9a32 100644 (file)
 #include "signature.h"
 
 
+#if GNULIB_TEST_SETLOCALE
+SIGNATURE_CHECK (GNULIB_NAMESPACE::setlocale, char *, (int, const char *));
+#endif
+
 #if GNULIB_TEST_DUPLOCALE && HAVE_DUPLOCALE
 SIGNATURE_CHECK (GNULIB_NAMESPACE::duplocale, locale_t, (locale_t));
 #endif
diff --git a/tests/test-mbrtowc-w32-1.sh b/tests/test-mbrtowc-w32-1.sh
new file mode 100755 (executable)
index 0000000..3f12e44
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1252 locale.
+./test-mbrtowc-w32${EXEEXT} French_France 1252
diff --git a/tests/test-mbrtowc-w32-2.sh b/tests/test-mbrtowc-w32-2.sh
new file mode 100755 (executable)
index 0000000..9e1a765
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1256 locale.
+./test-mbrtowc-w32${EXEEXT} "Arabic_Saudi Arabia" 1256
diff --git a/tests/test-mbrtowc-w32-3.sh b/tests/test-mbrtowc-w32-3.sh
new file mode 100755 (executable)
index 0000000..782c2d0
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP932 locale.
+./test-mbrtowc-w32${EXEEXT} Japanese_Japan 932
diff --git a/tests/test-mbrtowc-w32-4.sh b/tests/test-mbrtowc-w32-4.sh
new file mode 100755 (executable)
index 0000000..0630f30
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP950 locale.
+./test-mbrtowc-w32${EXEEXT} Chinese_Taiwan 950
diff --git a/tests/test-mbrtowc-w32-5.sh b/tests/test-mbrtowc-w32-5.sh
new file mode 100755 (executable)
index 0000000..7d7faa9
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP936 locale.
+./test-mbrtowc-w32${EXEEXT} Chinese_China 936
diff --git a/tests/test-mbrtowc-w32-6.sh b/tests/test-mbrtowc-w32-6.sh
new file mode 100755 (executable)
index 0000000..945ebb6
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# This test is not enabled by default, because MSVCRT does not support and
+# will likely never support locales with MB_CUR_MAX > 2.
+
+# Test a GB18030 locale.
+./test-mbrtowc-w32${EXEEXT} Chinese_China 54936
diff --git a/tests/test-mbrtowc-w32-7.sh b/tests/test-mbrtowc-w32-7.sh
new file mode 100755 (executable)
index 0000000..26fc7b3
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# This test is not enabled by default, because MSVCRT does not support and
+# will likely never support locales with MB_CUR_MAX > 2.
+
+# Test some UTF-8 locales.
+./test-mbrtowc-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001
diff --git a/tests/test-mbrtowc-w32.c b/tests/test-mbrtowc-w32.c
new file mode 100644 (file)
index 0000000..ee8caf9
--- /dev/null
@@ -0,0 +1,735 @@
+/* Test of conversion of multibyte character to wide character.
+   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+
+   This 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>
+
+#include <wchar.h>
+
+#include <errno.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+
+static int
+test_one_locale (const char *name, int codepage)
+{
+  mbstate_t state;
+  wchar_t wc;
+  size_t ret;
+
+# if 1
+  /* Portable code to set the locale.  */
+  {
+    char name_with_codepage[1024];
+
+    sprintf (name_with_codepage, "%s.%d", name, codepage);
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name_with_codepage) == NULL)
+      return 77;
+  }
+# else
+  /* Hacky way to set a locale.codepage combination that setlocale() refuses
+     to set.  */
+  {
+    /* Codepage of the current locale, set with setlocale().
+       Not necessarily the same as GetACP().  */
+    extern __declspec(dllimport) unsigned int __lc_codepage;
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name) == NULL)
+      return 77;
+
+    /* Clobber the codepage and MB_CUR_MAX, both set by setlocale().  */
+    __lc_codepage = codepage;
+    switch (codepage)
+      {
+      case 1252:
+      case 1256:
+        MB_CUR_MAX = 1;
+        break;
+      case 932:
+      case 950:
+      case 936:
+        MB_CUR_MAX = 2;
+        break;
+      case 54936:
+      case 65001:
+        MB_CUR_MAX = 4;
+        break;
+      }
+
+    /* Test whether the codepage is really available.  */
+    memset (&state, '\0', sizeof (mbstate_t));
+    if (mbrtowc (&wc, " ", 1, &state) == (size_t)(-1))
+      return 77;
+  }
+# endif
+
+  /* Test zero-length input.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    wc = (wchar_t) 0xBADFACE;
+    ret = mbrtowc (&wc, "x", 0, &state);
+    /* gnulib's implementation returns (size_t)(-2).
+       The AIX 5.1 implementation returns (size_t)(-1).
+       glibc's implementation returns 0.  */
+    ASSERT (ret == (size_t)(-2) || ret == (size_t)(-1) || ret == 0);
+    ASSERT (mbsinit (&state));
+  }
+
+  /* Test NUL byte input.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    wc = (wchar_t) 0xBADFACE;
+    ret = mbrtowc (&wc, "", 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (wc == 0);
+    ASSERT (mbsinit (&state));
+    ret = mbrtowc (NULL, "", 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (mbsinit (&state));
+  }
+
+  /* Test single-byte input.  */
+  {
+    int c;
+    char buf[1];
+
+    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;
+        }
+  }
+
+  /* Test special calling convention, passing a NULL pointer.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    wc = (wchar_t) 0xBADFACE;
+    ret = mbrtowc (&wc, NULL, 5, &state);
+    ASSERT (ret == 0);
+    ASSERT (wc == (wchar_t) 0xBADFACE);
+    ASSERT (mbsinit (&state));
+  }
+
+  switch (codepage)
+    {
+    case 1252:
+      /* Locale encoding is CP1252, an extension of ISO-8859-1.  */
+      {
+        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 (wc == 0x00FC);
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtowc (NULL, input + 2, 3, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 2, 3, &state);
+        ASSERT (ret == 1);
+        ASSERT (wctob (wc) == (unsigned char) '\337');
+        ASSERT (wc == 0x00DF);
+        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 1256:
+      /* Locale encoding is CP1256, not the same as ISO-8859-6.  */
+      {
+        char input[] = "x\302\341\346y"; /* "xآلوy" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'x');
+        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) '\302');
+        ASSERT (wc == 0x0622);
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtowc (NULL, input + 2, 3, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 2, 3, &state);
+        ASSERT (ret == 1);
+        ASSERT (wctob (wc) == (unsigned char) '\341');
+        ASSERT (wc == 0x0644);
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 3, 2, &state);
+        ASSERT (ret == 1);
+        ASSERT (wctob (wc) == (unsigned char) '\346');
+        ASSERT (wc == 0x0648);
+        ASSERT (mbsinit (&state));
+        input[3] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 4, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'y');
+        ASSERT (mbsinit (&state));
+      }
+      return 0;
+
+    case 932:
+      /* Locale encoding is CP932, similar to Shift_JIS.  */
+      {
+        char input[] = "<\223\372\226\173\214\352>"; /* "<日本語>" */
+        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 (wc == 0x65E5);
+        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 (wc == 0x672C);
+        ASSERT (mbsinit (&state));
+        input[4] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtowc (NULL, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x8A9E);
+        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));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+      }
+      return 0;
+
+    case 950:
+      /* Locale encoding is CP950, similar to Big5.  */
+      {
+        char input[] = "<\244\351\245\273\273\171>"; /* "<日本語>" */
+        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 (wc == 0x65E5);
+        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 (wc == 0x672C);
+        ASSERT (mbsinit (&state));
+        input[4] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtowc (NULL, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x8A9E);
+        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));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+      }
+      return 0;
+
+    case 936:
+      /* Locale encoding is CP936 = GBK, an extension of GB2312.  */
+      {
+        char input[] = "<\310\325\261\276\325\132>"; /* "<日本語>" */
+        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 (wc == 0x65E5);
+        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 (wc == 0x672C);
+        ASSERT (mbsinit (&state));
+        input[4] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtowc (NULL, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x8A9E);
+        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));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+      }
+      return 0;
+
+    case 54936:
+      /* Locale encoding is CP54936 = 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 (wc == 0x00FC);
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtowc (NULL, input + 3, 6, &state);
+        ASSERT (ret == 4);
+        ASSERT (mbsinit (&state));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 3, 6, &state);
+        ASSERT (ret == 4);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x00DF);
+        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));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\201\045", 2, &state); /* 0x81 0x25 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\201\060\377", 3, &state); /* 0x81 0x30 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\201\060\377\064", 4, &state); /* 0x81 0x30 0xFF 0x34 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\201\060\211\072", 4, &state); /* 0x81 0x30 0x89 0x3A */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+      }
+      return 0;
+
+    case 65001:
+      /* Locale encoding is CP65001 = 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 (wc == 0x00FC);
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtowc (NULL, input + 3, 4, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 3, 4, &state);
+        ASSERT (ret == 2);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x00DF);
+        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));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\303\300", 2, &state); /* 0xC3 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\343\300", 2, &state); /* 0xE3 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\343\300\200", 3, &state); /* 0xE3 0xC0 0x80 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\343\200\300", 3, &state); /* 0xE3 0x80 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\363\300", 2, &state); /* 0xF3 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\363\300\200\200", 4, &state); /* 0xF3 0xC0 0x80 0x80 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\363\200\300", 3, &state); /* 0xF3 0x80 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\363\200\300\200", 4, &state); /* 0xF3 0x80 0xC0 0x80 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\363\200\200\300", 4, &state); /* 0xF3 0x80 0x80 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+      }
+      return 0;
+
+    default:
+      return 1;
+    }
+}
+
+int
+main (int argc, char *argv[])
+{
+  int codepage = atoi (argv[argc - 1]);
+  int result;
+  int i;
+
+  result = 77;
+  for (i = 1; i < argc - 1; i++)
+    {
+      int ret = test_one_locale (argv[i], codepage);
+
+      if (ret != 77)
+        result = ret;
+    }
+
+  if (result == 77)
+    {
+      fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
+               codepage);
+    }
+  return result;
+}
+
+#else
+
+int
+main (int argc, char *argv[])
+{
+  fputs ("Skipping test: not a native Windows system\n", stderr);
+  return 77;
+}
+
+#endif
index cffb56b..395983e 100644 (file)
@@ -202,5 +202,95 @@ main (int argc, char *argv[])
     free (needle);
   }
 
+  {
+    /* Ensure that with a barely periodic "short" needle, memmem's
+       search does not mistakenly skip just past the match point.
+       This use of memmem would mistakenly return NULL before
+       gnulib v0.0-4927.  */
+    const char *haystack =
+      "\n"
+      "with_build_libsubdir\n"
+      "with_local_prefix\n"
+      "with_gxx_include_dir\n"
+      "with_cpp_install_dir\n"
+      "enable_generated_files_in_srcdir\n"
+      "with_gnu_ld\n"
+      "with_ld\n"
+      "with_demangler_in_ld\n"
+      "with_gnu_as\n"
+      "with_as\n"
+      "enable_largefile\n"
+      "enable_werror_always\n"
+      "enable_checking\n"
+      "enable_coverage\n"
+      "enable_gather_detailed_mem_stats\n"
+      "enable_build_with_cxx\n"
+      "with_stabs\n"
+      "enable_multilib\n"
+      "enable___cxa_atexit\n"
+      "enable_decimal_float\n"
+      "enable_fixed_point\n"
+      "enable_threads\n"
+      "enable_tls\n"
+      "enable_objc_gc\n"
+      "with_dwarf2\n"
+      "enable_shared\n"
+      "with_build_sysroot\n"
+      "with_sysroot\n"
+      "with_specs\n"
+      "with_pkgversion\n"
+      "with_bugurl\n"
+      "enable_languages\n"
+      "with_multilib_list\n";
+    const char *needle = "\n"
+      "with_gnu_ld\n";
+    const char* p = memmem (haystack, strlen (haystack),
+                            needle, strlen (needle));
+    ASSERT (p - haystack == 114);
+  }
+
+  {
+    /* Same bug, shorter trigger.  */
+    const char *haystack = "..wi.d.";
+    const char *needle = ".d.";
+    const char* p = memmem (haystack, strlen (haystack),
+                            needle, strlen (needle));
+    ASSERT (p - haystack == 4);
+  }
+
+  {
+    /* Like the above, but trigger the flaw in two_way_long_needle
+       by using a needle of length LONG_NEEDLE_THRESHOLD (32) or greater.
+       Rather than trying to find the right alignment manually, I've
+       arbitrarily chosen the following needle and template for the
+       haystack, and ensure that for each placement of the needle in
+       that haystack, memmem finds it.  */
+    const char *needle = "\nwith_gnu_ld-extend-to-len-32-b\n";
+    const char *h =
+      "\n"
+      "with_build_libsubdir\n"
+      "with_local_prefix\n"
+      "with_gxx_include_dir\n"
+      "with_cpp_install_dir\n"
+      "with_e_\n"
+      "..............................\n"
+      "with_FGHIJKLMNOPQRSTUVWXYZ\n"
+      "with_567890123456789\n"
+      "with_multilib_list\n";
+    size_t h_len = strlen (h);
+    char *haystack = malloc (h_len + 1);
+    size_t i;
+    ASSERT (haystack);
+    for (i = 0; i < h_len - strlen (needle); i++)
+      {
+        const char *p;
+        memcpy (haystack, h, h_len + 1);
+        memcpy (haystack + i, needle, strlen (needle) + 1);
+        p = memmem (haystack, strlen (haystack), needle, strlen (needle));
+        ASSERT (p);
+        ASSERT (p - haystack == i);
+      }
+  }
+
   return 0;
 }
diff --git a/tests/test-nonblocking.c b/tests/test-nonblocking.c
new file mode 100644 (file)
index 0000000..f1b7610
--- /dev/null
@@ -0,0 +1,128 @@
+/* Test manipulation of non-blocking flag.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This 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>, 2011.  */
+
+#include <config.h>
+
+#include "nonblocking.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/socket.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  const char *file = "test-nonblock.tmp";
+  int fd_file;
+  int fd_pipe[2];
+  int fd_sock;
+  bool sock_works = true;
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+  /* For now, we can't get nonblocking status of windows sockets.  */
+  sock_works = false;
+#endif
+
+  fd_file = creat (file, 0600);
+
+  /* Assume std descriptors were provided by invoker.  */
+  ASSERT (STDERR_FILENO < fd_file);
+
+  /* Test regular files; setting nonblocking on file is unspecified.  */
+  ASSERT (get_nonblocking_flag (fd_file) == 0);
+  ASSERT (set_nonblocking_flag (fd_file, false) == 0);
+  ASSERT (get_nonblocking_flag (fd_file) == 0);
+  ASSERT (close (fd_file) == 0);
+  ASSERT (unlink (file) == 0);
+
+  /* Test directories; setting nonblocking is unspecified.  */
+  fd_file = open (".", O_RDONLY);
+  if (STDERR_FILENO < fd_file)
+    {
+      /* mingw can't open directories unless fchdir module is active.  */
+      ASSERT (get_nonblocking_flag (fd_file) == 0);
+      ASSERT (set_nonblocking_flag (fd_file, false) == 0);
+      ASSERT (get_nonblocking_flag (fd_file) == 0);
+      ASSERT (close (fd_file) == 0);
+    }
+
+  /* Test pipes.  */
+  ASSERT (pipe (fd_pipe) == 0);
+  ASSERT (get_nonblocking_flag (fd_pipe[0]) == 0);
+  ASSERT (get_nonblocking_flag (fd_pipe[1]) == 0);
+  ASSERT (set_nonblocking_flag (fd_pipe[0], true) == 0);
+  ASSERT (get_nonblocking_flag (fd_pipe[0]) == 1);
+  ASSERT (get_nonblocking_flag (fd_pipe[1]) == 0);
+  ASSERT (set_nonblocking_flag (fd_pipe[1], true) == 0);
+  ASSERT (set_nonblocking_flag (fd_pipe[0], false) == 0);
+  ASSERT (get_nonblocking_flag (fd_pipe[0]) == 0);
+  ASSERT (get_nonblocking_flag (fd_pipe[1]) == 1);
+  ASSERT (close (fd_pipe[0]) == 0);
+  ASSERT (close (fd_pipe[1]) == 0);
+
+#if GNULIB_TEST_PIPE2
+  /* mingw still lacks O_NONBLOCK replacement.  */
+  ASSERT (pipe2 (fd_pipe, O_NONBLOCK) == 0);
+  ASSERT (get_nonblocking_flag (fd_pipe[0]) == !!O_NONBLOCK);
+  ASSERT (get_nonblocking_flag (fd_pipe[1]) == !!O_NONBLOCK);
+  ASSERT (close (fd_pipe[0]) == 0);
+  ASSERT (close (fd_pipe[1]) == 0);
+#endif /* GNULIB_TEST_PIPE2 */
+
+  /* Test sockets.  */
+  fd_sock = socket (AF_INET, SOCK_STREAM, 0);
+  ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 0 : -1));
+  ASSERT (set_nonblocking_flag (fd_sock, true) == 0);
+  ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 1 : -1));
+  ASSERT (set_nonblocking_flag (fd_sock, false) == 0);
+  ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 0 : -1));
+  ASSERT (close (fd_sock) == 0);
+
+#if SOCK_NONBLOCK
+  fd_sock = socket (AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
+  ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 1 : -1));
+  ASSERT (close (fd_sock) == 0);
+#endif /* SOCK_NONBLOCK */
+
+  /* Test error handling.  */
+  {
+    errno = 0;
+    ASSERT (get_nonblocking_flag (-1) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    errno = 0;
+    ASSERT (set_nonblocking_flag (-1, false) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    errno = 0;
+    ASSERT (set_nonblocking_flag (-1, true) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    errno = 0;
+    ASSERT (set_nonblocking_flag (10000000, false) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  return 0;
+}
diff --git a/tests/test-passfd.c b/tests/test-passfd.c
new file mode 100644 (file)
index 0000000..d657ad9
--- /dev/null
@@ -0,0 +1,118 @@
+/* Test of passing file descriptors.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This 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>
+
+#include "passfd.h"
+
+#include <fcntl.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  int pair[2];
+  int ret;
+  pid_t pid;
+  int status;
+  int fdnull;
+  int fd;
+  struct stat st;
+
+#if HAVE_DECL_ALARM
+  /* Avoid hanging on failure.  */
+  signal (SIGALRM, SIG_DFL);
+  alarm (5);
+#endif
+
+  fdnull = open ("/dev/null", O_RDWR);
+  if (fdnull < 0)
+    {
+      perror ("Could not open /dev/null");
+      return 1;
+    }
+
+  ret = socketpair (AF_UNIX, SOCK_STREAM, 0, pair);
+  if (ret < 0)
+    {
+      perror ("socket pair failed");
+      return 2;
+    }
+
+  pid = fork ();
+  if (pid == -1)
+    {
+      perror ("fork");
+      return 3;
+    }
+  if (pid == 0)
+    {
+      ret = sendfd (pair[1], fdnull);
+      if (ret == -1)
+        {
+          perror ("sendfd");
+          return 64;
+        }
+      return 0;
+    }
+  /* father */
+  else
+    {
+      fd = recvfd (pair[0], 0);
+      if (fd == -1)
+        {
+          perror ("recvfd");
+          return 16;
+        }
+      ret = waitpid (pid, &status, 0);
+      if (ret == -1)
+        {
+          perror ("waitpid");
+          return 17;
+        }
+      ASSERT (ret == pid);
+
+      if (!WIFEXITED (status))
+        {
+          fprintf (stderr, "Child does not normally exit\n");
+          return 65;
+        }
+      ret = WEXITSTATUS (status);
+      if (ret != 0)
+        {
+          fprintf (stderr, "Send fd fail\n");
+          return ret;
+        }
+
+      /* try to stat new fd */
+      ret = fstat (fd, &st);
+      if (ret < 0)
+        {
+          perror ("fstat");
+          return 80;
+        }
+      return 0;
+    }
+}
index 08d5662..7247fc4 100644 (file)
@@ -38,7 +38,7 @@ test_readlink (ssize_t (*func) (char const *, char *, size_t), bool print)
   ASSERT (errno == ENOENT);
   errno = 0;
   ASSERT (func ("", buf, sizeof buf) == -1);
-  ASSERT (errno == ENOENT);
+  ASSERT (errno == ENOENT || errno == EINVAL);
   errno = 0;
   ASSERT (func (".", buf, sizeof buf) == -1);
   ASSERT (errno == EINVAL);
index 7f1e8f0..02728f9 100644 (file)
 static void
 check (const char *literal, int cflags, const char *expected)
 {
+  struct regex_quote_spec spec;
   char *result;
   size_t length;
 
-  result = regex_quote (literal, cflags);
+  spec = regex_quote_spec_posix (cflags, false);
+  result = regex_quote (literal, &spec);
   ASSERT (strcmp (result, expected) == 0);
-  length = regex_quote_length (literal, cflags);
+  length = regex_quote_length (literal, &spec);
   ASSERT (length == strlen (result));
   free (result);
 
   result = (char *) xmalloc (1 + length + 1 + 1);
   result[0] = '^';
-  strcpy (regex_quote_copy (result + 1, literal, cflags), "$");
+  strcpy (regex_quote_copy (result + 1, literal, &spec), "$");
+  {
+    regex_t regex;
+    regmatch_t match[1];
+
+    ASSERT (regcomp (&regex, result, cflags) == 0);
+
+    ASSERT (regexec (&regex, literal, 1, match, 0) == 0);
+    ASSERT (match[0].rm_so == 0);
+    ASSERT (match[0].rm_eo == strlen (literal));
+    regfree (&regex);
+  }
+  free (result);
+
+  spec = regex_quote_spec_posix (cflags, true);
+  result = regex_quote (literal, &spec);
+  length = regex_quote_length (literal, &spec);
+  ASSERT (length == strlen (result));
   {
     regex_t regex;
     regmatch_t match[1];
diff --git a/tests/test-setlocale1.c b/tests/test-setlocale1.c
new file mode 100644 (file)
index 0000000..ea7945c
--- /dev/null
@@ -0,0 +1,59 @@
+/* Test of setting the current locale.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This 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>
+
+#include <locale.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (setlocale, char *, (int, const char *));
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  char *name1;
+  char *name2;
+
+  /* Try to set the locale by implicitly looking at the LC_ALL environment
+     variable.
+     configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  name1 = strdup (setlocale (LC_ALL, NULL));
+
+  /* Reset the locale.  */
+  if (setlocale (LC_ALL, "C") == NULL)
+    return 1;
+
+  /* Try to set the locale by explicitly looking at the LC_ALL environment
+     variable.
+     configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL)
+    return 1;
+
+  name2 = strdup (setlocale (LC_ALL, NULL));
+
+  /* Test that the two results are the same.  */
+  ASSERT (strcmp (name1, name2) == 0);
+
+  return 0;
+}
diff --git a/tests/test-setlocale1.sh b/tests/test-setlocale1.sh
new file mode 100755 (executable)
index 0000000..59a0532
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+: ${LOCALE_FR=fr_FR}
+: ${LOCALE_FR_UTF8=fr_FR.UTF-8}
+: ${LOCALE_JA=ja_JP}
+: ${LOCALE_ZH_CN=zh_CN.GB18030}
+
+if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none \
+   && test $LOCALE_JA = none && test $LOCALE_ZH_CN = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no locale for testing is installed"
+  else
+    echo "Skipping test: no locale for testing is supported"
+  fi
+  exit 77
+fi
+
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR      ./test-setlocale1${EXEEXT} || exit 1
+fi
+
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 ./test-setlocale1${EXEEXT} || exit 1
+fi
+
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA      ./test-setlocale1${EXEEXT} || exit 1
+fi
+
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN   ./test-setlocale1${EXEEXT} || exit 1
+fi
+
+exit 0
diff --git a/tests/test-setlocale2.c b/tests/test-setlocale2.c
new file mode 100644 (file)
index 0000000..7bfc42a
--- /dev/null
@@ -0,0 +1,55 @@
+/* Test of setting the current locale.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This 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>
+
+#include <locale.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int
+main ()
+{
+  /* Try to set the locale by implicitly looking at the LC_ALL environment
+     variable.  */
+  if (setlocale (LC_ALL, "") != NULL)
+    /* It was successful.  Check whether LC_CTYPE is non-trivial.  */
+    if (strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+      {
+        fprintf (stderr, "setlocale did not fail for implicit %s\n",
+                 getenv ("LC_ALL"));
+        return 1;
+      }
+
+  /* Reset the locale.  */
+  if (setlocale (LC_ALL, "C") == NULL)
+    return 1;
+
+  /* Try to set the locale by explicitly looking at the LC_ALL environment
+     variable.  */
+  if (setlocale (LC_ALL, getenv ("LC_ALL")) != NULL)
+    /* It was successful.  Check whether LC_CTYPE is non-trivial.  */
+    if (strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+      {
+        fprintf (stderr, "setlocale did not fail for explicit %s\n",
+                 getenv ("LC_ALL"));
+        return 1;
+      }
+
+  return 0;
+}
diff --git a/tests/test-setlocale2.sh b/tests/test-setlocale2.sh
new file mode 100755 (executable)
index 0000000..723e74e
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test locale names with likely unsupported encoding in Unix syntax.
+for name in ar_SA.ISO-8859-1 fr_FR.CP1251 zh_TW.GB18030 zh_CN.BIG5; do
+  LC_ALL=$name ./test-setlocale2${EXEEXT} 1 || exit 1
+done
+
+# Test locale names with likely unsupported encoding in native Windows syntax.
+for name in "Arabic_Saudi Arabia.1252" "Arabic_Saudi Arabia.65001" \
+            French_France.65001 Japanese_Japan.65001 Turkish_Turkey.65001 \
+            Chinese_Taiwan.65001 Chinese_China.54936 Chinese_China.65001; do
+  LC_ALL=$name ./test-setlocale2${EXEEXT} 1 || exit 1
+done
+
+exit 0
index b8595f5..9010c1c 100644 (file)
@@ -60,6 +60,11 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::grantpt, int, (int));
 SIGNATURE_CHECK (GNULIB_NAMESPACE::malloc, void *, (size_t));
 #endif
 
+#if GNULIB_TEST_MBTOWC
+SIGNATURE_CHECK (GNULIB_NAMESPACE::mbtowc, int,
+                 (wchar_t *, const char *, size_t));
+#endif
+
 #if GNULIB_TEST_MKDTEMP
 SIGNATURE_CHECK (GNULIB_NAMESPACE::mkdtemp, char *, (char *));
 #endif
@@ -147,6 +152,10 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::unlockpt, int, (int));
 SIGNATURE_CHECK (GNULIB_NAMESPACE::unsetenv, int, (const char *));
 #endif
 
+#if GNULIB_TEST_WCTOMB
+SIGNATURE_CHECK (GNULIB_NAMESPACE::wctomb, int, (char *, wchar_t));
+#endif
+
 
 int
 main ()
index a38f9ac..fb1314b 100644 (file)
@@ -162,5 +162,93 @@ main ()
     free (haystack);
   }
 
+  {
+    /* Ensure that with a barely periodic "short" needle, strcasestr's
+       search does not mistakenly skip just past the match point.
+       This use of strcasestr would mistakenly return NULL before
+       gnulib v0.0-4927.  */
+    const char *haystack =
+      "\n"
+      "with_build_libsubdir\n"
+      "with_local_prefix\n"
+      "with_gxx_include_dir\n"
+      "with_cpp_install_dir\n"
+      "enable_generated_files_in_srcdir\n"
+      "with_gnu_ld\n"
+      "with_ld\n"
+      "with_demangler_in_ld\n"
+      "with_gnu_as\n"
+      "with_as\n"
+      "enable_largefile\n"
+      "enable_werror_always\n"
+      "enable_checking\n"
+      "enable_coverage\n"
+      "enable_gather_detailed_mem_stats\n"
+      "enable_build_with_cxx\n"
+      "with_stabs\n"
+      "enable_multilib\n"
+      "enable___cxa_atexit\n"
+      "enable_decimal_float\n"
+      "enable_fixed_point\n"
+      "enable_threads\n"
+      "enable_tls\n"
+      "enable_objc_gc\n"
+      "with_dwarf2\n"
+      "enable_shared\n"
+      "with_build_sysroot\n"
+      "with_sysroot\n"
+      "with_specs\n"
+      "with_pkgversion\n"
+      "with_bugurl\n"
+      "enable_languages\n"
+      "with_multilib_list\n";
+    const char *needle = "\n"
+      "with_GNU_ld\n";
+    const char* p = strcasestr (haystack, needle);
+    ASSERT (p - haystack == 114);
+  }
+
+  {
+    /* Same bug, shorter trigger.  */
+    const char *haystack = "..wi.D.";
+    const char *needle = ".d.";
+    const char* p = strcasestr (haystack, needle);
+    ASSERT (p - haystack == 4);
+  }
+
+  {
+    /* Like the above, but trigger the flaw in two_way_long_needle
+       by using a needle of length LONG_NEEDLE_THRESHOLD (32) or greater.
+       Rather than trying to find the right alignment manually, I've
+       arbitrarily chosen the following needle and template for the
+       haystack, and ensure that for each placement of the needle in
+       that haystack, strcasestr finds it.  */
+    const char *needle = "\nwith_gnu_ld-extend-to-len-32-b\n";
+    const char *h =
+      "\n"
+      "with_build_libsubdir\n"
+      "with_local_prefix\n"
+      "with_gxx_include_dir\n"
+      "with_cpp_install_dir\n"
+      "with_e_\n"
+      "..............................\n"
+      "with_FGHIJKLMNOPQRSTUVWXYZ\n"
+      "with_567890123456789\n"
+      "with_multilib_list\n";
+    size_t h_len = strlen (h);
+    char *haystack = malloc (h_len + 1);
+    size_t i;
+    ASSERT (haystack);
+    for (i = 0; i < h_len - strlen (needle); i++)
+      {
+        const char *p;
+        memcpy (haystack, h, h_len + 1);
+        memcpy (haystack + i, needle, strlen (needle) + 1);
+        p = strcasestr (haystack, needle);
+        ASSERT (p);
+        ASSERT (p - haystack == i);
+      }
+  }
+
   return 0;
 }
diff --git a/tests/test-strftime.c b/tests/test-strftime.c
new file mode 100644 (file)
index 0000000..2578550
--- /dev/null
@@ -0,0 +1,82 @@
+/* Test that posixtime works as required.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This 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 Jim Meyering.  */
+
+#include <config.h>
+
+#include "strftime.h"
+
+#include <stdio.h>
+#include <time.h>
+#include <string.h>
+
+#include "macros.h"
+#define STREQ(a, b) (strcmp (a, b) == 0)
+
+struct posixtm_test
+{
+  time_t in;
+  int in_ns;
+  char const *fmt;
+  char const *exp;
+};
+
+static struct posixtm_test const T[] =
+  {
+    { 1300000000, 0,            "%F", "2011-03-13" },
+    { 0,          0,            NULL, NULL }
+  };
+
+int
+main (void)
+{
+  int fail = 0;
+  unsigned int i;
+
+  for (i = 0; T[i].fmt; i++)
+    {
+      char buf[1000];
+      time_t t = T[i].in;
+      struct tm *tm = gmtime (&t);
+      size_t n;
+      int utc = 1;
+
+      ASSERT (tm);
+
+      n = nstrftime (buf, sizeof buf, T[i].fmt, tm, utc, T[i].in_ns);
+      if (n == 0)
+        {
+          fail = 1;
+          printf ("nstrftime failed with format %s\n", T[i].fmt);
+        }
+
+      if (! STREQ (buf, T[i].exp))
+        {
+          fail = 1;
+          printf ("%s: result mismatch: got %s, expected %s\n",
+                  T[i].fmt, buf, T[i].exp);
+        }
+    }
+
+  return fail;
+}
+
+/*
+Local Variables:
+indent-tabs-mode: nil
+End:
+*/
index f63cb33..d6d6639 100644 (file)
@@ -184,5 +184,94 @@ main (int argc, char *argv[])
   /* Sublinear speed is only possible in memmem; strstr must examine
      every character of haystack to find its length.  */
 
+
+  {
+    /* Ensure that with a barely periodic "short" needle, strstr's
+       search does not mistakenly skip just past the match point.
+       This use of strstr would mistakenly return NULL before
+       gnulib v0.0-4927.  */
+    const char *haystack =
+      "\n"
+      "with_build_libsubdir\n"
+      "with_local_prefix\n"
+      "with_gxx_include_dir\n"
+      "with_cpp_install_dir\n"
+      "enable_generated_files_in_srcdir\n"
+      "with_gnu_ld\n"
+      "with_ld\n"
+      "with_demangler_in_ld\n"
+      "with_gnu_as\n"
+      "with_as\n"
+      "enable_largefile\n"
+      "enable_werror_always\n"
+      "enable_checking\n"
+      "enable_coverage\n"
+      "enable_gather_detailed_mem_stats\n"
+      "enable_build_with_cxx\n"
+      "with_stabs\n"
+      "enable_multilib\n"
+      "enable___cxa_atexit\n"
+      "enable_decimal_float\n"
+      "enable_fixed_point\n"
+      "enable_threads\n"
+      "enable_tls\n"
+      "enable_objc_gc\n"
+      "with_dwarf2\n"
+      "enable_shared\n"
+      "with_build_sysroot\n"
+      "with_sysroot\n"
+      "with_specs\n"
+      "with_pkgversion\n"
+      "with_bugurl\n"
+      "enable_languages\n"
+      "with_multilib_list\n";
+    const char *needle = "\n"
+      "with_gnu_ld\n";
+    const char* p = strstr (haystack, needle);
+    ASSERT (p - haystack == 114);
+  }
+
+  {
+    /* Same bug, shorter trigger.  */
+    const char *haystack = "..wi.d.";
+    const char *needle = ".d.";
+    const char* p = strstr (haystack, needle);
+    ASSERT (p - haystack == 4);
+  }
+
+  {
+    /* Like the above, but trigger the flaw in two_way_long_needle
+       by using a needle of length LONG_NEEDLE_THRESHOLD (32) or greater.
+       Rather than trying to find the right alignment manually, I've
+       arbitrarily chosen the following needle and template for the
+       haystack, and ensure that for each placement of the needle in
+       that haystack, strstr finds it.  */
+    const char *needle = "\nwith_gnu_ld-extend-to-len-32-b\n";
+    const char *h =
+      "\n"
+      "with_build_libsubdir\n"
+      "with_local_prefix\n"
+      "with_gxx_include_dir\n"
+      "with_cpp_install_dir\n"
+      "with_e_\n"
+      "..............................\n"
+      "with_FGHIJKLMNOPQRSTUVWXYZ\n"
+      "with_567890123456789\n"
+      "with_multilib_list\n";
+    size_t h_len = strlen (h);
+    char *haystack = malloc (h_len + 1);
+    size_t i;
+    ASSERT (haystack);
+    for (i = 0; i < h_len - strlen (needle); i++)
+      {
+        const char *p;
+        memcpy (haystack, h, h_len + 1);
+        memcpy (haystack + i, needle, strlen (needle) + 1);
+        p = strstr (haystack, needle);
+        ASSERT (p);
+        ASSERT (p - haystack == i);
+      }
+  }
+
   return 0;
 }
diff --git a/tests/test-wcrtomb-w32-1.sh b/tests/test-wcrtomb-w32-1.sh
new file mode 100755 (executable)
index 0000000..50c82f5
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1252 locale.
+./test-wcrtomb-w32${EXEEXT} French_France 1252
diff --git a/tests/test-wcrtomb-w32-2.sh b/tests/test-wcrtomb-w32-2.sh
new file mode 100755 (executable)
index 0000000..783c70c
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1256 locale.
+./test-wcrtomb-w32${EXEEXT} "Arabic_Saudi Arabia" 1256
diff --git a/tests/test-wcrtomb-w32-3.sh b/tests/test-wcrtomb-w32-3.sh
new file mode 100755 (executable)
index 0000000..619ea64
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP932 locale.
+./test-wcrtomb-w32${EXEEXT} Japanese_Japan 932
diff --git a/tests/test-wcrtomb-w32-4.sh b/tests/test-wcrtomb-w32-4.sh
new file mode 100755 (executable)
index 0000000..67b6803
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP950 locale.
+./test-wcrtomb-w32${EXEEXT} Chinese_Taiwan 950
diff --git a/tests/test-wcrtomb-w32-5.sh b/tests/test-wcrtomb-w32-5.sh
new file mode 100755 (executable)
index 0000000..9841fa9
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP936 locale.
+./test-wcrtomb-w32${EXEEXT} Chinese_China 936
diff --git a/tests/test-wcrtomb-w32-6.sh b/tests/test-wcrtomb-w32-6.sh
new file mode 100755 (executable)
index 0000000..1709c98
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# This test is not enabled by default, because MSVCRT does not support and
+# will likely never support locales with MB_CUR_MAX > 2.
+
+# Test a GB18030 locale.
+./test-wcrtomb-w32${EXEEXT} Chinese_China 54936
diff --git a/tests/test-wcrtomb-w32-7.sh b/tests/test-wcrtomb-w32-7.sh
new file mode 100755 (executable)
index 0000000..bea12ab
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# This test is not enabled by default, because MSVCRT does not support and
+# will likely never support locales with MB_CUR_MAX > 2.
+
+# Test some UTF-8 locales.
+./test-wcrtomb-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001
diff --git a/tests/test-wcrtomb-w32.c b/tests/test-wcrtomb-w32.c
new file mode 100644 (file)
index 0000000..0b09498
--- /dev/null
@@ -0,0 +1,332 @@
+/* Test of conversion of wide character to multibyte character.
+   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+
+   This 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>
+
+#include <wchar.h>
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+
+static int
+test_one_locale (const char *name, int codepage)
+{
+  char buf[64];
+  size_t ret;
+
+# if 1
+  /* Portable code to set the locale.  */
+  {
+    char name_with_codepage[1024];
+
+    sprintf (name_with_codepage, "%s.%d", name, codepage);
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name_with_codepage) == NULL)
+      return 77;
+  }
+# else
+  /* Hacky way to set a locale.codepage combination that setlocale() refuses
+     to set.  */
+  {
+    /* Codepage of the current locale, set with setlocale().
+       Not necessarily the same as GetACP().  */
+    extern __declspec(dllimport) unsigned int __lc_codepage;
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name) == NULL)
+      return 77;
+
+    /* Clobber the codepage and MB_CUR_MAX, both set by setlocale().  */
+    __lc_codepage = codepage;
+    switch (codepage)
+      {
+      case 1252:
+      case 1256:
+        MB_CUR_MAX = 1;
+        break;
+      case 932:
+      case 950:
+      case 936:
+        MB_CUR_MAX = 2;
+        break;
+      case 54936:
+      case 65001:
+        MB_CUR_MAX = 4;
+        break;
+      }
+
+    /* Test whether the codepage is really available.  */
+    {
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, " ", 1, &state) == (size_t)(-1))
+        return 77;
+    }
+  }
+# endif
+
+  /* Test NUL character.  */
+  {
+    buf[0] = 'x';
+    ret = wcrtomb (buf, 0, NULL);
+    ASSERT (ret == 1);
+    ASSERT (buf[0] == '\0');
+  }
+
+  /* Test single bytes.  */
+  {
+    int c;
+
+    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".  */
+          ret = wcrtomb (buf, btowc (c), NULL);
+          ASSERT (ret == 1);
+          ASSERT (buf[0] == (char) c);
+          break;
+        }
+  }
+
+  /* Test special calling convention, passing a NULL pointer.  */
+  {
+    ret = wcrtomb (NULL, '\0', NULL);
+    ASSERT (ret == 1);
+    ret = wcrtomb (NULL, btowc ('x'), NULL);
+    ASSERT (ret == 1);
+  }
+
+  switch (codepage)
+    {
+    case 1252:
+      /* Locale encoding is CP1252, an extension of ISO-8859-1.  */
+      {
+        /* Convert "B\374\337er": "Büßer" */
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x00FC, NULL);
+        ASSERT (ret == 1);
+        ASSERT (memcmp (buf, "\374", 1) == 0);
+        ASSERT (buf[1] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x00DF, NULL);
+        ASSERT (ret == 1);
+        ASSERT (memcmp (buf, "\337", 1) == 0);
+        ASSERT (buf[1] == 'x');
+      }
+      return 0;
+
+    case 1256:
+      /* Locale encoding is CP1256, not the same as ISO-8859-6.  */
+      {
+        /* Convert "x\302\341\346y": "xآلوy" */
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x0622, NULL);
+        ASSERT (ret == 1);
+        ASSERT (memcmp (buf, "\302", 1) == 0);
+        ASSERT (buf[1] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x0644, NULL);
+        ASSERT (ret == 1);
+        ASSERT (memcmp (buf, "\341", 1) == 0);
+        ASSERT (buf[1] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x0648, NULL);
+        ASSERT (ret == 1);
+        ASSERT (memcmp (buf, "\346", 1) == 0);
+        ASSERT (buf[1] == 'x');
+      }
+      return 0;
+
+    case 932:
+      /* Locale encoding is CP932, similar to Shift_JIS.  */
+      {
+        /* Convert "<\223\372\226\173\214\352>": "<日本語>" */
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x65E5, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\223\372", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x672C, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\226\173", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x8A9E, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\214\352", 2) == 0);
+        ASSERT (buf[2] == 'x');
+      }
+      return 0;
+
+    case 950:
+      /* Locale encoding is CP950, similar to Big5.  */
+      {
+        /* Convert "<\244\351\245\273\273\171>": "<日本語>" */
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x65E5, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\244\351", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x672C, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\245\273", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x8A9E, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\273\171", 2) == 0);
+        ASSERT (buf[2] == 'x');
+      }
+      return 0;
+
+    case 936:
+      /* Locale encoding is CP936 = GBK, an extension of GB2312.  */
+      {
+        /* Convert "<\310\325\261\276\325\132>": "<日本語>" */
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x65E5, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\310\325", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x672C, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\261\276", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x8A9E, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\325\132", 2) == 0);
+        ASSERT (buf[2] == 'x');
+      }
+      return 0;
+
+    case 54936:
+      /* Locale encoding is CP54936 = GB18030.  */
+      {
+        /* Convert "B\250\271\201\060\211\070er": "Büßer" */
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x00FC, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\250\271", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x00DF, NULL);
+        ASSERT (ret == 4);
+        ASSERT (memcmp (buf, "\201\060\211\070", 4) == 0);
+        ASSERT (buf[4] == 'x');
+      }
+      return 0;
+
+    case 65001:
+      /* Locale encoding is CP65001 = UTF-8.  */
+      {
+        /* Convert "B\303\274\303\237er": "Büßer" */
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x00FC, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\303\274", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x00DF, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\303\237", 2) == 0);
+        ASSERT (buf[2] == 'x');
+      }
+      return 0;
+
+    default:
+      return 1;
+    }
+}
+
+int
+main (int argc, char *argv[])
+{
+  int codepage = atoi (argv[argc - 1]);
+  int result;
+  int i;
+
+  result = 77;
+  for (i = 1; i < argc - 1; i++)
+    {
+      int ret = test_one_locale (argv[i], codepage);
+
+      if (ret != 77)
+        result = ret;
+    }
+
+  if (result == 77)
+    {
+      fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
+               codepage);
+    }
+  return result;
+}
+
+#else
+
+int
+main (int argc, char *argv[])
+{
+  fputs ("Skipping test: not a native Windows system\n", stderr);
+  return 77;
+}
+
+#endif
index 48bae41..a50817f 100644 (file)
@@ -105,6 +105,14 @@ main (int argc, char *argv[])
         }
   }
 
+  /* Test special calling convention, passing a NULL pointer.  */
+  {
+    ret = wcrtomb (NULL, '\0', NULL);
+    ASSERT (ret == 1);
+    ret = wcrtomb (NULL, btowc ('x'), NULL);
+    ASSERT (ret == 1);
+  }
+
   if (argc > 1)
     switch (argv[1][0])
       {
index 9139131..3449c5b 100644 (file)
@@ -1,5 +1,5 @@
 /* Test the Unicode character type functions.
-   Copyright (C) 2007-2010 Free Software Foundation, Inc.
+   Copyright (C) 2007-2011 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 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);
+  ASSERT (uc_bidi_class_byname ("L") == UC_BIDI_L);
+  ASSERT (uc_bidi_class_byname ("LRE") == UC_BIDI_LRE);
+  ASSERT (uc_bidi_class_byname ("LRO") == UC_BIDI_LRO);
+  ASSERT (uc_bidi_class_byname ("R") == UC_BIDI_R);
+  ASSERT (uc_bidi_class_byname ("AL") == UC_BIDI_AL);
+  ASSERT (uc_bidi_class_byname ("RLE") == UC_BIDI_RLE);
+  ASSERT (uc_bidi_class_byname ("RLO") == UC_BIDI_RLO);
+  ASSERT (uc_bidi_class_byname ("PDF") == UC_BIDI_PDF);
+  ASSERT (uc_bidi_class_byname ("EN") == UC_BIDI_EN);
+  ASSERT (uc_bidi_class_byname ("ES") == UC_BIDI_ES);
+  ASSERT (uc_bidi_class_byname ("ET") == UC_BIDI_ET);
+  ASSERT (uc_bidi_class_byname ("AN") == UC_BIDI_AN);
+  ASSERT (uc_bidi_class_byname ("CS") == UC_BIDI_CS);
+  ASSERT (uc_bidi_class_byname ("NSM") == UC_BIDI_NSM);
+  ASSERT (uc_bidi_class_byname ("BN") == UC_BIDI_BN);
+  ASSERT (uc_bidi_class_byname ("B") == UC_BIDI_B);
+  ASSERT (uc_bidi_class_byname ("S") == UC_BIDI_S);
+  ASSERT (uc_bidi_class_byname ("WS") == UC_BIDI_WS);
+  ASSERT (uc_bidi_class_byname ("ON") == UC_BIDI_ON);
+
+  ASSERT (uc_bidi_class_byname ("ARABIC LETTER") == UC_BIDI_AL);
+  ASSERT (uc_bidi_class_byname ("Arabic Letter") == UC_BIDI_AL);
+  ASSERT (uc_bidi_class_byname ("Arabic_Letter") == UC_BIDI_AL);
+  ASSERT (uc_bidi_class_byname ("ArabicLetter") == UC_BIDI_AL);
+  ASSERT (uc_bidi_class_byname ("ARABIC NUMBER") == UC_BIDI_AN);
+  ASSERT (uc_bidi_class_byname ("Arabic Number") == UC_BIDI_AN);
+  ASSERT (uc_bidi_class_byname ("Arabic_Number") == UC_BIDI_AN);
+  ASSERT (uc_bidi_class_byname ("ArabicNumber") == UC_BIDI_AN);
+  ASSERT (uc_bidi_class_byname ("PARAGRAPH SEPARATOR") == UC_BIDI_B);
+  ASSERT (uc_bidi_class_byname ("Paragraph Separator") == UC_BIDI_B);
+  ASSERT (uc_bidi_class_byname ("Paragraph_Separator") == UC_BIDI_B);
+  ASSERT (uc_bidi_class_byname ("ParagraphSeparator") == UC_BIDI_B);
+  ASSERT (uc_bidi_class_byname ("BOUNDARY NEUTRAL") == UC_BIDI_BN);
+  ASSERT (uc_bidi_class_byname ("Boundary Neutral") == UC_BIDI_BN);
+  ASSERT (uc_bidi_class_byname ("Boundary_Neutral") == UC_BIDI_BN);
+  ASSERT (uc_bidi_class_byname ("BoundaryNeutral") == UC_BIDI_BN);
+  ASSERT (uc_bidi_class_byname ("COMMON SEPARATOR") == UC_BIDI_CS);
+  ASSERT (uc_bidi_class_byname ("Common Separator") == UC_BIDI_CS);
+  ASSERT (uc_bidi_class_byname ("Common_Separator") == UC_BIDI_CS);
+  ASSERT (uc_bidi_class_byname ("CommonSeparator") == UC_BIDI_CS);
+  ASSERT (uc_bidi_class_byname ("EUROPEAN NUMBER") == UC_BIDI_EN);
+  ASSERT (uc_bidi_class_byname ("European Number") == UC_BIDI_EN);
+  ASSERT (uc_bidi_class_byname ("European_Number") == UC_BIDI_EN);
+  ASSERT (uc_bidi_class_byname ("EuropeanNumber") == UC_BIDI_EN);
+  ASSERT (uc_bidi_class_byname ("EUROPEAN SEPARATOR") == UC_BIDI_ES);
+  ASSERT (uc_bidi_class_byname ("European Separator") == UC_BIDI_ES);
+  ASSERT (uc_bidi_class_byname ("European_Separator") == UC_BIDI_ES);
+  ASSERT (uc_bidi_class_byname ("EuropeanSeparator") == UC_BIDI_ES);
+  ASSERT (uc_bidi_class_byname ("EUROPEAN TERMINATOR") == UC_BIDI_ET);
+  ASSERT (uc_bidi_class_byname ("European Terminator") == UC_BIDI_ET);
+  ASSERT (uc_bidi_class_byname ("European_Terminator") == UC_BIDI_ET);
+  ASSERT (uc_bidi_class_byname ("EuropeanTerminator") == UC_BIDI_ET);
+  ASSERT (uc_bidi_class_byname ("LEFT TO RIGHT") == UC_BIDI_L);
+  ASSERT (uc_bidi_class_byname ("Left To Right") == UC_BIDI_L);
+  ASSERT (uc_bidi_class_byname ("Left_To_Right") == UC_BIDI_L);
+  ASSERT (uc_bidi_class_byname ("LeftToRight") == UC_BIDI_L);
+  ASSERT (uc_bidi_class_byname ("LEFT TO RIGHT EMBEDDING") == UC_BIDI_LRE);
+  ASSERT (uc_bidi_class_byname ("Left To Right Embedding") == UC_BIDI_LRE);
+  ASSERT (uc_bidi_class_byname ("Left_To_Right_Embedding") == UC_BIDI_LRE);
+  ASSERT (uc_bidi_class_byname ("LeftToRightEmbedding") == UC_BIDI_LRE);
+  ASSERT (uc_bidi_class_byname ("LEFT TO RIGHT OVERRIDE") == UC_BIDI_LRO);
+  ASSERT (uc_bidi_class_byname ("Left To Right Override") == UC_BIDI_LRO);
+  ASSERT (uc_bidi_class_byname ("Left_To_Right_Override") == UC_BIDI_LRO);
+  ASSERT (uc_bidi_class_byname ("LeftToRightOverride") == UC_BIDI_LRO);
+  ASSERT (uc_bidi_class_byname ("NONSPACING MARK") == UC_BIDI_NSM);
+  ASSERT (uc_bidi_class_byname ("Nonspacing Mark") == UC_BIDI_NSM);
+  ASSERT (uc_bidi_class_byname ("Nonspacing_Mark") == UC_BIDI_NSM);
+  ASSERT (uc_bidi_class_byname ("NonspacingMark") == UC_BIDI_NSM);
+  ASSERT (uc_bidi_class_byname ("OTHER NEUTRAL") == UC_BIDI_ON);
+  ASSERT (uc_bidi_class_byname ("Other Neutral") == UC_BIDI_ON);
+  ASSERT (uc_bidi_class_byname ("Other_Neutral") == UC_BIDI_ON);
+  ASSERT (uc_bidi_class_byname ("OtherNeutral") == UC_BIDI_ON);
+  ASSERT (uc_bidi_class_byname ("POP DIRECTIONAL FORMAT") == UC_BIDI_PDF);
+  ASSERT (uc_bidi_class_byname ("Pop Directional Format") == UC_BIDI_PDF);
+  ASSERT (uc_bidi_class_byname ("Pop_Directional_Format") == UC_BIDI_PDF);
+  ASSERT (uc_bidi_class_byname ("PopDirectionalFormat") == UC_BIDI_PDF);
+  ASSERT (uc_bidi_class_byname ("RIGHT TO LEFT") == UC_BIDI_R);
+  ASSERT (uc_bidi_class_byname ("Right To Left") == UC_BIDI_R);
+  ASSERT (uc_bidi_class_byname ("Right_To_Left") == UC_BIDI_R);
+  ASSERT (uc_bidi_class_byname ("RightToLeft") == UC_BIDI_R);
+  ASSERT (uc_bidi_class_byname ("RIGHT TO LEFT EMBEDDING") == UC_BIDI_RLE);
+  ASSERT (uc_bidi_class_byname ("Right To Left Embedding") == UC_BIDI_RLE);
+  ASSERT (uc_bidi_class_byname ("Right_To_Left_Embedding") == UC_BIDI_RLE);
+  ASSERT (uc_bidi_class_byname ("RightToLeftEmbedding") == UC_BIDI_RLE);
+  ASSERT (uc_bidi_class_byname ("RIGHT TO LEFT OVERRIDE") == UC_BIDI_RLO);
+  ASSERT (uc_bidi_class_byname ("Right To Left Override") == UC_BIDI_RLO);
+  ASSERT (uc_bidi_class_byname ("Right_To_Left_Override") == UC_BIDI_RLO);
+  ASSERT (uc_bidi_class_byname ("RightToLeftOverride") == UC_BIDI_RLO);
+  ASSERT (uc_bidi_class_byname ("SEGMENT SEPARATOR") == UC_BIDI_S);
+  ASSERT (uc_bidi_class_byname ("Segment Separator") == UC_BIDI_S);
+  ASSERT (uc_bidi_class_byname ("Segment_Separator") == UC_BIDI_S);
+  ASSERT (uc_bidi_class_byname ("SegmentSeparator") == UC_BIDI_S);
+  ASSERT (uc_bidi_class_byname ("WHITE SPACE") == UC_BIDI_WS);
+  ASSERT (uc_bidi_class_byname ("White Space") == UC_BIDI_WS);
+  ASSERT (uc_bidi_class_byname ("White_Space") == UC_BIDI_WS);
+  ASSERT (uc_bidi_class_byname ("WhiteSpace") == UC_BIDI_WS);
+
+  ASSERT (uc_bidi_class_byname ("X") < 0);
+  ASSERT (uc_bidi_class_byname ("") < 0);
 
   return 0;
 }
diff --git a/tests/unictype/test-bidi_longname.c b/tests/unictype/test-bidi_longname.c
new file mode 100644 (file)
index 0000000..b7618d2
--- /dev/null
@@ -0,0 +1,50 @@
+/* Test the Unicode character type functions.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This 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>
+
+#include "unictype.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_AL), "Arabic Letter") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_AN), "Arabic Number") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_B), "Paragraph Separator") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_BN), "Boundary Neutral") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_CS), "Common Separator") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_EN), "European Number") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_ES), "European Separator") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_ET), "European Terminator") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_L), "Left To Right") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_LRE), "Left To Right Embedding") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_LRO), "Left To Right Override") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_NSM), "Nonspacing Mark") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_ON), "Other Neutral") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_PDF), "Pop Directional Format") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_R), "Right To Left") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_RLE), "Right To Left Embedding") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_RLO), "Right To Left Override") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_S), "Segment Separator") == 0);
+  ASSERT (strcmp (uc_bidi_class_long_name (UC_BIDI_WS), "White Space") == 0);
+  ASSERT (uc_bidi_class_long_name (-1) == NULL);
+
+  return 0;
+}
index 1a4ef0b..03b3674 100644 (file)
@@ -1,5 +1,5 @@
 /* Test the Unicode character type functions.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2009, 2011 Free Software Foundation, Inc.
 
    This 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,8 +25,8 @@
 int
 main ()
 {
-  ASSERT (strcmp (uc_bidi_category_name (UC_BIDI_NSM), "NSM") == 0);
-  ASSERT (uc_bidi_category_name (-1) == NULL);
+  ASSERT (strcmp (uc_bidi_class_name (UC_BIDI_NSM), "NSM") == 0);
+  ASSERT (uc_bidi_class_name (-1) == NULL);
 
   return 0;
 }
index 91fda15..5b7a33d 100644 (file)
@@ -1,5 +1,5 @@
 /* Test the Unicode character type functions.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2009, 2011 Free Software Foundation, Inc.
 
    This 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,9 +25,9 @@
 int
 main ()
 {
-  ASSERT (uc_bidi_category ('x') == UC_BIDI_L);
-  ASSERT (uc_bidi_category (0x05D7) == UC_BIDI_R);
-  ASSERT (uc_bidi_category ('7') == UC_BIDI_EN);
+  ASSERT (uc_bidi_class ('x') == UC_BIDI_L);
+  ASSERT (uc_bidi_class (0x05D7) == UC_BIDI_R);
+  ASSERT (uc_bidi_class ('7') == UC_BIDI_EN);
 
   return 0;
 }
index c9e7b39..908d1b7 100644 (file)
@@ -1,5 +1,5 @@
 /* Test the Unicode character type functions.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2009, 2011 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 int
 main ()
 {
-  ASSERT (uc_is_bidi_category ('x', UC_BIDI_L));
-  ASSERT (!uc_is_bidi_category ('x', UC_BIDI_R));
-  ASSERT (!uc_is_bidi_category ('x', UC_BIDI_EN));
+  ASSERT (uc_is_bidi_class ('x', UC_BIDI_L));
+  ASSERT (!uc_is_bidi_class ('x', UC_BIDI_R));
+  ASSERT (!uc_is_bidi_class ('x', UC_BIDI_EN));
 
-  ASSERT (uc_is_bidi_category (0x05D7, UC_BIDI_R));
-  ASSERT (!uc_is_bidi_category (0x05D7, UC_BIDI_L));
-  ASSERT (!uc_is_bidi_category (0x05D7, UC_BIDI_EN));
+  ASSERT (uc_is_bidi_class (0x05D7, UC_BIDI_R));
+  ASSERT (!uc_is_bidi_class (0x05D7, UC_BIDI_L));
+  ASSERT (!uc_is_bidi_class (0x05D7, UC_BIDI_EN));
 
-  ASSERT (uc_is_bidi_category ('7', UC_BIDI_EN));
-  ASSERT (!uc_is_bidi_category ('7', UC_BIDI_L));
-  ASSERT (!uc_is_bidi_category ('7', UC_BIDI_R));
+  ASSERT (uc_is_bidi_class ('7', UC_BIDI_EN));
+  ASSERT (!uc_is_bidi_class ('7', UC_BIDI_L));
+  ASSERT (!uc_is_bidi_class ('7', UC_BIDI_R));
 
   {
     unsigned int c;
 
     for (c = 0; c < 0x110000; c++)
-      ASSERT (uc_is_bidi_category (c, uc_bidi_category (c)));
+      ASSERT (uc_is_bidi_class (c, uc_bidi_class (c)));
   }
 
   return 0;
diff --git a/tests/unictype/test-categ_LC.c b/tests/unictype/test-categ_LC.c
new file mode 100644 (file)
index 0000000..7dcadaf
--- /dev/null
@@ -0,0 +1,132 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Test the Unicode character type functions.
+   Copyright (C) 2007 Free Software Foundation, Inc.
+
+   This 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 "test-predicate-part1.h"
+
+    { 0x0041, 0x005A },
+    { 0x0061, 0x007A },
+    { 0x00AA, 0x00AA },
+    { 0x00B5, 0x00B5 },
+    { 0x00BA, 0x00BA },
+    { 0x00C0, 0x00D6 },
+    { 0x00D8, 0x00F6 },
+    { 0x00F8, 0x01BA },
+    { 0x01BC, 0x01BF },
+    { 0x01C4, 0x0293 },
+    { 0x0295, 0x02AF },
+    { 0x0370, 0x0373 },
+    { 0x0376, 0x0377 },
+    { 0x037B, 0x037D },
+    { 0x0386, 0x0386 },
+    { 0x0388, 0x038A },
+    { 0x038C, 0x038C },
+    { 0x038E, 0x03A1 },
+    { 0x03A3, 0x03F5 },
+    { 0x03F7, 0x0481 },
+    { 0x048A, 0x0527 },
+    { 0x0531, 0x0556 },
+    { 0x0561, 0x0587 },
+    { 0x10A0, 0x10C5 },
+    { 0x1D00, 0x1D2B },
+    { 0x1D62, 0x1D77 },
+    { 0x1D79, 0x1D9A },
+    { 0x1E00, 0x1F15 },
+    { 0x1F18, 0x1F1D },
+    { 0x1F20, 0x1F45 },
+    { 0x1F48, 0x1F4D },
+    { 0x1F50, 0x1F57 },
+    { 0x1F59, 0x1F59 },
+    { 0x1F5B, 0x1F5B },
+    { 0x1F5D, 0x1F5D },
+    { 0x1F5F, 0x1F7D },
+    { 0x1F80, 0x1FB4 },
+    { 0x1FB6, 0x1FBC },
+    { 0x1FBE, 0x1FBE },
+    { 0x1FC2, 0x1FC4 },
+    { 0x1FC6, 0x1FCC },
+    { 0x1FD0, 0x1FD3 },
+    { 0x1FD6, 0x1FDB },
+    { 0x1FE0, 0x1FEC },
+    { 0x1FF2, 0x1FF4 },
+    { 0x1FF6, 0x1FFC },
+    { 0x2102, 0x2102 },
+    { 0x2107, 0x2107 },
+    { 0x210A, 0x2113 },
+    { 0x2115, 0x2115 },
+    { 0x2119, 0x211D },
+    { 0x2124, 0x2124 },
+    { 0x2126, 0x2126 },
+    { 0x2128, 0x2128 },
+    { 0x212A, 0x212D },
+    { 0x212F, 0x2134 },
+    { 0x2139, 0x2139 },
+    { 0x213C, 0x213F },
+    { 0x2145, 0x2149 },
+    { 0x214E, 0x214E },
+    { 0x2183, 0x2184 },
+    { 0x2C00, 0x2C2E },
+    { 0x2C30, 0x2C5E },
+    { 0x2C60, 0x2C7C },
+    { 0x2C7E, 0x2CE4 },
+    { 0x2CEB, 0x2CEE },
+    { 0x2D00, 0x2D25 },
+    { 0xA640, 0xA66D },
+    { 0xA680, 0xA697 },
+    { 0xA722, 0xA76F },
+    { 0xA771, 0xA787 },
+    { 0xA78B, 0xA78E },
+    { 0xA790, 0xA791 },
+    { 0xA7A0, 0xA7A9 },
+    { 0xA7FA, 0xA7FA },
+    { 0xFB00, 0xFB06 },
+    { 0xFB13, 0xFB17 },
+    { 0xFF21, 0xFF3A },
+    { 0xFF41, 0xFF5A },
+    { 0x10400, 0x1044F },
+    { 0x1D400, 0x1D454 },
+    { 0x1D456, 0x1D49C },
+    { 0x1D49E, 0x1D49F },
+    { 0x1D4A2, 0x1D4A2 },
+    { 0x1D4A5, 0x1D4A6 },
+    { 0x1D4A9, 0x1D4AC },
+    { 0x1D4AE, 0x1D4B9 },
+    { 0x1D4BB, 0x1D4BB },
+    { 0x1D4BD, 0x1D4C3 },
+    { 0x1D4C5, 0x1D505 },
+    { 0x1D507, 0x1D50A },
+    { 0x1D50D, 0x1D514 },
+    { 0x1D516, 0x1D51C },
+    { 0x1D51E, 0x1D539 },
+    { 0x1D53B, 0x1D53E },
+    { 0x1D540, 0x1D544 },
+    { 0x1D546, 0x1D546 },
+    { 0x1D54A, 0x1D550 },
+    { 0x1D552, 0x1D6A5 },
+    { 0x1D6A8, 0x1D6C0 },
+    { 0x1D6C2, 0x1D6DA },
+    { 0x1D6DC, 0x1D6FA },
+    { 0x1D6FC, 0x1D714 },
+    { 0x1D716, 0x1D734 },
+    { 0x1D736, 0x1D74E },
+    { 0x1D750, 0x1D76E },
+    { 0x1D770, 0x1D788 },
+    { 0x1D78A, 0x1D7A8 },
+    { 0x1D7AA, 0x1D7C2 },
+    { 0x1D7C4, 0x1D7CB }
+
+#define PREDICATE(c) uc_is_general_category (c, UC_CATEGORY_LC)
+#include "test-predicate-part2.h"
index 0da1625..b07962a 100644 (file)
@@ -1,5 +1,5 @@
 /* Test the Unicode character type functions.
-   Copyright (C) 2007-2010 Free Software Foundation, Inc.
+   Copyright (C) 2007-2011 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -38,6 +38,7 @@ int
 main ()
 {
   ASSERT (category_equals (uc_general_category_byname ("L"), UC_CATEGORY_L));
+  ASSERT (category_equals (uc_general_category_byname ("LC"), UC_CATEGORY_LC));
   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));
@@ -75,6 +76,137 @@ main ()
   ASSERT (category_equals (uc_general_category_byname ("Co"), UC_CATEGORY_Co));
   ASSERT (category_equals (uc_general_category_byname ("Cn"), UC_CATEGORY_Cn));
 
+  ASSERT (category_equals (uc_general_category_byname ("LETTER"), UC_CATEGORY_L));
+  ASSERT (category_equals (uc_general_category_byname ("Letter"), UC_CATEGORY_L));
+  ASSERT (category_equals (uc_general_category_byname ("CASED LETTER"), UC_CATEGORY_LC));
+  ASSERT (category_equals (uc_general_category_byname ("Cased Letter"), UC_CATEGORY_LC));
+  ASSERT (category_equals (uc_general_category_byname ("Cased_Letter"), UC_CATEGORY_LC));
+  ASSERT (category_equals (uc_general_category_byname ("CasedLetter"), UC_CATEGORY_LC));
+  ASSERT (category_equals (uc_general_category_byname ("UPPERCASE LETTER"), UC_CATEGORY_Lu));
+  ASSERT (category_equals (uc_general_category_byname ("Uppercase Letter"), UC_CATEGORY_Lu));
+  ASSERT (category_equals (uc_general_category_byname ("Uppercase_Letter"), UC_CATEGORY_Lu));
+  ASSERT (category_equals (uc_general_category_byname ("UppercaseLetter"), UC_CATEGORY_Lu));
+  ASSERT (category_equals (uc_general_category_byname ("LOWERCASE LETTER"), UC_CATEGORY_Ll));
+  ASSERT (category_equals (uc_general_category_byname ("Lowercase Letter"), UC_CATEGORY_Ll));
+  ASSERT (category_equals (uc_general_category_byname ("Lowercase_Letter"), UC_CATEGORY_Ll));
+  ASSERT (category_equals (uc_general_category_byname ("LowercaseLetter"), UC_CATEGORY_Ll));
+  ASSERT (category_equals (uc_general_category_byname ("TITLECASE LETTER"), UC_CATEGORY_Lt));
+  ASSERT (category_equals (uc_general_category_byname ("Titlecase Letter"), UC_CATEGORY_Lt));
+  ASSERT (category_equals (uc_general_category_byname ("Titlecase_Letter"), UC_CATEGORY_Lt));
+  ASSERT (category_equals (uc_general_category_byname ("TitlecaseLetter"), UC_CATEGORY_Lt));
+  ASSERT (category_equals (uc_general_category_byname ("MODIFIER LETTER"), UC_CATEGORY_Lm));
+  ASSERT (category_equals (uc_general_category_byname ("Modifier Letter"), UC_CATEGORY_Lm));
+  ASSERT (category_equals (uc_general_category_byname ("Modifier_Letter"), UC_CATEGORY_Lm));
+  ASSERT (category_equals (uc_general_category_byname ("ModifierLetter"), UC_CATEGORY_Lm));
+  ASSERT (category_equals (uc_general_category_byname ("OTHER LETTER"), UC_CATEGORY_Lo));
+  ASSERT (category_equals (uc_general_category_byname ("Other Letter"), UC_CATEGORY_Lo));
+  ASSERT (category_equals (uc_general_category_byname ("Other_Letter"), UC_CATEGORY_Lo));
+  ASSERT (category_equals (uc_general_category_byname ("OtherLetter"), UC_CATEGORY_Lo));
+  ASSERT (category_equals (uc_general_category_byname ("MARK"), UC_CATEGORY_M));
+  ASSERT (category_equals (uc_general_category_byname ("Mark"), UC_CATEGORY_M));
+  ASSERT (category_equals (uc_general_category_byname ("NONSPACING MARK"), UC_CATEGORY_Mn));
+  ASSERT (category_equals (uc_general_category_byname ("Nonspacing Mark"), UC_CATEGORY_Mn));
+  ASSERT (category_equals (uc_general_category_byname ("Nonspacing_Mark"), UC_CATEGORY_Mn));
+  ASSERT (category_equals (uc_general_category_byname ("NonspacingMark"), UC_CATEGORY_Mn));
+  ASSERT (category_equals (uc_general_category_byname ("SPACING MARK"), UC_CATEGORY_Mc));
+  ASSERT (category_equals (uc_general_category_byname ("Spacing Mark"), UC_CATEGORY_Mc));
+  ASSERT (category_equals (uc_general_category_byname ("Spacing_Mark"), UC_CATEGORY_Mc));
+  ASSERT (category_equals (uc_general_category_byname ("SpacingMark"), UC_CATEGORY_Mc));
+  ASSERT (category_equals (uc_general_category_byname ("ENCLOSING MARK"), UC_CATEGORY_Me));
+  ASSERT (category_equals (uc_general_category_byname ("Enclosing Mark"), UC_CATEGORY_Me));
+  ASSERT (category_equals (uc_general_category_byname ("Enclosing_Mark"), UC_CATEGORY_Me));
+  ASSERT (category_equals (uc_general_category_byname ("EnclosingMark"), UC_CATEGORY_Me));
+  ASSERT (category_equals (uc_general_category_byname ("NUMBER"), UC_CATEGORY_N));
+  ASSERT (category_equals (uc_general_category_byname ("Number"), UC_CATEGORY_N));
+  ASSERT (category_equals (uc_general_category_byname ("DECIMAL NUMBER"), UC_CATEGORY_Nd));
+  ASSERT (category_equals (uc_general_category_byname ("Decimal Number"), UC_CATEGORY_Nd));
+  ASSERT (category_equals (uc_general_category_byname ("Decimal_Number"), UC_CATEGORY_Nd));
+  ASSERT (category_equals (uc_general_category_byname ("DecimalNumber"), UC_CATEGORY_Nd));
+  ASSERT (category_equals (uc_general_category_byname ("LETTER NUMBER"), UC_CATEGORY_Nl));
+  ASSERT (category_equals (uc_general_category_byname ("Letter Number"), UC_CATEGORY_Nl));
+  ASSERT (category_equals (uc_general_category_byname ("Letter_Number"), UC_CATEGORY_Nl));
+  ASSERT (category_equals (uc_general_category_byname ("LetterNumber"), UC_CATEGORY_Nl));
+  ASSERT (category_equals (uc_general_category_byname ("OTHER NUMBER"), UC_CATEGORY_No));
+  ASSERT (category_equals (uc_general_category_byname ("Other Number"), UC_CATEGORY_No));
+  ASSERT (category_equals (uc_general_category_byname ("Other_Number"), UC_CATEGORY_No));
+  ASSERT (category_equals (uc_general_category_byname ("OtherNumber"), UC_CATEGORY_No));
+  ASSERT (category_equals (uc_general_category_byname ("PUNCTUATION"), UC_CATEGORY_P));
+  ASSERT (category_equals (uc_general_category_byname ("Punctuation"), UC_CATEGORY_P));
+  ASSERT (category_equals (uc_general_category_byname ("CONNECTOR PUNCTUATION"), UC_CATEGORY_Pc));
+  ASSERT (category_equals (uc_general_category_byname ("Connector Punctuation"), UC_CATEGORY_Pc));
+  ASSERT (category_equals (uc_general_category_byname ("Connector_Punctuation"), UC_CATEGORY_Pc));
+  ASSERT (category_equals (uc_general_category_byname ("ConnectorPunctuation"), UC_CATEGORY_Pc));
+  ASSERT (category_equals (uc_general_category_byname ("DASH PUNCTUATION"), UC_CATEGORY_Pd));
+  ASSERT (category_equals (uc_general_category_byname ("Dash Punctuation"), UC_CATEGORY_Pd));
+  ASSERT (category_equals (uc_general_category_byname ("Dash_Punctuation"), UC_CATEGORY_Pd));
+  ASSERT (category_equals (uc_general_category_byname ("DashPunctuation"), UC_CATEGORY_Pd));
+  ASSERT (category_equals (uc_general_category_byname ("OPEN PUNCTUATION"), UC_CATEGORY_Ps));
+  ASSERT (category_equals (uc_general_category_byname ("Open Punctuation"), UC_CATEGORY_Ps));
+  ASSERT (category_equals (uc_general_category_byname ("Open_Punctuation"), UC_CATEGORY_Ps));
+  ASSERT (category_equals (uc_general_category_byname ("OpenPunctuation"), UC_CATEGORY_Ps));
+  ASSERT (category_equals (uc_general_category_byname ("CLOSE PUNCTUATION"), UC_CATEGORY_Pe));
+  ASSERT (category_equals (uc_general_category_byname ("Close Punctuation"), UC_CATEGORY_Pe));
+  ASSERT (category_equals (uc_general_category_byname ("Close_Punctuation"), UC_CATEGORY_Pe));
+  ASSERT (category_equals (uc_general_category_byname ("ClosePunctuation"), UC_CATEGORY_Pe));
+  ASSERT (category_equals (uc_general_category_byname ("INITIAL PUNCTUATION"), UC_CATEGORY_Pi));
+  ASSERT (category_equals (uc_general_category_byname ("Initial Punctuation"), UC_CATEGORY_Pi));
+  ASSERT (category_equals (uc_general_category_byname ("Initial_Punctuation"), UC_CATEGORY_Pi));
+  ASSERT (category_equals (uc_general_category_byname ("InitialPunctuation"), UC_CATEGORY_Pi));
+  ASSERT (category_equals (uc_general_category_byname ("FINAL PUNCTUATION"), UC_CATEGORY_Pf));
+  ASSERT (category_equals (uc_general_category_byname ("Final Punctuation"), UC_CATEGORY_Pf));
+  ASSERT (category_equals (uc_general_category_byname ("Final_Punctuation"), UC_CATEGORY_Pf));
+  ASSERT (category_equals (uc_general_category_byname ("FinalPunctuation"), UC_CATEGORY_Pf));
+  ASSERT (category_equals (uc_general_category_byname ("OTHER PUNCTUATION"), UC_CATEGORY_Po));
+  ASSERT (category_equals (uc_general_category_byname ("Other Punctuation"), UC_CATEGORY_Po));
+  ASSERT (category_equals (uc_general_category_byname ("Other_Punctuation"), UC_CATEGORY_Po));
+  ASSERT (category_equals (uc_general_category_byname ("OtherPunctuation"), UC_CATEGORY_Po));
+  ASSERT (category_equals (uc_general_category_byname ("SYMBOL"), UC_CATEGORY_S));
+  ASSERT (category_equals (uc_general_category_byname ("Symbol"), UC_CATEGORY_S));
+  ASSERT (category_equals (uc_general_category_byname ("MATH SYMBOL"), UC_CATEGORY_Sm));
+  ASSERT (category_equals (uc_general_category_byname ("Math Symbol"), UC_CATEGORY_Sm));
+  ASSERT (category_equals (uc_general_category_byname ("Math_Symbol"), UC_CATEGORY_Sm));
+  ASSERT (category_equals (uc_general_category_byname ("MathSymbol"), UC_CATEGORY_Sm));
+  ASSERT (category_equals (uc_general_category_byname ("CURRENCY SYMBOL"), UC_CATEGORY_Sc));
+  ASSERT (category_equals (uc_general_category_byname ("Currency Symbol"), UC_CATEGORY_Sc));
+  ASSERT (category_equals (uc_general_category_byname ("Currency_Symbol"), UC_CATEGORY_Sc));
+  ASSERT (category_equals (uc_general_category_byname ("CurrencySymbol"), UC_CATEGORY_Sc));
+  ASSERT (category_equals (uc_general_category_byname ("MODIFIER SYMBOL"), UC_CATEGORY_Sk));
+  ASSERT (category_equals (uc_general_category_byname ("Modifier Symbol"), UC_CATEGORY_Sk));
+  ASSERT (category_equals (uc_general_category_byname ("Modifier_Symbol"), UC_CATEGORY_Sk));
+  ASSERT (category_equals (uc_general_category_byname ("ModifierSymbol"), UC_CATEGORY_Sk));
+  ASSERT (category_equals (uc_general_category_byname ("OTHER SYMBOL"), UC_CATEGORY_So));
+  ASSERT (category_equals (uc_general_category_byname ("Other Symbol"), UC_CATEGORY_So));
+  ASSERT (category_equals (uc_general_category_byname ("Other_Symbol"), UC_CATEGORY_So));
+  ASSERT (category_equals (uc_general_category_byname ("OtherSymbol"), UC_CATEGORY_So));
+  ASSERT (category_equals (uc_general_category_byname ("SEPARATOR"), UC_CATEGORY_Z));
+  ASSERT (category_equals (uc_general_category_byname ("Separator"), UC_CATEGORY_Z));
+  ASSERT (category_equals (uc_general_category_byname ("SPACE SEPARATOR"), UC_CATEGORY_Zs));
+  ASSERT (category_equals (uc_general_category_byname ("Space Separator"), UC_CATEGORY_Zs));
+  ASSERT (category_equals (uc_general_category_byname ("Space_Separator"), UC_CATEGORY_Zs));
+  ASSERT (category_equals (uc_general_category_byname ("SpaceSeparator"), UC_CATEGORY_Zs));
+  ASSERT (category_equals (uc_general_category_byname ("LINE SEPARATOR"), UC_CATEGORY_Zl));
+  ASSERT (category_equals (uc_general_category_byname ("Line Separator"), UC_CATEGORY_Zl));
+  ASSERT (category_equals (uc_general_category_byname ("Line_Separator"), UC_CATEGORY_Zl));
+  ASSERT (category_equals (uc_general_category_byname ("LineSeparator"), UC_CATEGORY_Zl));
+  ASSERT (category_equals (uc_general_category_byname ("PARAGRAPH SEPARATOR"), UC_CATEGORY_Zp));
+  ASSERT (category_equals (uc_general_category_byname ("Paragraph Separator"), UC_CATEGORY_Zp));
+  ASSERT (category_equals (uc_general_category_byname ("Paragraph_Separator"), UC_CATEGORY_Zp));
+  ASSERT (category_equals (uc_general_category_byname ("ParagraphSeparator"), UC_CATEGORY_Zp));
+  ASSERT (category_equals (uc_general_category_byname ("OTHER"), UC_CATEGORY_C));
+  ASSERT (category_equals (uc_general_category_byname ("Other"), UC_CATEGORY_C));
+  ASSERT (category_equals (uc_general_category_byname ("CONTROL"), UC_CATEGORY_Cc));
+  ASSERT (category_equals (uc_general_category_byname ("Control"), UC_CATEGORY_Cc));
+  ASSERT (category_equals (uc_general_category_byname ("FORMAT"), UC_CATEGORY_Cf));
+  ASSERT (category_equals (uc_general_category_byname ("Format"), UC_CATEGORY_Cf));
+  ASSERT (category_equals (uc_general_category_byname ("SURROGATE"), UC_CATEGORY_Cs));
+  ASSERT (category_equals (uc_general_category_byname ("Surrogate"), UC_CATEGORY_Cs));
+  ASSERT (category_equals (uc_general_category_byname ("PRIVATE USE"), UC_CATEGORY_Co));
+  ASSERT (category_equals (uc_general_category_byname ("Private Use"), UC_CATEGORY_Co));
+  ASSERT (category_equals (uc_general_category_byname ("Private_Use"), UC_CATEGORY_Co));
+  ASSERT (category_equals (uc_general_category_byname ("PrivateUse"), UC_CATEGORY_Co));
+  ASSERT (category_equals (uc_general_category_byname ("UNASSIGNED"), UC_CATEGORY_Cn));
+  ASSERT (category_equals (uc_general_category_byname ("Unassigned"), UC_CATEGORY_Cn));
+
   uc_general_category_byname ("Nl");
 
   {
diff --git a/tests/unictype/test-categ_longname.c b/tests/unictype/test-categ_longname.c
new file mode 100644 (file)
index 0000000..bd6630e
--- /dev/null
@@ -0,0 +1,33 @@
+/* Test the Unicode character type functions.
+   Copyright (C) 2007-2009, 2011 Free Software Foundation, Inc.
+
+   This 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>
+
+#include "unictype.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  ASSERT (strcmp (uc_general_category_long_name (UC_CATEGORY_Z), "Separator") == 0);
+  ASSERT (strcmp (uc_general_category_long_name (UC_CATEGORY_Nl), "Letter Number") == 0);
+  ASSERT (uc_general_category_long_name (uc_general_category_or (UC_CATEGORY_Z, UC_CATEGORY_Nl)) == NULL);
+
+  return 0;
+}
diff --git a/tests/unictype/test-combining.c b/tests/unictype/test-combining.c
deleted file mode 100644 (file)
index d890f1d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Test the Unicode character type functions.
-   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/>.  */
-
-#include <config.h>
-
-#include "unictype.h"
-
-#include <string.h>
-
-#include "macros.h"
-
-int
-main ()
-{
-  ASSERT (uc_combining_class ('x') == UC_CCC_NR);
-  ASSERT (uc_combining_class (0x0300) == UC_CCC_A);
-  ASSERT (uc_combining_class (0x0319) == UC_CCC_B);
-  ASSERT (uc_combining_class (0x0327) == UC_CCC_ATB);
-  ASSERT (uc_combining_class (0x093C) == UC_CCC_NK);
-
-  return 0;
-}
diff --git a/tests/unictype/test-combiningclass.c b/tests/unictype/test-combiningclass.c
new file mode 100644 (file)
index 0000000..d890f1d
--- /dev/null
@@ -0,0 +1,35 @@
+/* Test the Unicode character type functions.
+   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/>.  */
+
+#include <config.h>
+
+#include "unictype.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  ASSERT (uc_combining_class ('x') == UC_CCC_NR);
+  ASSERT (uc_combining_class (0x0300) == UC_CCC_A);
+  ASSERT (uc_combining_class (0x0319) == UC_CCC_B);
+  ASSERT (uc_combining_class (0x0327) == UC_CCC_ATB);
+  ASSERT (uc_combining_class (0x093C) == UC_CCC_NK);
+
+  return 0;
+}
diff --git a/tests/unictype/test-combiningclass_byname.c b/tests/unictype/test-combiningclass_byname.c
new file mode 100644 (file)
index 0000000..157fa57
--- /dev/null
@@ -0,0 +1,118 @@
+/* Test the Unicode character Arabic joining group functions.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  ASSERT (uc_combining_class_byname ("NR") == UC_CCC_NR);
+  ASSERT (uc_combining_class_byname ("OV") == UC_CCC_OV);
+  ASSERT (uc_combining_class_byname ("NK") == UC_CCC_NK);
+  ASSERT (uc_combining_class_byname ("KV") == UC_CCC_KV);
+  ASSERT (uc_combining_class_byname ("VR") == UC_CCC_VR);
+  ASSERT (uc_combining_class_byname ("ATBL") == UC_CCC_ATBL);
+  ASSERT (uc_combining_class_byname ("ATB") == UC_CCC_ATB);
+  ASSERT (uc_combining_class_byname ("ATA") == UC_CCC_ATA);
+  ASSERT (uc_combining_class_byname ("ATAR") == UC_CCC_ATAR);
+  ASSERT (uc_combining_class_byname ("BL") == UC_CCC_BL);
+  ASSERT (uc_combining_class_byname ("B") == UC_CCC_B);
+  ASSERT (uc_combining_class_byname ("BR") == UC_CCC_BR);
+  ASSERT (uc_combining_class_byname ("L") == UC_CCC_L);
+  ASSERT (uc_combining_class_byname ("R") == UC_CCC_R);
+  ASSERT (uc_combining_class_byname ("AL") == UC_CCC_AL);
+  ASSERT (uc_combining_class_byname ("A") == UC_CCC_A);
+  ASSERT (uc_combining_class_byname ("AR") == UC_CCC_AR);
+  ASSERT (uc_combining_class_byname ("DB") == UC_CCC_DB);
+  ASSERT (uc_combining_class_byname ("DA") == UC_CCC_DA);
+  ASSERT (uc_combining_class_byname ("IS") == UC_CCC_IS);
+
+  ASSERT (uc_combining_class_byname ("NOT REORDERED") == UC_CCC_NR);
+  ASSERT (uc_combining_class_byname ("Not Reordered") == UC_CCC_NR);
+  ASSERT (uc_combining_class_byname ("Not_Reordered") == UC_CCC_NR);
+  ASSERT (uc_combining_class_byname ("NotReordered") == UC_CCC_NR);
+  ASSERT (uc_combining_class_byname ("OVERLAY") == UC_CCC_OV);
+  ASSERT (uc_combining_class_byname ("Overlay") == UC_CCC_OV);
+  ASSERT (uc_combining_class_byname ("NUKTA") == UC_CCC_NK);
+  ASSERT (uc_combining_class_byname ("Nukta") == UC_CCC_NK);
+  ASSERT (uc_combining_class_byname ("KANA VOICING") == UC_CCC_KV);
+  ASSERT (uc_combining_class_byname ("Kana Voicing") == UC_CCC_KV);
+  ASSERT (uc_combining_class_byname ("Kana_Voicing") == UC_CCC_KV);
+  ASSERT (uc_combining_class_byname ("KanaVoicing") == UC_CCC_KV);
+  ASSERT (uc_combining_class_byname ("VIRAMA") == UC_CCC_VR);
+  ASSERT (uc_combining_class_byname ("Virama") == UC_CCC_VR);
+  ASSERT (uc_combining_class_byname ("ATTACHED BELOW LEFT") == UC_CCC_ATBL);
+  ASSERT (uc_combining_class_byname ("Attached Below Left") == UC_CCC_ATBL);
+  ASSERT (uc_combining_class_byname ("Attached_Below_Left") == UC_CCC_ATBL);
+  ASSERT (uc_combining_class_byname ("AttachedBelowLeft") == UC_CCC_ATBL);
+  ASSERT (uc_combining_class_byname ("ATTACHED BELOW") == UC_CCC_ATB);
+  ASSERT (uc_combining_class_byname ("Attached Below") == UC_CCC_ATB);
+  ASSERT (uc_combining_class_byname ("Attached_Below") == UC_CCC_ATB);
+  ASSERT (uc_combining_class_byname ("AttachedBelow") == UC_CCC_ATB);
+  ASSERT (uc_combining_class_byname ("ATTACHED ABOVE") == UC_CCC_ATA);
+  ASSERT (uc_combining_class_byname ("Attached Above") == UC_CCC_ATA);
+  ASSERT (uc_combining_class_byname ("Attached_Above") == UC_CCC_ATA);
+  ASSERT (uc_combining_class_byname ("AttachedAbove") == UC_CCC_ATA);
+  ASSERT (uc_combining_class_byname ("ATTACHED ABOVE RIGHT") == UC_CCC_ATAR);
+  ASSERT (uc_combining_class_byname ("Attached Above Right") == UC_CCC_ATAR);
+  ASSERT (uc_combining_class_byname ("Attached_Above_Right") == UC_CCC_ATAR);
+  ASSERT (uc_combining_class_byname ("AttachedAboveRight") == UC_CCC_ATAR);
+  ASSERT (uc_combining_class_byname ("BELOW LEFT") == UC_CCC_BL);
+  ASSERT (uc_combining_class_byname ("Below Left") == UC_CCC_BL);
+  ASSERT (uc_combining_class_byname ("Below_Left") == UC_CCC_BL);
+  ASSERT (uc_combining_class_byname ("BelowLeft") == UC_CCC_BL);
+  ASSERT (uc_combining_class_byname ("BELOW") == UC_CCC_B);
+  ASSERT (uc_combining_class_byname ("Below") == UC_CCC_B);
+  ASSERT (uc_combining_class_byname ("BELOW RIGHT") == UC_CCC_BR);
+  ASSERT (uc_combining_class_byname ("Below Right") == UC_CCC_BR);
+  ASSERT (uc_combining_class_byname ("Below_Right") == UC_CCC_BR);
+  ASSERT (uc_combining_class_byname ("BelowRight") == UC_CCC_BR);
+  ASSERT (uc_combining_class_byname ("LEFT") == UC_CCC_L);
+  ASSERT (uc_combining_class_byname ("Left") == UC_CCC_L);
+  ASSERT (uc_combining_class_byname ("RIGHT") == UC_CCC_R);
+  ASSERT (uc_combining_class_byname ("Right") == UC_CCC_R);
+  ASSERT (uc_combining_class_byname ("ABOVE LEFT") == UC_CCC_AL);
+  ASSERT (uc_combining_class_byname ("Above Left") == UC_CCC_AL);
+  ASSERT (uc_combining_class_byname ("Above_Left") == UC_CCC_AL);
+  ASSERT (uc_combining_class_byname ("AboveLeft") == UC_CCC_AL);
+  ASSERT (uc_combining_class_byname ("ABOVE") == UC_CCC_A);
+  ASSERT (uc_combining_class_byname ("ABOVE RIGHT") == UC_CCC_AR);
+  ASSERT (uc_combining_class_byname ("Above Right") == UC_CCC_AR);
+  ASSERT (uc_combining_class_byname ("Above_Right") == UC_CCC_AR);
+  ASSERT (uc_combining_class_byname ("AboveRight") == UC_CCC_AR);
+  ASSERT (uc_combining_class_byname ("DOUBLE BELOW") == UC_CCC_DB);
+  ASSERT (uc_combining_class_byname ("Double Below") == UC_CCC_DB);
+  ASSERT (uc_combining_class_byname ("Double_Below") == UC_CCC_DB);
+  ASSERT (uc_combining_class_byname ("DoubleBelow") == UC_CCC_DB);
+  ASSERT (uc_combining_class_byname ("DOUBLE ABOVE") == UC_CCC_DA);
+  ASSERT (uc_combining_class_byname ("Double Above") == UC_CCC_DA);
+  ASSERT (uc_combining_class_byname ("Double_Above") == UC_CCC_DA);
+  ASSERT (uc_combining_class_byname ("DoubleAbove") == UC_CCC_DA);
+  ASSERT (uc_combining_class_byname ("IOTA SUBSCRIPT") == UC_CCC_IS);
+  ASSERT (uc_combining_class_byname ("Iota Subscript") == UC_CCC_IS);
+  ASSERT (uc_combining_class_byname ("Iota_Subscript") == UC_CCC_IS);
+  ASSERT (uc_combining_class_byname ("IotaSubscript") == UC_CCC_IS);
+
+  return 0;
+}
diff --git a/tests/unictype/test-combiningclass_longname.c b/tests/unictype/test-combiningclass_longname.c
new file mode 100644 (file)
index 0000000..7de89b8
--- /dev/null
@@ -0,0 +1,53 @@
+/* Test the Unicode character type functions.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This 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>
+
+#include "unictype.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_NR), "Not Reordered") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_OV), "Overlay") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_NK), "Nukta") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_KV), "Kana Voicing") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_VR), "Virama") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_ATBL), "Attached Below Left") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_ATB), "Attached Below") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_ATA), "Attached Above") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_ATAR), "Attached Above Right") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_BL), "Below Left") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_B), "Below") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_BR), "Below Right") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_L), "Left") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_R), "Right") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_AL), "Above Left") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_A), "Above") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_AR), "Above Right") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_DB), "Double Below") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_DA), "Double Above") == 0);
+  ASSERT (strcmp (uc_combining_class_long_name (UC_CCC_IS), "Iota Subscript") == 0);
+  ASSERT (uc_combining_class_long_name (-5) == NULL);
+  ASSERT (uc_combining_class_long_name (163) == NULL);
+  ASSERT (uc_combining_class_long_name (255) == NULL);
+
+  return 0;
+}
diff --git a/tests/unictype/test-combiningclass_name.c b/tests/unictype/test-combiningclass_name.c
new file mode 100644 (file)
index 0000000..02420ff
--- /dev/null
@@ -0,0 +1,53 @@
+/* Test the Unicode character type functions.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This 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>
+
+#include "unictype.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_NR), "NR") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_OV), "OV") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_NK), "NK") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_KV), "KV") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_VR), "VR") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_ATBL), "ATBL") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_ATB), "ATB") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_ATA), "ATA") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_ATAR), "ATAR") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_BL), "BL") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_B), "B") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_BR), "BR") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_L), "L") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_R), "R") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_AL), "AL") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_A), "A") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_AR), "AR") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_DB), "DB") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_DA), "DA") == 0);
+  ASSERT (strcmp (uc_combining_class_name (UC_CCC_IS), "IS") == 0);
+  ASSERT (uc_combining_class_name (-5) == NULL);
+  ASSERT (uc_combining_class_name (163) == NULL);
+  ASSERT (uc_combining_class_name (255) == NULL);
+
+  return 0;
+}
diff --git a/tests/unictype/test-joininggroup_byname.c b/tests/unictype/test-joininggroup_byname.c
new file mode 100644 (file)
index 0000000..9f2119a
--- /dev/null
@@ -0,0 +1,178 @@
+/* Test the Unicode character Arabic joining group functions.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  ASSERT (uc_joining_group_byname ("NO JOINING GROUP") == UC_JOINING_GROUP_NONE);
+  ASSERT (uc_joining_group_byname ("No Joining Group") == UC_JOINING_GROUP_NONE);
+  ASSERT (uc_joining_group_byname ("No_Joining_Group") == UC_JOINING_GROUP_NONE);
+  ASSERT (uc_joining_group_byname ("NoJoiningGroup") == UC_JOINING_GROUP_NONE);
+  ASSERT (uc_joining_group_byname ("AIN") == UC_JOINING_GROUP_AIN);
+  ASSERT (uc_joining_group_byname ("Ain") == UC_JOINING_GROUP_AIN);
+  ASSERT (uc_joining_group_byname ("ALAPH") == UC_JOINING_GROUP_ALAPH);
+  ASSERT (uc_joining_group_byname ("Alaph") == UC_JOINING_GROUP_ALAPH);
+  ASSERT (uc_joining_group_byname ("ALEF") == UC_JOINING_GROUP_ALEF);
+  ASSERT (uc_joining_group_byname ("Alef") == UC_JOINING_GROUP_ALEF);
+  ASSERT (uc_joining_group_byname ("BEH") == UC_JOINING_GROUP_BEH);
+  ASSERT (uc_joining_group_byname ("Beh") == UC_JOINING_GROUP_BEH);
+  ASSERT (uc_joining_group_byname ("BETH") == UC_JOINING_GROUP_BETH);
+  ASSERT (uc_joining_group_byname ("Beth") == UC_JOINING_GROUP_BETH);
+  ASSERT (uc_joining_group_byname ("BURUSHASKI YEH BARREE") == UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE);
+  ASSERT (uc_joining_group_byname ("Burushaski Yeh Barree") == UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE);
+  ASSERT (uc_joining_group_byname ("Burushaski_Yeh_Barree") == UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE);
+  ASSERT (uc_joining_group_byname ("BurushaskiYehBarree") == UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE);
+  ASSERT (uc_joining_group_byname ("DAL") == UC_JOINING_GROUP_DAL);
+  ASSERT (uc_joining_group_byname ("Dal") == UC_JOINING_GROUP_DAL);
+  ASSERT (uc_joining_group_byname ("DALATH RISH") == UC_JOINING_GROUP_DALATH_RISH);
+  ASSERT (uc_joining_group_byname ("Dalath Rish") == UC_JOINING_GROUP_DALATH_RISH);
+  ASSERT (uc_joining_group_byname ("Dalath_Rish") == UC_JOINING_GROUP_DALATH_RISH);
+  ASSERT (uc_joining_group_byname ("DalathRish") == UC_JOINING_GROUP_DALATH_RISH);
+  ASSERT (uc_joining_group_byname ("E") == UC_JOINING_GROUP_E);
+  ASSERT (uc_joining_group_byname ("FARSI YEH") == UC_JOINING_GROUP_FARSI_YEH);
+  ASSERT (uc_joining_group_byname ("Farsi Yeh") == UC_JOINING_GROUP_FARSI_YEH);
+  ASSERT (uc_joining_group_byname ("Farsi_Yeh") == UC_JOINING_GROUP_FARSI_YEH);
+  ASSERT (uc_joining_group_byname ("FarsiYeh") == UC_JOINING_GROUP_FARSI_YEH);
+  ASSERT (uc_joining_group_byname ("FE") == UC_JOINING_GROUP_FE);
+  ASSERT (uc_joining_group_byname ("Fe") == UC_JOINING_GROUP_FE);
+  ASSERT (uc_joining_group_byname ("FEH") == UC_JOINING_GROUP_FEH);
+  ASSERT (uc_joining_group_byname ("Feh") == UC_JOINING_GROUP_FEH);
+  ASSERT (uc_joining_group_byname ("FINAL SEMKATH") == UC_JOINING_GROUP_FINAL_SEMKATH);
+  ASSERT (uc_joining_group_byname ("Final Semkath") == UC_JOINING_GROUP_FINAL_SEMKATH);
+  ASSERT (uc_joining_group_byname ("Final_Semkath") == UC_JOINING_GROUP_FINAL_SEMKATH);
+  ASSERT (uc_joining_group_byname ("FinalSemkath") == UC_JOINING_GROUP_FINAL_SEMKATH);
+  ASSERT (uc_joining_group_byname ("GAF") == UC_JOINING_GROUP_GAF);
+  ASSERT (uc_joining_group_byname ("Gaf") == UC_JOINING_GROUP_GAF);
+  ASSERT (uc_joining_group_byname ("GAMAL") == UC_JOINING_GROUP_GAMAL);
+  ASSERT (uc_joining_group_byname ("Gamal") == UC_JOINING_GROUP_GAMAL);
+  ASSERT (uc_joining_group_byname ("HAH") == UC_JOINING_GROUP_HAH);
+  ASSERT (uc_joining_group_byname ("Hah") == UC_JOINING_GROUP_HAH);
+  ASSERT (uc_joining_group_byname ("HE") == UC_JOINING_GROUP_HE);
+  ASSERT (uc_joining_group_byname ("He") == UC_JOINING_GROUP_HE);
+  ASSERT (uc_joining_group_byname ("HEH") == UC_JOINING_GROUP_HEH);
+  ASSERT (uc_joining_group_byname ("Heh") == UC_JOINING_GROUP_HEH);
+  ASSERT (uc_joining_group_byname ("HEH GOAL") == UC_JOINING_GROUP_HEH_GOAL);
+  ASSERT (uc_joining_group_byname ("Heh Goal") == UC_JOINING_GROUP_HEH_GOAL);
+  ASSERT (uc_joining_group_byname ("Heh_Goal") == UC_JOINING_GROUP_HEH_GOAL);
+  ASSERT (uc_joining_group_byname ("HehGoal") == UC_JOINING_GROUP_HEH_GOAL);
+  ASSERT (uc_joining_group_byname ("HETH") == UC_JOINING_GROUP_HETH);
+  ASSERT (uc_joining_group_byname ("Heth") == UC_JOINING_GROUP_HETH);
+  ASSERT (uc_joining_group_byname ("KAF") == UC_JOINING_GROUP_KAF);
+  ASSERT (uc_joining_group_byname ("Kaf") == UC_JOINING_GROUP_KAF);
+  ASSERT (uc_joining_group_byname ("KAPH") == UC_JOINING_GROUP_KAPH);
+  ASSERT (uc_joining_group_byname ("Kaph") == UC_JOINING_GROUP_KAPH);
+  ASSERT (uc_joining_group_byname ("KHAPH") == UC_JOINING_GROUP_KHAPH);
+  ASSERT (uc_joining_group_byname ("Khaph") == UC_JOINING_GROUP_KHAPH);
+  ASSERT (uc_joining_group_byname ("KNOTTED HEH") == UC_JOINING_GROUP_KNOTTED_HEH);
+  ASSERT (uc_joining_group_byname ("Knotted Heh") == UC_JOINING_GROUP_KNOTTED_HEH);
+  ASSERT (uc_joining_group_byname ("Knotted_Heh") == UC_JOINING_GROUP_KNOTTED_HEH);
+  ASSERT (uc_joining_group_byname ("KnottedHeh") == UC_JOINING_GROUP_KNOTTED_HEH);
+  ASSERT (uc_joining_group_byname ("LAM") == UC_JOINING_GROUP_LAM);
+  ASSERT (uc_joining_group_byname ("Lam") == UC_JOINING_GROUP_LAM);
+  ASSERT (uc_joining_group_byname ("LAMADH") == UC_JOINING_GROUP_LAMADH);
+  ASSERT (uc_joining_group_byname ("Lamadh") == UC_JOINING_GROUP_LAMADH);
+  ASSERT (uc_joining_group_byname ("MEEM") == UC_JOINING_GROUP_MEEM);
+  ASSERT (uc_joining_group_byname ("Meem") == UC_JOINING_GROUP_MEEM);
+  ASSERT (uc_joining_group_byname ("MIM") == UC_JOINING_GROUP_MIM);
+  ASSERT (uc_joining_group_byname ("Mim") == UC_JOINING_GROUP_MIM);
+  ASSERT (uc_joining_group_byname ("NOON") == UC_JOINING_GROUP_NOON);
+  ASSERT (uc_joining_group_byname ("Noon") == UC_JOINING_GROUP_NOON);
+  ASSERT (uc_joining_group_byname ("NUN") == UC_JOINING_GROUP_NUN);
+  ASSERT (uc_joining_group_byname ("Nun") == UC_JOINING_GROUP_NUN);
+  ASSERT (uc_joining_group_byname ("NYA") == UC_JOINING_GROUP_NYA);
+  ASSERT (uc_joining_group_byname ("Nya") == UC_JOINING_GROUP_NYA);
+  ASSERT (uc_joining_group_byname ("PE") == UC_JOINING_GROUP_PE);
+  ASSERT (uc_joining_group_byname ("Pe") == UC_JOINING_GROUP_PE);
+  ASSERT (uc_joining_group_byname ("QAF") == UC_JOINING_GROUP_QAF);
+  ASSERT (uc_joining_group_byname ("Qaf") == UC_JOINING_GROUP_QAF);
+  ASSERT (uc_joining_group_byname ("QAPH") == UC_JOINING_GROUP_QAPH);
+  ASSERT (uc_joining_group_byname ("Qaph") == UC_JOINING_GROUP_QAPH);
+  ASSERT (uc_joining_group_byname ("REH") == UC_JOINING_GROUP_REH);
+  ASSERT (uc_joining_group_byname ("Reh") == UC_JOINING_GROUP_REH);
+  ASSERT (uc_joining_group_byname ("REVERSED PE") == UC_JOINING_GROUP_REVERSED_PE);
+  ASSERT (uc_joining_group_byname ("Reversed Pe") == UC_JOINING_GROUP_REVERSED_PE);
+  ASSERT (uc_joining_group_byname ("Reversed_Pe") == UC_JOINING_GROUP_REVERSED_PE);
+  ASSERT (uc_joining_group_byname ("ReversedPe") == UC_JOINING_GROUP_REVERSED_PE);
+  ASSERT (uc_joining_group_byname ("SAD") == UC_JOINING_GROUP_SAD);
+  ASSERT (uc_joining_group_byname ("Sad") == UC_JOINING_GROUP_SAD);
+  ASSERT (uc_joining_group_byname ("SADHE") == UC_JOINING_GROUP_SADHE);
+  ASSERT (uc_joining_group_byname ("Sadhe") == UC_JOINING_GROUP_SADHE);
+  ASSERT (uc_joining_group_byname ("SEEN") == UC_JOINING_GROUP_SEEN);
+  ASSERT (uc_joining_group_byname ("Seen") == UC_JOINING_GROUP_SEEN);
+  ASSERT (uc_joining_group_byname ("SEMKATH") == UC_JOINING_GROUP_SEMKATH);
+  ASSERT (uc_joining_group_byname ("Semkath") == UC_JOINING_GROUP_SEMKATH);
+  ASSERT (uc_joining_group_byname ("SHIN") == UC_JOINING_GROUP_SHIN);
+  ASSERT (uc_joining_group_byname ("Shin") == UC_JOINING_GROUP_SHIN);
+  ASSERT (uc_joining_group_byname ("SWASH KAF") == UC_JOINING_GROUP_SWASH_KAF);
+  ASSERT (uc_joining_group_byname ("Swash Kaf") == UC_JOINING_GROUP_SWASH_KAF);
+  ASSERT (uc_joining_group_byname ("Swash_Kaf") == UC_JOINING_GROUP_SWASH_KAF);
+  ASSERT (uc_joining_group_byname ("SwashKaf") == UC_JOINING_GROUP_SWASH_KAF);
+  ASSERT (uc_joining_group_byname ("SYRIAC WAW") == UC_JOINING_GROUP_SYRIAC_WAW);
+  ASSERT (uc_joining_group_byname ("Syriac Waw") == UC_JOINING_GROUP_SYRIAC_WAW);
+  ASSERT (uc_joining_group_byname ("Syriac_Waw") == UC_JOINING_GROUP_SYRIAC_WAW);
+  ASSERT (uc_joining_group_byname ("SyriacWaw") == UC_JOINING_GROUP_SYRIAC_WAW);
+  ASSERT (uc_joining_group_byname ("TAH") == UC_JOINING_GROUP_TAH);
+  ASSERT (uc_joining_group_byname ("Tah") == UC_JOINING_GROUP_TAH);
+  ASSERT (uc_joining_group_byname ("TAW") == UC_JOINING_GROUP_TAW);
+  ASSERT (uc_joining_group_byname ("Taw") == UC_JOINING_GROUP_TAW);
+  ASSERT (uc_joining_group_byname ("TEH MARBUTA") == UC_JOINING_GROUP_TEH_MARBUTA);
+  ASSERT (uc_joining_group_byname ("Teh Marbuta") == UC_JOINING_GROUP_TEH_MARBUTA);
+  ASSERT (uc_joining_group_byname ("Teh_Marbuta") == UC_JOINING_GROUP_TEH_MARBUTA);
+  ASSERT (uc_joining_group_byname ("TehMarbuta") == UC_JOINING_GROUP_TEH_MARBUTA);
+  ASSERT (uc_joining_group_byname ("TEH MARBUTA GOAL") == UC_JOINING_GROUP_TEH_MARBUTA_GOAL);
+  ASSERT (uc_joining_group_byname ("Teh Marbuta Goal") == UC_JOINING_GROUP_TEH_MARBUTA_GOAL);
+  ASSERT (uc_joining_group_byname ("Teh_Marbuta_Goal") == UC_JOINING_GROUP_TEH_MARBUTA_GOAL);
+  ASSERT (uc_joining_group_byname ("TehMarbutaGoal") == UC_JOINING_GROUP_TEH_MARBUTA_GOAL);
+  ASSERT (uc_joining_group_byname ("TETH") == UC_JOINING_GROUP_TETH);
+  ASSERT (uc_joining_group_byname ("Teth") == UC_JOINING_GROUP_TETH);
+  ASSERT (uc_joining_group_byname ("WAW") == UC_JOINING_GROUP_WAW);
+  ASSERT (uc_joining_group_byname ("Waw") == UC_JOINING_GROUP_WAW);
+  ASSERT (uc_joining_group_byname ("YEH") == UC_JOINING_GROUP_YEH);
+  ASSERT (uc_joining_group_byname ("Yeh") == UC_JOINING_GROUP_YEH);
+  ASSERT (uc_joining_group_byname ("YEH BARREE") == UC_JOINING_GROUP_YEH_BARREE);
+  ASSERT (uc_joining_group_byname ("Yeh Barree") == UC_JOINING_GROUP_YEH_BARREE);
+  ASSERT (uc_joining_group_byname ("Yeh_Barree") == UC_JOINING_GROUP_YEH_BARREE);
+  ASSERT (uc_joining_group_byname ("YehBarree") == UC_JOINING_GROUP_YEH_BARREE);
+  ASSERT (uc_joining_group_byname ("YEH WITH TAIL") == UC_JOINING_GROUP_YEH_WITH_TAIL);
+  ASSERT (uc_joining_group_byname ("Yeh with tail") == UC_JOINING_GROUP_YEH_WITH_TAIL);
+  ASSERT (uc_joining_group_byname ("Yeh_with_tail") == UC_JOINING_GROUP_YEH_WITH_TAIL);
+  ASSERT (uc_joining_group_byname ("YehWithTail") == UC_JOINING_GROUP_YEH_WITH_TAIL);
+  ASSERT (uc_joining_group_byname ("YUDH") == UC_JOINING_GROUP_YUDH);
+  ASSERT (uc_joining_group_byname ("Yudh") == UC_JOINING_GROUP_YUDH);
+  ASSERT (uc_joining_group_byname ("YUDH HE") == UC_JOINING_GROUP_YUDH_HE);
+  ASSERT (uc_joining_group_byname ("Yudh He") == UC_JOINING_GROUP_YUDH_HE);
+  ASSERT (uc_joining_group_byname ("Yudh_He") == UC_JOINING_GROUP_YUDH_HE);
+  ASSERT (uc_joining_group_byname ("YudhHe") == UC_JOINING_GROUP_YUDH_HE);
+  ASSERT (uc_joining_group_byname ("ZAIN") == UC_JOINING_GROUP_ZAIN);
+  ASSERT (uc_joining_group_byname ("Zain") == UC_JOINING_GROUP_ZAIN);
+  ASSERT (uc_joining_group_byname ("ZHAIN") == UC_JOINING_GROUP_ZHAIN);
+  ASSERT (uc_joining_group_byname ("Zhain") == UC_JOINING_GROUP_ZHAIN);
+  ASSERT (uc_joining_group_byname ("SEEN WITH 3 DOTS BELOW AND 3 DOTS ABOVE") < 0);
+  ASSERT (uc_joining_group_byname ("X") < 0);
+  ASSERT (uc_joining_group_byname ("") < 0);
+
+  return 0;
+}
diff --git a/tests/unictype/test-joininggroup_name.c b/tests/unictype/test-joininggroup_name.c
new file mode 100644 (file)
index 0000000..a1d5c94
--- /dev/null
@@ -0,0 +1,90 @@
+/* Test the Unicode character Arabic joining group functions.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_NONE),                  "No Joining Group") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_AIN),                   "Ain") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_ALAPH),                 "Alaph") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_ALEF),                  "Alef") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_BEH),                   "Beh") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_BETH),                  "Beth") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE), "Burushaski Yeh Barree") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_DAL),                   "Dal") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_DALATH_RISH),           "Dalath Rish") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_E),                     "E") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_FARSI_YEH),             "Farsi Yeh") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_FE),                    "Fe") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_FEH),                   "Feh") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_FINAL_SEMKATH),         "Final Semkath") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_GAF),                   "Gaf") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_GAMAL),                 "Gamal") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_HAH),                   "Hah") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_HE),                    "He") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_HEH),                   "Heh") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_HEH_GOAL),              "Heh Goal") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_HETH),                  "Heth") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_KAF),                   "Kaf") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_KAPH),                  "Kaph") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_KHAPH),                 "Khaph") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_KNOTTED_HEH),           "Knotted Heh") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_LAM),                   "Lam") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_LAMADH),                "Lamadh") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_MEEM),                  "Meem") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_MIM),                   "Mim") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_NOON),                  "Noon") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_NUN),                   "Nun") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_NYA),                   "Nya") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_PE),                    "Pe") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_QAF),                   "Qaf") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_QAPH),                  "Qaph") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_REH),                   "Reh") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_REVERSED_PE),           "Reversed Pe") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_SAD),                   "Sad") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_SADHE),                 "Sadhe") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_SEEN),                  "Seen") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_SEMKATH),               "Semkath") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_SHIN),                  "Shin") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_SWASH_KAF),             "Swash Kaf") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_SYRIAC_WAW),            "Syriac Waw") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_TAH),                   "Tah") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_TAW),                   "Taw") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_TEH_MARBUTA),           "Teh Marbuta") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_TEH_MARBUTA_GOAL),      "Teh Marbuta Goal") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_TETH),                  "Teth") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_WAW),                   "Waw") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_YEH),                   "Yeh") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_YEH_BARREE),            "Yeh Barree") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_YEH_WITH_TAIL),         "Yeh With Tail") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_YUDH),                  "Yudh") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_YUDH_HE),               "Yudh He") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_ZAIN),                  "Zain") == 0);
+  ASSERT (strcmp (uc_joining_group_name (UC_JOINING_GROUP_ZHAIN),                 "Zhain") == 0);
+  ASSERT (uc_joining_group_name (-1) == NULL);
+
+  return 0;
+}
diff --git a/tests/unictype/test-joininggroup_of.c b/tests/unictype/test-joininggroup_of.c
new file mode 100644 (file)
index 0000000..ffbdaeb
--- /dev/null
@@ -0,0 +1,52 @@
+/* Test the Unicode character Arabic joining group functions.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+typedef struct { ucs4_t ch; int value; } pair_t;
+
+static const pair_t mapping[] =
+  {
+#include "test-joininggroup_of.h"
+  };
+
+int
+main ()
+{
+  unsigned int c;
+  size_t i;
+
+  c = 0;
+  for (i = 0; i < SIZEOF (mapping); i++)
+    {
+      for (; c < mapping[i].ch; c++)
+        ASSERT (uc_joining_group (c) == UC_JOINING_GROUP_NONE);
+      ASSERT (uc_joining_group (c) == mapping[i].value);
+      c++;
+    }
+  for (; c < 0x110000; c++)
+    ASSERT (uc_joining_group (c) == UC_JOINING_GROUP_NONE);
+
+  return 0;
+}
diff --git a/tests/unictype/test-joininggroup_of.h b/tests/unictype/test-joininggroup_of.h
new file mode 100644 (file)
index 0000000..89fe497
--- /dev/null
@@ -0,0 +1,233 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Arabic joining group of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 6.0.0.  */
+    { 0x0620, UC_JOINING_GROUP_YEH },
+    { 0x0622, UC_JOINING_GROUP_ALEF },
+    { 0x0623, UC_JOINING_GROUP_ALEF },
+    { 0x0624, UC_JOINING_GROUP_WAW },
+    { 0x0625, UC_JOINING_GROUP_ALEF },
+    { 0x0626, UC_JOINING_GROUP_YEH },
+    { 0x0627, UC_JOINING_GROUP_ALEF },
+    { 0x0628, UC_JOINING_GROUP_BEH },
+    { 0x0629, UC_JOINING_GROUP_TEH_MARBUTA },
+    { 0x062A, UC_JOINING_GROUP_BEH },
+    { 0x062B, UC_JOINING_GROUP_BEH },
+    { 0x062C, UC_JOINING_GROUP_HAH },
+    { 0x062D, UC_JOINING_GROUP_HAH },
+    { 0x062E, UC_JOINING_GROUP_HAH },
+    { 0x062F, UC_JOINING_GROUP_DAL },
+    { 0x0630, UC_JOINING_GROUP_DAL },
+    { 0x0631, UC_JOINING_GROUP_REH },
+    { 0x0632, UC_JOINING_GROUP_REH },
+    { 0x0633, UC_JOINING_GROUP_SEEN },
+    { 0x0634, UC_JOINING_GROUP_SEEN },
+    { 0x0635, UC_JOINING_GROUP_SAD },
+    { 0x0636, UC_JOINING_GROUP_SAD },
+    { 0x0637, UC_JOINING_GROUP_TAH },
+    { 0x0638, UC_JOINING_GROUP_TAH },
+    { 0x0639, UC_JOINING_GROUP_AIN },
+    { 0x063A, UC_JOINING_GROUP_AIN },
+    { 0x063B, UC_JOINING_GROUP_GAF },
+    { 0x063C, UC_JOINING_GROUP_GAF },
+    { 0x063D, UC_JOINING_GROUP_FARSI_YEH },
+    { 0x063E, UC_JOINING_GROUP_FARSI_YEH },
+    { 0x063F, UC_JOINING_GROUP_FARSI_YEH },
+    { 0x0641, UC_JOINING_GROUP_FEH },
+    { 0x0642, UC_JOINING_GROUP_QAF },
+    { 0x0643, UC_JOINING_GROUP_KAF },
+    { 0x0644, UC_JOINING_GROUP_LAM },
+    { 0x0645, UC_JOINING_GROUP_MEEM },
+    { 0x0646, UC_JOINING_GROUP_NOON },
+    { 0x0647, UC_JOINING_GROUP_HEH },
+    { 0x0648, UC_JOINING_GROUP_WAW },
+    { 0x0649, UC_JOINING_GROUP_YEH },
+    { 0x064A, UC_JOINING_GROUP_YEH },
+    { 0x066E, UC_JOINING_GROUP_BEH },
+    { 0x066F, UC_JOINING_GROUP_QAF },
+    { 0x0671, UC_JOINING_GROUP_ALEF },
+    { 0x0672, UC_JOINING_GROUP_ALEF },
+    { 0x0673, UC_JOINING_GROUP_ALEF },
+    { 0x0675, UC_JOINING_GROUP_ALEF },
+    { 0x0676, UC_JOINING_GROUP_WAW },
+    { 0x0677, UC_JOINING_GROUP_WAW },
+    { 0x0678, UC_JOINING_GROUP_YEH },
+    { 0x0679, UC_JOINING_GROUP_BEH },
+    { 0x067A, UC_JOINING_GROUP_BEH },
+    { 0x067B, UC_JOINING_GROUP_BEH },
+    { 0x067C, UC_JOINING_GROUP_BEH },
+    { 0x067D, UC_JOINING_GROUP_BEH },
+    { 0x067E, UC_JOINING_GROUP_BEH },
+    { 0x067F, UC_JOINING_GROUP_BEH },
+    { 0x0680, UC_JOINING_GROUP_BEH },
+    { 0x0681, UC_JOINING_GROUP_HAH },
+    { 0x0682, UC_JOINING_GROUP_HAH },
+    { 0x0683, UC_JOINING_GROUP_HAH },
+    { 0x0684, UC_JOINING_GROUP_HAH },
+    { 0x0685, UC_JOINING_GROUP_HAH },
+    { 0x0686, UC_JOINING_GROUP_HAH },
+    { 0x0687, UC_JOINING_GROUP_HAH },
+    { 0x0688, UC_JOINING_GROUP_DAL },
+    { 0x0689, UC_JOINING_GROUP_DAL },
+    { 0x068A, UC_JOINING_GROUP_DAL },
+    { 0x068B, UC_JOINING_GROUP_DAL },
+    { 0x068C, UC_JOINING_GROUP_DAL },
+    { 0x068D, UC_JOINING_GROUP_DAL },
+    { 0x068E, UC_JOINING_GROUP_DAL },
+    { 0x068F, UC_JOINING_GROUP_DAL },
+    { 0x0690, UC_JOINING_GROUP_DAL },
+    { 0x0691, UC_JOINING_GROUP_REH },
+    { 0x0692, UC_JOINING_GROUP_REH },
+    { 0x0693, UC_JOINING_GROUP_REH },
+    { 0x0694, UC_JOINING_GROUP_REH },
+    { 0x0695, UC_JOINING_GROUP_REH },
+    { 0x0696, UC_JOINING_GROUP_REH },
+    { 0x0697, UC_JOINING_GROUP_REH },
+    { 0x0698, UC_JOINING_GROUP_REH },
+    { 0x0699, UC_JOINING_GROUP_REH },
+    { 0x069A, UC_JOINING_GROUP_SEEN },
+    { 0x069B, UC_JOINING_GROUP_SEEN },
+    { 0x069C, UC_JOINING_GROUP_SEEN },
+    { 0x069D, UC_JOINING_GROUP_SAD },
+    { 0x069E, UC_JOINING_GROUP_SAD },
+    { 0x069F, UC_JOINING_GROUP_TAH },
+    { 0x06A0, UC_JOINING_GROUP_AIN },
+    { 0x06A1, UC_JOINING_GROUP_FEH },
+    { 0x06A2, UC_JOINING_GROUP_FEH },
+    { 0x06A3, UC_JOINING_GROUP_FEH },
+    { 0x06A4, UC_JOINING_GROUP_FEH },
+    { 0x06A5, UC_JOINING_GROUP_FEH },
+    { 0x06A6, UC_JOINING_GROUP_FEH },
+    { 0x06A7, UC_JOINING_GROUP_QAF },
+    { 0x06A8, UC_JOINING_GROUP_QAF },
+    { 0x06A9, UC_JOINING_GROUP_GAF },
+    { 0x06AA, UC_JOINING_GROUP_SWASH_KAF },
+    { 0x06AB, UC_JOINING_GROUP_GAF },
+    { 0x06AC, UC_JOINING_GROUP_KAF },
+    { 0x06AD, UC_JOINING_GROUP_KAF },
+    { 0x06AE, UC_JOINING_GROUP_KAF },
+    { 0x06AF, UC_JOINING_GROUP_GAF },
+    { 0x06B0, UC_JOINING_GROUP_GAF },
+    { 0x06B1, UC_JOINING_GROUP_GAF },
+    { 0x06B2, UC_JOINING_GROUP_GAF },
+    { 0x06B3, UC_JOINING_GROUP_GAF },
+    { 0x06B4, UC_JOINING_GROUP_GAF },
+    { 0x06B5, UC_JOINING_GROUP_LAM },
+    { 0x06B6, UC_JOINING_GROUP_LAM },
+    { 0x06B7, UC_JOINING_GROUP_LAM },
+    { 0x06B8, UC_JOINING_GROUP_LAM },
+    { 0x06B9, UC_JOINING_GROUP_NOON },
+    { 0x06BA, UC_JOINING_GROUP_NOON },
+    { 0x06BB, UC_JOINING_GROUP_NOON },
+    { 0x06BC, UC_JOINING_GROUP_NOON },
+    { 0x06BD, UC_JOINING_GROUP_NYA },
+    { 0x06BE, UC_JOINING_GROUP_KNOTTED_HEH },
+    { 0x06BF, UC_JOINING_GROUP_HAH },
+    { 0x06C0, UC_JOINING_GROUP_TEH_MARBUTA },
+    { 0x06C1, UC_JOINING_GROUP_HEH_GOAL },
+    { 0x06C2, UC_JOINING_GROUP_HEH_GOAL },
+    { 0x06C3, UC_JOINING_GROUP_TEH_MARBUTA_GOAL },
+    { 0x06C4, UC_JOINING_GROUP_WAW },
+    { 0x06C5, UC_JOINING_GROUP_WAW },
+    { 0x06C6, UC_JOINING_GROUP_WAW },
+    { 0x06C7, UC_JOINING_GROUP_WAW },
+    { 0x06C8, UC_JOINING_GROUP_WAW },
+    { 0x06C9, UC_JOINING_GROUP_WAW },
+    { 0x06CA, UC_JOINING_GROUP_WAW },
+    { 0x06CB, UC_JOINING_GROUP_WAW },
+    { 0x06CC, UC_JOINING_GROUP_FARSI_YEH },
+    { 0x06CD, UC_JOINING_GROUP_YEH_WITH_TAIL },
+    { 0x06CE, UC_JOINING_GROUP_FARSI_YEH },
+    { 0x06CF, UC_JOINING_GROUP_WAW },
+    { 0x06D0, UC_JOINING_GROUP_YEH },
+    { 0x06D1, UC_JOINING_GROUP_YEH },
+    { 0x06D2, UC_JOINING_GROUP_YEH_BARREE },
+    { 0x06D3, UC_JOINING_GROUP_YEH_BARREE },
+    { 0x06D5, UC_JOINING_GROUP_TEH_MARBUTA },
+    { 0x06EE, UC_JOINING_GROUP_DAL },
+    { 0x06EF, UC_JOINING_GROUP_REH },
+    { 0x06FA, UC_JOINING_GROUP_SEEN },
+    { 0x06FB, UC_JOINING_GROUP_SAD },
+    { 0x06FC, UC_JOINING_GROUP_AIN },
+    { 0x06FF, UC_JOINING_GROUP_KNOTTED_HEH },
+    { 0x0710, UC_JOINING_GROUP_ALAPH },
+    { 0x0712, UC_JOINING_GROUP_BETH },
+    { 0x0713, UC_JOINING_GROUP_GAMAL },
+    { 0x0714, UC_JOINING_GROUP_GAMAL },
+    { 0x0715, UC_JOINING_GROUP_DALATH_RISH },
+    { 0x0716, UC_JOINING_GROUP_DALATH_RISH },
+    { 0x0717, UC_JOINING_GROUP_HE },
+    { 0x0718, UC_JOINING_GROUP_SYRIAC_WAW },
+    { 0x0719, UC_JOINING_GROUP_ZAIN },
+    { 0x071A, UC_JOINING_GROUP_HETH },
+    { 0x071B, UC_JOINING_GROUP_TETH },
+    { 0x071C, UC_JOINING_GROUP_TETH },
+    { 0x071D, UC_JOINING_GROUP_YUDH },
+    { 0x071E, UC_JOINING_GROUP_YUDH_HE },
+    { 0x071F, UC_JOINING_GROUP_KAPH },
+    { 0x0720, UC_JOINING_GROUP_LAMADH },
+    { 0x0721, UC_JOINING_GROUP_MIM },
+    { 0x0722, UC_JOINING_GROUP_NUN },
+    { 0x0723, UC_JOINING_GROUP_SEMKATH },
+    { 0x0724, UC_JOINING_GROUP_FINAL_SEMKATH },
+    { 0x0725, UC_JOINING_GROUP_E },
+    { 0x0726, UC_JOINING_GROUP_PE },
+    { 0x0727, UC_JOINING_GROUP_REVERSED_PE },
+    { 0x0728, UC_JOINING_GROUP_SADHE },
+    { 0x0729, UC_JOINING_GROUP_QAPH },
+    { 0x072A, UC_JOINING_GROUP_DALATH_RISH },
+    { 0x072B, UC_JOINING_GROUP_SHIN },
+    { 0x072C, UC_JOINING_GROUP_TAW },
+    { 0x072D, UC_JOINING_GROUP_BETH },
+    { 0x072E, UC_JOINING_GROUP_GAMAL },
+    { 0x072F, UC_JOINING_GROUP_DALATH_RISH },
+    { 0x074D, UC_JOINING_GROUP_ZHAIN },
+    { 0x074E, UC_JOINING_GROUP_KHAPH },
+    { 0x074F, UC_JOINING_GROUP_FE },
+    { 0x0750, UC_JOINING_GROUP_BEH },
+    { 0x0751, UC_JOINING_GROUP_BEH },
+    { 0x0752, UC_JOINING_GROUP_BEH },
+    { 0x0753, UC_JOINING_GROUP_BEH },
+    { 0x0754, UC_JOINING_GROUP_BEH },
+    { 0x0755, UC_JOINING_GROUP_BEH },
+    { 0x0756, UC_JOINING_GROUP_BEH },
+    { 0x0757, UC_JOINING_GROUP_HAH },
+    { 0x0758, UC_JOINING_GROUP_HAH },
+    { 0x0759, UC_JOINING_GROUP_DAL },
+    { 0x075A, UC_JOINING_GROUP_DAL },
+    { 0x075B, UC_JOINING_GROUP_REH },
+    { 0x075C, UC_JOINING_GROUP_SEEN },
+    { 0x075D, UC_JOINING_GROUP_AIN },
+    { 0x075E, UC_JOINING_GROUP_AIN },
+    { 0x075F, UC_JOINING_GROUP_AIN },
+    { 0x0760, UC_JOINING_GROUP_FEH },
+    { 0x0761, UC_JOINING_GROUP_FEH },
+    { 0x0762, UC_JOINING_GROUP_GAF },
+    { 0x0763, UC_JOINING_GROUP_GAF },
+    { 0x0764, UC_JOINING_GROUP_GAF },
+    { 0x0765, UC_JOINING_GROUP_MEEM },
+    { 0x0766, UC_JOINING_GROUP_MEEM },
+    { 0x0767, UC_JOINING_GROUP_NOON },
+    { 0x0768, UC_JOINING_GROUP_NOON },
+    { 0x0769, UC_JOINING_GROUP_NOON },
+    { 0x076A, UC_JOINING_GROUP_LAM },
+    { 0x076B, UC_JOINING_GROUP_REH },
+    { 0x076C, UC_JOINING_GROUP_REH },
+    { 0x076D, UC_JOINING_GROUP_SEEN },
+    { 0x076E, UC_JOINING_GROUP_HAH },
+    { 0x076F, UC_JOINING_GROUP_HAH },
+    { 0x0770, UC_JOINING_GROUP_SEEN },
+    { 0x0771, UC_JOINING_GROUP_REH },
+    { 0x0772, UC_JOINING_GROUP_HAH },
+    { 0x0773, UC_JOINING_GROUP_ALEF },
+    { 0x0774, UC_JOINING_GROUP_ALEF },
+    { 0x0775, UC_JOINING_GROUP_FARSI_YEH },
+    { 0x0776, UC_JOINING_GROUP_FARSI_YEH },
+    { 0x0777, UC_JOINING_GROUP_YEH },
+    { 0x0778, UC_JOINING_GROUP_WAW },
+    { 0x0779, UC_JOINING_GROUP_WAW },
+    { 0x077A, UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE },
+    { 0x077B, UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE },
+    { 0x077C, UC_JOINING_GROUP_HAH },
+    { 0x077D, UC_JOINING_GROUP_SEEN },
+    { 0x077E, UC_JOINING_GROUP_SEEN },
+    { 0x077F, UC_JOINING_GROUP_KAF }
diff --git a/tests/unictype/test-joiningtype_byname.c b/tests/unictype/test-joiningtype_byname.c
new file mode 100644 (file)
index 0000000..1065bff
--- /dev/null
@@ -0,0 +1,64 @@
+/* Test the Unicode character Arabic joining type functions.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  ASSERT (uc_joining_type_byname ("U") == UC_JOINING_TYPE_U);
+  ASSERT (uc_joining_type_byname ("T") == UC_JOINING_TYPE_T);
+  ASSERT (uc_joining_type_byname ("C") == UC_JOINING_TYPE_C);
+  ASSERT (uc_joining_type_byname ("L") == UC_JOINING_TYPE_L);
+  ASSERT (uc_joining_type_byname ("R") == UC_JOINING_TYPE_R);
+  ASSERT (uc_joining_type_byname ("D") == UC_JOINING_TYPE_D);
+
+  ASSERT (uc_joining_type_byname ("JOIN CAUSING") == UC_JOINING_TYPE_C);
+  ASSERT (uc_joining_type_byname ("Join Causing") == UC_JOINING_TYPE_C);
+  ASSERT (uc_joining_type_byname ("Join_Causing") == UC_JOINING_TYPE_C);
+  ASSERT (uc_joining_type_byname ("JoinCausing") == UC_JOINING_TYPE_C);
+  ASSERT (uc_joining_type_byname ("DUAL JOINING") == UC_JOINING_TYPE_D);
+  ASSERT (uc_joining_type_byname ("Dual Joining") == UC_JOINING_TYPE_D);
+  ASSERT (uc_joining_type_byname ("Dual_Joining") == UC_JOINING_TYPE_D);
+  ASSERT (uc_joining_type_byname ("DualJoining") == UC_JOINING_TYPE_D);
+  ASSERT (uc_joining_type_byname ("LEFT JOINING") == UC_JOINING_TYPE_L);
+  ASSERT (uc_joining_type_byname ("Left Joining") == UC_JOINING_TYPE_L);
+  ASSERT (uc_joining_type_byname ("Left_Joining") == UC_JOINING_TYPE_L);
+  ASSERT (uc_joining_type_byname ("LeftJoining") == UC_JOINING_TYPE_L);
+  ASSERT (uc_joining_type_byname ("RIGHT JOINING") == UC_JOINING_TYPE_R);
+  ASSERT (uc_joining_type_byname ("Right Joining") == UC_JOINING_TYPE_R);
+  ASSERT (uc_joining_type_byname ("Right_Joining") == UC_JOINING_TYPE_R);
+  ASSERT (uc_joining_type_byname ("RightJoining") == UC_JOINING_TYPE_R);
+  ASSERT (uc_joining_type_byname ("TRANSPARENT") == UC_JOINING_TYPE_T);
+  ASSERT (uc_joining_type_byname ("Transparent") == UC_JOINING_TYPE_T);
+  ASSERT (uc_joining_type_byname ("NON JOINING") == UC_JOINING_TYPE_U);
+  ASSERT (uc_joining_type_byname ("Non Joining") == UC_JOINING_TYPE_U);
+  ASSERT (uc_joining_type_byname ("Non_Joining") == UC_JOINING_TYPE_U);
+  ASSERT (uc_joining_type_byname ("NonJoining") == UC_JOINING_TYPE_U);
+
+  ASSERT (uc_joining_type_byname ("X") < 0);
+  ASSERT (uc_joining_type_byname ("") < 0);
+
+  return 0;
+}
diff --git a/tests/unictype/test-joiningtype_longname.c b/tests/unictype/test-joiningtype_longname.c
new file mode 100644 (file)
index 0000000..55c05b5
--- /dev/null
@@ -0,0 +1,39 @@
+/* Test the Unicode character Arabic joining type functions.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  ASSERT (strcmp (uc_joining_type_long_name (UC_JOINING_TYPE_U), "Non Joining") == 0);
+  ASSERT (strcmp (uc_joining_type_long_name (UC_JOINING_TYPE_T), "Transparent") == 0);
+  ASSERT (strcmp (uc_joining_type_long_name (UC_JOINING_TYPE_C), "Join Causing") == 0);
+  ASSERT (strcmp (uc_joining_type_long_name (UC_JOINING_TYPE_L), "Left Joining") == 0);
+  ASSERT (strcmp (uc_joining_type_long_name (UC_JOINING_TYPE_R), "Right Joining") == 0);
+  ASSERT (strcmp (uc_joining_type_long_name (UC_JOINING_TYPE_D), "Dual Joining") == 0);
+  ASSERT (uc_joining_type_long_name (-1) == NULL);
+
+  return 0;
+}
diff --git a/tests/unictype/test-joiningtype_name.c b/tests/unictype/test-joiningtype_name.c
new file mode 100644 (file)
index 0000000..83cbeb1
--- /dev/null
@@ -0,0 +1,39 @@
+/* Test the Unicode character Arabic joining type functions.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  ASSERT (strcmp (uc_joining_type_name (UC_JOINING_TYPE_U), "U") == 0);
+  ASSERT (strcmp (uc_joining_type_name (UC_JOINING_TYPE_T), "T") == 0);
+  ASSERT (strcmp (uc_joining_type_name (UC_JOINING_TYPE_C), "C") == 0);
+  ASSERT (strcmp (uc_joining_type_name (UC_JOINING_TYPE_L), "L") == 0);
+  ASSERT (strcmp (uc_joining_type_name (UC_JOINING_TYPE_R), "R") == 0);
+  ASSERT (strcmp (uc_joining_type_name (UC_JOINING_TYPE_D), "D") == 0);
+  ASSERT (uc_joining_type_name (-1) == NULL);
+
+  return 0;
+}
diff --git a/tests/unictype/test-joiningtype_of.c b/tests/unictype/test-joiningtype_of.c
new file mode 100644 (file)
index 0000000..f0e2aac
--- /dev/null
@@ -0,0 +1,65 @@
+/* Test the Unicode character Arabic joining type functions.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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 "unictype.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+typedef struct { ucs4_t ch; int value; } pair_t;
+
+static const pair_t mapping[] =
+  {
+#include "test-joiningtype_of.h"
+  };
+
+int
+main ()
+{
+  unsigned int c;
+  size_t i;
+
+  c = 0;
+  for (i = 0; i < SIZEOF (mapping); i++)
+    {
+      for (; c < mapping[i].ch; c++)
+        ASSERT (uc_joining_type (c) == UC_JOINING_TYPE_U
+                || uc_joining_type (c) == UC_JOINING_TYPE_T);
+      ASSERT (uc_joining_type (c) == mapping[i].value);
+      c++;
+    }
+  for (; c < 0x110000; c++)
+    ASSERT (uc_joining_type (c) == UC_JOINING_TYPE_U
+            || uc_joining_type (c) == UC_JOINING_TYPE_T);
+
+  /* Test distinction between U and T.  */
+  ASSERT (uc_joining_type (0x060C) == UC_JOINING_TYPE_U);
+  ASSERT (uc_joining_type (0x060D) == UC_JOINING_TYPE_U);
+  ASSERT (uc_joining_type (0x060E) == UC_JOINING_TYPE_U);
+  ASSERT (uc_joining_type (0x060F) == UC_JOINING_TYPE_U);
+  ASSERT (uc_joining_type (0x0610) == UC_JOINING_TYPE_T);
+  ASSERT (uc_joining_type (0x0611) == UC_JOINING_TYPE_T);
+  ASSERT (uc_joining_type (0x0612) == UC_JOINING_TYPE_T);
+  ASSERT (uc_joining_type (0x0613) == UC_JOINING_TYPE_T);
+  ASSERT (uc_joining_type (0x0614) == UC_JOINING_TYPE_T);
+
+  return 0;
+}
diff --git a/tests/unictype/test-joiningtype_of.h b/tests/unictype/test-joiningtype_of.h
new file mode 100644 (file)
index 0000000..15fa7d6
--- /dev/null
@@ -0,0 +1,279 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Arabic joining type of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 6.0.0.  */
+    { 0x0600, UC_JOINING_TYPE_U },
+    { 0x0601, UC_JOINING_TYPE_U },
+    { 0x0602, UC_JOINING_TYPE_U },
+    { 0x0603, UC_JOINING_TYPE_U },
+    { 0x0608, UC_JOINING_TYPE_U },
+    { 0x060B, UC_JOINING_TYPE_U },
+    { 0x0620, UC_JOINING_TYPE_D },
+    { 0x0621, UC_JOINING_TYPE_U },
+    { 0x0622, UC_JOINING_TYPE_R },
+    { 0x0623, UC_JOINING_TYPE_R },
+    { 0x0624, UC_JOINING_TYPE_R },
+    { 0x0625, UC_JOINING_TYPE_R },
+    { 0x0626, UC_JOINING_TYPE_D },
+    { 0x0627, UC_JOINING_TYPE_R },
+    { 0x0628, UC_JOINING_TYPE_D },
+    { 0x0629, UC_JOINING_TYPE_R },
+    { 0x062A, UC_JOINING_TYPE_D },
+    { 0x062B, UC_JOINING_TYPE_D },
+    { 0x062C, UC_JOINING_TYPE_D },
+    { 0x062D, UC_JOINING_TYPE_D },
+    { 0x062E, UC_JOINING_TYPE_D },
+    { 0x062F, UC_JOINING_TYPE_R },
+    { 0x0630, UC_JOINING_TYPE_R },
+    { 0x0631, UC_JOINING_TYPE_R },
+    { 0x0632, UC_JOINING_TYPE_R },
+    { 0x0633, UC_JOINING_TYPE_D },
+    { 0x0634, UC_JOINING_TYPE_D },
+    { 0x0635, UC_JOINING_TYPE_D },
+    { 0x0636, UC_JOINING_TYPE_D },
+    { 0x0637, UC_JOINING_TYPE_D },
+    { 0x0638, UC_JOINING_TYPE_D },
+    { 0x0639, UC_JOINING_TYPE_D },
+    { 0x063A, UC_JOINING_TYPE_D },
+    { 0x063B, UC_JOINING_TYPE_D },
+    { 0x063C, UC_JOINING_TYPE_D },
+    { 0x063D, UC_JOINING_TYPE_D },
+    { 0x063E, UC_JOINING_TYPE_D },
+    { 0x063F, UC_JOINING_TYPE_D },
+    { 0x0640, UC_JOINING_TYPE_C },
+    { 0x0641, UC_JOINING_TYPE_D },
+    { 0x0642, UC_JOINING_TYPE_D },
+    { 0x0643, UC_JOINING_TYPE_D },
+    { 0x0644, UC_JOINING_TYPE_D },
+    { 0x0645, UC_JOINING_TYPE_D },
+    { 0x0646, UC_JOINING_TYPE_D },
+    { 0x0647, UC_JOINING_TYPE_D },
+    { 0x0648, UC_JOINING_TYPE_R },
+    { 0x0649, UC_JOINING_TYPE_D },
+    { 0x064A, UC_JOINING_TYPE_D },
+    { 0x066E, UC_JOINING_TYPE_D },
+    { 0x066F, UC_JOINING_TYPE_D },
+    { 0x0671, UC_JOINING_TYPE_R },
+    { 0x0672, UC_JOINING_TYPE_R },
+    { 0x0673, UC_JOINING_TYPE_R },
+    { 0x0674, UC_JOINING_TYPE_U },
+    { 0x0675, UC_JOINING_TYPE_R },
+    { 0x0676, UC_JOINING_TYPE_R },
+    { 0x0677, UC_JOINING_TYPE_R },
+    { 0x0678, UC_JOINING_TYPE_D },
+    { 0x0679, UC_JOINING_TYPE_D },
+    { 0x067A, UC_JOINING_TYPE_D },
+    { 0x067B, UC_JOINING_TYPE_D },
+    { 0x067C, UC_JOINING_TYPE_D },
+    { 0x067D, UC_JOINING_TYPE_D },
+    { 0x067E, UC_JOINING_TYPE_D },
+    { 0x067F, UC_JOINING_TYPE_D },
+    { 0x0680, UC_JOINING_TYPE_D },
+    { 0x0681, UC_JOINING_TYPE_D },
+    { 0x0682, UC_JOINING_TYPE_D },
+    { 0x0683, UC_JOINING_TYPE_D },
+    { 0x0684, UC_JOINING_TYPE_D },
+    { 0x0685, UC_JOINING_TYPE_D },
+    { 0x0686, UC_JOINING_TYPE_D },
+    { 0x0687, UC_JOINING_TYPE_D },
+    { 0x0688, UC_JOINING_TYPE_R },
+    { 0x0689, UC_JOINING_TYPE_R },
+    { 0x068A, UC_JOINING_TYPE_R },
+    { 0x068B, UC_JOINING_TYPE_R },
+    { 0x068C, UC_JOINING_TYPE_R },
+    { 0x068D, UC_JOINING_TYPE_R },
+    { 0x068E, UC_JOINING_TYPE_R },
+    { 0x068F, UC_JOINING_TYPE_R },
+    { 0x0690, UC_JOINING_TYPE_R },
+    { 0x0691, UC_JOINING_TYPE_R },
+    { 0x0692, UC_JOINING_TYPE_R },
+    { 0x0693, UC_JOINING_TYPE_R },
+    { 0x0694, UC_JOINING_TYPE_R },
+    { 0x0695, UC_JOINING_TYPE_R },
+    { 0x0696, UC_JOINING_TYPE_R },
+    { 0x0697, UC_JOINING_TYPE_R },
+    { 0x0698, UC_JOINING_TYPE_R },
+    { 0x0699, UC_JOINING_TYPE_R },
+    { 0x069A, UC_JOINING_TYPE_D },
+    { 0x069B, UC_JOINING_TYPE_D },
+    { 0x069C, UC_JOINING_TYPE_D },
+    { 0x069D, UC_JOINING_TYPE_D },
+    { 0x069E, UC_JOINING_TYPE_D },
+    { 0x069F, UC_JOINING_TYPE_D },
+    { 0x06A0, UC_JOINING_TYPE_D },
+    { 0x06A1, UC_JOINING_TYPE_D },
+    { 0x06A2, UC_JOINING_TYPE_D },
+    { 0x06A3, UC_JOINING_TYPE_D },
+    { 0x06A4, UC_JOINING_TYPE_D },
+    { 0x06A5, UC_JOINING_TYPE_D },
+    { 0x06A6, UC_JOINING_TYPE_D },
+    { 0x06A7, UC_JOINING_TYPE_D },
+    { 0x06A8, UC_JOINING_TYPE_D },
+    { 0x06A9, UC_JOINING_TYPE_D },
+    { 0x06AA, UC_JOINING_TYPE_D },
+    { 0x06AB, UC_JOINING_TYPE_D },
+    { 0x06AC, UC_JOINING_TYPE_D },
+    { 0x06AD, UC_JOINING_TYPE_D },
+    { 0x06AE, UC_JOINING_TYPE_D },
+    { 0x06AF, UC_JOINING_TYPE_D },
+    { 0x06B0, UC_JOINING_TYPE_D },
+    { 0x06B1, UC_JOINING_TYPE_D },
+    { 0x06B2, UC_JOINING_TYPE_D },
+    { 0x06B3, UC_JOINING_TYPE_D },
+    { 0x06B4, UC_JOINING_TYPE_D },
+    { 0x06B5, UC_JOINING_TYPE_D },
+    { 0x06B6, UC_JOINING_TYPE_D },
+    { 0x06B7, UC_JOINING_TYPE_D },
+    { 0x06B8, UC_JOINING_TYPE_D },
+    { 0x06B9, UC_JOINING_TYPE_D },
+    { 0x06BA, UC_JOINING_TYPE_D },
+    { 0x06BB, UC_JOINING_TYPE_D },
+    { 0x06BC, UC_JOINING_TYPE_D },
+    { 0x06BD, UC_JOINING_TYPE_D },
+    { 0x06BE, UC_JOINING_TYPE_D },
+    { 0x06BF, UC_JOINING_TYPE_D },
+    { 0x06C0, UC_JOINING_TYPE_R },
+    { 0x06C1, UC_JOINING_TYPE_D },
+    { 0x06C2, UC_JOINING_TYPE_D },
+    { 0x06C3, UC_JOINING_TYPE_R },
+    { 0x06C4, UC_JOINING_TYPE_R },
+    { 0x06C5, UC_JOINING_TYPE_R },
+    { 0x06C6, UC_JOINING_TYPE_R },
+    { 0x06C7, UC_JOINING_TYPE_R },
+    { 0x06C8, UC_JOINING_TYPE_R },
+    { 0x06C9, UC_JOINING_TYPE_R },
+    { 0x06CA, UC_JOINING_TYPE_R },
+    { 0x06CB, UC_JOINING_TYPE_R },
+    { 0x06CC, UC_JOINING_TYPE_D },
+    { 0x06CD, UC_JOINING_TYPE_R },
+    { 0x06CE, UC_JOINING_TYPE_D },
+    { 0x06CF, UC_JOINING_TYPE_R },
+    { 0x06D0, UC_JOINING_TYPE_D },
+    { 0x06D1, UC_JOINING_TYPE_D },
+    { 0x06D2, UC_JOINING_TYPE_R },
+    { 0x06D3, UC_JOINING_TYPE_R },
+    { 0x06D5, UC_JOINING_TYPE_R },
+    { 0x06DD, UC_JOINING_TYPE_U },
+    { 0x06EE, UC_JOINING_TYPE_R },
+    { 0x06EF, UC_JOINING_TYPE_R },
+    { 0x06FA, UC_JOINING_TYPE_D },
+    { 0x06FB, UC_JOINING_TYPE_D },
+    { 0x06FC, UC_JOINING_TYPE_D },
+    { 0x06FF, UC_JOINING_TYPE_D },
+    { 0x0710, UC_JOINING_TYPE_R },
+    { 0x0712, UC_JOINING_TYPE_D },
+    { 0x0713, UC_JOINING_TYPE_D },
+    { 0x0714, UC_JOINING_TYPE_D },
+    { 0x0715, UC_JOINING_TYPE_R },
+    { 0x0716, UC_JOINING_TYPE_R },
+    { 0x0717, UC_JOINING_TYPE_R },
+    { 0x0718, UC_JOINING_TYPE_R },
+    { 0x0719, UC_JOINING_TYPE_R },
+    { 0x071A, UC_JOINING_TYPE_D },
+    { 0x071B, UC_JOINING_TYPE_D },
+    { 0x071C, UC_JOINING_TYPE_D },
+    { 0x071D, UC_JOINING_TYPE_D },
+    { 0x071E, UC_JOINING_TYPE_R },
+    { 0x071F, UC_JOINING_TYPE_D },
+    { 0x0720, UC_JOINING_TYPE_D },
+    { 0x0721, UC_JOINING_TYPE_D },
+    { 0x0722, UC_JOINING_TYPE_D },
+    { 0x0723, UC_JOINING_TYPE_D },
+    { 0x0724, UC_JOINING_TYPE_D },
+    { 0x0725, UC_JOINING_TYPE_D },
+    { 0x0726, UC_JOINING_TYPE_D },
+    { 0x0727, UC_JOINING_TYPE_D },
+    { 0x0728, UC_JOINING_TYPE_R },
+    { 0x0729, UC_JOINING_TYPE_D },
+    { 0x072A, UC_JOINING_TYPE_R },
+    { 0x072B, UC_JOINING_TYPE_D },
+    { 0x072C, UC_JOINING_TYPE_R },
+    { 0x072D, UC_JOINING_TYPE_D },
+    { 0x072E, UC_JOINING_TYPE_D },
+    { 0x072F, UC_JOINING_TYPE_R },
+    { 0x074D, UC_JOINING_TYPE_R },
+    { 0x074E, UC_JOINING_TYPE_D },
+    { 0x074F, UC_JOINING_TYPE_D },
+    { 0x0750, UC_JOINING_TYPE_D },
+    { 0x0751, UC_JOINING_TYPE_D },
+    { 0x0752, UC_JOINING_TYPE_D },
+    { 0x0753, UC_JOINING_TYPE_D },
+    { 0x0754, UC_JOINING_TYPE_D },
+    { 0x0755, UC_JOINING_TYPE_D },
+    { 0x0756, UC_JOINING_TYPE_D },
+    { 0x0757, UC_JOINING_TYPE_D },
+    { 0x0758, UC_JOINING_TYPE_D },
+    { 0x0759, UC_JOINING_TYPE_R },
+    { 0x075A, UC_JOINING_TYPE_R },
+    { 0x075B, UC_JOINING_TYPE_R },
+    { 0x075C, UC_JOINING_TYPE_D },
+    { 0x075D, UC_JOINING_TYPE_D },
+    { 0x075E, UC_JOINING_TYPE_D },
+    { 0x075F, UC_JOINING_TYPE_D },
+    { 0x0760, UC_JOINING_TYPE_D },
+    { 0x0761, UC_JOINING_TYPE_D },
+    { 0x0762, UC_JOINING_TYPE_D },
+    { 0x0763, UC_JOINING_TYPE_D },
+    { 0x0764, UC_JOINING_TYPE_D },
+    { 0x0765, UC_JOINING_TYPE_D },
+    { 0x0766, UC_JOINING_TYPE_D },
+    { 0x0767, UC_JOINING_TYPE_D },
+    { 0x0768, UC_JOINING_TYPE_D },
+    { 0x0769, UC_JOINING_TYPE_D },
+    { 0x076A, UC_JOINING_TYPE_D },
+    { 0x076B, UC_JOINING_TYPE_R },
+    { 0x076C, UC_JOINING_TYPE_R },
+    { 0x076D, UC_JOINING_TYPE_D },
+    { 0x076E, UC_JOINING_TYPE_D },
+    { 0x076F, UC_JOINING_TYPE_D },
+    { 0x0770, UC_JOINING_TYPE_D },
+    { 0x0771, UC_JOINING_TYPE_R },
+    { 0x0772, UC_JOINING_TYPE_D },
+    { 0x0773, UC_JOINING_TYPE_R },
+    { 0x0774, UC_JOINING_TYPE_R },
+    { 0x0775, UC_JOINING_TYPE_D },
+    { 0x0776, UC_JOINING_TYPE_D },
+    { 0x0777, UC_JOINING_TYPE_D },
+    { 0x0778, UC_JOINING_TYPE_R },
+    { 0x0779, UC_JOINING_TYPE_R },
+    { 0x077A, UC_JOINING_TYPE_D },
+    { 0x077B, UC_JOINING_TYPE_D },
+    { 0x077C, UC_JOINING_TYPE_D },
+    { 0x077D, UC_JOINING_TYPE_D },
+    { 0x077E, UC_JOINING_TYPE_D },
+    { 0x077F, UC_JOINING_TYPE_D },
+    { 0x07CA, UC_JOINING_TYPE_D },
+    { 0x07CB, UC_JOINING_TYPE_D },
+    { 0x07CC, UC_JOINING_TYPE_D },
+    { 0x07CD, UC_JOINING_TYPE_D },
+    { 0x07CE, UC_JOINING_TYPE_D },
+    { 0x07CF, UC_JOINING_TYPE_D },
+    { 0x07D0, UC_JOINING_TYPE_D },
+    { 0x07D1, UC_JOINING_TYPE_D },
+    { 0x07D2, UC_JOINING_TYPE_D },
+    { 0x07D3, UC_JOINING_TYPE_D },
+    { 0x07D4, UC_JOINING_TYPE_D },
+    { 0x07D5, UC_JOINING_TYPE_D },
+    { 0x07D6, UC_JOINING_TYPE_D },
+    { 0x07D7, UC_JOINING_TYPE_D },
+    { 0x07D8, UC_JOINING_TYPE_D },
+    { 0x07D9, UC_JOINING_TYPE_D },
+    { 0x07DA, UC_JOINING_TYPE_D },
+    { 0x07DB, UC_JOINING_TYPE_D },
+    { 0x07DC, UC_JOINING_TYPE_D },
+    { 0x07DD, UC_JOINING_TYPE_D },
+    { 0x07DE, UC_JOINING_TYPE_D },
+    { 0x07DF, UC_JOINING_TYPE_D },
+    { 0x07E0, UC_JOINING_TYPE_D },
+    { 0x07E1, UC_JOINING_TYPE_D },
+    { 0x07E2, UC_JOINING_TYPE_D },
+    { 0x07E3, UC_JOINING_TYPE_D },
+    { 0x07E4, UC_JOINING_TYPE_D },
+    { 0x07E5, UC_JOINING_TYPE_D },
+    { 0x07E6, UC_JOINING_TYPE_D },
+    { 0x07E7, UC_JOINING_TYPE_D },
+    { 0x07E8, UC_JOINING_TYPE_D },
+    { 0x07E9, UC_JOINING_TYPE_D },
+    { 0x07EA, UC_JOINING_TYPE_D },
+    { 0x07FA, UC_JOINING_TYPE_C },
+    { 0x200C, UC_JOINING_TYPE_U },
+    { 0x200D, UC_JOINING_TYPE_C }
index 606d42e..524b69f 100644 (file)
@@ -33,7 +33,7 @@ GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
 
 GIT = git
 VC = $(GIT)
-VC-tag = git tag -s -m '$(VERSION)' -u '$(gpg_key_ID)'
+VC-tag = git tag -s -m '$(VERSION)' 'v$(VERSION)' -u '$(gpg_key_ID)'
 
 VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
 
@@ -57,11 +57,13 @@ endif
 # In order to be able to consistently filter "."-relative names,
 # (i.e., with no $(srcdir) prefix), this definition is careful to
 # remove any $(srcdir) prefix, and to restore what it removes.
+_sc_excl = \
+  $(if $(exclude_file_name_regexp--$@),$(exclude_file_name_regexp--$@),^$$)
 VC_LIST_EXCEPT = \
   $(VC_LIST) | sed 's|^$(_dot_escaped_srcdir)/||' \
        | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; \
          else grep -Ev -e "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi \
-       | grep -Ev -e '$(VC_LIST_ALWAYS_EXCLUDE_REGEX)' \
+       | grep -Ev -e '($(VC_LIST_ALWAYS_EXCLUDE_REGEX)|$(_sc_excl))' \
        $(_prepend_srcdir_prefix)
 
 ifeq ($(origin prev_version_file), undefined)
@@ -126,8 +128,13 @@ syntax-check-rules := $(sort $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \
                        $(srcdir)/$(ME) $(_cfg_mk)))
 .PHONY: $(syntax-check-rules)
 
-local-checks-available = \
-  $(syntax-check-rules)
+ifeq ($(shell $(VC_LIST) >/dev/null 2>&1; echo $$?),0)
+local-checks-available += $(syntax-check-rules)
+else
+local-checks-available += no-vc-detected
+no-vc-detected:
+       @echo "No version control files detected; skipping syntax check"
+endif
 .PHONY: $(local-checks-available)
 
 # Arrange to print the name of each syntax-checking rule just before running it.
@@ -191,6 +198,16 @@ syntax-check: $(local-check)
 #  halt
 #
 #     Message to display before to halting execution.
+#
+# Finally, you may exempt files based on an ERE matching file names.
+# For example, to exempt from the sc_space_tab check all files with the
+# .diff suffix, set this Make variable:
+#
+# exclude_file_name_regexp--sc_space_tab = \.diff$
+#
+# Note that while this functionality is mostly inherited via VC_LIST_EXCEPT,
+# when filtering by name via in_files, we explicitly filter out matching
+# names here as well.
 
 # By default, _sc_search_regexp does not ignore case.
 export ignore_case =
@@ -228,7 +245,8 @@ define _sc_search_regexp
                                                                        \
    : Filter by file name;                                              \
    if test -n "$$in_files"; then                                       \
-     files=$$(find $(srcdir) | grep -E "$$in_files");                  \
+     files=$$(find $(srcdir) | grep -E "$$in_files"                    \
+              | grep -Ev '$(exclude_file_name_regexp--$@)');           \
    else                                                                        \
      files=$$($(VC_LIST_EXCEPT));                                      \
      if test -n "$$in_vc_files"; then                                  \
@@ -654,7 +672,7 @@ sc_two_space_separator_in_usage:
 sc_unmarked_diagnostics:
        @grep -nE                                                       \
            '\<error *\([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT))      \
-         | grep -v '_''(' &&                                           \
+         | grep -Ev '(_|ngettext ?)\(' &&                              \
          { echo '$(ME): found unmarked diagnostic(s)' 1>&2;            \
            exit 1; } || :
 
@@ -773,17 +791,22 @@ sc_prohibit_cvs_keyword:
 #   perl -ln -0777 -e '/\n(\n+)$/ and print "$ARGV: ".length $1' ...
 # but that would be far less efficient, reading the entire contents
 # of each file, rather than just the last two bytes of each.
+# In addition, while the code below detects both blank lines and a missing
+# newline at EOF, the above detects only the former.
 #
 # This is a perl script that is expected to be the single-quoted argument
 # to a command-line "-le".  The remaining arguments are file names.
-# Print the name of each file that ends in two or more newline bytes.
+# Print the name of each file that ends in exactly one newline byte.
+# I.e., warn if there are blank lines (2 or more newlines), or if the
+# last byte is not a newline.  However, currently we don't complain
+# about any file that contains exactly one byte.
 # Exit nonzero if at least one such file is found, otherwise, exit 0.
 # Warn about, but otherwise ignore open failure.  Ignore seek/read failure.
 #
 # Use this if you want to remove trailing empty lines from selected files:
 #   perl -pi -0777 -e 's/\n\n+$/\n/' files...
 #
-detect_empty_lines_at_EOF_ =                                           \
+require_exactly_one_NL_at_EOF_ =                                       \
   foreach my $$f (@ARGV)                                               \
     {                                                                  \
       open F, "<", $$f or (warn "failed to open $$f: $$!\n"), next;    \
@@ -793,12 +816,14 @@ detect_empty_lines_at_EOF_ =                                              \
       defined $$p and $$p = sysread F, $$last_two_bytes, 2;            \
       close F;                                                         \
       $$c = "ignore read failure";                                     \
-      $$p && $$last_two_bytes eq "\n\n" and (print $$f), $$fail=1;     \
+      $$p && ($$last_two_bytes eq "\n\n"                               \
+              || substr ($$last_two_bytes,1) ne "\n")                  \
+          and (print $$f), $$fail=1;                                   \
     }                                                                  \
   END { exit defined $$fail }
 sc_prohibit_empty_lines_at_EOF:
-       @perl -le '$(detect_empty_lines_at_EOF_)' $$($(VC_LIST_EXCEPT)) \
-          || { echo '$(ME): the above files end with empty line(s)'     \
+       @perl -le '$(require_exactly_one_NL_at_EOF_)' $$($(VC_LIST_EXCEPT)) \
+          || { echo '$(ME): empty line(s) or no newline at EOF'        \
                1>&2; exit 1; } || :;                                   \
 
 # Make sure we don't use st_blocks.  Use ST_NBLOCKS instead.
@@ -930,13 +955,13 @@ fix_po_file_diag = \
 apply the above patch\n'
 
 # Verify that all source files using _() are listed in po/POTFILES.in.
-po_file po/POTFILES.in
+po_file ?= $(srcdir)/po/POTFILES.in
 sc_po_check:
        @if test -f $(po_file); then                                    \
          grep -E -v '^(#|$$)' $(po_file)                               \
            | grep -v '^src/false\.c$$' | sort > $@-1;                  \
          files=;                                                       \
-         for file in $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do              \
+         for file in $$($(VC_LIST_EXCEPT)) $(srcdir)/lib/*.[ch]; do    \
            test -r $$file || continue;                                 \
            case $$file in                                              \
              *.m4|*.mk) continue ;;                                    \
@@ -951,7 +976,7 @@ sc_po_check:
            files="$$files $$file";                                     \
          done;                                                         \
          grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files          \
-           | sort -u > $@-2;                                           \
+           | sed 's|^$(_dot_escaped_srcdir)/||' | sort -u > $@-2;      \
          diff -u -L $(po_file) -L $(po_file) $@-1 $@-2                 \
            || { printf '$(ME): '$(fix_po_file_diag) 1>&2; exit 1; };   \
          rm -f $@-1 $@-2;                                              \
index 8ba07f6..7151184 100644 (file)
--- a/users.txt
+++ b/users.txt
@@ -3,6 +3,7 @@ The following packages appear to be using gnulib and gnulib-tool:
   CSSC            http://git.savannah.gnu.org/cgit/cssc.git
   Net::CDP        http://search.cpan.org/src/MCHAPMAN/Net-CDP-0.09/libcdp/
   OPeNDAP         http://scm.opendap.org:8090/svn/trunk/
+  acct            http://cvs.sv.gnu.org/viewcvs/acct/acct/
   anubis          http://cvs.sv.gnu.org/viewcvs/anubis/anubis/
   augeas          http://augeas.net/
   autobuild       http://josefsson.org/autobuild/
@@ -11,11 +12,15 @@ The following packages appear to be using gnulib and gnulib-tool:
   coreutils       http://git.sv.gnu.org/gitweb/?p=coreutils.git
   cpio            http://cvs.sv.gnu.org/viewcvs/cpio/cpio/
   cvs             http://cvs.sv.gnu.org/viewcvs/cvs/ccvs/
+  cvsps           http://sourceforge.net/projects/cvsps/
   diffutils       http://git.sv.gnu.org/cgit/diffutils.git/
   febootstrap     http://people.redhat.com/~rjones/febootstrap/
   findutils       http://cvs.sv.gnu.org/viewcvs/findutils/findutils/
   gcal            http://git.savannah.gnu.org/gitweb/?p=gcal.git
+  gdb             http://sourceware.org/git/?p=gdb.git;a=summary
   gettext         http://cvs.sv.gnu.org/viewcvs/gettext/gettext/
+  gengetopt       http://git.sv.gnu.org/gitweb/?p=gengetopt.git
+  gmediaserver    http://cvs.sv.gnu.org/viewvc/gmediaserver/gmediaserver/
   gnuit           http://www.gnu.org/software/gnuit/
                   http://git.savannah.gnu.org/gitweb/?p=gnuit.git
   gnutls          http://cvs.gnupg.org/cgi-bin/viewcvs.cgi/gnutls/?root=GNU+TLS+Library
@@ -24,6 +29,7 @@ The following packages appear to be using gnulib and gnulib-tool:
   gpg             http://cvs.gnupg.org/cgi-bin/viewcvs.cgi/trunk/
   gsasl           http://git.sv.gnu.org/gitweb/?p=gsasl.git
   gss             http://git.sv.gnu.org/gitweb/?p=gss.git
+  gtkreindeer     http://git.sv.gnu.org/gitweb/?p=gtkreindeer.git
   gtk-vnc         http://gtk-vnc.codemonkey.ws/hg/outgoing.hg
   grep            http://git.sv.gnu.org/cgit/grep.git/
   guile           http://cvs.sv.gnu.org/viewvc/guile/guile/guile-core/
@@ -33,6 +39,7 @@ The following packages appear to be using gnulib and gnulib-tool:
   icoutils        http://riva.ucam.org/svn/cjwatson/src/debian/icoutils/trunk/icoutils/
   inetutils       http://cvs.sv.gnu.org/viewcvs/inetutils/inetutils/
   iwhd            http://git.fedorahosted.org/git/?p=iwhd.git
+  jugtail         http://cvs.savannah.gnu.org/viewvc/?root=jugtail
   jwhois          http://cvs.sv.gnu.org/viewvc/jwhois/jwhois/
   libdap          http://scm.opendap.org:8090/svn/trunk/libdap/
   libffcall       http://savannah.gnu.org/projects/libffcall/
@@ -40,12 +47,13 @@ The following packages appear to be using gnulib and gnulib-tool:
   libguestfs      http://libguestfs.org/
   libiconv        http://libiconv.cvs.sourceforge.net/libiconv/libiconv/
   libidn          http://git.sv.gnu.org/gitweb/?p=libidn.git
+  libidn2         http://josefsson.org/libidn2/
   libksba         http://cvs.gnupg.org/cgi-bin/viewcvs.cgi/trunk/?root=KSBA
   libntlm         http://git.josefsson.org/?p=libntlm.git;a=summary
   libprelude      https://trac.prelude-ids.org/browser/trunk/libprelude/
   libpreludedb    https://trac.prelude-ids.org/browser/trunk/libpreludedb/
-  libtasn1        http://cvs.gnupg.org/cgi-bin/viewcvs.cgi/libtasn1/?root=GNU+TLS+Library
-                  http://repo.or.cz/w/libtasn1.git
+  libtasn1        http://git.savannah.gnu.org/gitweb/?p=libtasn1.git
+  libunistring    http://git.sv.gnu.org/gitweb/?p=libunistring.git
   libvirt         http://libvirt.org/
                   http://git.et.redhat.com/?p=libvirt.git;a=summary
   m4              http://git.sv.gnu.org/gitweb/?p=m4.git;a=summary
@@ -53,8 +61,10 @@ The following packages appear to be using gnulib and gnulib-tool:
   mailutils       http://cvs.sv.gnu.org/viewcvs/mailutils/mailutils/
   man-db          http://www.chiark.greenend.org.uk/~cjwatson/bzr/man-db/trunk/
   miktex          https://svn.sourceforge.net/svnroot/miktex/miktex/trunk
+  mini-httpd      http://git.sv.gnu.org/gitweb/?p=mini-httpd.git
   msmtp           http://msmtp.cvs.sourceforge.net/msmtp/msmtp/
   myserver        http://git.sv.gnu.org/gitweb/?p=myserver.git;a=summary
+  nagios-plugins  http://nagiosplug.git.sourceforge.net/
   netcf           http://fedorahosted.org/netcf/
   newts           http://svn.arete.cc/newts/trunk/
   OATH Toolkit    http://www.nongnu.org/oath-toolkit/
@@ -66,12 +76,14 @@ The following packages appear to be using gnulib and gnulib-tool:
   pspp            http://git.sv.gnu.org/gitweb/?p=pspp.git
   radius          http://cvs.sv.gnu.org/viewcvs/radius/radius/
   recutils        http://git.savannah.gnu.org/gitweb/?p=recutils.git
+  reindeer        http://git.sv.gnu.org/gitweb/?p=reindeer.git
   rcs             http://git.savannah.gnu.org/cgit/rcs.git
   sed             http://cvs.savannah.gnu.org/viewcvs/sed/?root=sed
   sharutils       http://cvs.savannah.gnu.org/viewvc/sharutils/sharutils/
   shishi          http://git.sv.gnu.org/gitweb/?p=shishi.git
   tar             http://cvs.sv.gnu.org/viewcvs/tar/tar/
   texinfo         http://cvs.sv.gnu.org/viewcvs/texinfo/texinfo/
+  tmpwatch        https://fedorahosted.org/tmpwatch/
   vc-dwim         http://git.sv.gnu.org/gitweb/?p=vc-dwim.git
   wget            http://hg.addictivecode.org/wget/mainline/
   wydawca         http://svn.gnu.org.ua/viewvc/wydawca/trunk/