+++ /dev/null
-/* Safe automatic memory allocation.
- Copyright (C) 2003 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "allocsa.h"
-
-/* The speed critical point in this file is freesa() applied to an alloca()
- result: it must be fast, to match the speed of alloca(). The speed of
- mallocsa() and freesa() in the other case are not critical, because they
- are only invoked for big memory sizes. */
-
-#if HAVE_ALLOCA
-
-/* Store the mallocsa() results in a hash table. This is needed to reliably
- distinguish a mallocsa() result and an alloca() result.
-
- Although it is possible that the same pointer is returned by alloca() and
- by mallocsa() at different times in the same application, it does not lead
- to a bug in freesa(), because:
- - Before a pointer returned by alloca() can point into malloc()ed memory,
- the function must return, and once this has happened the programmer must
- not call freesa() on it anyway.
- - Before a pointer returned by mallocsa() can point into the stack, it
- must be freed. The only function that can free it is freesa(), and
- when freesa() frees it, it also removes it from the hash table. */
-
-#define MAGIC_NUMBER 0x1415fb4a
-#define MAGIC_SIZE sizeof (int)
-/* This is how the header info would look like without any alignment
- considerations. */
-struct preliminary_header { void *next; char room[MAGIC_SIZE]; };
-/* But the header's size must be a multiple of sa_alignment_max. */
-#define HEADER_SIZE \
- (((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max)
-struct header { void *next; char room[HEADER_SIZE - sizeof (struct preliminary_header) + MAGIC_SIZE]; };
-/* Verify that HEADER_SIZE == sizeof (struct header). */
-typedef int verify1[2 * (HEADER_SIZE == sizeof (struct header)) - 1];
-/* We make the hash table quite big, so that during lookups the probability
- of empty hash buckets is quite high. There is no need to make the hash
- table resizable, because when the hash table gets filled so much that the
- lookup becomes slow, it means that the application has memory leaks. */
-#define HASH_TABLE_SIZE 257
-static void * mallocsa_results[HASH_TABLE_SIZE];
-
-#endif
-
-void *
-mallocsa (size_t n)
-{
-#if HAVE_ALLOCA
- /* Allocate one more word, that serves as an indicator for malloc()ed
- memory, so that freesa() of an alloca() result is fast. */
- size_t nplus = n + HEADER_SIZE;
-
- if (nplus >= n)
- {
- char *p = (char *) malloc (nplus);
-
- if (p != NULL)
- {
- size_t slot;
-
- p += HEADER_SIZE;
-
- /* Put a magic number into the indicator word. */
- ((int *) p)[-1] = MAGIC_NUMBER;
-
- /* Enter p into the hash table. */
- slot = (unsigned long) p % HASH_TABLE_SIZE;
- ((struct header *) (p - HEADER_SIZE))->next = mallocsa_results[slot];
- mallocsa_results[slot] = p;
-
- return p;
- }
- }
- /* Out of memory. */
- return NULL;
-#else
-# if !MALLOC_0_IS_NONNULL
- if (n == 0)
- n = 1;
-# endif
- return malloc (n);
-#endif
-}
-
-#if HAVE_ALLOCA
-void
-freesa (void *p)
-{
- /* mallocsa() may have returned NULL. */
- if (p != NULL)
- {
- /* Attempt to quickly distinguish the mallocsa() result - which has
- a magic indicator word - and the alloca() result - which has an
- uninitialized indicator word. It is for this test that sa_increment
- additional bytes are allocated in the alloca() case. */
- if (((int *) p)[-1] == MAGIC_NUMBER)
- {
- /* Looks like a mallocsa() result. To see whether it really is one,
- perform a lookup in the hash table. */
- size_t slot = (unsigned long) p % HASH_TABLE_SIZE;
- void **chain = &mallocsa_results[slot];
- for (; *chain != NULL;)
- {
- if (*chain == p)
- {
- /* Found it. Remove it from the hash table and free it. */
- char *p_begin = (char *) p - HEADER_SIZE;
- *chain = ((struct header *) p_begin)->next;
- free (p_begin);
- return;
- }
- chain = &((struct header *) ((char *) *chain - HEADER_SIZE))->next;
- }
- }
- /* At this point, we know it was not a mallocsa() result. */
- }
-}
-#endif
+++ /dev/null
-/* Safe automatic memory allocation.
- Copyright (C) 2003-2005 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _ALLOCSA_H
-#define _ALLOCSA_H
-
-#include <alloca.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* safe_alloca(N) is equivalent to alloca(N) when it is safe to call
- alloca(N); otherwise it returns NULL. It either returns N bytes of
- memory allocated on the stack, that lasts until the function returns,
- or NULL.
- Use of safe_alloca should be avoided:
- - inside arguments of function calls - undefined behaviour,
- - in inline functions - the allocation may actually last until the
- calling function returns.
-*/
-#if HAVE_ALLOCA
-/* The OS usually guarantees only one guard page at the bottom of the stack,
- and a page size can be as small as 4096 bytes. So we cannot safely
- allocate anything larger than 4096 bytes. Also care for the possibility
- of a few compiler-allocated temporary stack slots.
- This must be a macro, not an inline function. */
-# define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL)
-#else
-# define safe_alloca(N) ((N), NULL)
-#endif
-
-/* allocsa(N) is a safe variant of alloca(N). It allocates N bytes of
- memory allocated on the stack, that must be freed using freesa() before
- the function returns. Upon failure, it returns NULL. */
-#if HAVE_ALLOCA
-# define allocsa(N) \
- ((N) < 4032 - sa_increment \
- ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \
- : mallocsa (N))
-#else
-# define allocsa(N) \
- mallocsa (N)
-#endif
-extern void * mallocsa (size_t n);
-
-/* Free a block of memory allocated through allocsa(). */
-#if HAVE_ALLOCA
-extern void freesa (void *p);
-#else
-# define freesa free
-#endif
-
-/* Maybe we should also define a variant
- nallocsa (size_t n, size_t s) - behaves like allocsa (n * s)
- If this would be useful in your application. please speak up. */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-/* ------------------- Auxiliary, non-public definitions ------------------- */
-
-/* Determine the alignment of a type at compile time. */
-#if defined __GNUC__
-# define sa_alignof __alignof__
-#elif defined __cplusplus
- template <class type> struct sa_alignof_helper { char __slot1; type __slot2; };
-# define sa_alignof(type) offsetof (sa_alignof_helper<type>, __slot2)
-#elif defined __hpux
- /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof
- values. */
-# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
-#elif defined _AIX
- /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof
- values. */
-# define sa_alignof(type) 4
-#else
-# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
-#endif
-
-enum
-{
-/* The desired alignment of memory allocations is the maximum alignment
- among all elementary types. */
- sa_alignment_long = sa_alignof (long),
- sa_alignment_double = sa_alignof (double),
-#ifdef HAVE_LONG_LONG
- sa_alignment_longlong = sa_alignof (long long),
-#endif
-#ifdef HAVE_LONG_DOUBLE
- sa_alignment_longdouble = sa_alignof (long double),
-#endif
- sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1)
-#ifdef HAVE_LONG_LONG
- | (sa_alignment_longlong - 1)
-#endif
-#ifdef HAVE_LONG_DOUBLE
- | (sa_alignment_longdouble - 1)
-#endif
- ) + 1,
-/* The increment that guarantees room for a magic word must be >= sizeof (int)
- and a multiple of sa_alignment_max. */
- sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max
-};
-
-#endif /* _ALLOCSA_H */
+++ /dev/null
-# Suppress a valgrind message about use of uninitialized memory in freesa().
-# This use is OK because it provides only a speedup.
-{
- freesa
- Memcheck:Cond
- fun:freesa
-}
+++ /dev/null
-/* argmatch.c -- find a match for a string in an array
-
- Copyright (C) 1990, 1998, 1999, 2001, 2002, 2003, 2004, 2005 Free
- Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Written by David MacKenzie <djm@ai.mit.edu>
- Modified by Akim Demaille <demaille@inf.enst.fr> */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "argmatch.h"
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "gettext.h"
-#define _(msgid) gettext (msgid)
-
-#include "error.h"
-#include "exit.h"
-#include "quotearg.h"
-#include "quote.h"
-
-#if USE_UNLOCKED_IO
-# include "unlocked-io.h"
-#endif
-
-/* When reporting an invalid argument, show nonprinting characters
- by using the quoting style ARGMATCH_QUOTING_STYLE. Do not use
- literal_quoting_style. */
-#ifndef ARGMATCH_QUOTING_STYLE
-# define ARGMATCH_QUOTING_STYLE locale_quoting_style
-#endif
-
-/* Non failing version of argmatch call this function after failing. */
-#ifndef ARGMATCH_DIE
-# include "exitfail.h"
-# define ARGMATCH_DIE exit (exit_failure)
-#endif
-
-#ifdef ARGMATCH_DIE_DECL
-ARGMATCH_DIE_DECL;
-#endif
-
-static void
-__argmatch_die (void)
-{
- ARGMATCH_DIE;
-}
-
-/* Used by XARGMATCH and XARGCASEMATCH. See description in argmatch.h.
- Default to __argmatch_die, but allow caller to change this at run-time. */
-argmatch_exit_fn argmatch_die = __argmatch_die;
-
-\f
-/* If ARG is an unambiguous match for an element of the
- NULL-terminated array ARGLIST, return the index in ARGLIST
- of the matched element, else -1 if it does not match any element
- or -2 if it is ambiguous (is a prefix of more than one element).
-
- If VALLIST is none null, use it to resolve ambiguities limited to
- synonyms, i.e., for
- "yes", "yop" -> 0
- "no", "nope" -> 1
- "y" is a valid argument, for `0', and "n" for `1'. */
-
-ptrdiff_t
-argmatch (const char *arg, const char *const *arglist,
- const char *vallist, size_t valsize)
-{
- size_t i; /* Temporary index in ARGLIST. */
- size_t arglen; /* Length of ARG. */
- ptrdiff_t matchind = -1; /* Index of first nonexact match. */
- bool ambiguous = false; /* If true, multiple nonexact match(es). */
-
- arglen = strlen (arg);
-
- /* Test all elements for either exact match or abbreviated matches. */
- for (i = 0; arglist[i]; i++)
- {
- if (!strncmp (arglist[i], arg, arglen))
- {
- if (strlen (arglist[i]) == arglen)
- /* Exact match found. */
- return i;
- else if (matchind == -1)
- /* First nonexact match found. */
- matchind = i;
- else
- {
- /* Second nonexact match found. */
- if (vallist == NULL
- || memcmp (vallist + valsize * matchind,
- vallist + valsize * i, valsize))
- {
- /* There is a real ambiguity, or we could not
- disambiguate. */
- ambiguous = true;
- }
- }
- }
- }
- if (ambiguous)
- return -2;
- else
- return matchind;
-}
-
-/* Error reporting for argmatch.
- CONTEXT is a description of the type of entity that was being matched.
- VALUE is the invalid value that was given.
- PROBLEM is the return value from argmatch. */
-
-void
-argmatch_invalid (const char *context, const char *value, ptrdiff_t problem)
-{
- char const *format = (problem == -1
- ? _("invalid argument %s for %s")
- : _("ambiguous argument %s for %s"));
-
- error (0, 0, format, quotearg_n_style (0, ARGMATCH_QUOTING_STYLE, value),
- quote_n (1, context));
-}
-
-/* List the valid arguments for argmatch.
- ARGLIST is the same as in argmatch.
- VALLIST is a pointer to an array of values.
- VALSIZE is the size of the elements of VALLIST */
-void
-argmatch_valid (const char *const *arglist,
- const char *vallist, size_t valsize)
-{
- size_t i;
- const char *last_val = NULL;
-
- /* We try to put synonyms on the same line. The assumption is that
- synonyms follow each other */
- fprintf (stderr, _("Valid arguments are:"));
- for (i = 0; arglist[i]; i++)
- if ((i == 0)
- || memcmp (last_val, vallist + valsize * i, valsize))
- {
- fprintf (stderr, "\n - `%s'", arglist[i]);
- last_val = vallist + valsize * i;
- }
- else
- {
- fprintf (stderr, ", `%s'", arglist[i]);
- }
- putc ('\n', stderr);
-}
-
-/* Never failing versions of the previous functions.
-
- CONTEXT is the context for which argmatch is called (e.g.,
- "--version-control", or "$VERSION_CONTROL" etc.). Upon failure,
- calls the (supposed never to return) function EXIT_FN. */
-
-ptrdiff_t
-__xargmatch_internal (const char *context,
- const char *arg, const char *const *arglist,
- const char *vallist, size_t valsize,
- argmatch_exit_fn exit_fn)
-{
- ptrdiff_t res = argmatch (arg, arglist, vallist, valsize);
- if (res >= 0)
- /* Success. */
- return res;
-
- /* We failed. Explain why. */
- argmatch_invalid (context, arg, res);
- argmatch_valid (arglist, vallist, valsize);
- (*exit_fn) ();
-
- return -1; /* To please the compilers. */
-}
-
-/* Look for VALUE in VALLIST, an array of objects of size VALSIZE and
- return the first corresponding argument in ARGLIST */
-const char *
-argmatch_to_argument (const char *value,
- const char *const *arglist,
- const char *vallist, size_t valsize)
-{
- size_t i;
-
- for (i = 0; arglist[i]; i++)
- if (!memcmp (value, vallist + valsize * i, valsize))
- return arglist[i];
- return NULL;
-}
-
-#ifdef TEST
-/*
- * Based on "getversion.c" by David MacKenzie <djm@gnu.ai.mit.edu>
- */
-char *program_name;
-
-/* When to make backup files. */
-enum backup_type
-{
- /* Never make backups. */
- no_backups,
-
- /* Make simple backups of every file. */
- simple_backups,
-
- /* Make numbered backups of files that already have numbered backups,
- and simple backups of the others. */
- numbered_existing_backups,
-
- /* Make numbered backups of every file. */
- numbered_backups
-};
-
-/* Two tables describing arguments (keys) and their corresponding
- values */
-static const char *const backup_args[] =
-{
- "no", "none", "off",
- "simple", "never",
- "existing", "nil",
- "numbered", "t",
- 0
-};
-
-static const enum backup_type backup_vals[] =
-{
- no_backups, no_backups, no_backups,
- simple_backups, simple_backups,
- numbered_existing_backups, numbered_existing_backups,
- numbered_backups, numbered_backups
-};
-
-int
-main (int argc, const char *const *argv)
-{
- const char *cp;
- enum backup_type backup_type = no_backups;
-
- program_name = (char *) argv[0];
-
- if (argc > 2)
- {
- fprintf (stderr, "Usage: %s [VERSION_CONTROL]\n", program_name);
- exit (1);
- }
-
- if ((cp = getenv ("VERSION_CONTROL")))
- backup_type = XARGMATCH ("$VERSION_CONTROL", cp,
- backup_args, backup_vals);
-
- if (argc == 2)
- backup_type = XARGMATCH (program_name, argv[1],
- backup_args, backup_vals);
-
- printf ("The version control is `%s'\n",
- ARGMATCH_TO_ARGUMENT (backup_type, backup_args, backup_vals));
-
- return 0;
-}
-#endif
+++ /dev/null
-/* argmatch.h -- definitions and prototypes for argmatch.c
-
- Copyright (C) 1990, 1998, 1999, 2001, 2002, 2004, 2005 Free Software
- Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Written by David MacKenzie <djm@ai.mit.edu>
- Modified by Akim Demaille <demaille@inf.enst.fr> */
-
-#ifndef ARGMATCH_H_
-# define ARGMATCH_H_ 1
-
-# include <stddef.h>
-
-# include "verify.h"
-
-# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
-
-/* Assert there are as many real arguments as there are values
- (argument list ends with a NULL guard). */
-
-# define ARGMATCH_VERIFY(Arglist, Vallist) \
- verify (ARRAY_CARDINALITY (Arglist) == ARRAY_CARDINALITY (Vallist) + 1)
-
-/* Return the index of the element of ARGLIST (NULL terminated) that
- matches with ARG. If VALLIST is not NULL, then use it to resolve
- false ambiguities (i.e., different matches of ARG but corresponding
- to the same values in VALLIST). */
-
-ptrdiff_t argmatch (char const *arg, char const *const *arglist,
- char const *vallist, size_t valsize);
-
-# define ARGMATCH(Arg, Arglist, Vallist) \
- argmatch (Arg, Arglist, (char const *) (Vallist), sizeof *(Vallist))
-
-/* xargmatch calls this function when it fails. This function should not
- return. By default, this is a function that calls ARGMATCH_DIE which
- in turn defaults to `exit (exit_failure)'. */
-typedef void (*argmatch_exit_fn) (void);
-extern DLL_VARIABLE argmatch_exit_fn argmatch_die;
-
-/* Report on stderr why argmatch failed. Report correct values. */
-
-void argmatch_invalid (char const *context, char const *value,
- ptrdiff_t problem);
-
-/* Left for compatibility with the old name invalid_arg */
-
-# define invalid_arg(Context, Value, Problem) \
- argmatch_invalid (Context, Value, Problem)
-
-
-
-/* Report on stderr the list of possible arguments. */
-
-void argmatch_valid (char const *const *arglist,
- char const *vallist, size_t valsize);
-
-# define ARGMATCH_VALID(Arglist, Vallist) \
- argmatch_valid (Arglist, (char const *) (Vallist), sizeof *(Vallist))
-
-
-
-/* Same as argmatch, but upon failure, reports a explanation on the
- failure, and exits using the function EXIT_FN. */
-
-ptrdiff_t __xargmatch_internal (char const *context,
- char const *arg, char const *const *arglist,
- char const *vallist, size_t valsize,
- argmatch_exit_fn exit_fn);
-
-/* Programmer friendly interface to __xargmatch_internal. */
-
-# define XARGMATCH(Context, Arg, Arglist, Vallist) \
- ((Vallist) [__xargmatch_internal (Context, Arg, Arglist, \
- (char const *) (Vallist), \
- sizeof *(Vallist), \
- argmatch_die)])
-
-/* Convert a value into a corresponding argument. */
-
-char const *argmatch_to_argument (char const *value,
- char const *const *arglist,
- char const *vallist, size_t valsize);
-
-# define ARGMATCH_TO_ARGUMENT(Value, Arglist, Vallist) \
- argmatch_to_argument (Value, Arglist, \
- (char const *) (Vallist), sizeof *(Vallist))
-
-#endif /* ARGMATCH_H_ */
+++ /dev/null
-/* Wrapper to implement ANSI C's atexit using SunOS's on_exit. */
-/* This function is in the public domain. --Mike Stump. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-int
-atexit (void (*f) (void))
-{
- /* If the system doesn't provide a definition for atexit, use on_exit
- if the system provides that. */
- on_exit (f, 0);
- return 0;
-}
+++ /dev/null
-/* Binary mode I/O.
- Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _BINARY_H
-#define _BINARY_H
-
-/* For systems that distinguish between text and binary I/O.
- O_BINARY is usually declared in <fcntl.h>. */
-#include <fcntl.h>
-
-/* The MSVC7 <stdio.h> doesn't like to be included after '#define fileno ...',
- so we include it here first. */
-#include <stdio.h>
-
-#if !defined O_BINARY && defined _O_BINARY
- /* For MSC-compatible compilers. */
-# define O_BINARY _O_BINARY
-# define O_TEXT _O_TEXT
-#endif
-#ifdef __BEOS__
- /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */
-# undef O_BINARY
-# undef O_TEXT
-#endif
-#if O_BINARY
-# if !(defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__)
-# define setmode _setmode
-# undef fileno
-# define fileno _fileno
-# endif
-# if defined __DJGPP__ || defined __CYGWIN__
-# include <io.h> /* declares setmode() */
-# endif
-# ifdef __DJGPP__
-# include <unistd.h> /* declares isatty() */
-# /* Avoid putting stdin/stdout in binary mode if it is connected to the
-# console, because that would make it impossible for the user to
-# interrupt the program through Ctrl-C or Ctrl-Break. */
-# define SET_BINARY(fd) (!isatty (fd) ? (setmode (fd, O_BINARY), 0) : 0)
-# else
-# define SET_BINARY(fd) setmode (fd, O_BINARY)
-# endif
-#else
- /* On reasonable systems, binary I/O is the default. */
-# undef O_BINARY
-# define O_BINARY 0
-# define SET_BINARY(fd) /* nothing */
-#endif
-
-#endif /* _BINARY_H */
+++ /dev/null
-/* byteswap.h - Byte swapping
- Copyright (C) 2005 Free Software Foundation, Inc.
- Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _BYTESWAP_H
-
-/* Given an unsigned 16-bit argument X, return the value corresponding to
- X with reversed byte order. */
-#define bswap_16(x) ((((x) & 0x00FF) << 8) | \
- (((x) & 0xFF00) >> 8))
-
-/* Given an unsigned 32-bit argument X, return the value corresponding to
- X with reversed byte order. */
-#define bswap_32(x) ((((x) & 0x000000FF) << 24) | \
- (((x) & 0x0000FF00) << 8) | \
- (((x) & 0x00FF0000) << 8) | \
- (((x) & 0xFF000000) >> 24))
-
-/* Given an unsigned 64-bit argument X, return the value corresponding to
- X with reversed byte order. */
-#define bswap_64(x) ((((x) & 0x00000000000000FFULL) << 56) | \
- (((x) & 0x000000000000FF00ULL) << 40) | \
- (((x) & 0x0000000000FF0000ULL) << 24) | \
- (((x) & 0x00000000FF000000ULL) << 8) | \
- (((x) & 0x000000FF00000000ULL) >> 8) | \
- (((x) & 0x0000FF0000000000ULL) >> 24) | \
- (((x) & 0x00FF000000000000ULL) >> 40) | \
- (((x) & 0xFF00000000000000ULL) >> 56))
-
-#endif
+++ /dev/null
-/* Character handling in C locale.
-
- Copyright 2000-2003 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation,
-Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Specification. */
-#include "c-ctype.h"
-
-#undef c_isalnum
-#undef c_isalpha
-#undef c_isascii
-#undef c_isblank
-#undef c_iscntrl
-#undef c_isdigit
-#undef c_islower
-#undef c_isgraph
-#undef c_isprint
-#undef c_ispunct
-#undef c_isspace
-#undef c_isupper
-#undef c_isxdigit
-#undef c_tolower
-#undef c_toupper
-
-/* The function isascii is not locale dependent. Its use in EBCDIC is
- questionable. */
-bool
-c_isascii (int c)
-{
- return (c >= 0x00 && c <= 0x7f);
-}
-
-bool
-c_isalnum (int c)
-{
-#if C_CTYPE_CONSECUTIVE_DIGITS \
- && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
-#if C_CTYPE_ASCII
- return ((c >= '0' && c <= '9')
- || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'));
-#else
- return ((c >= '0' && c <= '9')
- || (c >= 'A' && c <= 'Z')
- || (c >= 'a' && c <= 'z'));
-#endif
-#else
- switch (c)
- {
- case '0': case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9':
- case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
- case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
- case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
- case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
- case 'Y': case 'Z':
- case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
- case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
- case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
- case 's': case 't': case 'u': case 'v': case 'w': case 'x':
- case 'y': case 'z':
- return 1;
- default:
- return 0;
- }
-#endif
-}
-
-bool
-c_isalpha (int c)
-{
-#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
-#if C_CTYPE_ASCII
- return ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z');
-#else
- return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'));
-#endif
-#else
- switch (c)
- {
- case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
- case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
- case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
- case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
- case 'Y': case 'Z':
- case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
- case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
- case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
- case 's': case 't': case 'u': case 'v': case 'w': case 'x':
- case 'y': case 'z':
- return 1;
- default:
- return 0;
- }
-#endif
-}
-
-bool
-c_isblank (int c)
-{
- return (c == ' ' || c == '\t');
-}
-
-bool
-c_iscntrl (int c)
-{
-#if C_CTYPE_ASCII
- return ((c & ~0x1f) == 0 || c == 0x7f);
-#else
- switch (c)
- {
- case ' ': 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 '@':
- 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 '`':
- 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 '~':
- return 0;
- default:
- return 1;
- }
-#endif
-}
-
-bool
-c_isdigit (int c)
-{
-#if C_CTYPE_CONSECUTIVE_DIGITS
- return (c >= '0' && c <= '9');
-#else
- switch (c)
- {
- case '0': case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9':
- return 1;
- default:
- return 0;
- }
-#endif
-}
-
-bool
-c_islower (int c)
-{
-#if C_CTYPE_CONSECUTIVE_LOWERCASE
- return (c >= 'a' && c <= 'z');
-#else
- switch (c)
- {
- case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
- case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
- case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
- case 's': case 't': case 'u': case 'v': case 'w': case 'x':
- case 'y': case 'z':
- return 1;
- default:
- return 0;
- }
-#endif
-}
-
-bool
-c_isgraph (int c)
-{
-#if C_CTYPE_ASCII
- return (c >= '!' && c <= '~');
-#else
- switch (c)
- {
- 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 '@':
- 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 '`':
- 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 '~':
- return 1;
- default:
- return 0;
- }
-#endif
-}
-
-bool
-c_isprint (int c)
-{
-#if C_CTYPE_ASCII
- return (c >= ' ' && c <= '~');
-#else
- switch (c)
- {
- case ' ': 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 '@':
- 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 '`':
- 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 '~':
- return 1;
- default:
- return 0;
- }
-#endif
-}
-
-bool
-c_ispunct (int c)
-{
-#if C_CTYPE_ASCII
- return ((c >= '!' && c <= '~')
- && !((c >= '0' && c <= '9')
- || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z')));
-#else
- switch (c)
- {
- case '!': case '"': case '#': case '$': case '%': case '&':
- case '\'': case '(': case ')': case '*': case '+': case ',':
- case '-': case '.': case '/':
- case ':': case ';': case '<': case '=': case '>': case '?':
- case '@':
- case '[': case '\\': case ']': case '^': case '_': case '`':
- case '{': case '|': case '}': case '~':
- return 1;
- default:
- return 0;
- }
-#endif
-}
-
-bool
-c_isspace (int c)
-{
- return (c == ' ' || c == '\t'
- || c == '\n' || c == '\v' || c == '\f' || c == '\r');
-}
-
-bool
-c_isupper (int c)
-{
-#if C_CTYPE_CONSECUTIVE_UPPERCASE
- return (c >= 'A' && c <= 'Z');
-#else
- switch (c)
- {
- case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
- case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
- case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
- case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
- case 'Y': case 'Z':
- return 1;
- default:
- return 0;
- }
-#endif
-}
-
-bool
-c_isxdigit (int c)
-{
-#if C_CTYPE_CONSECUTIVE_DIGITS \
- && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
-#if C_CTYPE_ASCII
- return ((c >= '0' && c <= '9')
- || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'F'));
-#else
- return ((c >= '0' && c <= '9')
- || (c >= 'A' && c <= 'F')
- || (c >= 'a' && c <= 'f'));
-#endif
-#else
- switch (c)
- {
- case '0': case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9':
- case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
- case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
- return 1;
- default:
- return 0;
- }
-#endif
-}
-
-int
-c_tolower (int c)
-{
-#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
- return (c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c);
-#else
- switch (c)
- {
- case 'A': return 'a';
- case 'B': return 'b';
- case 'C': return 'c';
- case 'D': return 'd';
- case 'E': return 'e';
- case 'F': return 'f';
- case 'G': return 'g';
- case 'H': return 'h';
- case 'I': return 'i';
- case 'J': return 'j';
- case 'K': return 'k';
- case 'L': return 'l';
- case 'M': return 'm';
- case 'N': return 'n';
- case 'O': return 'o';
- case 'P': return 'p';
- case 'Q': return 'q';
- case 'R': return 'r';
- case 'S': return 's';
- case 'T': return 't';
- case 'U': return 'u';
- case 'V': return 'v';
- case 'W': return 'w';
- case 'X': return 'x';
- case 'Y': return 'y';
- case 'Z': return 'z';
- default: return c;
- }
-#endif
-}
-
-int
-c_toupper (int c)
-{
-#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
- return (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c);
-#else
- switch (c)
- {
- case 'a': return 'A';
- case 'b': return 'B';
- case 'c': return 'C';
- case 'd': return 'D';
- case 'e': return 'E';
- case 'f': return 'F';
- case 'g': return 'G';
- case 'h': return 'H';
- case 'i': return 'I';
- case 'j': return 'J';
- case 'k': return 'K';
- case 'l': return 'L';
- case 'm': return 'M';
- case 'n': return 'N';
- case 'o': return 'O';
- case 'p': return 'P';
- case 'q': return 'Q';
- case 'r': return 'R';
- case 's': return 'S';
- case 't': return 'T';
- case 'u': return 'U';
- case 'v': return 'V';
- case 'w': return 'W';
- case 'x': return 'X';
- case 'y': return 'Y';
- case 'z': return 'Z';
- default: return c;
- }
-#endif
-}
+++ /dev/null
-/* Character handling in C locale.
-
- These functions work like the corresponding functions in <ctype.h>,
- except that they have the C (POSIX) locale hardwired, whereas the
- <ctype.h> functions' behaviour depends on the current locale set via
- setlocale.
-
- Copyright (C) 2000-2003 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation,
-Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef C_CTYPE_H
-#define C_CTYPE_H
-
-#include <stdbool.h>
-
-
-/* The functions defined in this file assume the "C" locale and a character
- set without diacritics (ASCII-US or EBCDIC-US or something like that).
- Even if the "C" locale on a particular system is an extension of the ASCII
- character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it
- is ISO-8859-1), the functions in this file recognize only the ASCII
- characters. */
-
-
-/* Check whether the ASCII optimizations apply. */
-
-/* ANSI C89 (and ISO C99 5.2.1.3 too) already guarantees that
- '0', '1', ..., '9' have consecutive integer values. */
-#define C_CTYPE_CONSECUTIVE_DIGITS 1
-
-#if ('A' <= 'Z') \
- && ('A' + 1 == 'B') && ('B' + 1 == 'C') && ('C' + 1 == 'D') \
- && ('D' + 1 == 'E') && ('E' + 1 == 'F') && ('F' + 1 == 'G') \
- && ('G' + 1 == 'H') && ('H' + 1 == 'I') && ('I' + 1 == 'J') \
- && ('J' + 1 == 'K') && ('K' + 1 == 'L') && ('L' + 1 == 'M') \
- && ('M' + 1 == 'N') && ('N' + 1 == 'O') && ('O' + 1 == 'P') \
- && ('P' + 1 == 'Q') && ('Q' + 1 == 'R') && ('R' + 1 == 'S') \
- && ('S' + 1 == 'T') && ('T' + 1 == 'U') && ('U' + 1 == 'V') \
- && ('V' + 1 == 'W') && ('W' + 1 == 'X') && ('X' + 1 == 'Y') \
- && ('Y' + 1 == 'Z')
-#define C_CTYPE_CONSECUTIVE_UPPERCASE 1
-#endif
-
-#if ('a' <= 'z') \
- && ('a' + 1 == 'b') && ('b' + 1 == 'c') && ('c' + 1 == 'd') \
- && ('d' + 1 == 'e') && ('e' + 1 == 'f') && ('f' + 1 == 'g') \
- && ('g' + 1 == 'h') && ('h' + 1 == 'i') && ('i' + 1 == 'j') \
- && ('j' + 1 == 'k') && ('k' + 1 == 'l') && ('l' + 1 == 'm') \
- && ('m' + 1 == 'n') && ('n' + 1 == 'o') && ('o' + 1 == 'p') \
- && ('p' + 1 == 'q') && ('q' + 1 == 'r') && ('r' + 1 == 's') \
- && ('s' + 1 == 't') && ('t' + 1 == 'u') && ('u' + 1 == 'v') \
- && ('v' + 1 == 'w') && ('w' + 1 == 'x') && ('x' + 1 == 'y') \
- && ('y' + 1 == 'z')
-#define C_CTYPE_CONSECUTIVE_LOWERCASE 1
-#endif
-
-#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
- && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
- && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
- && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
- && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
- && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
- && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
- && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
- && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
- && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
- && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
- && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
- && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
- && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
- && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
- && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
- && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
- && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
- && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
- && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
- && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
- && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
- && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)
-/* The character set is ASCII or one of its variants or extensions, not EBCDIC.
- Testing the value of '\n' and '\r' is not relevant. */
-#define C_CTYPE_ASCII 1
-#endif
-
-
-/* Function declarations. */
-
-extern bool c_isascii (int c); /* not locale dependent */
-
-extern bool c_isalnum (int c);
-extern bool c_isalpha (int c);
-extern bool c_isblank (int c);
-extern bool c_iscntrl (int c);
-extern bool c_isdigit (int c);
-extern bool c_islower (int c);
-extern bool c_isgraph (int c);
-extern bool c_isprint (int c);
-extern bool c_ispunct (int c);
-extern bool c_isspace (int c);
-extern bool c_isupper (int c);
-extern bool c_isxdigit (int c);
-
-extern int c_tolower (int c);
-extern int c_toupper (int c);
-
-
-#if defined __GNUC__ && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__
-
-/* ASCII optimizations. */
-
-#define c_isascii(c) \
- ({ int __c = (c); \
- (__c >= 0x00 && __c <= 0x7f); \
- })
-
-#if C_CTYPE_CONSECUTIVE_DIGITS \
- && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
-#if C_CTYPE_ASCII
-#define c_isalnum(c) \
- ({ int __c = (c); \
- ((__c >= '0' && __c <= '9') \
- || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z')); \
- })
-#else
-#define c_isalnum(c) \
- ({ int __c = (c); \
- ((__c >= '0' && __c <= '9') \
- || (__c >= 'A' && __c <= 'Z') \
- || (__c >= 'a' && __c <= 'z')); \
- })
-#endif
-#endif
-
-#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
-#if C_CTYPE_ASCII
-#define c_isalpha(c) \
- ({ int __c = (c); \
- ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z'); \
- })
-#else
-#define c_isalpha(c) \
- ({ int __c = (c); \
- ((__c >= 'A' && __c <= 'Z') || (__c >= 'a' && __c <= 'z')); \
- })
-#endif
-#endif
-
-#define c_isblank(c) \
- ({ int __c = (c); \
- (__c == ' ' || __c == '\t'); \
- })
-
-#if C_CTYPE_ASCII
-#define c_iscntrl(c) \
- ({ int __c = (c); \
- ((__c & ~0x1f) == 0 || __c == 0x7f); \
- })
-#endif
-
-#if C_CTYPE_CONSECUTIVE_DIGITS
-#define c_isdigit(c) \
- ({ int __c = (c); \
- (__c >= '0' && __c <= '9'); \
- })
-#endif
-
-#if C_CTYPE_CONSECUTIVE_LOWERCASE
-#define c_islower(c) \
- ({ int __c = (c); \
- (__c >= 'a' && __c <= 'z'); \
- })
-#endif
-
-#if C_CTYPE_ASCII
-#define c_isgraph(c) \
- ({ int __c = (c); \
- (__c >= '!' && __c <= '~'); \
- })
-#endif
-
-#if C_CTYPE_ASCII
-#define c_isprint(c) \
- ({ int __c = (c); \
- (__c >= ' ' && __c <= '~'); \
- })
-#endif
-
-#if C_CTYPE_ASCII
-#define c_ispunct(c) \
- ({ int _c = (c); \
- (c_isgraph (_c) && ! c_isalnum (_c)); \
- })
-#endif
-
-#define c_isspace(c) \
- ({ int __c = (c); \
- (__c == ' ' || __c == '\t' \
- || __c == '\n' || __c == '\v' || __c == '\f' || __c == '\r'); \
- })
-
-#if C_CTYPE_CONSECUTIVE_UPPERCASE
-#define c_isupper(c) \
- ({ int __c = (c); \
- (__c >= 'A' && __c <= 'Z'); \
- })
-#endif
-
-#if C_CTYPE_CONSECUTIVE_DIGITS \
- && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
-#if C_CTYPE_ASCII
-#define c_isxdigit(c) \
- ({ int __c = (c); \
- ((__c >= '0' && __c <= '9') \
- || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'F')); \
- })
-#else
-#define c_isxdigit(c) \
- ({ int __c = (c); \
- ((__c >= '0' && __c <= '9') \
- || (__c >= 'A' && __c <= 'F') \
- || (__c >= 'a' && __c <= 'f')); \
- })
-#endif
-#endif
-
-#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
-#define c_tolower(c) \
- ({ int __c = (c); \
- (__c >= 'A' && __c <= 'Z' ? __c - 'A' + 'a' : __c); \
- })
-#define c_toupper(c) \
- ({ int __c = (c); \
- (__c >= 'a' && __c <= 'z' ? __c - 'a' + 'A' : __c); \
- })
-#endif
-
-#endif /* optimizing for speed */
-
-#endif /* C_CTYPE_H */
+++ /dev/null
-/* Case-insensitive string comparison functions in C locale.
- Copyright (C) 1995-1996, 2001, 2003, 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef C_STRCASE_H
-#define C_STRCASE_H
-
-#include <stddef.h>
-
-
-/* The functions defined in this file assume the "C" locale and a character
- set without diacritics (ASCII-US or EBCDIC-US or something like that).
- Even if the "C" locale on a particular system is an extension of the ASCII
- character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it
- is ISO-8859-1), the functions in this file recognize only the ASCII
- characters. More precisely, one of the string arguments must be an ASCII
- string; the other one can also contain non-ASCII characters (but then
- the comparison result will be nonzero). */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
- greater than zero if S1 is lexicographically less than, equal to or greater
- than S2. */
-extern int c_strcasecmp (const char *s1, const char *s2);
-
-/* Compare no more than N characters of strings S1 and S2, ignoring case,
- returning less than, equal to or greater than zero if S1 is
- lexicographically less than, equal to or greater than S2. */
-extern int c_strncasecmp (const char *s1, const char *s2, size_t n);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* C_STRCASE_H */
+++ /dev/null
-/* c-strcasecmp.c -- case insensitive string comparator in C locale
- Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "c-strcase.h"
-
-#include <limits.h>
-
-#include "c-ctype.h"
-
-int
-c_strcasecmp (const char *s1, const char *s2)
-{
- register const unsigned char *p1 = (const unsigned char *) s1;
- register const unsigned char *p2 = (const unsigned char *) s2;
- unsigned char c1, c2;
-
- if (p1 == p2)
- return 0;
-
- do
- {
- c1 = c_tolower (*p1);
- c2 = c_tolower (*p2);
-
- if (c1 == '\0')
- break;
-
- ++p1;
- ++p2;
- }
- while (c1 == c2);
-
- if (UCHAR_MAX <= INT_MAX)
- return c1 - c2;
- else
- /* On machines where 'char' and 'int' are types of the same size, the
- difference of two 'unsigned char' values - including the sign bit -
- doesn't fit in an 'int'. */
- return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
-}
+++ /dev/null
-/* c-strcasestr.c -- case insensitive substring search in C locale
- Copyright (C) 2005 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2005.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "c-strcasestr.h"
-
-#include <stddef.h>
-
-#include "c-ctype.h"
-
-/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
- comparison.
- Note: This function may, in multibyte locales, return success even if
- strlen (haystack) < strlen (needle) ! */
-char *
-c_strcasestr (const char *haystack, const char *needle)
-{
- /* Be careful not to look at the entire extent of haystack or needle
- until needed. This is useful because of these two cases:
- - haystack may be very long, and a match of needle found early,
- - needle may be very long, and not even a short initial segment of
- needle may be found in haystack. */
- if (*needle != '\0')
- {
- /* Speed up the following searches of needle by caching its first
- character. */
- unsigned char b = c_tolower ((unsigned char) *needle);
-
- needle++;
- for (;; haystack++)
- {
- if (*haystack == '\0')
- /* No match. */
- return NULL;
- if (c_tolower ((unsigned char) *haystack) == b)
- /* The first character matches. */
- {
- const char *rhaystack = haystack + 1;
- const char *rneedle = needle;
-
- for (;; rhaystack++, rneedle++)
- {
- if (*rneedle == '\0')
- /* Found a match. */
- return (char *) haystack;
- if (*rhaystack == '\0')
- /* No match. */
- return NULL;
- if (c_tolower ((unsigned char) *rhaystack)
- != c_tolower ((unsigned char) *rneedle))
- /* Nothing in this round. */
- break;
- }
- }
- }
- }
- else
- return (char *) haystack;
-}
+++ /dev/null
-/* Case-insensitive searching in a string in C locale.
- Copyright (C) 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef C_STRCASESTR_H
-#define C_STRCASESTR_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
- comparison. */
-extern char *c_strcasestr (const char *haystack, const char *needle);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* C_STRCASESTR_H */
+++ /dev/null
-/* c-strncasecmp.c -- case insensitive string comparator in C locale
- Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "c-strcase.h"
-
-#include <limits.h>
-
-#include "c-ctype.h"
-
-int
-c_strncasecmp (const char *s1, const char *s2, size_t n)
-{
- register const unsigned char *p1 = (const unsigned char *) s1;
- register const unsigned char *p2 = (const unsigned char *) s2;
- unsigned char c1, c2;
-
- if (p1 == p2 || n == 0)
- return 0;
-
- do
- {
- c1 = c_tolower (*p1);
- c2 = c_tolower (*p2);
-
- if (--n == 0 || c1 == '\0')
- break;
-
- ++p1;
- ++p2;
- }
- while (c1 == c2);
-
- if (UCHAR_MAX <= INT_MAX)
- return c1 - c2;
- else
- /* On machines where 'char' and 'int' are types of the same size, the
- difference of two 'unsigned char' values - including the sign bit -
- doesn't fit in an 'int'. */
- return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
-}
+++ /dev/null
-/* Java CLASSPATH handling.
- Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "classpath.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "xsetenv.h"
-#include "xalloc.h"
-
-/* Name of environment variable. */
-#ifndef CLASSPATHVAR
-# define CLASSPATHVAR "CLASSPATH"
-#endif
-
-/* Separator in PATH like lists of pathnames. */
-#if ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __EMX__ || defined __DJGPP__
- /* Win32, OS/2, DOS */
-# define PATH_SEPARATOR ';'
-#else
- /* Unix */
-# define PATH_SEPARATOR ':'
-#endif
-
-/* Return the new CLASSPATH value. The given classpaths are prepended to
- the current CLASSPATH value. If use_minimal_classpath, the current
- CLASSPATH is ignored. */
-char *
-new_classpath (const char * const *classpaths, unsigned int classpaths_count,
- bool use_minimal_classpath)
-{
- const char *old_classpath;
- unsigned int length;
- unsigned int i;
- char *result;
- char *p;
-
- old_classpath = (use_minimal_classpath ? NULL : getenv (CLASSPATHVAR));
- if (old_classpath == NULL)
- old_classpath = "";
-
- length = 0;
- for (i = 0; i < classpaths_count; i++)
- length += strlen (classpaths[i]) + 1;
- length += strlen (old_classpath);
- if (classpaths_count > 0 && old_classpath[0] == '\0')
- length--;
-
- result = (char *) xmalloc (length + 1);
- p = result;
- for (i = 0; i < classpaths_count; i++)
- {
- memcpy (p, classpaths[i], strlen (classpaths[i]));
- p += strlen (classpaths[i]);
- *p++ = PATH_SEPARATOR;
- }
- if (old_classpath[0] != '\0')
- {
- memcpy (p, old_classpath, strlen (old_classpath));
- p += strlen (old_classpath);
- }
- else
- {
- if (classpaths_count > 0)
- p--;
- }
- *p = '\0';
-
- return result;
-}
-
-/* Set CLASSPATH and returns a safe copy of its old value. */
-char *
-set_classpath (const char * const *classpaths, unsigned int classpaths_count,
- bool use_minimal_classpath, bool verbose)
-{
- const char *old_CLASSPATH = getenv (CLASSPATHVAR);
- char *result = (old_CLASSPATH != NULL ? xstrdup (old_CLASSPATH) : NULL);
- char *new_CLASSPATH =
- new_classpath (classpaths, classpaths_count, use_minimal_classpath);
-
- if (verbose)
- printf (CLASSPATHVAR "=%s ", new_CLASSPATH);
-
- xsetenv (CLASSPATHVAR, new_CLASSPATH, 1);
-
- free (new_CLASSPATH);
-
- return result;
-}
-
-/* Restore CLASSPATH to its previous value. */
-void
-reset_classpath (char *old_classpath)
-{
- if (old_classpath != NULL)
- {
- xsetenv (CLASSPATHVAR, old_classpath, 1);
- free (old_classpath);
- }
- else
- unsetenv (CLASSPATHVAR);
-}
+++ /dev/null
-/* Java CLASSPATH handling.
- Copyright (C) 2003 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#include <stdbool.h>
-
-/* Return the new CLASSPATH value. The given classpaths are prepended to
- the current CLASSPATH value. If use_minimal_classpath, the current
- CLASSPATH is ignored. */
-extern char * new_classpath (const char * const *classpaths,
- unsigned int classpaths_count,
- bool use_minimal_classpath);
-
-/* Set CLASSPATH and returns a safe copy of its old value. */
-extern char * set_classpath (const char * const *classpaths,
- unsigned int classpaths_count,
- bool use_minimal_classpath, bool verbose);
-
-/* Restore CLASSPATH to its previous value. */
-extern void reset_classpath (char *old_classpath);
+++ /dev/null
-/* Temporary directories and temporary files with automatic cleanup.
- Copyright (C) 2001, 2003, 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2006.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-/* Specification. */
-#include "clean-temp.h"
-
-#include <errno.h>
-#include <limits.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "error.h"
-#include "fatal-signal.h"
-#include "pathmax.h"
-#include "tmpdir.h"
-#include "mkdtemp.h"
-#include "xalloc.h"
-#include "xallocsa.h"
-#include "gl_linkedhash_list.h"
-#include "gettext.h"
-
-#define _(str) gettext (str)
-
-
-/* The use of 'volatile' in the types below (and ISO C 99 section 5.1.2.3.(5))
- ensure that while constructing or modifying the data structures, the field
- values are written to memory in the order of the C statements. So the
- signal handler can rely on these field values to be up to date. */
-
-
-/* Registry for a single temporary directory.
- 'struct temp_dir' from the public header file overlaps with this. */
-struct tempdir
-{
- /* The absolute pathname of the directory. */
- char * volatile dirname;
- /* Whether errors during explicit cleanup are reported to standard error. */
- bool cleanup_verbose;
- /* Absolute pathnames of subdirectories. */
- gl_list_t /* <char *> */ volatile subdirs;
- /* Absolute pathnames of files. */
- gl_list_t /* <char *> */ volatile files;
-};
-
-/* List of all temporary directories. */
-static struct
-{
- struct tempdir * volatile * volatile tempdir_list;
- size_t volatile tempdir_count;
- size_t tempdir_allocated;
-} cleanup_list /* = { NULL, 0, 0 } */;
-
-
-/* For the subdirs and for the files, we use a gl_list_t of type LINKEDHASH.
- Why? We need a data structure that
-
- 1) Can contain an arbitrary number of 'char *' values. The strings
- are compared via strcmp, not pointer comparison.
- 2) Has insertion and deletion operations that are fast: ideally O(1),
- or possibly O(log n). This is important for GNU sort, which may
- create a large number of temporary files.
- 3) Allows iteration through all elements from within a signal handler.
- 4) May or may not allow duplicates. It doesn't matter here, since
- any file or subdir can only be removed once.
-
- Criterion 1) would allow any gl_list_t or gl_oset_t implementation.
-
- Criterion 2) leaves only GL_LINKEDHASH_LIST, GL_TREEHASH_LIST, or
- GL_TREE_OSET.
-
- Criterion 3) puts at disadvantage GL_TREEHASH_LIST and GL_TREE_OSET.
- Namely, iteration through the elements of a binary tree requires access
- to many ->left, ->right, ->parent pointers. However, the rebalancing
- code for insertion and deletion in an AVL or red-black tree is so
- complicated that we cannot assume that >left, ->right, ->parent pointers
- are in a consistent state throughout these operations. Therefore, to
- avoid a crash in the signal handler, all destructive operations to the
- lists would have to be protected by a
- block_fatal_signals ();
- ...
- unblock_fatal_signals ();
- pair. Which causes extra system calls.
-
- Criterion 3) would also discourage GL_ARRAY_LIST and GL_CARRAY_LIST,
- if they were not already excluded. Namely, these implementations use
- xrealloc(), leaving a time window in which in the list->elements pointer
- points to already deallocated memory. To avoid a crash in the signal
- handler at such a moment, all destructive operations would have to
- protected by block/unblock_fatal_signals (), in this case too.
-
- A list of type GL_LINKEDHASH_LIST without duplicates fulfills all
- requirements:
- 2) Insertion and deletion are O(1) on average.
- 3) The gl_list_iterator, gl_list_iterator_next implementations do
- not trigger memory allocations, nor other system calls, and are
- therefore safe to be called from a signal handler.
- Furthermore, since SIGNAL_SAFE_LIST is defined, the implementation
- of the destructive functions ensures that the list structure is
- safe to be traversed at any moment, even when interrupted by an
- asynchronous signal.
- */
-
-/* String equality and hash code functions used by the lists. */
-
-static bool
-string_equals (const void *x1, const void *x2)
-{
- const char *s1 = x1;
- const char *s2 = x2;
- return strcmp (s1, s2) == 0;
-}
-
-#define SIZE_BITS (sizeof (size_t) * CHAR_BIT)
-
-/* A hash function for NUL-terminated char* strings using
- the method described by Bruno Haible.
- See http://www.haible.de/bruno/hashfunc.html. */
-static size_t
-string_hash (const void *x)
-{
- const char *s = x;
- size_t h = 0;
-
- for (; *s; s++)
- h = *s + ((h << 9) | (h >> (SIZE_BITS - 9)));
-
- return h;
-}
-
-
-/* The signal handler. It gets called asynchronously. */
-static void
-cleanup ()
-{
- size_t i;
-
- for (i = 0; i < cleanup_list.tempdir_count; i++)
- {
- struct tempdir *dir = cleanup_list.tempdir_list[i];
-
- if (dir != NULL)
- {
- gl_list_iterator_t iter;
- const void *element;
-
- /* First cleanup the files in the subdirectories. */
- iter = gl_list_iterator (dir->files);
- while (gl_list_iterator_next (&iter, &element, NULL))
- {
- const char *file = (const char *) element;
- unlink (file);
- }
- gl_list_iterator_free (&iter);
-
- /* Then cleanup the subdirectories. */
- iter = gl_list_iterator (dir->subdirs);
- while (gl_list_iterator_next (&iter, &element, NULL))
- {
- const char *subdir = (const char *) element;
- rmdir (subdir);
- }
- gl_list_iterator_free (&iter);
-
- /* Then cleanup the temporary directory itself. */
- rmdir (dir->dirname);
- }
- }
-}
-
-/* Create a temporary directory.
- PREFIX is used as a prefix for the name of the temporary directory. It
- should be short and still give an indication about the program.
- PARENTDIR can be used to specify the parent directory; if NULL, a default
- parent directory is used (either $TMPDIR or /tmp or similar).
- CLEANUP_VERBOSE determines whether errors during explicit cleanup are
- reported to standard error.
- Return a fresh 'struct temp_dir' on success. Upon error, an error message
- is shown and NULL is returned. */
-struct temp_dir *
-create_temp_dir (const char *prefix, const char *parentdir,
- bool cleanup_verbose)
-{
- struct tempdir * volatile *tmpdirp = NULL;
- struct tempdir *tmpdir;
- size_t i;
- char *template;
- char *tmpdirname;
-
- /* See whether it can take the slot of an earlier temporary directory
- already cleaned up. */
- for (i = 0; i < cleanup_list.tempdir_count; i++)
- if (cleanup_list.tempdir_list[i] == NULL)
- {
- tmpdirp = &cleanup_list.tempdir_list[i];
- break;
- }
- if (tmpdirp == NULL)
- {
- /* See whether the array needs to be extended. */
- if (cleanup_list.tempdir_count == cleanup_list.tempdir_allocated)
- {
- /* Note that we cannot use xrealloc(), because then the cleanup()
- function could access an already deallocated array. */
- struct tempdir * volatile *old_array = cleanup_list.tempdir_list;
- size_t old_allocated = cleanup_list.tempdir_allocated;
- size_t new_allocated = 2 * cleanup_list.tempdir_allocated + 1;
- struct tempdir * volatile *new_array =
- (struct tempdir * volatile *)
- xmalloc (new_allocated * sizeof (struct tempdir * volatile));
-
- if (old_allocated == 0)
- /* First use of this facility. Register the cleanup handler. */
- at_fatal_signal (&cleanup);
- else
- {
- /* Don't use memcpy() here, because memcpy takes non-volatile
- arguments and is therefore not guaranteed to complete all
- memory stores before the next statement. */
- size_t k;
-
- for (k = 0; k < old_allocated; k++)
- new_array[k] = old_array[k];
- }
-
- cleanup_list.tempdir_list = new_array;
- cleanup_list.tempdir_allocated = new_allocated;
-
- /* Now we can free the old array. */
- if (old_array != NULL)
- free ((struct tempdir **) old_array);
- }
-
- tmpdirp = &cleanup_list.tempdir_list[cleanup_list.tempdir_count];
- /* Initialize *tmpdirp before incrementing tempdir_count, so that
- cleanup() will skip this entry before it is fully initialized. */
- *tmpdirp = NULL;
- cleanup_list.tempdir_count++;
- }
-
- /* Initialize a 'struct tempdir'. */
- tmpdir = (struct tempdir *) xmalloc (sizeof (struct tempdir));
- tmpdir->dirname = NULL;
- tmpdir->cleanup_verbose = cleanup_verbose;
- tmpdir->subdirs = gl_list_create_empty (GL_LINKEDHASH_LIST,
- string_equals, string_hash, false);
- tmpdir->files = gl_list_create_empty (GL_LINKEDHASH_LIST,
- string_equals, string_hash, false);
-
- /* Create the temporary directory. */
- template = (char *) xallocsa (PATH_MAX);
- if (path_search (template, PATH_MAX, parentdir, prefix, parentdir == NULL))
- {
- error (0, errno,
- _("cannot find a temporary directory, try setting $TMPDIR"));
- goto quit;
- }
- block_fatal_signals ();
- tmpdirname = mkdtemp (template);
- if (tmpdirname != NULL)
- {
- tmpdir->dirname = tmpdirname;
- *tmpdirp = tmpdir;
- }
- unblock_fatal_signals ();
- if (tmpdirname == NULL)
- {
- error (0, errno,
- _("cannot create a temporary directory using template \"%s\""),
- template);
- goto quit;
- }
- /* Replace tmpdir->dirname with a copy that has indefinite extent.
- We cannot do this inside the block_fatal_signals/unblock_fatal_signals
- block because then the cleanup handler would not remove the directory
- if xstrdup fails. */
- tmpdir->dirname = xstrdup (tmpdirname);
- freesa (template);
- return (struct temp_dir *) tmpdir;
-
- quit:
- freesa (template);
- return NULL;
-}
-
-/* Register the given ABSOLUTE_FILE_NAME as being a file inside DIR, that
- needs to be removed before DIR can be removed.
- Should be called before the file ABSOLUTE_FILE_NAME is created. */
-void
-register_temp_file (struct temp_dir *dir,
- const char *absolute_file_name)
-{
- struct tempdir *tmpdir = (struct tempdir *)dir;
-
- /* Add absolute_file_name to tmpdir->files, without duplicates. */
- if (gl_list_search (tmpdir->files, absolute_file_name) == NULL)
- gl_list_add_first (tmpdir->files, xstrdup (absolute_file_name));
-}
-
-/* Unregister the given ABSOLUTE_FILE_NAME as being a file inside DIR, that
- needs to be removed before DIR can be removed.
- Should be called when the file ABSOLUTE_FILE_NAME could not be created. */
-void
-unregister_temp_file (struct temp_dir *dir,
- const char *absolute_file_name)
-{
- struct tempdir *tmpdir = (struct tempdir *)dir;
- gl_list_t list = tmpdir->files;
- gl_list_node_t node;
-
- node = gl_list_search (list, absolute_file_name);
- if (node != NULL)
- {
- char *old_string = (char *) gl_list_node_value (list, node);
-
- gl_list_remove_node (list, node);
- free (old_string);
- }
-}
-
-/* Register the given ABSOLUTE_DIR_NAME as being a subdirectory inside DIR,
- that needs to be removed before DIR can be removed.
- Should be called before the subdirectory ABSOLUTE_DIR_NAME is created. */
-void
-register_temp_subdir (struct temp_dir *dir,
- const char *absolute_dir_name)
-{
- struct tempdir *tmpdir = (struct tempdir *)dir;
-
- /* Add absolute_dir_name to tmpdir->subdirs, without duplicates. */
- if (gl_list_search (tmpdir->subdirs, absolute_dir_name) == NULL)
- gl_list_add_first (tmpdir->subdirs, xstrdup (absolute_dir_name));
-}
-
-/* Unregister the given ABSOLUTE_DIR_NAME as being a subdirectory inside DIR,
- that needs to be removed before DIR can be removed.
- Should be called when the subdirectory ABSOLUTE_DIR_NAME could not be
- created. */
-void
-unregister_temp_subdir (struct temp_dir *dir,
- const char *absolute_dir_name)
-{
- struct tempdir *tmpdir = (struct tempdir *)dir;
- gl_list_t list = tmpdir->subdirs;
- gl_list_node_t node;
-
- node = gl_list_search (list, absolute_dir_name);
- if (node != NULL)
- {
- char *old_string = (char *) gl_list_node_value (list, node);
-
- gl_list_remove_node (list, node);
- free (old_string);
- }
-}
-
-/* Remove a file, with optional error message. */
-static void
-do_unlink (struct temp_dir *dir, const char *absolute_file_name)
-{
- if (unlink (absolute_file_name) < 0 && dir->cleanup_verbose
- && errno != ENOENT)
- error (0, errno, _("cannot remove temporary file %s"), absolute_file_name);
-}
-
-/* Remove a directory, with optional error message. */
-static void
-do_rmdir (struct temp_dir *dir, const char *absolute_dir_name)
-{
- if (rmdir (absolute_dir_name) < 0 && dir->cleanup_verbose
- && errno != ENOENT)
- error (0, errno,
- _("cannot remove temporary directory %s"), absolute_dir_name);
-}
-
-/* Remove the given ABSOLUTE_FILE_NAME and unregister it. */
-void
-cleanup_temp_file (struct temp_dir *dir,
- const char *absolute_file_name)
-{
- do_unlink (dir, absolute_file_name);
- unregister_temp_file (dir, absolute_file_name);
-}
-
-/* Remove the given ABSOLUTE_DIR_NAME and unregister it. */
-void
-cleanup_temp_subdir (struct temp_dir *dir,
- const char *absolute_dir_name)
-{
- do_rmdir (dir, absolute_dir_name);
- unregister_temp_subdir (dir, absolute_dir_name);
-}
-
-/* Remove all registered files and subdirectories inside DIR. */
-void
-cleanup_temp_dir_contents (struct temp_dir *dir)
-{
- struct tempdir *tmpdir = (struct tempdir *)dir;
- gl_list_t list;
- gl_list_iterator_t iter;
- const void *element;
- gl_list_node_t node;
-
- /* First cleanup the files in the subdirectories. */
- list = tmpdir->files;
- iter = gl_list_iterator (list);
- while (gl_list_iterator_next (&iter, &element, &node))
- {
- char *file = (char *) element;
-
- do_unlink (dir, file);
- gl_list_remove_node (list, node);
- /* Now only we can free file. */
- free (file);
- }
- gl_list_iterator_free (&iter);
-
- /* Then cleanup the subdirectories. */
- list = tmpdir->subdirs;
- iter = gl_list_iterator (list);
- while (gl_list_iterator_next (&iter, &element, &node))
- {
- char *subdir = (char *) element;
-
- do_rmdir (dir, subdir);
- gl_list_remove_node (list, node);
- /* Now only we can free subdir. */
- free (subdir);
- }
- gl_list_iterator_free (&iter);
-}
-
-/* Remove all registered files and subdirectories inside DIR and DIR itself.
- DIR cannot be used any more after this call. */
-void
-cleanup_temp_dir (struct temp_dir *dir)
-{
- struct tempdir *tmpdir = (struct tempdir *)dir;
- size_t i;
-
- cleanup_temp_dir_contents (dir);
- do_rmdir (dir, tmpdir->dirname);
-
- for (i = 0; i < cleanup_list.tempdir_count; i++)
- if (cleanup_list.tempdir_list[i] == tmpdir)
- {
- /* Remove cleanup_list.tempdir_list[i]. */
- if (i + 1 == cleanup_list.tempdir_count)
- {
- while (i > 0 && cleanup_list.tempdir_list[i - 1] == NULL)
- i--;
- cleanup_list.tempdir_count = i;
- }
- else
- cleanup_list.tempdir_list[i] = NULL;
- /* Now only we can free the tmpdir->dirname and tmpdir itself. */
- free (tmpdir->dirname);
- free (tmpdir);
- return;
- }
-
- /* The user passed an invalid DIR argument. */
- abort ();
-}
+++ /dev/null
-/* Temporary directories and temporary files with automatic cleanup.
- Copyright (C) 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2006.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _CLEAN_TEMP_H
-#define _CLEAN_TEMP_H
-
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Temporary directories and temporary files should be automatically removed
- when the program exits either normally or through a fatal signal. We can't
- rely on the "unlink before close" idiom, because it works only on Unix and
- also - if no signal blocking is used - leaves a time window where a fatal
- signal would not clean up the temporary file.
-
- This module provides support for temporary directories and temporary files
- inside these temporary directories. Temporary files without temporary
- directories are not supported here. */
-
-struct temp_dir
-{
- /* The absolute pathname of the directory. */
- const char * const dir_name;
- /* Whether errors during explicit cleanup are reported to standard error. */
- bool cleanup_verbose;
- /* More fields are present here, but not public. */
-};
-
-/* Create a temporary directory.
- PREFIX is used as a prefix for the name of the temporary directory. It
- should be short and still give an indication about the program.
- PARENTDIR can be used to specify the parent directory; if NULL, a default
- parent directory is used (either $TMPDIR or /tmp or similar).
- CLEANUP_VERBOSE determines whether errors during explicit cleanup are
- reported to standard error.
- Return a fresh 'struct temp_dir' on success. Upon error, an error message
- is shown and NULL is returned. */
-extern struct temp_dir * create_temp_dir (const char *prefix,
- const char *parentdir,
- bool cleanup_verbose);
-
-/* Register the given ABSOLUTE_FILE_NAME as being a file inside DIR, that
- needs to be removed before DIR can be removed.
- Should be called before the file ABSOLUTE_FILE_NAME is created. */
-extern void register_temp_file (struct temp_dir *dir,
- const char *absolute_file_name);
-
-/* Unregister the given ABSOLUTE_FILE_NAME as being a file inside DIR, that
- needs to be removed before DIR can be removed.
- Should be called when the file ABSOLUTE_FILE_NAME could not be created. */
-extern void unregister_temp_file (struct temp_dir *dir,
- const char *absolute_file_name);
-
-/* Register the given ABSOLUTE_DIR_NAME as being a subdirectory inside DIR,
- that needs to be removed before DIR can be removed.
- Should be called before the subdirectory ABSOLUTE_DIR_NAME is created. */
-extern void register_temp_subdir (struct temp_dir *dir,
- const char *absolute_dir_name);
-
-/* Unregister the given ABSOLUTE_DIR_NAME as being a subdirectory inside DIR,
- that needs to be removed before DIR can be removed.
- Should be called when the subdirectory ABSOLUTE_DIR_NAME could not be
- created. */
-extern void unregister_temp_subdir (struct temp_dir *dir,
- const char *absolute_dir_name);
-
-/* Remove the given ABSOLUTE_FILE_NAME and unregister it. */
-extern void cleanup_temp_file (struct temp_dir *dir,
- const char *absolute_file_name);
-
-/* Remove the given ABSOLUTE_DIR_NAME and unregister it. */
-extern void cleanup_temp_subdir (struct temp_dir *dir,
- const char *absolute_dir_name);
-
-/* Remove all registered files and subdirectories inside DIR. */
-extern void cleanup_temp_dir_contents (struct temp_dir *dir);
-
-/* Remove all registered files and subdirectories inside DIR and DIR itself.
- DIR cannot be used any more after this call. */
-extern void cleanup_temp_dir (struct temp_dir *dir);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CLEAN_TEMP_H */
+++ /dev/null
-/* Construct a full pathname from a directory and a filename.
- Copyright (C) 2001-2004 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA. */
-
-/* Written by Bruno Haible <haible@clisp.cons.org>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "pathname.h"
-
-#include <string.h>
-
-#include "xalloc.h"
-#include "stpcpy.h"
-
-/* Concatenate a directory pathname, a relative pathname and an optional
- suffix. The directory may end with the directory separator. The second
- argument may not start with the directory separator (it is relative).
- Return a freshly allocated pathname. */
-char *
-concatenated_pathname (const char *directory, const char *filename,
- const char *suffix)
-{
- char *result;
- char *p;
-
- if (strcmp (directory, ".") == 0)
- {
- /* No need to prepend the directory. */
- result = (char *) xmalloc (strlen (filename)
- + (suffix != NULL ? strlen (suffix) : 0)
- + 1);
- p = result;
- }
- else
- {
- size_t directory_len = strlen (directory);
- int need_slash =
- (directory_len > FILE_SYSTEM_PREFIX_LEN (directory)
- && !ISSLASH (directory[directory_len - 1]));
- result = (char *) xmalloc (directory_len + need_slash
- + strlen (filename)
- + (suffix != NULL ? strlen (suffix) : 0)
- + 1);
- memcpy (result, directory, directory_len);
- p = result + directory_len;
- if (need_slash)
- *p++ = '/';
- }
- p = stpcpy (p, filename);
- if (suffix != NULL)
- stpcpy (p, suffix);
- return result;
-}
+++ /dev/null
-#! /bin/sh
-# Output a system dependent table of character encoding aliases.
-#
-# Copyright (C) 2000-2004, 2006 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Library General Public License as published
-# by the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-#
-# The table consists of lines of the form
-# ALIAS CANONICAL
-#
-# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
-# ALIAS is compared in a case sensitive way.
-#
-# CANONICAL is the GNU canonical name for this character encoding.
-# It must be an encoding supported by libiconv. Support by GNU libc is
-# also desirable. CANONICAL is case insensitive. Usually an upper case
-# MIME charset name is preferred.
-# The current list of GNU canonical charset names is as follows.
-#
-# name MIME? used by which systems
-# ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin
-# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd darwin
-# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd darwin
-# ISO-8859-3 Y glibc solaris
-# ISO-8859-4 Y osf solaris freebsd netbsd darwin
-# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd darwin
-# ISO-8859-6 Y glibc aix hpux solaris
-# ISO-8859-7 Y glibc aix hpux irix osf solaris netbsd darwin
-# ISO-8859-8 Y glibc aix hpux osf solaris
-# ISO-8859-9 Y glibc aix hpux irix osf solaris darwin
-# ISO-8859-13 glibc netbsd darwin
-# ISO-8859-14 glibc
-# ISO-8859-15 glibc aix osf solaris freebsd darwin
-# KOI8-R Y glibc solaris freebsd netbsd darwin
-# KOI8-U Y glibc freebsd netbsd darwin
-# KOI8-T glibc
-# CP437 dos
-# CP775 dos
-# CP850 aix osf dos
-# CP852 dos
-# CP855 dos
-# CP856 aix
-# CP857 dos
-# CP861 dos
-# CP862 dos
-# CP864 dos
-# CP865 dos
-# CP866 freebsd netbsd darwin dos
-# CP869 dos
-# CP874 woe32 dos
-# CP922 aix
-# CP932 aix woe32 dos
-# CP943 aix
-# CP949 osf woe32 dos
-# CP950 woe32 dos
-# CP1046 aix
-# CP1124 aix
-# CP1125 dos
-# CP1129 aix
-# CP1250 woe32
-# CP1251 glibc solaris netbsd darwin woe32
-# CP1252 aix woe32
-# CP1253 woe32
-# CP1254 woe32
-# CP1255 glibc woe32
-# CP1256 woe32
-# CP1257 woe32
-# GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin
-# EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin
-# EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin
-# EUC-TW glibc aix hpux irix osf solaris netbsd
-# BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin
-# BIG5-HKSCS glibc solaris
-# GBK glibc aix osf solaris woe32 dos
-# GB18030 glibc solaris netbsd
-# SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin
-# JOHAB glibc solaris woe32
-# TIS-620 glibc aix hpux osf solaris
-# VISCII Y glibc
-# TCVN5712-1 glibc
-# GEORGIAN-PS glibc
-# HP-ROMAN8 hpux
-# HP-ARABIC8 hpux
-# HP-GREEK8 hpux
-# HP-HEBREW8 hpux
-# HP-TURKISH8 hpux
-# HP-KANA8 hpux
-# DEC-KANJI osf
-# DEC-HANYU osf
-# UTF-8 Y glibc aix hpux osf solaris netbsd darwin
-#
-# Note: Names which are not marked as being a MIME name should not be used in
-# Internet protocols for information interchange (mail, news, etc.).
-#
-# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
-# must understand both names and treat them as equivalent.
-#
-# The first argument passed to this file is the canonical host specification,
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-
-host="$1"
-os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
-echo "# This file contains a table of character encoding aliases,"
-echo "# suitable for operating system '${os}'."
-echo "# It was automatically generated from config.charset."
-# List of references, updated during installation:
-echo "# Packages using this file: "
-case "$os" in
- linux-gnulibc1*)
- # Linux libc5 doesn't have nl_langinfo(CODESET); therefore
- # localcharset.c falls back to using the full locale name
- # from the environment variables.
- echo "C ASCII"
- echo "POSIX ASCII"
- for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \
- en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \
- en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \
- es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \
- et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \
- fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \
- it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \
- sv_FI sv_SE; do
- echo "$l ISO-8859-1"
- echo "$l.iso-8859-1 ISO-8859-1"
- echo "$l.iso-8859-15 ISO-8859-15"
- echo "$l.iso-8859-15@euro ISO-8859-15"
- echo "$l@euro ISO-8859-15"
- echo "$l.cp-437 CP437"
- echo "$l.cp-850 CP850"
- echo "$l.cp-1252 CP1252"
- echo "$l.cp-1252@euro CP1252"
- #echo "$l.atari-st ATARI-ST" # not a commonly used encoding
- echo "$l.utf-8 UTF-8"
- echo "$l.utf-8@euro UTF-8"
- done
- for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \
- sl_SI sr sr_CS sr_YU; do
- echo "$l ISO-8859-2"
- echo "$l.iso-8859-2 ISO-8859-2"
- echo "$l.cp-852 CP852"
- echo "$l.cp-1250 CP1250"
- echo "$l.utf-8 UTF-8"
- done
- for l in mk mk_MK ru ru_RU; do
- echo "$l ISO-8859-5"
- echo "$l.iso-8859-5 ISO-8859-5"
- echo "$l.koi8-r KOI8-R"
- echo "$l.cp-866 CP866"
- echo "$l.cp-1251 CP1251"
- echo "$l.utf-8 UTF-8"
- done
- for l in ar ar_SA; do
- echo "$l ISO-8859-6"
- echo "$l.iso-8859-6 ISO-8859-6"
- echo "$l.cp-864 CP864"
- #echo "$l.cp-868 CP868" # not a commonly used encoding
- echo "$l.cp-1256 CP1256"
- echo "$l.utf-8 UTF-8"
- done
- for l in el el_GR gr gr_GR; do
- echo "$l ISO-8859-7"
- echo "$l.iso-8859-7 ISO-8859-7"
- echo "$l.cp-869 CP869"
- echo "$l.cp-1253 CP1253"
- echo "$l.cp-1253@euro CP1253"
- echo "$l.utf-8 UTF-8"
- echo "$l.utf-8@euro UTF-8"
- done
- for l in he he_IL iw iw_IL; do
- echo "$l ISO-8859-8"
- echo "$l.iso-8859-8 ISO-8859-8"
- echo "$l.cp-862 CP862"
- echo "$l.cp-1255 CP1255"
- echo "$l.utf-8 UTF-8"
- done
- for l in tr tr_TR; do
- echo "$l ISO-8859-9"
- echo "$l.iso-8859-9 ISO-8859-9"
- echo "$l.cp-857 CP857"
- echo "$l.cp-1254 CP1254"
- echo "$l.utf-8 UTF-8"
- done
- for l in lt lt_LT lv lv_LV; do
- #echo "$l BALTIC" # not a commonly used encoding, wrong encoding name
- echo "$l ISO-8859-13"
- done
- for l in ru_UA uk uk_UA; do
- echo "$l KOI8-U"
- done
- for l in zh zh_CN; do
- #echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name
- echo "$l GB2312"
- done
- for l in ja ja_JP ja_JP.EUC; do
- echo "$l EUC-JP"
- done
- for l in ko ko_KR; do
- echo "$l EUC-KR"
- done
- for l in th th_TH; do
- echo "$l TIS-620"
- done
- for l in fa fa_IR; do
- #echo "$l ISIRI-3342" # a broken encoding
- echo "$l.utf-8 UTF-8"
- done
- ;;
- linux* | *-gnu*)
- # With glibc-2.1 or newer, we don't need any canonicalization,
- # because glibc has iconv and both glibc and libiconv support all
- # GNU canonical names directly. Therefore, the Makefile does not
- # need to install the alias file at all.
- # The following applies only to glibc-2.0.x and older libcs.
- echo "ISO_646.IRV:1983 ASCII"
- ;;
- aix*)
- echo "ISO8859-1 ISO-8859-1"
- echo "ISO8859-2 ISO-8859-2"
- echo "ISO8859-5 ISO-8859-5"
- echo "ISO8859-6 ISO-8859-6"
- echo "ISO8859-7 ISO-8859-7"
- echo "ISO8859-8 ISO-8859-8"
- echo "ISO8859-9 ISO-8859-9"
- echo "ISO8859-15 ISO-8859-15"
- echo "IBM-850 CP850"
- echo "IBM-856 CP856"
- echo "IBM-921 ISO-8859-13"
- echo "IBM-922 CP922"
- echo "IBM-932 CP932"
- echo "IBM-943 CP943"
- echo "IBM-1046 CP1046"
- echo "IBM-1124 CP1124"
- echo "IBM-1129 CP1129"
- echo "IBM-1252 CP1252"
- echo "IBM-eucCN GB2312"
- echo "IBM-eucJP EUC-JP"
- echo "IBM-eucKR EUC-KR"
- echo "IBM-eucTW EUC-TW"
- echo "big5 BIG5"
- echo "GBK GBK"
- echo "TIS-620 TIS-620"
- echo "UTF-8 UTF-8"
- ;;
- hpux*)
- echo "iso88591 ISO-8859-1"
- echo "iso88592 ISO-8859-2"
- echo "iso88595 ISO-8859-5"
- echo "iso88596 ISO-8859-6"
- echo "iso88597 ISO-8859-7"
- echo "iso88598 ISO-8859-8"
- echo "iso88599 ISO-8859-9"
- echo "iso885915 ISO-8859-15"
- echo "roman8 HP-ROMAN8"
- echo "arabic8 HP-ARABIC8"
- echo "greek8 HP-GREEK8"
- echo "hebrew8 HP-HEBREW8"
- echo "turkish8 HP-TURKISH8"
- echo "kana8 HP-KANA8"
- echo "tis620 TIS-620"
- echo "big5 BIG5"
- echo "eucJP EUC-JP"
- echo "eucKR EUC-KR"
- echo "eucTW EUC-TW"
- echo "hp15CN GB2312"
- #echo "ccdc ?" # what is this?
- echo "SJIS SHIFT_JIS"
- echo "utf8 UTF-8"
- ;;
- irix*)
- echo "ISO8859-1 ISO-8859-1"
- echo "ISO8859-2 ISO-8859-2"
- echo "ISO8859-5 ISO-8859-5"
- echo "ISO8859-7 ISO-8859-7"
- echo "ISO8859-9 ISO-8859-9"
- echo "eucCN GB2312"
- echo "eucJP EUC-JP"
- echo "eucKR EUC-KR"
- echo "eucTW EUC-TW"
- ;;
- osf*)
- echo "ISO8859-1 ISO-8859-1"
- echo "ISO8859-2 ISO-8859-2"
- echo "ISO8859-4 ISO-8859-4"
- echo "ISO8859-5 ISO-8859-5"
- echo "ISO8859-7 ISO-8859-7"
- echo "ISO8859-8 ISO-8859-8"
- echo "ISO8859-9 ISO-8859-9"
- echo "ISO8859-15 ISO-8859-15"
- echo "cp850 CP850"
- echo "big5 BIG5"
- echo "dechanyu DEC-HANYU"
- echo "dechanzi GB2312"
- echo "deckanji DEC-KANJI"
- echo "deckorean EUC-KR"
- echo "eucJP EUC-JP"
- echo "eucKR EUC-KR"
- echo "eucTW EUC-TW"
- echo "GBK GBK"
- echo "KSC5601 CP949"
- echo "sdeckanji EUC-JP"
- echo "SJIS SHIFT_JIS"
- echo "TACTIS TIS-620"
- echo "UTF-8 UTF-8"
- ;;
- solaris*)
- echo "646 ASCII"
- echo "ISO8859-1 ISO-8859-1"
- echo "ISO8859-2 ISO-8859-2"
- echo "ISO8859-3 ISO-8859-3"
- echo "ISO8859-4 ISO-8859-4"
- echo "ISO8859-5 ISO-8859-5"
- echo "ISO8859-6 ISO-8859-6"
- echo "ISO8859-7 ISO-8859-7"
- echo "ISO8859-8 ISO-8859-8"
- echo "ISO8859-9 ISO-8859-9"
- echo "ISO8859-15 ISO-8859-15"
- echo "koi8-r KOI8-R"
- echo "ansi-1251 CP1251"
- echo "BIG5 BIG5"
- echo "Big5-HKSCS BIG5-HKSCS"
- echo "gb2312 GB2312"
- echo "GBK GBK"
- echo "GB18030 GB18030"
- echo "cns11643 EUC-TW"
- echo "5601 EUC-KR"
- echo "ko_KR.johap92 JOHAB"
- echo "eucJP EUC-JP"
- echo "PCK SHIFT_JIS"
- echo "TIS620.2533 TIS-620"
- #echo "sun_eu_greek ?" # what is this?
- echo "UTF-8 UTF-8"
- ;;
- freebsd* | os2*)
- # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
- # localcharset.c falls back to using the full locale name
- # from the environment variables.
- # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
- # reuse FreeBSD's locale data for OS/2.
- echo "C ASCII"
- echo "US-ASCII ASCII"
- for l in la_LN lt_LN; do
- echo "$l.ASCII ASCII"
- done
- for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
- fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
- lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
- echo "$l.ISO_8859-1 ISO-8859-1"
- echo "$l.DIS_8859-15 ISO-8859-15"
- done
- for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
- echo "$l.ISO_8859-2 ISO-8859-2"
- done
- for l in la_LN lt_LT; do
- echo "$l.ISO_8859-4 ISO-8859-4"
- done
- for l in ru_RU ru_SU; do
- echo "$l.KOI8-R KOI8-R"
- echo "$l.ISO_8859-5 ISO-8859-5"
- echo "$l.CP866 CP866"
- done
- echo "uk_UA.KOI8-U KOI8-U"
- echo "zh_TW.BIG5 BIG5"
- echo "zh_TW.Big5 BIG5"
- echo "zh_CN.EUC GB2312"
- echo "ja_JP.EUC EUC-JP"
- echo "ja_JP.SJIS SHIFT_JIS"
- echo "ja_JP.Shift_JIS SHIFT_JIS"
- echo "ko_KR.EUC EUC-KR"
- ;;
- netbsd*)
- echo "646 ASCII"
- echo "ISO8859-1 ISO-8859-1"
- echo "ISO8859-2 ISO-8859-2"
- echo "ISO8859-4 ISO-8859-4"
- echo "ISO8859-5 ISO-8859-5"
- echo "ISO8859-7 ISO-8859-7"
- echo "ISO8859-13 ISO-8859-13"
- echo "ISO8859-15 ISO-8859-15"
- echo "eucCN GB2312"
- echo "eucJP EUC-JP"
- echo "eucKR EUC-KR"
- echo "eucTW EUC-TW"
- echo "BIG5 BIG5"
- echo "SJIS SHIFT_JIS"
- ;;
- darwin[56]*)
- # Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore
- # localcharset.c falls back to using the full locale name
- # from the environment variables.
- echo "C ASCII"
- for l in en_AU en_CA en_GB en_US la_LN; do
- echo "$l.US-ASCII ASCII"
- done
- for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
- fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \
- nl_NL no_NO pt_PT sv_SE; do
- echo "$l ISO-8859-1"
- echo "$l.ISO8859-1 ISO-8859-1"
- echo "$l.ISO8859-15 ISO-8859-15"
- done
- for l in la_LN; do
- echo "$l.ISO8859-1 ISO-8859-1"
- echo "$l.ISO8859-15 ISO-8859-15"
- done
- for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do
- echo "$l.ISO8859-2 ISO-8859-2"
- done
- for l in la_LN lt_LT; do
- echo "$l.ISO8859-4 ISO-8859-4"
- done
- for l in ru_RU; do
- echo "$l.KOI8-R KOI8-R"
- echo "$l.ISO8859-5 ISO-8859-5"
- echo "$l.CP866 CP866"
- done
- for l in bg_BG; do
- echo "$l.CP1251 CP1251"
- done
- echo "uk_UA.KOI8-U KOI8-U"
- echo "zh_TW.BIG5 BIG5"
- echo "zh_TW.Big5 BIG5"
- echo "zh_CN.EUC GB2312"
- echo "ja_JP.EUC EUC-JP"
- echo "ja_JP.SJIS SHIFT_JIS"
- echo "ko_KR.EUC EUC-KR"
- ;;
- darwin*)
- # Darwin 7.5 has nl_langinfo(CODESET), but it is useless:
- # - It returns the empty string when LANG is set to a locale of the
- # form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8
- # LC_CTYPE file.
- # - The environment variables LANG, LC_CTYPE, LC_ALL are not set by
- # the system; nl_langinfo(CODESET) returns "US-ASCII" in this case.
- # - The documentation says:
- # "... all code that calls BSD system routines should ensure
- # that the const *char parameters of these routines are in UTF-8
- # encoding. All BSD system functions expect their string
- # parameters to be in UTF-8 encoding and nothing else."
- # It also says
- # "An additional caveat is that string parameters for files,
- # paths, and other file-system entities must be in canonical
- # UTF-8. In a canonical UTF-8 Unicode string, all decomposable
- # characters are decomposed ..."
- # but this is not true: You can pass non-decomposed UTF-8 strings
- # to file system functions, and it is the OS which will convert
- # them to decomposed UTF-8 before accessing the file system.
- # - The Apple Terminal application displays UTF-8 by default.
- # - However, other applications are free to use different encodings:
- # - xterm uses ISO-8859-1 by default.
- # - TextEdit uses MacRoman by default.
- # We prefer UTF-8 over decomposed UTF-8-MAC because one should
- # minimize the use of decomposed Unicode. Unfortunately, through the
- # Darwin file system, decomposed UTF-8 strings are leaked into user
- # space nevertheless.
- echo "* UTF-8"
- ;;
- beos*)
- # BeOS has a single locale, and it has UTF-8 encoding.
- echo "* UTF-8"
- ;;
- msdosdjgpp*)
- # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
- # localcharset.c falls back to using the full locale name
- # from the environment variables.
- echo "#"
- echo "# The encodings given here may not all be correct."
- echo "# If you find that the encoding given for your language and"
- echo "# country is not the one your DOS machine actually uses, just"
- echo "# correct it in this file, and send a mail to"
- echo "# Juan Manuel Guerrero <juan.guerrero@gmx.de>"
- echo "# and Bruno Haible <bruno@clisp.org>."
- echo "#"
- echo "C ASCII"
- # ISO-8859-1 languages
- echo "ca CP850"
- echo "ca_ES CP850"
- echo "da CP865" # not CP850 ??
- echo "da_DK CP865" # not CP850 ??
- echo "de CP850"
- echo "de_AT CP850"
- echo "de_CH CP850"
- echo "de_DE CP850"
- echo "en CP850"
- echo "en_AU CP850" # not CP437 ??
- echo "en_CA CP850"
- echo "en_GB CP850"
- echo "en_NZ CP437"
- echo "en_US CP437"
- echo "en_ZA CP850" # not CP437 ??
- echo "es CP850"
- echo "es_AR CP850"
- echo "es_BO CP850"
- echo "es_CL CP850"
- echo "es_CO CP850"
- echo "es_CR CP850"
- echo "es_CU CP850"
- echo "es_DO CP850"
- echo "es_EC CP850"
- echo "es_ES CP850"
- echo "es_GT CP850"
- echo "es_HN CP850"
- echo "es_MX CP850"
- echo "es_NI CP850"
- echo "es_PA CP850"
- echo "es_PY CP850"
- echo "es_PE CP850"
- echo "es_SV CP850"
- echo "es_UY CP850"
- echo "es_VE CP850"
- echo "et CP850"
- echo "et_EE CP850"
- echo "eu CP850"
- echo "eu_ES CP850"
- echo "fi CP850"
- echo "fi_FI CP850"
- echo "fr CP850"
- echo "fr_BE CP850"
- echo "fr_CA CP850"
- echo "fr_CH CP850"
- echo "fr_FR CP850"
- echo "ga CP850"
- echo "ga_IE CP850"
- echo "gd CP850"
- echo "gd_GB CP850"
- echo "gl CP850"
- echo "gl_ES CP850"
- echo "id CP850" # not CP437 ??
- echo "id_ID CP850" # not CP437 ??
- echo "is CP861" # not CP850 ??
- echo "is_IS CP861" # not CP850 ??
- echo "it CP850"
- echo "it_CH CP850"
- echo "it_IT CP850"
- echo "lt CP775"
- echo "lt_LT CP775"
- echo "lv CP775"
- echo "lv_LV CP775"
- echo "nb CP865" # not CP850 ??
- echo "nb_NO CP865" # not CP850 ??
- echo "nl CP850"
- echo "nl_BE CP850"
- echo "nl_NL CP850"
- echo "nn CP865" # not CP850 ??
- echo "nn_NO CP865" # not CP850 ??
- echo "no CP865" # not CP850 ??
- echo "no_NO CP865" # not CP850 ??
- echo "pt CP850"
- echo "pt_BR CP850"
- echo "pt_PT CP850"
- echo "sv CP850"
- echo "sv_SE CP850"
- # ISO-8859-2 languages
- echo "cs CP852"
- echo "cs_CZ CP852"
- echo "hr CP852"
- echo "hr_HR CP852"
- echo "hu CP852"
- echo "hu_HU CP852"
- echo "pl CP852"
- echo "pl_PL CP852"
- echo "ro CP852"
- echo "ro_RO CP852"
- echo "sk CP852"
- echo "sk_SK CP852"
- echo "sl CP852"
- echo "sl_SI CP852"
- echo "sq CP852"
- echo "sq_AL CP852"
- echo "sr CP852" # CP852 or CP866 or CP855 ??
- echo "sr_CS CP852" # CP852 or CP866 or CP855 ??
- echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
- # ISO-8859-3 languages
- echo "mt CP850"
- echo "mt_MT CP850"
- # ISO-8859-5 languages
- echo "be CP866"
- echo "be_BE CP866"
- echo "bg CP866" # not CP855 ??
- echo "bg_BG CP866" # not CP855 ??
- echo "mk CP866" # not CP855 ??
- echo "mk_MK CP866" # not CP855 ??
- echo "ru CP866"
- echo "ru_RU CP866"
- echo "uk CP1125"
- echo "uk_UA CP1125"
- # ISO-8859-6 languages
- echo "ar CP864"
- echo "ar_AE CP864"
- echo "ar_DZ CP864"
- echo "ar_EG CP864"
- echo "ar_IQ CP864"
- echo "ar_IR CP864"
- echo "ar_JO CP864"
- echo "ar_KW CP864"
- echo "ar_MA CP864"
- echo "ar_OM CP864"
- echo "ar_QA CP864"
- echo "ar_SA CP864"
- echo "ar_SY CP864"
- # ISO-8859-7 languages
- echo "el CP869"
- echo "el_GR CP869"
- # ISO-8859-8 languages
- echo "he CP862"
- echo "he_IL CP862"
- # ISO-8859-9 languages
- echo "tr CP857"
- echo "tr_TR CP857"
- # Japanese
- echo "ja CP932"
- echo "ja_JP CP932"
- # Chinese
- echo "zh_CN GBK"
- echo "zh_TW CP950" # not CP938 ??
- # Korean
- echo "kr CP949" # not CP934 ??
- echo "kr_KR CP949" # not CP934 ??
- # Thai
- echo "th CP874"
- echo "th_TH CP874"
- # Other
- echo "eo CP850"
- echo "eo_EO CP850"
- ;;
-esac
+++ /dev/null
-/* Copying of files.
- Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "copy-file.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stddef.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#if HAVE_UTIME || HAVE_UTIMES
-# if HAVE_UTIME_H
-# include <utime.h>
-# else
-# include <sys/utime.h>
-# endif
-#endif
-
-#include "error.h"
-#include "safe-read.h"
-#include "full-write.h"
-#include "binary-io.h"
-#include "exit.h"
-#include "gettext.h"
-
-#define _(str) gettext (str)
-
-void
-copy_file_preserving (const char *src_filename, const char *dest_filename)
-{
- int src_fd;
- struct stat statbuf;
- int mode;
- int dest_fd;
- char buf[4096];
- const size_t buf_size = sizeof (buf);
-
- src_fd = open (src_filename, O_RDONLY | O_BINARY);
- if (src_fd < 0 || fstat (src_fd, &statbuf) < 0)
- error (EXIT_FAILURE, errno, _("error while opening \"%s\" for reading"),
- src_filename);
-
- mode = statbuf.st_mode & 07777;
-
- dest_fd = open (dest_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0600);
- if (dest_fd < 0)
- error (EXIT_FAILURE, errno, _("cannot open backup file \"%s\" for writing"),
- dest_filename);
-
- /* Copy the file contents. */
- for (;;)
- {
- size_t n_read = safe_read (src_fd, buf, buf_size);
- if (n_read == SAFE_READ_ERROR)
- error (EXIT_FAILURE, errno, _("error reading \"%s\""), src_filename);
- if (n_read == 0)
- break;
-
- if (full_write (dest_fd, buf, n_read) < n_read)
- error (EXIT_FAILURE, errno, _("error writing \"%s\""), dest_filename);
- }
-
- if (close (dest_fd) < 0)
- error (EXIT_FAILURE, errno, _("error writing \"%s\""), dest_filename);
- if (close (src_fd) < 0)
- error (EXIT_FAILURE, errno, _("error after reading \"%s\""), src_filename);
-
- /* Preserve the access and modification times. */
-#if HAVE_UTIME
- {
- struct utimbuf ut;
-
- ut.actime = statbuf.st_atime;
- ut.modtime = statbuf.st_mtime;
- utime (dest_filename, &ut);
- }
-#elif HAVE_UTIMES
- {
- struct timeval ut[2];
-
- ut[0].tv_sec = statbuf.st_atime; ut[0].tv_usec = 0;
- ut[1].tv_sec = statbuf.st_mtime; ut[1].tv_usec = 0;
- utimes (dest_filename, &ut);
- }
-#endif
-
-#if HAVE_CHOWN
- /* Preserve the owner and group. */
- chown (dest_filename, statbuf.st_uid, statbuf.st_gid);
-#endif
-
- /* Preserve the access permissions. */
- chmod (dest_filename, mode);
-}
+++ /dev/null
-/* Copying of files.
- Copyright (C) 2001-2003 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Copy a regular file: from src_filename to dest_filename.
- The destination file is assumed to be a backup file.
- Modification times, owner, group and access permissions are preserved as
- far as possible.
- Exit upon failure. */
-extern void copy_file_preserving (const char *src_filename, const char *dest_filename);
-
-
-#ifdef __cplusplus
-}
-#endif
+++ /dev/null
-/* Compile a C# program.
- Copyright (C) 2003-2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include <alloca.h>
-
-/* Specification. */
-#include "csharpcomp.h"
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "execute.h"
-#include "pipe.h"
-#include "wait-process.h"
-#include "getline.h"
-#include "sh-quote.h"
-#include "safe-read.h"
-#include "xallocsa.h"
-#include "error.h"
-#include "gettext.h"
-
-#define _(str) gettext (str)
-
-
-/* Survey of C# compilers.
-
- Program from
-
- cscc pnet
- mcs mono
- csc sscli
-
- We try the CIL interpreters in the following order:
- 1. "cscc", because it is a completely free system.
- 2. "mcs", because it is a free system but doesn't integrate so well
- with Unix. (Command line options start with / instead of -. Errors go
- to stdout instead of stderr. Source references are printed as
- "file(lineno)" instead of "file:lineno:".)
- 3. "csc", although it is not free, because it is a kind of "reference
- implementation" of C#.
- But the order can be changed through the --enable-csharp configuration
- option.
- */
-
-static int
-compile_csharp_using_pnet (const char * const *sources,
- unsigned int sources_count,
- const char * const *libdirs,
- unsigned int libdirs_count,
- const char * const *libraries,
- unsigned int libraries_count,
- const char *output_file, bool output_is_library,
- bool optimize, bool debug,
- bool verbose)
-{
- static bool cscc_tested;
- static bool cscc_present;
-
- if (!cscc_tested)
- {
- /* Test for presence of cscc:
- "cscc --version >/dev/null 2>/dev/null" */
- char *argv[3];
- int exitstatus;
-
- argv[0] = "cscc";
- argv[1] = "--version";
- argv[2] = NULL;
- exitstatus = execute ("cscc", "cscc", argv, false, false, true, true,
- true, false);
- cscc_present = (exitstatus == 0);
- cscc_tested = true;
- }
-
- if (cscc_present)
- {
- unsigned int argc;
- char **argv;
- char **argp;
- int exitstatus;
- unsigned int i;
-
- argc =
- 1 + (output_is_library ? 1 : 0) + 2 + 2 * libdirs_count
- + 2 * libraries_count + (optimize ? 1 : 0) + (debug ? 1 : 0)
- + sources_count;
- argv = (char **) xallocsa ((argc + 1) * sizeof (char *));
-
- argp = argv;
- *argp++ = "cscc";
- if (output_is_library)
- *argp++ = "-shared";
- *argp++ = "-o";
- *argp++ = (char *) output_file;
- for (i = 0; i < libdirs_count; i++)
- {
- *argp++ = "-L";
- *argp++ = (char *) libdirs[i];
- }
- for (i = 0; i < libraries_count; i++)
- {
- *argp++ = "-l";
- *argp++ = (char *) libraries[i];
- }
- if (optimize)
- *argp++ = "-O";
- if (debug)
- *argp++ = "-g";
- for (i = 0; i < sources_count; i++)
- {
- const char *source_file = sources[i];
- if (strlen (source_file) >= 10
- && memcmp (source_file + strlen (source_file) - 10, ".resources",
- 10) == 0)
- {
- char *option = (char *) xallocsa (12 + strlen (source_file) + 1);
-
- memcpy (option, "-fresources=", 12);
- strcpy (option + 12, source_file);
- *argp++ = option;
- }
- else
- *argp++ = (char *) source_file;
- }
- *argp = NULL;
- /* Ensure argv length was correctly calculated. */
- if (argp - argv != argc)
- abort ();
-
- if (verbose)
- {
- char *command = shell_quote_argv (argv);
- printf ("%s\n", command);
- free (command);
- }
-
- exitstatus = execute ("cscc", "cscc", argv, false, false, false, false,
- true, true);
-
- for (i = 0; i < sources_count; i++)
- if (argv[argc - sources_count + i] != sources[i])
- freesa (argv[argc - sources_count + i]);
- freesa (argv);
-
- return (exitstatus != 0);
- }
- else
- return -1;
-}
-
-static int
-compile_csharp_using_mono (const char * const *sources,
- unsigned int sources_count,
- const char * const *libdirs,
- unsigned int libdirs_count,
- const char * const *libraries,
- unsigned int libraries_count,
- const char *output_file, bool output_is_library,
- bool optimize, bool debug,
- bool verbose)
-{
- static bool mcs_tested;
- static bool mcs_present;
-
- if (!mcs_tested)
- {
- /* Test for presence of mcs:
- "mcs --version >/dev/null 2>/dev/null" */
- char *argv[3];
- int exitstatus;
-
- argv[0] = "mcs";
- argv[1] = "--version";
- argv[2] = NULL;
- exitstatus = execute ("mcs", "mcs", argv, false, false, true, true, true,
- false);
- mcs_present = (exitstatus == 0);
- mcs_tested = true;
- }
-
- if (mcs_present)
- {
- unsigned int argc;
- char **argv;
- char **argp;
- pid_t child;
- int fd[1];
- FILE *fp;
- char *line[2];
- size_t linesize[2];
- size_t linelen[2];
- unsigned int l;
- int exitstatus;
- unsigned int i;
-
- argc =
- 1 + (output_is_library ? 1 : 0) + 1 + libdirs_count + libraries_count
- + (debug ? 1 : 0) + sources_count;
- argv = (char **) xallocsa ((argc + 1) * sizeof (char *));
-
- argp = argv;
- *argp++ = "mcs";
- if (output_is_library)
- *argp++ = "-target:library";
- {
- char *option = (char *) xallocsa (5 + strlen (output_file) + 1);
- memcpy (option, "-out:", 5);
- strcpy (option + 5, output_file);
- *argp++ = option;
- }
- for (i = 0; i < libdirs_count; i++)
- {
- char *option = (char *) xallocsa (5 + strlen (libdirs[i]) + 1);
- memcpy (option, "-lib:", 5);
- strcpy (option + 5, libdirs[i]);
- *argp++ = option;
- }
- for (i = 0; i < libraries_count; i++)
- {
- char *option = (char *) xallocsa (11 + strlen (libraries[i]) + 4 + 1);
- memcpy (option, "-reference:", 11);
- memcpy (option + 11, libraries[i], strlen (libraries[i]));
- strcpy (option + 11 + strlen (libraries[i]), ".dll");
- *argp++ = option;
- }
- if (debug)
- *argp++ = "-debug";
- for (i = 0; i < sources_count; i++)
- {
- const char *source_file = sources[i];
- if (strlen (source_file) >= 10
- && memcmp (source_file + strlen (source_file) - 10, ".resources",
- 10) == 0)
- {
- char *option = (char *) xallocsa (10 + strlen (source_file) + 1);
-
- memcpy (option, "-resource:", 10);
- strcpy (option + 10, source_file);
- *argp++ = option;
- }
- else
- *argp++ = (char *) source_file;
- }
- *argp = NULL;
- /* Ensure argv length was correctly calculated. */
- if (argp - argv != argc)
- abort ();
-
- if (verbose)
- {
- char *command = shell_quote_argv (argv);
- printf ("%s\n", command);
- free (command);
- }
-
- child = create_pipe_in ("mcs", "mcs", argv, NULL, false, true, true, fd);
-
- /* Read the subprocess output, copying it to stderr. Drop the last
- line if it starts with "Compilation succeeded". */
- fp = fdopen (fd[0], "r");
- if (fp == NULL)
- error (EXIT_FAILURE, errno, _("fdopen() failed"));
- line[0] = NULL; linesize[0] = 0;
- line[1] = NULL; linesize[1] = 0;
- l = 0;
- for (;;)
- {
- linelen[l] = getline (&line[l], &linesize[l], fp);
- if (linelen[l] == (size_t)(-1))
- break;
- l = (l + 1) % 2;
- if (line[l] != NULL)
- fwrite (line[l], 1, linelen[l], stderr);
- }
- l = (l + 1) % 2;
- if (line[l] != NULL
- && !(linelen[l] >= 21
- && memcmp (line[l], "Compilation succeeded", 21) == 0))
- fwrite (line[l], 1, linelen[l], stderr);
- if (line[0] != NULL)
- free (line[0]);
- if (line[1] != NULL)
- free (line[1]);
- fclose (fp);
-
- /* Remove zombie process from process list, and retrieve exit status. */
- exitstatus = wait_subprocess (child, "mcs", false, false, true, true);
-
- for (i = 1 + (output_is_library ? 1 : 0);
- i < 1 + (output_is_library ? 1 : 0)
- + 1 + libdirs_count + libraries_count;
- i++)
- freesa (argv[i]);
- for (i = 0; i < sources_count; i++)
- if (argv[argc - sources_count + i] != sources[i])
- freesa (argv[argc - sources_count + i]);
- freesa (argv);
-
- return (exitstatus != 0);
- }
- else
- return -1;
-}
-
-static int
-compile_csharp_using_sscli (const char * const *sources,
- unsigned int sources_count,
- const char * const *libdirs,
- unsigned int libdirs_count,
- const char * const *libraries,
- unsigned int libraries_count,
- const char *output_file, bool output_is_library,
- bool optimize, bool debug,
- bool verbose)
-{
- static bool csc_tested;
- static bool csc_present;
-
- if (!csc_tested)
- {
- /* Test for presence of csc:
- "csc -help >/dev/null 2>/dev/null \
- && ! { csc -help 2>/dev/null | grep -i chicken > /dev/null; }" */
- char *argv[3];
- pid_t child;
- int fd[1];
- int exitstatus;
-
- argv[0] = "csc";
- argv[1] = "-help";
- argv[2] = NULL;
- child = create_pipe_in ("csc", "csc", argv, DEV_NULL, true, true, false,
- fd);
- csc_present = false;
- if (child != -1)
- {
- /* Read the subprocess output, and test whether it contains the
- string "chicken". */
- char c[7];
- size_t count = 0;
-
- csc_present = true;
- while (safe_read (fd[0], &c[count], 1) > 0)
- {
- if (c[count] >= 'A' && c[count] <= 'Z')
- c[count] += 'a' - 'A';
- count++;
- if (count == 7)
- {
- if (memcmp (c, "chicken", 7) == 0)
- csc_present = false;
- c[0] = c[1]; c[1] = c[2]; c[2] = c[3];
- c[3] = c[4]; c[4] = c[5]; c[5] = c[6];
- count--;
- }
- }
-
- close (fd[0]);
-
- /* Remove zombie process from process list, and retrieve exit
- status. */
- exitstatus =
- wait_subprocess (child, "csc", false, true, true, false);
- if (exitstatus != 0)
- csc_present = false;
- }
- csc_tested = true;
- }
-
- if (csc_present)
- {
- unsigned int argc;
- char **argv;
- char **argp;
- int exitstatus;
- unsigned int i;
-
- argc =
- 1 + 1 + 1 + libdirs_count + libraries_count
- + (optimize ? 1 : 0) + (debug ? 1 : 0) + sources_count;
- argv = (char **) xallocsa ((argc + 1) * sizeof (char *));
-
- argp = argv;
- *argp++ = "csc";
- *argp++ = (output_is_library ? "-target:library" : "-target:exe");
- {
- char *option = (char *) xallocsa (5 + strlen (output_file) + 1);
- memcpy (option, "-out:", 5);
- strcpy (option + 5, output_file);
- *argp++ = option;
- }
- for (i = 0; i < libdirs_count; i++)
- {
- char *option = (char *) xallocsa (5 + strlen (libdirs[i]) + 1);
- memcpy (option, "-lib:", 5);
- strcpy (option + 5, libdirs[i]);
- *argp++ = option;
- }
- for (i = 0; i < libraries_count; i++)
- {
- char *option = (char *) xallocsa (11 + strlen (libraries[i]) + 4 + 1);
- memcpy (option, "-reference:", 11);
- memcpy (option + 11, libraries[i], strlen (libraries[i]));
- strcpy (option + 11 + strlen (libraries[i]), ".dll");
- *argp++ = option;
- }
- if (optimize)
- *argp++ = "-optimize+";
- if (debug)
- *argp++ = "-debug+";
- for (i = 0; i < sources_count; i++)
- {
- const char *source_file = sources[i];
- if (strlen (source_file) >= 10
- && memcmp (source_file + strlen (source_file) - 10, ".resources",
- 10) == 0)
- {
- char *option = (char *) xallocsa (10 + strlen (source_file) + 1);
-
- memcpy (option, "-resource:", 10);
- strcpy (option + 10, source_file);
- *argp++ = option;
- }
- else
- *argp++ = (char *) source_file;
- }
- *argp = NULL;
- /* Ensure argv length was correctly calculated. */
- if (argp - argv != argc)
- abort ();
-
- if (verbose)
- {
- char *command = shell_quote_argv (argv);
- printf ("%s\n", command);
- free (command);
- }
-
- exitstatus = execute ("csc", "csc", argv, false, false, false, false,
- true, true);
-
- for (i = 2; i < 3 + libdirs_count + libraries_count; i++)
- freesa (argv[i]);
- for (i = 0; i < sources_count; i++)
- if (argv[argc - sources_count + i] != sources[i])
- freesa (argv[argc - sources_count + i]);
- freesa (argv);
-
- return (exitstatus != 0);
- }
- else
- return -1;
-}
-
-bool
-compile_csharp_class (const char * const *sources,
- unsigned int sources_count,
- const char * const *libdirs,
- unsigned int libdirs_count,
- const char * const *libraries,
- unsigned int libraries_count,
- const char *output_file,
- bool optimize, bool debug,
- bool verbose)
-{
- bool output_is_library =
- (strlen (output_file) >= 4
- && memcmp (output_file + strlen (output_file) - 4, ".dll", 4) == 0);
- int result;
-
- /* First try the C# implementation specified through --enable-csharp. */
-#if CSHARP_CHOICE_PNET
- result = compile_csharp_using_pnet (sources, sources_count,
- libdirs, libdirs_count,
- libraries, libraries_count,
- output_file, output_is_library,
- optimize, debug, verbose);
- if (result >= 0)
- return (bool) result;
-#endif
-
-#if CSHARP_CHOICE_MONO
- result = compile_csharp_using_mono (sources, sources_count,
- libdirs, libdirs_count,
- libraries, libraries_count,
- output_file, output_is_library,
- optimize, debug, verbose);
- if (result >= 0)
- return (bool) result;
-#endif
-
- /* Then try the remaining C# implementations in our standard order. */
-#if !CSHARP_CHOICE_PNET
- result = compile_csharp_using_pnet (sources, sources_count,
- libdirs, libdirs_count,
- libraries, libraries_count,
- output_file, output_is_library,
- optimize, debug, verbose);
- if (result >= 0)
- return (bool) result;
-#endif
-
-#if !CSHARP_CHOICE_MONO
- result = compile_csharp_using_mono (sources, sources_count,
- libdirs, libdirs_count,
- libraries, libraries_count,
- output_file, output_is_library,
- optimize, debug, verbose);
- if (result >= 0)
- return (bool) result;
-#endif
-
- result = compile_csharp_using_sscli (sources, sources_count,
- libdirs, libdirs_count,
- libraries, libraries_count,
- output_file, output_is_library,
- optimize, debug, verbose);
- if (result >= 0)
- return (bool) result;
-
- error (0, 0, _("C# compiler not found, try installing pnet"));
- return true;
-}
+++ /dev/null
-/* Compile a C# program.
- Copyright (C) 2003 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _CSHARPCOMP_H
-#define _CSHARPCOMP_H
-
-#include <stdbool.h>
-
-/* Compile a set of C# source files to bytecode.
- sources is an array of source file names, including resource files.
- libdirs is a list of directories to be searched for libraries.
- libraries is a list of libraries on which the program depends.
- output_file is the name of the output file; it should end in .exe or .dll.
- If verbose, the command to be executed will be printed.
- Return false if OK, true on error. */
-extern bool compile_csharp_class (const char * const *sources,
- unsigned int sources_count,
- const char * const *libdirs,
- unsigned int libdirs_count,
- const char * const *libraries,
- unsigned int libraries_count,
- const char *output_file,
- bool optimize, bool debug,
- bool verbose);
-
-#endif /* _CSHARPCOMP_H */
+++ /dev/null
-/* Execute a C# program.
- Copyright (C) 2003-2005 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include <alloca.h>
-
-/* Specification. */
-#include "csharpexec.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "execute.h"
-#include "sh-quote.h"
-#include "xallocsa.h"
-#include "error.h"
-#include "gettext.h"
-
-/* Handling of MONO_PATH is just like Java CLASSPATH. */
-#define CLASSPATHVAR "MONO_PATH"
-#define new_classpath new_monopath
-#define set_classpath set_monopath
-#define reset_classpath reset_monopath
-#include "classpath.h"
-#include "classpath.c"
-#undef reset_classpath
-#undef set_classpath
-#undef new_classpath
-#undef CLASSPATHVAR
-
-/* Handling of clix' PATH variable is just like Java CLASSPATH. */
-#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__
- /* Win32, Cygwin */
- #define CLASSPATHVAR "PATH"
-#elif defined __APPLE__ && defined __MACH__
- /* MacOS X */
- #define CLASSPATHVAR "DYLD_LIBRARY_PATH"
-#else
- /* Normal Unix */
- #define CLASSPATHVAR "LD_LIBRARY_PATH"
-#endif
-#define new_classpath new_clixpath
-#define set_classpath set_clixpath
-#define reset_classpath reset_clixpath
-#include "classpath.h"
-#include "classpath.c"
-#undef reset_classpath
-#undef set_classpath
-#undef new_classpath
-#undef CLASSPATHVAR
-
-#define _(str) gettext (str)
-
-
-/* Survey of CIL interpreters.
-
- Program from
-
- ilrun pnet
- mono mono
- clix sscli
-
- With Mono, the MONO_PATH is a colon separated list of pathnames. (On
- Windows: semicolon separated list of pathnames.)
-
- We try the CIL interpreters in the following order:
- 1. "ilrun", because it is a completely free system.
- 2. "mono", because it is a partially free system but doesn't integrate
- well with Unix.
- 3. "clix", although it is not free, because it is a kind of "reference
- implementation" of C#.
- But the order can be changed through the --enable-csharp configuration
- option.
- */
-
-static int
-execute_csharp_using_pnet (const char *assembly_path,
- const char * const *libdirs,
- unsigned int libdirs_count,
- const char * const *args, unsigned int nargs,
- bool verbose, bool quiet,
- execute_fn *executer, void *private_data)
-{
- static bool ilrun_tested;
- static bool ilrun_present;
-
- if (!ilrun_tested)
- {
- /* Test for presence of ilrun:
- "ilrun --version >/dev/null 2>/dev/null" */
- char *argv[3];
- int exitstatus;
-
- argv[0] = "ilrun";
- argv[1] = "--version";
- argv[2] = NULL;
- exitstatus = execute ("ilrun", "ilrun", argv, false, false, true, true,
- true, false);
- ilrun_present = (exitstatus == 0);
- ilrun_tested = true;
- }
-
- if (ilrun_present)
- {
- unsigned int argc;
- char **argv;
- char **argp;
- unsigned int i;
- bool err;
-
- argc = 1 + 2 * libdirs_count + 1 + nargs;
- argv = (char **) xallocsa ((argc + 1) * sizeof (char *));
-
- argp = argv;
- *argp++ = "ilrun";
- for (i = 0; i < libdirs_count; i++)
- {
- *argp++ = "-L";
- *argp++ = (char *) libdirs[i];
- }
- *argp++ = (char *) assembly_path;
- for (i = 0; i < nargs; i++)
- *argp++ = (char *) args[i];
- *argp = NULL;
- /* Ensure argv length was correctly calculated. */
- if (argp - argv != argc)
- abort ();
-
- if (verbose)
- {
- char *command = shell_quote_argv (argv);
- printf ("%s\n", command);
- free (command);
- }
-
- err = executer ("ilrun", "ilrun", argv, private_data);
-
- freesa (argv);
-
- return err;
- }
- else
- return -1;
-}
-
-static int
-execute_csharp_using_mono (const char *assembly_path,
- const char * const *libdirs,
- unsigned int libdirs_count,
- const char * const *args, unsigned int nargs,
- bool verbose, bool quiet,
- execute_fn *executer, void *private_data)
-{
- static bool mono_tested;
- static bool mono_present;
-
- if (!mono_tested)
- {
- /* Test for presence of mono:
- "mono --version >/dev/null 2>/dev/null" */
- char *argv[3];
- int exitstatus;
-
- argv[0] = "mono";
- argv[1] = "--version";
- argv[2] = NULL;
- exitstatus = execute ("mono", "mono", argv, false, false, true, true,
- true, false);
- mono_present = (exitstatus == 0);
- mono_tested = true;
- }
-
- if (mono_present)
- {
- char *old_monopath;
- char **argv = (char **) xallocsa ((2 + nargs + 1) * sizeof (char *));
- unsigned int i;
- bool err;
-
- /* Set MONO_PATH. */
- old_monopath = set_monopath (libdirs, libdirs_count, false, verbose);
-
- argv[0] = "mono";
- argv[1] = (char *) assembly_path;
- for (i = 0; i <= nargs; i++)
- argv[2 + i] = (char *) args[i];
-
- if (verbose)
- {
- char *command = shell_quote_argv (argv);
- printf ("%s\n", command);
- free (command);
- }
-
- err = executer ("mono", "mono", argv, private_data);
-
- /* Reset MONO_PATH. */
- reset_monopath (old_monopath);
-
- freesa (argv);
-
- return err;
- }
- else
- return -1;
-}
-
-static int
-execute_csharp_using_sscli (const char *assembly_path,
- const char * const *libdirs,
- unsigned int libdirs_count,
- const char * const *args, unsigned int nargs,
- bool verbose, bool quiet,
- execute_fn *executer, void *private_data)
-{
- static bool clix_tested;
- static bool clix_present;
-
- if (!clix_tested)
- {
- /* Test for presence of clix:
- "clix >/dev/null 2>/dev/null ; test $? = 1" */
- char *argv[2];
- int exitstatus;
-
- argv[0] = "clix";
- argv[1] = NULL;
- exitstatus = execute ("clix", "clix", argv, false, false, true, true,
- true, false);
- clix_present = (exitstatus == 0 || exitstatus == 1);
- clix_tested = true;
- }
-
- if (clix_present)
- {
- char *old_clixpath;
- char **argv = (char **) xallocsa ((2 + nargs + 1) * sizeof (char *));
- unsigned int i;
- bool err;
-
- /* Set clix' PATH variable. */
- old_clixpath = set_clixpath (libdirs, libdirs_count, false, verbose);
-
- argv[0] = "clix";
- argv[1] = (char *) assembly_path;
- for (i = 0; i <= nargs; i++)
- argv[2 + i] = (char *) args[i];
-
- if (verbose)
- {
- char *command = shell_quote_argv (argv);
- printf ("%s\n", command);
- free (command);
- }
-
- err = executer ("clix", "clix", argv, private_data);
-
- /* Reset clix' PATH variable. */
- reset_clixpath (old_clixpath);
-
- freesa (argv);
-
- return err;
- }
- else
- return -1;
-}
-
-bool
-execute_csharp_program (const char *assembly_path,
- const char * const *libdirs,
- unsigned int libdirs_count,
- const char * const *args,
- bool verbose, bool quiet,
- execute_fn *executer, void *private_data)
-{
- unsigned int nargs;
- int result;
-
- /* Count args. */
- {
- const char * const *arg;
-
- for (nargs = 0, arg = args; *arg != NULL; nargs++, arg++)
- ;
- }
-
- /* First try the C# implementation specified through --enable-csharp. */
-#if CSHARP_CHOICE_PNET
- result = execute_csharp_using_pnet (assembly_path, libdirs, libdirs_count,
- args, nargs, verbose, quiet,
- executer, private_data);
- if (result >= 0)
- return (bool) result;
-#endif
-
-#if CSHARP_CHOICE_MONO
- result = execute_csharp_using_mono (assembly_path, libdirs, libdirs_count,
- args, nargs, verbose, quiet,
- executer, private_data);
- if (result >= 0)
- return (bool) result;
-#endif
-
- /* Then try the remaining C# implementations in our standard order. */
-#if !CSHARP_CHOICE_PNET
- result = execute_csharp_using_pnet (assembly_path, libdirs, libdirs_count,
- args, nargs, verbose, quiet,
- executer, private_data);
- if (result >= 0)
- return (bool) result;
-#endif
-
-#if !CSHARP_CHOICE_MONO
- result = execute_csharp_using_mono (assembly_path, libdirs, libdirs_count,
- args, nargs, verbose, quiet,
- executer, private_data);
- if (result >= 0)
- return (bool) result;
-#endif
-
- result = execute_csharp_using_sscli (assembly_path, libdirs, libdirs_count,
- args, nargs, verbose, quiet,
- executer, private_data);
- if (result >= 0)
- return (bool) result;
-
- if (!quiet)
- error (0, 0, _("C# virtual machine not found, try installing pnet"));
- return true;
-}
+++ /dev/null
-/* Execute a C# program.
- Copyright (C) 2003 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _CSHARPEXEC_H
-#define _CSHARPEXEC_H
-
-#include <stdbool.h>
-
-typedef bool execute_fn (const char *progname,
- const char *prog_path, char **prog_argv,
- void *private_data);
-
-/* Execute a C# program.
- assembly_path is the assembly's pathname (= program name with .exe).
- libdirs is a list of directories to be searched for libraries.
- args is a NULL terminated list of arguments to be passed to the program.
- If verbose, the command to be executed will be printed.
- Then the command is passed to the execute function together with the
- private_data argument. This function returns false if OK, true on error.
- Return false if OK, true on error.
- If quiet, error messages will not be printed. */
-extern bool execute_csharp_program (const char *assembly_path,
- const char * const *libdirs,
- unsigned int libdirs_count,
- const char * const *args,
- bool verbose, bool quiet,
- execute_fn *executer, void *private_data);
-
-#endif /* _CSHARPEXEC_H */
+++ /dev/null
-/* Error handler for noninteractive utilities
- Copyright (C) 1990-1998, 2000-2003, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "error.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if !_LIBC && ENABLE_NLS
-# include "gettext.h"
-#endif
-
-#ifdef _LIBC
-# include <wchar.h>
-# define mbsrtowcs __mbsrtowcs
-#endif
-
-#if USE_UNLOCKED_IO
-# include "unlocked-io.h"
-#endif
-
-#ifndef _
-# define _(String) String
-#endif
-
-/* If NULL, error will flush stdout, then print on stderr the program
- name, a colon and a space. Otherwise, error will call this
- function without parameters instead. */
-void (*error_print_progname) (void);
-
-/* This variable is incremented each time `error' is called. */
-unsigned int error_message_count;
-
-#ifdef _LIBC
-/* In the GNU C library, there is a predefined variable for this. */
-
-# define program_name program_invocation_name
-# include <errno.h>
-# include <libio/libioP.h>
-
-/* In GNU libc we want do not want to use the common name `error' directly.
- Instead make it a weak alias. */
-extern void __error (int status, int errnum, const char *message, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
-extern void __error_at_line (int status, int errnum, const char *file_name,
- unsigned int line_number, const char *message,
- ...)
- __attribute__ ((__format__ (__printf__, 5, 6)));;
-# define error __error
-# define error_at_line __error_at_line
-
-# include <libio/iolibio.h>
-# define fflush(s) INTUSE(_IO_fflush) (s)
-# undef putc
-# define putc(c, fp) INTUSE(_IO_putc) (c, fp)
-
-# include <bits/libc-lock.h>
-
-#else /* not _LIBC */
-
-# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
-# ifndef HAVE_DECL_STRERROR_R
-"this configure-time declaration test was not run"
-# endif
-char *strerror_r ();
-# endif
-
-# ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-# endif
-
-/* The calling program should define program_name and set it to the
- name of the executing program. */
-extern char *program_name;
-
-# if HAVE_STRERROR_R || defined strerror_r
-# define __strerror_r strerror_r
-# endif
-#endif /* not _LIBC */
-
-static void
-print_errno_message (int errnum)
-{
- char const *s = NULL;
-
-#if defined HAVE_STRERROR_R || _LIBC
- char errbuf[1024];
-# if STRERROR_R_CHAR_P || _LIBC
- s = __strerror_r (errnum, errbuf, sizeof errbuf);
-# else
- if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
- s = errbuf;
-# endif
-#endif
-
-#if !_LIBC
- if (! s && ! (s = strerror (errnum)))
- s = _("Unknown system error");
-#endif
-
-#if _LIBC
- if (_IO_fwide (stderr, 0) > 0)
- {
- __fwprintf (stderr, L": %s", s);
- return;
- }
-#endif
-
- fprintf (stderr, ": %s", s);
-}
-
-static void
-error_tail (int status, int errnum, const char *message, va_list args)
-{
-#if _LIBC
- if (_IO_fwide (stderr, 0) > 0)
- {
-# define ALLOCA_LIMIT 2000
- size_t len = strlen (message) + 1;
- const wchar_t *wmessage = L"out of memory";
- wchar_t *wbuf = (len < ALLOCA_LIMIT
- ? alloca (len * sizeof *wbuf)
- : len <= SIZE_MAX / sizeof *wbuf
- ? malloc (len * sizeof *wbuf)
- : NULL);
-
- if (wbuf)
- {
- size_t res;
- mbstate_t st;
- const char *tmp = message;
- memset (&st, '\0', sizeof (st));
- res = mbsrtowcs (wbuf, &tmp, len, &st);
- wmessage = res == (size_t) -1 ? L"???" : wbuf;
- }
-
- __vfwprintf (stderr, wmessage, args);
- if (! (len < ALLOCA_LIMIT))
- free (wbuf);
- }
- else
-#endif
- vfprintf (stderr, message, args);
- va_end (args);
-
- ++error_message_count;
- if (errnum)
- print_errno_message (errnum);
-#if _LIBC
- if (_IO_fwide (stderr, 0) > 0)
- putwc (L'\n', stderr);
- else
-#endif
- putc ('\n', stderr);
- fflush (stderr);
- if (status)
- exit (status);
-}
-
-
-/* Print the program name and error message MESSAGE, which is a printf-style
- format string with optional args.
- If ERRNUM is nonzero, print its corresponding system error message.
- Exit with status STATUS if it is nonzero. */
-void
-error (int status, int errnum, const char *message, ...)
-{
- va_list args;
-
-#if defined _LIBC && defined __libc_ptf_call
- /* We do not want this call to be cut short by a thread
- cancellation. Therefore disable cancellation for now. */
- int state = PTHREAD_CANCEL_ENABLE;
- __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
- 0);
-#endif
-
- fflush (stdout);
-#ifdef _LIBC
- _IO_flockfile (stderr);
-#endif
- if (error_print_progname)
- (*error_print_progname) ();
- else
- {
-#if _LIBC
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s: ", program_name);
- else
-#endif
- fprintf (stderr, "%s: ", program_name);
- }
-
- va_start (args, message);
- error_tail (status, errnum, message, args);
-
-#ifdef _LIBC
- _IO_funlockfile (stderr);
-# ifdef __libc_ptf_call
- __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
-# endif
-#endif
-}
-\f
-/* Sometimes we want to have at most one error per line. This
- variable controls whether this mode is selected or not. */
-int error_one_per_line;
-
-void
-error_at_line (int status, int errnum, const char *file_name,
- unsigned int line_number, const char *message, ...)
-{
- va_list args;
-
- if (error_one_per_line)
- {
- static const char *old_file_name;
- static unsigned int old_line_number;
-
- if (old_line_number == line_number
- && (file_name == old_file_name
- || strcmp (old_file_name, file_name) == 0))
- /* Simply return and print nothing. */
- return;
-
- old_file_name = file_name;
- old_line_number = line_number;
- }
-
-#if defined _LIBC && defined __libc_ptf_call
- /* We do not want this call to be cut short by a thread
- cancellation. Therefore disable cancellation for now. */
- int state = PTHREAD_CANCEL_ENABLE;
- __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
- 0);
-#endif
-
- fflush (stdout);
-#ifdef _LIBC
- _IO_flockfile (stderr);
-#endif
- if (error_print_progname)
- (*error_print_progname) ();
- else
- {
-#if _LIBC
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s: ", program_name);
- else
-#endif
- fprintf (stderr, "%s:", program_name);
- }
-
- if (file_name != NULL)
- {
-#if _LIBC
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s:%d: ", file_name, line_number);
- else
-#endif
- fprintf (stderr, "%s:%d: ", file_name, line_number);
- }
-
- va_start (args, message);
- error_tail (status, errnum, message, args);
-
-#ifdef _LIBC
- _IO_funlockfile (stderr);
-# ifdef __libc_ptf_call
- __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
-# endif
-#endif
-}
-
-#ifdef _LIBC
-/* Make the weak alias. */
-# undef error
-# undef error_at_line
-weak_alias (__error, error)
-weak_alias (__error_at_line, error_at_line)
-#endif
+++ /dev/null
-/* Declaration for error-reporting function
- Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _ERROR_H
-#define _ERROR_H 1
-
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-# define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-# define __format__ format
-# define __printf__ printf
-# endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* 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)'. */
-
-extern void error (int __status, int __errnum, const char *__format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
-
-extern void error_at_line (int __status, int __errnum, const char *__fname,
- unsigned int __lineno, const char *__format, ...)
- __attribute__ ((__format__ (__printf__, 5, 6)));
-
-/* If NULL, error will flush stdout, then print on stderr the program
- name, a colon and a space. Otherwise, error will call this
- function without parameters instead. */
-extern DLL_VARIABLE void (*error_print_progname) (void);
-
-/* This variable is incremented each time `error' is called. */
-extern DLL_VARIABLE unsigned int error_message_count;
-
-/* Sometimes we want to have at most one error per line. This
- variable controls whether this mode is selected or not. */
-extern DLL_VARIABLE int error_one_per_line;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* error.h */
+++ /dev/null
-/* Creation of autonomous subprocesses.
- Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-/* Specification. */
-#include "execute.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include "error.h"
-#include "exit.h"
-#include "fatal-signal.h"
-#include "wait-process.h"
-#include "gettext.h"
-
-#define _(str) gettext (str)
-
-#if defined _MSC_VER || defined __MINGW32__
-
-/* Native Woe32 API. */
-# include <process.h>
-# include "w32spawn.h"
-
-#else
-
-/* Unix API. */
-# ifdef HAVE_POSIX_SPAWN
-# include <spawn.h>
-# else
-# ifdef HAVE_VFORK_H
-# include <vfork.h>
-# endif
-# endif
-
-#endif
-
-#ifndef HAVE_ENVIRON_DECL
-extern char **environ;
-#endif
-
-#ifndef STDIN_FILENO
-# define STDIN_FILENO 0
-#endif
-#ifndef STDOUT_FILENO
-# define STDOUT_FILENO 1
-#endif
-#ifndef STDERR_FILENO
-# define STDERR_FILENO 2
-#endif
-
-
-#ifdef EINTR
-
-/* EINTR handling for close(), open().
- These functions can return -1/EINTR even though we don't have any
- signal handlers set up, namely when we get interrupted via SIGSTOP. */
-
-static inline int
-nonintr_close (int fd)
-{
- int retval;
-
- do
- retval = close (fd);
- while (retval < 0 && errno == EINTR);
-
- return retval;
-}
-#define close nonintr_close
-
-static inline int
-nonintr_open (const char *pathname, int oflag, mode_t mode)
-{
- int retval;
-
- do
- retval = open (pathname, oflag, mode);
- while (retval < 0 && errno == EINTR);
-
- return retval;
-}
-#undef open /* avoid warning on VMS */
-#define open nonintr_open
-
-#endif
-
-
-/* Execute a command, optionally redirecting any of the three standard file
- descriptors to /dev/null. Return its exit code.
- If it didn't terminate correctly, exit if exit_on_error is true, otherwise
- return 127.
- If slave_process is true, the child process will be terminated when its
- creator receives a catchable fatal signal. */
-int
-execute (const char *progname,
- const char *prog_path, char **prog_argv,
- bool ignore_sigpipe,
- bool null_stdin, bool null_stdout, bool null_stderr,
- bool slave_process, bool exit_on_error)
-{
-#if defined _MSC_VER || defined __MINGW32__
-
- /* Native Woe32 API. */
- int orig_stdin;
- int orig_stdout;
- int orig_stderr;
- int exitcode;
- int nullinfd;
- int nulloutfd;
-
- prog_argv = prepare_spawn (prog_argv);
-
- /* Save standard file handles of parent process. */
- if (null_stdin)
- orig_stdin = dup_noinherit (STDIN_FILENO);
- if (null_stdout)
- orig_stdout = dup_noinherit (STDOUT_FILENO);
- if (null_stderr)
- orig_stderr = dup_noinherit (STDERR_FILENO);
- exitcode = -1;
-
- /* Create standard file handles of child process. */
- nullinfd = -1;
- nulloutfd = -1;
- if ((!null_stdin
- || ((nullinfd = open ("NUL", O_RDONLY, 0)) >= 0
- && (nullinfd == STDIN_FILENO
- || (dup2 (nullinfd, STDIN_FILENO) >= 0
- && close (nullinfd) >= 0))))
- && (!(null_stdout || null_stderr)
- || ((nulloutfd = open ("NUL", O_RDWR, 0)) >= 0
- && (!null_stdout
- || nulloutfd == STDOUT_FILENO
- || dup2 (nulloutfd, STDOUT_FILENO) >= 0)
- && (!null_stderr
- || nulloutfd == STDERR_FILENO
- || dup2 (nulloutfd, STDERR_FILENO) >= 0)
- && ((null_stdout && nulloutfd == STDOUT_FILENO)
- || (null_stderr && nulloutfd == STDERR_FILENO)
- || close (nulloutfd) >= 0))))
- exitcode = spawnvp (P_WAIT, prog_path, prog_argv);
- if (nulloutfd >= 0)
- close (nulloutfd);
- if (nullinfd >= 0)
- close (nullinfd);
-
- /* Restore standard file handles of parent process. */
- if (null_stderr)
- dup2 (orig_stderr, STDERR_FILENO), close (orig_stderr);
- if (null_stdout)
- dup2 (orig_stdout, STDOUT_FILENO), close (orig_stdout);
- if (null_stdin)
- dup2 (orig_stdin, STDIN_FILENO), close (orig_stdin);
-
- if (exitcode == -1)
- {
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, errno,
- _("%s subprocess failed"), progname);
- return 127;
- }
-
- return exitcode;
-
-#else
-
- /* Unix API. */
- /* Note about 127: Some errors during posix_spawnp() cause the function
- posix_spawnp() to return an error code; some other errors cause the
- subprocess to exit with return code 127. It is implementation
- dependent which error is reported which way. We treat both cases as
- equivalent. */
-#if HAVE_POSIX_SPAWN
- sigset_t blocked_signals;
- posix_spawn_file_actions_t actions;
- bool actions_allocated;
- posix_spawnattr_t attrs;
- bool attrs_allocated;
- int err;
- pid_t child;
-#else
- int child;
-#endif
-
-#if HAVE_POSIX_SPAWN
- if (slave_process)
- {
- sigprocmask (SIG_SETMASK, NULL, &blocked_signals);
- block_fatal_signals ();
- }
- actions_allocated = false;
- attrs_allocated = false;
- if ((err = posix_spawn_file_actions_init (&actions)) != 0
- || (actions_allocated = true,
- (null_stdin
- && (err = posix_spawn_file_actions_addopen (&actions,
- STDIN_FILENO,
- "/dev/null", O_RDONLY,
- 0))
- != 0)
- || (null_stdout
- && (err = posix_spawn_file_actions_addopen (&actions,
- STDOUT_FILENO,
- "/dev/null", O_RDWR,
- 0))
- != 0)
- || (null_stderr
- && (err = posix_spawn_file_actions_addopen (&actions,
- STDERR_FILENO,
- "/dev/null", O_RDWR,
- 0))
- != 0)
- || (slave_process
- && ((err = posix_spawnattr_init (&attrs)) != 0
- || (attrs_allocated = true,
- (err = posix_spawnattr_setsigmask (&attrs,
- &blocked_signals))
- != 0
- || (err = posix_spawnattr_setflags (&attrs,
- POSIX_SPAWN_SETSIGMASK))
- != 0)))
- || (err = posix_spawnp (&child, prog_path, &actions,
- attrs_allocated ? &attrs : NULL, prog_argv,
- environ))
- != 0))
- {
- if (actions_allocated)
- posix_spawn_file_actions_destroy (&actions);
- if (attrs_allocated)
- posix_spawnattr_destroy (&attrs);
- if (slave_process)
- unblock_fatal_signals ();
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, err,
- _("%s subprocess failed"), progname);
- return 127;
- }
- posix_spawn_file_actions_destroy (&actions);
- if (attrs_allocated)
- posix_spawnattr_destroy (&attrs);
-#else
- if (slave_process)
- block_fatal_signals ();
- /* Use vfork() instead of fork() for efficiency. */
- if ((child = vfork ()) == 0)
- {
- /* Child process code. */
- int nullinfd;
- int nulloutfd;
-
- if ((!null_stdin
- || ((nullinfd = open ("/dev/null", O_RDONLY, 0)) >= 0
- && (nullinfd == STDIN_FILENO
- || (dup2 (nullinfd, STDIN_FILENO) >= 0
- && close (nullinfd) >= 0))))
- && (!(null_stdout || null_stderr)
- || ((nulloutfd = open ("/dev/null", O_RDWR, 0)) >= 0
- && (!null_stdout
- || nulloutfd == STDOUT_FILENO
- || dup2 (nulloutfd, STDOUT_FILENO) >= 0)
- && (!null_stderr
- || nulloutfd == STDERR_FILENO
- || dup2 (nulloutfd, STDERR_FILENO) >= 0)
- && ((null_stdout && nulloutfd == STDOUT_FILENO)
- || (null_stderr && nulloutfd == STDERR_FILENO)
- || close (nulloutfd) >= 0)))
- && (!slave_process || (unblock_fatal_signals (), true)))
- execvp (prog_path, prog_argv);
- _exit (127);
- }
- if (child == -1)
- {
- if (slave_process)
- unblock_fatal_signals ();
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, errno,
- _("%s subprocess failed"), progname);
- return 127;
- }
-#endif
- if (slave_process)
- {
- register_slave_subprocess (child);
- unblock_fatal_signals ();
- }
-
- return wait_subprocess (child, progname, ignore_sigpipe, null_stderr,
- slave_process, exit_on_error);
-
-#endif
-}
+++ /dev/null
-/* Creation of autonomous subprocesses.
- Copyright (C) 2001-2003 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _EXECUTE_H
-#define _EXECUTE_H
-
-#include <stdbool.h>
-
-/* Execute a command, optionally redirecting any of the three standard file
- descriptors to /dev/null. Return its exit code.
- If it didn't terminate correctly, exit if exit_on_error is true, otherwise
- return 127.
- If ignore_sigpipe is true, consider a subprocess termination due to SIGPIPE
- as equivalent to a success. This is suitable for processes whose only
- purpose is to write to standard output.
- If slave_process is true, the child process will be terminated when its
- creator receives a catchable fatal signal.
- It is recommended that no signal is blocked or ignored while execute()
- is called. See pipe.h for the reason. */
-extern int execute (const char *progname,
- const char *prog_path, char **prog_argv,
- bool ignore_sigpipe,
- bool null_stdin, bool null_stdout, bool null_stderr,
- bool slave_process, bool exit_on_error);
-
-#endif /* _EXECUTE_H */
+++ /dev/null
-/* exit() function.
- Copyright (C) 1995, 2001 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _EXIT_H
-#define _EXIT_H
-
-/* Get exit() declaration. */
-#include <stdlib.h>
-
-/* Some systems do not define EXIT_*, despite otherwise supporting C89. */
-#ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-#endif
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-
-#endif /* _EXIT_H */
+++ /dev/null
-/* Failure exit status
-
- Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING.
- If not, write to the Free Software Foundation,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "exitfail.h"
-#include "exit.h"
-
-int volatile exit_failure = EXIT_FAILURE;
+++ /dev/null
-/* Failure exit status
-
- Copyright (C) 2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING.
- If not, write to the Free Software Foundation,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-extern DLL_VARIABLE int volatile exit_failure;
+++ /dev/null
-/* Emergency actions in case of a fatal signal.
- Copyright (C) 2003-2004, 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "fatal-signal.h"
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include "xalloc.h"
-
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
-
-/* ========================================================================= */
-
-
-/* The list of fatal signals.
- These are those signals whose default action is to terminate the process
- without a core dump, except
- SIGKILL - because it cannot be caught,
- SIGALRM SIGUSR1 SIGUSR2 SIGPOLL SIGIO SIGLOST - because applications
- often use them for their own purpose,
- SIGPROF SIGVTALRM - because they are used for profiling,
- SIGSTKFLT - because it is more similar to SIGFPE, SIGSEGV, SIGBUS,
- SIGSYS - because it is more similar to SIGABRT, SIGSEGV,
- SIGPWR - because it of too special use,
- SIGRTMIN...SIGRTMAX - because they are reserved for application use.
- plus
- SIGXCPU, SIGXFSZ - because they are quite similar to SIGTERM. */
-
-static int fatal_signals[] =
- {
- /* ISO C 99 signals. */
-#ifdef SIGINT
- SIGINT,
-#endif
-#ifdef SIGTERM
- SIGTERM,
-#endif
- /* POSIX:2001 signals. */
-#ifdef SIGHUP
- SIGHUP,
-#endif
-#ifdef SIGPIPE
- SIGPIPE,
-#endif
- /* BSD signals. */
-#ifdef SIGXCPU
- SIGXCPU,
-#endif
-#ifdef SIGXFSZ
- SIGXFSZ,
-#endif
- 0
- };
-
-#define num_fatal_signals (SIZEOF (fatal_signals) - 1)
-
-/* Eliminate signals whose signal handler is SIG_IGN. */
-
-static void
-init_fatal_signals (void)
-{
- static bool fatal_signals_initialized = false;
- if (!fatal_signals_initialized)
- {
-#if HAVE_SIGACTION
- size_t i;
-
- for (i = 0; i < num_fatal_signals; i++)
- {
- struct sigaction action;
-
- if (sigaction (fatal_signals[i], NULL, &action) >= 0
- && action.sa_handler == SIG_IGN)
- fatal_signals[i] = -1;
- }
-#endif
-
- fatal_signals_initialized = true;
- }
-}
-
-
-/* ========================================================================= */
-
-
-typedef void (*action_t) (void);
-
-/* Type of an entry in the actions array.
- The 'action' field is accessed from within the fatal_signal_handler(),
- therefore we mark it as 'volatile'. */
-typedef struct
-{
- volatile action_t action;
-}
-actions_entry_t;
-
-/* The registered cleanup actions. */
-static actions_entry_t static_actions[32];
-static actions_entry_t * volatile actions = static_actions;
-static sig_atomic_t volatile actions_count = 0;
-static size_t actions_allocated = SIZEOF (static_actions);
-
-
-/* Uninstall the handlers. */
-static inline void
-uninstall_handlers ()
-{
- size_t i;
-
- for (i = 0; i < num_fatal_signals; i++)
- if (fatal_signals[i] >= 0)
- signal (fatal_signals[i], SIG_DFL);
-}
-
-
-/* The signal handler. It gets called asynchronously. */
-static void
-fatal_signal_handler (int sig)
-{
- for (;;)
- {
- /* Get the last registered cleanup action, in a reentrant way. */
- action_t action;
- size_t n = actions_count;
- if (n == 0)
- break;
- n--;
- actions_count = n;
- action = actions[n].action;
- /* Execute the action. */
- action ();
- }
-
- /* Now execute the signal's default action.
- If signal() blocks the signal being delivered for the duration of the
- signal handler's execution, the re-raised signal is delivered when this
- handler returns; otherwise it is delivered already during raise(). */
- uninstall_handlers ();
-#if HAVE_RAISE
- raise (sig);
-#else
- kill (getpid (), sig);
-#endif
-}
-
-
-/* Install the handlers. */
-static inline void
-install_handlers ()
-{
- size_t i;
-
- for (i = 0; i < num_fatal_signals; i++)
- if (fatal_signals[i] >= 0)
- signal (fatal_signals[i], &fatal_signal_handler);
-}
-
-
-/* Register a cleanup function to be executed when a catchable fatal signal
- occurs. */
-void
-at_fatal_signal (action_t action)
-{
- static bool cleanup_initialized = false;
- if (!cleanup_initialized)
- {
- init_fatal_signals ();
- install_handlers ();
- cleanup_initialized = true;
- }
-
- if (actions_count == actions_allocated)
- {
- /* Extend the actions array. Note that we cannot use xrealloc(),
- because then the cleanup() function could access an already
- deallocated array. */
- actions_entry_t *old_actions = actions;
- size_t old_actions_allocated = actions_allocated;
- size_t new_actions_allocated = 2 * actions_allocated;
- actions_entry_t *new_actions =
- xmalloc (new_actions_allocated * sizeof (actions_entry_t));
- size_t k;
-
- /* Don't use memcpy() here, because memcpy takes non-volatile arguments
- and is therefore not guaranteed to complete all memory stores before
- the next statement. */
- for (k = 0; k < old_actions_allocated; k++)
- new_actions[k] = old_actions[k];
- actions = new_actions;
- actions_allocated = new_actions_allocated;
- /* Now we can free the old actions array. */
- if (old_actions != static_actions)
- free (old_actions);
- }
- /* The two uses of 'volatile' in the types above (and ISO C 99 section
- 5.1.2.3.(5)) ensure that we increment the actions_count only after
- the new action has been written to the memory location
- actions[actions_count]. */
- actions[actions_count].action = action;
- actions_count++;
-}
-
-
-/* ========================================================================= */
-
-
-#if HAVE_POSIX_SIGNALBLOCKING
-
-static sigset_t fatal_signal_set;
-
-static void
-init_fatal_signal_set ()
-{
- static bool fatal_signal_set_initialized = false;
- if (!fatal_signal_set_initialized)
- {
- size_t i;
-
- init_fatal_signals ();
-
- sigemptyset (&fatal_signal_set);
- for (i = 0; i < num_fatal_signals; i++)
- if (fatal_signals[i] >= 0)
- sigaddset (&fatal_signal_set, fatal_signals[i]);
-
- fatal_signal_set_initialized = true;
- }
-}
-
-/* Temporarily delay the catchable fatal signals. */
-void
-block_fatal_signals ()
-{
- init_fatal_signal_set ();
- sigprocmask (SIG_BLOCK, &fatal_signal_set, NULL);
-}
-
-/* Stop delaying the catchable fatal signals. */
-void
-unblock_fatal_signals ()
-{
- init_fatal_signal_set ();
- sigprocmask (SIG_UNBLOCK, &fatal_signal_set, NULL);
-}
-
-#else
-
-/* Don't bother caring about the old systems which don't have POSIX signal
- blocking. */
-
-void
-block_fatal_signals ()
-{
-}
-
-void
-unblock_fatal_signals ()
-{
-}
-
-#endif
+++ /dev/null
-/* Emergency actions in case of a fatal signal.
- Copyright (C) 2003-2004 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* It is often useful to do some cleanup action when a usually fatal signal
- terminates the process, like removing a temporary file or killing a
- subprocess that may be stuck waiting for a device, pipe or network input.
- Such signals are SIGHUP, SIGINT, SIGPIPE, SIGTERM, and possibly others.
- The limitation of this facility is that it cannot work for SIGKILL.
-
- Signals with a SIG_IGN handler are considered to be non-fatal. The
- functions in this file assume that when a SIG_IGN handler is installed
- for a signal, it was installed before any functions in this file were
- called and it stays so for the whole lifetime of the process. */
-
-/* Register a cleanup function to be executed when a catchable fatal signal
- occurs.
-
- Restrictions for the cleanup function:
- - The cleanup function can do all kinds of system calls.
- - It can also access application dependent memory locations and data
- structures provided they are in a consistent state. One way to ensure
- this is through block_fatal_signals()/unblock_fatal_signals(), see
- below. Another - more tricky - way to ensure this is the careful use
- of 'volatile'.
- However,
- - malloc() and similarly complex facilities are not safe to be called
- because they are not guaranteed to be in a consistent state.
- - Also, the cleanup function must not block the catchable fatal signals
- and leave them blocked upon return.
-
- The cleanup function is executed asynchronously. It is unspecified
- whether during its execution the catchable fatal signals are blocked
- or not. */
-extern void at_fatal_signal (void (*function) (void));
-
-
-/* Sometimes it is necessary to block the usually fatal signals while the
- data structures being accessed by the cleanup action are being built or
- reorganized. This is the case, for example, when a temporary file or
- directory is created through mkstemp() or mkdtemp(), because these
- functions create the temporary file or directory _before_ returning its
- name to the application. */
-
-/* Temporarily delay the catchable fatal signals.
- The signals will be blocked (= delayed) until the next call to
- unblock_fatal_signals(). If the signals are already blocked, a further
- call to block_fatal_signals() has no effect. */
-extern void block_fatal_signals (void);
-
-/* Stop delaying the catchable fatal signals. */
-extern void unblock_fatal_signals (void);
-
-
-#ifdef __cplusplus
-}
-#endif
+++ /dev/null
-/* Locating a program in PATH.
- Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "findprog.h"
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "xalloc.h"
-#include "pathname.h"
-
-
-const char *
-find_in_path (const char *progname)
-{
-#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
- /* Win32, Cygwin, OS/2, DOS */
- /* The searching rules with .COM, .EXE, .BAT, .CMD etc. suffixes are
- too complicated. Leave it to the OS. */
- return progname;
-#else
- /* Unix */
- char *path;
- char *dir;
- char *cp;
-
- if (strchr (progname, '/') != NULL)
- /* If progname contains a slash, it is either absolute or relative to
- the current directory. PATH is not used. */
- return progname;
-
- path = getenv ("PATH");
- if (path == NULL || *path == '\0')
- /* If PATH is not set, the default search path is implementation
- dependent. */
- return progname;
-
- /* Make a copy, to prepare for destructive modifications. */
- path = xstrdup (path);
- for (dir = path; ; dir = cp + 1)
- {
- bool last;
- char *progpathname;
-
- /* Extract next directory in PATH. */
- for (cp = dir; *cp != '\0' && *cp != ':'; cp++)
- ;
- last = (*cp == '\0');
- *cp = '\0';
-
- /* Empty PATH components designate the current directory. */
- if (dir == cp)
- dir = ".";
-
- /* Concatenate dir and progname. */
- progpathname = concatenated_pathname (dir, progname, NULL);
-
- /* On systems which have the eaccess() system call, let's use it.
- On other systems, let's hope that this program is not installed
- setuid or setgid, so that it is ok to call access() despite its
- design flaw. */
- if (eaccess (progpathname, X_OK) == 0)
- {
- /* Found! */
- if (strcmp (progpathname, progname) == 0)
- {
- free (progpathname);
-
- /* Add the "./" prefix for real, that concatenated_pathname()
- optimized away. This avoids a second PATH search when the
- caller uses execlp/execvp. */
- progpathname = xmalloc (2 + strlen (progname) + 1);
- progpathname[0] = '.';
- progpathname[1] = '/';
- memcpy (progpathname + 2, progname, strlen (progname) + 1);
- }
-
- free (path);
- return progpathname;
- }
-
- free (progpathname);
-
- if (last)
- break;
- }
-
- /* Not found in PATH. An error will be signalled at the first call. */
- free (path);
- return progname;
-#endif
-}
+++ /dev/null
-/* Locating a program in PATH.
- Copyright (C) 2001-2003 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Look up a program in the PATH.
- Attempt to determine the pathname that would be called by execlp/execvp
- of PROGNAME. If successful, return a pathname containing a slash
- (either absolute or relative to the current directory). Otherwise,
- return PROGNAME unmodified.
- Because of the latter case, callers should use execlp/execvp, not
- execl/execv on the returned pathname.
- The returned string is freshly malloc()ed if it is != PROGNAME. */
-extern const char *find_in_path (const char *progname);
-
-
-#ifdef __cplusplus
-}
-#endif
+++ /dev/null
-/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006
- Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Enable GNU extensions in fnmatch.h. */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE 1
-#endif
-
-#if ! defined __builtin_expect && __GNUC__ < 3
-# define __builtin_expect(expr, expected) (expr)
-#endif
-
-#include <fnmatch.h>
-
-#include <alloca.h>
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stddef.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define WIDE_CHAR_SUPPORT \
- (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC \
- && HAVE_WMEMCHR && (HAVE_WMEMCPY || HAVE_WMEMPCPY))
-
-/* For platform which support the ISO C amendement 1 functionality we
- support user defined character classes. */
-#if defined _LIBC || WIDE_CHAR_SUPPORT
-/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
-# include <wchar.h>
-# include <wctype.h>
-#endif
-
-/* We need some of the locale data (the collation sequence information)
- but there is no interface to get this information in general. Therefore
- we support a correct implementation only in glibc. */
-#ifdef _LIBC
-# include "../locale/localeinfo.h"
-# include "../locale/elem-hash.h"
-# include "../locale/coll-lookup.h"
-# include <shlib-compat.h>
-
-# define CONCAT(a,b) __CONCAT(a,b)
-# define mbsrtowcs __mbsrtowcs
-# define fnmatch __fnmatch
-extern int fnmatch (const char *pattern, const char *string, int flags);
-#endif
-
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-#endif
-
-/* We often have to test for FNM_FILE_NAME and FNM_PERIOD being both set. */
-#define NO_LEADING_PERIOD(flags) \
- ((flags & (FNM_FILE_NAME | FNM_PERIOD)) == (FNM_FILE_NAME | FNM_PERIOD))
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself, and have not detected a bug
- in the library. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#if defined _LIBC || !defined __GNU_LIBRARY__ || !HAVE_FNMATCH_GNU
-
-
-# if ! (defined isblank || HAVE_DECL_ISBLANK)
-# define isblank(c) ((c) == ' ' || (c) == '\t')
-# endif
-
-# define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
-
-# if defined _LIBC || WIDE_CHAR_SUPPORT
-/* The GNU C library provides support for user-defined character classes
- and the functions from ISO C amendement 1. */
-# ifdef CHARCLASS_NAME_MAX
-# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
-# else
-/* This shouldn't happen but some implementation might still have this
- problem. Use a reasonable default value. */
-# define CHAR_CLASS_MAX_LENGTH 256
-# endif
-
-# ifdef _LIBC
-# define IS_CHAR_CLASS(string) __wctype (string)
-# else
-# define IS_CHAR_CLASS(string) wctype (string)
-# endif
-
-# ifdef _LIBC
-# define ISWCTYPE(WC, WT) __iswctype (WC, WT)
-# else
-# define ISWCTYPE(WC, WT) iswctype (WC, WT)
-# endif
-
-# if (HAVE_MBSTATE_T && HAVE_MBSRTOWCS) || _LIBC
-/* In this case we are implementing the multibyte character handling. */
-# define HANDLE_MULTIBYTE 1
-# endif
-
-# else
-# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
-
-# define IS_CHAR_CLASS(string) \
- (STREQ (string, "alpha") || STREQ (string, "upper") \
- || STREQ (string, "lower") || STREQ (string, "digit") \
- || STREQ (string, "alnum") || STREQ (string, "xdigit") \
- || STREQ (string, "space") || STREQ (string, "print") \
- || STREQ (string, "punct") || STREQ (string, "graph") \
- || STREQ (string, "cntrl") || STREQ (string, "blank"))
-# endif
-
-/* Avoid depending on library functions or files
- whose names are inconsistent. */
-
-/* Global variable. */
-static int posixly_correct;
-
-# ifndef internal_function
-/* Inside GNU libc we mark some function in a special way. In other
- environments simply ignore the marking. */
-# define internal_function
-# endif
-
-/* Note that this evaluates C many times. */
-# define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
-# define CHAR char
-# define UCHAR unsigned char
-# define INT int
-# define FCT internal_fnmatch
-# define EXT ext_match
-# define END end_pattern
-# define L_(CS) CS
-# ifdef _LIBC
-# define BTOWC(C) __btowc (C)
-# else
-# define BTOWC(C) btowc (C)
-# endif
-# define STRLEN(S) strlen (S)
-# define STRCAT(D, S) strcat (D, S)
-# ifdef _LIBC
-# define MEMPCPY(D, S, N) __mempcpy (D, S, N)
-# else
-# if HAVE_MEMPCPY
-# define MEMPCPY(D, S, N) mempcpy (D, S, N)
-# else
-# define MEMPCPY(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N)))
-# endif
-# endif
-# define MEMCHR(S, C, N) memchr (S, C, N)
-# define STRCOLL(S1, S2) strcoll (S1, S2)
-# include "fnmatch_loop.c"
-
-
-# if HANDLE_MULTIBYTE
-# define FOLD(c) ((flags & FNM_CASEFOLD) ? towlower (c) : (c))
-# define CHAR wchar_t
-# define UCHAR wint_t
-# define INT wint_t
-# define FCT internal_fnwmatch
-# define EXT ext_wmatch
-# define END end_wpattern
-# define L_(CS) L##CS
-# define BTOWC(C) (C)
-# ifdef _LIBC
-# define STRLEN(S) __wcslen (S)
-# define STRCAT(D, S) __wcscat (D, S)
-# define MEMPCPY(D, S, N) __wmempcpy (D, S, N)
-# else
-# define STRLEN(S) wcslen (S)
-# define STRCAT(D, S) wcscat (D, S)
-# if HAVE_WMEMPCPY
-# define MEMPCPY(D, S, N) wmempcpy (D, S, N)
-# else
-# define MEMPCPY(D, S, N) (wmemcpy (D, S, N) + (N))
-# endif
-# endif
-# define MEMCHR(S, C, N) wmemchr (S, C, N)
-# define STRCOLL(S1, S2) wcscoll (S1, S2)
-# define WIDE_CHAR_VERSION 1
-
-# undef IS_CHAR_CLASS
-/* We have to convert the wide character string in a multibyte string. But
- we know that the character class names consist of alphanumeric characters
- from the portable character set, and since the wide character encoding
- for a member of the portable character set is the same code point as
- its single-byte encoding, we can use a simplified method to convert the
- string to a multibyte character string. */
-static wctype_t
-is_char_class (const wchar_t *wcs)
-{
- char s[CHAR_CLASS_MAX_LENGTH + 1];
- char *cp = s;
-
- do
- {
- /* Test for a printable character from the portable character set. */
-# ifdef _LIBC
- if (*wcs < 0x20 || *wcs > 0x7e
- || *wcs == 0x24 || *wcs == 0x40 || *wcs == 0x60)
- return (wctype_t) 0;
-# else
- switch (*wcs)
- {
- case L' ': case L'!': case L'"': case L'#': case L'%':
- case L'&': case L'\'': case L'(': case L')': case L'*':
- case L'+': case L',': case L'-': case L'.': case L'/':
- case L'0': case L'1': case L'2': case L'3': case L'4':
- case L'5': case L'6': case L'7': case L'8': case L'9':
- case L':': case L';': case L'<': case L'=': case L'>':
- case L'?':
- case L'A': case L'B': case L'C': case L'D': case L'E':
- case L'F': case L'G': case L'H': case L'I': case L'J':
- case L'K': case L'L': case L'M': case L'N': case L'O':
- case L'P': case L'Q': case L'R': case L'S': case L'T':
- case L'U': case L'V': case L'W': case L'X': case L'Y':
- case L'Z':
- case L'[': case L'\\': case L']': case L'^': case L'_':
- case L'a': case L'b': case L'c': case L'd': case L'e':
- case L'f': case L'g': case L'h': case L'i': case L'j':
- case L'k': case L'l': case L'm': case L'n': case L'o':
- case L'p': case L'q': case L'r': case L's': case L't':
- case L'u': case L'v': case L'w': case L'x': case L'y':
- case L'z': case L'{': case L'|': case L'}': case L'~':
- break;
- default:
- return (wctype_t) 0;
- }
-# endif
-
- /* Avoid overrunning the buffer. */
- if (cp == s + CHAR_CLASS_MAX_LENGTH)
- return (wctype_t) 0;
-
- *cp++ = (char) *wcs++;
- }
- while (*wcs != L'\0');
-
- *cp = '\0';
-
-# ifdef _LIBC
- return __wctype (s);
-# else
- return wctype (s);
-# endif
-}
-# define IS_CHAR_CLASS(string) is_char_class (string)
-
-# include "fnmatch_loop.c"
-# endif
-
-
-int
-fnmatch (const char *pattern, const char *string, int flags)
-{
-# if HANDLE_MULTIBYTE
-# define ALLOCA_LIMIT 2000
- if (__builtin_expect (MB_CUR_MAX, 1) != 1)
- {
- mbstate_t ps;
- size_t patsize;
- size_t strsize;
- size_t totsize;
- wchar_t *wpattern;
- wchar_t *wstring;
- int res;
-
- /* Calculate the size needed to convert the strings to
- wide characters. */
- memset (&ps, '\0', sizeof (ps));
- patsize = mbsrtowcs (NULL, &pattern, 0, &ps) + 1;
- if (__builtin_expect (patsize != 0, 1))
- {
- assert (mbsinit (&ps));
- strsize = mbsrtowcs (NULL, &string, 0, &ps) + 1;
- if (__builtin_expect (strsize != 0, 1))
- {
- assert (mbsinit (&ps));
- totsize = patsize + strsize;
- if (__builtin_expect (! (patsize <= totsize
- && totsize <= SIZE_MAX / sizeof (wchar_t)),
- 0))
- {
- errno = ENOMEM;
- return -1;
- }
-
- /* Allocate room for the wide characters. */
- if (__builtin_expect (totsize < ALLOCA_LIMIT, 1))
- wpattern = (wchar_t *) alloca (totsize * sizeof (wchar_t));
- else
- {
- wpattern = malloc (totsize * sizeof (wchar_t));
- if (__builtin_expect (! wpattern, 0))
- {
- errno = ENOMEM;
- return -1;
- }
- }
- wstring = wpattern + patsize;
-
- /* Convert the strings into wide characters. */
- mbsrtowcs (wpattern, &pattern, patsize, &ps);
- assert (mbsinit (&ps));
- mbsrtowcs (wstring, &string, strsize, &ps);
-
- res = internal_fnwmatch (wpattern, wstring, wstring + strsize - 1,
- flags & FNM_PERIOD, flags);
-
- if (__builtin_expect (! (totsize < ALLOCA_LIMIT), 0))
- free (wpattern);
- return res;
- }
- }
- }
-
-# endif /* HANDLE_MULTIBYTE */
-
- return internal_fnmatch (pattern, string, string + strlen (string),
- flags & FNM_PERIOD, flags);
-}
-
-# ifdef _LIBC
-# undef fnmatch
-versioned_symbol (libc, __fnmatch, fnmatch, GLIBC_2_2_3);
-# if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_3)
-strong_alias (__fnmatch, __fnmatch_old)
-compat_symbol (libc, __fnmatch_old, fnmatch, GLIBC_2_0);
-# endif
-libc_hidden_ver (__fnmatch, fnmatch)
-# endif
-
-#endif /* _LIBC or not __GNU_LIBRARY__. */
+++ /dev/null
-/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003,
- 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _FNMATCH_H
-# define _FNMATCH_H 1
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-/* We #undef these before defining them because some losing systems
- (HP-UX A.08.07 for example) define these in <unistd.h>. */
-# undef FNM_PATHNAME
-# undef FNM_NOESCAPE
-# undef FNM_PERIOD
-
-/* Bits set in the FLAGS argument to `fnmatch'. */
-# define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */
-# define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
-# define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
-
-# if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
-# define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
-# define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
-# define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
-# define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */
-# endif
-
-/* Value returned by `fnmatch' if STRING does not match PATTERN. */
-# define FNM_NOMATCH 1
-
-/* This value is returned if the implementation does not support
- `fnmatch'. Since this is not the case here it will never be
- returned but the conformance test suites still require the symbol
- to be defined. */
-# ifdef _XOPEN_SOURCE
-# define FNM_NOSYS (-1)
-# endif
-
-/* Match NAME against the file name pattern PATTERN,
- returning zero if it matches, FNM_NOMATCH if not. */
-extern int fnmatch (const char *__pattern, const char *__name,
- int __flags);
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif /* fnmatch.h */
+++ /dev/null
-/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006
- Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Match STRING against the file name pattern PATTERN, returning zero if
- it matches, nonzero if not. */
-static int EXT (INT opt, const CHAR *pattern, const CHAR *string,
- const CHAR *string_end, bool no_leading_period, int flags)
- internal_function;
-static const CHAR *END (const CHAR *patternp) internal_function;
-
-static int
-internal_function
-FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
- bool no_leading_period, int flags)
-{
- register const CHAR *p = pattern, *n = string;
- register UCHAR c;
-#ifdef _LIBC
-# if WIDE_CHAR_VERSION
- const char *collseq = (const char *)
- _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQWC);
-# else
- const UCHAR *collseq = (const UCHAR *)
- _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQMB);
-# endif
-#endif
-
- while ((c = *p++) != L_('\0'))
- {
- bool new_no_leading_period = false;
- c = FOLD (c);
-
- switch (c)
- {
- case L_('?'):
- if (__builtin_expect (flags & FNM_EXTMATCH, 0) && *p == '(')
- {
- int res;
-
- res = EXT (c, p, n, string_end, no_leading_period,
- flags);
- if (res != -1)
- return res;
- }
-
- if (n == string_end)
- return FNM_NOMATCH;
- else if (*n == L_('/') && (flags & FNM_FILE_NAME))
- return FNM_NOMATCH;
- else if (*n == L_('.') && no_leading_period)
- return FNM_NOMATCH;
- break;
-
- case L_('\\'):
- if (!(flags & FNM_NOESCAPE))
- {
- c = *p++;
- if (c == L_('\0'))
- /* Trailing \ loses. */
- return FNM_NOMATCH;
- c = FOLD (c);
- }
- if (n == string_end || FOLD ((UCHAR) *n) != c)
- return FNM_NOMATCH;
- break;
-
- case L_('*'):
- if (__builtin_expect (flags & FNM_EXTMATCH, 0) && *p == '(')
- {
- int res;
-
- res = EXT (c, p, n, string_end, no_leading_period,
- flags);
- if (res != -1)
- return res;
- }
-
- if (n != string_end && *n == L_('.') && no_leading_period)
- return FNM_NOMATCH;
-
- for (c = *p++; c == L_('?') || c == L_('*'); c = *p++)
- {
- if (*p == L_('(') && (flags & FNM_EXTMATCH) != 0)
- {
- const CHAR *endp = END (p);
- if (endp != p)
- {
- /* This is a pattern. Skip over it. */
- p = endp;
- continue;
- }
- }
-
- if (c == L_('?'))
- {
- /* A ? needs to match one character. */
- if (n == string_end)
- /* There isn't another character; no match. */
- return FNM_NOMATCH;
- else if (*n == L_('/')
- && __builtin_expect (flags & FNM_FILE_NAME, 0))
- /* A slash does not match a wildcard under
- FNM_FILE_NAME. */
- return FNM_NOMATCH;
- else
- /* One character of the string is consumed in matching
- this ? wildcard, so *??? won't match if there are
- less than three characters. */
- ++n;
- }
- }
-
- if (c == L_('\0'))
- /* The wildcard(s) is/are the last element of the pattern.
- If the name is a file name and contains another slash
- this means it cannot match, unless the FNM_LEADING_DIR
- flag is set. */
- {
- int result = (flags & FNM_FILE_NAME) == 0 ? 0 : FNM_NOMATCH;
-
- if (flags & FNM_FILE_NAME)
- {
- if (flags & FNM_LEADING_DIR)
- result = 0;
- else
- {
- if (MEMCHR (n, L_('/'), string_end - n) == NULL)
- result = 0;
- }
- }
-
- return result;
- }
- else
- {
- const CHAR *endp;
-
- endp = MEMCHR (n, (flags & FNM_FILE_NAME) ? L_('/') : L_('\0'),
- string_end - n);
- if (endp == NULL)
- endp = string_end;
-
- if (c == L_('[')
- || (__builtin_expect (flags & FNM_EXTMATCH, 0) != 0
- && (c == L_('@') || c == L_('+') || c == L_('!'))
- && *p == L_('(')))
- {
- int flags2 = ((flags & FNM_FILE_NAME)
- ? flags : (flags & ~FNM_PERIOD));
- bool no_leading_period2 = no_leading_period;
-
- for (--p; n < endp; ++n, no_leading_period2 = false)
- if (FCT (p, n, string_end, no_leading_period2, flags2)
- == 0)
- return 0;
- }
- else if (c == L_('/') && (flags & FNM_FILE_NAME))
- {
- while (n < string_end && *n != L_('/'))
- ++n;
- if (n < string_end && *n == L_('/')
- && (FCT (p, n + 1, string_end, flags & FNM_PERIOD, flags)
- == 0))
- return 0;
- }
- else
- {
- int flags2 = ((flags & FNM_FILE_NAME)
- ? flags : (flags & ~FNM_PERIOD));
- int no_leading_period2 = no_leading_period;
-
- if (c == L_('\\') && !(flags & FNM_NOESCAPE))
- c = *p;
- c = FOLD (c);
- for (--p; n < endp; ++n, no_leading_period2 = false)
- if (FOLD ((UCHAR) *n) == c
- && (FCT (p, n, string_end, no_leading_period2, flags2)
- == 0))
- return 0;
- }
- }
-
- /* If we come here no match is possible with the wildcard. */
- return FNM_NOMATCH;
-
- case L_('['):
- {
- /* Nonzero if the sense of the character class is inverted. */
- register bool not;
- CHAR cold;
- UCHAR fn;
-
- if (posixly_correct == 0)
- posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1;
-
- if (n == string_end)
- return FNM_NOMATCH;
-
- if (*n == L_('.') && no_leading_period)
- return FNM_NOMATCH;
-
- if (*n == L_('/') && (flags & FNM_FILE_NAME))
- /* `/' cannot be matched. */
- return FNM_NOMATCH;
-
- not = (*p == L_('!') || (posixly_correct < 0 && *p == L_('^')));
- if (not)
- ++p;
-
- fn = FOLD ((UCHAR) *n);
-
- c = *p++;
- for (;;)
- {
- if (!(flags & FNM_NOESCAPE) && c == L_('\\'))
- {
- if (*p == L_('\0'))
- return FNM_NOMATCH;
- c = FOLD ((UCHAR) *p);
- ++p;
-
- if (c == fn)
- goto matched;
- }
- else if (c == L_('[') && *p == L_(':'))
- {
- /* Leave room for the null. */
- CHAR str[CHAR_CLASS_MAX_LENGTH + 1];
- size_t c1 = 0;
-#if defined _LIBC || WIDE_CHAR_SUPPORT
- wctype_t wt;
-#endif
- const CHAR *startp = p;
-
- for (;;)
- {
- if (c1 == CHAR_CLASS_MAX_LENGTH)
- /* The name is too long and therefore the pattern
- is ill-formed. */
- return FNM_NOMATCH;
-
- c = *++p;
- if (c == L_(':') && p[1] == L_(']'))
- {
- p += 2;
- break;
- }
- if (c < L_('a') || c >= L_('z'))
- {
- /* This cannot possibly be a character class name.
- Match it as a normal range. */
- p = startp;
- c = L_('[');
- goto normal_bracket;
- }
- str[c1++] = c;
- }
- str[c1] = L_('\0');
-
-#if defined _LIBC || WIDE_CHAR_SUPPORT
- wt = IS_CHAR_CLASS (str);
- if (wt == 0)
- /* Invalid character class name. */
- return FNM_NOMATCH;
-
-# if defined _LIBC && ! WIDE_CHAR_VERSION
- /* The following code is glibc specific but does
- there a good job in speeding up the code since
- we can avoid the btowc() call. */
- if (_ISCTYPE ((UCHAR) *n, wt))
- goto matched;
-# else
- if (ISWCTYPE (BTOWC ((UCHAR) *n), wt))
- goto matched;
-# endif
-#else
- if ((STREQ (str, L_("alnum")) && isalnum ((UCHAR) *n))
- || (STREQ (str, L_("alpha")) && isalpha ((UCHAR) *n))
- || (STREQ (str, L_("blank")) && isblank ((UCHAR) *n))
- || (STREQ (str, L_("cntrl")) && iscntrl ((UCHAR) *n))
- || (STREQ (str, L_("digit")) && isdigit ((UCHAR) *n))
- || (STREQ (str, L_("graph")) && isgraph ((UCHAR) *n))
- || (STREQ (str, L_("lower")) && islower ((UCHAR) *n))
- || (STREQ (str, L_("print")) && isprint ((UCHAR) *n))
- || (STREQ (str, L_("punct")) && ispunct ((UCHAR) *n))
- || (STREQ (str, L_("space")) && isspace ((UCHAR) *n))
- || (STREQ (str, L_("upper")) && isupper ((UCHAR) *n))
- || (STREQ (str, L_("xdigit")) && isxdigit ((UCHAR) *n)))
- goto matched;
-#endif
- c = *p++;
- }
-#ifdef _LIBC
- else if (c == L_('[') && *p == L_('='))
- {
- UCHAR str[1];
- uint32_t nrules =
- _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
- const CHAR *startp = p;
-
- c = *++p;
- if (c == L_('\0'))
- {
- p = startp;
- c = L_('[');
- goto normal_bracket;
- }
- str[0] = c;
-
- c = *++p;
- if (c != L_('=') || p[1] != L_(']'))
- {
- p = startp;
- c = L_('[');
- goto normal_bracket;
- }
- p += 2;
-
- if (nrules == 0)
- {
- if ((UCHAR) *n == str[0])
- goto matched;
- }
- else
- {
- const int32_t *table;
-# if WIDE_CHAR_VERSION
- const int32_t *weights;
- const int32_t *extra;
-# else
- const unsigned char *weights;
- const unsigned char *extra;
-# endif
- const int32_t *indirect;
- int32_t idx;
- const UCHAR *cp = (const UCHAR *) str;
-
- /* This #include defines a local function! */
-# if WIDE_CHAR_VERSION
-# include <locale/weightwc.h>
-# else
-# include <locale/weight.h>
-# endif
-
-# if WIDE_CHAR_VERSION
- table = (const int32_t *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEWC);
- weights = (const int32_t *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTWC);
- extra = (const int32_t *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAWC);
- indirect = (const int32_t *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTWC);
-# else
- table = (const int32_t *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
- weights = (const unsigned char *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTMB);
- extra = (const unsigned char *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
- indirect = (const int32_t *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
-# endif
-
- idx = findidx (&cp);
- if (idx != 0)
- {
- /* We found a table entry. Now see whether the
- character we are currently at has the same
- equivalance class value. */
- int len = weights[idx];
- int32_t idx2;
- const UCHAR *np = (const UCHAR *) n;
-
- idx2 = findidx (&np);
- if (idx2 != 0 && len == weights[idx2])
- {
- int cnt = 0;
-
- while (cnt < len
- && (weights[idx + 1 + cnt]
- == weights[idx2 + 1 + cnt]))
- ++cnt;
-
- if (cnt == len)
- goto matched;
- }
- }
- }
-
- c = *p++;
- }
-#endif
- else if (c == L_('\0'))
- /* [ (unterminated) loses. */
- return FNM_NOMATCH;
- else
- {
- bool is_range = false;
-
-#ifdef _LIBC
- bool is_seqval = false;
-
- if (c == L_('[') && *p == L_('.'))
- {
- uint32_t nrules =
- _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
- const CHAR *startp = p;
- size_t c1 = 0;
-
- while (1)
- {
- c = *++p;
- if (c == L_('.') && p[1] == L_(']'))
- {
- p += 2;
- break;
- }
- if (c == '\0')
- return FNM_NOMATCH;
- ++c1;
- }
-
- /* We have to handling the symbols differently in
- ranges since then the collation sequence is
- important. */
- is_range = *p == L_('-') && p[1] != L_('\0');
-
- if (nrules == 0)
- {
- /* There are no names defined in the collation
- data. Therefore we only accept the trivial
- names consisting of the character itself. */
- if (c1 != 1)
- return FNM_NOMATCH;
-
- if (!is_range && *n == startp[1])
- goto matched;
-
- cold = startp[1];
- c = *p++;
- }
- else
- {
- int32_t table_size;
- const int32_t *symb_table;
-# ifdef WIDE_CHAR_VERSION
- char str[c1];
- size_t strcnt;
-# else
-# define str (startp + 1)
-# endif
- const unsigned char *extra;
- int32_t idx;
- int32_t elem;
- int32_t second;
- int32_t hash;
-
-# ifdef WIDE_CHAR_VERSION
- /* We have to convert the name to a single-byte
- string. This is possible since the names
- consist of ASCII characters and the internal
- representation is UCS4. */
- for (strcnt = 0; strcnt < c1; ++strcnt)
- str[strcnt] = startp[1 + strcnt];
-# endif
-
- table_size =
- _NL_CURRENT_WORD (LC_COLLATE,
- _NL_COLLATE_SYMB_HASH_SIZEMB);
- symb_table = (const int32_t *)
- _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_SYMB_TABLEMB);
- extra = (const unsigned char *)
- _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_SYMB_EXTRAMB);
-
- /* Locate the character in the hashing table. */
- hash = elem_hash (str, c1);
-
- idx = 0;
- elem = hash % table_size;
- second = hash % (table_size - 2);
- while (symb_table[2 * elem] != 0)
- {
- /* First compare the hashing value. */
- if (symb_table[2 * elem] == hash
- && c1 == extra[symb_table[2 * elem + 1]]
- && memcmp (str,
- &extra[symb_table[2 * elem + 1]
- + 1], c1) == 0)
- {
- /* Yep, this is the entry. */
- idx = symb_table[2 * elem + 1];
- idx += 1 + extra[idx];
- break;
- }
-
- /* Next entry. */
- elem += second;
- }
-
- if (symb_table[2 * elem] != 0)
- {
- /* Compare the byte sequence but only if
- this is not part of a range. */
-# ifdef WIDE_CHAR_VERSION
- int32_t *wextra;
-
- idx += 1 + extra[idx];
- /* Adjust for the alignment. */
- idx = (idx + 3) & ~3;
-
- wextra = (int32_t *) &extra[idx + 4];
-# endif
-
- if (! is_range)
- {
-# ifdef WIDE_CHAR_VERSION
- for (c1 = 0;
- (int32_t) c1 < wextra[idx];
- ++c1)
- if (n[c1] != wextra[1 + c1])
- break;
-
- if ((int32_t) c1 == wextra[idx])
- goto matched;
-# else
- for (c1 = 0; c1 < extra[idx]; ++c1)
- if (n[c1] != extra[1 + c1])
- break;
-
- if (c1 == extra[idx])
- goto matched;
-# endif
- }
-
- /* Get the collation sequence value. */
- is_seqval = true;
-# ifdef WIDE_CHAR_VERSION
- cold = wextra[1 + wextra[idx]];
-# else
- /* Adjust for the alignment. */
- idx += 1 + extra[idx];
- idx = (idx + 3) & ~4;
- cold = *((int32_t *) &extra[idx]);
-# endif
-
- c = *p++;
- }
- else if (c1 == 1)
- {
- /* No valid character. Match it as a
- single byte. */
- if (!is_range && *n == str[0])
- goto matched;
-
- cold = str[0];
- c = *p++;
- }
- else
- return FNM_NOMATCH;
- }
- }
- else
-# undef str
-#endif
- {
- c = FOLD (c);
- normal_bracket:
-
- /* We have to handling the symbols differently in
- ranges since then the collation sequence is
- important. */
- is_range = (*p == L_('-') && p[1] != L_('\0')
- && p[1] != L_(']'));
-
- if (!is_range && c == fn)
- goto matched;
-
- cold = c;
- c = *p++;
- }
-
- if (c == L_('-') && *p != L_(']'))
- {
-#if _LIBC
- /* We have to find the collation sequence
- value for C. Collation sequence is nothing
- we can regularly access. The sequence
- value is defined by the order in which the
- definitions of the collation values for the
- various characters appear in the source
- file. A strange concept, nowhere
- documented. */
- uint32_t fcollseq;
- uint32_t lcollseq;
- UCHAR cend = *p++;
-
-# ifdef WIDE_CHAR_VERSION
- /* Search in the `names' array for the characters. */
- fcollseq = __collseq_table_lookup (collseq, fn);
- if (fcollseq == ~((uint32_t) 0))
- /* XXX We don't know anything about the character
- we are supposed to match. This means we are
- failing. */
- goto range_not_matched;
-
- if (is_seqval)
- lcollseq = cold;
- else
- lcollseq = __collseq_table_lookup (collseq, cold);
-# else
- fcollseq = collseq[fn];
- lcollseq = is_seqval ? cold : collseq[(UCHAR) cold];
-# endif
-
- is_seqval = false;
- if (cend == L_('[') && *p == L_('.'))
- {
- uint32_t nrules =
- _NL_CURRENT_WORD (LC_COLLATE,
- _NL_COLLATE_NRULES);
- const CHAR *startp = p;
- size_t c1 = 0;
-
- while (1)
- {
- c = *++p;
- if (c == L_('.') && p[1] == L_(']'))
- {
- p += 2;
- break;
- }
- if (c == '\0')
- return FNM_NOMATCH;
- ++c1;
- }
-
- if (nrules == 0)
- {
- /* There are no names defined in the
- collation data. Therefore we only
- accept the trivial names consisting
- of the character itself. */
- if (c1 != 1)
- return FNM_NOMATCH;
-
- cend = startp[1];
- }
- else
- {
- int32_t table_size;
- const int32_t *symb_table;
-# ifdef WIDE_CHAR_VERSION
- char str[c1];
- size_t strcnt;
-# else
-# define str (startp + 1)
-# endif
- const unsigned char *extra;
- int32_t idx;
- int32_t elem;
- int32_t second;
- int32_t hash;
-
-# ifdef WIDE_CHAR_VERSION
- /* We have to convert the name to a single-byte
- string. This is possible since the names
- consist of ASCII characters and the internal
- representation is UCS4. */
- for (strcnt = 0; strcnt < c1; ++strcnt)
- str[strcnt] = startp[1 + strcnt];
-# endif
-
- table_size =
- _NL_CURRENT_WORD (LC_COLLATE,
- _NL_COLLATE_SYMB_HASH_SIZEMB);
- symb_table = (const int32_t *)
- _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_SYMB_TABLEMB);
- extra = (const unsigned char *)
- _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_SYMB_EXTRAMB);
-
- /* Locate the character in the hashing
- table. */
- hash = elem_hash (str, c1);
-
- idx = 0;
- elem = hash % table_size;
- second = hash % (table_size - 2);
- while (symb_table[2 * elem] != 0)
- {
- /* First compare the hashing value. */
- if (symb_table[2 * elem] == hash
- && (c1
- == extra[symb_table[2 * elem + 1]])
- && memcmp (str,
- &extra[symb_table[2 * elem + 1]
- + 1], c1) == 0)
- {
- /* Yep, this is the entry. */
- idx = symb_table[2 * elem + 1];
- idx += 1 + extra[idx];
- break;
- }
-
- /* Next entry. */
- elem += second;
- }
-
- if (symb_table[2 * elem] != 0)
- {
- /* Compare the byte sequence but only if
- this is not part of a range. */
-# ifdef WIDE_CHAR_VERSION
- int32_t *wextra;
-
- idx += 1 + extra[idx];
- /* Adjust for the alignment. */
- idx = (idx + 3) & ~4;
-
- wextra = (int32_t *) &extra[idx + 4];
-# endif
- /* Get the collation sequence value. */
- is_seqval = true;
-# ifdef WIDE_CHAR_VERSION
- cend = wextra[1 + wextra[idx]];
-# else
- /* Adjust for the alignment. */
- idx += 1 + extra[idx];
- idx = (idx + 3) & ~4;
- cend = *((int32_t *) &extra[idx]);
-# endif
- }
- else if (symb_table[2 * elem] != 0 && c1 == 1)
- {
- cend = str[0];
- c = *p++;
- }
- else
- return FNM_NOMATCH;
- }
-# undef str
- }
- else
- {
- if (!(flags & FNM_NOESCAPE) && cend == L_('\\'))
- cend = *p++;
- if (cend == L_('\0'))
- return FNM_NOMATCH;
- cend = FOLD (cend);
- }
-
- /* XXX It is not entirely clear to me how to handle
- characters which are not mentioned in the
- collation specification. */
- if (
-# ifdef WIDE_CHAR_VERSION
- lcollseq == 0xffffffff ||
-# endif
- lcollseq <= fcollseq)
- {
- /* We have to look at the upper bound. */
- uint32_t hcollseq;
-
- if (is_seqval)
- hcollseq = cend;
- else
- {
-# ifdef WIDE_CHAR_VERSION
- hcollseq =
- __collseq_table_lookup (collseq, cend);
- if (hcollseq == ~((uint32_t) 0))
- {
- /* Hum, no information about the upper
- bound. The matching succeeds if the
- lower bound is matched exactly. */
- if (lcollseq != fcollseq)
- goto range_not_matched;
-
- goto matched;
- }
-# else
- hcollseq = collseq[cend];
-# endif
- }
-
- if (lcollseq <= hcollseq && fcollseq <= hcollseq)
- goto matched;
- }
-# ifdef WIDE_CHAR_VERSION
- range_not_matched:
-# endif
-#else
- /* We use a boring value comparison of the character
- values. This is better than comparing using
- `strcoll' since the latter would have surprising
- and sometimes fatal consequences. */
- UCHAR cend = *p++;
-
- if (!(flags & FNM_NOESCAPE) && cend == L_('\\'))
- cend = *p++;
- if (cend == L_('\0'))
- return FNM_NOMATCH;
-
- /* It is a range. */
- if (cold <= fn && fn <= cend)
- goto matched;
-#endif
-
- c = *p++;
- }
- }
-
- if (c == L_(']'))
- break;
- }
-
- if (!not)
- return FNM_NOMATCH;
- break;
-
- matched:
- /* Skip the rest of the [...] that already matched. */
- do
- {
- ignore_next:
- c = *p++;
-
- if (c == L_('\0'))
- /* [... (unterminated) loses. */
- return FNM_NOMATCH;
-
- if (!(flags & FNM_NOESCAPE) && c == L_('\\'))
- {
- if (*p == L_('\0'))
- return FNM_NOMATCH;
- /* XXX 1003.2d11 is unclear if this is right. */
- ++p;
- }
- else if (c == L_('[') && *p == L_(':'))
- {
- int c1 = 0;
- const CHAR *startp = p;
-
- while (1)
- {
- c = *++p;
- if (++c1 == CHAR_CLASS_MAX_LENGTH)
- return FNM_NOMATCH;
-
- if (*p == L_(':') && p[1] == L_(']'))
- break;
-
- if (c < L_('a') || c >= L_('z'))
- {
- p = startp;
- goto ignore_next;
- }
- }
- p += 2;
- c = *p++;
- }
- else if (c == L_('[') && *p == L_('='))
- {
- c = *++p;
- if (c == L_('\0'))
- return FNM_NOMATCH;
- c = *++p;
- if (c != L_('=') || p[1] != L_(']'))
- return FNM_NOMATCH;
- p += 2;
- c = *p++;
- }
- else if (c == L_('[') && *p == L_('.'))
- {
- ++p;
- while (1)
- {
- c = *++p;
- if (c == '\0')
- return FNM_NOMATCH;
-
- if (*p == L_('.') && p[1] == L_(']'))
- break;
- }
- p += 2;
- c = *p++;
- }
- }
- while (c != L_(']'));
- if (not)
- return FNM_NOMATCH;
- }
- break;
-
- case L_('+'):
- case L_('@'):
- case L_('!'):
- if (__builtin_expect (flags & FNM_EXTMATCH, 0) && *p == '(')
- {
- int res;
-
- res = EXT (c, p, n, string_end, no_leading_period, flags);
- if (res != -1)
- return res;
- }
- goto normal_match;
-
- case L_('/'):
- if (NO_LEADING_PERIOD (flags))
- {
- if (n == string_end || c != (UCHAR) *n)
- return FNM_NOMATCH;
-
- new_no_leading_period = true;
- break;
- }
- /* FALLTHROUGH */
- default:
- normal_match:
- if (n == string_end || c != FOLD ((UCHAR) *n))
- return FNM_NOMATCH;
- }
-
- no_leading_period = new_no_leading_period;
- ++n;
- }
-
- if (n == string_end)
- return 0;
-
- if ((flags & FNM_LEADING_DIR) && n != string_end && *n == L_('/'))
- /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */
- return 0;
-
- return FNM_NOMATCH;
-}
-
-
-static const CHAR *
-internal_function
-END (const CHAR *pattern)
-{
- const CHAR *p = pattern;
-
- while (1)
- if (*++p == L_('\0'))
- /* This is an invalid pattern. */
- return pattern;
- else if (*p == L_('['))
- {
- /* Handle brackets special. */
- if (posixly_correct == 0)
- posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1;
-
- /* Skip the not sign. We have to recognize it because of a possibly
- following ']'. */
- if (*++p == L_('!') || (posixly_correct < 0 && *p == L_('^')))
- ++p;
- /* A leading ']' is recognized as such. */
- if (*p == L_(']'))
- ++p;
- /* Skip over all characters of the list. */
- while (*p != L_(']'))
- if (*p++ == L_('\0'))
- /* This is no valid pattern. */
- return pattern;
- }
- else if ((*p == L_('?') || *p == L_('*') || *p == L_('+') || *p == L_('@')
- || *p == L_('!')) && p[1] == L_('('))
- p = END (p + 1);
- else if (*p == L_(')'))
- break;
-
- return p + 1;
-}
-
-
-static int
-internal_function
-EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
- bool no_leading_period, int flags)
-{
- const CHAR *startp;
- size_t level;
- struct patternlist
- {
- struct patternlist *next;
- CHAR str[1];
- } *list = NULL;
- struct patternlist **lastp = &list;
- size_t pattern_len = STRLEN (pattern);
- const CHAR *p;
- const CHAR *rs;
- enum { ALLOCA_LIMIT = 8000 };
-
- /* Parse the pattern. Store the individual parts in the list. */
- level = 0;
- for (startp = p = pattern + 1; ; ++p)
- if (*p == L_('\0'))
- /* This is an invalid pattern. */
- return -1;
- else if (*p == L_('['))
- {
- /* Handle brackets special. */
- if (posixly_correct == 0)
- posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1;
-
- /* Skip the not sign. We have to recognize it because of a possibly
- following ']'. */
- if (*++p == L_('!') || (posixly_correct < 0 && *p == L_('^')))
- ++p;
- /* A leading ']' is recognized as such. */
- if (*p == L_(']'))
- ++p;
- /* Skip over all characters of the list. */
- while (*p != L_(']'))
- if (*p++ == L_('\0'))
- /* This is no valid pattern. */
- return -1;
- }
- else if ((*p == L_('?') || *p == L_('*') || *p == L_('+') || *p == L_('@')
- || *p == L_('!')) && p[1] == L_('('))
- /* Remember the nesting level. */
- ++level;
- else if (*p == L_(')'))
- {
- if (level-- == 0)
- {
- /* This means we found the end of the pattern. */
-#define NEW_PATTERN \
- struct patternlist *newp; \
- size_t plen; \
- size_t plensize; \
- size_t newpsize; \
- \
- plen = (opt == L_('?') || opt == L_('@') \
- ? pattern_len \
- : p - startp + 1); \
- plensize = plen * sizeof (CHAR); \
- newpsize = offsetof (struct patternlist, str) + plensize; \
- if ((size_t) -1 / sizeof (CHAR) < plen \
- || newpsize < offsetof (struct patternlist, str) \
- || ALLOCA_LIMIT <= newpsize) \
- return -1; \
- newp = (struct patternlist *) alloca (newpsize); \
- *((CHAR *) MEMPCPY (newp->str, startp, p - startp)) = L_('\0'); \
- newp->next = NULL; \
- *lastp = newp; \
- lastp = &newp->next
- NEW_PATTERN;
- break;
- }
- }
- else if (*p == L_('|'))
- {
- if (level == 0)
- {
- NEW_PATTERN;
- startp = p + 1;
- }
- }
- assert (list != NULL);
- assert (p[-1] == L_(')'));
-#undef NEW_PATTERN
-
- switch (opt)
- {
- case L_('*'):
- if (FCT (p, string, string_end, no_leading_period, flags) == 0)
- return 0;
- /* FALLTHROUGH */
-
- case L_('+'):
- do
- {
- for (rs = string; rs <= string_end; ++rs)
- /* First match the prefix with the current pattern with the
- current pattern. */
- if (FCT (list->str, string, rs, no_leading_period,
- flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD) == 0
- /* This was successful. Now match the rest with the rest
- of the pattern. */
- && (FCT (p, rs, string_end,
- rs == string
- ? no_leading_period
- : rs[-1] == '/' && NO_LEADING_PERIOD (flags),
- flags & FNM_FILE_NAME
- ? flags : flags & ~FNM_PERIOD) == 0
- /* This didn't work. Try the whole pattern. */
- || (rs != string
- && FCT (pattern - 1, rs, string_end,
- rs == string
- ? no_leading_period
- : rs[-1] == '/' && NO_LEADING_PERIOD (flags),
- flags & FNM_FILE_NAME
- ? flags : flags & ~FNM_PERIOD) == 0)))
- /* It worked. Signal success. */
- return 0;
- }
- while ((list = list->next) != NULL);
-
- /* None of the patterns lead to a match. */
- return FNM_NOMATCH;
-
- case L_('?'):
- if (FCT (p, string, string_end, no_leading_period, flags) == 0)
- return 0;
- /* FALLTHROUGH */
-
- case L_('@'):
- do
- /* I cannot believe it but `strcat' is actually acceptable
- here. Match the entire string with the prefix from the
- pattern list and the rest of the pattern following the
- pattern list. */
- if (FCT (STRCAT (list->str, p), string, string_end,
- no_leading_period,
- flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD) == 0)
- /* It worked. Signal success. */
- return 0;
- while ((list = list->next) != NULL);
-
- /* None of the patterns lead to a match. */
- return FNM_NOMATCH;
-
- case L_('!'):
- for (rs = string; rs <= string_end; ++rs)
- {
- struct patternlist *runp;
-
- for (runp = list; runp != NULL; runp = runp->next)
- if (FCT (runp->str, string, rs, no_leading_period,
- flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD) == 0)
- break;
-
- /* If none of the patterns matched see whether the rest does. */
- if (runp == NULL
- && (FCT (p, rs, string_end,
- rs == string
- ? no_leading_period
- : rs[-1] == '/' && NO_LEADING_PERIOD (flags),
- flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD)
- == 0))
- /* This is successful. */
- return 0;
- }
-
- /* None of the patterns together with the rest of the pattern
- lead to a match. */
- return FNM_NOMATCH;
-
- default:
- assert (! "Invalid extended matching operator");
- break;
- }
-
- return -1;
-}
-
-
-#undef FOLD
-#undef CHAR
-#undef UCHAR
-#undef INT
-#undef FCT
-#undef EXT
-#undef END
-#undef MEMPCPY
-#undef MEMCHR
-#undef STRCOLL
-#undef STRLEN
-#undef STRCAT
-#undef L_
-#undef BTOWC
+++ /dev/null
-/* An interface to read and write that retries (if necessary) until complete.
-
- Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#ifdef FULL_READ
-# include "full-read.h"
-#else
-# include "full-write.h"
-#endif
-
-#include <errno.h>
-
-#ifdef FULL_READ
-# include "safe-read.h"
-# define safe_rw safe_read
-# define full_rw full_read
-# undef const
-# define const /* empty */
-#else
-# include "safe-write.h"
-# define safe_rw safe_write
-# define full_rw full_write
-#endif
-
-#ifdef FULL_READ
-/* Set errno to zero upon EOF. */
-# define ZERO_BYTE_TRANSFER_ERRNO 0
-#else
-/* Some buggy drivers return 0 when one tries to write beyond
- a device's end. (Example: Linux 1.2.13 on /dev/fd0.)
- Set errno to ENOSPC so they get a sensible diagnostic. */
-# define ZERO_BYTE_TRANSFER_ERRNO ENOSPC
-#endif
-
-/* Write(read) COUNT bytes at BUF to(from) descriptor FD, retrying if
- interrupted or if a partial write(read) occurs. Return the number
- of bytes transferred.
- When writing, set errno if fewer than COUNT bytes are written.
- When reading, if fewer than COUNT bytes are read, you must examine
- errno to distinguish failure from EOF (errno == 0). */
-size_t
-full_rw (int fd, const void *buf, size_t count)
-{
- size_t total = 0;
- const char *ptr = buf;
-
- while (count > 0)
- {
- size_t n_rw = safe_rw (fd, ptr, count);
- if (n_rw == (size_t) -1)
- break;
- if (n_rw == 0)
- {
- errno = ZERO_BYTE_TRANSFER_ERRNO;
- break;
- }
- total += n_rw;
- ptr += n_rw;
- count -= n_rw;
- }
-
- return total;
-}
+++ /dev/null
-/* An interface to write() that writes all it is asked to write.
-
- Copyright (C) 2002-2003 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#include <stddef.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Write COUNT bytes at BUF to descriptor FD, retrying if interrupted
- or if partial writes occur. Return the number of bytes successfully
- written, setting errno if that is less than COUNT. */
-extern size_t full_write (int fd, const void *buf, size_t count);
-
-
-#ifdef __cplusplus
-}
-#endif
+++ /dev/null
-/* Detect write error on a stream.
- Copyright (C) 2003-2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "fwriteerror.h"
-
-#include <errno.h>
-#include <stdbool.h>
-
-int
-fwriteerror (FILE *fp)
-{
- /* State to allow multiple calls to fwriteerror (stdout). */
- static bool stdout_closed = false;
-
- if (fp == stdout && stdout_closed)
- return 0;
-
- /* Need to
- 1. test the error indicator of the stream,
- 2. flush the buffers both in userland and in the kernel, through fclose,
- testing for error again. */
-
- /* Clear errno, so that on non-POSIX systems the caller doesn't see a
- wrong value of errno when we return -1. */
- errno = 0;
-
- if (ferror (fp))
- {
- if (fflush (fp))
- goto close_preserving_errno; /* errno is set here */
- /* The stream had an error earlier, but its errno was lost. If the
- error was not temporary, we can get the same errno by writing and
- flushing one more byte. We can do so because at this point the
- stream's contents is garbage anyway. */
- if (fputc ('\0', fp) == EOF)
- goto close_preserving_errno; /* errno is set here */
- if (fflush (fp))
- goto close_preserving_errno; /* errno is set here */
- /* Give up on errno. */
- errno = 0;
- close_preserving_errno:
- /* There's an error. Nevertheless call fclose(fp), for consistency
- with the other cases. */
- {
- int saved_errno = errno;
- fclose (fp);
- errno = saved_errno;
- return -1;
- }
- }
-
- /* If we are closing stdout, don't attempt to do it later again. */
- if (fp == stdout)
- stdout_closed = true;
-
- if (fclose (fp))
- return -1; /* errno is set here */
-
- return 0;
-}
-
-
-#if TEST
-
-/* Name of a file on which writing fails. On systems without /dev/full,
- you can choose a filename on a full filesystem. */
-#define UNWRITABLE_FILE "/dev/full"
-
-int
-main ()
-{
- static int sizes[] =
- {
- 511, 512, 513,
- 1023, 1024, 1025,
- 2047, 2048, 2049,
- 4095, 4096, 4097,
- 8191, 8192, 8193
- };
- static char dummy[8193];
- unsigned int i, j;
-
- for (i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++)
- {
- size_t size = sizes[i];
-
- for (j = 0; j < 2; j++)
- {
- /* Run a test depending on i and j:
- Write size bytes and then calls fflush if j==1. */
- FILE *stream = fopen (UNWRITABLE_FILE, "w");
-
- if (stream == NULL)
- {
- fprintf (stderr, "Test %u:%u: could not open file\n", i, j);
- continue;
- }
-
- fwrite (dummy, 347, 1, stream);
- fwrite (dummy, size - 347, 1, stream);
- if (j)
- fflush (stream);
-
- if (fwriteerror (stream) == -1)
- {
- if (errno != ENOSPC)
- fprintf (stderr, "Test %u:%u: fwriteerror ok, errno = %d\n",
- i, j, errno);
- }
- else
- fprintf (stderr, "Test %u:%u: fwriteerror found no error!\n",
- i, j);
- }
- }
-
- return 0;
-}
-
-#endif
+++ /dev/null
-/* Detect write error on a stream.
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* There are two approaches for detecting a write error on a stream opened
- for writing:
-
- (a) Test the return value of every fwrite() or fprintf() call, and react
- immediately.
- (b) Just before fclose(), test the error indicator in the stream and
- the return value of the final fclose() call.
-
- The benefit of (a) is that non file related errors (such that ENOMEM during
- fprintf) and temporary error conditions can be diagnosed accurately.
-
- A theoretical benefit of (a) is also that, on POSIX systems, in the case of
- an ENOSPC error, errno is set and can be used by error() to provide a more
- accurate error message. But in practice, this benefit is not big because
- users can easily figure out by themselves why a file cannot be written to,
- and furthermore the function fwriteerror() can provide errno as well.
-
- The big drawback of (a) is extensive error checking code: Every function
- which does stream output must return an error indicator.
-
- This file provides support for (b). */
-
-#include <stdio.h>
-
-/* Write out the not yet written buffered contents of the stream FP, close
- the stream FP, and test whether some error occurred on the stream FP.
- FP must be a stream opened for writing.
- Return 0 if no error occurred and fclose (fp) succeeded.
- Return -1 and set errno if there was an error. The errno value will be 0
- if the cause of the error cannot be determined.
- For any given stream FP other than stdout, fwriteerror (FP) may only be
- called once. */
-extern int fwriteerror (FILE *fp);
+++ /dev/null
-/* Arithmetic.
- Copyright (C) 2001-2002, 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* This file can also be used to define gcd functions for other unsigned
- types, such as 'unsigned long long' or 'uintmax_t'. */
-#ifndef WORD_T
-/* Specification. */
-# include "gcd.h"
-# define WORD_T unsigned long
-# define GCD gcd
-#endif
-
-#include <stdlib.h>
-
-/* Return the greatest common divisor of a > 0 and b > 0. */
-WORD_T
-GCD (WORD_T a, WORD_T b)
-{
- /* Why no division, as in Euclid's algorithm? Because in Euclid's algorithm
- the division result floor(a/b) or floor(b/a) is very often = 1 or = 2,
- and nearly always < 8. A sequence of a few subtractions and tests is
- faster than a division. */
- /* Why not Euclid's algorithm? Because the two integers can be shifted by 1
- bit in a single instruction, and the algorithm uses fewer variables than
- Euclid's algorithm. */
-
- WORD_T c = a | b;
- c = c ^ (c - 1);
- /* c = largest power of 2 that divides a and b. */
-
- if (a & c)
- {
- if (b & c)
- goto odd_odd;
- else
- goto odd_even;
- }
- else
- {
- if (b & c)
- goto even_odd;
- else
- abort ();
- }
-
- for (;;)
- {
- odd_odd: /* a/c and b/c both odd */
- if (a == b)
- break;
- if (a > b)
- {
- a = a - b;
- even_odd: /* a/c even, b/c odd */
- do
- a = a >> 1;
- while ((a & c) == 0);
- }
- else
- {
- b = b - a;
- odd_even: /* a/c odd, b/c even */
- do
- b = b >> 1;
- while ((b & c) == 0);
- }
- }
-
- /* a = b */
- return a;
-}
+++ /dev/null
-/* Arithmetic.
- Copyright (C) 2001-2002 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _GCD_H
-#define _GCD_H
-
-/* Return the greatest common divisor of a > 0 and b > 0. */
-extern unsigned long gcd (unsigned long a, unsigned long b);
-
-#endif /* _GCD_H */
+++ /dev/null
-/* Getopt for GNU.
- NOTE: getopt is now part of the C library, so if you don't know what
- "Keep this file name-space clean" means, talk to drepper@gnu.org
- before changing it!
- Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006
- Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-\f
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "getopt.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#ifdef __VMS
-# include <unixlib.h>
-#endif
-
-#ifdef _LIBC
-# include <libintl.h>
-#else
-# include "gettext.h"
-# define _(msgid) gettext (msgid)
-#endif
-
-#if defined _LIBC && defined USE_IN_LIBIO
-# include <wchar.h>
-#endif
-
-#ifndef attribute_hidden
-# define attribute_hidden
-#endif
-
-/* Unlike standard Unix `getopt', functions like `getopt_long'
- let the user intersperse the options with the other arguments.
-
- As `getopt_long' works, it permutes the elements of ARGV so that,
- when it is done, all the options precede everything else. Thus
- all application programs are extended to handle flexible argument order.
-
- Using `getopt' or setting the environment variable POSIXLY_CORRECT
- disables permutation.
- Then the application's behavior is completely standard.
-
- GNU application programs can use a third alternative mode in which
- they can distinguish the relative order of options and other arguments. */
-
-#include "getopt_int.h"
-
-/* For communication from `getopt' to the caller.
- When `getopt' finds an option that takes an argument,
- the argument value is returned here.
- Also, when `ordering' is RETURN_IN_ORDER,
- each non-option ARGV-element is returned here. */
-
-char *optarg;
-
-/* Index in ARGV of the next element to be scanned.
- This is used for communication to and from the caller
- and for communication between successive calls to `getopt'.
-
- On entry to `getopt', zero means this is the first call; initialize.
-
- When `getopt' returns -1, this is the index of the first of the
- non-option elements that the caller should itself scan.
-
- Otherwise, `optind' communicates from one call to the next
- how much of ARGV has been scanned so far. */
-
-/* 1003.2 says this must be 1 before any call. */
-int optind = 1;
-
-/* Callers store zero here to inhibit the error message
- for unrecognized options. */
-
-int opterr = 1;
-
-/* Set to an option character which was unrecognized.
- This must be initialized on some systems to avoid linking in the
- system's own getopt implementation. */
-
-int optopt = '?';
-
-/* Keep a global copy of all internal members of getopt_data. */
-
-static struct _getopt_data getopt_data;
-
-\f
-#if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV
-extern char *getenv ();
-#endif
-\f
-#ifdef _LIBC
-/* Stored original parameters.
- XXX This is no good solution. We should rather copy the args so
- that we can compare them later. But we must not use malloc(3). */
-extern int __libc_argc;
-extern char **__libc_argv;
-
-/* Bash 2.0 gives us an environment variable containing flags
- indicating ARGV elements that should not be considered arguments. */
-
-# ifdef USE_NONOPTION_FLAGS
-/* Defined in getopt_init.c */
-extern char *__getopt_nonoption_flags;
-# endif
-
-# ifdef USE_NONOPTION_FLAGS
-# define SWAP_FLAGS(ch1, ch2) \
- if (d->__nonoption_flags_len > 0) \
- { \
- char __tmp = __getopt_nonoption_flags[ch1]; \
- __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
- __getopt_nonoption_flags[ch2] = __tmp; \
- }
-# else
-# define SWAP_FLAGS(ch1, ch2)
-# endif
-#else /* !_LIBC */
-# define SWAP_FLAGS(ch1, ch2)
-#endif /* _LIBC */
-
-/* Exchange two adjacent subsequences of ARGV.
- One subsequence is elements [first_nonopt,last_nonopt)
- which contains all the non-options that have been skipped so far.
- The other is elements [last_nonopt,optind), which contains all
- the options processed since those non-options were skipped.
-
- `first_nonopt' and `last_nonopt' are relocated so that they describe
- the new indices of the non-options in ARGV after they are moved. */
-
-static void
-exchange (char **argv, struct _getopt_data *d)
-{
- int bottom = d->__first_nonopt;
- int middle = d->__last_nonopt;
- int top = d->optind;
- char *tem;
-
- /* Exchange the shorter segment with the far end of the longer segment.
- That puts the shorter segment into the right place.
- It leaves the longer segment in the right place overall,
- but it consists of two parts that need to be swapped next. */
-
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
- /* First make sure the handling of the `__getopt_nonoption_flags'
- string can work normally. Our top argument must be in the range
- of the string. */
- if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len)
- {
- /* We must extend the array. The user plays games with us and
- presents new arguments. */
- char *new_str = malloc (top + 1);
- if (new_str == NULL)
- d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0;
- else
- {
- memset (__mempcpy (new_str, __getopt_nonoption_flags,
- d->__nonoption_flags_max_len),
- '\0', top + 1 - d->__nonoption_flags_max_len);
- d->__nonoption_flags_max_len = top + 1;
- __getopt_nonoption_flags = new_str;
- }
- }
-#endif
-
- while (top > middle && middle > bottom)
- {
- if (top - middle > middle - bottom)
- {
- /* Bottom segment is the short one. */
- int len = middle - bottom;
- register int i;
-
- /* Swap it with the top part of the top segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[top - (middle - bottom) + i];
- argv[top - (middle - bottom) + i] = tem;
- SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
- }
- /* Exclude the moved bottom segment from further swapping. */
- top -= len;
- }
- else
- {
- /* Top segment is the short one. */
- int len = top - middle;
- register int i;
-
- /* Swap it with the bottom part of the bottom segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[middle + i];
- argv[middle + i] = tem;
- SWAP_FLAGS (bottom + i, middle + i);
- }
- /* Exclude the moved top segment from further swapping. */
- bottom += len;
- }
- }
-
- /* Update records for the slots the non-options now occupy. */
-
- d->__first_nonopt += (d->optind - d->__last_nonopt);
- d->__last_nonopt = d->optind;
-}
-
-/* Initialize the internal data when the first call is made. */
-
-static const char *
-_getopt_initialize (int argc, char **argv, const char *optstring,
- int posixly_correct, struct _getopt_data *d)
-{
- /* Start processing options with ARGV-element 1 (since ARGV-element 0
- is the program name); the sequence of previously skipped
- non-option ARGV-elements is empty. */
-
- d->__first_nonopt = d->__last_nonopt = d->optind;
-
- d->__nextchar = NULL;
-
- d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT");
-
- /* Determine how to handle the ordering of options and nonoptions. */
-
- if (optstring[0] == '-')
- {
- d->__ordering = RETURN_IN_ORDER;
- ++optstring;
- }
- else if (optstring[0] == '+')
- {
- d->__ordering = REQUIRE_ORDER;
- ++optstring;
- }
- else if (d->__posixly_correct)
- d->__ordering = REQUIRE_ORDER;
- else
- d->__ordering = PERMUTE;
-
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
- if (!d->__posixly_correct
- && argc == __libc_argc && argv == __libc_argv)
- {
- if (d->__nonoption_flags_max_len == 0)
- {
- if (__getopt_nonoption_flags == NULL
- || __getopt_nonoption_flags[0] == '\0')
- d->__nonoption_flags_max_len = -1;
- else
- {
- const char *orig_str = __getopt_nonoption_flags;
- int len = d->__nonoption_flags_max_len = strlen (orig_str);
- if (d->__nonoption_flags_max_len < argc)
- d->__nonoption_flags_max_len = argc;
- __getopt_nonoption_flags =
- (char *) malloc (d->__nonoption_flags_max_len);
- if (__getopt_nonoption_flags == NULL)
- d->__nonoption_flags_max_len = -1;
- else
- memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
- '\0', d->__nonoption_flags_max_len - len);
- }
- }
- d->__nonoption_flags_len = d->__nonoption_flags_max_len;
- }
- else
- d->__nonoption_flags_len = 0;
-#endif
-
- return optstring;
-}
-\f
-/* Scan elements of ARGV (whose length is ARGC) for option characters
- given in OPTSTRING.
-
- If an element of ARGV starts with '-', and is not exactly "-" or "--",
- then it is an option element. The characters of this element
- (aside from the initial '-') are option characters. If `getopt'
- is called repeatedly, it returns successively each of the option characters
- from each of the option elements.
-
- If `getopt' finds another option character, it returns that character,
- updating `optind' and `nextchar' so that the next call to `getopt' can
- resume the scan with the following option character or ARGV-element.
-
- If there are no more option characters, `getopt' returns -1.
- Then `optind' is the index in ARGV of the first ARGV-element
- that is not an option. (The ARGV-elements have been permuted
- so that those that are not options now come last.)
-
- OPTSTRING is a string containing the legitimate option characters.
- If an option character is seen that is not listed in OPTSTRING,
- return '?' after printing an error message. If you set `opterr' to
- zero, the error message is suppressed but we still return '?'.
-
- If a char in OPTSTRING is followed by a colon, that means it wants an arg,
- so the following text in the same ARGV-element, or the text of the following
- ARGV-element, is returned in `optarg'. Two colons mean an option that
- wants an optional arg; if there is text in the current ARGV-element,
- it is returned in `optarg', otherwise `optarg' is set to zero.
-
- If OPTSTRING starts with `-' or `+', it requests different methods of
- handling the non-option ARGV-elements.
- See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
-
- Long-named options begin with `--' instead of `-'.
- Their names may be abbreviated as long as the abbreviation is unique
- or is an exact match for some defined option. If they have an
- argument, it follows the option name in the same ARGV-element, separated
- from the option name by a `=', or else the in next ARGV-element.
- When `getopt' finds a long-named option, it returns 0 if that option's
- `flag' field is nonzero, the value of the option's `val' field
- if the `flag' field is zero.
-
- LONGOPTS is a vector of `struct option' terminated by an
- element containing a name which is zero.
-
- LONGIND returns the index in LONGOPT of the long-named option found.
- It is only valid when a long-named option has been found by the most
- recent call.
-
- If LONG_ONLY is nonzero, '-' as well as '--' can introduce
- long-named options.
-
- If POSIXLY_CORRECT is nonzero, behave as if the POSIXLY_CORRECT
- environment variable were set. */
-
-int
-_getopt_internal_r (int argc, char **argv, const char *optstring,
- const struct option *longopts, int *longind,
- int long_only, int posixly_correct, struct _getopt_data *d)
-{
- int print_errors = d->opterr;
- if (optstring[0] == ':')
- print_errors = 0;
-
- if (argc < 1)
- return -1;
-
- d->optarg = NULL;
-
- if (d->optind == 0 || !d->__initialized)
- {
- if (d->optind == 0)
- d->optind = 1; /* Don't scan ARGV[0], the program name. */
- optstring = _getopt_initialize (argc, argv, optstring,
- posixly_correct, d);
- d->__initialized = 1;
- }
-
- /* Test whether ARGV[optind] points to a non-option argument.
- Either it does not have option syntax, or there is an environment flag
- from the shell indicating it is not an option. The later information
- is only used when the used in the GNU libc. */
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
-# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \
- || (d->optind < d->__nonoption_flags_len \
- && __getopt_nonoption_flags[d->optind] == '1'))
-#else
-# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0')
-#endif
-
- if (d->__nextchar == NULL || *d->__nextchar == '\0')
- {
- /* Advance to the next ARGV-element. */
-
- /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
- moved back by the user (who may also have changed the arguments). */
- if (d->__last_nonopt > d->optind)
- d->__last_nonopt = d->optind;
- if (d->__first_nonopt > d->optind)
- d->__first_nonopt = d->optind;
-
- if (d->__ordering == PERMUTE)
- {
- /* If we have just processed some options following some non-options,
- exchange them so that the options come first. */
-
- if (d->__first_nonopt != d->__last_nonopt
- && d->__last_nonopt != d->optind)
- exchange ((char **) argv, d);
- else if (d->__last_nonopt != d->optind)
- d->__first_nonopt = d->optind;
-
- /* Skip any additional non-options
- and extend the range of non-options previously skipped. */
-
- while (d->optind < argc && NONOPTION_P)
- d->optind++;
- d->__last_nonopt = d->optind;
- }
-
- /* The special ARGV-element `--' means premature end of options.
- Skip it like a null option,
- then exchange with previous non-options as if it were an option,
- then skip everything else like a non-option. */
-
- if (d->optind != argc && !strcmp (argv[d->optind], "--"))
- {
- d->optind++;
-
- if (d->__first_nonopt != d->__last_nonopt
- && d->__last_nonopt != d->optind)
- exchange ((char **) argv, d);
- else if (d->__first_nonopt == d->__last_nonopt)
- d->__first_nonopt = d->optind;
- d->__last_nonopt = argc;
-
- d->optind = argc;
- }
-
- /* If we have done all the ARGV-elements, stop the scan
- and back over any non-options that we skipped and permuted. */
-
- if (d->optind == argc)
- {
- /* Set the next-arg-index to point at the non-options
- that we previously skipped, so the caller will digest them. */
- if (d->__first_nonopt != d->__last_nonopt)
- d->optind = d->__first_nonopt;
- return -1;
- }
-
- /* If we have come to a non-option and did not permute it,
- either stop the scan or describe it to the caller and pass it by. */
-
- if (NONOPTION_P)
- {
- if (d->__ordering == REQUIRE_ORDER)
- return -1;
- d->optarg = argv[d->optind++];
- return 1;
- }
-
- /* We have found another option-ARGV-element.
- Skip the initial punctuation. */
-
- d->__nextchar = (argv[d->optind] + 1
- + (longopts != NULL && argv[d->optind][1] == '-'));
- }
-
- /* Decode the current option-ARGV-element. */
-
- /* Check whether the ARGV-element is a long option.
-
- If long_only and the ARGV-element has the form "-f", where f is
- a valid short option, don't consider it an abbreviated form of
- a long option that starts with f. Otherwise there would be no
- way to give the -f short option.
-
- On the other hand, if there's a long option "fubar" and
- the ARGV-element is "-fu", do consider that an abbreviation of
- the long option, just like "--fu", and not "-f" with arg "u".
-
- This distinction seems to be the most useful approach. */
-
- if (longopts != NULL
- && (argv[d->optind][1] == '-'
- || (long_only && (argv[d->optind][2]
- || !strchr (optstring, argv[d->optind][1])))))
- {
- char *nameend;
- const struct option *p;
- const struct option *pfound = NULL;
- int exact = 0;
- int ambig = 0;
- int indfound = -1;
- int option_index;
-
- for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++)
- /* Do nothing. */ ;
-
- /* Test all long options for either exact match
- or abbreviated matches. */
- for (p = longopts, option_index = 0; p->name; p++, option_index++)
- if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar))
- {
- if ((unsigned int) (nameend - d->__nextchar)
- == (unsigned int) strlen (p->name))
- {
- /* Exact match found. */
- pfound = p;
- indfound = option_index;
- exact = 1;
- break;
- }
- else if (pfound == NULL)
- {
- /* First nonexact match found. */
- pfound = p;
- indfound = option_index;
- }
- else if (long_only
- || pfound->has_arg != p->has_arg
- || pfound->flag != p->flag
- || pfound->val != p->val)
- /* Second or later nonexact match found. */
- ambig = 1;
- }
-
- if (ambig && !exact)
- {
- if (print_errors)
- {
-#if defined _LIBC && defined USE_IN_LIBIO
- char *buf;
-
- if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"),
- argv[0], argv[d->optind]) >= 0)
- {
- _IO_flockfile (stderr);
-
- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
-
- __fxprintf (NULL, "%s", buf);
-
- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
- _IO_funlockfile (stderr);
-
- free (buf);
- }
-#else
- fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
- argv[0], argv[d->optind]);
-#endif
- }
- d->__nextchar += strlen (d->__nextchar);
- d->optind++;
- d->optopt = 0;
- return '?';
- }
-
- if (pfound != NULL)
- {
- option_index = indfound;
- d->optind++;
- if (*nameend)
- {
- /* Don't test has_arg with >, because some C compilers don't
- allow it to be used on enums. */
- if (pfound->has_arg)
- d->optarg = nameend + 1;
- else
- {
- if (print_errors)
- {
-#if defined _LIBC && defined USE_IN_LIBIO
- char *buf;
- int n;
-#endif
-
- if (argv[d->optind - 1][1] == '-')
- {
- /* --option */
-#if defined _LIBC && defined USE_IN_LIBIO
- n = __asprintf (&buf, _("\
-%s: option `--%s' doesn't allow an argument\n"),
- argv[0], pfound->name);
-#else
- fprintf (stderr, _("\
-%s: option `--%s' doesn't allow an argument\n"),
- argv[0], pfound->name);
-#endif
- }
- else
- {
- /* +option or -option */
-#if defined _LIBC && defined USE_IN_LIBIO
- n = __asprintf (&buf, _("\
-%s: option `%c%s' doesn't allow an argument\n"),
- argv[0], argv[d->optind - 1][0],
- pfound->name);
-#else
- fprintf (stderr, _("\
-%s: option `%c%s' doesn't allow an argument\n"),
- argv[0], argv[d->optind - 1][0],
- pfound->name);
-#endif
- }
-
-#if defined _LIBC && defined USE_IN_LIBIO
- if (n >= 0)
- {
- _IO_flockfile (stderr);
-
- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
- ((_IO_FILE *) stderr)->_flags2
- |= _IO_FLAGS2_NOTCANCEL;
-
- __fxprintf (NULL, "%s", buf);
-
- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
- _IO_funlockfile (stderr);
-
- free (buf);
- }
-#endif
- }
-
- d->__nextchar += strlen (d->__nextchar);
-
- d->optopt = pfound->val;
- return '?';
- }
- }
- else if (pfound->has_arg == 1)
- {
- if (d->optind < argc)
- d->optarg = argv[d->optind++];
- else
- {
- if (print_errors)
- {
-#if defined _LIBC && defined USE_IN_LIBIO
- char *buf;
-
- if (__asprintf (&buf, _("\
-%s: option `%s' requires an argument\n"),
- argv[0], argv[d->optind - 1]) >= 0)
- {
- _IO_flockfile (stderr);
-
- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
- ((_IO_FILE *) stderr)->_flags2
- |= _IO_FLAGS2_NOTCANCEL;
-
- __fxprintf (NULL, "%s", buf);
-
- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
- _IO_funlockfile (stderr);
-
- free (buf);
- }
-#else
- fprintf (stderr,
- _("%s: option `%s' requires an argument\n"),
- argv[0], argv[d->optind - 1]);
-#endif
- }
- d->__nextchar += strlen (d->__nextchar);
- d->optopt = pfound->val;
- return optstring[0] == ':' ? ':' : '?';
- }
- }
- d->__nextchar += strlen (d->__nextchar);
- if (longind != NULL)
- *longind = option_index;
- if (pfound->flag)
- {
- *(pfound->flag) = pfound->val;
- return 0;
- }
- return pfound->val;
- }
-
- /* Can't find it as a long option. If this is not getopt_long_only,
- or the option starts with '--' or is not a valid short
- option, then it's an error.
- Otherwise interpret it as a short option. */
- if (!long_only || argv[d->optind][1] == '-'
- || strchr (optstring, *d->__nextchar) == NULL)
- {
- if (print_errors)
- {
-#if defined _LIBC && defined USE_IN_LIBIO
- char *buf;
- int n;
-#endif
-
- if (argv[d->optind][1] == '-')
- {
- /* --option */
-#if defined _LIBC && defined USE_IN_LIBIO
- n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"),
- argv[0], d->__nextchar);
-#else
- fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
- argv[0], d->__nextchar);
-#endif
- }
- else
- {
- /* +option or -option */
-#if defined _LIBC && defined USE_IN_LIBIO
- n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"),
- argv[0], argv[d->optind][0], d->__nextchar);
-#else
- fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
- argv[0], argv[d->optind][0], d->__nextchar);
-#endif
- }
-
-#if defined _LIBC && defined USE_IN_LIBIO
- if (n >= 0)
- {
- _IO_flockfile (stderr);
-
- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
-
- __fxprintf (NULL, "%s", buf);
-
- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
- _IO_funlockfile (stderr);
-
- free (buf);
- }
-#endif
- }
- d->__nextchar = (char *) "";
- d->optind++;
- d->optopt = 0;
- return '?';
- }
- }
-
- /* Look at and handle the next short option-character. */
-
- {
- char c = *d->__nextchar++;
- char *temp = strchr (optstring, c);
-
- /* Increment `optind' when we start to process its last character. */
- if (*d->__nextchar == '\0')
- ++d->optind;
-
- if (temp == NULL || c == ':')
- {
- if (print_errors)
- {
-#if defined _LIBC && defined USE_IN_LIBIO
- char *buf;
- int n;
-#endif
-
- if (d->__posixly_correct)
- {
- /* 1003.2 specifies the format of this message. */
-#if defined _LIBC && defined USE_IN_LIBIO
- n = __asprintf (&buf, _("%s: illegal option -- %c\n"),
- argv[0], c);
-#else
- fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
-#endif
- }
- else
- {
-#if defined _LIBC && defined USE_IN_LIBIO
- n = __asprintf (&buf, _("%s: invalid option -- %c\n"),
- argv[0], c);
-#else
- fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
-#endif
- }
-
-#if defined _LIBC && defined USE_IN_LIBIO
- if (n >= 0)
- {
- _IO_flockfile (stderr);
-
- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
-
- __fxprintf (NULL, "%s", buf);
-
- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
- _IO_funlockfile (stderr);
-
- free (buf);
- }
-#endif
- }
- d->optopt = c;
- return '?';
- }
- /* Convenience. Treat POSIX -W foo same as long option --foo */
- if (temp[0] == 'W' && temp[1] == ';')
- {
- char *nameend;
- const struct option *p;
- const struct option *pfound = NULL;
- int exact = 0;
- int ambig = 0;
- int indfound = 0;
- int option_index;
-
- /* This is an option that requires an argument. */
- if (*d->__nextchar != '\0')
- {
- d->optarg = d->__nextchar;
- /* If we end this ARGV-element by taking the rest as an arg,
- we must advance to the next element now. */
- d->optind++;
- }
- else if (d->optind == argc)
- {
- if (print_errors)
- {
- /* 1003.2 specifies the format of this message. */
-#if defined _LIBC && defined USE_IN_LIBIO
- char *buf;
-
- if (__asprintf (&buf,
- _("%s: option requires an argument -- %c\n"),
- argv[0], c) >= 0)
- {
- _IO_flockfile (stderr);
-
- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
-
- __fxprintf (NULL, "%s", buf);
-
- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
- _IO_funlockfile (stderr);
-
- free (buf);
- }
-#else
- fprintf (stderr, _("%s: option requires an argument -- %c\n"),
- argv[0], c);
-#endif
- }
- d->optopt = c;
- if (optstring[0] == ':')
- c = ':';
- else
- c = '?';
- return c;
- }
- else
- /* We already incremented `d->optind' once;
- increment it again when taking next ARGV-elt as argument. */
- d->optarg = argv[d->optind++];
-
- /* optarg is now the argument, see if it's in the
- table of longopts. */
-
- for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '=';
- nameend++)
- /* Do nothing. */ ;
-
- /* Test all long options for either exact match
- or abbreviated matches. */
- for (p = longopts, option_index = 0; p->name; p++, option_index++)
- if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar))
- {
- if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name))
- {
- /* Exact match found. */
- pfound = p;
- indfound = option_index;
- exact = 1;
- break;
- }
- else if (pfound == NULL)
- {
- /* First nonexact match found. */
- pfound = p;
- indfound = option_index;
- }
- else
- /* Second or later nonexact match found. */
- ambig = 1;
- }
- if (ambig && !exact)
- {
- if (print_errors)
- {
-#if defined _LIBC && defined USE_IN_LIBIO
- char *buf;
-
- if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"),
- argv[0], argv[d->optind]) >= 0)
- {
- _IO_flockfile (stderr);
-
- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
-
- __fxprintf (NULL, "%s", buf);
-
- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
- _IO_funlockfile (stderr);
-
- free (buf);
- }
-#else
- fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
- argv[0], argv[d->optind]);
-#endif
- }
- d->__nextchar += strlen (d->__nextchar);
- d->optind++;
- return '?';
- }
- if (pfound != NULL)
- {
- option_index = indfound;
- if (*nameend)
- {
- /* Don't test has_arg with >, because some C compilers don't
- allow it to be used on enums. */
- if (pfound->has_arg)
- d->optarg = nameend + 1;
- else
- {
- if (print_errors)
- {
-#if defined _LIBC && defined USE_IN_LIBIO
- char *buf;
-
- if (__asprintf (&buf, _("\
-%s: option `-W %s' doesn't allow an argument\n"),
- argv[0], pfound->name) >= 0)
- {
- _IO_flockfile (stderr);
-
- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
- ((_IO_FILE *) stderr)->_flags2
- |= _IO_FLAGS2_NOTCANCEL;
-
- __fxprintf (NULL, "%s", buf);
-
- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
- _IO_funlockfile (stderr);
-
- free (buf);
- }
-#else
- fprintf (stderr, _("\
-%s: option `-W %s' doesn't allow an argument\n"),
- argv[0], pfound->name);
-#endif
- }
-
- d->__nextchar += strlen (d->__nextchar);
- return '?';
- }
- }
- else if (pfound->has_arg == 1)
- {
- if (d->optind < argc)
- d->optarg = argv[d->optind++];
- else
- {
- if (print_errors)
- {
-#if defined _LIBC && defined USE_IN_LIBIO
- char *buf;
-
- if (__asprintf (&buf, _("\
-%s: option `%s' requires an argument\n"),
- argv[0], argv[d->optind - 1]) >= 0)
- {
- _IO_flockfile (stderr);
-
- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
- ((_IO_FILE *) stderr)->_flags2
- |= _IO_FLAGS2_NOTCANCEL;
-
- __fxprintf (NULL, "%s", buf);
-
- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
- _IO_funlockfile (stderr);
-
- free (buf);
- }
-#else
- fprintf (stderr,
- _("%s: option `%s' requires an argument\n"),
- argv[0], argv[d->optind - 1]);
-#endif
- }
- d->__nextchar += strlen (d->__nextchar);
- return optstring[0] == ':' ? ':' : '?';
- }
- }
- d->__nextchar += strlen (d->__nextchar);
- if (longind != NULL)
- *longind = option_index;
- if (pfound->flag)
- {
- *(pfound->flag) = pfound->val;
- return 0;
- }
- return pfound->val;
- }
- d->__nextchar = NULL;
- return 'W'; /* Let the application handle it. */
- }
- if (temp[1] == ':')
- {
- if (temp[2] == ':')
- {
- /* This is an option that accepts an argument optionally. */
- if (*d->__nextchar != '\0')
- {
- d->optarg = d->__nextchar;
- d->optind++;
- }
- else
- d->optarg = NULL;
- d->__nextchar = NULL;
- }
- else
- {
- /* This is an option that requires an argument. */
- if (*d->__nextchar != '\0')
- {
- d->optarg = d->__nextchar;
- /* If we end this ARGV-element by taking the rest as an arg,
- we must advance to the next element now. */
- d->optind++;
- }
- else if (d->optind == argc)
- {
- if (print_errors)
- {
- /* 1003.2 specifies the format of this message. */
-#if defined _LIBC && defined USE_IN_LIBIO
- char *buf;
-
- if (__asprintf (&buf, _("\
-%s: option requires an argument -- %c\n"),
- argv[0], c) >= 0)
- {
- _IO_flockfile (stderr);
-
- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
-
- __fxprintf (NULL, "%s", buf);
-
- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
- _IO_funlockfile (stderr);
-
- free (buf);
- }
-#else
- fprintf (stderr,
- _("%s: option requires an argument -- %c\n"),
- argv[0], c);
-#endif
- }
- d->optopt = c;
- if (optstring[0] == ':')
- c = ':';
- else
- c = '?';
- }
- else
- /* We already incremented `optind' once;
- increment it again when taking next ARGV-elt as argument. */
- d->optarg = argv[d->optind++];
- d->__nextchar = NULL;
- }
- }
- return c;
- }
-}
-
-int
-_getopt_internal (int argc, char **argv, const char *optstring,
- const struct option *longopts, int *longind,
- int long_only, int posixly_correct)
-{
- int result;
-
- getopt_data.optind = optind;
- getopt_data.opterr = opterr;
-
- result = _getopt_internal_r (argc, argv, optstring, longopts, longind,
- long_only, posixly_correct, &getopt_data);
-
- optind = getopt_data.optind;
- optarg = getopt_data.optarg;
- optopt = getopt_data.optopt;
-
- return result;
-}
-
-/* glibc gets a LSB-compliant getopt.
- Standalone applications get a POSIX-compliant getopt. */
-#if _LIBC
-enum { POSIXLY_CORRECT = 0 };
-#else
-enum { POSIXLY_CORRECT = 1 };
-#endif
-
-int
-getopt (int argc, char *const *argv, const char *optstring)
-{
- return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0,
- POSIXLY_CORRECT);
-}
-
-\f
-#ifdef TEST
-
-/* Compile with -DTEST to make an executable for use in testing
- the above definition of `getopt'. */
-
-int
-main (int argc, char **argv)
-{
- int c;
- int digit_optind = 0;
-
- while (1)
- {
- int this_option_optind = optind ? optind : 1;
-
- c = getopt (argc, argv, "abc:d:0123456789");
- if (c == -1)
- break;
-
- switch (c)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
- }
-
- if (optind < argc)
- {
- printf ("non-option ARGV-elements: ");
- while (optind < argc)
- printf ("%s ", argv[optind++]);
- printf ("\n");
- }
-
- exit (0);
-}
-
-#endif /* TEST */
+++ /dev/null
-/* getopt_long and getopt_long_only entry points for GNU getopt.
- Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004
- Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-\f
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef _LIBC
-# include <getopt.h>
-#else
-# include "getopt.h"
-#endif
-#include "getopt_int.h"
-
-#include <stdio.h>
-
-/* This needs to come after some library #include
- to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
-#include <stdlib.h>
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-int
-getopt_long (int argc, char *__getopt_argv_const *argv, const char *options,
- const struct option *long_options, int *opt_index)
-{
- return _getopt_internal (argc, (char **) argv, options, long_options,
- opt_index, 0, 0);
-}
-
-int
-_getopt_long_r (int argc, char **argv, const char *options,
- const struct option *long_options, int *opt_index,
- struct _getopt_data *d)
-{
- return _getopt_internal_r (argc, argv, options, long_options, opt_index,
- 0, 0, d);
-}
-
-/* Like getopt_long, but '-' as well as '--' can indicate a long option.
- If an option that starts with '-' (not '--') doesn't match a long option,
- but does match a short option, it is parsed as a short option
- instead. */
-
-int
-getopt_long_only (int argc, char *__getopt_argv_const *argv,
- const char *options,
- const struct option *long_options, int *opt_index)
-{
- return _getopt_internal (argc, (char **) argv, options, long_options,
- opt_index, 1, 0);
-}
-
-int
-_getopt_long_only_r (int argc, char **argv, const char *options,
- const struct option *long_options, int *opt_index,
- struct _getopt_data *d)
-{
- return _getopt_internal_r (argc, argv, options, long_options, opt_index,
- 1, 0, d);
-}
-
-\f
-#ifdef TEST
-
-#include <stdio.h>
-
-int
-main (int argc, char **argv)
-{
- int c;
- int digit_optind = 0;
-
- while (1)
- {
- int this_option_optind = optind ? optind : 1;
- int option_index = 0;
- static struct option long_options[] =
- {
- {"add", 1, 0, 0},
- {"append", 0, 0, 0},
- {"delete", 1, 0, 0},
- {"verbose", 0, 0, 0},
- {"create", 0, 0, 0},
- {"file", 1, 0, 0},
- {0, 0, 0, 0}
- };
-
- c = getopt_long (argc, argv, "abc:d:0123456789",
- long_options, &option_index);
- if (c == -1)
- break;
-
- switch (c)
- {
- case 0:
- printf ("option %s", long_options[option_index].name);
- if (optarg)
- printf (" with arg %s", optarg);
- printf ("\n");
- break;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case 'd':
- printf ("option d with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
- }
-
- if (optind < argc)
- {
- printf ("non-option ARGV-elements: ");
- while (optind < argc)
- printf ("%s ", argv[optind++]);
- printf ("\n");
- }
-
- exit (0);
-}
-
-#endif /* TEST */
+++ /dev/null
-/* Declarations for getopt.
- Copyright (C) 1989-1994,1996-1999,2001,2003-2006
- Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _GETOPT_H
-
-#ifndef __need_getopt
-# define _GETOPT_H 1
-#endif
-
-/* Ensure that DLL_VARIABLE is defined. Since on OSF/1 4.0 and Irix 6.5
- <stdlib.h> includes <getopt.h>, and <config.h> is not a prerequisite for
- using <stdlib.h>, this file can be included without a prior
- "#include <config.h>". */
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Standalone applications should #define __GETOPT_PREFIX to an
- identifier that prefixes the external functions and variables
- defined in this header. When this happens, include the
- headers that might declare getopt so that they will not cause
- confusion if included after this file. Then systematically rename
- identifiers so that they do not collide with the system functions
- and variables. Renaming avoids problems with some compilers and
- linkers. */
-#if defined __GETOPT_PREFIX && !defined __need_getopt
-# include <stdlib.h>
-# include <stdio.h>
-# include <unistd.h>
-# undef __need_getopt
-# undef getopt
-# undef getopt_long
-# undef getopt_long_only
-# undef optarg
-# undef opterr
-# undef optind
-# undef optopt
-# define __GETOPT_CONCAT(x, y) x ## y
-# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
-# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
-# define getopt __GETOPT_ID (getopt)
-# define getopt_long __GETOPT_ID (getopt_long)
-# define getopt_long_only __GETOPT_ID (getopt_long_only)
-# define optarg __GETOPT_ID (optarg)
-# define opterr __GETOPT_ID (opterr)
-# define optind __GETOPT_ID (optind)
-# define optopt __GETOPT_ID (optopt)
-#endif
-
-/* Standalone applications get correct prototypes for getopt_long and
- getopt_long_only; they declare "char **argv". libc uses prototypes
- with "char *const *argv" that are incorrect because getopt_long and
- getopt_long_only can permute argv; this is required for backward
- compatibility (e.g., for LSB 2.0.1).
-
- This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt',
- but it caused redefinition warnings if both unistd.h and getopt.h were
- included, since unistd.h includes getopt.h having previously defined
- __need_getopt.
-
- The only place where __getopt_argv_const is used is in definitions
- of getopt_long and getopt_long_only below, but these are visible
- only if __need_getopt is not defined, so it is quite safe to rewrite
- the conditional as follows:
-*/
-#if !defined __need_getopt
-# if defined __GETOPT_PREFIX
-# define __getopt_argv_const /* empty */
-# else
-# define __getopt_argv_const const
-# endif
-#endif
-
-/* If __GNU_LIBRARY__ is not already defined, either we are being used
- standalone, or this is the first header included in the source file.
- If we are being used with glibc, we need to include <features.h>, but
- that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
- not defined, include <ctype.h>, which will pull in <features.h> for us
- if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
- doesn't flood the namespace with stuff the way some other headers do.) */
-#if !defined __GNU_LIBRARY__
-# include <ctype.h>
-#endif
-
-#ifndef __THROW
-# ifndef __GNUC_PREREQ
-# define __GNUC_PREREQ(maj, min) (0)
-# endif
-# if defined __cplusplus && __GNUC_PREREQ (2,8)
-# define __THROW throw ()
-# else
-# define __THROW
-# endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* For communication from `getopt' to the caller.
- When `getopt' finds an option that takes an argument,
- the argument value is returned here.
- Also, when `ordering' is RETURN_IN_ORDER,
- each non-option ARGV-element is returned here. */
-
-extern DLL_VARIABLE char *optarg;
-
-/* Index in ARGV of the next element to be scanned.
- This is used for communication to and from the caller
- and for communication between successive calls to `getopt'.
-
- On entry to `getopt', zero means this is the first call; initialize.
-
- When `getopt' returns -1, this is the index of the first of the
- non-option elements that the caller should itself scan.
-
- Otherwise, `optind' communicates from one call to the next
- how much of ARGV has been scanned so far. */
-
-extern DLL_VARIABLE int optind;
-
-/* Callers store zero here to inhibit the error message `getopt' prints
- for unrecognized options. */
-
-extern DLL_VARIABLE int opterr;
-
-/* Set to an option character which was unrecognized. */
-
-extern DLL_VARIABLE int optopt;
-
-#ifndef __need_getopt
-/* Describe the long-named options requested by the application.
- The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
- of `struct option' terminated by an element containing a name which is
- zero.
-
- The field `has_arg' is:
- no_argument (or 0) if the option does not take an argument,
- required_argument (or 1) if the option requires an argument,
- optional_argument (or 2) if the option takes an optional argument.
-
- If the field `flag' is not NULL, it points to a variable that is set
- to the value given in the field `val' when the option is found, but
- left unchanged if the option is not found.
-
- To have a long-named option do something other than set an `int' to
- a compiled-in constant, such as set a value from `optarg', set the
- option's `flag' field to zero and its `val' field to a nonzero
- value (the equivalent single-letter option character, if there is
- one). For long options that have a zero `flag' field, `getopt'
- returns the contents of the `val' field. */
-
-struct option
-{
- const char *name;
- /* has_arg can't be an enum because some compilers complain about
- type mismatches in all the code that assumes it is an int. */
- int has_arg;
- int *flag;
- int val;
-};
-
-/* Names for the values of the `has_arg' field of `struct option'. */
-
-# define no_argument 0
-# define required_argument 1
-# define optional_argument 2
-#endif /* need getopt */
-
-
-/* Get definitions and prototypes for functions to process the
- arguments in ARGV (ARGC of them, minus the program name) for
- options given in OPTS.
-
- Return the option character from OPTS just read. Return -1 when
- there are no more options. For unrecognized options, or options
- missing arguments, `optopt' is set to the option letter, and '?' is
- returned.
-
- The OPTS string is a list of characters which are recognized option
- letters, optionally followed by colons, specifying that that letter
- takes an argument, to be placed in `optarg'.
-
- If a letter in OPTS is followed by two colons, its argument is
- optional. This behavior is specific to the GNU `getopt'.
-
- The argument `--' causes premature termination of argument
- scanning, explicitly telling `getopt' that there are no more
- options.
-
- If OPTS begins with `--', then non-option arguments are treated as
- arguments to the option '\0'. This behavior is specific to the GNU
- `getopt'. */
-
-extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
- __THROW;
-
-#ifndef __need_getopt
-extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
- const char *__shortopts,
- const struct option *__longopts, int *__longind)
- __THROW;
-extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
- const char *__shortopts,
- const struct option *__longopts, int *__longind)
- __THROW;
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-/* Make sure we later can get all the definitions and declarations. */
-#undef __need_getopt
-
-#endif /* getopt.h */
+++ /dev/null
-/* Internal declarations for getopt.
- Copyright (C) 1989-1994,1996-1999,2001,2003,2004
- Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _GETOPT_INT_H
-#define _GETOPT_INT_H 1
-
-extern int _getopt_internal (int ___argc, char **___argv,
- const char *__shortopts,
- const struct option *__longopts, int *__longind,
- int __long_only, int __posixly_correct);
-
-\f
-/* Reentrant versions which can handle parsing multiple argument
- vectors at the same time. */
-
-/* Data type for reentrant functions. */
-struct _getopt_data
-{
- /* These have exactly the same meaning as the corresponding global
- variables, except that they are used for the reentrant
- versions of getopt. */
- int optind;
- int opterr;
- int optopt;
- char *optarg;
-
- /* Internal members. */
-
- /* True if the internal members have been initialized. */
- int __initialized;
-
- /* The next char to be scanned in the option-element
- in which the last option character we returned was found.
- This allows us to pick up the scan where we left off.
-
- If this is zero, or a null string, it means resume the scan
- by advancing to the next ARGV-element. */
- char *__nextchar;
-
- /* Describe how to deal with options that follow non-option ARGV-elements.
-
- If the caller did not specify anything,
- the default is REQUIRE_ORDER if the environment variable
- POSIXLY_CORRECT is defined, PERMUTE otherwise.
-
- REQUIRE_ORDER means don't recognize them as options;
- stop option processing when the first non-option is seen.
- This is what Unix does.
- This mode of operation is selected by either setting the environment
- variable POSIXLY_CORRECT, or using `+' as the first character
- of the list of option characters, or by calling getopt.
-
- PERMUTE is the default. We permute the contents of ARGV as we
- scan, so that eventually all the non-options are at the end.
- This allows options to be given in any order, even with programs
- that were not written to expect this.
-
- RETURN_IN_ORDER is an option available to programs that were
- written to expect options and other ARGV-elements in any order
- and that care about the ordering of the two. We describe each
- non-option ARGV-element as if it were the argument of an option
- with character code 1. Using `-' as the first character of the
- list of option characters selects this mode of operation.
-
- The special argument `--' forces an end of option-scanning regardless
- of the value of `ordering'. In the case of RETURN_IN_ORDER, only
- `--' can cause `getopt' to return -1 with `optind' != ARGC. */
-
- enum
- {
- REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
- } __ordering;
-
- /* If the POSIXLY_CORRECT environment variable is set
- or getopt was called. */
- int __posixly_correct;
-
-
- /* Handle permutation of arguments. */
-
- /* Describe the part of ARGV that contains non-options that have
- been skipped. `first_nonopt' is the index in ARGV of the first
- of them; `last_nonopt' is the index after the last of them. */
-
- int __first_nonopt;
- int __last_nonopt;
-
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
- int __nonoption_flags_max_len;
- int __nonoption_flags_len;
-# endif
-};
-
-/* The initializer is necessary to set OPTIND and OPTERR to their
- default values and to clear the initialization flag. */
-#define _GETOPT_DATA_INITIALIZER { 1, 1 }
-
-extern int _getopt_internal_r (int ___argc, char **___argv,
- const char *__shortopts,
- const struct option *__longopts, int *__longind,
- int __long_only, int __posixly_correct,
- struct _getopt_data *__data);
-
-extern int _getopt_long_r (int ___argc, char **___argv,
- const char *__shortopts,
- const struct option *__longopts, int *__longind,
- struct _getopt_data *__data);
-
-extern int _getopt_long_only_r (int ___argc, char **___argv,
- const char *__shortopts,
- const struct option *__longopts,
- int *__longind,
- struct _getopt_data *__data);
-
-#endif /* getopt_int.h */
+++ /dev/null
-/* Sequential list data type implemented by a hash table with another list.
- Copyright (C) 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2006.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Common code of
- gl_linkedhash_list.c, gl_avltreehash_list.c, gl_rbtreehash_list.c. */
-
-/* Hash table entry. */
-struct gl_hash_entry
-{
- struct gl_hash_entry *hash_next; /* chain of entries in same bucket */
- size_t hashcode; /* cache of values' common hash code */
-};
-typedef struct gl_hash_entry * gl_hash_entry_t;
+++ /dev/null
-/* Sequential list data type implemented by a hash table with another list.
- Copyright (C) 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2006.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Common code of
- gl_linkedhash_list.c, gl_avltreehash_list.c, gl_rbtreehash_list.c. */
-
-/* Array of primes, approximately in steps of factor 1.2.
- This table was computed by executing the Common Lisp expression
- (dotimes (i 244) (format t "nextprime(~D)~%" (ceiling (expt 1.2d0 i))))
- and feeding the result to PARI/gp. */
-static const size_t primes[] =
- {
- 11, 13, 17, 19, 23, 29, 37, 41, 47, 59, 67, 83, 97, 127, 139, 167, 199,
- 239, 293, 347, 419, 499, 593, 709, 853, 1021, 1229, 1471, 1777, 2129, 2543,
- 3049, 3659, 4391, 5273, 6323, 7589, 9103, 10937, 13109, 15727, 18899,
- 22651, 27179, 32609, 39133, 46957, 56359, 67619, 81157, 97369, 116849,
- 140221, 168253, 201907, 242309, 290761, 348889, 418667, 502409, 602887,
- 723467, 868151, 1041779, 1250141, 1500181, 1800191, 2160233, 2592277,
- 3110741, 3732887, 4479463, 5375371, 6450413, 7740517, 9288589, 11146307,
- 13375573, 16050689, 19260817, 23112977, 27735583, 33282701, 39939233,
- 47927081, 57512503, 69014987, 82818011, 99381577, 119257891, 143109469,
- 171731387, 206077643, 247293161, 296751781, 356102141, 427322587,
- 512787097, 615344489, 738413383, 886096061, 1063315271, 1275978331,
- 1531174013, 1837408799, 2204890543UL, 2645868653UL, 3175042391UL,
- 3810050851UL,
-#if SIZE_MAX > 4294967295UL
- 4572061027UL, 5486473229UL, 6583767889UL, 7900521449UL, 9480625733UL,
- 11376750877UL, 13652101063UL, 16382521261UL, 19659025513UL, 23590830631UL,
- 28308996763UL, 33970796089UL, 40764955463UL, 48917946377UL, 58701535657UL,
- 70441842749UL, 84530211301UL, 101436253561UL, 121723504277UL,
- 146068205131UL, 175281846149UL, 210338215379UL, 252405858521UL,
- 302887030151UL, 363464436191UL, 436157323417UL, 523388788231UL,
- 628066545713UL, 753679854847UL, 904415825857UL, 1085298991109UL,
- 1302358789181UL, 1562830547009UL, 1875396656429UL, 2250475987709UL,
- 2700571185239UL, 3240685422287UL, 3888822506759UL, 4666587008147UL,
- 5599904409713UL, 6719885291641UL, 8063862349969UL, 9676634819959UL,
- 11611961783951UL, 13934354140769UL, 16721224968907UL, 20065469962669UL,
- 24078563955191UL, 28894276746229UL, 34673132095507UL, 41607758514593UL,
- 49929310217531UL, 59915172260971UL, 71898206713183UL, 86277848055823UL,
- 103533417666967UL, 124240101200359UL, 149088121440451UL, 178905745728529UL,
- 214686894874223UL, 257624273849081UL, 309149128618903UL, 370978954342639UL,
- 445174745211143UL, 534209694253381UL, 641051633104063UL, 769261959724877UL,
- 923114351670013UL, 1107737222003791UL, 1329284666404567UL,
- 1595141599685509UL, 1914169919622551UL, 2297003903547091UL,
- 2756404684256459UL, 3307685621107757UL, 3969222745329323UL,
- 4763067294395177UL, 5715680753274209UL, 6858816903929113UL,
- 8230580284714831UL, 9876696341657791UL, 11852035609989371UL,
- 14222442731987227UL, 17066931278384657UL, 20480317534061597UL,
- 24576381040873903UL, 29491657249048679UL, 35389988698858471UL,
- 42467986438630267UL, 50961583726356109UL, 61153900471627387UL,
- 73384680565952851UL, 88061616679143347UL, 105673940014972061UL,
- 126808728017966413UL, 152170473621559703UL, 182604568345871671UL,
- 219125482015045997UL, 262950578418055169UL, 315540694101666193UL,
- 378648832921999397UL, 454378599506399233UL, 545254319407679131UL,
- 654305183289214771UL, 785166219947057701UL, 942199463936469157UL,
- 1130639356723763129UL, 1356767228068515623UL, 1628120673682218619UL,
- 1953744808418662409UL, 2344493770102394881UL, 2813392524122873857UL,
- 3376071028947448339UL, 4051285234736937517UL, 4861542281684325481UL,
- 5833850738021191727UL, 7000620885625427969UL, 8400745062750513217UL,
- 10080894075300616261UL, 12097072890360739951UL, 14516487468432885797UL,
- 17419784962119465179UL,
-#endif
- SIZE_MAX /* sentinel, to ensure the search terminates */
- };
-
-/* Return a suitable prime >= ESTIMATE. */
-static size_t
-next_prime (size_t estimate)
-{
- size_t i;
-
- for (i = 0; i < sizeof (primes) / sizeof (primes[0]); i++)
- if (primes[i] >= estimate)
- return primes[i];
- return SIZE_MAX; /* not a prime, but better than nothing */
-}
-
-/* Resize the hash table with a new estimated size. */
-static void
-hash_resize (gl_list_t list, size_t estimate)
-{
- size_t new_size = next_prime (estimate);
-
- if (new_size > list->table_size)
- {
- gl_hash_entry_t *old_table = list->table;
- /* Allocate the new table. */
- gl_hash_entry_t *new_table =
- (gl_hash_entry_t *) xzalloc (new_size * sizeof (gl_hash_entry_t));
- size_t i;
-
- /* Iterate through the entries of the old table. */
- for (i = list->table_size; i > 0; )
- {
- gl_hash_entry_t node = old_table[--i];
-
- while (node != NULL)
- {
- gl_hash_entry_t next = node->hash_next;
- /* Add the entry to the new table. */
- size_t index = node->hashcode % new_size;
- node->hash_next = new_table[index];
- new_table[index] = node;
-
- node = next;
- }
- }
-
- list->table = new_table;
- list->table_size = new_size;
- free (old_table);
- }
-}
+++ /dev/null
-/* Sequential list data type implemented by a linked list.
- Copyright (C) 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2006.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Common code of gl_linked_list.c and gl_linkedhash_list.c. */
-
-/* -------------------------- gl_list_t Data Type -------------------------- */
-
-/* Concrete list node implementation, valid for this file only. */
-struct gl_list_node_impl
-{
-#if WITH_HASHTABLE
- struct gl_hash_entry h; /* hash table entry fields; must be first */
-#endif
- struct gl_list_node_impl *next;
- struct gl_list_node_impl *prev;
- const void *value;
-};
-
-/* Concrete gl_list_impl type, valid for this file only. */
-struct gl_list_impl
-{
- struct gl_list_impl_base base;
-#if WITH_HASHTABLE
- /* A hash table: managed as an array of collision lists. */
- struct gl_hash_entry **table;
- size_t table_size;
-#endif
- /* A circular list anchored at root.
- The first node is = root.next, the last node is = root.prev.
- The root's value is unused. */
- struct gl_list_node_impl root;
- /* Number of list nodes, excluding the root. */
- size_t count;
-};
+++ /dev/null
-/* Sequential list data type implemented by a linked list.
- Copyright (C) 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2006.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Common code of gl_linked_list.c and gl_linkedhash_list.c. */
-
-/* If the symbol SIGNAL_SAFE_LIST is defined, the code is compiled in such
- a way that a gl_list_t data structure may be used from within a signal
- handler. The operations allowed in the signal handler are:
- gl_list_iterator, gl_list_iterator_next, gl_list_iterator_free.
- The list and node fields that are therefore accessed from the signal handler
- are:
- list->root, node->next, node->value.
- We are careful to make modifications to these fields only in an order
- that maintains the consistency of the list data structure at any moment,
- and we use 'volatile' assignments to prevent the compiler from reordering
- such assignments. */
-#ifdef SIGNAL_SAFE_LIST
-# define ASYNCSAFE(type) *(volatile type *)&
-#else
-# define ASYNCSAFE(type)
-#endif
-
-/* -------------------------- gl_list_t Data Type -------------------------- */
-
-static gl_list_t
-gl_linked_create_empty (gl_list_implementation_t implementation,
- gl_listelement_equals_fn equals_fn,
- gl_listelement_hashcode_fn hashcode_fn,
- bool allow_duplicates)
-{
- struct gl_list_impl *list =
- (struct gl_list_impl *) xmalloc (sizeof (struct gl_list_impl));
-
- list->base.vtable = implementation;
- list->base.equals_fn = equals_fn;
- list->base.hashcode_fn = hashcode_fn;
- list->base.allow_duplicates = allow_duplicates;
-#if WITH_HASHTABLE
- list->table_size = 11;
- list->table =
- (gl_hash_entry_t *) xzalloc (list->table_size * sizeof (gl_hash_entry_t));
-#endif
- list->root.next = &list->root;
- list->root.prev = &list->root;
- list->count = 0;
-
- return list;
-}
-
-static gl_list_t
-gl_linked_create (gl_list_implementation_t implementation,
- gl_listelement_equals_fn equals_fn,
- gl_listelement_hashcode_fn hashcode_fn,
- bool allow_duplicates,
- size_t count, const void **contents)
-{
- struct gl_list_impl *list =
- (struct gl_list_impl *) xmalloc (sizeof (struct gl_list_impl));
- gl_list_node_t tail;
-
- list->base.vtable = implementation;
- list->base.equals_fn = equals_fn;
- list->base.hashcode_fn = hashcode_fn;
- list->base.allow_duplicates = allow_duplicates;
-#if WITH_HASHTABLE
- {
- size_t estimate = xsum (count, count / 2); /* 1.5 * count */
- if (estimate < 10)
- estimate = 10;
- list->table_size = next_prime (estimate);
- list->table =
- (gl_hash_entry_t *) xzalloc (list->table_size * sizeof (gl_hash_entry_t));
- }
-#endif
- list->count = count;
- tail = &list->root;
- for (; count > 0; contents++, count--)
- {
- gl_list_node_t node =
- (struct gl_list_node_impl *)
- xmalloc (sizeof (struct gl_list_node_impl));
-
- node->value = *contents;
-#if WITH_HASHTABLE
- node->h.hashcode =
- (list->base.hashcode_fn != NULL
- ? list->base.hashcode_fn (node->value)
- : (size_t)(uintptr_t) node->value);
-
- /* Add node to the hash table. */
- add_to_bucket (list, node);
-#endif
-
- /* Add node to the list. */
- node->prev = tail;
- tail->next = node;
- tail = node;
- }
- tail->next = &list->root;
- list->root.prev = tail;
-
- return list;
-}
-
-static size_t
-gl_linked_size (gl_list_t list)
-{
- return list->count;
-}
-
-static const void *
-gl_linked_node_value (gl_list_t list, gl_list_node_t node)
-{
- return node->value;
-}
-
-static gl_list_node_t
-gl_linked_next_node (gl_list_t list, gl_list_node_t node)
-{
- return (node->next != &list->root ? node->next : NULL);
-}
-
-static gl_list_node_t
-gl_linked_previous_node (gl_list_t list, gl_list_node_t node)
-{
- return (node->prev != &list->root ? node->prev : NULL);
-}
-
-static const void *
-gl_linked_get_at (gl_list_t list, size_t position)
-{
- size_t count = list->count;
- gl_list_node_t node;
-
- if (!(position < count))
- /* Invalid argument. */
- abort ();
- /* Here we know count > 0. */
- if (position <= ((count - 1) / 2))
- {
- node = list->root.next;
- for (; position > 0; position--)
- node = node->next;
- }
- else
- {
- position = count - 1 - position;
- node = list->root.prev;
- for (; position > 0; position--)
- node = node->prev;
- }
- return node->value;
-}
-
-static gl_list_node_t
-gl_linked_set_at (gl_list_t list, size_t position, const void *elt)
-{
- size_t count = list->count;
- gl_list_node_t node;
-
- if (!(position < count))
- /* Invalid argument. */
- abort ();
- /* Here we know count > 0. */
- if (position <= ((count - 1) / 2))
- {
- node = list->root.next;
- for (; position > 0; position--)
- node = node->next;
- }
- else
- {
- position = count - 1 - position;
- node = list->root.prev;
- for (; position > 0; position--)
- node = node->prev;
- }
-#if WITH_HASHTABLE
- if (elt != node->value)
- {
- size_t new_hashcode =
- (list->base.hashcode_fn != NULL
- ? list->base.hashcode_fn (elt)
- : (size_t)(uintptr_t) elt);
-
- if (new_hashcode != node->h.hashcode)
- {
- remove_from_bucket (list, node);
- node->value = elt;
- node->h.hashcode = new_hashcode;
- add_to_bucket (list, node);
- }
- else
- node->value = elt;
- }
-#else
- node->value = elt;
-#endif
- return node;
-}
-
-static gl_list_node_t
-gl_linked_search (gl_list_t list, const void *elt)
-{
-#if WITH_HASHTABLE
- size_t hashcode =
- (list->base.hashcode_fn != NULL
- ? list->base.hashcode_fn (elt)
- : (size_t)(uintptr_t) elt);
- size_t index = hashcode % list->table_size;
- gl_listelement_equals_fn equals = list->base.equals_fn;
-
- if (!list->base.allow_duplicates)
- {
- /* Look for the first match in the hash bucket. */
- gl_list_node_t node;
-
- for (node = (gl_list_node_t) list->table[index];
- node != NULL;
- node = (gl_list_node_t) node->h.hash_next)
- if (node->h.hashcode == hashcode
- && (equals != NULL
- ? equals (elt, node->value)
- : elt == node->value))
- return node;
- return NULL;
- }
- else
- {
- /* Look whether there is more than one match in the hash bucket. */
- bool multiple_matches = false;
- gl_list_node_t first_match = NULL;
- gl_list_node_t node;
-
- for (node = (gl_list_node_t) list->table[index];
- node != NULL;
- node = (gl_list_node_t) node->h.hash_next)
- if (node->h.hashcode == hashcode
- && (equals != NULL
- ? equals (elt, node->value)
- : elt == node->value))
- {
- if (first_match == NULL)
- first_match = node;
- else
- {
- multiple_matches = true;
- break;
- }
- }
- if (!multiple_matches)
- return first_match;
- else
- {
- /* We need the match with the smallest index. But we don't have
- a fast mapping node -> index. So we have to walk the list. */
- for (node = list->root.next; node != &list->root; node = node->next)
- if (node->h.hashcode == hashcode
- && (equals != NULL
- ? equals (elt, node->value)
- : elt == node->value))
- return node;
- /* We know there are at least two matches. */
- abort ();
- }
- }
-#else
- gl_listelement_equals_fn equals = list->base.equals_fn;
- gl_list_node_t node;
-
- if (equals != NULL)
- {
- for (node = list->root.next; node != &list->root; node = node->next)
- if (equals (elt, node->value))
- return node;
- }
- else
- {
- for (node = list->root.next; node != &list->root; node = node->next)
- if (elt == node->value)
- return node;
- }
- return NULL;
-#endif
-}
-
-static size_t
-gl_linked_indexof (gl_list_t list, const void *elt)
-{
-#if WITH_HASHTABLE
- /* Here the hash table doesn't help much. It only allows us to minimize
- the number of equals() calls, by looking up first the node and then
- its index. */
- size_t hashcode =
- (list->base.hashcode_fn != NULL
- ? list->base.hashcode_fn (elt)
- : (size_t)(uintptr_t) elt);
- size_t index = hashcode % list->table_size;
- gl_listelement_equals_fn equals = list->base.equals_fn;
- gl_list_node_t node;
-
- /* First step: Look up the node. */
- if (!list->base.allow_duplicates)
- {
- /* Look for the first match in the hash bucket. */
- for (node = (gl_list_node_t) list->table[index];
- node != NULL;
- node = (gl_list_node_t) node->h.hash_next)
- if (node->h.hashcode == hashcode
- && (equals != NULL
- ? equals (elt, node->value)
- : elt == node->value))
- break;
- }
- else
- {
- /* Look whether there is more than one match in the hash bucket. */
- bool multiple_matches = false;
- gl_list_node_t first_match = NULL;
-
- for (node = (gl_list_node_t) list->table[index];
- node != NULL;
- node = (gl_list_node_t) node->h.hash_next)
- if (node->h.hashcode == hashcode
- && (equals != NULL
- ? equals (elt, node->value)
- : elt == node->value))
- {
- if (first_match == NULL)
- first_match = node;
- else
- {
- multiple_matches = true;
- break;
- }
- }
- if (multiple_matches)
- {
- /* We need the match with the smallest index. But we don't have
- a fast mapping node -> index. So we have to walk the list. */
- size_t index;
-
- for (node = list->root.next, index = 0;
- node != &list->root;
- node = node->next, index++)
- if (node->h.hashcode == hashcode
- && (equals != NULL
- ? equals (elt, node->value)
- : elt == node->value))
- return index;
- /* We know there are at least two matches. */
- abort ();
- }
- node = first_match;
- }
-
- /* Second step: Look up the index of the node. */
- if (node == NULL)
- return (size_t)(-1);
- else
- {
- size_t index = 0;
-
- for (; node->prev != &list->root; node = node->prev)
- index++;
-
- return index;
- }
-#else
- gl_listelement_equals_fn equals = list->base.equals_fn;
- gl_list_node_t node;
-
- if (equals != NULL)
- {
- size_t index;
- for (node = list->root.next, index = 0;
- node != &list->root;
- node = node->next, index++)
- if (equals (elt, node->value))
- return index;
- }
- else
- {
- size_t index;
- for (node = list->root.next, index = 0;
- node != &list->root;
- node = node->next, index++)
- if (elt == node->value)
- return index;
- }
- return (size_t)(-1);
-#endif
-}
-
-static gl_list_node_t
-gl_linked_add_first (gl_list_t list, const void *elt)
-{
- gl_list_node_t node =
- (struct gl_list_node_impl *) xmalloc (sizeof (struct gl_list_node_impl));
-
- ASYNCSAFE(const void *) node->value = elt;
-#if WITH_HASHTABLE
- node->h.hashcode =
- (list->base.hashcode_fn != NULL
- ? list->base.hashcode_fn (node->value)
- : (size_t)(uintptr_t) node->value);
-
- /* Add node to the hash table. */
- add_to_bucket (list, node);
-#endif
-
- /* Add node to the list. */
- node->prev = &list->root;
- ASYNCSAFE(gl_list_node_t) node->next = list->root.next;
- node->next->prev = node;
- ASYNCSAFE(gl_list_node_t) list->root.next = node;
- list->count++;
-
-#if WITH_HASHTABLE
- hash_resize_after_add (list);
-#endif
-
- return node;
-}
-
-static gl_list_node_t
-gl_linked_add_last (gl_list_t list, const void *elt)
-{
- gl_list_node_t node =
- (struct gl_list_node_impl *) xmalloc (sizeof (struct gl_list_node_impl));
-
- ASYNCSAFE(const void *) node->value = elt;
-#if WITH_HASHTABLE
- node->h.hashcode =
- (list->base.hashcode_fn != NULL
- ? list->base.hashcode_fn (node->value)
- : (size_t)(uintptr_t) node->value);
-
- /* Add node to the hash table. */
- add_to_bucket (list, node);
-#endif
-
- /* Add node to the list. */
- ASYNCSAFE(gl_list_node_t) node->next = &list->root;
- node->prev = list->root.prev;
- ASYNCSAFE(gl_list_node_t) node->prev->next = node;
- list->root.prev = node;
- list->count++;
-
-#if WITH_HASHTABLE
- hash_resize_after_add (list);
-#endif
-
- return node;
-}
-
-static gl_list_node_t
-gl_linked_add_before (gl_list_t list, gl_list_node_t node, const void *elt)
-{
- gl_list_node_t new_node =
- (struct gl_list_node_impl *) xmalloc (sizeof (struct gl_list_node_impl));
-
- ASYNCSAFE(const void *) new_node->value = elt;
-#if WITH_HASHTABLE
- new_node->h.hashcode =
- (list->base.hashcode_fn != NULL
- ? list->base.hashcode_fn (new_node->value)
- : (size_t)(uintptr_t) new_node->value);
-
- /* Add new_node to the hash table. */
- add_to_bucket (list, new_node);
-#endif
-
- /* Add new_node to the list. */
- ASYNCSAFE(gl_list_node_t) new_node->next = node;
- new_node->prev = node->prev;
- ASYNCSAFE(gl_list_node_t) new_node->prev->next = new_node;
- node->prev = new_node;
- list->count++;
-
-#if WITH_HASHTABLE
- hash_resize_after_add (list);
-#endif
-
- return new_node;
-}
-
-static gl_list_node_t
-gl_linked_add_after (gl_list_t list, gl_list_node_t node, const void *elt)
-{
- gl_list_node_t new_node =
- (struct gl_list_node_impl *) xmalloc (sizeof (struct gl_list_node_impl));
-
- ASYNCSAFE(const void *) new_node->value = elt;
-#if WITH_HASHTABLE
- new_node->h.hashcode =
- (list->base.hashcode_fn != NULL
- ? list->base.hashcode_fn (new_node->value)
- : (size_t)(uintptr_t) new_node->value);
-
- /* Add new_node to the hash table. */
- add_to_bucket (list, new_node);
-#endif
-
- /* Add new_node to the list. */
- new_node->prev = node;
- ASYNCSAFE(gl_list_node_t) new_node->next = node->next;
- new_node->next->prev = new_node;
- ASYNCSAFE(gl_list_node_t) node->next = new_node;
- list->count++;
-
-#if WITH_HASHTABLE
- hash_resize_after_add (list);
-#endif
-
- return new_node;
-}
-
-static gl_list_node_t
-gl_linked_add_at (gl_list_t list, size_t position, const void *elt)
-{
- size_t count = list->count;
- gl_list_node_t new_node;
-
- if (!(position <= count))
- /* Invalid argument. */
- abort ();
-
- new_node =
- (struct gl_list_node_impl *) xmalloc (sizeof (struct gl_list_node_impl));
- ASYNCSAFE(const void *) new_node->value = elt;
-#if WITH_HASHTABLE
- new_node->h.hashcode =
- (list->base.hashcode_fn != NULL
- ? list->base.hashcode_fn (new_node->value)
- : (size_t)(uintptr_t) new_node->value);
-
- /* Add new_node to the hash table. */
- add_to_bucket (list, new_node);
-#endif
-
- /* Add new_node to the list. */
- if (position <= (count / 2))
- {
- gl_list_node_t node;
-
- node = &list->root;
- for (; position > 0; position--)
- node = node->next;
- new_node->prev = node;
- ASYNCSAFE(gl_list_node_t) new_node->next = node->next;
- new_node->next->prev = new_node;
- ASYNCSAFE(gl_list_node_t) node->next = new_node;
- }
- else
- {
- gl_list_node_t node;
-
- position = count - position;
- node = &list->root;
- for (; position > 0; position--)
- node = node->prev;
- ASYNCSAFE(gl_list_node_t) new_node->next = node;
- new_node->prev = node->prev;
- ASYNCSAFE(gl_list_node_t) new_node->prev->next = new_node;
- node->prev = new_node;
- }
- list->count++;
-
-#if WITH_HASHTABLE
- hash_resize_after_add (list);
-#endif
-
- return new_node;
-}
-
-static bool
-gl_linked_remove_node (gl_list_t list, gl_list_node_t node)
-{
- gl_list_node_t prev;
- gl_list_node_t next;
-
-#if WITH_HASHTABLE
- /* Remove node from the hash table. */
- remove_from_bucket (list, node);
-#endif
-
- /* Remove node from the list. */
- prev = node->prev;
- next = node->next;
-
- ASYNCSAFE(gl_list_node_t) prev->next = next;
- next->prev = prev;
- list->count--;
-
- free (node);
- return true;
-}
-
-static bool
-gl_linked_remove_at (gl_list_t list, size_t position)
-{
- size_t count = list->count;
- gl_list_node_t removed_node;
-
- if (!(position < count))
- /* Invalid argument. */
- abort ();
- /* Here we know count > 0. */
- if (position <= ((count - 1) / 2))
- {
- gl_list_node_t node;
- gl_list_node_t after_removed;
-
- node = &list->root;
- for (; position > 0; position--)
- node = node->next;
- removed_node = node->next;
- after_removed = node->next->next;
- ASYNCSAFE(gl_list_node_t) node->next = after_removed;
- after_removed->prev = node;
- }
- else
- {
- gl_list_node_t node;
- gl_list_node_t before_removed;
-
- position = count - 1 - position;
- node = &list->root;
- for (; position > 0; position--)
- node = node->prev;
- removed_node = node->prev;
- before_removed = node->prev->prev;
- node->prev = before_removed;
- ASYNCSAFE(gl_list_node_t) before_removed->next = node;
- }
-#if WITH_HASHTABLE
- remove_from_bucket (list, removed_node);
-#endif
- list->count--;
-
- free (removed_node);
- return true;
-}
-
-static bool
-gl_linked_remove (gl_list_t list, const void *elt)
-{
- gl_list_node_t node = gl_linked_search (list, elt);
-
- if (node != NULL)
- return gl_linked_remove_node (list, node);
- else
- return false;
-}
-
-static void
-gl_linked_list_free (gl_list_t list)
-{
- gl_list_node_t node;
-
- for (node = list->root.next; node != &list->root; )
- {
- gl_list_node_t next = node->next;
- free (node);
- node = next;
- }
-#if WITH_HASHTABLE
- free (list->table);
-#endif
- free (list);
-}
-
-/* --------------------- gl_list_iterator_t Data Type --------------------- */
-
-static gl_list_iterator_t
-gl_linked_iterator (gl_list_t list)
-{
- gl_list_iterator_t result;
-
- result.vtable = list->base.vtable;
- result.list = list;
- result.p = list->root.next;
- result.q = &list->root;
-
- return result;
-}
-
-static gl_list_iterator_t
-gl_linked_iterator_from_to (gl_list_t list,
- size_t start_index, size_t end_index)
-{
- gl_list_iterator_t result;
- size_t n1, n2, n3;
-
- if (!(start_index <= end_index && end_index <= list->count))
- /* Invalid arguments. */
- abort ();
- result.vtable = list->base.vtable;
- result.list = list;
- n1 = start_index;
- n2 = end_index - start_index;
- n3 = list->count - end_index;
- /* Find the maximum among n1, n2, n3, so as to reduce the number of
- loop iterations to n1 + n2 + n3 - max(n1,n2,n3). */
- if (n1 > n2 && n1 > n3)
- {
- /* n1 is the maximum, use n2 and n3. */
- gl_list_node_t node;
- size_t i;
-
- node = &list->root;
- for (i = n3; i > 0; i--)
- node = node->prev;
- result.q = node;
- for (i = n2; i > 0; i--)
- node = node->prev;
- result.p = node;
- }
- else if (n2 > n3)
- {
- /* n2 is the maximum, use n1 and n3. */
- gl_list_node_t node;
- size_t i;
-
- node = list->root.next;
- for (i = n1; i > 0; i--)
- node = node->next;
- result.p = node;
-
- node = &list->root;
- for (i = n3; i > 0; i--)
- node = node->prev;
- result.q = node;
- }
- else
- {
- /* n3 is the maximum, use n1 and n2. */
- gl_list_node_t node;
- size_t i;
-
- node = list->root.next;
- for (i = n1; i > 0; i--)
- node = node->next;
- result.p = node;
- for (i = n2; i > 0; i--)
- node = node->next;
- result.q = node;
- }
-
- return result;
-}
-
-static bool
-gl_linked_iterator_next (gl_list_iterator_t *iterator,
- const void **eltp, gl_list_node_t *nodep)
-{
- if (iterator->p != iterator->q)
- {
- gl_list_node_t node = (gl_list_node_t) iterator->p;
- *eltp = node->value;
- if (nodep != NULL)
- *nodep = node;
- iterator->p = node->next;
- return true;
- }
- else
- return false;
-}
-
-static void
-gl_linked_iterator_free (gl_list_iterator_t *iterator)
-{
-}
-
-/* ---------------------- Sorted gl_list_t Data Type ---------------------- */
-
-static gl_list_node_t
-gl_linked_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar,
- const void *elt)
-{
- gl_list_node_t node;
-
- for (node = list->root.next; node != &list->root; node = node->next)
- {
- int cmp = compar (node->value, elt);
-
- if (cmp > 0)
- break;
- if (cmp == 0)
- return node;
- }
- return NULL;
-}
-
-static size_t
-gl_linked_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar,
- const void *elt)
-{
- gl_list_node_t node;
- size_t index;
-
- for (node = list->root.next, index = 0;
- node != &list->root;
- node = node->next, index++)
- {
- int cmp = compar (node->value, elt);
-
- if (cmp > 0)
- break;
- if (cmp == 0)
- return index;
- }
- return (size_t)(-1);
-}
-
-static gl_list_node_t
-gl_linked_sortedlist_add (gl_list_t list, gl_listelement_compar_fn compar,
- const void *elt)
-{
- gl_list_node_t node;
-
- for (node = list->root.next; node != &list->root; node = node->next)
- if (compar (node->value, elt) >= 0)
- return gl_linked_add_before (list, node, elt);
- return gl_linked_add_last (list, elt);
-}
-
-static bool
-gl_linked_sortedlist_remove (gl_list_t list, gl_listelement_compar_fn compar,
- const void *elt)
-{
- gl_list_node_t node;
-
- for (node = list->root.next; node != &list->root; node = node->next)
- {
- int cmp = compar (node->value, elt);
-
- if (cmp > 0)
- break;
- if (cmp == 0)
- return gl_linked_remove_node (list, node);
- }
- return false;
-}
+++ /dev/null
-/* Sequential list data type implemented by a hash table with a linked list.
- Copyright (C) 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2006.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "gl_linkedhash_list.h"
-
-#include <stdlib.h>
-
-#include "xalloc.h"
-#include "xsize.h"
-#include "size_max.h"
-
-#ifndef uintptr_t
-# define uintptr_t unsigned long
-#endif
-
-#define WITH_HASHTABLE 1
-
-/* -------------------------- gl_list_t Data Type -------------------------- */
-
-/* Generic hash-table code. */
-#include "gl_anyhash_list1.h"
-
-/* Generic linked list code. */
-#include "gl_anylinked_list1.h"
-
-/* Generic hash-table code. */
-#include "gl_anyhash_list2.h"
-
-/* Resize the hash table if needed, after list->count was incremented. */
-static inline void
-hash_resize_after_add (gl_list_t list)
-{
- size_t count = list->count;
- size_t estimate = xsum (count, count / 2); /* 1.5 * count */
- if (estimate > list->table_size)
- hash_resize (list, estimate);
-}
-
-/* Add a node to the hash table structure. */
-static inline void
-add_to_bucket (gl_list_t list, gl_list_node_t node)
-{
- size_t index = node->h.hashcode % list->table_size;
-
- node->h.hash_next = list->table[index];
- list->table[index] = &node->h;
-}
-
-/* Remove a node from the hash table structure. */
-static inline void
-remove_from_bucket (gl_list_t list, gl_list_node_t node)
-{
- size_t index = node->h.hashcode % list->table_size;
- gl_hash_entry_t *p;
-
- for (p = &list->table[index]; ; p = &(*p)->hash_next)
- {
- if (*p == &node->h)
- {
- *p = node->h.hash_next;
- break;
- }
- if (*p == NULL)
- /* node is not in the right bucket. Did the hash codes
- change inadvertently? */
- abort ();
- }
-}
-
-/* Generic linked list code. */
-#include "gl_anylinked_list2.h"
-
-
-const struct gl_list_implementation gl_linkedhash_list_implementation =
- {
- gl_linked_create_empty,
- gl_linked_create,
- gl_linked_size,
- gl_linked_node_value,
- gl_linked_next_node,
- gl_linked_previous_node,
- gl_linked_get_at,
- gl_linked_set_at,
- gl_linked_search,
- gl_linked_indexof,
- gl_linked_add_first,
- gl_linked_add_last,
- gl_linked_add_before,
- gl_linked_add_after,
- gl_linked_add_at,
- gl_linked_remove_node,
- gl_linked_remove_at,
- gl_linked_remove,
- gl_linked_list_free,
- gl_linked_iterator,
- gl_linked_iterator_from_to,
- gl_linked_iterator_next,
- gl_linked_iterator_free,
- gl_linked_sortedlist_search,
- gl_linked_sortedlist_indexof,
- gl_linked_sortedlist_add,
- gl_linked_sortedlist_remove
- };
+++ /dev/null
-/* Sequential list data type implemented by a hash table with a linked list.
- Copyright (C) 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2006.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _GL_LINKEDHASH_LIST_H
-#define _GL_LINKEDHASH_LIST_H
-
-#include "gl_list.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern const struct gl_list_implementation gl_linkedhash_list_implementation;
-#define GL_LINKEDHASH_LIST &gl_linkedhash_list_implementation
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GL_LINKEDHASH_LIST_H */
+++ /dev/null
-/* Abstract sequential list data type.
- Copyright (C) 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2006.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "gl_list.h"
-
-#if !HAVE_INLINE
-
-/* Define all functions of this file as inline accesses to the
- struct gl_list_implementation.
- Use #define to avoid a warning because of extern vs. static. */
-
-gl_list_t
-gl_list_create_empty (gl_list_implementation_t implementation,
- gl_listelement_equals_fn equals_fn,
- gl_listelement_hashcode_fn hashcode_fn,
- bool allow_duplicates)
-{
- return implementation->create_empty (implementation, equals_fn, hashcode_fn,
- allow_duplicates);
-}
-
-gl_list_t
-gl_list_create (gl_list_implementation_t implementation,
- gl_listelement_equals_fn equals_fn,
- gl_listelement_hashcode_fn hashcode_fn,
- bool allow_duplicates,
- size_t count, const void **contents)
-{
- return implementation->create (implementation, equals_fn, hashcode_fn,
- allow_duplicates, count, contents);
-}
-
-size_t
-gl_list_size (gl_list_t list)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->size (list);
-}
-
-const void *
-gl_list_node_value (gl_list_t list, gl_list_node_t node)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->node_value (list, node);
-}
-
-gl_list_node_t
-gl_list_next_node (gl_list_t list, gl_list_node_t node)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->next_node (list, node);
-}
-
-gl_list_node_t
-gl_list_previous_node (gl_list_t list, gl_list_node_t node)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->previous_node (list, node);
-}
-
-const void *
-gl_list_get_at (gl_list_t list, size_t position)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->get_at (list, position);
-}
-
-gl_list_node_t
-gl_list_set_at (gl_list_t list, size_t position, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->set_at (list, position, elt);
-}
-
-gl_list_node_t
-gl_list_search (gl_list_t list, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->search (list, elt);
-}
-
-size_t
-gl_list_indexof (gl_list_t list, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->indexof (list, elt);
-}
-
-gl_list_node_t
-gl_list_add_first (gl_list_t list, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->add_first (list, elt);
-}
-
-gl_list_node_t
-gl_list_add_last (gl_list_t list, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->add_last (list, elt);
-}
-
-gl_list_node_t
-gl_list_add_before (gl_list_t list, gl_list_node_t node, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->add_before (list, node, elt);
-}
-
-gl_list_node_t
-gl_list_add_after (gl_list_t list, gl_list_node_t node, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->add_after (list, node, elt);
-}
-
-gl_list_node_t
-gl_list_add_at (gl_list_t list, size_t position, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->add_at (list, position, elt);
-}
-
-bool
-gl_list_remove_node (gl_list_t list, gl_list_node_t node)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->remove_node (list, node);
-}
-
-bool
-gl_list_remove_at (gl_list_t list, size_t position)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->remove_at (list, position);
-}
-
-bool
-gl_list_remove (gl_list_t list, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->remove (list, elt);
-}
-
-void
-gl_list_free (gl_list_t list)
-{
- ((const struct gl_list_impl_base *) list)->vtable->list_free (list);
-}
-
-gl_list_iterator_t
-gl_list_iterator (gl_list_t list)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->iterator (list);
-}
-
-gl_list_iterator_t
-gl_list_iterator_from_to (gl_list_t list, size_t start_index, size_t end_index)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->iterator_from_to (list, start_index, end_index);
-}
-
-bool
-gl_list_iterator_next (gl_list_iterator_t *iterator,
- const void **eltp, gl_list_node_t *nodep)
-{
- return iterator->vtable->iterator_next (iterator, eltp, nodep);
-}
-
-void
-gl_list_iterator_free (gl_list_iterator_t *iterator)
-{
- iterator->vtable->iterator_free (iterator);
-}
-
-gl_list_node_t
-gl_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->sortedlist_search (list, compar, elt);
-}
-
-size_t
-gl_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->sortedlist_indexof (list, compar, elt);
-}
-
-gl_list_node_t
-gl_sortedlist_add (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->sortedlist_add (list, compar, elt);
-}
-
-bool
-gl_sortedlist_remove (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->sortedlist_remove (list, compar, elt);
-}
-
-#endif
+++ /dev/null
-/* Abstract sequential list data type.
- Copyright (C) 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2006.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _GL_LIST_H
-#define _GL_LIST_H
-
-#include <stdbool.h>
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* gl_list is an abstract list data type. It can contain any number of
- objects ('void *' or 'const void *' pointers) in any given order.
- Duplicates are allowed, but can optionally be forbidden.
-
- There are several implementations of this list datatype, optimized for
- different operations or for memory. You can start using the simplest list
- implementation, GL_ARRAY_LIST, and switch to a different implementation
- later, when you realize which operations are performed the most frequently.
- The API of the different implementations is exactly the same; when
- switching to a different implementation, you only have to change the
- gl_list_create call.
-
- The implementations are:
- GL_ARRAY_LIST a growable array
- GL_CARRAY_LIST a growable circular array
- GL_LINKED_LIST a linked list
- GL_AVLTREE_LIST a binary tree (AVL tree)
- GL_RBTREE_LIST a binary tree (red-black tree)
- GL_LINKEDHASH_LIST a hash table with a linked list
- GL_AVLTREEHASH_LIST a hash table with a binary tree (AVL tree)
- GL_RBTREEHASH_LIST a hash table with a binary tree (red-black tree)
-
- The memory consumption is asymptotically the same: O(1) for every object
- in the list. When looking more closely at the average memory consumed
- for an object, GL_ARRAY_LIST is the most compact representation, and
- GL_LINKEDHASH_LIST and GL_TREEHASH_LIST need more memory.
-
- The guaranteed average performance of the operations is, for a list of
- n elements:
-
- Operation ARRAY LINKED TREE LINKEDHASH TREEHASH
- CARRAY with|without with|without
- duplicates duplicates
-
- gl_list_size O(1) O(1) O(1) O(1) O(1)
- gl_list_node_value O(1) O(1) O(1) O(1) O(1)
- gl_list_next_node O(1) O(1) O(log n) O(1) O(log n)
- gl_list_previous_node O(1) O(1) O(log n) O(1) O(log n)
- gl_list_get_at O(1) O(n) O(log n) O(n) O(log n)
- gl_list_set_at O(1) O(n) O(log n) O(n) O((log n)²)/O(log n)
- gl_list_search O(n) O(n) O(n) O(n)/O(1) O(log n)/O(1)
- gl_list_indexof O(n) O(n) O(n) O(n) O(log n)
- gl_list_add_first O(n)/O(1) O(1) O(log n) O(1) O((log n)²)/O(log n)
- gl_list_add_last O(1) O(1) O(log n) O(1) O((log n)²)/O(log n)
- gl_list_add_before O(n) O(1) O(log n) O(1) O((log n)²)/O(log n)
- gl_list_add_after O(n) O(1) O(log n) O(1) O((log n)²)/O(log n)
- gl_list_add_at O(n) O(n) O(log n) O(n) O((log n)²)/O(log n)
- gl_list_remove_node O(n) O(1) O(log n) O(n)/O(1) O((log n)²)/O(log n)
- gl_list_remove_at O(n) O(n) O(log n) O(n) O((log n)²)/O(log n)
- gl_list_remove O(n) O(n) O(n) O(n)/O(1) O((log n)²)/O(log n)
- gl_list_iterator O(1) O(1) O(log n) O(1) O(log n)
- gl_list_iterator_from_to O(1) O(n) O(log n) O(n) O(log n)
- gl_list_iterator_next O(1) O(1) O(log n) O(1) O(log n)
- gl_sortedlist_search O(log n) O(n) O(log n) O(n) O(log n)
- gl_sortedlist_indexof O(log n) O(n) O(log n) O(n) O(log n)
- gl_sortedlist_add O(n) O(n) O(log n) O(n) O((log n)²)/O(log n)
- gl_sortedlist_remove O(n) O(n) O(log n) O(n) O((log n)²)/O(log n)
- */
-
-/* -------------------------- gl_list_t Data Type -------------------------- */
-
-/* Type of function used to compare two elements.
- NULL denotes pointer comparison. */
-typedef bool (*gl_listelement_equals_fn) (const void *elt1, const void *elt2);
-
-/* Type of function used to compute a hash code.
- NULL denotes a function that depends only on the pointer itself. */
-typedef size_t (*gl_listelement_hashcode_fn) (const void *elt);
-
-struct gl_list_impl;
-/* Type representing an entire list. */
-typedef struct gl_list_impl * gl_list_t;
-
-struct gl_list_node_impl;
-/* Type representing the position of an element in the list, in a way that
- is more adapted to the list implementation than a plain index.
- Note: It is invalidated by insertions and removals! */
-typedef struct gl_list_node_impl * gl_list_node_t;
-
-struct gl_list_implementation;
-/* Type representing a list datatype implementation. */
-typedef const struct gl_list_implementation * gl_list_implementation_t;
-
-/* Create an empty list.
- IMPLEMENTATION is one of GL_ARRAY_LIST, GL_CARRAY_LIST, GL_LINKED_LIST,
- GL_AVLTREE_LIST, GL_RBTREE_LIST, GL_LINKEDHASH_LIST, GL_AVLTREEHASH_LIST,
- GL_RBTREEHASH_LIST.
- EQUALS_FN is an element comparison function or NULL.
- HASHCODE_FN is an element hash code function or NULL.
- ALLOW_DUPLICATES is false if duplicate elements shall not be allowed in
- the list. The implementation may verify this at runtime. */
-extern gl_list_t gl_list_create_empty (gl_list_implementation_t implementation,
- gl_listelement_equals_fn equals_fn,
- gl_listelement_hashcode_fn hashcode_fn,
- bool allow_duplicates);
-
-/* Create a list with given contents.
- IMPLEMENTATION is one of GL_ARRAY_LIST, GL_CARRAY_LIST, GL_LINKED_LIST,
- GL_AVLTREE_LIST, GL_RBTREE_LIST, GL_LINKEDHASH_LIST, GL_AVLTREEHASH_LIST,
- GL_RBTREEHASH_LIST.
- EQUALS_FN is an element comparison function or NULL.
- HASHCODE_FN is an element hash code function or NULL.
- ALLOW_DUPLICATES is false if duplicate elements shall not be allowed in
- the list. The implementation may verify this at runtime.
- COUNT is the number of initial elements.
- CONTENTS[0..COUNT-1] is the initial contents. */
-extern gl_list_t gl_list_create (gl_list_implementation_t implementation,
- gl_listelement_equals_fn equals_fn,
- gl_listelement_hashcode_fn hashcode_fn,
- bool allow_duplicates,
- size_t count, const void **contents);
-
-/* Return the current number of elements in a list. */
-extern size_t gl_list_size (gl_list_t list);
-
-/* Return the element value represented by a list node. */
-extern const void * gl_list_node_value (gl_list_t list, gl_list_node_t node);
-
-/* Return the node immediately after the given node in the list, or NULL
- if the given node is the last (rightmost) one in the list. */
-extern gl_list_node_t gl_list_next_node (gl_list_t list, gl_list_node_t node);
-
-/* Return the node immediately before the given node in the list, or NULL
- if the given node is the first (leftmost) one in the list. */
-extern gl_list_node_t gl_list_previous_node (gl_list_t list, gl_list_node_t node);
-
-/* Return the element at a given position in the list.
- POSITION must be >= 0 and < gl_list_size (list). */
-extern const void * gl_list_get_at (gl_list_t list, size_t position);
-
-/* Replace the element at a given position in the list.
- POSITION must be >= 0 and < gl_list_size (list).
- Return its node. */
-extern gl_list_node_t gl_list_set_at (gl_list_t list, size_t position,
- const void *elt);
-
-/* Search whether an element is already in the list.
- Return its node if found, or NULL if not present in the list. */
-extern gl_list_node_t gl_list_search (gl_list_t list, const void *elt);
-
-/* Search whether an element is already in the list.
- Return its position if found, or (size_t)(-1) if not present in the list. */
-extern size_t gl_list_indexof (gl_list_t list, const void *elt);
-
-/* Add an element as the first element of the list.
- Return its node. */
-extern gl_list_node_t gl_list_add_first (gl_list_t list, const void *elt);
-
-/* Add an element as the last element of the list.
- Return its node. */
-extern gl_list_node_t gl_list_add_last (gl_list_t list, const void *elt);
-
-/* Add an element before a given element node of the list.
- Return its node. */
-extern gl_list_node_t gl_list_add_before (gl_list_t list, gl_list_node_t node,
- const void *elt);
-
-/* Add an element after a given element node of the list.
- Return its node. */
-extern gl_list_node_t gl_list_add_after (gl_list_t list, gl_list_node_t node,
- const void *elt);
-
-/* Add an element add a given position in the list.
- POSITION must be >= 0 and <= gl_list_size (list). */
-extern gl_list_node_t gl_list_add_at (gl_list_t list, size_t position,
- const void *elt);
-
-/* Remove an element from the list.
- Return true. */
-extern bool gl_list_remove_node (gl_list_t list, gl_list_node_t node);
-
-/* Remove an element at a given position from the list.
- POSITION must be >= 0 and < gl_list_size (list).
- Return true. */
-extern bool gl_list_remove_at (gl_list_t list, size_t position);
-
-/* Search and remove an element from the list.
- Return true if it was found and removed. */
-extern bool gl_list_remove (gl_list_t list, const void *elt);
-
-/* Free an entire list.
- (But this call does not free the elements of the list.) */
-extern void gl_list_free (gl_list_t list);
-
-/* --------------------- gl_list_iterator_t Data Type --------------------- */
-
-/* Functions for iterating through a list. */
-
-/* Type of an iterator that traverses a list.
- This is a fixed-size struct, so that creation of an iterator doesn't need
- memory allocation on the heap. */
-typedef struct
-{
- /* For fast dispatch of gl_list_iterator_next. */
- const struct gl_list_implementation *vtable;
- /* For detecting whether the last returned element was removed. */
- gl_list_t list;
- size_t count;
- /* Other, implementation-private fields. */
- void *p; void *q;
- size_t i; size_t j;
-} gl_list_iterator_t;
-
-/* Create an iterator traversing a list.
- The list contents must not be modified while the iterator is in use,
- except for replacing or removing the last returned element. */
-extern gl_list_iterator_t gl_list_iterator (gl_list_t list);
-
-/* Create an iterator traversing the element with indices i,
- start_index <= i < end_index, of a list.
- The list contents must not be modified while the iterator is in use,
- except for replacing or removing the last returned element. */
-extern gl_list_iterator_t gl_list_iterator_from_to (gl_list_t list,
- size_t start_index,
- size_t end_index);
-
-/* If there is a next element, store the next element in *ELTP, store its
- node in *NODEP if NODEP is non-NULL, advance the iterator and return true.
- Otherwise, return false. */
-extern bool gl_list_iterator_next (gl_list_iterator_t *iterator,
- const void **eltp, gl_list_node_t *nodep);
-
-/* Free an iterator. */
-extern void gl_list_iterator_free (gl_list_iterator_t *iterator);
-
-/* ---------------------- Sorted gl_list_t Data Type ---------------------- */
-
-/* The following functions are for lists without duplicates where the
- order is given by a sort criterion. */
-
-/* Type of function used to compare two elements. Same as for qsort().
- NULL denotes pointer comparison. */
-typedef int (*gl_listelement_compar_fn) (const void *elt1, const void *elt2);
-
-/* Search whether an element is already in the list.
- The list is assumed to be sorted with COMPAR.
- Return its node if found, or NULL if not present in the list.
- If the list contains several copies of ELT, the node of the leftmost one is
- returned. */
-extern gl_list_node_t gl_sortedlist_search (gl_list_t list,
- gl_listelement_compar_fn compar,
- const void *elt);
-
-/* Search whether an element is already in the list.
- The list is assumed to be sorted with COMPAR.
- Return its position if found, or (size_t)(-1) if not present in the list.
- If the list contains several copies of ELT, the position of the leftmost one
- is returned. */
-extern size_t gl_sortedlist_indexof (gl_list_t list,
- gl_listelement_compar_fn compar,
- const void *elt);
-
-/* Add an element at the appropriate position in the list.
- The list is assumed to be sorted with COMPAR.
- Return its node. */
-extern gl_list_node_t gl_sortedlist_add (gl_list_t list,
- gl_listelement_compar_fn compar,
- const void *elt);
-
-/* Search and remove an element from the list.
- The list is assumed to be sorted with COMPAR.
- Return true if it was found and removed.
- If the list contains several copies of ELT, only the leftmost one is
- removed. */
-extern bool gl_sortedlist_remove (gl_list_t list,
- gl_listelement_compar_fn compar,
- const void *elt);
-
-/* ------------------------ Implementation Details ------------------------ */
-
-struct gl_list_implementation
-{
- // gl_list_t functions.
- gl_list_t (*create_empty) (gl_list_implementation_t implementation,
- gl_listelement_equals_fn equals_fn,
- gl_listelement_hashcode_fn hashcode_fn,
- bool allow_duplicates);
- gl_list_t (*create) (gl_list_implementation_t implementation,
- gl_listelement_equals_fn equals_fn,
- gl_listelement_hashcode_fn hashcode_fn,
- bool allow_duplicates,
- size_t count, const void **contents);
- size_t (*size) (gl_list_t list);
- const void * (*node_value) (gl_list_t list, gl_list_node_t node);
- gl_list_node_t (*next_node) (gl_list_t list, gl_list_node_t node);
- gl_list_node_t (*previous_node) (gl_list_t list, gl_list_node_t node);
- const void * (*get_at) (gl_list_t list, size_t position);
- gl_list_node_t (*set_at) (gl_list_t list, size_t position, const void *elt);
- gl_list_node_t (*search) (gl_list_t list, const void *elt);
- size_t (*indexof) (gl_list_t list, const void *elt);
- gl_list_node_t (*add_first) (gl_list_t list, const void *elt);
- gl_list_node_t (*add_last) (gl_list_t list, const void *elt);
- gl_list_node_t (*add_before) (gl_list_t list, gl_list_node_t node,
- const void *elt);
- gl_list_node_t (*add_after) (gl_list_t list, gl_list_node_t node,
- const void *elt);
- gl_list_node_t (*add_at) (gl_list_t list, size_t position,
- const void *elt);
- bool (*remove_node) (gl_list_t list, gl_list_node_t node);
- bool (*remove_at) (gl_list_t list, size_t position);
- bool (*remove) (gl_list_t list, const void *elt);
- void (*list_free) (gl_list_t list);
- // gl_list_iterator_t functions.
- gl_list_iterator_t (*iterator) (gl_list_t list);
- gl_list_iterator_t (*iterator_from_to) (gl_list_t list,
- size_t start_index,
- size_t end_index);
- bool (*iterator_next) (gl_list_iterator_t *iterator,
- const void **eltp, gl_list_node_t *nodep);
- void (*iterator_free) (gl_list_iterator_t *iterator);
- // Sorted gl_list_t functions.
- gl_list_node_t (*sortedlist_search) (gl_list_t list,
- gl_listelement_compar_fn compar,
- const void *elt);
- size_t (*sortedlist_indexof) (gl_list_t list,
- gl_listelement_compar_fn compar,
- const void *elt);
- gl_list_node_t (*sortedlist_add) (gl_list_t list,
- gl_listelement_compar_fn compar,
- const void *elt);
- bool (*sortedlist_remove) (gl_list_t list,
- gl_listelement_compar_fn compar,
- const void *elt);
-};
-
-struct gl_list_impl_base
-{
- const struct gl_list_implementation *vtable;
- gl_listelement_equals_fn equals_fn;
- gl_listelement_hashcode_fn hashcode_fn;
- bool allow_duplicates;
-};
-
-#if HAVE_INLINE
-
-/* Define all functions of this file as inline accesses to the
- struct gl_list_implementation.
- Use #define to avoid a warning because of extern vs. static. */
-
-# define gl_list_create_empty gl_list_create_empty_inline
-static inline gl_list_t
-gl_list_create_empty (gl_list_implementation_t implementation,
- gl_listelement_equals_fn equals_fn,
- gl_listelement_hashcode_fn hashcode_fn,
- bool allow_duplicates)
-{
- return implementation->create_empty (implementation, equals_fn, hashcode_fn,
- allow_duplicates);
-}
-
-# define gl_list_create gl_list_create_inline
-static inline gl_list_t
-gl_list_create (gl_list_implementation_t implementation,
- gl_listelement_equals_fn equals_fn,
- gl_listelement_hashcode_fn hashcode_fn,
- bool allow_duplicates,
- size_t count, const void **contents)
-{
- return implementation->create (implementation, equals_fn, hashcode_fn,
- allow_duplicates, count, contents);
-}
-
-# define gl_list_size gl_list_size_inline
-static inline size_t
-gl_list_size (gl_list_t list)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->size (list);
-}
-
-# define gl_list_node_value gl_list_node_value_inline
-static inline const void *
-gl_list_node_value (gl_list_t list, gl_list_node_t node)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->node_value (list, node);
-}
-
-# define gl_list_next_node gl_list_next_node_inline
-static inline gl_list_node_t
-gl_list_next_node (gl_list_t list, gl_list_node_t node)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->next_node (list, node);
-}
-
-# define gl_list_previous_node gl_list_previous_node_inline
-static inline gl_list_node_t
-gl_list_previous_node (gl_list_t list, gl_list_node_t node)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->previous_node (list, node);
-}
-
-# define gl_list_get_at gl_list_get_at_inline
-static inline const void *
-gl_list_get_at (gl_list_t list, size_t position)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->get_at (list, position);
-}
-
-# define gl_list_set_at gl_list_set_at_inline
-static inline gl_list_node_t
-gl_list_set_at (gl_list_t list, size_t position, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->set_at (list, position, elt);
-}
-
-# define gl_list_search gl_list_search_inline
-static inline gl_list_node_t
-gl_list_search (gl_list_t list, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->search (list, elt);
-}
-
-# define gl_list_indexof gl_list_indexof_inline
-static inline size_t
-gl_list_indexof (gl_list_t list, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->indexof (list, elt);
-}
-
-# define gl_list_add_first gl_list_add_first_inline
-static inline gl_list_node_t
-gl_list_add_first (gl_list_t list, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->add_first (list, elt);
-}
-
-# define gl_list_add_last gl_list_add_last_inline
-static inline gl_list_node_t
-gl_list_add_last (gl_list_t list, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->add_last (list, elt);
-}
-
-# define gl_list_add_before gl_list_add_before_inline
-static inline gl_list_node_t
-gl_list_add_before (gl_list_t list, gl_list_node_t node, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->add_before (list, node, elt);
-}
-
-# define gl_list_add_after gl_list_add_after_inline
-static inline gl_list_node_t
-gl_list_add_after (gl_list_t list, gl_list_node_t node, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->add_after (list, node, elt);
-}
-
-# define gl_list_add_at gl_list_add_at_inline
-static inline gl_list_node_t
-gl_list_add_at (gl_list_t list, size_t position, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->add_at (list, position, elt);
-}
-
-# define gl_list_remove_node gl_list_remove_node_inline
-static inline bool
-gl_list_remove_node (gl_list_t list, gl_list_node_t node)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->remove_node (list, node);
-}
-
-# define gl_list_remove_at gl_list_remove_at_inline
-static inline bool
-gl_list_remove_at (gl_list_t list, size_t position)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->remove_at (list, position);
-}
-
-# define gl_list_remove gl_list_remove_inline
-static inline bool
-gl_list_remove (gl_list_t list, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->remove (list, elt);
-}
-
-# define gl_list_free gl_list_free_inline
-static inline void
-gl_list_free (gl_list_t list)
-{
- ((const struct gl_list_impl_base *) list)->vtable->list_free (list);
-}
-
-# define gl_list_iterator gl_list_iterator_inline
-static inline gl_list_iterator_t
-gl_list_iterator (gl_list_t list)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->iterator (list);
-}
-
-# define gl_list_iterator_from_to gl_list_iterator_from_to_inline
-static inline gl_list_iterator_t
-gl_list_iterator_from_to (gl_list_t list, size_t start_index, size_t end_index)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->iterator_from_to (list, start_index, end_index);
-}
-
-# define gl_list_iterator_next gl_list_iterator_next_inline
-static inline bool
-gl_list_iterator_next (gl_list_iterator_t *iterator,
- const void **eltp, gl_list_node_t *nodep)
-{
- return iterator->vtable->iterator_next (iterator, eltp, nodep);
-}
-
-# define gl_list_iterator_free gl_list_iterator_free_inline
-static inline void
-gl_list_iterator_free (gl_list_iterator_t *iterator)
-{
- iterator->vtable->iterator_free (iterator);
-}
-
-# define gl_sortedlist_search gl_sortedlist_search_inline
-static inline gl_list_node_t
-gl_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->sortedlist_search (list, compar, elt);
-}
-
-# define gl_sortedlist_indexof gl_sortedlist_indexof_inline
-static inline size_t
-gl_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->sortedlist_indexof (list, compar, elt);
-}
-
-# define gl_sortedlist_add gl_sortedlist_add_inline
-static inline gl_list_node_t
-gl_sortedlist_add (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->sortedlist_add (list, compar, elt);
-}
-
-# define gl_sortedlist_remove gl_sortedlist_remove_inline
-static inline bool
-gl_sortedlist_remove (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
-{
- return ((const struct gl_list_impl_base *) list)->vtable
- ->sortedlist_remove (list, compar, elt);
-}
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GL_LIST_H */
+++ /dev/null
-/* Compile a Java program.
- Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include <alloca.h>
-
-/* Specification. */
-#include "javacomp.h"
-
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "javaversion.h"
-#include "execute.h"
-#include "pipe.h"
-#include "wait-process.h"
-#include "classpath.h"
-#include "xsetenv.h"
-#include "sh-quote.h"
-#include "binary-io.h"
-#include "safe-read.h"
-#include "xalloc.h"
-#include "xallocsa.h"
-#include "getline.h"
-#include "pathname.h"
-#include "fwriteerror.h"
-#include "clean-temp.h"
-#include "error.h"
-#include "xvasprintf.h"
-#include "c-strstr.h"
-#include "gettext.h"
-
-#define _(str) gettext (str)
-
-
-/* Survey of Java compilers.
-
- A = does it work without CLASSPATH being set
- C = option to set CLASSPATH, other than setting it in the environment
- O = option for optimizing
- g = option for debugging
- T = test for presence
-
- Program from A C O g T
-
- $JAVAC unknown N n/a -O -g true
- gcj -C GCC 3.2 Y --classpath=P -O -g gcj --version | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^3\.[01]/d' | grep '^[3-9]' >/dev/null
- javac JDK 1.1.8 Y -classpath P -O -g javac 2>/dev/null; test $? = 1
- javac JDK 1.3.0 Y -classpath P -O -g javac 2>/dev/null; test $? -le 2
- jikes Jikes 1.14 N -classpath P -O -g jikes 2>/dev/null; test $? = 1
-
- All compilers support the option "-d DIRECTORY" for the base directory
- of the classes to be written.
-
- The CLASSPATH is a colon separated list of pathnames. (On Windows: a
- semicolon separated list of pathnames.)
-
- We try the Java compilers in the following order:
- 1. getenv ("JAVAC"), because the user must be able to override our
- preferences,
- 2. "gcj -C", because it is a completely free compiler,
- 3. "javac", because it is a standard compiler,
- 4. "jikes", comes last because it has some deviating interpretation
- of the Java Language Specification and because it requires a
- CLASSPATH environment variable.
-
- We unset the JAVA_HOME environment variable, because a wrong setting of
- this variable can confuse the JDK's javac.
- */
-
-/* Return the default target_version. */
-static const char *
-default_target_version (void)
-{
- /* Use a cache. Assumes that the PATH environment variable doesn't change
- during the lifetime of the program. */
- static const char *java_version_cache;
- if (java_version_cache == NULL)
- {
- /* Determine the version from the found JVM. */
- java_version_cache = javaexec_version ();
- if (java_version_cache == NULL
- || !(java_version_cache[0] == '1' && java_version_cache[1] == '.'
- && (java_version_cache[2] >= '1' && java_version_cache[2] <= '6')
- && java_version_cache[3] == '\0'))
- java_version_cache = "1.1";
- }
- return java_version_cache;
-}
-
-/* ======================= Source version dependent ======================= */
-
-/* Convert a source version to an index. */
-#define SOURCE_VERSION_BOUND 3 /* exclusive upper bound */
-static unsigned int
-source_version_index (const char *source_version)
-{
- if (source_version[0] == '1' && source_version[1] == '.'
- && (source_version[2] >= '3' && source_version[2] <= '5')
- && source_version[3] == '\0')
- return source_version[2] - '3';
- error (EXIT_FAILURE, 0, _("invalid source_version argument to compile_java_class"));
- return 0;
-}
-
-/* Return a snippet of code that should compile in the given source version. */
-static const char *
-get_goodcode_snippet (const char *source_version)
-{
- if (strcmp (source_version, "1.3") == 0)
- return "class conftest {}\n";
- if (strcmp (source_version, "1.4") == 0)
- return "class conftest { static { assert(true); } }\n";
- if (strcmp (source_version, "1.5") == 0)
- return "class conftest<T> { T foo() { return null; } }\n";
- error (EXIT_FAILURE, 0, _("invalid source_version argument to compile_java_class"));
- return NULL;
-}
-
-/* Return a snippet of code that should fail to compile in the given source
- version, or NULL (standing for a snippet that would fail to compile with
- any compiler). */
-static const char *
-get_failcode_snippet (const char *source_version)
-{
- if (strcmp (source_version, "1.3") == 0)
- return "class conftestfail { static { assert(true); } }\n";
- if (strcmp (source_version, "1.4") == 0)
- return "class conftestfail<T> { T foo() { return null; } }\n";
- if (strcmp (source_version, "1.5") == 0)
- return NULL;
- error (EXIT_FAILURE, 0, _("invalid source_version argument to compile_java_class"));
- return NULL;
-}
-
-/* ======================= Target version dependent ======================= */
-
-/* Convert a target version to an index. */
-#define TARGET_VERSION_BOUND 6 /* exclusive upper bound */
-static unsigned int
-target_version_index (const char *target_version)
-{
- if (target_version[0] == '1' && target_version[1] == '.'
- && (target_version[2] >= '1' && target_version[2] <= '6')
- && target_version[3] == '\0')
- return target_version[2] - '1';
- error (EXIT_FAILURE, 0, _("invalid target_version argument to compile_java_class"));
- return 0;
-}
-
-/* Return the class file version number corresponding to a given target
- version. */
-static int
-corresponding_classfile_version (const char *target_version)
-{
- if (strcmp (target_version, "1.1") == 0)
- return 45;
- if (strcmp (target_version, "1.2") == 0)
- return 46;
- if (strcmp (target_version, "1.3") == 0)
- return 47;
- if (strcmp (target_version, "1.4") == 0)
- return 48;
- if (strcmp (target_version, "1.5") == 0)
- return 49;
- if (strcmp (target_version, "1.6") == 0)
- return 50;
- error (EXIT_FAILURE, 0, _("invalid target_version argument to compile_java_class"));
- return 0;
-}
-
-/* ======================== Compilation subroutines ======================== */
-
-/* Try to compile a set of Java sources with $JAVAC.
- Return a failure indicator (true upon error). */
-static bool
-compile_using_envjavac (const char *javac,
- const char * const *java_sources,
- unsigned int java_sources_count,
- const char *directory,
- bool optimize, bool debug,
- bool verbose, bool null_stderr)
-{
- /* Because $JAVAC may consist of a command and options, we use the
- shell. Because $JAVAC has been set by the user, we leave all
- environment variables in place, including JAVA_HOME, and we don't
- erase the user's CLASSPATH. */
- bool err;
- unsigned int command_length;
- char *command;
- char *argv[4];
- int exitstatus;
- unsigned int i;
- char *p;
-
- command_length = strlen (javac);
- if (optimize)
- command_length += 3;
- if (debug)
- command_length += 3;
- if (directory != NULL)
- command_length += 4 + shell_quote_length (directory);
- for (i = 0; i < java_sources_count; i++)
- command_length += 1 + shell_quote_length (java_sources[i]);
- command_length += 1;
-
- command = (char *) xallocsa (command_length);
- p = command;
- /* Don't shell_quote $JAVAC, because it may consist of a command
- and options. */
- memcpy (p, javac, strlen (javac));
- p += strlen (javac);
- if (optimize)
- {
- memcpy (p, " -O", 3);
- p += 3;
- }
- if (debug)
- {
- memcpy (p, " -g", 3);
- p += 3;
- }
- if (directory != NULL)
- {
- memcpy (p, " -d ", 4);
- p += 4;
- p = shell_quote_copy (p, directory);
- }
- for (i = 0; i < java_sources_count; i++)
- {
- *p++ = ' ';
- p = shell_quote_copy (p, java_sources[i]);
- }
- *p++ = '\0';
- /* Ensure command_length was correctly calculated. */
- if (p - command > command_length)
- abort ();
-
- if (verbose)
- printf ("%s\n", command);
-
- argv[0] = "/bin/sh";
- argv[1] = "-c";
- argv[2] = command;
- argv[3] = NULL;
- exitstatus = execute (javac, "/bin/sh", argv, false, false, false,
- null_stderr, true, true);
- err = (exitstatus != 0);
-
- freesa (command);
-
- return err;
-}
-
-/* Try to compile a set of Java sources with gcj.
- Return a failure indicator (true upon error). */
-static bool
-compile_using_gcj (const char * const *java_sources,
- unsigned int java_sources_count,
- bool no_assert_option,
- const char *directory,
- bool optimize, bool debug,
- bool verbose, bool null_stderr)
-{
- bool err;
- unsigned int argc;
- char **argv;
- char **argp;
- int exitstatus;
- unsigned int i;
-
- argc =
- 2 + (no_assert_option ? 1 : 0) + (optimize ? 1 : 0) + (debug ? 1 : 0)
- + (directory != NULL ? 2 : 0) + java_sources_count;
- argv = (char **) xallocsa ((argc + 1) * sizeof (char *));
-
- argp = argv;
- *argp++ = "gcj";
- *argp++ = "-C";
- if (no_assert_option)
- *argp++ = "-fno-assert";
- if (optimize)
- *argp++ = "-O";
- if (debug)
- *argp++ = "-g";
- if (directory != NULL)
- {
- *argp++ = "-d";
- *argp++ = (char *) directory;
- }
- for (i = 0; i < java_sources_count; i++)
- *argp++ = (char *) java_sources[i];
- *argp = NULL;
- /* Ensure argv length was correctly calculated. */
- if (argp - argv != argc)
- abort ();
-
- if (verbose)
- {
- char *command = shell_quote_argv (argv);
- printf ("%s\n", command);
- free (command);
- }
-
- exitstatus = execute ("gcj", "gcj", argv, false, false, false, null_stderr,
- true, true);
- err = (exitstatus != 0);
-
- freesa (argv);
-
- return err;
-}
-
-/* Try to compile a set of Java sources with javac.
- Return a failure indicator (true upon error). */
-static bool
-compile_using_javac (const char * const *java_sources,
- unsigned int java_sources_count,
- bool source_option, const char *source_version,
- bool target_option, const char *target_version,
- const char *directory,
- bool optimize, bool debug,
- bool verbose, bool null_stderr)
-{
- bool err;
- unsigned int argc;
- char **argv;
- char **argp;
- int exitstatus;
- unsigned int i;
-
- argc =
- 1 + (source_option ? 2 : 0) + (target_option ? 2 : 0) + (optimize ? 1 : 0)
- + (debug ? 1 : 0) + (directory != NULL ? 2 : 0) + java_sources_count;
- argv = (char **) xallocsa ((argc + 1) * sizeof (char *));
-
- argp = argv;
- *argp++ = "javac";
- if (source_option)
- {
- *argp++ = "-source";
- *argp++ = (char *) source_version;
- }
- if (target_option)
- {
- *argp++ = "-target";
- *argp++ = (char *) target_version;
- }
- if (optimize)
- *argp++ = "-O";
- if (debug)
- *argp++ = "-g";
- if (directory != NULL)
- {
- *argp++ = "-d";
- *argp++ = (char *) directory;
- }
- for (i = 0; i < java_sources_count; i++)
- *argp++ = (char *) java_sources[i];
- *argp = NULL;
- /* Ensure argv length was correctly calculated. */
- if (argp - argv != argc)
- abort ();
-
- if (verbose)
- {
- char *command = shell_quote_argv (argv);
- printf ("%s\n", command);
- free (command);
- }
-
- exitstatus = execute ("javac", "javac", argv, false, false, false,
- null_stderr, true, true);
- err = (exitstatus != 0);
-
- freesa (argv);
-
- return err;
-}
-
-/* Try to compile a set of Java sources with jikes.
- Return a failure indicator (true upon error). */
-static bool
-compile_using_jikes (const char * const *java_sources,
- unsigned int java_sources_count,
- const char *directory,
- bool optimize, bool debug,
- bool verbose, bool null_stderr)
-{
- bool err;
- unsigned int argc;
- char **argv;
- char **argp;
- int exitstatus;
- unsigned int i;
-
- argc =
- 1 + (optimize ? 1 : 0) + (debug ? 1 : 0) + (directory != NULL ? 2 : 0)
- + java_sources_count;
- argv = (char **) xallocsa ((argc + 1) * sizeof (char *));
-
- argp = argv;
- *argp++ = "jikes";
- if (optimize)
- *argp++ = "-O";
- if (debug)
- *argp++ = "-g";
- if (directory != NULL)
- {
- *argp++ = "-d";
- *argp++ = (char *) directory;
- }
- for (i = 0; i < java_sources_count; i++)
- *argp++ = (char *) java_sources[i];
- *argp = NULL;
- /* Ensure argv length was correctly calculated. */
- if (argp - argv != argc)
- abort ();
-
- if (verbose)
- {
- char *command = shell_quote_argv (argv);
- printf ("%s\n", command);
- free (command);
- }
-
- exitstatus = execute ("jikes", "jikes", argv, false, false, false,
- null_stderr, true, true);
- err = (exitstatus != 0);
-
- freesa (argv);
-
- return err;
-}
-
-/* ====================== Usability test subroutines ====================== */
-
-/* Write a given contents to a temporary file.
- FILE_NAME is the name of a file inside TMPDIR that is known not to exist
- yet.
- Return a failure indicator (true upon error). */
-static bool
-write_temp_file (struct temp_dir *tmpdir, const char *file_name,
- const char *contents)
-{
- FILE *fp;
-
- register_temp_file (tmpdir, file_name);
- fp = fopen (file_name, "w");
- if (fp == NULL)
- {
- error (0, errno, _("failed to create \"%s\""), file_name);
- unregister_temp_file (tmpdir, file_name);
- return true;
- }
- fputs (contents, fp);
- if (fwriteerror (fp))
- {
- error (0, errno, _("error while writing \"%s\" file"), file_name);
- return true;
- }
- return false;
-}
-
-/* Return the class file version number of a class file on disk. */
-static int
-get_classfile_version (const char *compiled_file_name)
-{
- unsigned char header[8];
- int fd;
-
- /* Open the class file. */
- fd = open (compiled_file_name, O_RDONLY | O_BINARY, 0);
- if (fd >= 0)
- {
- /* Read its first 8 bytes. */
- if (safe_read (fd, header, 8) == 8)
- {
- /* Verify the class file signature. */
- if (header[0] == 0xCA && header[1] == 0xFE
- && header[2] == 0xBA && header[3] == 0xBE)
- return header[7];
- }
- close (fd);
- }
-
- /* Could not get the class file version. Return a very large one. */
- return INT_MAX;
-}
-
-/* Return true if $JAVAC is a version of gcj. */
-static bool
-is_envjavac_gcj (const char *javac)
-{
- static bool envjavac_tested;
- static bool envjavac_gcj;
-
- if (!envjavac_tested)
- {
- /* Test whether $JAVAC is gcj:
- "$JAVAC --version 2>/dev/null | sed -e 1q | grep gcj > /dev/null" */
- unsigned int command_length;
- char *command;
- char *argv[4];
- pid_t child;
- int fd[1];
- FILE *fp;
- char *line;
- size_t linesize;
- size_t linelen;
- int exitstatus;
- char *p;
-
- /* Setup the command "$JAVAC --version". */
- command_length = strlen (javac) + 1 + 9 + 1;
- command = (char *) xallocsa (command_length);
- p = command;
- /* Don't shell_quote $JAVAC, because it may consist of a command
- and options. */
- memcpy (p, javac, strlen (javac));
- p += strlen (javac);
- memcpy (p, " --version", 1 + 9 + 1);
- p += 1 + 9 + 1;
- /* Ensure command_length was correctly calculated. */
- if (p - command > command_length)
- abort ();
-
- /* Call $JAVAC --version 2>/dev/null. */
- argv[0] = "/bin/sh";
- argv[1] = "-c";
- argv[2] = command;
- argv[3] = NULL;
- child = create_pipe_in (javac, "/bin/sh", argv, DEV_NULL, true, true,
- false, fd);
- if (child == -1)
- goto failed;
-
- /* Retrieve its result. */
- fp = fdopen (fd[0], "r");
- if (fp == NULL)
- goto failed;
-
- line = NULL; linesize = 0;
- linelen = getline (&line, &linesize, fp);
- if (linelen == (size_t)(-1))
- {
- fclose (fp);
- goto failed;
- }
- envjavac_gcj = (c_strstr (line, "gcj") != NULL);
-
- fclose (fp);
-
- /* Remove zombie process from process list, and retrieve exit status. */
- exitstatus = wait_subprocess (child, javac, true, true, true, false);
- if (exitstatus != 0)
- envjavac_gcj = false;
-
- failed:
- freesa (command);
-
- envjavac_tested = true;
- }
-
- return envjavac_gcj;
-}
-
-/* Test whether $JAVAC, known to be a version of gcj, can be used for
- compiling with target_version = 1.4 and source_version = 1.4.
- Return a failure indicator (true upon error). */
-static bool
-is_envjavac_gcj_14_14_usable (const char *javac, bool *usablep)
-{
- static bool envjavac_tested;
- static bool envjavac_usable;
-
- if (!envjavac_tested)
- {
- /* Try $JAVAC. */
- struct temp_dir *tmpdir;
- char *conftest_file_name;
- char *compiled_file_name;
- const char *java_sources[1];
- struct stat statbuf;
-
- tmpdir = create_temp_dir ("java", NULL, false);
- if (tmpdir == NULL)
- return true;
-
- conftest_file_name =
- concatenated_pathname (tmpdir->dir_name, "conftest.java", NULL);
- if (write_temp_file (tmpdir, conftest_file_name,
- get_goodcode_snippet ("1.4")))
- {
- free (conftest_file_name);
- cleanup_temp_dir (tmpdir);
- return true;
- }
-
- compiled_file_name =
- concatenated_pathname (tmpdir->dir_name, "conftest.class", NULL);
- register_temp_file (tmpdir, compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_envjavac (javac, java_sources, 1, tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0)
- /* Compilation succeeded. */
- envjavac_usable = true;
-
- free (compiled_file_name);
- free (conftest_file_name);
-
- cleanup_temp_dir (tmpdir);
-
- envjavac_tested = true;
- }
-
- *usablep = envjavac_usable;
- return false;
-}
-
-/* Test whether $JAVAC, known to be a version of gcj, can be used for
- compiling with target_version = 1.4 and source_version = 1.3.
- Return a failure indicator (true upon error). */
-static bool
-is_envjavac_gcj_14_13_usable (const char *javac,
- bool *usablep, bool *need_no_assert_option_p)
-{
- static bool envjavac_tested;
- static bool envjavac_usable;
- static bool envjavac_need_no_assert_option;
-
- if (!envjavac_tested)
- {
- /* Try $JAVAC and "$JAVAC -fno-assert". But add -fno-assert only if
- it makes a difference. (It could already be part of $JAVAC.) */
- struct temp_dir *tmpdir;
- char *conftest_file_name;
- char *compiled_file_name;
- const char *java_sources[1];
- struct stat statbuf;
- bool javac_works;
- char *javac_noassert;
- bool javac_noassert_works;
-
- tmpdir = create_temp_dir ("java", NULL, false);
- if (tmpdir == NULL)
- return true;
-
- conftest_file_name =
- concatenated_pathname (tmpdir->dir_name, "conftest.java", NULL);
- if (write_temp_file (tmpdir, conftest_file_name,
- get_goodcode_snippet ("1.3")))
- {
- free (conftest_file_name);
- cleanup_temp_dir (tmpdir);
- return true;
- }
-
- compiled_file_name =
- concatenated_pathname (tmpdir->dir_name, "conftest.class", NULL);
- register_temp_file (tmpdir, compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_envjavac (javac,
- java_sources, 1, tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0)
- /* Compilation succeeded. */
- javac_works = true;
- else
- javac_works = false;
-
- unlink (compiled_file_name);
-
- javac_noassert = xasprintf ("%s -fno-assert", javac);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_envjavac (javac_noassert,
- java_sources, 1, tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0)
- /* Compilation succeeded. */
- javac_noassert_works = true;
- else
- javac_noassert_works = false;
-
- free (compiled_file_name);
- free (conftest_file_name);
-
- if (javac_works && javac_noassert_works)
- {
- conftest_file_name =
- concatenated_pathname (tmpdir->dir_name, "conftestfail.java",
- NULL);
- if (write_temp_file (tmpdir, conftest_file_name,
- get_failcode_snippet ("1.3")))
- {
- free (conftest_file_name);
- free (javac_noassert);
- cleanup_temp_dir (tmpdir);
- return true;
- }
-
- compiled_file_name =
- concatenated_pathname (tmpdir->dir_name, "conftestfail.class",
- NULL);
- register_temp_file (tmpdir, compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_envjavac (javac,
- java_sources, 1, tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0)
- {
- /* Compilation succeeded. */
- unlink (compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!(!compile_using_envjavac (javac_noassert,
- java_sources, 1, tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0))
- /* Compilation failed. */
- /* "$JAVAC -fno-assert" works better than $JAVAC. */
- javac_works = true;
- }
-
- free (compiled_file_name);
- free (conftest_file_name);
- }
-
- cleanup_temp_dir (tmpdir);
-
- if (javac_works)
- {
- envjavac_usable = true;
- envjavac_need_no_assert_option = false;
- }
- else if (javac_noassert_works)
- {
- envjavac_usable = true;
- envjavac_need_no_assert_option = true;
- }
-
- envjavac_tested = true;
- }
-
- *usablep = envjavac_usable;
- *need_no_assert_option_p = envjavac_need_no_assert_option;
- return false;
-}
-
-/* Test whether $JAVAC, known to be not a version of gcj, can be used, and
- whether it needs a -source and/or -target option.
- Return a failure indicator (true upon error). */
-static bool
-is_envjavac_nongcj_usable (const char *javac,
- const char *source_version,
- const char *target_version,
- bool *usablep,
- bool *source_option_p, bool *target_option_p)
-{
- /* The cache depends on the source_version and target_version. */
- struct result_t
- {
- bool tested;
- bool usable;
- bool source_option;
- bool target_option;
- };
- static struct result_t result_cache[SOURCE_VERSION_BOUND][TARGET_VERSION_BOUND];
- struct result_t *resultp;
-
- resultp = &result_cache[source_version_index (source_version)]
- [target_version_index (target_version)];
- if (!resultp->tested)
- {
- /* Try $JAVAC. */
- struct temp_dir *tmpdir;
- char *conftest_file_name;
- char *compiled_file_name;
- const char *java_sources[1];
- struct stat statbuf;
-
- tmpdir = create_temp_dir ("java", NULL, false);
- if (tmpdir == NULL)
- return true;
-
- conftest_file_name =
- concatenated_pathname (tmpdir->dir_name, "conftest.java", NULL);
- if (write_temp_file (tmpdir, conftest_file_name,
- get_goodcode_snippet (source_version)))
- {
- free (conftest_file_name);
- cleanup_temp_dir (tmpdir);
- return true;
- }
-
- compiled_file_name =
- concatenated_pathname (tmpdir->dir_name, "conftest.class", NULL);
- register_temp_file (tmpdir, compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_envjavac (javac,
- java_sources, 1, tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0
- && get_classfile_version (compiled_file_name)
- <= corresponding_classfile_version (target_version))
- {
- /* $JAVAC compiled conftest.java successfully. */
- /* Try adding -source option if it is useful. */
- char *javac_source =
- xasprintf ("%s -source %s", javac, source_version);
-
- unlink (compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_envjavac (javac_source,
- java_sources, 1, tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0
- && get_classfile_version (compiled_file_name)
- <= corresponding_classfile_version (target_version))
- {
- const char *failcode = get_failcode_snippet (source_version);
-
- if (failcode != NULL)
- {
- free (compiled_file_name);
- free (conftest_file_name);
-
- conftest_file_name =
- concatenated_pathname (tmpdir->dir_name,
- "conftestfail.java",
- NULL);
- if (write_temp_file (tmpdir, conftest_file_name, failcode))
- {
- free (conftest_file_name);
- free (javac_source);
- cleanup_temp_dir (tmpdir);
- return true;
- }
-
- compiled_file_name =
- concatenated_pathname (tmpdir->dir_name,
- "conftestfail.class",
- NULL);
- register_temp_file (tmpdir, compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_envjavac (javac,
- java_sources, 1,
- tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0)
- {
- unlink (compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (compile_using_envjavac (javac_source,
- java_sources, 1,
- tmpdir->dir_name,
- false, false, false, true))
- /* $JAVAC compiled conftestfail.java successfully, and
- "$JAVAC -source $source_version" rejects it. So the
- -source option is useful. */
- resultp->source_option = true;
- }
- }
- }
-
- free (javac_source);
-
- resultp->usable = true;
- }
- else
- {
- /* Try with -target option alone. (Sun javac 1.3.1 has the -target
- option but no -source option.) */
- char *javac_target =
- xasprintf ("%s -target %s", javac, target_version);
-
- unlink (compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_envjavac (javac_target,
- java_sources, 1, tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0
- && get_classfile_version (compiled_file_name)
- <= corresponding_classfile_version (target_version))
- {
- /* "$JAVAC -target $target_version" compiled conftest.java
- successfully. */
- /* Try adding -source option if it is useful. */
- char *javac_target_source =
- xasprintf ("%s -source %s", javac_target, source_version);
-
- unlink (compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_envjavac (javac_target_source,
- java_sources, 1, tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0
- && get_classfile_version (compiled_file_name)
- <= corresponding_classfile_version (target_version))
- {
- const char *failcode = get_failcode_snippet (source_version);
-
- if (failcode != NULL)
- {
- free (compiled_file_name);
- free (conftest_file_name);
-
- conftest_file_name =
- concatenated_pathname (tmpdir->dir_name,
- "conftestfail.java",
- NULL);
- if (write_temp_file (tmpdir, conftest_file_name,
- failcode))
- {
- free (conftest_file_name);
- free (javac_target_source);
- free (javac_target);
- cleanup_temp_dir (tmpdir);
- return true;
- }
-
- compiled_file_name =
- concatenated_pathname (tmpdir->dir_name,
- "conftestfail.class",
- NULL);
- register_temp_file (tmpdir, compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_envjavac (javac_target,
- java_sources, 1,
- tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0)
- {
- unlink (compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (compile_using_envjavac (javac_target_source,
- java_sources, 1,
- tmpdir->dir_name,
- false, false, false,
- true))
- /* "$JAVAC -target $target_version" compiled
- conftestfail.java successfully, and
- "$JAVAC -target $target_version -source $source_version"
- rejects it. So the -source option is useful. */
- resultp->source_option = true;
- }
- }
- }
-
- free (javac_target_source);
-
- resultp->target_option = true;
- resultp->usable = true;
- }
- else
- {
- /* Maybe this -target option requires a -source option? Try with
- -target and -source options. (Supported by Sun javac 1.4 and
- higher.) */
- char *javac_target_source =
- xasprintf ("%s -source %s", javac_target, source_version);
-
- unlink (compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_envjavac (javac_target_source,
- java_sources, 1, tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0
- && get_classfile_version (compiled_file_name)
- <= corresponding_classfile_version (target_version))
- {
- /* "$JAVAC -target $target_version -source $source_version"
- compiled conftest.java successfully. */
- resultp->source_option = true;
- resultp->target_option = true;
- resultp->usable = true;
- }
-
- free (javac_target_source);
- }
-
- free (javac_target);
- }
-
- free (compiled_file_name);
- free (conftest_file_name);
-
- resultp->tested = true;
- }
-
- *usablep = resultp->usable;
- *source_option_p = resultp->source_option;
- *target_option_p = resultp->target_option;
- return false;
-}
-
-static bool
-is_gcj_present (void)
-{
- static bool gcj_tested;
- static bool gcj_present;
-
- if (!gcj_tested)
- {
- /* Test for presence of gcj:
- "gcj --version 2> /dev/null | \
- sed -e 's,^[^0-9]*,,' -e 1q | \
- sed -e '/^3\.[01]/d' | grep '^[3-9]' > /dev/null" */
- char *argv[3];
- pid_t child;
- int fd[1];
- int exitstatus;
-
- argv[0] = "gcj";
- argv[1] = "--version";
- argv[2] = NULL;
- child = create_pipe_in ("gcj", "gcj", argv, DEV_NULL, true, true,
- false, fd);
- gcj_present = false;
- if (child != -1)
- {
- /* Read the subprocess output, drop all lines except the first,
- drop all characters before the first digit, and test whether
- the remaining string starts with a digit >= 3, but not with
- "3.0" or "3.1". */
- char c[3];
- size_t count = 0;
-
- while (safe_read (fd[0], &c[count], 1) > 0)
- {
- if (c[count] == '\n')
- break;
- if (count == 0)
- {
- if (!(c[0] >= '0' && c[0] <= '9'))
- continue;
- gcj_present = (c[0] >= '3');
- }
- count++;
- if (count == 3)
- {
- if (c[0] == '3' && c[1] == '.'
- && (c[2] == '0' || c[2] == '1'))
- gcj_present = false;
- break;
- }
- }
- while (safe_read (fd[0], &c[0], 1) > 0)
- ;
-
- close (fd[0]);
-
- /* Remove zombie process from process list, and retrieve exit
- status. */
- exitstatus =
- wait_subprocess (child, "gcj", false, true, true, false);
- if (exitstatus != 0)
- gcj_present = false;
- }
-
- if (gcj_present)
- {
- /* See if libgcj.jar is well installed. */
- struct temp_dir *tmpdir;
-
- tmpdir = create_temp_dir ("java", NULL, false);
- if (tmpdir == NULL)
- gcj_present = false;
- else
- {
- char *conftest_file_name;
-
- conftest_file_name =
- concatenated_pathname (tmpdir->dir_name, "conftestlib.java",
- NULL);
- if (write_temp_file (tmpdir, conftest_file_name,
-"public class conftestlib {\n"
-" public static void main (String[] args) {\n"
-" }\n"
-"}\n"))
- gcj_present = false;
- else
- {
- char *compiled_file_name;
- const char *java_sources[1];
-
- compiled_file_name =
- concatenated_pathname (tmpdir->dir_name,
- "conftestlib.class",
- NULL);
- register_temp_file (tmpdir, compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (compile_using_gcj (java_sources, 1, false,
- tmpdir->dir_name,
- false, false, false, true))
- gcj_present = false;
-
- free (compiled_file_name);
- }
- free (conftest_file_name);
- }
- cleanup_temp_dir (tmpdir);
- }
-
- gcj_tested = true;
- }
-
- return gcj_present;
-}
-
-/* Test gcj can be used for compiling with target_version = 1.4 and
- source_version = 1.4.
- Return a failure indicator (true upon error). */
-static bool
-is_gcj_14_14_usable (bool *usablep)
-{
- static bool gcj_tested;
- static bool gcj_usable;
-
- if (!gcj_tested)
- {
- /* Try gcj. */
- struct temp_dir *tmpdir;
- char *conftest_file_name;
- char *compiled_file_name;
- const char *java_sources[1];
- struct stat statbuf;
-
- tmpdir = create_temp_dir ("java", NULL, false);
- if (tmpdir == NULL)
- return true;
-
- conftest_file_name =
- concatenated_pathname (tmpdir->dir_name, "conftest.java", NULL);
- if (write_temp_file (tmpdir, conftest_file_name,
- get_goodcode_snippet ("1.4")))
- {
- free (conftest_file_name);
- cleanup_temp_dir (tmpdir);
- return true;
- }
-
- compiled_file_name =
- concatenated_pathname (tmpdir->dir_name, "conftest.class", NULL);
- register_temp_file (tmpdir, compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_gcj (java_sources, 1, false, tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0)
- /* Compilation succeeded. */
- gcj_usable = true;
-
- free (compiled_file_name);
- free (conftest_file_name);
-
- cleanup_temp_dir (tmpdir);
-
- gcj_tested = true;
- }
-
- *usablep = gcj_usable;
- return false;
-}
-
-/* Test whether gcj can be used for compiling with target_version = 1.4 and
- source_version = 1.3.
- Return a failure indicator (true upon error). */
-static bool
-is_gcj_14_13_usable (bool *usablep, bool *need_no_assert_option_p)
-{
- static bool gcj_tested;
- static bool gcj_usable;
- static bool gcj_need_no_assert_option;
-
- if (!gcj_tested)
- {
- /* Try gcj and "gcj -fno-assert". But add -fno-assert only if
- it works (not gcj < 3.3). */
- struct temp_dir *tmpdir;
- char *conftest_file_name;
- char *compiled_file_name;
- const char *java_sources[1];
- struct stat statbuf;
-
- tmpdir = create_temp_dir ("java", NULL, false);
- if (tmpdir == NULL)
- return true;
-
- conftest_file_name =
- concatenated_pathname (tmpdir->dir_name, "conftest.java", NULL);
- if (write_temp_file (tmpdir, conftest_file_name,
- get_goodcode_snippet ("1.3")))
- {
- free (conftest_file_name);
- cleanup_temp_dir (tmpdir);
- return true;
- }
-
- compiled_file_name =
- concatenated_pathname (tmpdir->dir_name, "conftest.class", NULL);
- register_temp_file (tmpdir, compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_gcj (java_sources, 1, true, tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0)
- /* Compilation succeeded. */
- {
- gcj_usable = true;
- gcj_need_no_assert_option = true;
- }
- else
- {
- unlink (compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_gcj (java_sources, 1, false, tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0)
- /* Compilation succeeded. */
- {
- gcj_usable = true;
- gcj_need_no_assert_option = false;
- }
- }
-
- free (compiled_file_name);
- free (conftest_file_name);
-
- cleanup_temp_dir (tmpdir);
-
- gcj_tested = true;
- }
-
- *usablep = gcj_usable;
- *need_no_assert_option_p = gcj_need_no_assert_option;
- return false;
-}
-
-static bool
-is_javac_present (void)
-{
- static bool javac_tested;
- static bool javac_present;
-
- if (!javac_tested)
- {
- /* Test for presence of javac: "javac 2> /dev/null ; test $? -le 2" */
- char *argv[2];
- int exitstatus;
-
- argv[0] = "javac";
- argv[1] = NULL;
- exitstatus = execute ("javac", "javac", argv, false, false, true, true,
- true, false);
- javac_present = (exitstatus == 0 || exitstatus == 1 || exitstatus == 2);
- javac_tested = true;
- }
-
- return javac_present;
-}
-
-/* Test whether javac can be used and whether it needs a -source and/or
- -target option.
- Return a failure indicator (true upon error). */
-static bool
-is_javac_usable (const char *source_version, const char *target_version,
- bool *usablep, bool *source_option_p, bool *target_option_p)
-{
- /* The cache depends on the source_version and target_version. */
- struct result_t
- {
- bool tested;
- bool usable;
- bool source_option;
- bool target_option;
- };
- static struct result_t result_cache[SOURCE_VERSION_BOUND][TARGET_VERSION_BOUND];
- struct result_t *resultp;
-
- resultp = &result_cache[source_version_index (source_version)]
- [target_version_index (target_version)];
- if (!resultp->tested)
- {
- /* Try javac. */
- struct temp_dir *tmpdir;
- char *conftest_file_name;
- char *compiled_file_name;
- const char *java_sources[1];
- struct stat statbuf;
-
- tmpdir = create_temp_dir ("java", NULL, false);
- if (tmpdir == NULL)
- return true;
-
- conftest_file_name =
- concatenated_pathname (tmpdir->dir_name, "conftest.java", NULL);
- if (write_temp_file (tmpdir, conftest_file_name,
- get_goodcode_snippet (source_version)))
- {
- free (conftest_file_name);
- cleanup_temp_dir (tmpdir);
- return true;
- }
-
- compiled_file_name =
- concatenated_pathname (tmpdir->dir_name, "conftest.class", NULL);
- register_temp_file (tmpdir, compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_javac (java_sources, 1,
- false, source_version,
- false, target_version,
- tmpdir->dir_name, false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0
- && get_classfile_version (compiled_file_name)
- <= corresponding_classfile_version (target_version))
- {
- /* javac compiled conftest.java successfully. */
- /* Try adding -source option if it is useful. */
- unlink (compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_javac (java_sources, 1,
- true, source_version,
- false, target_version,
- tmpdir->dir_name, false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0
- && get_classfile_version (compiled_file_name)
- <= corresponding_classfile_version (target_version))
- {
- const char *failcode = get_failcode_snippet (source_version);
-
- if (failcode != NULL)
- {
- free (compiled_file_name);
- free (conftest_file_name);
-
- conftest_file_name =
- concatenated_pathname (tmpdir->dir_name,
- "conftestfail.java",
- NULL);
- if (write_temp_file (tmpdir, conftest_file_name, failcode))
- {
- free (conftest_file_name);
- cleanup_temp_dir (tmpdir);
- return true;
- }
-
- compiled_file_name =
- concatenated_pathname (tmpdir->dir_name,
- "conftestfail.class",
- NULL);
- register_temp_file (tmpdir, compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_javac (java_sources, 1,
- false, source_version,
- false, target_version,
- tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0)
- {
- unlink (compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (compile_using_javac (java_sources, 1,
- true, source_version,
- false, target_version,
- tmpdir->dir_name,
- false, false, false, true))
- /* javac compiled conftestfail.java successfully, and
- "javac -source $source_version" rejects it. So the
- -source option is useful. */
- resultp->source_option = true;
- }
- }
- }
-
- resultp->usable = true;
- }
- else
- {
- /* Try with -target option alone. (Sun javac 1.3.1 has the -target
- option but no -source option.) */
- unlink (compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_javac (java_sources, 1,
- false, source_version,
- true, target_version,
- tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0
- && get_classfile_version (compiled_file_name)
- <= corresponding_classfile_version (target_version))
- {
- /* "javac -target $target_version" compiled conftest.java
- successfully. */
- /* Try adding -source option if it is useful. */
- unlink (compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_javac (java_sources, 1,
- true, source_version,
- true, target_version,
- tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0
- && get_classfile_version (compiled_file_name)
- <= corresponding_classfile_version (target_version))
- {
- const char *failcode = get_failcode_snippet (source_version);
-
- if (failcode != NULL)
- {
- free (compiled_file_name);
- free (conftest_file_name);
-
- conftest_file_name =
- concatenated_pathname (tmpdir->dir_name,
- "conftestfail.java",
- NULL);
- if (write_temp_file (tmpdir, conftest_file_name,
- failcode))
- {
- free (conftest_file_name);
- cleanup_temp_dir (tmpdir);
- return true;
- }
-
- compiled_file_name =
- concatenated_pathname (tmpdir->dir_name,
- "conftestfail.class",
- NULL);
- register_temp_file (tmpdir, compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_javac (java_sources, 1,
- false, source_version,
- true, target_version,
- tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0)
- {
- unlink (compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (compile_using_javac (java_sources, 1,
- true, source_version,
- true, target_version,
- tmpdir->dir_name,
- false, false, false, true))
- /* "javac -target $target_version" compiled
- conftestfail.java successfully, and
- "javac -target $target_version -source $source_version"
- rejects it. So the -source option is useful. */
- resultp->source_option = true;
- }
- }
- }
-
- resultp->target_option = true;
- resultp->usable = true;
- }
- else
- {
- /* Maybe this -target option requires a -source option? Try with
- -target and -source options. (Supported by Sun javac 1.4 and
- higher.) */
- unlink (compiled_file_name);
-
- java_sources[0] = conftest_file_name;
- if (!compile_using_javac (java_sources, 1,
- true, source_version,
- true, target_version,
- tmpdir->dir_name,
- false, false, false, true)
- && stat (compiled_file_name, &statbuf) >= 0
- && get_classfile_version (compiled_file_name)
- <= corresponding_classfile_version (target_version))
- {
- /* "javac -target $target_version -source $source_version"
- compiled conftest.java successfully. */
- resultp->source_option = true;
- resultp->target_option = true;
- resultp->usable = true;
- }
- }
- }
-
- free (compiled_file_name);
- free (conftest_file_name);
-
- resultp->tested = true;
- }
-
- *usablep = resultp->usable;
- *source_option_p = resultp->source_option;
- *target_option_p = resultp->target_option;
- return false;
-}
-
-static bool
-is_jikes_present (void)
-{
- static bool jikes_tested;
- static bool jikes_present;
-
- if (!jikes_tested)
- {
- /* Test for presence of jikes: "jikes 2> /dev/null ; test $? = 1" */
- char *argv[2];
- int exitstatus;
-
- argv[0] = "jikes";
- argv[1] = NULL;
- exitstatus = execute ("jikes", "jikes", argv, false, false, true, true,
- true, false);
- jikes_present = (exitstatus == 0 || exitstatus == 1);
- jikes_tested = true;
- }
-
- return jikes_present;
-}
-
-/* ============================= Main function ============================= */
-
-bool
-compile_java_class (const char * const *java_sources,
- unsigned int java_sources_count,
- const char * const *classpaths,
- unsigned int classpaths_count,
- const char *source_version,
- const char *target_version,
- const char *directory,
- bool optimize, bool debug,
- bool use_minimal_classpath,
- bool verbose)
-{
- bool err = false;
- char *old_JAVA_HOME;
-
- {
- const char *javac = getenv ("JAVAC");
- if (javac != NULL && javac[0] != '\0')
- {
- bool usable = false;
- bool no_assert_option = false;
- bool source_option = false;
- bool target_option = false;
-
- if (target_version == NULL)
- target_version = default_target_version ();
-
- if (is_envjavac_gcj (javac))
- {
- /* It's a version of gcj. Ignore the version of the class files
- that it creates. */
- if (strcmp (target_version, "1.4") == 0
- && strcmp (source_version, "1.4") == 0)
- {
- if (is_envjavac_gcj_14_14_usable (javac, &usable))
- {
- err = true;
- goto done1;
- }
- }
- else if (strcmp (target_version, "1.4") == 0
- && strcmp (source_version, "1.3") == 0)
- {
- if (is_envjavac_gcj_14_13_usable (javac,
- &usable, &no_assert_option))
- {
- err = true;
- goto done1;
- }
- }
- }
- else
- {
- /* It's not gcj. Assume the classfile versions are correct. */
- if (is_envjavac_nongcj_usable (javac,
- source_version, target_version,
- &usable,
- &source_option, &target_option))
- {
- err = true;
- goto done1;
- }
- }
-
- if (usable)
- {
- char *old_classpath;
- char *javac_with_options;
-
- /* Set CLASSPATH. */
- old_classpath =
- set_classpath (classpaths, classpaths_count, false, verbose);
-
- javac_with_options =
- (no_assert_option
- ? xasprintf ("%s -fno-assert", javac)
- : xasprintf ("%s%s%s%s%s",
- javac,
- source_option ? " -source " : "",
- source_option ? source_version : "",
- target_option ? " -target " : "",
- target_option ? target_version : ""));
-
- err = compile_using_envjavac (javac_with_options,
- java_sources, java_sources_count,
- directory, optimize, debug, verbose,
- false);
-
- free (javac_with_options);
-
- /* Reset CLASSPATH. */
- reset_classpath (old_classpath);
-
- goto done1;
- }
- }
- }
-
- /* Unset the JAVA_HOME environment variable. */
- old_JAVA_HOME = getenv ("JAVA_HOME");
- if (old_JAVA_HOME != NULL)
- {
- old_JAVA_HOME = xstrdup (old_JAVA_HOME);
- unsetenv ("JAVA_HOME");
- }
-
- if (is_gcj_present ())
- {
- /* Test whether it supports the desired target-version and
- source-version. But ignore the version of the class files that
- it creates. */
- bool usable = false;
- bool no_assert_option = false;
-
- if (target_version == NULL)
- target_version = default_target_version ();
-
- if (strcmp (target_version, "1.4") == 0
- && strcmp (source_version, "1.4") == 0)
- {
- if (is_gcj_14_14_usable (&usable))
- {
- err = true;
- goto done1;
- }
- }
- else if (strcmp (target_version, "1.4") == 0
- && strcmp (source_version, "1.3") == 0)
- {
- if (is_gcj_14_13_usable (&usable, &no_assert_option))
- {
- err = true;
- goto done1;
- }
- }
-
- if (usable)
- {
- char *old_classpath;
-
- /* Set CLASSPATH. We could also use the --CLASSPATH=... option
- of gcj. Note that --classpath=... option is different: its
- argument should also contain gcj's libgcj.jar, but we don't
- know its location. */
- old_classpath =
- set_classpath (classpaths, classpaths_count, use_minimal_classpath,
- verbose);
-
- err = compile_using_gcj (java_sources, java_sources_count,
- no_assert_option,
- directory, optimize, debug, verbose, false);
-
- /* Reset CLASSPATH. */
- reset_classpath (old_classpath);
-
- goto done2;
- }
- }
-
- if (is_javac_present ())
- {
- bool usable = false;
- bool source_option = false;
- bool target_option = false;
-
- if (target_version == NULL)
- target_version = default_target_version ();
-
- if (is_javac_usable (source_version, target_version,
- &usable, &source_option, &target_option))
- {
- err = true;
- goto done1;
- }
-
- if (usable)
- {
- char *old_classpath;
-
- /* Set CLASSPATH. We don't use the "-classpath ..." option because
- in JDK 1.1.x its argument should also contain the JDK's
- classes.zip, but we don't know its location. (In JDK 1.3.0 it
- would work.) */
- old_classpath =
- set_classpath (classpaths, classpaths_count, use_minimal_classpath,
- verbose);
-
- err = compile_using_javac (java_sources, java_sources_count,
- source_option, source_version,
- target_option, target_version,
- directory, optimize, debug, verbose,
- false);
-
- /* Reset CLASSPATH. */
- reset_classpath (old_classpath);
-
- goto done2;
- }
- }
-
- if (is_jikes_present ())
- {
- /* Test whether it supports the desired target-version and
- source-version. */
- bool usable = (strcmp (source_version, "1.3") == 0);
-
- if (usable)
- {
- char *old_classpath;
-
- /* Set CLASSPATH. We could also use the "-classpath ..." option.
- Since jikes doesn't come with its own standard library, it
- needs a classes.zip or rt.jar or libgcj.jar in the CLASSPATH.
- To increase the chance of success, we reuse the current CLASSPATH
- if the user has set it. */
- old_classpath =
- set_classpath (classpaths, classpaths_count, false, verbose);
-
- err = compile_using_jikes (java_sources, java_sources_count,
- directory, optimize, debug, verbose,
- false);
-
- /* Reset CLASSPATH. */
- reset_classpath (old_classpath);
-
- goto done2;
- }
- }
-
- error (0, 0, _("Java compiler not found, try installing gcj or set $JAVAC"));
- err = true;
-
- done2:
- if (old_JAVA_HOME != NULL)
- {
- xsetenv ("JAVA_HOME", old_JAVA_HOME, 1);
- free (old_JAVA_HOME);
- }
-
- done1:
- return err;
-}
+++ /dev/null
-/* Compile a Java program.
- Copyright (C) 2001-2002, 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _JAVACOMP_H
-#define _JAVACOMP_H
-
-#include <stdbool.h>
-
-/* Compile a Java source file to bytecode.
- java_sources is an array of source file names.
- classpaths is a list of pathnames to be prepended to the CLASSPATH.
-
- source_version can be: support for
- 1.3 inner classes
- 1.4 assert keyword
- 1.5 generic classes and methods
- 1.6 (not yet supported)
- target_version can be: classfile version:
- 1.1 45.3
- 1.2 46.0
- 1.3 47.0
- 1.4 48.0
- 1.5 49.0
- 1.6 50.0
- target_version can also be given as NULL. In this case, the required
- target_version is determined from the found JVM (see javaversion.h).
- Specifying target_version is useful when building a library (.jar) that is
- useful outside the given package. Passing target_version = NULL is useful
- when building an application.
- It is unreasonable to ask for:
- - target_version < 1.4 with source_version >= 1.4, or
- - target_version < 1.5 with source_version >= 1.5, or
- - target_version < 1.6 with source_version >= 1.6,
- because even Sun's javac doesn't support these combinations.
- It is redundant to ask for a target_version > source_version, since the
- smaller target_version = source_version will also always work and newer JVMs
- support the older target_versions too. Except for the case
- target_version = 1.4, source_version = 1.3, which allows gcj versions 3.0
- to 3.2 to be used.
-
- directory is the target directory. The .class file for class X.Y.Z is
- written at directory/X/Y/Z.class. If directory is NULL, the .class
- file is written in the source's directory.
- use_minimal_classpath = true means to ignore the user's CLASSPATH and
- use a minimal one. This is likely to reduce possible problems if the
- user's CLASSPATH contains garbage or a classes.zip file of the wrong
- Java version.
- If verbose, the command to be executed will be printed.
- Return false if OK, true on error. */
-extern bool compile_java_class (const char * const *java_sources,
- unsigned int java_sources_count,
- const char * const *classpaths,
- unsigned int classpaths_count,
- const char *source_version,
- const char *target_version,
- const char *directory,
- bool optimize, bool debug,
- bool use_minimal_classpath,
- bool verbose);
-
-#endif /* _JAVACOMP_H */
+++ /dev/null
-/* Execute a Java program.
- Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include <alloca.h>
-
-/* Specification. */
-#include "javaexec.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "execute.h"
-#include "classpath.h"
-#include "xsetenv.h"
-#include "sh-quote.h"
-#include "pathname.h"
-#include "xalloc.h"
-#include "xallocsa.h"
-#include "error.h"
-#include "gettext.h"
-
-#define _(str) gettext (str)
-
-
-/* Survey of Java virtual machines.
-
- A = does it work without CLASSPATH being set
- B = does it work with CLASSPATH being set to empty
- C = option to set CLASSPATH, other than setting it in the environment
- T = test for presence
-
- Program from A B C T
-
- $JAVA unknown N Y n/a true
- gij GCC 3.0 Y Y n/a gij --version >/dev/null
- java JDK 1.1.8 Y Y -classpath P java -version 2>/dev/null
- jre JDK 1.1.8 N Y -classpath P jre 2>/dev/null; test $? = 1
- java JDK 1.3.0 Y Y -classpath P java -version 2>/dev/null
- jview MS IE Y Y -cp P jview -? >nul; %errorlevel% = 1
-
- The CLASSPATH is a colon separated list of pathnames. (On Windows: a
- semicolon separated list of pathnames.)
-
- We try the Java virtual machines in the following order:
- 1. getenv ("JAVA"), because the user must be able to override our
- preferences,
- 2. "gij", because it is a completely free JVM,
- 3. "java", because it is a standard JVM,
- 4. "jre", comes last because it requires a CLASSPATH environment variable,
- 5. "jview", on Windows only, because it is frequently installed.
-
- We unset the JAVA_HOME environment variable, because a wrong setting of
- this variable can confuse the JDK's javac.
- */
-
-bool
-execute_java_class (const char *class_name,
- const char * const *classpaths,
- unsigned int classpaths_count,
- bool use_minimal_classpath,
- const char *exe_dir,
- const char * const *args,
- bool verbose, bool quiet,
- execute_fn *executer, void *private_data)
-{
- bool err = false;
- unsigned int nargs;
- char *old_JAVA_HOME;
-
- /* Count args. */
- {
- const char * const *arg;
-
- for (nargs = 0, arg = args; *arg != NULL; nargs++, arg++)
- ;
- }
-
- /* First, try a class compiled to a native code executable. */
- if (exe_dir != NULL)
- {
- char *exe_pathname = concatenated_pathname (exe_dir, class_name, EXEEXT);
- char *old_classpath;
- char **argv = (char **) xallocsa ((1 + nargs + 1) * sizeof (char *));
- unsigned int i;
-
- /* Set CLASSPATH. */
- old_classpath =
- set_classpath (classpaths, classpaths_count, use_minimal_classpath,
- verbose);
-
- argv[0] = exe_pathname;
- for (i = 0; i <= nargs; i++)
- argv[1 + i] = (char *) args[i];
-
- if (verbose)
- {
- char *command = shell_quote_argv (argv);
- printf ("%s\n", command);
- free (command);
- }
-
- err = executer (class_name, exe_pathname, argv, private_data);
-
- /* Reset CLASSPATH. */
- reset_classpath (old_classpath);
-
- freesa (argv);
-
- goto done1;
- }
-
- {
- const char *java = getenv ("JAVA");
- if (java != NULL && java[0] != '\0')
- {
- /* Because $JAVA may consist of a command and options, we use the
- shell. Because $JAVA has been set by the user, we leave all
- all environment variables in place, including JAVA_HOME, and
- we don't erase the user's CLASSPATH. */
- char *old_classpath;
- unsigned int command_length;
- char *command;
- char *argv[4];
- const char * const *arg;
- char *p;
-
- /* Set CLASSPATH. */
- old_classpath =
- set_classpath (classpaths, classpaths_count, false,
- verbose);
-
- command_length = strlen (java);
- command_length += 1 + shell_quote_length (class_name);
- for (arg = args; *arg != NULL; arg++)
- command_length += 1 + shell_quote_length (*arg);
- command_length += 1;
-
- command = (char *) xallocsa (command_length);
- p = command;
- /* Don't shell_quote $JAVA, because it may consist of a command
- and options. */
- memcpy (p, java, strlen (java));
- p += strlen (java);
- *p++ = ' ';
- p = shell_quote_copy (p, class_name);
- for (arg = args; *arg != NULL; arg++)
- {
- *p++ = ' ';
- p = shell_quote_copy (p, *arg);
- }
- *p++ = '\0';
- /* Ensure command_length was correctly calculated. */
- if (p - command > command_length)
- abort ();
-
- if (verbose)
- printf ("%s\n", command);
-
- argv[0] = "/bin/sh";
- argv[1] = "-c";
- argv[2] = command;
- argv[3] = NULL;
- err = executer (java, "/bin/sh", argv, private_data);
-
- freesa (command);
-
- /* Reset CLASSPATH. */
- reset_classpath (old_classpath);
-
- goto done1;
- }
- }
-
- /* Unset the JAVA_HOME environment variable. */
- old_JAVA_HOME = getenv ("JAVA_HOME");
- if (old_JAVA_HOME != NULL)
- {
- old_JAVA_HOME = xstrdup (old_JAVA_HOME);
- unsetenv ("JAVA_HOME");
- }
-
- {
- static bool gij_tested;
- static bool gij_present;
-
- if (!gij_tested)
- {
- /* Test for presence of gij: "gij --version > /dev/null" */
- char *argv[3];
- int exitstatus;
-
- argv[0] = "gij";
- argv[1] = "--version";
- argv[2] = NULL;
- exitstatus = execute ("gij", "gij", argv, false, false, true, true,
- true, false);
- gij_present = (exitstatus == 0);
- gij_tested = true;
- }
-
- if (gij_present)
- {
- char *old_classpath;
- char **argv = (char **) xallocsa ((2 + nargs + 1) * sizeof (char *));
- unsigned int i;
-
- /* Set CLASSPATH. */
- old_classpath =
- set_classpath (classpaths, classpaths_count, use_minimal_classpath,
- verbose);
-
- argv[0] = "gij";
- argv[1] = (char *) class_name;
- for (i = 0; i <= nargs; i++)
- argv[2 + i] = (char *) args[i];
-
- if (verbose)
- {
- char *command = shell_quote_argv (argv);
- printf ("%s\n", command);
- free (command);
- }
-
- err = executer ("gij", "gij", argv, private_data);
-
- /* Reset CLASSPATH. */
- reset_classpath (old_classpath);
-
- freesa (argv);
-
- goto done2;
- }
- }
-
- {
- static bool java_tested;
- static bool java_present;
-
- if (!java_tested)
- {
- /* Test for presence of java: "java -version 2> /dev/null" */
- char *argv[3];
- int exitstatus;
-
- argv[0] = "java";
- argv[1] = "-version";
- argv[2] = NULL;
- exitstatus = execute ("java", "java", argv, false, false, true, true,
- true, false);
- java_present = (exitstatus == 0);
- java_tested = true;
- }
-
- if (java_present)
- {
- char *old_classpath;
- char **argv = (char **) xallocsa ((2 + nargs + 1) * sizeof (char *));
- unsigned int i;
-
- /* Set CLASSPATH. We don't use the "-classpath ..." option because
- in JDK 1.1.x its argument should also contain the JDK's classes.zip,
- but we don't know its location. (In JDK 1.3.0 it would work.) */
- old_classpath =
- set_classpath (classpaths, classpaths_count, use_minimal_classpath,
- verbose);
-
- argv[0] = "java";
- argv[1] = (char *) class_name;
- for (i = 0; i <= nargs; i++)
- argv[2 + i] = (char *) args[i];
-
- if (verbose)
- {
- char *command = shell_quote_argv (argv);
- printf ("%s\n", command);
- free (command);
- }
-
- err = executer ("java", "java", argv, private_data);
-
- /* Reset CLASSPATH. */
- reset_classpath (old_classpath);
-
- freesa (argv);
-
- goto done2;
- }
- }
-
- {
- static bool jre_tested;
- static bool jre_present;
-
- if (!jre_tested)
- {
- /* Test for presence of jre: "jre 2> /dev/null ; test $? = 1" */
- char *argv[2];
- int exitstatus;
-
- argv[0] = "jre";
- argv[1] = NULL;
- exitstatus = execute ("jre", "jre", argv, false, false, true, true,
- true, false);
- jre_present = (exitstatus == 0 || exitstatus == 1);
- jre_tested = true;
- }
-
- if (jre_present)
- {
- char *old_classpath;
- char **argv = (char **) xallocsa ((2 + nargs + 1) * sizeof (char *));
- unsigned int i;
-
- /* Set CLASSPATH. We don't use the "-classpath ..." option because
- in JDK 1.1.x its argument should also contain the JDK's classes.zip,
- but we don't know its location. */
- old_classpath =
- set_classpath (classpaths, classpaths_count, use_minimal_classpath,
- verbose);
-
- argv[0] = "jre";
- argv[1] = (char *) class_name;
- for (i = 0; i <= nargs; i++)
- argv[2 + i] = (char *) args[i];
-
- if (verbose)
- {
- char *command = shell_quote_argv (argv);
- printf ("%s\n", command);
- free (command);
- }
-
- err = executer ("jre", "jre", argv, private_data);
-
- /* Reset CLASSPATH. */
- reset_classpath (old_classpath);
-
- freesa (argv);
-
- goto done2;
- }
- }
-
-#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__
- /* Win32, Cygwin */
- {
- static bool jview_tested;
- static bool jview_present;
-
- if (!jview_tested)
- {
- /* Test for presence of jview: "jview -? >nul ; test $? = 1" */
- char *argv[3];
- int exitstatus;
-
- argv[0] = "jview";
- argv[1] = "-?";
- argv[2] = NULL;
- exitstatus = execute ("jview", "jview", argv, false, false, true, true,
- true, false);
- jview_present = (exitstatus == 0 || exitstatus == 1);
- jview_tested = true;
- }
-
- if (jview_present)
- {
- char *old_classpath;
- char **argv = (char **) xallocsa ((2 + nargs + 1) * sizeof (char *));
- unsigned int i;
-
- /* Set CLASSPATH. */
- old_classpath =
- set_classpath (classpaths, classpaths_count, use_minimal_classpath,
- verbose);
-
- argv[0] = "jview";
- argv[1] = (char *) class_name;
- for (i = 0; i <= nargs; i++)
- argv[2 + i] = (char *) args[i];
-
- if (verbose)
- {
- char *command = shell_quote_argv (argv);
- printf ("%s\n", command);
- free (command);
- }
-
- err = executer ("jview", "jview", argv, private_data);
-
- /* Reset CLASSPATH. */
- reset_classpath (old_classpath);
-
- freesa (argv);
-
- goto done2;
- }
- }
-#endif
-
- if (!quiet)
- error (0, 0, _("Java virtual machine not found, try installing gij or set $JAVA"));
- err = true;
-
- done2:
- if (old_JAVA_HOME != NULL)
- {
- xsetenv ("JAVA_HOME", old_JAVA_HOME, 1);
- free (old_JAVA_HOME);
- }
-
- done1:
- return err;
-}
+++ /dev/null
-/* Execute a Java program.
- Copyright (C) 2001-2002 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _JAVAEXEC_H
-#define _JAVAEXEC_H
-
-#include <stdbool.h>
-
-typedef bool execute_fn (const char *progname,
- const char *prog_path, char **prog_argv,
- void *private_data);
-
-/* Execute a Java class.
- class_name is the Java class name to be executed.
- classpaths is a list of pathnames to be prepended to the CLASSPATH.
- use_minimal_classpath = true means to ignore the user's CLASSPATH and
- use a minimal one. This is likely to reduce possible problems if the
- user's CLASSPATH contains garbage or a classes.zip file of the wrong
- Java version.
- exe_dir is a directory that may contain a native executable for the class.
- args is a NULL terminated list of arguments to be passed to the program.
- If verbose, the command to be executed will be printed.
- Then the command is passed to the execute function together with the
- private_data argument. This function returns false if OK, true on error.
- Return false if OK, true on error.
- If quiet, error messages will not be printed. */
-extern bool execute_java_class (const char *class_name,
- const char * const *classpaths,
- unsigned int classpaths_count,
- bool use_minimal_classpath,
- const char *exe_dir,
- const char * const *args,
- bool verbose, bool quiet,
- execute_fn *executer, void *private_data);
-
-#endif /* _JAVAEXEC_H */
+++ /dev/null
-/* Determine the Java version supported by javaexec.
- Copyright (C) 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2006.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "javaversion.h"
-
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-
-#if ENABLE_RELOCATABLE
-# include "relocatable.h"
-#else
-# define relocate(pathname) (pathname)
-#endif
-
-#include "javaexec.h"
-#include "pipe.h"
-#include "wait-process.h"
-#include "error.h"
-#include "getline.h"
-#include "gettext.h"
-
-#define _(str) gettext (str)
-
-
-struct locals
-{
- /* OUT */
- char *line;
-};
-
-static bool
-execute_and_read_line (const char *progname,
- const char *prog_path, char **prog_argv,
- void *private_data)
-{
- struct locals *l = (struct locals *) private_data;
- pid_t child;
- int fd[1];
- FILE *fp;
- char *line;
- size_t linesize;
- size_t linelen;
- int exitstatus;
-
- /* Open a pipe to the JVM. */
- child = create_pipe_in (progname, prog_path, prog_argv, DEV_NULL, false,
- true, false, fd);
-
- if (child == -1)
- return false;
-
- /* Retrieve its result. */
- fp = fdopen (fd[0], "r");
- if (fp == NULL)
- {
- error (0, errno, _("fdopen() failed"));
- return false;
- }
-
- line = NULL; linesize = 0;
- linelen = getline (&line, &linesize, fp);
- if (linelen == (size_t)(-1))
- {
- error (0, 0, _("%s subprocess I/O error"), progname);
- return false;
- }
- if (linelen > 0 && line[linelen - 1] == '\n')
- line[linelen - 1] = '\0';
-
- fclose (fp);
-
- /* Remove zombie process from process list, and retrieve exit status. */
- exitstatus = wait_subprocess (child, progname, true, false, true, false);
- if (exitstatus != 0)
- {
- free (line);
- return false;
- }
-
- l->line = line;
- return false;
-}
-
-char *
-javaexec_version (void)
-{
- const char *class_name = "javaversion";
- const char *pkgdatadir = relocate (PKGDATADIR);
- const char *args[1];
- struct locals locals;
-
- args[0] = NULL;
- locals.line = NULL;
- execute_java_class (class_name, &pkgdatadir, 1, true, NULL, args,
- false, false, execute_and_read_line, &locals);
-
- return locals.line;
-}
+++ /dev/null
-/* Determine the Java version supported by javaexec.
- Copyright (C) 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2006.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _JAVAVERSION_H
-#define _JAVAVERSION_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Return information about the Java version used by execute_java_class().
- This is the value of System.getProperty("java.specification.version").
- Some possible values are: 1.1, 1.2, 1.3, 1.4, 1.5, 1.6. Return NULL if
- the Java version cannot be determined. */
-extern char * javaexec_version (void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _JAVAVERSION_H */
+++ /dev/null
-/* Show the Java version.
- * Copyright (C) 2006 Free Software Foundation, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-/**
- * This program shows the Java version.
- *
- * This program _must_ be compiled with
- * javac -d . -target 1.1 javaversion.java
- * since its purpose is to show the version of _any_ Java implementation.
- *
- * @author Bruno Haible
- */
-public class javaversion {
- public static void main (String[] args) {
- System.out.println(System.getProperty("java.specification.version"));
- }
-}
+++ /dev/null
-/* Line breaking properties of Unicode characters. */
-/* Generated automatically by gen-lbrkprop for Unicode 3.1.0. */
-
-/* Copyright (C) 2000-2004 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation,
-Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#define lbrkprop_header_0 16
-#define lbrkprop_header_1 15
-#define lbrkprop_header_2 7
-#define lbrkprop_header_3 511
-#define lbrkprop_header_4 127
-static const
-struct
- {
- int level1[15];
- int level2[4 << 9];
- unsigned char level3[100 << 7];
- }
-lbrkprop =
-{
- { 0, 512, 1024, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 1536 },
- {
- 0, 128, 256, 384, 512, 640, 768, 896,
- 1024, 1152, 1280, 1408, 1536, 1664, 1792, 1920,
- -1, -1, 2048, 2176, 2304, 2432, 2560, 2688,
- 2816, 2944, 3072, 3200, 3328, 3456, 3584, 3712,
- 3840, 3968, 4096, 4224, 4352, 4480, 4608, 4736,
- 4864, 4992, 4992, 4992, 5120, 5248, -1, 5376,
- 5504, 5632, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 4992, 5760, 5888, 6016,
- 6144, 6272, 6400, 6528, 6656, 6784, 6912, 7040,
- 7168, 7296, 7424, 7552, 7680, -1, 7808, 7936,
- 4992, 4992, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 8064, 8192, 8320,
- 8448, 8576, 8704, 8832, 8960, 9088, 9216, 9344,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 9472, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 9600,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 9728, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 9856,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 8192, 8192, 9984, -1, 10112, 10240,
- 4992, 4992, 10368, 10496, 10624, 10752, 10880, 11008,
- -1, -1, -1, -1, -1, -1, 11136, -1,
- 11264, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- 4992, 11392, 11520, 11648, -1, -1, -1, -1,
- 11776, 11904, 12032, 4992, 4992, 12160, 4992, 12288,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
- 8192, 8192, 8192, 8192, 8192, 12416, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- 8192, 8192, 8192, 8192, 12544, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- 12672, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1
- },
- {
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_BA, LBP_BK, LBP_CM, LBP_BK, LBP_BK, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_SP, LBP_EX, LBP_QU, LBP_AL, LBP_PR, LBP_PO, LBP_AL, LBP_QU,
- LBP_OP, LBP_CL, LBP_AL, LBP_PR, LBP_IS, LBP_HY, LBP_IS, LBP_SY,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_IS, LBP_IS, LBP_AL, LBP_AL, LBP_AL, LBP_EX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_OP, LBP_PR, LBP_CL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_OP, LBP_BA, LBP_CL, LBP_AL, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_BK, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_GL, LBP_AI, LBP_PO, LBP_PR, LBP_PR, LBP_PR, LBP_AL, LBP_AI,
- LBP_AI, LBP_AL, LBP_AI, LBP_QU, LBP_AL, LBP_BA, LBP_AL, LBP_AL,
- LBP_PO, LBP_PR, LBP_AI, LBP_AI, LBP_BB, LBP_AL, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_QU, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI,
- LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AL,
- LBP_AI, LBP_AI, LBP_AI, LBP_AL, LBP_AI, LBP_AI, LBP_AL, LBP_AL,
- LBP_AI, LBP_AL, LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AL, LBP_AI, LBP_AL, LBP_AI, LBP_AL,
- LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AI, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AI,
- LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AI, LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL,
- LBP_AI, LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AI,
- LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AL,
- LBP_AI, LBP_AL, LBP_AI, LBP_AL, LBP_AI, LBP_AL, LBP_AI, LBP_AL,
- LBP_AI, LBP_AL, LBP_AI, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI,
- LBP_BB, LBP_AI, LBP_AI, LBP_AI, LBP_BB, LBP_AI, LBP_AL, LBP_AL,
- LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AL, LBP_AI, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_XX, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AL, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX,
- LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_AL,
- LBP_AL, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_IS, LBP_BA, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_AL, LBP_CM,
- LBP_AL, LBP_CM, LBP_CM, LBP_AL, LBP_CM, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_AL,
- LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_CM, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_AL, LBP_AL, LBP_CM,
- LBP_CM, LBP_AL, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_CM,
- LBP_AL, LBP_CM, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_CM, LBP_AL, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX,
- LBP_AL, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_CM, LBP_CM, LBP_AL, LBP_AL, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_AL,
- LBP_AL, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_CM, LBP_XX, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_CM,
- LBP_CM, LBP_XX, LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_CM,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_XX, LBP_AL,
- LBP_AL, LBP_AL, LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_AL, LBP_AL, LBP_PR, LBP_PR, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_CM, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_AL,
- LBP_AL, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_CM, LBP_XX, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_CM,
- LBP_CM, LBP_XX, LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_CM, LBP_CM, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_XX, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_CM, LBP_AL, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_CM,
- LBP_CM, LBP_CM, LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX,
- LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_AL,
- LBP_AL, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_CM, LBP_AL, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_CM,
- LBP_CM, LBP_XX, LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_CM, LBP_CM,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_XX, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_CM, LBP_CM, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_XX, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_CM, LBP_CM,
- LBP_CM, LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_CM,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_NU,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_CM, LBP_CM,
- LBP_CM, LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_CM, LBP_CM, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_CM, LBP_CM, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_CM, LBP_CM,
- LBP_CM, LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_CM, LBP_CM, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_XX,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_CM, LBP_CM, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_CM, LBP_CM,
- LBP_CM, LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_CM,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_CM, LBP_CM, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_XX, LBP_XX, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_CM, LBP_XX,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_CM, LBP_CM, LBP_AL, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_CM, LBP_SA, LBP_SA, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_PR,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_AL,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_NS, LBP_NS, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_SA, LBP_SA, LBP_XX, LBP_SA, LBP_XX, LBP_XX, LBP_SA,
- LBP_SA, LBP_XX, LBP_SA, LBP_XX, LBP_XX, LBP_SA, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_XX, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_XX, LBP_SA, LBP_SA, LBP_SA, LBP_XX, LBP_SA, LBP_XX, LBP_SA,
- LBP_XX, LBP_XX, LBP_SA, LBP_SA, LBP_XX, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_CM, LBP_SA, LBP_SA, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_XX, LBP_CM, LBP_CM, LBP_SA, LBP_XX, LBP_XX,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_XX, LBP_SA, LBP_XX,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_XX, LBP_XX, LBP_SA, LBP_SA, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_BA, LBP_GL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_CM, LBP_CM, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_CM, LBP_AL, LBP_CM,
- LBP_AL, LBP_CM, LBP_OP, LBP_CL, LBP_OP, LBP_CL, LBP_CM, LBP_CM,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_AL, LBP_CM, LBP_CM,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_CM, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_AL,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_SA, LBP_XX, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_XX, LBP_SA, LBP_SA, LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_ID,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_BA, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_BA, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_OP, LBP_CL, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_SA,
- LBP_SA, LBP_SA, LBP_SA, LBP_SA, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_NS, LBP_BA, LBP_NS, LBP_NS,
- LBP_NS, LBP_NS, LBP_NS, LBP_PR, LBP_AL, LBP_XX, LBP_XX, LBP_XX,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_BB, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_AL, LBP_XX, LBP_AL, LBP_XX, LBP_AL, LBP_XX, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_BA, LBP_BA, LBP_BA, LBP_BA, LBP_BA, LBP_BA, LBP_BA, LBP_GL,
- LBP_BA, LBP_BA, LBP_BA, LBP_ZW, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_BA, LBP_GL, LBP_BA, LBP_BA, LBP_B2, LBP_AI, LBP_AI, LBP_AL,
- LBP_QU, LBP_QU, LBP_OP, LBP_QU, LBP_QU, LBP_QU, LBP_OP, LBP_QU,
- LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_IN, LBP_IN, LBP_IN, LBP_BA,
- LBP_BK, LBP_BK, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_GL,
- LBP_PO, LBP_PO, LBP_PO, LBP_PO, LBP_PO, LBP_PO, LBP_PO, LBP_PO,
- LBP_AL, LBP_QU, LBP_QU, LBP_AI, LBP_NS, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_NS, LBP_OP, LBP_CL, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_AI, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_OP, LBP_CL, LBP_AI,
- LBP_AL, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_OP, LBP_CL, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_PR, LBP_PR, LBP_PR, LBP_PR, LBP_PR, LBP_PR, LBP_PR, LBP_PO,
- LBP_PR, LBP_PR, LBP_PR, LBP_PR, LBP_PR, LBP_PR, LBP_PR, LBP_PR,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_PO, LBP_AL, LBP_AI, LBP_AL, LBP_AL,
- LBP_AL, LBP_PO, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_PR, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_PO, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_AI, LBP_AI, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AI, LBP_AL,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AI, LBP_AL, LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AI,
- LBP_AI, LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AI,
- LBP_AL, LBP_AI, LBP_PR, LBP_PR, LBP_AL, LBP_AI, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AI, LBP_AL, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AL, LBP_AI, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AI, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AL, LBP_AL, LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AI, LBP_AI,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AI, LBP_AI,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AL,
- LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_OP, LBP_CL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AL, LBP_AL, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AI, LBP_AI, LBP_AL, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AI, LBP_AI,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AI, LBP_AL, LBP_AL,
- LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AI,
- LBP_AI, LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AI, LBP_AI,
- LBP_AI, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AI, LBP_AI, LBP_AI, LBP_AI, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AI, LBP_AL,
- LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AI,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AI, LBP_AL, LBP_AI, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AI, LBP_AL, LBP_AI, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AI, LBP_AI, LBP_AL, LBP_AI, LBP_AI, LBP_AI, LBP_AL, LBP_AI,
- LBP_AI, LBP_AI, LBP_AI, LBP_AL, LBP_AI, LBP_AI, LBP_AL, LBP_AI,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_XX, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_XX, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_CL, LBP_CL, LBP_ID, LBP_ID, LBP_NS, LBP_ID, LBP_ID,
- LBP_OP, LBP_CL, LBP_OP, LBP_CL, LBP_OP, LBP_CL, LBP_OP, LBP_CL,
- LBP_OP, LBP_CL, LBP_ID, LBP_ID, LBP_OP, LBP_CL, LBP_OP, LBP_CL,
- LBP_OP, LBP_CL, LBP_OP, LBP_CL, LBP_NS, LBP_OP, LBP_CL, LBP_CL,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_ID, LBP_NS, LBP_NS, LBP_NS, LBP_NS, LBP_NS, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX, LBP_XX, LBP_ID, LBP_ID,
- LBP_XX, LBP_NS, LBP_ID, LBP_NS, LBP_ID, LBP_NS, LBP_ID, LBP_NS,
- LBP_ID, LBP_NS, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_NS, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_NS, LBP_ID, LBP_NS, LBP_ID, LBP_NS,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_NS, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_CM, LBP_CM, LBP_NS, LBP_NS, LBP_NS, LBP_NS, LBP_XX,
- LBP_XX, LBP_NS, LBP_ID, LBP_NS, LBP_ID, LBP_NS, LBP_ID, LBP_NS,
- LBP_ID, LBP_NS, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_NS, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_NS, LBP_ID, LBP_NS, LBP_ID, LBP_NS,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_NS, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_NS, LBP_NS, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_NS, LBP_NS, LBP_NS, LBP_NS, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX, LBP_XX, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_XX, LBP_XX, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_XX, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_ID, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_CM, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_XX,
- LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_OP, LBP_CL,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_OP, LBP_CL, LBP_OP,
- LBP_CL, LBP_OP, LBP_CL, LBP_OP, LBP_CL, LBP_OP, LBP_CL, LBP_OP,
- LBP_CL, LBP_OP, LBP_CL, LBP_OP, LBP_CL, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_CL, LBP_ID, LBP_CL, LBP_XX, LBP_NS, LBP_NS, LBP_EX, LBP_EX,
- LBP_ID, LBP_OP, LBP_CL, LBP_OP, LBP_CL, LBP_OP, LBP_CL, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX,
- LBP_ID, LBP_PR, LBP_PO, LBP_ID, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_GL,
- LBP_XX, LBP_EX, LBP_ID, LBP_ID, LBP_PR, LBP_PO, LBP_ID, LBP_ID,
- LBP_OP, LBP_CL, LBP_ID, LBP_ID, LBP_CL, LBP_ID, LBP_CL, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_NS, LBP_NS, LBP_ID, LBP_ID, LBP_ID, LBP_EX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_OP, LBP_ID, LBP_CL, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_OP, LBP_ID, LBP_CL, LBP_ID, LBP_XX,
- LBP_XX, LBP_CL, LBP_OP, LBP_CL, LBP_CL, LBP_NS, LBP_AL, LBP_NS,
- LBP_NS, LBP_NS, LBP_NS, LBP_NS, LBP_NS, LBP_NS, LBP_NS, LBP_NS,
- LBP_NS, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_NS, LBP_NS,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX,
- LBP_PO, LBP_PR, LBP_ID, LBP_ID, LBP_ID, LBP_PR, LBP_PR, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_CM, LBP_CM, LBP_CM, LBP_CB, LBP_AI, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_AL, LBP_AL, LBP_AL, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_AL, LBP_AL, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_XX, LBP_XX, LBP_AL, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_XX,
- LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_AL, LBP_XX,
- LBP_XX, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_XX, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL, LBP_AL,
- LBP_AL, LBP_AL, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU, LBP_NU,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID,
- LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_ID, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_CM, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX, LBP_XX,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM,
- LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM, LBP_CM
- }
-};
+++ /dev/null
-/* linebreak.c - line breaking of Unicode strings
- Copyright (C) 2001-2003 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation,
-Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "linebreak.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include "c-ctype.h"
-#include "xsize.h"
-
-#include "utf8-ucs4.h"
-
-#ifdef unused
-#include "utf16-ucs4.h"
-
-static inline int
-u32_mbtouc (unsigned int *puc, const unsigned int *s, size_t n)
-{
- *puc = *s;
- return 1;
-}
-#endif
-
-
-/* Help GCC to generate good code for string comparisons with
- immediate strings. */
-#if defined (__GNUC__) && defined (__OPTIMIZE__)
-
-static inline int
-streq9 (const char *s1, const char *s2)
-{
- return strcmp (s1 + 9, s2 + 9) == 0;
-}
-
-static inline int
-streq8 (const char *s1, const char *s2, char s28)
-{
- if (s1[8] == s28)
- {
- if (s28 == 0)
- return 1;
- else
- return streq9 (s1, s2);
- }
- else
- return 0;
-}
-
-static inline int
-streq7 (const char *s1, const char *s2, char s27, char s28)
-{
- if (s1[7] == s27)
- {
- if (s27 == 0)
- return 1;
- else
- return streq8 (s1, s2, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq6 (const char *s1, const char *s2, char s26, char s27, char s28)
-{
- if (s1[6] == s26)
- {
- if (s26 == 0)
- return 1;
- else
- return streq7 (s1, s2, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq5 (const char *s1, const char *s2, char s25, char s26, char s27, char s28)
-{
- if (s1[5] == s25)
- {
- if (s25 == 0)
- return 1;
- else
- return streq6 (s1, s2, s26, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq4 (const char *s1, const char *s2, char s24, char s25, char s26, char s27, char s28)
-{
- if (s1[4] == s24)
- {
- if (s24 == 0)
- return 1;
- else
- return streq5 (s1, s2, s25, s26, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq3 (const char *s1, const char *s2, char s23, char s24, char s25, char s26, char s27, char s28)
-{
- if (s1[3] == s23)
- {
- if (s23 == 0)
- return 1;
- else
- return streq4 (s1, s2, s24, s25, s26, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq2 (const char *s1, const char *s2, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
-{
- if (s1[2] == s22)
- {
- if (s22 == 0)
- return 1;
- else
- return streq3 (s1, s2, s23, s24, s25, s26, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq1 (const char *s1, const char *s2, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
-{
- if (s1[1] == s21)
- {
- if (s21 == 0)
- return 1;
- else
- return streq2 (s1, s2, s22, s23, s24, s25, s26, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
-{
- if (s1[0] == s20)
- {
- if (s20 == 0)
- return 1;
- else
- return streq1 (s1, s2, s21, s22, s23, s24, s25, s26, s27, s28);
- }
- else
- return 0;
-}
-
-#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
- streq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28)
-
-#else
-
-#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
- (strcmp (s1, s2) == 0)
-
-#endif
-
-
-static int
-is_cjk_encoding (const char *encoding)
-{
- if (0
- /* Legacy Japanese encodings */
- || STREQ (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0)
- /* Legacy Chinese encodings */
- || STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
- || STREQ (encoding, "GBK", 'G', 'B', 'K', 0, 0, 0, 0, 0, 0)
- || STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)
- || STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)
- /* Legacy Korean encodings */
- || STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
- || STREQ (encoding, "CP949", 'C', 'P', '9', '4', '9', 0, 0, 0, 0)
- || STREQ (encoding, "JOHAB", 'J', 'O', 'H', 'A', 'B', 0, 0, 0, 0))
- return 1;
- return 0;
-}
-
-static int
-is_utf8_encoding (const char *encoding)
-{
- if (STREQ (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0 ,0))
- return 1;
- return 0;
-}
-
-
-/* Determine number of column positions required for UC. */
-int uc_width (unsigned int uc, const char *encoding);
-
-/*
- * Non-spacing attribute table.
- * Consists of:
- * - Non-spacing characters; generated from PropList.txt or
- * "grep '^[^;]*;[^;]*;[^;]*;[^;]*;NSM;' UnicodeData.txt"
- * - Format control characters; generated from
- * "grep '^[^;]*;[^;]*;Cf;' UnicodeData.txt"
- * - Zero width characters; generated from
- * "grep '^[^;]*;ZERO WIDTH ' UnicodeData.txt"
- */
-static const unsigned char nonspacing_table_data[16*64] = {
- /* 0x0000-0x01ff */
- 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0x0000-0x003f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x0040-0x007f */
- 0xff, 0xff, 0xff, 0xff, 0x00, 0x20, 0x00, 0x00, /* 0x0080-0x00bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00c0-0x00ff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0100-0x013f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0140-0x017f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0180-0x01bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x01c0-0x01ff */
- /* 0x0200-0x03ff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0200-0x023f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0240-0x027f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0280-0x02bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x02c0-0x02ff */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x0300-0x033f */
- 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0x00, 0x00, /* 0x0340-0x037f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0380-0x03bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x03c0-0x03ff */
- /* 0x0400-0x05ff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0400-0x043f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0440-0x047f */
- 0x78, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0480-0x04bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04c0-0x04ff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0500-0x053f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0540-0x057f */
- 0x00, 0x00, 0xfe, 0xff, 0xfb, 0xff, 0xff, 0xbb, /* 0x0580-0x05bf */
- 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x05c0-0x05ff */
- /* 0x0600-0x07ff */
- 0x0f, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0600-0x063f */
- 0x00, 0xf8, 0xff, 0x01, 0x00, 0x00, 0x01, 0x00, /* 0x0640-0x067f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0680-0x06bf */
- 0x00, 0x00, 0xc0, 0xff, 0x9f, 0x3d, 0x00, 0x00, /* 0x06c0-0x06ff */
- 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0x0700-0x073f */
- 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0740-0x077f */
- 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0x00, /* 0x0780-0x07bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x07c0-0x07ff */
- /* 0x0800-0x09ff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0800-0x083f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0840-0x087f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0880-0x08bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08c0-0x08ff */
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0900-0x093f */
- 0xfe, 0x21, 0x1e, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0940-0x097f */
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0980-0x09bf */
- 0x1e, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x09c0-0x09ff */
- /* 0x0a00-0x0bff */
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a00-0x0a3f */
- 0x86, 0x39, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, /* 0x0a40-0x0a7f */
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a80-0x0abf */
- 0xbe, 0x21, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0ac0-0x0aff */
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, /* 0x0b00-0x0b3f */
- 0x0e, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0b40-0x0b7f */
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0b80-0x0bbf */
- 0x01, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0bc0-0x0bff */
- /* 0x0c00-0x0dff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, /* 0x0c00-0x0c3f */
- 0xc1, 0x3d, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0c40-0x0c7f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0c80-0x0cbf */
- 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0cc0-0x0cff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d00-0x0d3f */
- 0x0e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d40-0x0d7f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d80-0x0dbf */
- 0x00, 0x04, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0dc0-0x0dff */
- /* 0x0e00-0x0fff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x07, /* 0x0e00-0x0e3f */
- 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0e40-0x0e7f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x1b, /* 0x0e80-0x0ebf */
- 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0ec0-0x0eff */
- 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xa0, 0x02, /* 0x0f00-0x0f3f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x7f, /* 0x0f40-0x0f7f */
- 0xdf, 0x00, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x1f, /* 0x0f80-0x0fbf */
- 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0fc0-0x0fff */
- /* 0x1000-0x11ff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xc5, 0x02, /* 0x1000-0x103f */
- 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* 0x1040-0x107f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1080-0x10bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c0-0x10ff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1100-0x113f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1140-0x117f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1180-0x11bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11c0-0x11ff */
- /* 0x1600-0x17ff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1600-0x163f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1640-0x167f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1680-0x16bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16c0-0x16ff */
- 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, /* 0x1700-0x173f */
- 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, /* 0x1740-0x177f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x3f, /* 0x1780-0x17bf */
- 0x40, 0xfe, 0x0f, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x17c0-0x17ff */
- /* 0x1800-0x19ff */
- 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1800-0x183f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1840-0x187f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, /* 0x1880-0x18bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18c0-0x18ff */
- 0x00, 0x00, 0x00, 0x00, 0x87, 0x0f, 0x04, 0x0e, /* 0x1900-0x193f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1940-0x197f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1980-0x19bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x19c0-0x19ff */
- /* 0x2000-0x21ff */
- 0x00, 0xf8, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, /* 0x2000-0x203f */
- 0x00, 0x00, 0x00, 0x00, 0x0f, 0xfc, 0x00, 0x00, /* 0x2040-0x207f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2080-0x20bf */
- 0x00, 0x00, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, /* 0x20c0-0x20ff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2100-0x213f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2140-0x217f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2180-0x21bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x21c0-0x21ff */
- /* 0x3000-0x31ff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, /* 0x3000-0x303f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3040-0x307f */
- 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, /* 0x3080-0x30bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30c0-0x30ff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3100-0x313f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3140-0x317f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3180-0x31bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x31c0-0x31ff */
- /* 0xfa00-0xfbff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa00-0xfa3f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa40-0xfa7f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa80-0xfabf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfac0-0xfaff */
- 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, /* 0xfb00-0xfb3f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb40-0xfb7f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb80-0xfbbf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfbc0-0xfbff */
- /* 0xfe00-0xffff */
- 0xff, 0xff, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, /* 0xfe00-0xfe3f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe40-0xfe7f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe80-0xfebf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0xfec0-0xfeff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff00-0xff3f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff40-0xff7f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff80-0xffbf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, /* 0xffc0-0xffff */
- /* 0x1d000-0x1d1ff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d000-0x1d03f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d040-0x1d07f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d080-0x1d0bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d0c0-0x1d0ff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d100-0x1d13f */
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0xf8, /* 0x1d140-0x1d17f */
- 0xe7, 0x0f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, /* 0x1d180-0x1d1bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x1d1c0-0x1d1ff */
-};
-static const signed char nonspacing_table_ind[240] = {
- 0, 1, 2, 3, 4, 5, 6, 7, /* 0x0000-0x0fff */
- 8, -1, -1, 9, 10, -1, -1, -1, /* 0x1000-0x1fff */
- 11, -1, -1, -1, -1, -1, -1, -1, /* 0x2000-0x2fff */
- 12, -1, -1, -1, -1, -1, -1, -1, /* 0x3000-0x3fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x4000-0x4fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x5000-0x5fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x6000-0x6fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x7000-0x7fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x8000-0x8fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x9000-0x9fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0xa000-0xafff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0xb000-0xbfff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0xc000-0xcfff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0xd000-0xdfff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0xe000-0xefff */
- -1, -1, -1, -1, -1, 13, -1, 14, /* 0xf000-0xffff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x10000-0x10fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x11000-0x11fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x12000-0x12fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x13000-0x13fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x14000-0x14fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x15000-0x15fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x16000-0x16fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x17000-0x17fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x18000-0x18fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x19000-0x19fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1a000-0x1afff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1b000-0x1bfff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1c000-0x1cfff */
- 15, -1, -1, -1, -1, -1, -1, -1 /* 0x1d000-0x1dfff */
-};
-
-/* Determine number of column positions required for UC. */
-int
-uc_width (unsigned int uc, const char *encoding)
-{
- /* Test for non-spacing or control character. */
- if ((uc >> 9) < 240)
- {
- int ind = nonspacing_table_ind[uc >> 9];
- if (ind >= 0)
- if ((nonspacing_table_data[64*ind + ((uc >> 3) & 63)] >> (uc & 7)) & 1)
- {
- if (uc > 0 && uc < 0xa0)
- return -1;
- else
- return 0;
- }
- }
- else if ((uc >> 9) == (0xe0000 >> 9))
- {
- if (uc < 0xe0100
- ? (uc >= 0xe0020 ? uc <= 0xe007f : uc == 0xe0001)
- : (uc <= 0xe01ef))
- return 0;
- }
- /* Test for double-width character.
- * Generated from "grep '^....;[WF]' EastAsianWidth.txt"
- * and "grep '^....;[^WF]' EastAsianWidth.txt"
- */
- if (uc >= 0x1100
- && ((uc < 0x1160) /* Hangul Jamo */
- || (uc >= 0x2e80 && uc < 0x4dc0 /* CJK */
- && !(uc == 0x303f))
- || (uc >= 0x4e00 && uc < 0xa4d0) /* CJK ... Yi */
- || (uc >= 0xac00 && uc < 0xd7a4) /* Hangul Syllables */
- || (uc >= 0xf900 && uc < 0xfb00) /* CJK Compatibility Ideographs */
- || (uc >= 0xfe30 && uc < 0xfe70) /* CJK Compatibility Forms */
- || (uc >= 0xff00 && uc < 0xff61) /* Fullwidth Forms */
- || (uc >= 0xffe0 && uc < 0xffe7)
- || (uc >= 0x20000 && uc <= 0x2fffd) /* CJK, CJK Compatibility Ideographs */
- || (uc >= 0x30000 && uc <= 0x3fffd)
- ) )
- return 2;
- /* In ancient CJK encodings, Cyrillic and most other characters are
- double-width as well. */
- if (uc >= 0x00A1 && uc < 0xFF61 && uc != 0x20A9
- && is_cjk_encoding (encoding))
- return 2;
- return 1;
-}
-
-
-#ifdef unused
-
-/* Determine number of column positions required for first N units
- (or fewer if S ends before this) in S. */
-
-int
-u8_width (const unsigned char *s, size_t n, const char *encoding)
-{
- const unsigned char *s_end = s + n;
- int width = 0;
-
- while (s < s_end)
- {
- unsigned int uc;
- int w;
-
- s += u8_mbtouc (&uc, s, s_end - s);
-
- if (uc == 0)
- break; /* end of string reached */
-
- w = uc_width (uc, encoding);
- if (w >= 0) /* ignore control characters in the string */
- width += w;
- }
-
- return width;
-}
-
-int
-u16_width (const unsigned short *s, size_t n, const char *encoding)
-{
- const unsigned short *s_end = s + n;
- int width = 0;
-
- while (s < s_end)
- {
- unsigned int uc;
- int w;
-
- s += u16_mbtouc (&uc, s, s_end - s);
-
- if (uc == 0)
- break; /* end of string reached */
-
- w = uc_width (uc, encoding);
- if (w >= 0) /* ignore control characters in the string */
- width += w;
- }
-
- return width;
-}
-
-int
-u32_width (const unsigned int *s, size_t n, const char *encoding)
-{
- const unsigned int *s_end = s + n;
- int width = 0;
-
- while (s < s_end)
- {
- unsigned int uc = *s++;
- int w;
-
- if (uc == 0)
- break; /* end of string reached */
-
- w = uc_width (uc, encoding);
- if (w >= 0) /* ignore control characters in the string */
- width += w;
- }
-
- return width;
-}
-
-#endif
-
-
-/* Determine the line break points in S, and store the result at p[0..n-1]. */
-/* We don't support line breaking of complex-context dependent characters
- (Thai, Lao, Myanmar, Khmer) yet, because it requires dictionary lookup. */
-
-/* Line breaking classification. */
-
-enum
-{
- /* Values >= 20 are resolved at run time. */
- LBP_BK = 0, /* mandatory break */
-/*LBP_CR, carriage return - not used here because it's a DOSism */
-/*LBP_LF, line feed - not used here because it's a DOSism */
- LBP_CM = 20, /* attached characters and combining marks */
-/*LBP_SG, surrogates - not used here because they are not characters */
- LBP_ZW = 1, /* zero width space */
- LBP_IN = 2, /* inseparable */
- LBP_GL = 3, /* non-breaking (glue) */
- LBP_CB = 22, /* contingent break opportunity */
- LBP_SP = 21, /* space */
- LBP_BA = 4, /* break opportunity after */
- LBP_BB = 5, /* break opportunity before */
- LBP_B2 = 6, /* break opportunity before and after */
- LBP_HY = 7, /* hyphen */
- LBP_NS = 8, /* non starter */
- LBP_OP = 9, /* opening punctuation */
- LBP_CL = 10, /* closing punctuation */
- LBP_QU = 11, /* ambiguous quotation */
- LBP_EX = 12, /* exclamation/interrogation */
- LBP_ID = 13, /* ideographic */
- LBP_NU = 14, /* numeric */
- LBP_IS = 15, /* infix separator (numeric) */
- LBP_SY = 16, /* symbols allowing breaks */
- LBP_AL = 17, /* ordinary alphabetic and symbol characters */
- LBP_PR = 18, /* prefix (numeric) */
- LBP_PO = 19, /* postfix (numeric) */
- LBP_SA = 23, /* complex context (South East Asian) */
- LBP_AI = 24, /* ambiguous (alphabetic or ideograph) */
- LBP_XX = 25 /* unknown */
-};
-
-#include "lbrkprop.h"
-
-static inline unsigned char
-lbrkprop_lookup (unsigned int uc)
-{
- unsigned int index1 = uc >> lbrkprop_header_0;
- if (index1 < lbrkprop_header_1)
- {
- int lookup1 = lbrkprop.level1[index1];
- if (lookup1 >= 0)
- {
- unsigned int index2 = (uc >> lbrkprop_header_2) & lbrkprop_header_3;
- int lookup2 = lbrkprop.level2[lookup1 + index2];
- if (lookup2 >= 0)
- {
- unsigned int index3 = uc & lbrkprop_header_4;
- return lbrkprop.level3[lookup2 + index3];
- }
- }
- }
- return LBP_XX;
-}
-
-/* Table indexed by two line breaking classifications. */
-#define D 1 /* direct break opportunity, empty in table 7.3 of UTR #14 */
-#define I 2 /* indirect break opportunity, '%' in table 7.3 of UTR #14 */
-#define P 3 /* prohibited break, '^' in table 7.3 of UTR #14 */
-static const unsigned char lbrk_table[19][19] = {
- /* after */
- /* ZW IN GL BA BB B2 HY NS OP CL QU EX ID NU IS SY AL PR PO */
-/* ZW */ { P, D, D, D, D, D, D, D, D, D, D, D, D, D, D, D, D, D, D, },
-/* IN */ { P, I, I, I, D, D, I, I, D, P, I, P, D, D, P, P, D, D, D, },
-/* GL */ { P, I, I, I, I, I, I, I, I, P, I, P, I, I, P, P, I, I, I, },
-/* BA */ { P, D, I, I, D, D, I, I, D, P, I, P, D, D, P, P, D, D, D, },
-/* BB */ { P, I, I, I, I, I, I, I, I, P, I, P, I, I, P, P, I, I, I, },
-/* B2 */ { P, D, I, I, D, P, I, I, D, P, I, P, D, D, P, P, D, D, D, },
-/* HY */ { P, D, I, I, D, D, I, I, D, P, I, P, D, D, P, P, D, D, D, },
-/* NS */ { P, D, I, I, D, D, I, I, D, P, I, P, D, D, P, P, D, D, D, },
-/* OP */ { P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, },
-/* CL */ { P, D, I, I, D, D, I, P, D, P, I, P, D, D, P, P, D, D, I, },
-/* QU */ { P, I, I, I, I, I, I, I, P, P, I, P, I, I, P, P, I, I, I, },
-/* EX */ { P, D, I, I, D, D, I, I, D, P, I, P, D, D, P, P, D, D, D, },
-/* ID */ { P, I, I, I, D, D, I, I, D, P, I, P, D, D, P, P, D, D, I, },
-/* NU */ { P, I, I, I, D, D, I, I, D, P, I, P, D, I, P, P, I, D, I, },
-/* IS */ { P, D, I, I, D, D, I, I, D, P, I, P, D, I, P, P, D, D, D, },
-/* SY */ { P, D, I, I, D, D, I, I, D, P, I, P, D, I, P, P, D, D, D, },
-/* AL */ { P, I, I, I, D, D, I, I, D, P, I, P, D, I, P, P, I, D, D, },
-/* PR */ { P, D, I, I, D, D, I, I, I, P, I, P, I, I, P, P, I, D, D, },
-/* PO */ { P, D, I, I, D, D, I, I, D, P, I, P, D, D, P, P, D, D, D, },
-/* "" */
-/* before */
-};
-/* Note: The (B2,B2) entry should probably be D instead of P. */
-/* Note: The (PR,ID) entry should probably be D instead of I. */
-
-void
-u8_possible_linebreaks (const unsigned char *s, size_t n, const char *encoding, char *p)
-{
- int LBP_AI_REPLACEMENT = (is_cjk_encoding (encoding) ? LBP_ID : LBP_AL);
- const unsigned char *s_end = s + n;
- int last_prop = LBP_BK; /* line break property of last non-space character */
- char *seen_space = NULL; /* Was a space seen after the last non-space character? */
- char *seen_space2 = NULL; /* At least two spaces after the last non-space? */
-
- /* Don't break inside multibyte characters. */
- memset (p, UC_BREAK_PROHIBITED, n);
-
- while (s < s_end)
- {
- unsigned int uc;
- int count = u8_mbtouc (&uc, s, s_end - s);
- int prop = lbrkprop_lookup (uc);
-
- if (prop == LBP_BK)
- {
- /* Mandatory break. */
- *p = UC_BREAK_MANDATORY;
- last_prop = LBP_BK;
- seen_space = NULL;
- seen_space2 = NULL;
- }
- else
- {
- char *q;
-
- /* Resolve property values whose behaviour is not fixed. */
- switch (prop)
- {
- case LBP_AI:
- /* Resolve ambiguous. */
- prop = LBP_AI_REPLACEMENT;
- break;
- case LBP_CB:
- /* This is arbitrary. */
- prop = LBP_ID;
- break;
- case LBP_SA:
- /* We don't handle complex scripts yet.
- Treat LBP_SA like LBP_XX. */
- case LBP_XX:
- /* This is arbitrary. */
- prop = LBP_AL;
- break;
- }
-
- /* Deal with combining characters. */
- q = p;
- if (prop == LBP_CM)
- {
- /* Don't break just before a combining character. */
- *p = UC_BREAK_PROHIBITED;
- /* A combining character turns a preceding space into LBP_AL. */
- if (seen_space != NULL)
- {
- q = seen_space;
- seen_space = seen_space2;
- prop = LBP_AL;
- goto lookup_via_table;
- }
- }
- else if (prop == LBP_SP)
- {
- /* Don't break just before a space. */
- *p = UC_BREAK_PROHIBITED;
- seen_space2 = seen_space;
- seen_space = p;
- }
- else
- {
- lookup_via_table:
- /* prop must be usable as an index for table 7.3 of UTR #14. */
- if (!(prop >= 1 && prop <= sizeof(lbrk_table) / sizeof(lbrk_table[0])))
- abort ();
-
- if (last_prop == LBP_BK)
- {
- /* Don't break at the beginning of a line. */
- *q = UC_BREAK_PROHIBITED;
- }
- else
- {
- switch (lbrk_table [last_prop-1] [prop-1])
- {
- case D:
- *q = UC_BREAK_POSSIBLE;
- break;
- case I:
- *q = (seen_space != NULL ? UC_BREAK_POSSIBLE : UC_BREAK_PROHIBITED);
- break;
- case P:
- *q = UC_BREAK_PROHIBITED;
- break;
- default:
- abort ();
- }
- }
- last_prop = prop;
- seen_space = NULL;
- seen_space2 = NULL;
- }
- }
-
- s += count;
- p += count;
- }
-}
-
-#ifdef unused
-
-void
-u16_possible_linebreaks (const unsigned short *s, size_t n, const char *encoding, char *p)
-{
- int LBP_AI_REPLACEMENT = (is_cjk_encoding (encoding) ? LBP_ID : LBP_AL);
- const unsigned short *s_end = s + n;
- int last_prop = LBP_BK; /* line break property of last non-space character */
- char *seen_space = NULL; /* Was a space seen after the last non-space character? */
- char *seen_space2 = NULL; /* At least two spaces after the last non-space? */
-
- /* Don't break inside multibyte characters. */
- memset (p, UC_BREAK_PROHIBITED, n);
-
- while (s < s_end)
- {
- unsigned int uc;
- int count = u16_mbtouc (&uc, s, s_end - s);
- int prop = lbrkprop_lookup (uc);
-
- if (prop == LBP_BK)
- {
- /* Mandatory break. */
- *p = UC_BREAK_MANDATORY;
- last_prop = LBP_BK;
- seen_space = NULL;
- seen_space2 = NULL;
- }
- else
- {
- char *q;
-
- /* Resolve property values whose behaviour is not fixed. */
- switch (prop)
- {
- case LBP_AI:
- /* Resolve ambiguous. */
- prop = LBP_AI_REPLACEMENT;
- break;
- case LBP_CB:
- /* This is arbitrary. */
- prop = LBP_ID;
- break;
- case LBP_SA:
- /* We don't handle complex scripts yet.
- Treat LBP_SA like LBP_XX. */
- case LBP_XX:
- /* This is arbitrary. */
- prop = LBP_AL;
- break;
- }
-
- /* Deal with combining characters. */
- q = p;
- if (prop == LBP_CM)
- {
- /* Don't break just before a combining character. */
- *p = UC_BREAK_PROHIBITED;
- /* A combining character turns a preceding space into LBP_AL. */
- if (seen_space != NULL)
- {
- q = seen_space;
- seen_space = seen_space2;
- prop = LBP_AL;
- goto lookup_via_table;
- }
- }
- else if (prop == LBP_SP)
- {
- /* Don't break just before a space. */
- *p = UC_BREAK_PROHIBITED;
- seen_space2 = seen_space;
- seen_space = p;
- }
- else
- {
- lookup_via_table:
- /* prop must be usable as an index for table 7.3 of UTR #14. */
- if (!(prop >= 1 && prop <= sizeof(lbrk_table) / sizeof(lbrk_table[0])))
- abort ();
-
- if (last_prop == LBP_BK)
- {
- /* Don't break at the beginning of a line. */
- *q = UC_BREAK_PROHIBITED;
- }
- else
- {
- switch (lbrk_table [last_prop-1] [prop-1])
- {
- case D:
- *q = UC_BREAK_POSSIBLE;
- break;
- case I:
- *q = (seen_space != NULL ? UC_BREAK_POSSIBLE : UC_BREAK_PROHIBITED);
- break;
- case P:
- *q = UC_BREAK_PROHIBITED;
- break;
- default:
- abort ();
- }
- }
- last_prop = prop;
- seen_space = NULL;
- seen_space2 = NULL;
- }
- }
-
- s += count;
- p += count;
- }
-}
-
-void
-u32_possible_linebreaks (const unsigned int *s, size_t n, const char *encoding, char *p)
-{
- int LBP_AI_REPLACEMENT = (is_cjk_encoding (encoding) ? LBP_ID : LBP_AL);
- const unsigned int *s_end = s + n;
- int last_prop = LBP_BK; /* line break property of last non-space character */
- char *seen_space = NULL; /* Was a space seen after the last non-space character? */
- char *seen_space2 = NULL; /* At least two spaces after the last non-space? */
-
- while (s < s_end)
- {
- unsigned int uc = *s;
- int prop = lbrkprop_lookup (uc);
-
- if (prop == LBP_BK)
- {
- /* Mandatory break. */
- *p = UC_BREAK_MANDATORY;
- last_prop = LBP_BK;
- seen_space = NULL;
- seen_space2 = NULL;
- }
- else
- {
- char *q;
-
- /* Resolve property values whose behaviour is not fixed. */
- switch (prop)
- {
- case LBP_AI:
- /* Resolve ambiguous. */
- prop = LBP_AI_REPLACEMENT;
- break;
- case LBP_CB:
- /* This is arbitrary. */
- prop = LBP_ID;
- break;
- case LBP_SA:
- /* We don't handle complex scripts yet.
- Treat LBP_SA like LBP_XX. */
- case LBP_XX:
- /* This is arbitrary. */
- prop = LBP_AL;
- break;
- }
-
- /* Deal with combining characters. */
- q = p;
- if (prop == LBP_CM)
- {
- /* Don't break just before a combining character. */
- *p = UC_BREAK_PROHIBITED;
- /* A combining character turns a preceding space into LBP_AL. */
- if (seen_space != NULL)
- {
- q = seen_space;
- seen_space = seen_space2;
- prop = LBP_AL;
- goto lookup_via_table;
- }
- }
- else if (prop == LBP_SP)
- {
- /* Don't break just before a space. */
- *p = UC_BREAK_PROHIBITED;
- seen_space2 = seen_space;
- seen_space = p;
- }
- else
- {
- lookup_via_table:
- /* prop must be usable as an index for table 7.3 of UTR #14. */
- if (!(prop >= 1 && prop <= sizeof(lbrk_table) / sizeof(lbrk_table[0])))
- abort ();
-
- if (last_prop == LBP_BK)
- {
- /* Don't break at the beginning of a line. */
- *q = UC_BREAK_PROHIBITED;
- }
- else
- {
- switch (lbrk_table [last_prop-1] [prop-1])
- {
- case D:
- *q = UC_BREAK_POSSIBLE;
- break;
- case I:
- *q = (seen_space != NULL ? UC_BREAK_POSSIBLE : UC_BREAK_PROHIBITED);
- break;
- case P:
- *q = UC_BREAK_PROHIBITED;
- break;
- default:
- abort ();
- }
- }
- last_prop = prop;
- seen_space = NULL;
- seen_space2 = NULL;
- }
- }
-
- s++;
- p++;
- }
-}
-
-#endif
-
-
-/* Choose the best line breaks, assuming the uc_width function.
- Return the column after the end of the string. */
-
-int
-u8_width_linebreaks (const unsigned char *s, size_t n,
- int width, int start_column, int at_end_columns,
- const char *o, const char *encoding,
- char *p)
-{
- const unsigned char *s_end;
- char *last_p;
- int last_column;
- int piece_width;
-
- u8_possible_linebreaks (s, n, encoding, p);
-
- s_end = s + n;
- last_p = NULL;
- last_column = start_column;
- piece_width = 0;
- while (s < s_end)
- {
- unsigned int uc;
- int count = u8_mbtouc (&uc, s, s_end - s);
-
- /* Respect the override. */
- if (o != NULL && *o != UC_BREAK_UNDEFINED)
- *p = *o;
-
- if (*p == UC_BREAK_POSSIBLE || *p == UC_BREAK_MANDATORY)
- {
- /* An atomic piece of text ends here. */
- if (last_p != NULL && last_column + piece_width > width)
- {
- /* Insert a line break. */
- *last_p = UC_BREAK_POSSIBLE;
- last_column = 0;
- }
- }
-
- if (*p == UC_BREAK_MANDATORY)
- {
- /* uc is a line break character. */
- /* Start a new piece at column 0. */
- last_p = NULL;
- last_column = 0;
- piece_width = 0;
- }
- else
- {
- /* uc is not a line break character. */
- int w;
-
- if (*p == UC_BREAK_POSSIBLE)
- {
- /* Start a new piece. */
- last_p = p;
- last_column += piece_width;
- piece_width = 0;
- /* No line break for the moment, may be turned into
- UC_BREAK_POSSIBLE later, via last_p. */
- }
-
- *p = UC_BREAK_PROHIBITED;
-
- w = uc_width (uc, encoding);
- if (w >= 0) /* ignore control characters in the string */
- piece_width += w;
- }
-
- s += count;
- p += count;
- if (o != NULL)
- o += count;
- }
-
- /* The last atomic piece of text ends here. */
- if (last_p != NULL && last_column + piece_width + at_end_columns > width)
- {
- /* Insert a line break. */
- *last_p = UC_BREAK_POSSIBLE;
- last_column = 0;
- }
-
- return last_column + piece_width;
-}
-
-#ifdef unused
-
-int
-u16_width_linebreaks (const unsigned short *s, size_t n,
- int width, int start_column, int at_end_columns,
- const char *o, const char *encoding,
- char *p)
-{
- const unsigned short *s_end;
- char *last_p;
- int last_column;
- int piece_width;
-
- u16_possible_linebreaks (s, n, encoding, p);
-
- s_end = s + n;
- last_p = NULL;
- last_column = start_column;
- piece_width = 0;
- while (s < s_end)
- {
- unsigned int uc;
- int count = u16_mbtouc (&uc, s, s_end - s);
-
- /* Respect the override. */
- if (o != NULL && *o != UC_BREAK_UNDEFINED)
- *p = *o;
-
- if (*p == UC_BREAK_POSSIBLE || *p == UC_BREAK_MANDATORY)
- {
- /* An atomic piece of text ends here. */
- if (last_p != NULL && last_column + piece_width > width)
- {
- /* Insert a line break. */
- *last_p = UC_BREAK_POSSIBLE;
- last_column = 0;
- }
- }
-
- if (*p == UC_BREAK_MANDATORY)
- {
- /* uc is a line break character. */
- /* Start a new piece at column 0. */
- last_p = NULL;
- last_column = 0;
- piece_width = 0;
- }
- else
- {
- /* uc is not a line break character. */
- int w;
-
- if (*p == UC_BREAK_POSSIBLE)
- {
- /* Start a new piece. */
- last_p = p;
- last_column += piece_width;
- piece_width = 0;
- /* No line break for the moment, may be turned into
- UC_BREAK_POSSIBLE later, via last_p. */
- }
-
- *p = UC_BREAK_PROHIBITED;
-
- w = uc_width (uc, encoding);
- if (w >= 0) /* ignore control characters in the string */
- piece_width += w;
- }
-
- s += count;
- p += count;
- if (o != NULL)
- o += count;
- }
-
- /* The last atomic piece of text ends here. */
- if (last_p != NULL && last_column + piece_width + at_end_columns > width)
- {
- /* Insert a line break. */
- *last_p = UC_BREAK_POSSIBLE;
- last_column = 0;
- }
-
- return last_column + piece_width;
-}
-
-int
-u32_width_linebreaks (const unsigned int *s, size_t n,
- int width, int start_column, int at_end_columns,
- const char *o, const char *encoding,
- char *p)
-{
- const unsigned int *s_end;
- char *last_p;
- int last_column;
- int piece_width;
-
- u32_possible_linebreaks (s, n, encoding, p);
-
- s_end = s + n;
- last_p = NULL;
- last_column = start_column;
- piece_width = 0;
- while (s < s_end)
- {
- unsigned int uc = *s;
-
- /* Respect the override. */
- if (o != NULL && *o != UC_BREAK_UNDEFINED)
- *p = *o;
-
- if (*p == UC_BREAK_POSSIBLE || *p == UC_BREAK_MANDATORY)
- {
- /* An atomic piece of text ends here. */
- if (last_p != NULL && last_column + piece_width > width)
- {
- /* Insert a line break. */
- *last_p = UC_BREAK_POSSIBLE;
- last_column = 0;
- }
- }
-
- if (*p == UC_BREAK_MANDATORY)
- {
- /* uc is a line break character. */
- /* Start a new piece at column 0. */
- last_p = NULL;
- last_column = 0;
- piece_width = 0;
- }
- else
- {
- /* uc is not a line break character. */
- int w;
-
- if (*p == UC_BREAK_POSSIBLE)
- {
- /* Start a new piece. */
- last_p = p;
- last_column += piece_width;
- piece_width = 0;
- /* No line break for the moment, may be turned into
- UC_BREAK_POSSIBLE later, via last_p. */
- }
-
- *p = UC_BREAK_PROHIBITED;
-
- w = uc_width (uc, encoding);
- if (w >= 0) /* ignore control characters in the string */
- piece_width += w;
- }
-
- s++;
- p++;
- if (o != NULL)
- o++;
- }
-
- /* The last atomic piece of text ends here. */
- if (last_p != NULL && last_column + piece_width + at_end_columns > width)
- {
- /* Insert a line break. */
- *last_p = UC_BREAK_POSSIBLE;
- last_column = 0;
- }
-
- return last_column + piece_width;
-}
-
-#endif
-
-
-#ifdef TEST1
-
-#include <stdio.h>
-
-/* Read the contents of an input stream, and return it, terminated with a NUL
- byte. */
-char *
-read_file (FILE *stream)
-{
-#define BUFSIZE 4096
- char *buf = NULL;
- int alloc = 0;
- int size = 0;
- int count;
-
- while (! feof (stream))
- {
- if (size + BUFSIZE > alloc)
- {
- alloc = alloc + alloc / 2;
- if (alloc < size + BUFSIZE)
- alloc = size + BUFSIZE;
- buf = realloc (buf, alloc);
- if (buf == NULL)
- {
- fprintf (stderr, "out of memory\n");
- exit (1);
- }
- }
- count = fread (buf + size, 1, BUFSIZE, stream);
- if (count == 0)
- {
- if (ferror (stream))
- {
- perror ("fread");
- exit (1);
- }
- }
- else
- size += count;
- }
- buf = realloc (buf, size + 1);
- if (buf == NULL)
- {
- fprintf (stderr, "out of memory\n");
- exit (1);
- }
- buf[size] = '\0';
- return buf;
-#undef BUFSIZE
-}
-
-int
-main (int argc, char * argv[])
-{
- if (argc == 1)
- {
- /* Display all the break opportunities in the input string. */
- char *input = read_file (stdin);
- int length = strlen (input);
- char *breaks = malloc (length);
- int i;
-
- u8_possible_linebreaks ((unsigned char *) input, length, "UTF-8", breaks);
-
- for (i = 0; i < length; i++)
- {
- switch (breaks[i])
- {
- case UC_BREAK_POSSIBLE:
- /* U+2027 in UTF-8 encoding */
- putc (0xe2, stdout); putc (0x80, stdout); putc (0xa7, stdout);
- break;
- case UC_BREAK_MANDATORY:
- /* U+21B2 (or U+21B5) in UTF-8 encoding */
- putc (0xe2, stdout); putc (0x86, stdout); putc (0xb2, stdout);
- break;
- case UC_BREAK_PROHIBITED:
- break;
- default:
- abort ();
- }
- putc (input[i], stdout);
- }
-
- free (breaks);
-
- return 0;
- }
- else if (argc == 2)
- {
- /* Insert line breaks for a given width. */
- int width = atoi (argv[1]);
- char *input = read_file (stdin);
- int length = strlen (input);
- char *breaks = malloc (length);
- int i;
-
- u8_width_linebreaks ((unsigned char *) input, length, width, 0, 0, NULL, "UTF-8", breaks);
-
- for (i = 0; i < length; i++)
- {
- switch (breaks[i])
- {
- case UC_BREAK_POSSIBLE:
- putc ('\n', stdout);
- break;
- case UC_BREAK_MANDATORY:
- break;
- case UC_BREAK_PROHIBITED:
- break;
- default:
- abort ();
- }
- putc (input[i], stdout);
- }
-
- free (breaks);
-
- return 0;
- }
- else
- return 1;
-}
-
-#endif /* TEST1 */
-
-
-/* Now the same thing with an arbitrary encoding.
-
- We convert the input string to Unicode.
-
- The standardized Unicode encodings are UTF-8, UCS-2, UCS-4, UTF-16,
- UTF-16BE, UTF-16LE, UTF-7. UCS-2 supports only characters up to
- \U0000FFFF. UTF-16 and variants support only characters up to
- \U0010FFFF. UTF-7 is way too complex and not supported by glibc-2.1.
- UCS-4 specification leaves doubts about endianness and byte order mark.
- glibc currently interprets it as big endian without byte order mark,
- but this is not backed by an RFC. So we use UTF-8. It supports
- characters up to \U7FFFFFFF and is unambiguously defined. */
-
-#if HAVE_ICONV
-
-#include <iconv.h>
-#include <errno.h>
-
-/* Luckily, the encoding's name is platform independent. */
-#define UTF8_NAME "UTF-8"
-
-/* Return the length of a string after conversion through an iconv_t. */
-static size_t
-iconv_string_length (iconv_t cd, const char *s, size_t n)
-{
-#define TMPBUFSIZE 4096
- size_t count = 0;
- char tmpbuf[TMPBUFSIZE];
- const char *inptr = s;
- size_t insize = n;
- while (insize > 0)
- {
- char *outptr = tmpbuf;
- size_t outsize = TMPBUFSIZE;
- size_t res = iconv (cd, (ICONV_CONST char **) &inptr, &insize, &outptr, &outsize);
- if (res == (size_t)(-1) && errno != E2BIG)
- return (size_t)(-1);
- count += outptr - tmpbuf;
- }
- /* Avoid glibc-2.1 bug and Solaris 7 through 9 bug. */
-#if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
- {
- char *outptr = tmpbuf;
- size_t outsize = TMPBUFSIZE;
- size_t res = iconv (cd, NULL, NULL, &outptr, &outsize);
- if (res == (size_t)(-1))
- return (size_t)(-1);
- count += outptr - tmpbuf;
- }
- /* Return to the initial state. */
- iconv (cd, NULL, NULL, NULL, NULL);
-#endif
- return count;
-#undef TMPBUFSIZE
-}
-
-static void
-iconv_string_keeping_offsets (iconv_t cd, const char *s, size_t n,
- size_t *offtable, char *t, size_t m)
-{
- size_t i;
- const char *s_end;
- const char *inptr;
- char *outptr;
- size_t outsize;
- /* Avoid glibc-2.1 bug. */
-#if !defined _LIBICONV_VERSION && (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1)
- const size_t extra = 1;
-#else
- const size_t extra = 0;
-#endif
-
- for (i = 0; i < n; i++)
- offtable[i] = (size_t)(-1);
-
- s_end = s + n;
- inptr = s;
- outptr = t;
- outsize = m + extra;
- while (inptr < s_end)
- {
- const char *saved_inptr;
- size_t insize;
- size_t res;
-
- offtable[inptr - s] = outptr - t;
-
- saved_inptr = inptr;
- res = (size_t)(-1);
- for (insize = 1; inptr + insize <= s_end; insize++)
- {
- res = iconv (cd, (ICONV_CONST char **) &inptr, &insize, &outptr, &outsize);
- if (!(res == (size_t)(-1) && errno == EINVAL))
- break;
- /* We expect that no input bytes have been consumed so far. */
- if (inptr != saved_inptr)
- abort ();
- }
- /* After we verified the convertibility and computed the translation's
- size m, there shouldn't be any conversion error here. */
- if (res == (size_t)(-1))
- abort ();
- }
- /* Avoid glibc-2.1 bug and Solaris 7 bug. */
-#if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
- if (iconv (cd, NULL, NULL, &outptr, &outsize) == (size_t)(-1))
- abort ();
-#endif
- /* We should have produced exactly m output bytes. */
- if (outsize != extra)
- abort ();
-}
-
-#endif /* HAVE_ICONV */
-
-#if C_CTYPE_ASCII
-
-/* Tests whether a string is entirely ASCII. Returns 1 if yes.
- Returns 0 if the string is in an 8-bit encoding or an ISO-2022 encoding. */
-static int
-is_all_ascii (const char *s, size_t n)
-{
- for (; n > 0; s++, n--)
- {
- unsigned char c = (unsigned char) *s;
-
- if (!(c_isprint (c) || c_isspace (c)))
- return 0;
- }
- return 1;
-}
-
-#endif /* C_CTYPE_ASCII */
-
-#if defined unused || defined TEST2
-
-void
-mbs_possible_linebreaks (const char *s, size_t n, const char *encoding,
- char *p)
-{
- if (n == 0)
- return;
- if (is_utf8_encoding (encoding))
- u8_possible_linebreaks ((const unsigned char *) s, n, encoding, p);
- else
- {
-#if HAVE_ICONV
- iconv_t to_utf8;
- /* Avoid glibc-2.1 bug with EUC-KR. */
-# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION
- if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0))
- to_utf8 = (iconv_t)(-1);
- else
-# endif
- /* Avoid Solaris 9 bug with GB2312, EUC-TW, BIG5, BIG5-HKSCS, GBK,
- GB18030. */
-# if defined __sun && !defined _LIBICONV_VERSION
- if ( STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
- || STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)
- || STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)
- || STREQ (encoding, "BIG5-HKSCS", 'B', 'I', 'G', '5', '-', 'H', 'K', 'S', 'C')
- || STREQ (encoding, "GBK", 'G', 'B', 'K', 0, 0, 0, 0, 0, 0)
- || STREQ (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
- to_utf8 = (iconv_t)(-1);
- else
-# endif
- to_utf8 = iconv_open (UTF8_NAME, encoding);
- if (to_utf8 != (iconv_t)(-1))
- {
- /* Determine the length of the resulting UTF-8 string. */
- size_t m = iconv_string_length (to_utf8, s, n);
- if (m != (size_t)(-1))
- {
- /* Convert the string to UTF-8 and build a translation table
- from offsets into s to offsets into the translated string. */
- size_t memory_size = xsum3 (xtimes (n, sizeof (size_t)), m, m);
- char *memory =
- (size_in_bounds_p (memory_size) ? malloc (memory_size) : NULL);
- if (memory != NULL)
- {
- size_t *offtable = (size_t *) memory;
- char *t = (char *) (offtable + n);
- char *q = (char *) (t + m);
- size_t i;
-
- iconv_string_keeping_offsets (to_utf8, s, n, offtable, t, m);
-
- /* Determine the possible line breaks of the UTF-8 string. */
- u8_possible_linebreaks ((const unsigned char *) t, m, encoding, q);
-
- /* Translate the result back to the original string. */
- memset (p, UC_BREAK_PROHIBITED, n);
- for (i = 0; i < n; i++)
- if (offtable[i] != (size_t)(-1))
- p[i] = q[offtable[i]];
-
- free (memory);
- iconv_close (to_utf8);
- return;
- }
- }
- iconv_close (to_utf8);
- }
-#endif
- /* Impossible to convert. */
-#if C_CTYPE_ASCII
- if (is_all_ascii (s, n))
- {
- /* ASCII is a subset of UTF-8. */
- u8_possible_linebreaks ((const unsigned char *) s, n, encoding, p);
- return;
- }
-#endif
- /* We have a non-ASCII string and cannot convert it.
- Don't produce line breaks except those already present in the
- input string. All we assume here is that the encoding is
- minimally ASCII compatible. */
- {
- const char *s_end = s + n;
- while (s < s_end)
- {
- *p = (*s == '\n' ? UC_BREAK_MANDATORY : UC_BREAK_PROHIBITED);
- s++;
- p++;
- }
- }
- }
-}
-
-#endif
-
-int
-mbs_width_linebreaks (const char *s, size_t n,
- int width, int start_column, int at_end_columns,
- const char *o, const char *encoding,
- char *p)
-{
- if (n == 0)
- return start_column;
- if (is_utf8_encoding (encoding))
- return u8_width_linebreaks ((const unsigned char *) s, n, width, start_column, at_end_columns, o, encoding, p);
- else
- {
-#if HAVE_ICONV
- iconv_t to_utf8;
- /* Avoid glibc-2.1 bug with EUC-KR. */
-# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION
- if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0))
- to_utf8 = (iconv_t)(-1);
- else
-# endif
- /* Avoid Solaris 9 bug with GB2312, EUC-TW, BIG5, BIG5-HKSCS, GBK,
- GB18030. */
-# if defined __sun && !defined _LIBICONV_VERSION
- if ( STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
- || STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)
- || STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)
- || STREQ (encoding, "BIG5-HKSCS", 'B', 'I', 'G', '5', '-', 'H', 'K', 'S', 'C')
- || STREQ (encoding, "GBK", 'G', 'B', 'K', 0, 0, 0, 0, 0, 0)
- || STREQ (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
- to_utf8 = (iconv_t)(-1);
- else
-# endif
- to_utf8 = iconv_open (UTF8_NAME, encoding);
- if (to_utf8 != (iconv_t)(-1))
- {
- /* Determine the length of the resulting UTF-8 string. */
- size_t m = iconv_string_length (to_utf8, s, n);
- if (m != (size_t)(-1))
- {
- /* Convert the string to UTF-8 and build a translation table
- from offsets into s to offsets into the translated string. */
- size_t memory_size =
- xsum4 (xtimes (n, sizeof (size_t)), m, m,
- (o != NULL ? m : 0));
- char *memory =
- (size_in_bounds_p (memory_size) ? malloc (memory_size) : NULL);
- if (memory != NULL)
- {
- size_t *offtable = (size_t *) memory;
- char *t = (char *) (offtable + n);
- char *q = (char *) (t + m);
- char *o8 = (o != NULL ? (char *) (q + m) : NULL);
- int res_column;
- size_t i;
-
- iconv_string_keeping_offsets (to_utf8, s, n, offtable, t, m);
-
- /* Translate the overrides to the UTF-8 string. */
- if (o != NULL)
- {
- memset (o8, UC_BREAK_UNDEFINED, m);
- for (i = 0; i < n; i++)
- if (offtable[i] != (size_t)(-1))
- o8[offtable[i]] = o[i];
- }
-
- /* Determine the line breaks of the UTF-8 string. */
- res_column =
- u8_width_linebreaks ((const unsigned char *) t, m, width, start_column, at_end_columns, o8, encoding, q);
-
- /* Translate the result back to the original string. */
- memset (p, UC_BREAK_PROHIBITED, n);
- for (i = 0; i < n; i++)
- if (offtable[i] != (size_t)(-1))
- p[i] = q[offtable[i]];
-
- free (memory);
- iconv_close (to_utf8);
- return res_column;
- }
- }
- iconv_close (to_utf8);
- }
-#endif
- /* Impossible to convert. */
-#if C_CTYPE_ASCII
- if (is_all_ascii (s, n))
- {
- /* ASCII is a subset of UTF-8. */
- return u8_width_linebreaks ((const unsigned char *) s, n, width, start_column, at_end_columns, o, encoding, p);
- }
-#endif
- /* We have a non-ASCII string and cannot convert it.
- Don't produce line breaks except those already present in the
- input string. All we assume here is that the encoding is
- minimally ASCII compatible. */
- {
- const char *s_end = s + n;
- while (s < s_end)
- {
- *p = ((o != NULL && *o == UC_BREAK_MANDATORY) || *s == '\n'
- ? UC_BREAK_MANDATORY
- : UC_BREAK_PROHIBITED);
- s++;
- p++;
- if (o != NULL)
- o++;
- }
- /* We cannot compute widths in this case. */
- return start_column;
- }
- }
-}
-
-
-#ifdef TEST2
-
-#include <stdio.h>
-#include <locale.h>
-
-/* Read the contents of an input stream, and return it, terminated with a NUL
- byte. */
-char *
-read_file (FILE *stream)
-{
-#define BUFSIZE 4096
- char *buf = NULL;
- int alloc = 0;
- int size = 0;
- int count;
-
- while (! feof (stream))
- {
- if (size + BUFSIZE > alloc)
- {
- alloc = alloc + alloc / 2;
- if (alloc < size + BUFSIZE)
- alloc = size + BUFSIZE;
- buf = realloc (buf, alloc);
- if (buf == NULL)
- {
- fprintf (stderr, "out of memory\n");
- exit (1);
- }
- }
- count = fread (buf + size, 1, BUFSIZE, stream);
- if (count == 0)
- {
- if (ferror (stream))
- {
- perror ("fread");
- exit (1);
- }
- }
- else
- size += count;
- }
- buf = realloc (buf, size + 1);
- if (buf == NULL)
- {
- fprintf (stderr, "out of memory\n");
- exit (1);
- }
- buf[size] = '\0';
- return buf;
-#undef BUFSIZE
-}
-
-int
-main (int argc, char * argv[])
-{
- setlocale (LC_CTYPE, "");
- if (argc == 1)
- {
- /* Display all the break opportunities in the input string. */
- char *input = read_file (stdin);
- int length = strlen (input);
- char *breaks = malloc (length);
- int i;
-
- mbs_possible_linebreaks (input, length, locale_charset (), breaks);
-
- for (i = 0; i < length; i++)
- {
- switch (breaks[i])
- {
- case UC_BREAK_POSSIBLE:
- putc ('|', stdout);
- break;
- case UC_BREAK_MANDATORY:
- break;
- case UC_BREAK_PROHIBITED:
- break;
- default:
- abort ();
- }
- putc (input[i], stdout);
- }
-
- free (breaks);
-
- return 0;
- }
- else if (argc == 2)
- {
- /* Insert line breaks for a given width. */
- int width = atoi (argv[1]);
- char *input = read_file (stdin);
- int length = strlen (input);
- char *breaks = malloc (length);
- int i;
-
- mbs_width_linebreaks (input, length, width, 0, 0, NULL, locale_charset (), breaks);
-
- for (i = 0; i < length; i++)
- {
- switch (breaks[i])
- {
- case UC_BREAK_POSSIBLE:
- putc ('\n', stdout);
- break;
- case UC_BREAK_MANDATORY:
- break;
- case UC_BREAK_PROHIBITED:
- break;
- default:
- abort ();
- }
- putc (input[i], stdout);
- }
-
- free (breaks);
-
- return 0;
- }
- else
- return 1;
-}
-
-#endif /* TEST2 */
+++ /dev/null
-/* linebreak.h - line breaking of Unicode strings
- Copyright (C) 2001-2003 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation,
-Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _LINEBREAK_H
-#define _LINEBREAK_H
-
-/* Get size_t. */
-#include <stddef.h>
-
-
-/* Display width. */
-
-/* These functions are locale dependent. The encoding argument identifies
- the encoding (e.g. "ISO-8859-2" for Polish). */
-
-/* Return the encoding of the current locale. */
-extern const char * locale_charset (void);
-
-/* Determine number of column positions required for UC. */
-extern int uc_width (unsigned int uc, const char *encoding);
-
-/* Determine number of column positions required for first N units
- (or fewer if S ends before this) in S. */
-extern int u8_width (const unsigned char *s, size_t n, const char *encoding);
-extern int u16_width (const unsigned short *s, size_t n, const char *encoding);
-extern int u32_width (const unsigned int *s, size_t n, const char *encoding);
-
-
-/* Line breaking. */
-
-enum {
- UC_BREAK_UNDEFINED,
- UC_BREAK_PROHIBITED,
- UC_BREAK_POSSIBLE,
- UC_BREAK_MANDATORY,
- UC_BREAK_HYPHENATION
-};
-
-/* Determine the line break points in S, and store the result at p[0..n-1].
- p[i] = UC_BREAK_MANDATORY means that s[i] is a line break character.
- p[i] = UC_BREAK_POSSIBLE means that a line break may be inserted between
- s[i-1] and s[i].
- p[i] = UC_BREAK_HYPHENATION means that a hyphen and a line break may be
- inserted between s[i-1] and s[i]. But beware of language dependent
- hyphenation rules.
- p[i] = UC_BREAK_PROHIBITED means that s[i-1] and s[i] must not be separated.
- */
-extern void u8_possible_linebreaks (const unsigned char *s, size_t n,
- const char *encoding,
- char *p);
-extern void u16_possible_linebreaks (const unsigned short *s, size_t n,
- const char *encoding,
- char *p);
-extern void u32_possible_linebreaks (const unsigned int *s, size_t n,
- const char *encoding,
- char *p);
-extern void mbs_possible_linebreaks (const char *s, size_t n,
- const char *encoding,
- char *p);
-
-/* Choose the best line breaks, assuming the uc_width function.
- Return the column after the end of the string.
- o is an optional override; if o[i] != UC_BREAK_UNDEFINED, o[i] takes
- precedence over p[i] as returned by the *_possible_linebreaks function.
- */
-extern int
- u8_width_linebreaks (const unsigned char *s, size_t n,
- int width, int start_column, int at_end_columns,
- const char *o, const char *encoding,
- char *p);
-extern int
- u16_width_linebreaks (const unsigned short *s, size_t n,
- int width, int start_column, int at_end_columns,
- const char *o, const char *encoding,
- char *p);
-extern int
- u32_width_linebreaks (const unsigned int *s, size_t n,
- int width, int start_column, int at_end_columns,
- const char *o, const char *encoding,
- char *p);
-extern int
- mbs_width_linebreaks (const char *s, size_t n,
- int width, int start_column, int at_end_columns,
- const char *o, const char *encoding,
- char *p);
-
-
-#endif /* _LINEBREAK_H */
+++ /dev/null
-/* Determine a canonical name for the current locale's character encoding.
-
- Copyright (C) 2000-2006 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published
- by the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA. */
-
-/* Written by Bruno Haible <bruno@clisp.org>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "localcharset.h"
-
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#if defined _WIN32 || defined __WIN32__
-# define WIN32_NATIVE
-#endif
-
-#if defined __EMX__
-/* Assume EMX program runs on OS/2, even if compiled under DOS. */
-# define OS2
-#endif
-
-#if !defined WIN32_NATIVE
-# if HAVE_LANGINFO_CODESET
-# include <langinfo.h>
-# else
-# if HAVE_SETLOCALE
-# include <locale.h>
-# endif
-# endif
-# ifdef __CYGWIN__
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# endif
-#elif defined WIN32_NATIVE
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-#endif
-#if defined OS2
-# define INCL_DOS
-# include <os2.h>
-#endif
-
-#if ENABLE_RELOCATABLE
-# include "relocatable.h"
-#else
-# define relocate(pathname) (pathname)
-#endif
-
-#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
- /* Win32, Cygwin, OS/2, DOS */
-# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-#endif
-
-#ifndef DIRECTORY_SEPARATOR
-# define DIRECTORY_SEPARATOR '/'
-#endif
-
-#ifndef ISSLASH
-# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
-#endif
-
-#if HAVE_DECL_GETC_UNLOCKED
-# undef getc
-# define getc getc_unlocked
-#endif
-
-/* The following static variable is declared 'volatile' to avoid a
- possible multithread problem in the function get_charset_aliases. If we
- are running in a threaded environment, and if two threads initialize
- 'charset_aliases' simultaneously, both will produce the same value,
- and everything will be ok if the two assignments to 'charset_aliases'
- are atomic. But I don't know what will happen if the two assignments mix. */
-#if __STDC__ != 1
-# define volatile /* empty */
-#endif
-/* Pointer to the contents of the charset.alias file, if it has already been
- read, else NULL. Its format is:
- ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */
-static const char * volatile charset_aliases;
-
-/* Return a pointer to the contents of the charset.alias file. */
-static const char *
-get_charset_aliases (void)
-{
- const char *cp;
-
- cp = charset_aliases;
- if (cp == NULL)
- {
-#if !(defined VMS || defined WIN32_NATIVE || defined __CYGWIN__)
- FILE *fp;
- const char *dir;
- const char *base = "charset.alias";
- char *file_name;
-
- /* Make it possible to override the charset.alias location. This is
- necessary for running the testsuite before "make install". */
- dir = getenv ("CHARSETALIASDIR");
- if (dir == NULL || dir[0] == '\0')
- dir = relocate (LIBDIR);
-
- /* Concatenate dir and base into freshly allocated file_name. */
- {
- size_t dir_len = strlen (dir);
- size_t base_len = strlen (base);
- int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1]));
- file_name = (char *) malloc (dir_len + add_slash + base_len + 1);
- if (file_name != NULL)
- {
- memcpy (file_name, dir, dir_len);
- if (add_slash)
- file_name[dir_len] = DIRECTORY_SEPARATOR;
- memcpy (file_name + dir_len + add_slash, base, base_len + 1);
- }
- }
-
- if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL)
- /* Out of memory or file not found, treat it as empty. */
- cp = "";
- else
- {
- /* Parse the file's contents. */
- char *res_ptr = NULL;
- size_t res_size = 0;
-
- for (;;)
- {
- int c;
- char buf1[50+1];
- char buf2[50+1];
- size_t l1, l2;
- char *old_res_ptr;
-
- c = getc (fp);
- if (c == EOF)
- break;
- if (c == '\n' || c == ' ' || c == '\t')
- continue;
- if (c == '#')
- {
- /* Skip comment, to end of line. */
- do
- c = getc (fp);
- while (!(c == EOF || c == '\n'));
- if (c == EOF)
- break;
- continue;
- }
- ungetc (c, fp);
- if (fscanf (fp, "%50s %50s", buf1, buf2) < 2)
- break;
- l1 = strlen (buf1);
- l2 = strlen (buf2);
- old_res_ptr = res_ptr;
- if (res_size == 0)
- {
- res_size = l1 + 1 + l2 + 1;
- res_ptr = (char *) malloc (res_size + 1);
- }
- else
- {
- res_size += l1 + 1 + l2 + 1;
- res_ptr = (char *) realloc (res_ptr, res_size + 1);
- }
- if (res_ptr == NULL)
- {
- /* Out of memory. */
- res_size = 0;
- if (old_res_ptr != NULL)
- free (old_res_ptr);
- break;
- }
- strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
- strcpy (res_ptr + res_size - (l2 + 1), buf2);
- }
- fclose (fp);
- if (res_size == 0)
- cp = "";
- else
- {
- *(res_ptr + res_size) = '\0';
- cp = res_ptr;
- }
- }
-
- if (file_name != NULL)
- free (file_name);
-
-#else
-
-# if defined VMS
- /* To avoid the troubles of an extra file charset.alias_vms in the
- sources of many GNU packages, simply inline the aliases here. */
- /* The list of encodings is taken from the OpenVMS 7.3-1 documentation
- "Compaq C Run-Time Library Reference Manual for OpenVMS systems"
- section 10.7 "Handling Different Character Sets". */
- cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
- "ISO8859-2" "\0" "ISO-8859-2" "\0"
- "ISO8859-5" "\0" "ISO-8859-5" "\0"
- "ISO8859-7" "\0" "ISO-8859-7" "\0"
- "ISO8859-8" "\0" "ISO-8859-8" "\0"
- "ISO8859-9" "\0" "ISO-8859-9" "\0"
- /* Japanese */
- "eucJP" "\0" "EUC-JP" "\0"
- "SJIS" "\0" "SHIFT_JIS" "\0"
- "DECKANJI" "\0" "DEC-KANJI" "\0"
- "SDECKANJI" "\0" "EUC-JP" "\0"
- /* Chinese */
- "eucTW" "\0" "EUC-TW" "\0"
- "DECHANYU" "\0" "DEC-HANYU" "\0"
- "DECHANZI" "\0" "GB2312" "\0"
- /* Korean */
- "DECKOREAN" "\0" "EUC-KR" "\0";
-# endif
-
-# if defined WIN32_NATIVE || defined __CYGWIN__
- /* To avoid the troubles of installing a separate file in the same
- directory as the DLL and of retrieving the DLL's directory at
- runtime, simply inline the aliases here. */
-
- cp = "CP936" "\0" "GBK" "\0"
- "CP1361" "\0" "JOHAB" "\0"
- "CP20127" "\0" "ASCII" "\0"
- "CP20866" "\0" "KOI8-R" "\0"
- "CP20936" "\0" "GB2312" "\0"
- "CP21866" "\0" "KOI8-RU" "\0"
- "CP28591" "\0" "ISO-8859-1" "\0"
- "CP28592" "\0" "ISO-8859-2" "\0"
- "CP28593" "\0" "ISO-8859-3" "\0"
- "CP28594" "\0" "ISO-8859-4" "\0"
- "CP28595" "\0" "ISO-8859-5" "\0"
- "CP28596" "\0" "ISO-8859-6" "\0"
- "CP28597" "\0" "ISO-8859-7" "\0"
- "CP28598" "\0" "ISO-8859-8" "\0"
- "CP28599" "\0" "ISO-8859-9" "\0"
- "CP28605" "\0" "ISO-8859-15" "\0"
- "CP38598" "\0" "ISO-8859-8" "\0"
- "CP51932" "\0" "EUC-JP" "\0"
- "CP51936" "\0" "GB2312" "\0"
- "CP51949" "\0" "EUC-KR" "\0"
- "CP51950" "\0" "EUC-TW" "\0"
- "CP54936" "\0" "GB18030" "\0"
- "CP65001" "\0" "UTF-8" "\0";
-# endif
-#endif
-
- charset_aliases = cp;
- }
-
- return cp;
-}
-
-/* Determine the current locale's character encoding, and canonicalize it
- into one of the canonical names listed in config.charset.
- The result must not be freed; it is statically allocated.
- If the canonical name cannot be determined, the result is a non-canonical
- name. */
-
-#ifdef STATIC
-STATIC
-#endif
-const char *
-locale_charset (void)
-{
- const char *codeset;
- const char *aliases;
-
-#if !(defined WIN32_NATIVE || defined OS2)
-
-# if HAVE_LANGINFO_CODESET
-
- /* Most systems support nl_langinfo (CODESET) nowadays. */
- codeset = nl_langinfo (CODESET);
-
-# ifdef __CYGWIN__
- /* Cygwin 2006 does not have locales. nl_langinfo (CODESET) always
- returns "US-ASCII". As long as this is not fixed, return the suffix
- of the locale name from the environment variables (if present) or
- the codepage as a number. */
- if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
- {
- const char *locale;
- static char buf[2 + 10 + 1];
-
- locale = getenv ("LC_ALL");
- if (locale == NULL || locale[0] == '\0')
- {
- locale = getenv ("LC_CTYPE");
- if (locale == NULL || locale[0] == '\0')
- locale = getenv ("LANG");
- }
- if (locale != NULL && locale[0] != '\0')
- {
- /* If the locale name contains an encoding after the dot, return
- it. */
- const char *dot = strchr (locale, '.');
-
- if (dot != NULL)
- {
- const char *modifier;
-
- dot++;
- /* Look for the possible @... trailer and remove it, if any. */
- modifier = strchr (dot, '@');
- if (modifier == NULL)
- return dot;
- if (modifier - dot < sizeof (buf))
- {
- memcpy (buf, dot, modifier - dot);
- buf [modifier - dot] = '\0';
- return buf;
- }
- }
- }
-
- /* Woe32 has a function returning the locale's codepage as a number. */
- sprintf (buf, "CP%u", GetACP ());
- codeset = buf;
- }
-# endif
-
-# else
-
- /* On old systems which lack it, use setlocale or getenv. */
- const char *locale = NULL;
-
- /* But most old systems don't have a complete set of locales. Some
- (like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
- use setlocale here; it would return "C" when it doesn't support the
- locale name the user has set. */
-# if HAVE_SETLOCALE && 0
- locale = setlocale (LC_CTYPE, NULL);
-# endif
- if (locale == NULL || locale[0] == '\0')
- {
- locale = getenv ("LC_ALL");
- if (locale == NULL || locale[0] == '\0')
- {
- locale = getenv ("LC_CTYPE");
- if (locale == NULL || locale[0] == '\0')
- locale = getenv ("LANG");
- }
- }
-
- /* On some old systems, one used to set locale = "iso8859_1". On others,
- you set it to "language_COUNTRY.charset". In any case, we resolve it
- through the charset.alias file. */
- codeset = locale;
-
-# endif
-
-#elif defined WIN32_NATIVE
-
- static char buf[2 + 10 + 1];
-
- /* Woe32 has a function returning the locale's codepage as a number. */
- sprintf (buf, "CP%u", GetACP ());
- codeset = buf;
-
-#elif defined OS2
-
- const char *locale;
- static char buf[2 + 10 + 1];
- ULONG cp[3];
- ULONG cplen;
-
- /* Allow user to override the codeset, as set in the operating system,
- with standard language environment variables. */
- locale = getenv ("LC_ALL");
- if (locale == NULL || locale[0] == '\0')
- {
- locale = getenv ("LC_CTYPE");
- if (locale == NULL || locale[0] == '\0')
- locale = getenv ("LANG");
- }
- if (locale != NULL && locale[0] != '\0')
- {
- /* If the locale name contains an encoding after the dot, return it. */
- const char *dot = strchr (locale, '.');
-
- if (dot != NULL)
- {
- const char *modifier;
-
- dot++;
- /* Look for the possible @... trailer and remove it, if any. */
- modifier = strchr (dot, '@');
- if (modifier == NULL)
- return dot;
- if (modifier - dot < sizeof (buf))
- {
- memcpy (buf, dot, modifier - dot);
- buf [modifier - dot] = '\0';
- return buf;
- }
- }
-
- /* Resolve through the charset.alias file. */
- codeset = locale;
- }
- else
- {
- /* OS/2 has a function returning the locale's codepage as a number. */
- if (DosQueryCp (sizeof (cp), cp, &cplen))
- codeset = "";
- else
- {
- sprintf (buf, "CP%u", cp[0]);
- codeset = buf;
- }
- }
-
-#endif
-
- if (codeset == NULL)
- /* The canonical name cannot be determined. */
- codeset = "";
-
- /* Resolve alias. */
- for (aliases = get_charset_aliases ();
- *aliases != '\0';
- aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
- if (strcmp (codeset, aliases) == 0
- || (aliases[0] == '*' && aliases[1] == '\0'))
- {
- codeset = aliases + strlen (aliases) + 1;
- break;
- }
-
- /* Don't return an empty string. GNU libc and GNU libiconv interpret
- the empty string as denoting "the locale's character encoding",
- thus GNU libiconv would call this function a second time. */
- if (codeset[0] == '\0')
- codeset = "ASCII";
-
- return codeset;
-}
+++ /dev/null
-/* Determine a canonical name for the current locale's character encoding.
- Copyright (C) 2000-2003 Free Software Foundation, Inc.
- This file is part of the GNU CHARSET Library.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published
- by the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA. */
-
-#ifndef _LOCALCHARSET_H
-#define _LOCALCHARSET_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Determine the current locale's character encoding, and canonicalize it
- into one of the canonical names listed in config.charset.
- The result must not be freed; it is statically allocated.
- If the canonical name cannot be determined, the result is a non-canonical
- name. */
-extern const char * locale_charset (void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _LOCALCHARSET_H */
+++ /dev/null
-/* Locking in multithreaded situations.
- Copyright (C) 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published
- by the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2005.
- Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h,
- gthr-win32.h. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "lock.h"
-
-/* ========================================================================= */
-
-#if USE_POSIX_THREADS
-
-/* Use the POSIX threads library. */
-
-# if PTHREAD_IN_USE_DETECTION_HARD
-
-/* The function to be executed by a dummy thread. */
-static void *
-dummy_thread_func (void *arg)
-{
- return arg;
-}
-
-int
-glthread_in_use (void)
-{
- static int tested;
- static int result; /* 1: linked with -lpthread, 0: only with libc */
-
- if (!tested)
- {
- pthread_t thread;
-
- if (pthread_create (&thread, NULL, dummy_thread_func, NULL) != 0)
- /* Thread creation failed. */
- result = 0;
- else
- {
- /* Thread creation works. */
- void *retval;
- if (pthread_join (thread, &retval) != 0)
- abort ();
- result = 1;
- }
- tested = 1;
- }
- return result;
-}
-
-# endif
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-# if HAVE_PTHREAD_RWLOCK
-
-# if !defined PTHREAD_RWLOCK_INITIALIZER
-
-void
-glthread_rwlock_init (gl_rwlock_t *lock)
-{
- if (pthread_rwlock_init (&lock->rwlock, NULL) != 0)
- abort ();
- lock->initialized = 1;
-}
-
-void
-glthread_rwlock_rdlock (gl_rwlock_t *lock)
-{
- if (!lock->initialized)
- {
- if (pthread_mutex_lock (&lock->guard) != 0)
- abort ();
- if (!lock->initialized)
- glthread_rwlock_init (lock);
- if (pthread_mutex_unlock (&lock->guard) != 0)
- abort ();
- }
- if (pthread_rwlock_rdlock (&lock->rwlock) != 0)
- abort ();
-}
-
-void
-glthread_rwlock_wrlock (gl_rwlock_t *lock)
-{
- if (!lock->initialized)
- {
- if (pthread_mutex_lock (&lock->guard) != 0)
- abort ();
- if (!lock->initialized)
- glthread_rwlock_init (lock);
- if (pthread_mutex_unlock (&lock->guard) != 0)
- abort ();
- }
- if (pthread_rwlock_wrlock (&lock->rwlock) != 0)
- abort ();
-}
-
-void
-glthread_rwlock_unlock (gl_rwlock_t *lock)
-{
- if (!lock->initialized)
- abort ();
- if (pthread_rwlock_unlock (&lock->rwlock) != 0)
- abort ();
-}
-
-void
-glthread_rwlock_destroy (gl_rwlock_t *lock)
-{
- if (!lock->initialized)
- abort ();
- if (pthread_rwlock_destroy (&lock->rwlock) != 0)
- abort ();
- lock->initialized = 0;
-}
-
-# endif
-
-# else
-
-void
-glthread_rwlock_init (gl_rwlock_t *lock)
-{
- if (pthread_mutex_init (&lock->lock, NULL) != 0)
- abort ();
- if (pthread_cond_init (&lock->waiting_readers, NULL) != 0)
- abort ();
- if (pthread_cond_init (&lock->waiting_writers, NULL) != 0)
- abort ();
- lock->waiting_writers_count = 0;
- lock->runcount = 0;
-}
-
-void
-glthread_rwlock_rdlock (gl_rwlock_t *lock)
-{
- if (pthread_mutex_lock (&lock->lock) != 0)
- abort ();
- /* Test whether only readers are currently running, and whether the runcount
- field will not overflow. */
- /* POSIX says: "It is implementation-defined whether the calling thread
- acquires the lock when a writer does not hold the lock and there are
- writers blocked on the lock." Let's say, no: give the writers a higher
- priority. */
- while (!(lock->runcount + 1 > 0 && lock->waiting_writers_count == 0))
- {
- /* This thread has to wait for a while. Enqueue it among the
- waiting_readers. */
- if (pthread_cond_wait (&lock->waiting_readers, &lock->lock) != 0)
- abort ();
- }
- lock->runcount++;
- if (pthread_mutex_unlock (&lock->lock) != 0)
- abort ();
-}
-
-void
-glthread_rwlock_wrlock (gl_rwlock_t *lock)
-{
- if (pthread_mutex_lock (&lock->lock) != 0)
- abort ();
- /* Test whether no readers or writers are currently running. */
- while (!(lock->runcount == 0))
- {
- /* This thread has to wait for a while. Enqueue it among the
- waiting_writers. */
- lock->waiting_writers_count++;
- if (pthread_cond_wait (&lock->waiting_writers, &lock->lock) != 0)
- abort ();
- lock->waiting_writers_count--;
- }
- lock->runcount--; /* runcount becomes -1 */
- if (pthread_mutex_unlock (&lock->lock) != 0)
- abort ();
-}
-
-void
-glthread_rwlock_unlock (gl_rwlock_t *lock)
-{
- if (pthread_mutex_lock (&lock->lock) != 0)
- abort ();
- if (lock->runcount < 0)
- {
- /* Drop a writer lock. */
- if (!(lock->runcount == -1))
- abort ();
- lock->runcount = 0;
- }
- else
- {
- /* Drop a reader lock. */
- if (!(lock->runcount > 0))
- abort ();
- lock->runcount--;
- }
- if (lock->runcount == 0)
- {
- /* POSIX recommends that "write locks shall take precedence over read
- locks", to avoid "writer starvation". */
- if (lock->waiting_writers_count > 0)
- {
- /* Wake up one of the waiting writers. */
- if (pthread_cond_signal (&lock->waiting_writers) != 0)
- abort ();
- }
- else
- {
- /* Wake up all waiting readers. */
- if (pthread_cond_broadcast (&lock->waiting_readers) != 0)
- abort ();
- }
- }
- if (pthread_mutex_unlock (&lock->lock) != 0)
- abort ();
-}
-
-void
-glthread_rwlock_destroy (gl_rwlock_t *lock)
-{
- if (pthread_mutex_destroy (&lock->lock) != 0)
- abort ();
- if (pthread_cond_destroy (&lock->waiting_readers) != 0)
- abort ();
- if (pthread_cond_destroy (&lock->waiting_writers) != 0)
- abort ();
-}
-
-# endif
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-# if HAVE_PTHREAD_MUTEX_RECURSIVE
-
-# if !(defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
-
-void
-glthread_recursive_lock_init (gl_recursive_lock_t *lock)
-{
- pthread_mutexattr_t attributes;
-
- if (pthread_mutexattr_init (&attributes) != 0)
- abort ();
- if (pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE) != 0)
- abort ();
- if (pthread_mutex_init (&lock->recmutex, &attributes) != 0)
- abort ();
- if (pthread_mutexattr_destroy (&attributes) != 0)
- abort ();
- lock->initialized = 1;
-}
-
-void
-glthread_recursive_lock_lock (gl_recursive_lock_t *lock)
-{
- if (!lock->initialized)
- {
- if (pthread_mutex_lock (&lock->guard) != 0)
- abort ();
- if (!lock->initialized)
- glthread_recursive_lock_init (lock);
- if (pthread_mutex_unlock (&lock->guard) != 0)
- abort ();
- }
- if (pthread_mutex_lock (&lock->recmutex) != 0)
- abort ();
-}
-
-void
-glthread_recursive_lock_unlock (gl_recursive_lock_t *lock)
-{
- if (!lock->initialized)
- abort ();
- if (pthread_mutex_unlock (&lock->recmutex) != 0)
- abort ();
-}
-
-void
-glthread_recursive_lock_destroy (gl_recursive_lock_t *lock)
-{
- if (!lock->initialized)
- abort ();
- if (pthread_mutex_destroy (&lock->recmutex) != 0)
- abort ();
- lock->initialized = 0;
-}
-
-# endif
-
-# else
-
-void
-glthread_recursive_lock_init (gl_recursive_lock_t *lock)
-{
- if (pthread_mutex_init (&lock->mutex, NULL) != 0)
- abort ();
- lock->owner = (pthread_t) 0;
- lock->depth = 0;
-}
-
-void
-glthread_recursive_lock_lock (gl_recursive_lock_t *lock)
-{
- pthread_t self = pthread_self ();
- if (lock->owner != self)
- {
- if (pthread_mutex_lock (&lock->mutex) != 0)
- abort ();
- lock->owner = self;
- }
- if (++(lock->depth) == 0) /* wraparound? */
- abort ();
-}
-
-void
-glthread_recursive_lock_unlock (gl_recursive_lock_t *lock)
-{
- if (lock->owner != pthread_self ())
- abort ();
- if (lock->depth == 0)
- abort ();
- if (--(lock->depth) == 0)
- {
- lock->owner = (pthread_t) 0;
- if (pthread_mutex_unlock (&lock->mutex) != 0)
- abort ();
- }
-}
-
-void
-glthread_recursive_lock_destroy (gl_recursive_lock_t *lock)
-{
- if (lock->owner != (pthread_t) 0)
- abort ();
- if (pthread_mutex_destroy (&lock->mutex) != 0)
- abort ();
-}
-
-# endif
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-static const pthread_once_t fresh_once = PTHREAD_ONCE_INIT;
-
-int
-glthread_once_singlethreaded (pthread_once_t *once_control)
-{
- /* We don't know whether pthread_once_t is an integer type, a floating-point
- type, a pointer type, or a structure type. */
- char *firstbyte = (char *)once_control;
- if (*firstbyte == *(const char *)&fresh_once)
- {
- /* First time use of once_control. Invert the first byte. */
- *firstbyte = ~ *(const char *)&fresh_once;
- return 1;
- }
- else
- return 0;
-}
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_PTH_THREADS
-
-/* Use the GNU Pth threads library. */
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-void
-glthread_once_call (void *arg)
-{
- void (**gl_once_temp_addr) (void) = (void (**) (void)) arg;
- void (*initfunction) (void) = *gl_once_temp_addr;
- initfunction ();
-}
-
-int
-glthread_once_singlethreaded (pth_once_t *once_control)
-{
- /* We know that pth_once_t is an integer type. */
- if (*once_control == PTH_ONCE_INIT)
- {
- /* First time use of once_control. Invert the marker. */
- *once_control = ~ PTH_ONCE_INIT;
- return 1;
- }
- else
- return 0;
-}
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_SOLARIS_THREADS
-
-/* Use the old Solaris threads library. */
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-void
-glthread_recursive_lock_init (gl_recursive_lock_t *lock)
-{
- if (mutex_init (&lock->mutex, USYNC_THREAD, NULL) != 0)
- abort ();
- lock->owner = (thread_t) 0;
- lock->depth = 0;
-}
-
-void
-glthread_recursive_lock_lock (gl_recursive_lock_t *lock)
-{
- thread_t self = thr_self ();
- if (lock->owner != self)
- {
- if (mutex_lock (&lock->mutex) != 0)
- abort ();
- lock->owner = self;
- }
- if (++(lock->depth) == 0) /* wraparound? */
- abort ();
-}
-
-void
-glthread_recursive_lock_unlock (gl_recursive_lock_t *lock)
-{
- if (lock->owner != thr_self ())
- abort ();
- if (lock->depth == 0)
- abort ();
- if (--(lock->depth) == 0)
- {
- lock->owner = (thread_t) 0;
- if (mutex_unlock (&lock->mutex) != 0)
- abort ();
- }
-}
-
-void
-glthread_recursive_lock_destroy (gl_recursive_lock_t *lock)
-{
- if (lock->owner != (thread_t) 0)
- abort ();
- if (mutex_destroy (&lock->mutex) != 0)
- abort ();
-}
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-void
-glthread_once (gl_once_t *once_control, void (*initfunction) (void))
-{
- if (!once_control->inited)
- {
- /* Use the mutex to guarantee that if another thread is already calling
- the initfunction, this thread waits until it's finished. */
- if (mutex_lock (&once_control->mutex) != 0)
- abort ();
- if (!once_control->inited)
- {
- once_control->inited = 1;
- initfunction ();
- }
- if (mutex_unlock (&once_control->mutex) != 0)
- abort ();
- }
-}
-
-int
-glthread_once_singlethreaded (gl_once_t *once_control)
-{
- /* We know that gl_once_t contains an integer type. */
- if (!once_control->inited)
- {
- /* First time use of once_control. Invert the marker. */
- once_control->inited = ~ 0;
- return 1;
- }
- else
- return 0;
-}
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_WIN32_THREADS
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-void
-glthread_lock_init (gl_lock_t *lock)
-{
- InitializeCriticalSection (&lock->lock);
- lock->guard.done = 1;
-}
-
-void
-glthread_lock_lock (gl_lock_t *lock)
-{
- if (!lock->guard.done)
- {
- if (InterlockedIncrement (&lock->guard.started) == 0)
- /* This thread is the first one to need this lock. Initialize it. */
- glthread_lock_init (lock);
- else
- /* Yield the CPU while waiting for another thread to finish
- initializing this lock. */
- while (!lock->guard.done)
- Sleep (0);
- }
- EnterCriticalSection (&lock->lock);
-}
-
-void
-glthread_lock_unlock (gl_lock_t *lock)
-{
- if (!lock->guard.done)
- abort ();
- LeaveCriticalSection (&lock->lock);
-}
-
-void
-glthread_lock_destroy (gl_lock_t *lock)
-{
- if (!lock->guard.done)
- abort ();
- DeleteCriticalSection (&lock->lock);
- lock->guard.done = 0;
-}
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-static inline void
-gl_waitqueue_init (gl_waitqueue_t *wq)
-{
- wq->array = NULL;
- wq->count = 0;
- wq->alloc = 0;
- wq->offset = 0;
-}
-
-/* Enqueues the current thread, represented by an event, in a wait queue.
- Returns INVALID_HANDLE_VALUE if an allocation failure occurs. */
-static HANDLE
-gl_waitqueue_add (gl_waitqueue_t *wq)
-{
- HANDLE event;
- unsigned int index;
-
- if (wq->count == wq->alloc)
- {
- unsigned int new_alloc = 2 * wq->alloc + 1;
- HANDLE *new_array =
- (HANDLE *) realloc (wq->array, new_alloc * sizeof (HANDLE));
- if (new_array == NULL)
- /* No more memory. */
- return INVALID_HANDLE_VALUE;
- /* Now is a good opportunity to rotate the array so that its contents
- starts at offset 0. */
- if (wq->offset > 0)
- {
- unsigned int old_count = wq->count;
- unsigned int old_alloc = wq->alloc;
- unsigned int old_offset = wq->offset;
- unsigned int i;
- if (old_offset + old_count > old_alloc)
- {
- unsigned int limit = old_offset + old_count - old_alloc;
- for (i = 0; i < limit; i++)
- new_array[old_alloc + i] = new_array[i];
- }
- for (i = 0; i < old_count; i++)
- new_array[i] = new_array[old_offset + i];
- wq->offset = 0;
- }
- wq->array = new_array;
- wq->alloc = new_alloc;
- }
- event = CreateEvent (NULL, TRUE, FALSE, NULL);
- if (event == INVALID_HANDLE_VALUE)
- /* No way to allocate an event. */
- return INVALID_HANDLE_VALUE;
- index = wq->offset + wq->count;
- if (index >= wq->alloc)
- index -= wq->alloc;
- wq->array[index] = event;
- wq->count++;
- return event;
-}
-
-/* Notifies the first thread from a wait queue and dequeues it. */
-static inline void
-gl_waitqueue_notify_first (gl_waitqueue_t *wq)
-{
- SetEvent (wq->array[wq->offset + 0]);
- wq->offset++;
- wq->count--;
- if (wq->count == 0 || wq->offset == wq->alloc)
- wq->offset = 0;
-}
-
-/* Notifies all threads from a wait queue and dequeues them all. */
-static inline void
-gl_waitqueue_notify_all (gl_waitqueue_t *wq)
-{
- unsigned int i;
-
- for (i = 0; i < wq->count; i++)
- {
- unsigned int index = wq->offset + i;
- if (index >= wq->alloc)
- index -= wq->alloc;
- SetEvent (wq->array[index]);
- }
- wq->count = 0;
- wq->offset = 0;
-}
-
-void
-glthread_rwlock_init (gl_rwlock_t *lock)
-{
- InitializeCriticalSection (&lock->lock);
- gl_waitqueue_init (&lock->waiting_readers);
- gl_waitqueue_init (&lock->waiting_writers);
- lock->runcount = 0;
- lock->guard.done = 1;
-}
-
-void
-glthread_rwlock_rdlock (gl_rwlock_t *lock)
-{
- if (!lock->guard.done)
- {
- if (InterlockedIncrement (&lock->guard.started) == 0)
- /* This thread is the first one to need this lock. Initialize it. */
- glthread_rwlock_init (lock);
- else
- /* Yield the CPU while waiting for another thread to finish
- initializing this lock. */
- while (!lock->guard.done)
- Sleep (0);
- }
- EnterCriticalSection (&lock->lock);
- /* Test whether only readers are currently running, and whether the runcount
- field will not overflow. */
- if (!(lock->runcount + 1 > 0))
- {
- /* This thread has to wait for a while. Enqueue it among the
- waiting_readers. */
- HANDLE event = gl_waitqueue_add (&lock->waiting_readers);
- if (event != INVALID_HANDLE_VALUE)
- {
- DWORD result;
- LeaveCriticalSection (&lock->lock);
- /* Wait until another thread signals this event. */
- result = WaitForSingleObject (event, INFINITE);
- if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
- abort ();
- CloseHandle (event);
- /* The thread which signalled the event already did the bookkeeping:
- removed us from the waiting_readers, incremented lock->runcount. */
- if (!(lock->runcount > 0))
- abort ();
- return;
- }
- else
- {
- /* Allocation failure. Weird. */
- do
- {
- LeaveCriticalSection (&lock->lock);
- Sleep (1);
- EnterCriticalSection (&lock->lock);
- }
- while (!(lock->runcount + 1 > 0));
- }
- }
- lock->runcount++;
- LeaveCriticalSection (&lock->lock);
-}
-
-void
-glthread_rwlock_wrlock (gl_rwlock_t *lock)
-{
- if (!lock->guard.done)
- {
- if (InterlockedIncrement (&lock->guard.started) == 0)
- /* This thread is the first one to need this lock. Initialize it. */
- glthread_rwlock_init (lock);
- else
- /* Yield the CPU while waiting for another thread to finish
- initializing this lock. */
- while (!lock->guard.done)
- Sleep (0);
- }
- EnterCriticalSection (&lock->lock);
- /* Test whether no readers or writers are currently running. */
- if (!(lock->runcount == 0))
- {
- /* This thread has to wait for a while. Enqueue it among the
- waiting_writers. */
- HANDLE event = gl_waitqueue_add (&lock->waiting_writers);
- if (event != INVALID_HANDLE_VALUE)
- {
- DWORD result;
- LeaveCriticalSection (&lock->lock);
- /* Wait until another thread signals this event. */
- result = WaitForSingleObject (event, INFINITE);
- if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
- abort ();
- CloseHandle (event);
- /* The thread which signalled the event already did the bookkeeping:
- removed us from the waiting_writers, set lock->runcount = -1. */
- if (!(lock->runcount == -1))
- abort ();
- return;
- }
- else
- {
- /* Allocation failure. Weird. */
- do
- {
- LeaveCriticalSection (&lock->lock);
- Sleep (1);
- EnterCriticalSection (&lock->lock);
- }
- while (!(lock->runcount == 0));
- }
- }
- lock->runcount--; /* runcount becomes -1 */
- LeaveCriticalSection (&lock->lock);
-}
-
-void
-glthread_rwlock_unlock (gl_rwlock_t *lock)
-{
- if (!lock->guard.done)
- abort ();
- EnterCriticalSection (&lock->lock);
- if (lock->runcount < 0)
- {
- /* Drop a writer lock. */
- if (!(lock->runcount == -1))
- abort ();
- lock->runcount = 0;
- }
- else
- {
- /* Drop a reader lock. */
- if (!(lock->runcount > 0))
- abort ();
- lock->runcount--;
- }
- if (lock->runcount == 0)
- {
- /* POSIX recommends that "write locks shall take precedence over read
- locks", to avoid "writer starvation". */
- if (lock->waiting_writers.count > 0)
- {
- /* Wake up one of the waiting writers. */
- lock->runcount--;
- gl_waitqueue_notify_first (&lock->waiting_writers);
- }
- else
- {
- /* Wake up all waiting readers. */
- lock->runcount += lock->waiting_readers.count;
- gl_waitqueue_notify_all (&lock->waiting_readers);
- }
- }
- LeaveCriticalSection (&lock->lock);
-}
-
-void
-glthread_rwlock_destroy (gl_rwlock_t *lock)
-{
- if (!lock->guard.done)
- abort ();
- if (lock->runcount != 0)
- abort ();
- DeleteCriticalSection (&lock->lock);
- if (lock->waiting_readers.array != NULL)
- free (lock->waiting_readers.array);
- if (lock->waiting_writers.array != NULL)
- free (lock->waiting_writers.array);
- lock->guard.done = 0;
-}
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-void
-glthread_recursive_lock_init (gl_recursive_lock_t *lock)
-{
- lock->owner = 0;
- lock->depth = 0;
- InitializeCriticalSection (&lock->lock);
- lock->guard.done = 1;
-}
-
-void
-glthread_recursive_lock_lock (gl_recursive_lock_t *lock)
-{
- if (!lock->guard.done)
- {
- if (InterlockedIncrement (&lock->guard.started) == 0)
- /* This thread is the first one to need this lock. Initialize it. */
- glthread_recursive_lock_init (lock);
- else
- /* Yield the CPU while waiting for another thread to finish
- initializing this lock. */
- while (!lock->guard.done)
- Sleep (0);
- }
- {
- DWORD self = GetCurrentThreadId ();
- if (lock->owner != self)
- {
- EnterCriticalSection (&lock->lock);
- lock->owner = self;
- }
- if (++(lock->depth) == 0) /* wraparound? */
- abort ();
- }
-}
-
-void
-glthread_recursive_lock_unlock (gl_recursive_lock_t *lock)
-{
- if (lock->owner != GetCurrentThreadId ())
- abort ();
- if (lock->depth == 0)
- abort ();
- if (--(lock->depth) == 0)
- {
- lock->owner = 0;
- LeaveCriticalSection (&lock->lock);
- }
-}
-
-void
-glthread_recursive_lock_destroy (gl_recursive_lock_t *lock)
-{
- if (lock->owner != 0)
- abort ();
- DeleteCriticalSection (&lock->lock);
- lock->guard.done = 0;
-}
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-void
-glthread_once (gl_once_t *once_control, void (*initfunction) (void))
-{
- if (once_control->inited <= 0)
- {
- if (InterlockedIncrement (&once_control->started) == 0)
- {
- /* This thread is the first one to come to this once_control. */
- InitializeCriticalSection (&once_control->lock);
- EnterCriticalSection (&once_control->lock);
- once_control->inited = 0;
- initfunction ();
- once_control->inited = 1;
- LeaveCriticalSection (&once_control->lock);
- }
- else
- {
- /* Undo last operation. */
- InterlockedDecrement (&once_control->started);
- /* Some other thread has already started the initialization.
- Yield the CPU while waiting for the other thread to finish
- initializing and taking the lock. */
- while (once_control->inited < 0)
- Sleep (0);
- if (once_control->inited <= 0)
- {
- /* Take the lock. This blocks until the other thread has
- finished calling the initfunction. */
- EnterCriticalSection (&once_control->lock);
- LeaveCriticalSection (&once_control->lock);
- if (!(once_control->inited > 0))
- abort ();
- }
- }
- }
-}
-
-#endif
-
-/* ========================================================================= */
+++ /dev/null
-/* Locking in multithreaded situations.
- Copyright (C) 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published
- by the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2005.
- Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h,
- gthr-win32.h. */
-
-/* This file contains locking primitives for use with a given thread library.
- It does not contain primitives for creating threads or for other
- synchronization primitives.
-
- Normal (non-recursive) locks:
- Type: gl_lock_t
- Declaration: gl_lock_define(extern, name)
- Initializer: gl_lock_define_initialized(, name)
- Initialization: gl_lock_init (name);
- Taking the lock: gl_lock_lock (name);
- Releasing the lock: gl_lock_unlock (name);
- De-initialization: gl_lock_destroy (name);
-
- Read-Write (non-recursive) locks:
- Type: gl_rwlock_t
- Declaration: gl_rwlock_define(extern, name)
- Initializer: gl_rwlock_define_initialized(, name)
- Initialization: gl_rwlock_init (name);
- Taking the lock: gl_rwlock_rdlock (name);
- gl_rwlock_wrlock (name);
- Releasing the lock: gl_rwlock_unlock (name);
- De-initialization: gl_rwlock_destroy (name);
-
- Recursive locks:
- Type: gl_recursive_lock_t
- Declaration: gl_recursive_lock_define(extern, name)
- Initializer: gl_recursive_lock_define_initialized(, name)
- Initialization: gl_recursive_lock_init (name);
- Taking the lock: gl_recursive_lock_lock (name);
- Releasing the lock: gl_recursive_lock_unlock (name);
- De-initialization: gl_recursive_lock_destroy (name);
-
- Once-only execution:
- Type: gl_once_t
- Initializer: gl_once_define(extern, name)
- Execution: gl_once (name, initfunction);
-*/
-
-
-#ifndef _LOCK_H
-#define _LOCK_H
-
-/* ========================================================================= */
-
-#if USE_POSIX_THREADS
-
-/* Use the POSIX threads library. */
-
-# include <pthread.h>
-# include <stdlib.h>
-
-# if PTHREAD_IN_USE_DETECTION_HARD
-
-/* The pthread_in_use() detection needs to be done at runtime. */
-# define pthread_in_use() \
- glthread_in_use ()
-extern int glthread_in_use (void);
-
-# endif
-
-# if USE_POSIX_THREADS_WEAK
-
-/* Use weak references to the POSIX threads library. */
-
-/* Weak references avoid dragging in external libraries if the other parts
- of the program don't use them. Here we use them, because we don't want
- every program that uses libintl to depend on libpthread. This assumes
- that libpthread would not be loaded after libintl; i.e. if libintl is
- loaded first, by an executable that does not depend on libpthread, and
- then a module is dynamically loaded that depends on libpthread, libintl
- will not be multithread-safe. */
-
-/* The way to test at runtime whether libpthread is present is to test
- whether a function pointer's value, such as &pthread_mutex_init, is
- non-NULL. However, some versions of GCC have a bug through which, in
- PIC mode, &foo != NULL always evaluates to true if there is a direct
- call to foo(...) in the same function. To avoid this, we test the
- address of a function in libpthread that we don't use. */
-
-# pragma weak pthread_mutex_init
-# pragma weak pthread_mutex_lock
-# pragma weak pthread_mutex_unlock
-# pragma weak pthread_mutex_destroy
-# pragma weak pthread_rwlock_init
-# pragma weak pthread_rwlock_rdlock
-# pragma weak pthread_rwlock_wrlock
-# pragma weak pthread_rwlock_unlock
-# pragma weak pthread_rwlock_destroy
-# pragma weak pthread_once
-# pragma weak pthread_cond_init
-# pragma weak pthread_cond_wait
-# pragma weak pthread_cond_signal
-# pragma weak pthread_cond_broadcast
-# pragma weak pthread_cond_destroy
-# pragma weak pthread_mutexattr_init
-# pragma weak pthread_mutexattr_settype
-# pragma weak pthread_mutexattr_destroy
-# ifndef pthread_self
-# pragma weak pthread_self
-# endif
-
-# if !PTHREAD_IN_USE_DETECTION_HARD
-# pragma weak pthread_cancel
-# define pthread_in_use() (pthread_cancel != NULL)
-# endif
-
-# else
-
-# if !PTHREAD_IN_USE_DETECTION_HARD
-# define pthread_in_use() 1
-# endif
-
-# endif
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-typedef pthread_mutex_t gl_lock_t;
-# define gl_lock_define(STORAGECLASS, NAME) \
- STORAGECLASS pthread_mutex_t NAME;
-# define gl_lock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS pthread_mutex_t NAME = gl_lock_initializer;
-# define gl_lock_initializer \
- PTHREAD_MUTEX_INITIALIZER
-# define gl_lock_init(NAME) \
- if (pthread_in_use () && pthread_mutex_init (&NAME, NULL) != 0) abort ()
-# define gl_lock_lock(NAME) \
- if (pthread_in_use () && pthread_mutex_lock (&NAME) != 0) abort ()
-# define gl_lock_unlock(NAME) \
- if (pthread_in_use () && pthread_mutex_unlock (&NAME) != 0) abort ()
-# define gl_lock_destroy(NAME) \
- if (pthread_in_use () && pthread_mutex_destroy (&NAME) != 0) abort ()
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-# if HAVE_PTHREAD_RWLOCK
-
-# ifdef PTHREAD_RWLOCK_INITIALIZER
-
-typedef pthread_rwlock_t gl_rwlock_t;
-# define gl_rwlock_define(STORAGECLASS, NAME) \
- STORAGECLASS pthread_rwlock_t NAME;
-# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS pthread_rwlock_t NAME = gl_rwlock_initializer;
-# define gl_rwlock_initializer \
- PTHREAD_RWLOCK_INITIALIZER
-# define gl_rwlock_init(NAME) \
- if (pthread_in_use () && pthread_rwlock_init (&NAME, NULL) != 0) abort ()
-# define gl_rwlock_rdlock(NAME) \
- if (pthread_in_use () && pthread_rwlock_rdlock (&NAME) != 0) abort ()
-# define gl_rwlock_wrlock(NAME) \
- if (pthread_in_use () && pthread_rwlock_wrlock (&NAME) != 0) abort ()
-# define gl_rwlock_unlock(NAME) \
- if (pthread_in_use () && pthread_rwlock_unlock (&NAME) != 0) abort ()
-# define gl_rwlock_destroy(NAME) \
- if (pthread_in_use () && pthread_rwlock_destroy (&NAME) != 0) abort ()
-
-# else
-
-typedef struct
- {
- int initialized;
- pthread_mutex_t guard; /* protects the initialization */
- pthread_rwlock_t rwlock; /* read-write lock */
- }
- gl_rwlock_t;
-# define gl_rwlock_define(STORAGECLASS, NAME) \
- STORAGECLASS gl_rwlock_t NAME;
-# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer;
-# define gl_rwlock_initializer \
- { 0, PTHREAD_MUTEX_INITIALIZER }
-# define gl_rwlock_init(NAME) \
- if (pthread_in_use ()) glthread_rwlock_init (&NAME)
-# define gl_rwlock_rdlock(NAME) \
- if (pthread_in_use ()) glthread_rwlock_rdlock (&NAME)
-# define gl_rwlock_wrlock(NAME) \
- if (pthread_in_use ()) glthread_rwlock_wrlock (&NAME)
-# define gl_rwlock_unlock(NAME) \
- if (pthread_in_use ()) glthread_rwlock_unlock (&NAME)
-# define gl_rwlock_destroy(NAME) \
- if (pthread_in_use ()) glthread_rwlock_destroy (&NAME)
-extern void glthread_rwlock_init (gl_rwlock_t *lock);
-extern void glthread_rwlock_rdlock (gl_rwlock_t *lock);
-extern void glthread_rwlock_wrlock (gl_rwlock_t *lock);
-extern void glthread_rwlock_unlock (gl_rwlock_t *lock);
-extern void glthread_rwlock_destroy (gl_rwlock_t *lock);
-
-# endif
-
-# else
-
-typedef struct
- {
- pthread_mutex_t lock; /* protects the remaining fields */
- pthread_cond_t waiting_readers; /* waiting readers */
- pthread_cond_t waiting_writers; /* waiting writers */
- unsigned int waiting_writers_count; /* number of waiting writers */
- int runcount; /* number of readers running, or -1 when a writer runs */
- }
- gl_rwlock_t;
-# define gl_rwlock_define(STORAGECLASS, NAME) \
- STORAGECLASS gl_rwlock_t NAME;
-# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer;
-# define gl_rwlock_initializer \
- { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
-# define gl_rwlock_init(NAME) \
- if (pthread_in_use ()) glthread_rwlock_init (&NAME)
-# define gl_rwlock_rdlock(NAME) \
- if (pthread_in_use ()) glthread_rwlock_rdlock (&NAME)
-# define gl_rwlock_wrlock(NAME) \
- if (pthread_in_use ()) glthread_rwlock_wrlock (&NAME)
-# define gl_rwlock_unlock(NAME) \
- if (pthread_in_use ()) glthread_rwlock_unlock (&NAME)
-# define gl_rwlock_destroy(NAME) \
- if (pthread_in_use ()) glthread_rwlock_destroy (&NAME)
-extern void glthread_rwlock_init (gl_rwlock_t *lock);
-extern void glthread_rwlock_rdlock (gl_rwlock_t *lock);
-extern void glthread_rwlock_wrlock (gl_rwlock_t *lock);
-extern void glthread_rwlock_unlock (gl_rwlock_t *lock);
-extern void glthread_rwlock_destroy (gl_rwlock_t *lock);
-
-# endif
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-# if HAVE_PTHREAD_MUTEX_RECURSIVE
-
-# if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
-
-typedef pthread_mutex_t gl_recursive_lock_t;
-# define gl_recursive_lock_define(STORAGECLASS, NAME) \
- STORAGECLASS pthread_mutex_t NAME;
-# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS pthread_mutex_t NAME = gl_recursive_lock_initializer;
-# ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER
-# define gl_recursive_lock_initializer \
- PTHREAD_RECURSIVE_MUTEX_INITIALIZER
-# else
-# define gl_recursive_lock_initializer \
- PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
-# endif
-# define gl_recursive_lock_init(NAME) \
- if (pthread_in_use () && pthread_mutex_init (&NAME, NULL) != 0) abort ()
-# define gl_recursive_lock_lock(NAME) \
- if (pthread_in_use () && pthread_mutex_lock (&NAME) != 0) abort ()
-# define gl_recursive_lock_unlock(NAME) \
- if (pthread_in_use () && pthread_mutex_unlock (&NAME) != 0) abort ()
-# define gl_recursive_lock_destroy(NAME) \
- if (pthread_in_use () && pthread_mutex_destroy (&NAME) != 0) abort ()
-
-# else
-
-typedef struct
- {
- pthread_mutex_t recmutex; /* recursive mutex */
- pthread_mutex_t guard; /* protects the initialization */
- int initialized;
- }
- gl_recursive_lock_t;
-# define gl_recursive_lock_define(STORAGECLASS, NAME) \
- STORAGECLASS gl_recursive_lock_t NAME;
-# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
-# define gl_recursive_lock_initializer \
- { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 0 }
-# define gl_recursive_lock_init(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_init (&NAME)
-# define gl_recursive_lock_lock(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_lock (&NAME)
-# define gl_recursive_lock_unlock(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_unlock (&NAME)
-# define gl_recursive_lock_destroy(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_destroy (&NAME)
-extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
-extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
-extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
-extern void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock);
-
-# endif
-
-# else
-
-/* Old versions of POSIX threads on Solaris did not have recursive locks.
- We have to implement them ourselves. */
-
-typedef struct
- {
- pthread_mutex_t mutex;
- pthread_t owner;
- unsigned long depth;
- }
- gl_recursive_lock_t;
-# define gl_recursive_lock_define(STORAGECLASS, NAME) \
- STORAGECLASS gl_recursive_lock_t NAME;
-# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
-# define gl_recursive_lock_initializer \
- { PTHREAD_MUTEX_INITIALIZER, (pthread_t) 0, 0 }
-# define gl_recursive_lock_init(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_init (&NAME)
-# define gl_recursive_lock_lock(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_lock (&NAME)
-# define gl_recursive_lock_unlock(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_unlock (&NAME)
-# define gl_recursive_lock_destroy(NAME) \
- if (pthread_in_use ()) glthread_recursive_lock_destroy (&NAME)
-extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
-extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
-extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
-extern void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock);
-
-# endif
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-typedef pthread_once_t gl_once_t;
-# define gl_once_define(STORAGECLASS, NAME) \
- STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT;
-# define gl_once(NAME, INITFUNCTION) \
- do \
- { \
- if (pthread_in_use ()) \
- { \
- if (pthread_once (&NAME, INITFUNCTION) != 0) \
- abort (); \
- } \
- else \
- { \
- if (glthread_once_singlethreaded (&NAME)) \
- INITFUNCTION (); \
- } \
- } \
- while (0)
-extern int glthread_once_singlethreaded (pthread_once_t *once_control);
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_PTH_THREADS
-
-/* Use the GNU Pth threads library. */
-
-# include <pth.h>
-# include <stdlib.h>
-
-# if USE_PTH_THREADS_WEAK
-
-/* Use weak references to the GNU Pth threads library. */
-
-# pragma weak pth_mutex_init
-# pragma weak pth_mutex_acquire
-# pragma weak pth_mutex_release
-# pragma weak pth_rwlock_init
-# pragma weak pth_rwlock_acquire
-# pragma weak pth_rwlock_release
-# pragma weak pth_once
-
-# pragma weak pth_cancel
-# define pth_in_use() (pth_cancel != NULL)
-
-# else
-
-# define pth_in_use() 1
-
-# endif
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-typedef pth_mutex_t gl_lock_t;
-# define gl_lock_define(STORAGECLASS, NAME) \
- STORAGECLASS pth_mutex_t NAME;
-# define gl_lock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS pth_mutex_t NAME = gl_lock_initializer;
-# define gl_lock_initializer \
- PTH_MUTEX_INIT
-# define gl_lock_init(NAME) \
- if (pth_in_use() && !pth_mutex_init (&NAME)) abort ()
-# define gl_lock_lock(NAME) \
- if (pth_in_use() && !pth_mutex_acquire (&NAME, 0, NULL)) abort ()
-# define gl_lock_unlock(NAME) \
- if (pth_in_use() && !pth_mutex_release (&NAME)) abort ()
-# define gl_lock_destroy(NAME) \
- (void)(&NAME)
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-typedef pth_rwlock_t gl_rwlock_t;
-# define gl_rwlock_define(STORAGECLASS, NAME) \
- STORAGECLASS pth_rwlock_t NAME;
-# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS pth_rwlock_t NAME = gl_rwlock_initializer;
-# define gl_rwlock_initializer \
- PTH_RWLOCK_INIT
-# define gl_rwlock_init(NAME) \
- if (pth_in_use() && !pth_rwlock_init (&NAME)) abort ()
-# define gl_rwlock_rdlock(NAME) \
- if (pth_in_use() && !pth_rwlock_acquire (&NAME, PTH_RWLOCK_RD, 0, NULL)) abort ()
-# define gl_rwlock_wrlock(NAME) \
- if (pth_in_use() && !pth_rwlock_acquire (&NAME, PTH_RWLOCK_RW, 0, NULL)) abort ()
-# define gl_rwlock_unlock(NAME) \
- if (pth_in_use() && !pth_rwlock_release (&NAME)) abort ()
-# define gl_rwlock_destroy(NAME) \
- (void)(&NAME)
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-/* In Pth, mutexes are recursive by default. */
-typedef pth_mutex_t gl_recursive_lock_t;
-# define gl_recursive_lock_define(STORAGECLASS, NAME) \
- STORAGECLASS pth_mutex_t NAME;
-# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS pth_mutex_t NAME = gl_recursive_lock_initializer;
-# define gl_recursive_lock_initializer \
- PTH_MUTEX_INIT
-# define gl_recursive_lock_init(NAME) \
- if (pth_in_use() && !pth_mutex_init (&NAME)) abort ()
-# define gl_recursive_lock_lock(NAME) \
- if (pth_in_use() && !pth_mutex_acquire (&NAME, 0, NULL)) abort ()
-# define gl_recursive_lock_unlock(NAME) \
- if (pth_in_use() && !pth_mutex_release (&NAME)) abort ()
-# define gl_recursive_lock_destroy(NAME) \
- (void)(&NAME)
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-typedef pth_once_t gl_once_t;
-# define gl_once_define(STORAGECLASS, NAME) \
- STORAGECLASS pth_once_t NAME = PTH_ONCE_INIT;
-# define gl_once(NAME, INITFUNCTION) \
- do \
- { \
- if (pth_in_use ()) \
- { \
- void (*gl_once_temp) (void) = INITFUNCTION; \
- if (!pth_once (&NAME, glthread_once_call, &gl_once_temp)) \
- abort (); \
- } \
- else \
- { \
- if (glthread_once_singlethreaded (&NAME)) \
- INITFUNCTION (); \
- } \
- } \
- while (0)
-extern void glthread_once_call (void *arg);
-extern int glthread_once_singlethreaded (pth_once_t *once_control);
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_SOLARIS_THREADS
-
-/* Use the old Solaris threads library. */
-
-# include <thread.h>
-# include <synch.h>
-# include <stdlib.h>
-
-# if USE_SOLARIS_THREADS_WEAK
-
-/* Use weak references to the old Solaris threads library. */
-
-# pragma weak mutex_init
-# pragma weak mutex_lock
-# pragma weak mutex_unlock
-# pragma weak mutex_destroy
-# pragma weak rwlock_init
-# pragma weak rw_rdlock
-# pragma weak rw_wrlock
-# pragma weak rw_unlock
-# pragma weak rwlock_destroy
-# pragma weak thr_self
-
-# pragma weak thr_suspend
-# define thread_in_use() (thr_suspend != NULL)
-
-# else
-
-# define thread_in_use() 1
-
-# endif
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-typedef mutex_t gl_lock_t;
-# define gl_lock_define(STORAGECLASS, NAME) \
- STORAGECLASS mutex_t NAME;
-# define gl_lock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS mutex_t NAME = gl_lock_initializer;
-# define gl_lock_initializer \
- DEFAULTMUTEX
-# define gl_lock_init(NAME) \
- if (thread_in_use () && mutex_init (&NAME, USYNC_THREAD, NULL) != 0) abort ()
-# define gl_lock_lock(NAME) \
- if (thread_in_use () && mutex_lock (&NAME) != 0) abort ()
-# define gl_lock_unlock(NAME) \
- if (thread_in_use () && mutex_unlock (&NAME) != 0) abort ()
-# define gl_lock_destroy(NAME) \
- if (thread_in_use () && mutex_destroy (&NAME) != 0) abort ()
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-typedef rwlock_t gl_rwlock_t;
-# define gl_rwlock_define(STORAGECLASS, NAME) \
- STORAGECLASS rwlock_t NAME;
-# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS rwlock_t NAME = gl_rwlock_initializer;
-# define gl_rwlock_initializer \
- DEFAULTRWLOCK
-# define gl_rwlock_init(NAME) \
- if (thread_in_use () && rwlock_init (&NAME, USYNC_THREAD, NULL) != 0) abort ()
-# define gl_rwlock_rdlock(NAME) \
- if (thread_in_use () && rw_rdlock (&NAME) != 0) abort ()
-# define gl_rwlock_wrlock(NAME) \
- if (thread_in_use () && rw_wrlock (&NAME) != 0) abort ()
-# define gl_rwlock_unlock(NAME) \
- if (thread_in_use () && rw_unlock (&NAME) != 0) abort ()
-# define gl_rwlock_destroy(NAME) \
- if (thread_in_use () && rwlock_destroy (&NAME) != 0) abort ()
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-/* Old Solaris threads did not have recursive locks.
- We have to implement them ourselves. */
-
-typedef struct
- {
- mutex_t mutex;
- thread_t owner;
- unsigned long depth;
- }
- gl_recursive_lock_t;
-# define gl_recursive_lock_define(STORAGECLASS, NAME) \
- STORAGECLASS gl_recursive_lock_t NAME;
-# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
-# define gl_recursive_lock_initializer \
- { DEFAULTMUTEX, (thread_t) 0, 0 }
-# define gl_recursive_lock_init(NAME) \
- if (thread_in_use ()) glthread_recursive_lock_init (&NAME)
-# define gl_recursive_lock_lock(NAME) \
- if (thread_in_use ()) glthread_recursive_lock_lock (&NAME)
-# define gl_recursive_lock_unlock(NAME) \
- if (thread_in_use ()) glthread_recursive_lock_unlock (&NAME)
-# define gl_recursive_lock_destroy(NAME) \
- if (thread_in_use ()) glthread_recursive_lock_destroy (&NAME)
-extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
-extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
-extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
-extern void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock);
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-typedef struct
- {
- volatile int inited;
- mutex_t mutex;
- }
- gl_once_t;
-# define gl_once_define(STORAGECLASS, NAME) \
- STORAGECLASS gl_once_t NAME = { 0, DEFAULTMUTEX };
-# define gl_once(NAME, INITFUNCTION) \
- do \
- { \
- if (thread_in_use ()) \
- { \
- glthread_once (&NAME, INITFUNCTION); \
- } \
- else \
- { \
- if (glthread_once_singlethreaded (&NAME)) \
- INITFUNCTION (); \
- } \
- } \
- while (0)
-extern void glthread_once (gl_once_t *once_control, void (*initfunction) (void));
-extern int glthread_once_singlethreaded (gl_once_t *once_control);
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_WIN32_THREADS
-
-# include <windows.h>
-
-/* We can use CRITICAL_SECTION directly, rather than the Win32 Event, Mutex,
- Semaphore types, because
- - we need only to synchronize inside a single process (address space),
- not inter-process locking,
- - we don't need to support trylock operations. (TryEnterCriticalSection
- does not work on Windows 95/98/ME. Packages that need trylock usually
- define their own mutex type.) */
-
-/* There is no way to statically initialize a CRITICAL_SECTION. It needs
- to be done lazily, once only. For this we need spinlocks. */
-
-typedef struct { volatile int done; volatile long started; } gl_spinlock_t;
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-typedef struct
- {
- gl_spinlock_t guard; /* protects the initialization */
- CRITICAL_SECTION lock;
- }
- gl_lock_t;
-# define gl_lock_define(STORAGECLASS, NAME) \
- STORAGECLASS gl_lock_t NAME;
-# define gl_lock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS gl_lock_t NAME = gl_lock_initializer;
-# define gl_lock_initializer \
- { { 0, -1 } }
-# define gl_lock_init(NAME) \
- glthread_lock_init (&NAME)
-# define gl_lock_lock(NAME) \
- glthread_lock_lock (&NAME)
-# define gl_lock_unlock(NAME) \
- glthread_lock_unlock (&NAME)
-# define gl_lock_destroy(NAME) \
- glthread_lock_destroy (&NAME)
-extern void glthread_lock_init (gl_lock_t *lock);
-extern void glthread_lock_lock (gl_lock_t *lock);
-extern void glthread_lock_unlock (gl_lock_t *lock);
-extern void glthread_lock_destroy (gl_lock_t *lock);
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-/* It is impossible to implement read-write locks using plain locks, without
- introducing an extra thread dedicated to managing read-write locks.
- Therefore here we need to use the low-level Event type. */
-
-typedef struct
- {
- HANDLE *array; /* array of waiting threads, each represented by an event */
- unsigned int count; /* number of waiting threads */
- unsigned int alloc; /* length of allocated array */
- unsigned int offset; /* index of first waiting thread in array */
- }
- gl_waitqueue_t;
-typedef struct
- {
- gl_spinlock_t guard; /* protects the initialization */
- CRITICAL_SECTION lock; /* protects the remaining fields */
- gl_waitqueue_t waiting_readers; /* waiting readers */
- gl_waitqueue_t waiting_writers; /* waiting writers */
- int runcount; /* number of readers running, or -1 when a writer runs */
- }
- gl_rwlock_t;
-# define gl_rwlock_define(STORAGECLASS, NAME) \
- STORAGECLASS gl_rwlock_t NAME;
-# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer;
-# define gl_rwlock_initializer \
- { { 0, -1 } }
-# define gl_rwlock_init(NAME) \
- glthread_rwlock_init (&NAME)
-# define gl_rwlock_rdlock(NAME) \
- glthread_rwlock_rdlock (&NAME)
-# define gl_rwlock_wrlock(NAME) \
- glthread_rwlock_wrlock (&NAME)
-# define gl_rwlock_unlock(NAME) \
- glthread_rwlock_unlock (&NAME)
-# define gl_rwlock_destroy(NAME) \
- glthread_rwlock_destroy (&NAME)
-extern void glthread_rwlock_init (gl_rwlock_t *lock);
-extern void glthread_rwlock_rdlock (gl_rwlock_t *lock);
-extern void glthread_rwlock_wrlock (gl_rwlock_t *lock);
-extern void glthread_rwlock_unlock (gl_rwlock_t *lock);
-extern void glthread_rwlock_destroy (gl_rwlock_t *lock);
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-/* The Win32 documentation says that CRITICAL_SECTION already implements a
- recursive lock. But we need not rely on it: It's easy to implement a
- recursive lock without this assumption. */
-
-typedef struct
- {
- gl_spinlock_t guard; /* protects the initialization */
- DWORD owner;
- unsigned long depth;
- CRITICAL_SECTION lock;
- }
- gl_recursive_lock_t;
-# define gl_recursive_lock_define(STORAGECLASS, NAME) \
- STORAGECLASS gl_recursive_lock_t NAME;
-# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
- STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
-# define gl_recursive_lock_initializer \
- { { 0, -1 }, 0, 0 }
-# define gl_recursive_lock_init(NAME) \
- glthread_recursive_lock_init (&NAME)
-# define gl_recursive_lock_lock(NAME) \
- glthread_recursive_lock_lock (&NAME)
-# define gl_recursive_lock_unlock(NAME) \
- glthread_recursive_lock_unlock (&NAME)
-# define gl_recursive_lock_destroy(NAME) \
- glthread_recursive_lock_destroy (&NAME)
-extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
-extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
-extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
-extern void glthread_recursive_lock_destroy (gl_recursive_lock_t *lock);
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-typedef struct
- {
- volatile int inited;
- volatile long started;
- CRITICAL_SECTION lock;
- }
- gl_once_t;
-# define gl_once_define(STORAGECLASS, NAME) \
- STORAGECLASS gl_once_t NAME = { -1, -1 };
-# define gl_once(NAME, INITFUNCTION) \
- glthread_once (&NAME, INITFUNCTION)
-extern void glthread_once (gl_once_t *once_control, void (*initfunction) (void));
-
-#endif
-
-/* ========================================================================= */
-
-#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || USE_WIN32_THREADS)
-
-/* Provide dummy implementation if threads are not supported. */
-
-/* -------------------------- gl_lock_t datatype -------------------------- */
-
-typedef int gl_lock_t;
-# define gl_lock_define(STORAGECLASS, NAME)
-# define gl_lock_define_initialized(STORAGECLASS, NAME)
-# define gl_lock_init(NAME)
-# define gl_lock_lock(NAME)
-# define gl_lock_unlock(NAME)
-
-/* ------------------------- gl_rwlock_t datatype ------------------------- */
-
-typedef int gl_rwlock_t;
-# define gl_rwlock_define(STORAGECLASS, NAME)
-# define gl_rwlock_define_initialized(STORAGECLASS, NAME)
-# define gl_rwlock_init(NAME)
-# define gl_rwlock_rdlock(NAME)
-# define gl_rwlock_wrlock(NAME)
-# define gl_rwlock_unlock(NAME)
-
-/* --------------------- gl_recursive_lock_t datatype --------------------- */
-
-typedef int gl_recursive_lock_t;
-# define gl_recursive_lock_define(STORAGECLASS, NAME)
-# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME)
-# define gl_recursive_lock_init(NAME)
-# define gl_recursive_lock_lock(NAME)
-# define gl_recursive_lock_unlock(NAME)
-
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-typedef int gl_once_t;
-# define gl_once_define(STORAGECLASS, NAME) \
- STORAGECLASS gl_once_t NAME = 0;
-# define gl_once(NAME, INITFUNCTION) \
- do \
- { \
- if (NAME == 0) \
- { \
- NAME = ~ 0; \
- INITFUNCTION (); \
- } \
- } \
- while (0)
-
-#endif
-
-/* ========================================================================= */
-
-#endif /* _LOCK_H */
+++ /dev/null
-/* Determine the number of screen columns needed for a string.
- Copyright (C) 2000-2006 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Written by Bruno Haible <haible@clisp.cons.org>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "mbswidth.h"
-
-/* Get MB_CUR_MAX. */
-#include <stdlib.h>
-
-#include <string.h>
-
-/* Get isprint(). */
-#include <ctype.h>
-
-/* Get mbstate_t, mbrtowc(), mbsinit(). */
-#if HAVE_WCHAR_H
-/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
- <wchar.h>.
- BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
- <wchar.h>. */
-# include <stdio.h>
-# include <time.h>
-# include <wchar.h>
-#endif
-
-/* Get wcwidth(). */
-#include "wcwidth.h"
-
-/* Get iswcntrl(). */
-#if HAVE_WCTYPE_H
-# include <wctype.h>
-#endif
-#if !defined iswcntrl && !HAVE_ISWCNTRL
-# define iswcntrl(wc) 0
-#endif
-
-#ifndef mbsinit
-# if !HAVE_MBSINIT
-# define mbsinit(ps) 1
-# endif
-#endif
-
-/* 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. */
-int
-mbswidth (const char *string, int flags)
-{
- return mbsnwidth (string, strlen (string), 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. */
-int
-mbsnwidth (const char *string, size_t nbytes, int flags)
-{
- const char *p = string;
- const char *plimit = p + nbytes;
- int width;
-
- width = 0;
-#if HAVE_MBRTOWC
- if (MB_CUR_MAX > 1)
- {
- while (p < plimit)
- switch (*p)
- {
- 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 '~':
- /* These characters are printable ASCII characters. */
- p++;
- width++;
- break;
- default:
- /* If we have a multibyte sequence, scan it up to its end. */
- {
- mbstate_t mbstate;
- memset (&mbstate, 0, sizeof mbstate);
- do
- {
- wchar_t wc;
- size_t bytes;
- int w;
-
- bytes = mbrtowc (&wc, p, plimit - p, &mbstate);
-
- if (bytes == (size_t) -1)
- /* An invalid multibyte sequence was encountered. */
- {
- if (!(flags & MBSW_REJECT_INVALID))
- {
- p++;
- width++;
- break;
- }
- else
- return -1;
- }
-
- if (bytes == (size_t) -2)
- /* An incomplete multibyte character at the end. */
- {
- if (!(flags & MBSW_REJECT_INVALID))
- {
- p = plimit;
- width++;
- break;
- }
- else
- return -1;
- }
-
- if (bytes == 0)
- /* A null wide character was encountered. */
- bytes = 1;
-
- w = wcwidth (wc);
- if (w >= 0)
- /* A printable multibyte character. */
- width += w;
- else
- /* An unprintable multibyte character. */
- if (!(flags & MBSW_REJECT_UNPRINTABLE))
- width += (iswcntrl (wc) ? 0 : 1);
- else
- return -1;
-
- p += bytes;
- }
- while (! mbsinit (&mbstate));
- }
- break;
- }
- return width;
- }
-#endif
-
- while (p < plimit)
- {
- unsigned char c = (unsigned char) *p++;
-
- if (isprint (c))
- width++;
- else if (!(flags & MBSW_REJECT_UNPRINTABLE))
- width += (iscntrl (c) ? 0 : 1);
- else
- return -1;
- }
- return width;
-}
+++ /dev/null
-/* Determine the number of screen columns needed for a string.
- Copyright (C) 2000-2004 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#include <stddef.h>
-
-/* Avoid a clash of our mbswidth() with a function of the same name defined
- in UnixWare 7.1.1 <wchar.h>. We need this #include before the #define
- below.
- However, we don't want to #include <wchar.h> on all platforms because
- - Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
- <wchar.h>.
- - BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
- <wchar.h>. */
-#if HAVE_DECL_MBSWIDTH_IN_WCHAR_H
-# include <wchar.h>
-#endif
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Optional flags to influence mbswidth/mbsnwidth behavior. */
-
-/* If this bit is set, return -1 upon finding an invalid or incomplete
- character. Otherwise, assume invalid characters have width 1. */
-#define MBSW_REJECT_INVALID 1
-
-/* If this bit is set, return -1 upon finding a non-printable character.
- Otherwise, assume unprintable characters have width 0 if they are
- control characters and 1 otherwise. */
-#define MBSW_REJECT_UNPRINTABLE 2
-
-
-/* Returns the number of screen columns needed for STRING. */
-#define mbswidth gnu_mbswidth /* avoid clash with UnixWare 7.1.1 function */
-extern int mbswidth (const char *string, int flags);
-
-/* Returns the number of screen columns needed for the NBYTES bytes
- starting at BUF. */
-extern int mbsnwidth (const char *buf, size_t nbytes, int flags);
-
-
-#ifdef __cplusplus
-}
-#endif
+++ /dev/null
-/* memmove.c -- copy memory.
- Copy LENGTH bytes from SOURCE to DEST. Does not null-terminate.
- In the public domain.
- By David MacKenzie <djm@gnu.ai.mit.edu>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stddef.h>
-
-void *
-memmove (void *dest0, void const *source0, size_t length)
-{
- char *dest = dest0;
- char const *source = source0;
- if (source < dest)
- /* Moving from low mem to hi mem; start at end. */
- for (source += length, dest += length; length; --length)
- *--dest = *--source;
- else if (source != dest)
- {
- /* Moving from hi mem to low mem; start at beginning. */
- for (; length; --length)
- *dest++ = *source++;
- }
- return dest0;
-}
+++ /dev/null
-/* memset.c -- set an area of memory to a given value
- Copyright (C) 1991, 2003 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#include <stddef.h>
-
-void *
-memset (void *str, int c, size_t len)
-{
- register char *st = str;
-
- while (len-- > 0)
- *st++ = c;
- return str;
-}
+++ /dev/null
-/* MIN, MAX macros.
- Copyright (C) 1995, 1998, 2001, 2003, 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _MINMAX_H
-#define _MINMAX_H
-
-/* Note: MIN, MAX are also defined in <sys/param.h> on some systems
- (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about
- MIN, MAX macro redefinitions on some systems; the workaround is to
- #include this file as the last one among the #include list. */
-
-/* Before we define the following symbols we get the <limits.h> file
- since otherwise we get redefinitions on some systems if <limits.h> is
- included after this file. Likewise for <sys/param.h>.
- If more than one of these system headers define MIN and MAX, pick just
- one of the headers (because the definitions most likely are the same). */
-#if HAVE_MINMAX_IN_LIMITS_H
-# include <limits.h>
-#elif HAVE_MINMAX_IN_SYS_PARAM_H
-# include <sys/param.h>
-#endif
-
-/* Note: MIN and MAX should be used with two arguments of the
- same type. They might not return the minimum and maximum of their two
- arguments, if the arguments have different types or have unusual
- floating-point values. For example, on a typical host with 32-bit 'int',
- 64-bit 'long long', and 64-bit IEEE 754 'double' types:
-
- MAX (-1, 2147483648) returns 4294967295.
- MAX (9007199254740992.0, 9007199254740993) returns 9007199254740992.0.
- MAX (NaN, 0.0) returns 0.0.
- MAX (+0.0, -0.0) returns -0.0.
-
- and in each case the answer is in some sense bogus. */
-
-/* MAX(a,b) returns the maximum of A and B. */
-#ifndef MAX
-# define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
-/* MIN(a,b) returns the minimum of A and B. */
-#ifndef MIN
-# define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-
-#endif /* _MINMAX_H */
+++ /dev/null
-/* Copyright (C) 1999, 2001-2003, 2006 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 51 Franklin Street,
- Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Extracted from misc/mkdtemp.c and sysdeps/posix/tempname.c. */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-/* Specification. */
-#include "mkdtemp.h"
-
-#include <errno.h>
-#ifndef __set_errno
-# define __set_errno(Val) errno = (Val)
-#endif
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <stdio.h>
-#ifndef TMP_MAX
-# define TMP_MAX 238328
-#endif
-
-#if HAVE_STDINT_H || _LIBC
-# include <stdint.h>
-#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-
-#include <unistd.h>
-
-#if HAVE_GETTIMEOFDAY || _LIBC
-# if HAVE_SYS_TIME_H || _LIBC
-# include <sys/time.h>
-# endif
-#else
-# if HAVE_TIME_H || _LIBC
-# include <time.h>
-# endif
-#endif
-
-#include <sys/stat.h>
-#if !defined S_ISDIR && defined S_IFDIR
-# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
-#endif
-#if !S_IRUSR && S_IREAD
-# define S_IRUSR S_IREAD
-#endif
-#if !S_IRUSR
-# define S_IRUSR 00400
-#endif
-#if !S_IWUSR && S_IWRITE
-# define S_IWUSR S_IWRITE
-#endif
-#if !S_IWUSR
-# define S_IWUSR 00200
-#endif
-#if !S_IXUSR && S_IEXEC
-# define S_IXUSR S_IEXEC
-#endif
-#if !S_IXUSR
-# define S_IXUSR 00100
-#endif
-
-#ifdef __MINGW32__
-# include <io.h>
-/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
- Therefore we have to disable the argument count checking. */
-# define mkdir ((int (*)()) _mkdir)
-#endif
-
-#if !_LIBC
-# define __getpid getpid
-# define __gettimeofday gettimeofday
-# define __mkdir mkdir
-#endif
-
-/* Use the widest available unsigned type if uint64_t is not
- available. The algorithm below extracts a number less than 62**6
- (approximately 2**35.725) from uint64_t, so ancient hosts where
- uintmax_t is only 32 bits lose about 3.725 bits of randomness,
- which is better than not having mkstemp at all. */
-#if !defined UINT64_MAX && !defined uint64_t
-# define uint64_t uintmax_t
-#endif
-
-/* These are the characters used in temporary filenames. */
-static const char letters[] =
-"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
-
-/* Generate a temporary file name based on TMPL. TMPL must match the
- rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed
- does not exist at the time of the call to __gen_tempname. TMPL is
- overwritten with the result.
-
- KIND is:
- __GT_DIR: create a directory, which will be mode 0700.
-
- We use a clever algorithm to get hard-to-predict names. */
-static int
-gen_tempname (char *tmpl)
-{
- int len;
- char *XXXXXX;
- static uint64_t value;
- uint64_t random_time_bits;
- int count, fd = -1;
- int save_errno = errno;
-
- len = strlen (tmpl);
- if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX"))
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- /* This is where the Xs start. */
- XXXXXX = &tmpl[len - 6];
-
- /* Get some more or less random data. */
-#ifdef RANDOM_BITS
- RANDOM_BITS (random_time_bits);
-#else
-# if HAVE_GETTIMEOFDAY || _LIBC
- {
- struct timeval tv;
- __gettimeofday (&tv, NULL);
- random_time_bits = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec;
- }
-# else
- random_time_bits = time (NULL);
-# endif
-#endif
- value += random_time_bits ^ __getpid ();
-
- for (count = 0; count < TMP_MAX; value += 7777, ++count)
- {
- uint64_t v = value;
-
- /* Fill in the random bits. */
- XXXXXX[0] = letters[v % 62];
- v /= 62;
- XXXXXX[1] = letters[v % 62];
- v /= 62;
- XXXXXX[2] = letters[v % 62];
- v /= 62;
- XXXXXX[3] = letters[v % 62];
- v /= 62;
- XXXXXX[4] = letters[v % 62];
- v /= 62;
- XXXXXX[5] = letters[v % 62];
-
- fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
-
- if (fd >= 0)
- {
- __set_errno (save_errno);
- return fd;
- }
- else if (errno != EEXIST)
- return -1;
- }
-
- /* We got out of the loop because we ran out of combinations to try. */
- __set_errno (EEXIST);
- return -1;
-}
-
-/* Generate a unique temporary directory from TEMPLATE.
- The last six characters of TEMPLATE must be "XXXXXX";
- they are replaced with a string that makes the filename unique.
- The directory is created, mode 700, and its name is returned.
- (This function comes from OpenBSD.) */
-char *
-mkdtemp (char *template)
-{
- if (gen_tempname (template))
- return NULL;
- else
- return template;
-}
+++ /dev/null
-/* Creating a private temporary directory.
- Copyright (C) 2001-2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#if HAVE_MKDTEMP
-
-/* Get mkdtemp() declaration. */
-#include <stdlib.h>
-
-#else
-
-/* Create a unique temporary directory from TEMPLATE.
- The last six characters of TEMPLATE must be "XXXXXX";
- they are replaced with a string that makes the directory name unique.
- Returns TEMPLATE, or a null pointer if it cannot get a unique name.
- The directory is created mode 700. */
-extern char * mkdtemp (char *template);
-
-#endif
+++ /dev/null
-/* obstack.c - subroutines used implicitly by object stack macros
- Copyright (C) 1988-1994, 1996-1999, 2000-2005 Free Software Foundation, Inc.
- This file is part of the GNU C Library. Its master source is NOT part of
- the C library, however. The master source lives in /gd/gnu/lib.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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 the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef _LIBC
-# include <obstack.h>
-# include <shlib-compat.h>
-#else
-# include "obstack.h"
-#endif
-
-/* NOTE BEFORE MODIFYING THIS FILE: This version number must be
- incremented whenever callers compiled using an old obstack.h can no
- longer properly call the functions in this obstack.c. */
-#define OBSTACK_INTERFACE_VERSION 1
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself, and the installed library
- supports the same library interface we do. This code is part of the GNU
- C Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object
- files, it is simpler to just do this in the source for each such file. */
-
-#include <stdio.h> /* Random thing to get __GNU_LIBRARY__. */
-#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
-# include <gnu-versions.h>
-# if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION
-# define ELIDE_CODE
-# endif
-#endif
-
-#include <stddef.h>
-
-#ifndef ELIDE_CODE
-
-
-# if HAVE_INTTYPES_H
-# include <inttypes.h>
-# endif
-# if HAVE_STDINT_H || defined _LIBC
-# include <stdint.h>
-# endif
-
-/* Determine default alignment. */
-union fooround
-{
- uintmax_t i;
- long double d;
- void *p;
-};
-struct fooalign
-{
- char c;
- union fooround u;
-};
-/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
- But in fact it might be less smart and round addresses to as much as
- DEFAULT_ROUNDING. So we prepare for it to do that. */
-enum
- {
- DEFAULT_ALIGNMENT = offsetof (struct fooalign, u),
- DEFAULT_ROUNDING = sizeof (union fooround)
- };
-
-/* When we copy a long block of data, this is the unit to do it with.
- On some machines, copying successive ints does not work;
- in such a case, redefine COPYING_UNIT to `long' (if that works)
- or `char' as a last resort. */
-# ifndef COPYING_UNIT
-# define COPYING_UNIT int
-# endif
-
-
-/* The functions allocating more room by calling `obstack_chunk_alloc'
- jump to the handler pointed to by `obstack_alloc_failed_handler'.
- This can be set to a user defined function which should either
- abort gracefully or use longjump - but shouldn't return. This
- variable by default points to the internal function
- `print_and_abort'. */
-static void print_and_abort (void);
-void (*obstack_alloc_failed_handler) (void) = print_and_abort;
-
-/* Exit value used when `print_and_abort' is used. */
-# include <stdlib.h>
-# ifdef _LIBC
-int obstack_exit_failure = EXIT_FAILURE;
-# else
-# include "exitfail.h"
-# define obstack_exit_failure exit_failure
-# endif
-
-# ifdef _LIBC
-# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
-/* A looong time ago (before 1994, anyway; we're not sure) this global variable
- was used by non-GNU-C macros to avoid multiple evaluation. The GNU C
- library still exports it because somebody might use it. */
-struct obstack *_obstack_compat;
-compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0);
-# endif
-# endif
-
-/* Define a macro that either calls functions with the traditional malloc/free
- calling interface, or calls functions with the mmalloc/mfree interface
- (that adds an extra first argument), based on the state of use_extra_arg.
- For free, do not use ?:, since some compilers, like the MIPS compilers,
- do not allow (expr) ? void : void. */
-
-# define CALL_CHUNKFUN(h, size) \
- (((h) -> use_extra_arg) \
- ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
- : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size)))
-
-# define CALL_FREEFUN(h, old_chunk) \
- do { \
- if ((h) -> use_extra_arg) \
- (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \
- else \
- (*(void (*) (void *)) (h)->freefun) ((old_chunk)); \
- } while (0)
-
-\f
-/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default).
- Objects start on multiples of ALIGNMENT (0 means use default).
- CHUNKFUN is the function to use to allocate chunks,
- and FREEFUN the function to free them.
-
- Return nonzero if successful, calls obstack_alloc_failed_handler if
- allocation fails. */
-
-int
-_obstack_begin (struct obstack *h,
- int size, int alignment,
- void *(*chunkfun) (long),
- void (*freefun) (void *))
-{
- register struct _obstack_chunk *chunk; /* points to new chunk */
-
- if (alignment == 0)
- alignment = DEFAULT_ALIGNMENT;
- if (size == 0)
- /* Default size is what GNU malloc can fit in a 4096-byte block. */
- {
- /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc.
- Use the values for range checking, because if range checking is off,
- the extra bytes won't be missed terribly, but if range checking is on
- and we used a larger request, a whole extra 4096 bytes would be
- allocated.
-
- These number are irrelevant to the new GNU malloc. I suspect it is
- less sensitive to the size of the request. */
- int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1))
- + 4 + DEFAULT_ROUNDING - 1)
- & ~(DEFAULT_ROUNDING - 1));
- size = 4096 - extra;
- }
-
- h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;
- h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
- h->chunk_size = size;
- h->alignment_mask = alignment - 1;
- h->use_extra_arg = 0;
-
- chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
- if (!chunk)
- (*obstack_alloc_failed_handler) ();
- h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents,
- alignment - 1);
- h->chunk_limit = chunk->limit
- = (char *) chunk + h->chunk_size;
- chunk->prev = 0;
- /* The initial chunk now contains no empty object. */
- h->maybe_empty_object = 0;
- h->alloc_failed = 0;
- return 1;
-}
-
-int
-_obstack_begin_1 (struct obstack *h, int size, int alignment,
- void *(*chunkfun) (void *, long),
- void (*freefun) (void *, void *),
- void *arg)
-{
- register struct _obstack_chunk *chunk; /* points to new chunk */
-
- if (alignment == 0)
- alignment = DEFAULT_ALIGNMENT;
- if (size == 0)
- /* Default size is what GNU malloc can fit in a 4096-byte block. */
- {
- /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc.
- Use the values for range checking, because if range checking is off,
- the extra bytes won't be missed terribly, but if range checking is on
- and we used a larger request, a whole extra 4096 bytes would be
- allocated.
-
- These number are irrelevant to the new GNU malloc. I suspect it is
- less sensitive to the size of the request. */
- int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1))
- + 4 + DEFAULT_ROUNDING - 1)
- & ~(DEFAULT_ROUNDING - 1));
- size = 4096 - extra;
- }
-
- h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun;
- h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
- h->chunk_size = size;
- h->alignment_mask = alignment - 1;
- h->extra_arg = arg;
- h->use_extra_arg = 1;
-
- chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
- if (!chunk)
- (*obstack_alloc_failed_handler) ();
- h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents,
- alignment - 1);
- h->chunk_limit = chunk->limit
- = (char *) chunk + h->chunk_size;
- chunk->prev = 0;
- /* The initial chunk now contains no empty object. */
- h->maybe_empty_object = 0;
- h->alloc_failed = 0;
- return 1;
-}
-
-/* Allocate a new current chunk for the obstack *H
- on the assumption that LENGTH bytes need to be added
- to the current object, or a new object of length LENGTH allocated.
- Copies any partial object from the end of the old chunk
- to the beginning of the new one. */
-
-void
-_obstack_newchunk (struct obstack *h, int length)
-{
- register struct _obstack_chunk *old_chunk = h->chunk;
- register struct _obstack_chunk *new_chunk;
- register long new_size;
- register long obj_size = h->next_free - h->object_base;
- register long i;
- long already;
- char *object_base;
-
- /* Compute size for new chunk. */
- new_size = (obj_size + length) + (obj_size >> 3) + h->alignment_mask + 100;
- if (new_size < h->chunk_size)
- new_size = h->chunk_size;
-
- /* Allocate and initialize the new chunk. */
- new_chunk = CALL_CHUNKFUN (h, new_size);
- if (!new_chunk)
- (*obstack_alloc_failed_handler) ();
- h->chunk = new_chunk;
- new_chunk->prev = old_chunk;
- new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;
-
- /* Compute an aligned object_base in the new chunk */
- object_base =
- __PTR_ALIGN ((char *) new_chunk, new_chunk->contents, h->alignment_mask);
-
- /* Move the existing object to the new chunk.
- Word at a time is fast and is safe if the object
- is sufficiently aligned. */
- if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT)
- {
- for (i = obj_size / sizeof (COPYING_UNIT) - 1;
- i >= 0; i--)
- ((COPYING_UNIT *)object_base)[i]
- = ((COPYING_UNIT *)h->object_base)[i];
- /* We used to copy the odd few remaining bytes as one extra COPYING_UNIT,
- but that can cross a page boundary on a machine
- which does not do strict alignment for COPYING_UNITS. */
- already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT);
- }
- else
- already = 0;
- /* Copy remaining bytes one by one. */
- for (i = already; i < obj_size; i++)
- object_base[i] = h->object_base[i];
-
- /* If the object just copied was the only data in OLD_CHUNK,
- free that chunk and remove it from the chain.
- But not if that chunk might contain an empty object. */
- if (! h->maybe_empty_object
- && (h->object_base
- == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents,
- h->alignment_mask)))
- {
- new_chunk->prev = old_chunk->prev;
- CALL_FREEFUN (h, old_chunk);
- }
-
- h->object_base = object_base;
- h->next_free = h->object_base + obj_size;
- /* The new chunk certainly contains no empty object yet. */
- h->maybe_empty_object = 0;
-}
-# ifdef _LIBC
-libc_hidden_def (_obstack_newchunk)
-# endif
-
-/* Return nonzero if object OBJ has been allocated from obstack H.
- This is here for debugging.
- If you use it in a program, you are probably losing. */
-
-/* Suppress -Wmissing-prototypes warning. We don't want to declare this in
- obstack.h because it is just for debugging. */
-int _obstack_allocated_p (struct obstack *h, void *obj);
-
-int
-_obstack_allocated_p (struct obstack *h, void *obj)
-{
- register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
- register struct _obstack_chunk *plp; /* point to previous chunk if any */
-
- lp = (h)->chunk;
- /* We use >= rather than > since the object cannot be exactly at
- the beginning of the chunk but might be an empty object exactly
- at the end of an adjacent chunk. */
- while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj))
- {
- plp = lp->prev;
- lp = plp;
- }
- return lp != 0;
-}
-\f
-/* Free objects in obstack H, including OBJ and everything allocate
- more recently than OBJ. If OBJ is zero, free everything in H. */
-
-# undef obstack_free
-
-void
-obstack_free (struct obstack *h, void *obj)
-{
- register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
- register struct _obstack_chunk *plp; /* point to previous chunk if any */
-
- lp = h->chunk;
- /* We use >= because there cannot be an object at the beginning of a chunk.
- But there can be an empty object at that address
- at the end of another chunk. */
- while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj))
- {
- plp = lp->prev;
- CALL_FREEFUN (h, lp);
- lp = plp;
- /* If we switch chunks, we can't tell whether the new current
- chunk contains an empty object, so assume that it may. */
- h->maybe_empty_object = 1;
- }
- if (lp)
- {
- h->object_base = h->next_free = (char *) (obj);
- h->chunk_limit = lp->limit;
- h->chunk = lp;
- }
- else if (obj != 0)
- /* obj is not in any of the chunks! */
- abort ();
-}
-
-# ifdef _LIBC
-/* Older versions of libc used a function _obstack_free intended to be
- called by non-GCC compilers. */
-strong_alias (obstack_free, _obstack_free)
-# endif
-\f
-int
-_obstack_memory_used (struct obstack *h)
-{
- register struct _obstack_chunk* lp;
- register int nbytes = 0;
-
- for (lp = h->chunk; lp != 0; lp = lp->prev)
- {
- nbytes += lp->limit - (char *) lp;
- }
- return nbytes;
-}
-\f
-/* Define the error handler. */
-# ifdef _LIBC
-# include <libintl.h>
-# else
-# include "gettext.h"
-# endif
-# ifndef _
-# define _(msgid) gettext (msgid)
-# endif
-
-# ifdef _LIBC
-# include <libio/iolibio.h>
-# endif
-
-# ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-# define __attribute__(Spec) /* empty */
-# endif
-# endif
-
-static void
-__attribute__ ((noreturn))
-print_and_abort (void)
-{
- /* Don't change any of these strings. Yes, it would be possible to add
- the newline to the string and use fputs or so. But this must not
- happen because the "memory exhausted" message appears in other places
- like this and the translation should be reused instead of creating
- a very similar string which requires a separate translation. */
-# ifdef _LIBC
- (void) __fxprintf (NULL, "%s\n", _("memory exhausted"));
-# else
- fprintf (stderr, "%s\n", _("memory exhausted"));
-# endif
- exit (obstack_exit_failure);
-}
-
-#endif /* !ELIDE_CODE */
+++ /dev/null
-/* obstack.h - object stack macros
- Copyright (C) 1988-1994, 1996-1999, 2003-2005 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Summary:
-
-All the apparent functions defined here are macros. The idea
-is that you would use these pre-tested macros to solve a
-very specific set of problems, and they would run fast.
-Caution: no side-effects in arguments please!! They may be
-evaluated MANY times!!
-
-These macros operate a stack of objects. Each object starts life
-small, and may grow to maturity. (Consider building a word syllable
-by syllable.) An object can move while it is growing. Once it has
-been "finished" it never changes address again. So the "top of the
-stack" is typically an immature growing object, while the rest of the
-stack is of mature, fixed size and fixed address objects.
-
-These routines grab large chunks of memory, using a function you
-supply, called `obstack_chunk_alloc'. On occasion, they free chunks,
-by calling `obstack_chunk_free'. You must define them and declare
-them before using any obstack macros.
-
-Each independent stack is represented by a `struct obstack'.
-Each of the obstack macros expects a pointer to such a structure
-as the first argument.
-
-One motivation for this package is the problem of growing char strings
-in symbol tables. Unless you are "fascist pig with a read-only mind"
---Gosper's immortal quote from HAKMEM item 154, out of context--you
-would not like to put any arbitrary upper limit on the length of your
-symbols.
-
-In practice this often means you will build many short symbols and a
-few long symbols. At the time you are reading a symbol you don't know
-how long it is. One traditional method is to read a symbol into a
-buffer, realloc()ating the buffer every time you try to read a symbol
-that is longer than the buffer. This is beaut, but you still will
-want to copy the symbol from the buffer to a more permanent
-symbol-table entry say about half the time.
-
-With obstacks, you can work differently. Use one obstack for all symbol
-names. As you read a symbol, grow the name in the obstack gradually.
-When the name is complete, finalize it. Then, if the symbol exists already,
-free the newly read name.
-
-The way we do this is to take a large chunk, allocating memory from
-low addresses. When you want to build a symbol in the chunk you just
-add chars above the current "high water mark" in the chunk. When you
-have finished adding chars, because you got to the end of the symbol,
-you know how long the chars are, and you can create a new object.
-Mostly the chars will not burst over the highest address of the chunk,
-because you would typically expect a chunk to be (say) 100 times as
-long as an average object.
-
-In case that isn't clear, when we have enough chars to make up
-the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed)
-so we just point to it where it lies. No moving of chars is
-needed and this is the second win: potentially long strings need
-never be explicitly shuffled. Once an object is formed, it does not
-change its address during its lifetime.
-
-When the chars burst over a chunk boundary, we allocate a larger
-chunk, and then copy the partly formed object from the end of the old
-chunk to the beginning of the new larger chunk. We then carry on
-accreting characters to the end of the object as we normally would.
-
-A special macro is provided to add a single char at a time to a
-growing object. This allows the use of register variables, which
-break the ordinary 'growth' macro.
-
-Summary:
- We allocate large chunks.
- We carve out one object at a time from the current chunk.
- Once carved, an object never moves.
- We are free to append data of any size to the currently
- growing object.
- Exactly one object is growing in an obstack at any one time.
- You can run one obstack per control block.
- You may have as many control blocks as you dare.
- Because of the way we do it, you can `unwind' an obstack
- back to a previous state. (You may remove objects much
- as you would with a stack.)
-*/
-
-
-/* Don't do the contents of this file more than once. */
-
-#ifndef _OBSTACK_H
-#define _OBSTACK_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-\f
-/* We need the type of a pointer subtraction. If __PTRDIFF_TYPE__ is
- defined, as with GNU C, use that; that way we don't pollute the
- namespace with <stddef.h>'s symbols. Otherwise, include <stddef.h>
- and use ptrdiff_t. */
-
-#ifdef __PTRDIFF_TYPE__
-# define PTR_INT_TYPE __PTRDIFF_TYPE__
-#else
-# include <stddef.h>
-# define PTR_INT_TYPE ptrdiff_t
-#endif
-
-/* If B is the base of an object addressed by P, return the result of
- aligning P to the next multiple of A + 1. B and P must be of type
- char *. A + 1 must be a power of 2. */
-
-#define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A)))
-
-/* Similiar to _BPTR_ALIGN (B, P, A), except optimize the common case
- where pointers can be converted to integers, aligned as integers,
- and converted back again. If PTR_INT_TYPE is narrower than a
- pointer (e.g., the AS/400), play it safe and compute the alignment
- relative to B. Otherwise, use the faster strategy of computing the
- alignment relative to 0. */
-
-#define __PTR_ALIGN(B, P, A) \
- __BPTR_ALIGN (sizeof (PTR_INT_TYPE) < sizeof (void *) ? (B) : (char *) 0, \
- P, A)
-
-#include <string.h>
-
-struct _obstack_chunk /* Lives at front of each chunk. */
-{
- char *limit; /* 1 past end of this chunk */
- struct _obstack_chunk *prev; /* address of prior chunk or NULL */
- char contents[4]; /* objects begin here */
-};
-
-struct obstack /* control current object in current chunk */
-{
- long chunk_size; /* preferred size to allocate chunks in */
- struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */
- char *object_base; /* address of object we are building */
- char *next_free; /* where to add next char to current object */
- char *chunk_limit; /* address of char after current chunk */
- union
- {
- PTR_INT_TYPE tempint;
- void *tempptr;
- } temp; /* Temporary for some macros. */
- int alignment_mask; /* Mask of alignment for each object. */
- /* These prototypes vary based on `use_extra_arg', and we use
- casts to the prototypeless function type in all assignments,
- but having prototypes here quiets -Wstrict-prototypes. */
- struct _obstack_chunk *(*chunkfun) (void *, long);
- void (*freefun) (void *, struct _obstack_chunk *);
- void *extra_arg; /* first arg for chunk alloc/dealloc funcs */
- unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */
- unsigned maybe_empty_object:1;/* There is a possibility that the current
- chunk contains a zero-length object. This
- prevents freeing the chunk if we allocate
- a bigger chunk to replace it. */
- unsigned alloc_failed:1; /* No longer used, as we now call the failed
- handler on error, but retained for binary
- compatibility. */
-};
-
-/* Declare the external functions we use; they are in obstack.c. */
-
-extern void _obstack_newchunk (struct obstack *, int);
-extern int _obstack_begin (struct obstack *, int, int,
- void *(*) (long), void (*) (void *));
-extern int _obstack_begin_1 (struct obstack *, int, int,
- void *(*) (void *, long),
- void (*) (void *, void *), void *);
-extern int _obstack_memory_used (struct obstack *);
-
-void obstack_free (struct obstack *obstack, void *block);
-
-\f
-/* Error handler called when `obstack_chunk_alloc' failed to allocate
- more memory. This can be set to a user defined function which
- should either abort gracefully or use longjump - but shouldn't
- return. The default action is to print a message and abort. */
-extern DLL_VARIABLE void (*obstack_alloc_failed_handler) (void);
-
-/* Exit value used when `print_and_abort' is used. */
-extern DLL_VARIABLE int obstack_exit_failure;
-\f
-/* Pointer to beginning of object being allocated or to be allocated next.
- Note that this might not be the final address of the object
- because a new chunk might be needed to hold the final size. */
-
-#define obstack_base(h) ((void *) (h)->object_base)
-
-/* Size for allocating ordinary chunks. */
-
-#define obstack_chunk_size(h) ((h)->chunk_size)
-
-/* Pointer to next byte not yet allocated in current chunk. */
-
-#define obstack_next_free(h) ((h)->next_free)
-
-/* Mask specifying low bits that should be clear in address of an object. */
-
-#define obstack_alignment_mask(h) ((h)->alignment_mask)
-
-/* To prevent prototype warnings provide complete argument list. */
-#define obstack_init(h) \
- _obstack_begin ((h), 0, 0, \
- (void *(*) (long)) obstack_chunk_alloc, \
- (void (*) (void *)) obstack_chunk_free)
-
-#define obstack_begin(h, size) \
- _obstack_begin ((h), (size), 0, \
- (void *(*) (long)) obstack_chunk_alloc, \
- (void (*) (void *)) obstack_chunk_free)
-
-#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
- _obstack_begin ((h), (size), (alignment), \
- (void *(*) (long)) (chunkfun), \
- (void (*) (void *)) (freefun))
-
-#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
- _obstack_begin_1 ((h), (size), (alignment), \
- (void *(*) (void *, long)) (chunkfun), \
- (void (*) (void *, void *)) (freefun), (arg))
-
-#define obstack_chunkfun(h, newchunkfun) \
- ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun))
-
-#define obstack_freefun(h, newfreefun) \
- ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))
-
-#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar))
-
-#define obstack_blank_fast(h,n) ((h)->next_free += (n))
-
-#define obstack_memory_used(h) _obstack_memory_used (h)
-\f
-#if defined __GNUC__ && defined __STDC__ && __STDC__
-/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
- does not implement __extension__. But that compiler doesn't define
- __GNUC_MINOR__. */
-# if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__)
-# define __extension__
-# endif
-
-/* For GNU C, if not -traditional,
- we can define these macros to compute all args only once
- without using a global variable.
- Also, we can avoid using the `temp' slot, to make faster code. */
-
-# define obstack_object_size(OBSTACK) \
- __extension__ \
- ({ struct obstack const *__o = (OBSTACK); \
- (unsigned) (__o->next_free - __o->object_base); })
-
-# define obstack_room(OBSTACK) \
- __extension__ \
- ({ struct obstack const *__o = (OBSTACK); \
- (unsigned) (__o->chunk_limit - __o->next_free); })
-
-# define obstack_make_room(OBSTACK,length) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
- if (__o->chunk_limit - __o->next_free < __len) \
- _obstack_newchunk (__o, __len); \
- (void) 0; })
-
-# define obstack_empty_p(OBSTACK) \
- __extension__ \
- ({ struct obstack const *__o = (OBSTACK); \
- (__o->chunk->prev == 0 \
- && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \
- __o->chunk->contents, \
- __o->alignment_mask)); })
-
-# define obstack_grow(OBSTACK,where,length) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
- if (__o->next_free + __len > __o->chunk_limit) \
- _obstack_newchunk (__o, __len); \
- memcpy (__o->next_free, where, __len); \
- __o->next_free += __len; \
- (void) 0; })
-
-# define obstack_grow0(OBSTACK,where,length) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
- if (__o->next_free + __len + 1 > __o->chunk_limit) \
- _obstack_newchunk (__o, __len + 1); \
- memcpy (__o->next_free, where, __len); \
- __o->next_free += __len; \
- *(__o->next_free)++ = 0; \
- (void) 0; })
-
-# define obstack_1grow(OBSTACK,datum) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- if (__o->next_free + 1 > __o->chunk_limit) \
- _obstack_newchunk (__o, 1); \
- obstack_1grow_fast (__o, datum); \
- (void) 0; })
-
-/* These assume that the obstack alignment is good enough for pointers
- or ints, and that the data added so far to the current object
- shares that much alignment. */
-
-# define obstack_ptr_grow(OBSTACK,datum) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
- _obstack_newchunk (__o, sizeof (void *)); \
- obstack_ptr_grow_fast (__o, datum); }) \
-
-# define obstack_int_grow(OBSTACK,datum) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- if (__o->next_free + sizeof (int) > __o->chunk_limit) \
- _obstack_newchunk (__o, sizeof (int)); \
- obstack_int_grow_fast (__o, datum); })
-
-# define obstack_ptr_grow_fast(OBSTACK,aptr) \
-__extension__ \
-({ struct obstack *__o1 = (OBSTACK); \
- *(const void **) __o1->next_free = (aptr); \
- __o1->next_free += sizeof (const void *); \
- (void) 0; })
-
-# define obstack_int_grow_fast(OBSTACK,aint) \
-__extension__ \
-({ struct obstack *__o1 = (OBSTACK); \
- *(int *) __o1->next_free = (aint); \
- __o1->next_free += sizeof (int); \
- (void) 0; })
-
-# define obstack_blank(OBSTACK,length) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
- if (__o->chunk_limit - __o->next_free < __len) \
- _obstack_newchunk (__o, __len); \
- obstack_blank_fast (__o, __len); \
- (void) 0; })
-
-# define obstack_alloc(OBSTACK,length) \
-__extension__ \
-({ struct obstack *__h = (OBSTACK); \
- obstack_blank (__h, (length)); \
- obstack_finish (__h); })
-
-# define obstack_copy(OBSTACK,where,length) \
-__extension__ \
-({ struct obstack *__h = (OBSTACK); \
- obstack_grow (__h, (where), (length)); \
- obstack_finish (__h); })
-
-# define obstack_copy0(OBSTACK,where,length) \
-__extension__ \
-({ struct obstack *__h = (OBSTACK); \
- obstack_grow0 (__h, (where), (length)); \
- obstack_finish (__h); })
-
-/* The local variable is named __o1 to avoid a name conflict
- when obstack_blank is called. */
-# define obstack_finish(OBSTACK) \
-__extension__ \
-({ struct obstack *__o1 = (OBSTACK); \
- void *__value = (void *) __o1->object_base; \
- if (__o1->next_free == __value) \
- __o1->maybe_empty_object = 1; \
- __o1->next_free \
- = __PTR_ALIGN (__o1->object_base, __o1->next_free, \
- __o1->alignment_mask); \
- if (__o1->next_free - (char *)__o1->chunk \
- > __o1->chunk_limit - (char *)__o1->chunk) \
- __o1->next_free = __o1->chunk_limit; \
- __o1->object_base = __o1->next_free; \
- __value; })
-
-# define obstack_free(OBSTACK, OBJ) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- void *__obj = (OBJ); \
- if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \
- __o->next_free = __o->object_base = (char *)__obj; \
- else (obstack_free) (__o, __obj); })
-\f
-#else /* not __GNUC__ or not __STDC__ */
-
-# define obstack_object_size(h) \
- (unsigned) ((h)->next_free - (h)->object_base)
-
-# define obstack_room(h) \
- (unsigned) ((h)->chunk_limit - (h)->next_free)
-
-# define obstack_empty_p(h) \
- ((h)->chunk->prev == 0 \
- && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \
- (h)->chunk->contents, \
- (h)->alignment_mask))
-
-/* Note that the call to _obstack_newchunk is enclosed in (..., 0)
- so that we can avoid having void expressions
- in the arms of the conditional expression.
- Casting the third operand to void was tried before,
- but some compilers won't accept it. */
-
-# define obstack_make_room(h,length) \
-( (h)->temp.tempint = (length), \
- (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0))
-
-# define obstack_grow(h,where,length) \
-( (h)->temp.tempint = (length), \
- (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \
- memcpy ((h)->next_free, where, (h)->temp.tempint), \
- (h)->next_free += (h)->temp.tempint)
-
-# define obstack_grow0(h,where,length) \
-( (h)->temp.tempint = (length), \
- (((h)->next_free + (h)->temp.tempint + 1 > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), (h)->temp.tempint + 1), 0) : 0), \
- memcpy ((h)->next_free, where, (h)->temp.tempint), \
- (h)->next_free += (h)->temp.tempint, \
- *((h)->next_free)++ = 0)
-
-# define obstack_1grow(h,datum) \
-( (((h)->next_free + 1 > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), 1), 0) : 0), \
- obstack_1grow_fast (h, datum))
-
-# define obstack_ptr_grow(h,datum) \
-( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \
- obstack_ptr_grow_fast (h, datum))
-
-# define obstack_int_grow(h,datum) \
-( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \
- obstack_int_grow_fast (h, datum))
-
-# define obstack_ptr_grow_fast(h,aptr) \
- (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr))
-
-# define obstack_int_grow_fast(h,aint) \
- (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint))
-
-# define obstack_blank(h,length) \
-( (h)->temp.tempint = (length), \
- (((h)->chunk_limit - (h)->next_free < (h)->temp.tempint) \
- ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \
- obstack_blank_fast (h, (h)->temp.tempint))
-
-# define obstack_alloc(h,length) \
- (obstack_blank ((h), (length)), obstack_finish ((h)))
-
-# define obstack_copy(h,where,length) \
- (obstack_grow ((h), (where), (length)), obstack_finish ((h)))
-
-# define obstack_copy0(h,where,length) \
- (obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
-
-# define obstack_finish(h) \
-( ((h)->next_free == (h)->object_base \
- ? (((h)->maybe_empty_object = 1), 0) \
- : 0), \
- (h)->temp.tempptr = (h)->object_base, \
- (h)->next_free \
- = __PTR_ALIGN ((h)->object_base, (h)->next_free, \
- (h)->alignment_mask), \
- (((h)->next_free - (char *) (h)->chunk \
- > (h)->chunk_limit - (char *) (h)->chunk) \
- ? ((h)->next_free = (h)->chunk_limit) : 0), \
- (h)->object_base = (h)->next_free, \
- (h)->temp.tempptr)
-
-# define obstack_free(h,obj) \
-( (h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \
- ((((h)->temp.tempint > 0 \
- && (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \
- ? (int) ((h)->next_free = (h)->object_base \
- = (h)->temp.tempint + (char *) (h)->chunk) \
- : (((obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0)))
-
-#endif /* not __GNUC__ or not __STDC__ */
-
-#ifdef __cplusplus
-} /* C++ */
-#endif
-
-#endif /* obstack.h */
+++ /dev/null
-/* Define PATH_MAX somehow. Requires sys/types.h.
- Copyright (C) 1992, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _PATHMAX_H
-# define _PATHMAX_H
-
-# include <unistd.h>
-
-# include <limits.h>
-
-# ifndef _POSIX_PATH_MAX
-# define _POSIX_PATH_MAX 256
-# endif
-
-# if !defined PATH_MAX && defined _PC_PATH_MAX
-# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 \
- : pathconf ("/", _PC_PATH_MAX))
-# endif
-
-/* Don't include sys/param.h if it already has been. */
-# if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
-# include <sys/param.h>
-# endif
-
-# if !defined PATH_MAX && defined MAXPATHLEN
-# define PATH_MAX MAXPATHLEN
-# endif
-
-# ifndef PATH_MAX
-# define PATH_MAX _POSIX_PATH_MAX
-# endif
-
-#endif /* _PATHMAX_H */
+++ /dev/null
-/* Pathname support.
- Copyright (C) 2001-2004 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _PATHNAME_H
-#define _PATHNAME_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Pathname support.
- ISSLASH(C) tests whether C is a directory separator character.
- IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
- it may be concatenated to a directory pathname.
- 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 */
-# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-# define HAS_DEVICE(P) \
- ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
- && (P)[1] == ':')
-# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
-# define IS_PATH_WITH_DIR(P) \
- (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
-# define FILE_SYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
-#else
- /* Unix */
-# define ISSLASH(C) ((C) == '/')
-# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
-# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
-# define FILE_SYSTEM_PREFIX_LEN(P) 0
-#endif
-
-/* Concatenate a directory pathname, a relative pathname and an optional
- suffix. Return a freshly allocated pathname. */
-extern char *concatenated_pathname (const char *directory,
- const char *filename, const char *suffix);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PATHNAME_H */
+++ /dev/null
-/* Creation of subprocesses, communicating via pipes.
- Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "pipe.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include "error.h"
-#include "exit.h"
-#include "fatal-signal.h"
-#include "wait-process.h"
-#include "gettext.h"
-
-#define _(str) gettext (str)
-
-#if defined _MSC_VER || defined __MINGW32__
-
-/* Native Woe32 API. */
-# include <process.h>
-# include "w32spawn.h"
-
-#else
-
-/* Unix API. */
-# ifdef HAVE_POSIX_SPAWN
-# include <spawn.h>
-# else
-# ifdef HAVE_VFORK_H
-# include <vfork.h>
-# endif
-# endif
-
-#endif
-
-#ifndef HAVE_ENVIRON_DECL
-extern char **environ;
-#endif
-
-#ifndef STDIN_FILENO
-# define STDIN_FILENO 0
-#endif
-#ifndef STDOUT_FILENO
-# define STDOUT_FILENO 1
-#endif
-#ifndef STDERR_FILENO
-# define STDERR_FILENO 2
-#endif
-
-
-#ifdef EINTR
-
-/* EINTR handling for close().
- These functions can return -1/EINTR even though we don't have any
- signal handlers set up, namely when we get interrupted via SIGSTOP. */
-
-static inline int
-nonintr_close (int fd)
-{
- int retval;
-
- do
- retval = close (fd);
- while (retval < 0 && errno == EINTR);
-
- return retval;
-}
-#define close nonintr_close
-
-static inline int
-nonintr_open (const char *pathname, int oflag, mode_t mode)
-{
- int retval;
-
- do
- retval = open (pathname, oflag, mode);
- while (retval < 0 && errno == EINTR);
-
- return retval;
-}
-#undef open /* avoid warning on VMS */
-#define open nonintr_open
-
-#endif
-
-
-/* Open a pipe connected to a child process.
- *
- * write system read
- * parent -> fd[1] -> STDIN_FILENO -> child if pipe_stdin
- * parent <- fd[0] <- STDOUT_FILENO <- child if pipe_stdout
- * read system write
- *
- * At least one of pipe_stdin, pipe_stdout must be true.
- * pipe_stdin and prog_stdin together determine the child's standard input.
- * pipe_stdout and prog_stdout together determine the child's standard output.
- * If pipe_stdin is true, prog_stdin is ignored.
- * If pipe_stdout is true, prog_stdout is ignored.
- */
-static pid_t
-create_pipe (const char *progname,
- const char *prog_path, char **prog_argv,
- bool pipe_stdin, bool pipe_stdout,
- const char *prog_stdin, const char *prog_stdout,
- bool null_stderr,
- bool slave_process, bool exit_on_error,
- int fd[2])
-{
-#if defined _MSC_VER || defined __MINGW32__
-
- /* Native Woe32 API.
- This uses _pipe(), dup2(), and spawnv(). It could also be implemented
- using the low-level functions CreatePipe(), DuplicateHandle(),
- CreateProcess() and _open_osfhandle(); see the GNU make and GNU clisp
- and cvs source code. */
- int ifd[2];
- int ofd[2];
- int orig_stdin;
- int orig_stdout;
- int orig_stderr;
- int child;
- int nulloutfd;
- int stdinfd;
- int stdoutfd;
-
- prog_argv = prepare_spawn (prog_argv);
-
- if (pipe_stdout)
- if (_pipe (ifd, 4096, O_BINARY | O_NOINHERIT) < 0)
- error (EXIT_FAILURE, errno, _("cannot create pipe"));
- if (pipe_stdin)
- if (_pipe (ofd, 4096, O_BINARY | O_NOINHERIT) < 0)
- error (EXIT_FAILURE, errno, _("cannot create pipe"));
-/* Data flow diagram:
- *
- * write system read
- * parent -> ofd[1] -> ofd[0] -> child if pipe_stdin
- * parent <- ifd[0] <- ifd[1] <- child if pipe_stdout
- * read system write
- *
- */
-
- /* Save standard file handles of parent process. */
- if (pipe_stdin || prog_stdin != NULL)
- orig_stdin = dup_noinherit (STDIN_FILENO);
- if (pipe_stdout || prog_stdout != NULL)
- orig_stdout = dup_noinherit (STDOUT_FILENO);
- if (null_stderr)
- orig_stderr = dup_noinherit (STDERR_FILENO);
- child = -1;
-
- /* Create standard file handles of child process. */
- nulloutfd = -1;
- stdinfd = -1;
- stdoutfd = -1;
- if ((!pipe_stdin || dup2 (ofd[0], STDIN_FILENO) >= 0)
- && (!pipe_stdout || dup2 (ifd[1], STDOUT_FILENO) >= 0)
- && (!null_stderr
- || ((nulloutfd = open ("NUL", O_RDWR, 0)) >= 0
- && (nulloutfd == STDERR_FILENO
- || (dup2 (nulloutfd, STDERR_FILENO) >= 0
- && close (nulloutfd) >= 0))))
- && (pipe_stdin
- || prog_stdin == NULL
- || ((stdinfd = open (prog_stdin, O_RDONLY, 0)) >= 0
- && (stdinfd == STDIN_FILENO
- || (dup2 (stdinfd, STDIN_FILENO) >= 0
- && close (stdinfd) >= 0))))
- && (pipe_stdout
- || prog_stdout == NULL
- || ((stdoutfd = open (prog_stdout, O_WRONLY, 0)) >= 0
- && (stdoutfd == STDOUT_FILENO
- || (dup2 (stdoutfd, STDOUT_FILENO) >= 0
- && close (stdoutfd) >= 0)))))
- /* The child process doesn't inherit ifd[0], ifd[1], ofd[0], ofd[1],
- but it inherits all open()ed or dup2()ed file handles (which is what
- we want in the case of STD*_FILENO) and also orig_stdin,
- orig_stdout, orig_stderr (which is not explicitly wanted but
- harmless). */
- child = spawnvp (P_NOWAIT, prog_path, prog_argv);
- if (stdinfd >= 0)
- close (stdinfd);
- if (stdoutfd >= 0)
- close (stdoutfd);
- if (nulloutfd >= 0)
- close (nulloutfd);
-
- /* Restore standard file handles of parent process. */
- if (null_stderr)
- dup2 (orig_stderr, STDERR_FILENO), close (orig_stderr);
- if (pipe_stdout || prog_stdout != NULL)
- dup2 (orig_stdout, STDOUT_FILENO), close (orig_stdout);
- if (pipe_stdin || prog_stdin != NULL)
- dup2 (orig_stdin, STDIN_FILENO), close (orig_stdin);
-
- if (pipe_stdin)
- close (ofd[0]);
- if (pipe_stdout)
- close (ifd[1]);
- if (child == -1)
- {
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, errno,
- _("%s subprocess failed"), progname);
- if (pipe_stdout)
- close (ifd[0]);
- if (pipe_stdin)
- close (ofd[1]);
- return -1;
- }
-
- if (pipe_stdout)
- fd[0] = ifd[0];
- if (pipe_stdin)
- fd[1] = ofd[1];
- return child;
-
-#else
-
- /* Unix API. */
- int ifd[2];
- int ofd[2];
-# if HAVE_POSIX_SPAWN
- sigset_t blocked_signals;
- posix_spawn_file_actions_t actions;
- bool actions_allocated;
- posix_spawnattr_t attrs;
- bool attrs_allocated;
- int err;
- pid_t child;
-# else
- int child;
-# endif
-
- if (pipe_stdout)
- if (pipe (ifd) < 0)
- error (EXIT_FAILURE, errno, _("cannot create pipe"));
- if (pipe_stdin)
- if (pipe (ofd) < 0)
- error (EXIT_FAILURE, errno, _("cannot create pipe"));
-/* Data flow diagram:
- *
- * write system read
- * parent -> ofd[1] -> ofd[0] -> child if pipe_stdin
- * parent <- ifd[0] <- ifd[1] <- child if pipe_stdout
- * read system write
- *
- */
-
-# if HAVE_POSIX_SPAWN
- if (slave_process)
- {
- sigprocmask (SIG_SETMASK, NULL, &blocked_signals);
- block_fatal_signals ();
- }
- actions_allocated = false;
- attrs_allocated = false;
- if ((err = posix_spawn_file_actions_init (&actions)) != 0
- || (actions_allocated = true,
- (pipe_stdin
- && (err = posix_spawn_file_actions_adddup2 (&actions,
- ofd[0], STDIN_FILENO))
- != 0)
- || (pipe_stdout
- && (err = posix_spawn_file_actions_adddup2 (&actions,
- ifd[1], STDOUT_FILENO))
- != 0)
- || (pipe_stdin
- && (err = posix_spawn_file_actions_addclose (&actions, ofd[0]))
- != 0)
- || (pipe_stdout
- && (err = posix_spawn_file_actions_addclose (&actions, ifd[1]))
- != 0)
- || (pipe_stdin
- && (err = posix_spawn_file_actions_addclose (&actions, ofd[1]))
- != 0)
- || (pipe_stdout
- && (err = posix_spawn_file_actions_addclose (&actions, ifd[0]))
- != 0)
- || (null_stderr
- && (err = posix_spawn_file_actions_addopen (&actions,
- STDERR_FILENO,
- "/dev/null", O_RDWR,
- 0))
- != 0)
- || (!pipe_stdin
- && prog_stdin != NULL
- && (err = posix_spawn_file_actions_addopen (&actions,
- STDIN_FILENO,
- prog_stdin, O_RDONLY,
- 0))
- != 0)
- || (!pipe_stdout
- && prog_stdout != NULL
- && (err = posix_spawn_file_actions_addopen (&actions,
- STDOUT_FILENO,
- prog_stdout, O_WRONLY,
- 0))
- != 0)
- || (slave_process
- && ((err = posix_spawnattr_init (&attrs)) != 0
- || (attrs_allocated = true,
- (err = posix_spawnattr_setsigmask (&attrs,
- &blocked_signals))
- != 0
- || (err = posix_spawnattr_setflags (&attrs,
- POSIX_SPAWN_SETSIGMASK))
- != 0)))
- || (err = posix_spawnp (&child, prog_path, &actions,
- attrs_allocated ? &attrs : NULL, prog_argv,
- environ))
- != 0))
- {
- if (actions_allocated)
- posix_spawn_file_actions_destroy (&actions);
- if (attrs_allocated)
- posix_spawnattr_destroy (&attrs);
- if (slave_process)
- unblock_fatal_signals ();
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, err,
- _("%s subprocess failed"), progname);
- if (pipe_stdout)
- {
- close (ifd[0]);
- close (ifd[1]);
- }
- if (pipe_stdin)
- {
- close (ofd[0]);
- close (ofd[1]);
- }
- return -1;
- }
- posix_spawn_file_actions_destroy (&actions);
- if (attrs_allocated)
- posix_spawnattr_destroy (&attrs);
-# else
- if (slave_process)
- block_fatal_signals ();
- /* Use vfork() instead of fork() for efficiency. */
- if ((child = vfork ()) == 0)
- {
- /* Child process code. */
- int nulloutfd;
- int stdinfd;
- int stdoutfd;
-
- if ((!pipe_stdin || dup2 (ofd[0], STDIN_FILENO) >= 0)
- && (!pipe_stdout || dup2 (ifd[1], STDOUT_FILENO) >= 0)
- && (!pipe_stdin || close (ofd[0]) >= 0)
- && (!pipe_stdout || close (ifd[1]) >= 0)
- && (!pipe_stdin || close (ofd[1]) >= 0)
- && (!pipe_stdout || close (ifd[0]) >= 0)
- && (!null_stderr
- || ((nulloutfd = open ("/dev/null", O_RDWR, 0)) >= 0
- && (nulloutfd == STDERR_FILENO
- || (dup2 (nulloutfd, STDERR_FILENO) >= 0
- && close (nulloutfd) >= 0))))
- && (pipe_stdin
- || prog_stdin == NULL
- || ((stdinfd = open (prog_stdin, O_RDONLY, 0)) >= 0
- && (stdinfd == STDIN_FILENO
- || (dup2 (stdinfd, STDIN_FILENO) >= 0
- && close (stdinfd) >= 0))))
- && (pipe_stdout
- || prog_stdout == NULL
- || ((stdoutfd = open (prog_stdout, O_WRONLY, 0)) >= 0
- && (stdoutfd == STDOUT_FILENO
- || (dup2 (stdoutfd, STDOUT_FILENO) >= 0
- && close (stdoutfd) >= 0))))
- && (!slave_process || (unblock_fatal_signals (), true)))
- execvp (prog_path, prog_argv);
- _exit (127);
- }
- if (child == -1)
- {
- if (slave_process)
- unblock_fatal_signals ();
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, errno,
- _("%s subprocess failed"), progname);
- if (pipe_stdout)
- {
- close (ifd[0]);
- close (ifd[1]);
- }
- if (pipe_stdin)
- {
- close (ofd[0]);
- close (ofd[1]);
- }
- return -1;
- }
-# endif
- if (slave_process)
- {
- register_slave_subprocess (child);
- unblock_fatal_signals ();
- }
- if (pipe_stdin)
- close (ofd[0]);
- if (pipe_stdout)
- close (ifd[1]);
-
- if (pipe_stdout)
- fd[0] = ifd[0];
- if (pipe_stdin)
- fd[1] = ofd[1];
- return child;
-
-#endif
-}
-
-/* Open a bidirectional pipe.
- *
- * write system read
- * parent -> fd[1] -> STDIN_FILENO -> child
- * parent <- fd[0] <- STDOUT_FILENO <- child
- * read system write
- *
- */
-pid_t
-create_pipe_bidi (const char *progname,
- const char *prog_path, char **prog_argv,
- bool null_stderr,
- bool slave_process, bool exit_on_error,
- int fd[2])
-{
- pid_t result = create_pipe (progname, prog_path, prog_argv,
- true, true, NULL, NULL,
- null_stderr, slave_process, exit_on_error,
- fd);
- return result;
-}
-
-/* Open a pipe for input from a child process.
- * The child's stdin comes from a file.
- *
- * read system write
- * parent <- fd[0] <- STDOUT_FILENO <- child
- *
- */
-pid_t
-create_pipe_in (const char *progname,
- const char *prog_path, char **prog_argv,
- const char *prog_stdin, bool null_stderr,
- bool slave_process, bool exit_on_error,
- int fd[1])
-{
- int iofd[2];
- pid_t result = create_pipe (progname, prog_path, prog_argv,
- false, true, prog_stdin, NULL,
- null_stderr, slave_process, exit_on_error,
- iofd);
- if (result != -1)
- fd[0] = iofd[0];
- return result;
-}
-
-/* Open a pipe for output to a child process.
- * The child's stdout goes to a file.
- *
- * write system read
- * parent -> fd[0] -> STDIN_FILENO -> child
- *
- */
-pid_t
-create_pipe_out (const char *progname,
- const char *prog_path, char **prog_argv,
- const char *prog_stdout, bool null_stderr,
- bool slave_process, bool exit_on_error,
- int fd[1])
-{
- int iofd[2];
- pid_t result = create_pipe (progname, prog_path, prog_argv,
- true, false, NULL, prog_stdout,
- null_stderr, slave_process, exit_on_error,
- iofd);
- if (result != -1)
- fd[0] = iofd[1];
- return result;
-}
+++ /dev/null
-/* Creation of subprocesses, communicating via pipes.
- Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _PIPE_H
-#define _PIPE_H
-
-/* Get pid_t. */
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-#include <stdbool.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* All these functions create a subprocess and don't wait for its termination.
- They return the process id of the subprocess. They also return in fd[]
- one or two file descriptors for communication with the subprocess.
- If the subprocess creation fails: if exit_on_error is true, the main
- process exits with an error message; otherwise, an error message is given
- if null_stderr is false, then -1 is returned and fd[] remain uninitialized.
-
- After finishing communication, the caller should call wait_subprocess()
- to get rid of the subprocess in the process table.
-
- If slave_process is true, the child process will be terminated when its
- creator receives a catchable fatal signal or exits normally. If
- slave_process is false, the child process will continue running in this
- case, until it is lucky enough to attempt to communicate with its creator
- and thus get a SIGPIPE signal.
-
- If exit_on_error is false, a child process id of -1 should be treated the
- same way as a subprocess which accepts no input, produces no output and
- terminates with exit code 127. Why? Some errors during posix_spawnp()
- cause the function posix_spawnp() to return an error code; some other
- errors cause the subprocess to exit with return code 127. It is
- implementation dependent which error is reported which way. The caller
- must treat both cases as equivalent.
-
- It is recommended that no signal is blocked or ignored (i.e. have a
- signal handler with value SIG_IGN) while any of these functions is called.
- The reason is that child processes inherit the mask of blocked signals
- from their parent (both through posix_spawn() and fork()/exec());
- likewise, signals ignored in the parent are also ignored in the child
- (except possibly for SIGCHLD). And POSIX:2001 says [in the description
- of exec()]:
- "it should be noted that many existing applications wrongly
- assume that they start with certain signals set to the default
- action and/or unblocked. In particular, applications written
- with a simpler signal model that does not include blocking of
- signals, such as the one in the ISO C standard, may not behave
- properly if invoked with some signals blocked. Therefore, it is
- best not to block or ignore signals across execs without explicit
- reason to do so, and especially not to block signals across execs
- of arbitrary (not closely co-operating) programs." */
-
-/* Open a pipe for output to a child process.
- * The child's stdout goes to a file.
- *
- * write system read
- * parent -> fd[0] -> STDIN_FILENO -> child
- *
- */
-extern pid_t create_pipe_out (const char *progname,
- const char *prog_path, char **prog_argv,
- const char *prog_stdout, bool null_stderr,
- bool slave_process, bool exit_on_error,
- int fd[1]);
-
-/* Open a pipe for input from a child process.
- * The child's stdin comes from a file.
- *
- * read system write
- * parent <- fd[0] <- STDOUT_FILENO <- child
- *
- */
-extern pid_t create_pipe_in (const char *progname,
- const char *prog_path, char **prog_argv,
- const char *prog_stdin, bool null_stderr,
- bool slave_process, bool exit_on_error,
- int fd[1]);
-
-/* Open a bidirectional pipe.
- *
- * write system read
- * parent -> fd[1] -> STDIN_FILENO -> child
- * parent <- fd[0] <- STDOUT_FILENO <- child
- * read system write
- *
- */
-extern pid_t create_pipe_bidi (const char *progname,
- const char *prog_path, char **prog_argv,
- bool null_stderr,
- bool slave_process, bool exit_on_error,
- int fd[2]);
-
-/* The name of the "always silent" device. */
-#if defined _MSC_VER || defined __MINGW32__
-/* Native Woe32 API. */
-# define DEV_NULL "NUL"
-#else
-/* Unix API. */
-# define DEV_NULL "/dev/null"
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _PIPE_H */
+++ /dev/null
-/* Program name management.
- Copyright (C) 2001-2003, 2005 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "progname.h"
-
-#include <string.h>
-
-#undef set_program_name
-
-
-/* String containing name the program is called with.
- To be initialized by main(). */
-const char *program_name = NULL;
-
-/* Set program_name, based on argv[0]. */
-void
-set_program_name (const char *argv0)
-{
- /* libtool creates a temporary executable whose name is sometimes prefixed
- with "lt-" (depends on the platform). It also makes argv[0] absolute.
- Remove this "<dirname>/.libs/" or "<dirname>/.libs/lt-" prefix here. */
- const char *slash;
- const char *base;
-
- slash = strrchr (argv0, '/');
- base = (slash != NULL ? slash + 1 : argv0);
- if (base - argv0 >= 7 && memcmp (base - 7, "/.libs/", 7) == 0)
- argv0 = base;
- if (strncmp (base, "lt-", 3) == 0)
- argv0 = base + 3;
- program_name = argv0;
-}
+++ /dev/null
-/* Program name management.
- Copyright (C) 2001-2004 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _PROGNAME_H
-#define _PROGNAME_H
-
-/* Programs using this file should do the following in main():
- set_program_name (argv[0]);
- */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* String containing name the program is called with. */
-extern DLL_VARIABLE const char *program_name;
-
-/* Set program_name, based on argv[0]. */
-extern void set_program_name (const char *argv0);
-
-#if ENABLE_RELOCATABLE
-
-/* Set program_name, based on argv[0], and original installation prefix and
- directory, for relocatability. */
-extern void set_program_name_and_installdir (const char *argv0,
- const char *orig_installprefix,
- const char *orig_installdir);
-#define set_program_name(ARG0) \
- set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR)
-
-/* Return the full pathname of the current executable, based on the earlier
- call to set_program_name_and_installdir. Return NULL if unknown. */
-extern char *get_full_program_name (void);
-
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _PROGNAME_H */
+++ /dev/null
-/* Provide relocatable programs.
- Copyright (C) 2003-2006 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published
- by the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA. */
-
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "progname.h"
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#include <sys/stat.h>
-
-/* Get declaration of _NSGetExecutablePath on MacOS X 10.2 or newer. */
-#if HAVE_MACH_O_DYLD_H
-# include <mach-o/dyld.h>
-#endif
-
-#if defined _WIN32 || defined __WIN32__
-# define WIN32_NATIVE
-#endif
-
-#if defined WIN32_NATIVE || defined __CYGWIN__
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-#endif
-
-#include "xreadlink.h"
-#include "canonicalize.h"
-#include "relocatable.h"
-
-#ifdef NO_XMALLOC
-# define xmalloc malloc
-# define xstrdup strdup
-#else
-# include "xalloc.h"
-#endif
-
-/* Pathname support.
- 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 */
-# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-# define HAS_DEVICE(P) \
- ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
- && (P)[1] == ':')
-# define IS_PATH_WITH_DIR(P) \
- (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
-# define FILE_SYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
-#else
- /* Unix */
-# define ISSLASH(C) ((C) == '/')
-# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
-# define FILE_SYSTEM_PREFIX_LEN(P) 0
-#endif
-
-#undef set_program_name
-
-
-#if ENABLE_RELOCATABLE
-
-#ifdef __linux__
-/* File descriptor of the executable.
- (Only used to verify that we find the correct executable.) */
-static int executable_fd = -1;
-#endif
-
-/* Tests whether a given pathname may belong to the executable. */
-static bool
-maybe_executable (const char *filename)
-{
- /* Woe32 lacks the access() function, but Cygwin doesn't. */
-#if !(defined WIN32_NATIVE && !defined __CYGWIN__)
- if (access (filename, X_OK) < 0)
- return false;
-
-#ifdef __linux__
- if (executable_fd >= 0)
- {
- /* If we already have an executable_fd, check that filename points to
- the same inode. */
- struct stat statexe;
- struct stat statfile;
-
- if (fstat (executable_fd, &statexe) >= 0)
- {
- if (stat (filename, &statfile) < 0)
- return false;
- if (!(statfile.st_dev
- && statfile.st_dev == statexe.st_dev
- && statfile.st_ino == statexe.st_ino))
- return false;
- }
- }
-#endif
-#endif
-
- return true;
-}
-
-/* Determine the full pathname of the current executable, freshly allocated.
- Return NULL if unknown.
- Guaranteed to work on Linux and Woe32. Likely to work on the other
- Unixes (maybe except BeOS), under most conditions. */
-static char *
-find_executable (const char *argv0)
-{
-#if defined WIN32_NATIVE || defined __CYGWIN__
- char location[MAX_PATH];
- int length = GetModuleFileName (NULL, location, sizeof (location));
- if (length < 0)
- return NULL;
- 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__
- /* 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,
- enclosed in brackets, which we cannot use here. */
- {
- char *link;
-
- link = xreadlink ("/proc/self/exe");
- if (link != NULL && link[0] != '[')
- return link;
- if (executable_fd < 0)
- executable_fd = open ("/proc/self/exe", O_RDONLY, 0);
-
- {
- char buf[6+10+5];
- sprintf (buf, "/proc/%d/exe", getpid ());
- link = xreadlink (buf);
- if (link != NULL && link[0] != '[')
- return link;
- if (executable_fd < 0)
- executable_fd = open (buf, O_RDONLY, 0);
- }
- }
-#endif
-#if HAVE_MACH_O_DYLD_H && HAVE__NSGETEXECUTABLEPATH
- /* On MacOS X 10.2 or newer, the function
- int _NSGetExecutablePath (char *buf, unsigned long *bufsize);
- can be used to retrieve the executable's full path. */
- char location[4096];
- unsigned long length = sizeof (location);
- if (_NSGetExecutablePath (location, &length) == 0
- && location[0] == '/')
- return canonicalize_file_name (location);
-#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. */
- {
- bool has_slash = false;
- {
- const char *p;
- for (p = argv0; *p; p++)
- if (*p == '/')
- {
- has_slash = true;
- break;
- }
- }
- if (!has_slash)
- {
- /* exec searches paths without slashes in the directory list given
- by $PATH. */
- const char *path = getenv ("PATH");
-
- if (path != NULL)
- {
- const char *p;
- const char *p_next;
-
- for (p = path; *p; p = p_next)
- {
- const char *q;
- size_t p_len;
- char *concat_name;
-
- for (q = p; *q; q++)
- if (*q == ':')
- break;
- p_len = q - p;
- p_next = (*q == '\0' ? q : q + 1);
-
- /* 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
- if (concat_name == NULL)
- return NULL;
-#endif
- if (p_len == 0)
- /* An empty PATH element designates the current directory. */
- strcpy (concat_name, argv0);
- else
- {
- memcpy (concat_name, p, p_len);
- concat_name[p_len] = '/';
- strcpy (concat_name + p_len + 1, argv0);
- }
- if (maybe_executable (concat_name))
- return canonicalize_file_name (concat_name);
- free (concat_name);
- }
- }
- /* Not found in the PATH, assume the current directory. */
- }
- /* exec treats paths containing slashes as relative to the current
- directory. */
- if (maybe_executable (argv0))
- return canonicalize_file_name (argv0);
- }
- /* No way to find the executable. */
- return NULL;
-#endif
-}
-
-/* Full pathname of executable, or NULL. */
-static char *executable_fullname;
-
-static void
-prepare_relocate (const char *orig_installprefix, const char *orig_installdir,
- const char *argv0)
-{
- const char *curr_prefix;
-
- /* Determine the full pathname of the current executable. */
- executable_fullname = find_executable (argv0);
-
- /* Determine the current installation prefix from it. */
- curr_prefix = compute_curr_prefix (orig_installprefix, orig_installdir,
- executable_fullname);
- if (curr_prefix != NULL)
- /* Now pass this prefix to all copies of the relocate.c source file. */
- set_relocation_prefix (orig_installprefix, curr_prefix);
-}
-
-/* Set program_name, based on argv[0], and original installation prefix and
- directory, for relocatability. */
-void
-set_program_name_and_installdir (const char *argv0,
- const char *orig_installprefix,
- const char *orig_installdir)
-{
- const char *argv0_stripped = argv0;
-
- /* Relocatable programs are renamed to .bin by install-reloc. Or, more
- generally, their suffix is changed from $exeext to .bin$exeext.
- Remove the ".bin" here. */
- {
- size_t argv0_len = strlen (argv0);
- const size_t exeext_len = sizeof (EXEEXT) - sizeof ("");
- if (argv0_len > 4 + exeext_len)
- if (memcmp (argv0 + argv0_len - exeext_len - 4, ".bin", 4) == 0)
- {
- if (sizeof (EXEEXT) > sizeof (""))
- {
- /* Compare using an inlined copy of c_strncasecmp(), because
- the filenames may have undergone a case conversion since
- they were packaged. In other words, EXEEXT may be ".exe"
- on one system and ".EXE" on another. */
- static const char exeext[] = EXEEXT;
- const char *s1 = argv0 + argv0_len - exeext_len;
- const char *s2 = exeext;
- for (; *s1 != '\0'; s1++, s2++)
- {
- unsigned char c1 = *s1;
- unsigned char c2 = *s2;
- if ((c1 >= 'A' && c1 <= 'Z' ? c1 - 'A' + 'a' : c1)
- != (c2 >= 'A' && c2 <= 'Z' ? c2 - 'A' + 'a' : c2))
- goto done_stripping;
- }
- }
- /* Remove ".bin" before EXEEXT or its equivalent. */
- {
- char *shorter = (char *) xmalloc (argv0_len - 4 + 1);
-#ifdef NO_XMALLOC
- if (shorter != NULL)
-#endif
- {
- memcpy (shorter, argv0, argv0_len - exeext_len - 4);
- if (sizeof (EXEEXT) > sizeof (""))
- memcpy (shorter + argv0_len - exeext_len - 4,
- argv0 + argv0_len - exeext_len - 4,
- exeext_len);
- shorter[argv0_len - 4] = '\0';
- argv0_stripped = shorter;
- }
- }
- done_stripping: ;
- }
- }
-
- set_program_name (argv0_stripped);
-
- prepare_relocate (orig_installprefix, orig_installdir, argv0);
-}
-
-/* Return the full pathname of the current executable, based on the earlier
- call to set_program_name_and_installdir. Return NULL if unknown. */
-char *
-get_full_program_name (void)
-{
- return executable_fullname;
-}
-
-#endif
+++ /dev/null
-/* quote.c - quote arguments for output
- Copyright (C) 1998-1999, 2000-2001, 2003, 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Written by Paul Eggert <eggert@twinsun.com> */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "quotearg.h"
-#include "quote.h"
-
-/* Return an unambiguous printable representation of NAME,
- allocated in slot N, suitable for diagnostics. */
-char const *
-quote_n (int n, char const *name)
-{
- return quotearg_n_style (n, locale_quoting_style, name);
-}
-
-/* Return an unambiguous printable representation of NAME,
- suitable for diagnostics. */
-char const *
-quote (char const *name)
-{
- return quote_n (0, name);
-}
+++ /dev/null
-/* quote.h - prototypes for quote.c
-
- Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software
- Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-char const *quote_n (int n, char const *name);
-char const *quote (char const *name);
+++ /dev/null
-/* quotearg.c - quote arguments for output
-
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006 Free
- Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Written by Paul Eggert <eggert@twinsun.com> */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "quotearg.h"
-
-#include "xalloc.h"
-
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "gettext.h"
-#define _(msgid) gettext (msgid)
-#define N_(msgid) msgid
-
-#if HAVE_WCHAR_H
-
-/* BSD/OS 4.1 wchar.h requires FILE and struct tm to be declared. */
-# include <stdio.h>
-# include <time.h>
-
-# include <wchar.h>
-#endif
-
-#if !HAVE_MBRTOWC
-/* Disable multibyte processing entirely. Since MB_CUR_MAX is 1, the
- other macros are defined only for documentation and to satisfy C
- syntax. */
-# undef MB_CUR_MAX
-# define MB_CUR_MAX 1
-# define mbrtowc(pwc, s, n, ps) ((*(pwc) = *(s)) != 0)
-# define iswprint(wc) isprint ((unsigned char) (wc))
-# undef HAVE_MBSINIT
-#endif
-
-#if !defined mbsinit && !HAVE_MBSINIT
-# define mbsinit(ps) 1
-#endif
-
-#ifndef iswprint
-# if HAVE_WCTYPE_H
-# include <wctype.h>
-# endif
-# if !defined iswprint && !HAVE_ISWPRINT
-# define iswprint(wc) 1
-# endif
-#endif
-
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-#endif
-
-#define INT_BITS (sizeof (int) * CHAR_BIT)
-
-struct quoting_options
-{
- /* Basic quoting style. */
- enum quoting_style style;
-
- /* Quote the characters indicated by this bit vector even if the
- quoting style would not normally require them to be quoted. */
- unsigned int quote_these_too[(UCHAR_MAX / INT_BITS) + 1];
-};
-
-/* Names of quoting styles. */
-char const *const quoting_style_args[] =
-{
- "literal",
- "shell",
- "shell-always",
- "c",
- "escape",
- "locale",
- "clocale",
- 0
-};
-
-/* Correspondences to quoting style names. */
-enum quoting_style const quoting_style_vals[] =
-{
- literal_quoting_style,
- shell_quoting_style,
- shell_always_quoting_style,
- c_quoting_style,
- escape_quoting_style,
- locale_quoting_style,
- clocale_quoting_style
-};
-
-/* The default quoting options. */
-static struct quoting_options default_quoting_options;
-
-/* Allocate a new set of quoting options, with contents initially identical
- to O if O is not null, or to the default if O is null.
- It is the caller's responsibility to free the result. */
-struct quoting_options *
-clone_quoting_options (struct quoting_options *o)
-{
- int e = errno;
- struct quoting_options *p = xmalloc (sizeof *p);
- *p = *(o ? o : &default_quoting_options);
- errno = e;
- return p;
-}
-
-/* Get the value of O's quoting style. If O is null, use the default. */
-enum quoting_style
-get_quoting_style (struct quoting_options *o)
-{
- return (o ? o : &default_quoting_options)->style;
-}
-
-/* In O (or in the default if O is null),
- set the value of the quoting style to S. */
-void
-set_quoting_style (struct quoting_options *o, enum quoting_style s)
-{
- (o ? o : &default_quoting_options)->style = s;
-}
-
-/* In O (or in the default if O is null),
- set the value of the quoting options for character C to I.
- Return the old value. Currently, the only values defined for I are
- 0 (the default) and 1 (which means to quote the character even if
- it would not otherwise be quoted). */
-int
-set_char_quoting (struct quoting_options *o, char c, int i)
-{
- unsigned char uc = c;
- unsigned int *p =
- (o ? o : &default_quoting_options)->quote_these_too + uc / INT_BITS;
- int shift = uc % INT_BITS;
- int r = (*p >> shift) & 1;
- *p ^= ((i & 1) ^ r) << shift;
- return r;
-}
-
-/* MSGID approximates a quotation mark. Return its translation if it
- has one; otherwise, return either it or "\"", depending on S. */
-static char const *
-gettext_quote (char const *msgid, enum quoting_style s)
-{
- char const *translation = _(msgid);
- if (translation == msgid && s == clocale_quoting_style)
- translation = "\"";
- return translation;
-}
-
-/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
- argument ARG (of size ARGSIZE), using QUOTING_STYLE and the
- non-quoting-style part of O to control quoting.
- Terminate the output with a null character, and return the written
- size of the output, not counting the terminating null.
- If BUFFERSIZE is too small to store the output string, return the
- value that would have been returned had BUFFERSIZE been large enough.
- If ARGSIZE is SIZE_MAX, use the string length of the argument for ARGSIZE.
-
- This function acts like quotearg_buffer (BUFFER, BUFFERSIZE, ARG,
- ARGSIZE, O), except it uses QUOTING_STYLE instead of the quoting
- style specified by O, and O may not be null. */
-
-static size_t
-quotearg_buffer_restyled (char *buffer, size_t buffersize,
- char const *arg, size_t argsize,
- enum quoting_style quoting_style,
- struct quoting_options const *o)
-{
- size_t i;
- size_t len = 0;
- char const *quote_string = 0;
- size_t quote_string_len = 0;
- bool backslash_escapes = false;
- bool unibyte_locale = MB_CUR_MAX == 1;
-
-#define STORE(c) \
- do \
- { \
- if (len < buffersize) \
- buffer[len] = (c); \
- len++; \
- } \
- while (0)
-
- switch (quoting_style)
- {
- case c_quoting_style:
- STORE ('"');
- backslash_escapes = true;
- quote_string = "\"";
- quote_string_len = 1;
- break;
-
- case escape_quoting_style:
- backslash_escapes = true;
- break;
-
- case locale_quoting_style:
- case clocale_quoting_style:
- {
- /* TRANSLATORS:
- Get translations for open and closing quotation marks.
-
- The message catalog should translate "`" to a left
- quotation mark suitable for the locale, and similarly for
- "'". If the catalog has no translation,
- locale_quoting_style quotes `like this', and
- clocale_quoting_style quotes "like this".
-
- For example, an American English Unicode locale should
- translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and
- should translate "'" to U+201D (RIGHT DOUBLE QUOTATION
- MARK). A British English Unicode locale should instead
- translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and
- U+2019 (RIGHT SINGLE QUOTATION MARK), respectively.
-
- If you don't know what to put here, please see
- <http://en.wikipedia.org/wiki/Quotation_mark#Glyphs>
- and use glyphs suitable for your language. */
-
- char const *left = gettext_quote (N_("`"), quoting_style);
- char const *right = gettext_quote (N_("'"), quoting_style);
- for (quote_string = left; *quote_string; quote_string++)
- STORE (*quote_string);
- backslash_escapes = true;
- quote_string = right;
- quote_string_len = strlen (quote_string);
- }
- break;
-
- case shell_always_quoting_style:
- STORE ('\'');
- quote_string = "'";
- quote_string_len = 1;
- break;
-
- default:
- break;
- }
-
- for (i = 0; ! (argsize == SIZE_MAX ? arg[i] == '\0' : i == argsize); i++)
- {
- unsigned char c;
- unsigned char esc;
-
- if (backslash_escapes
- && quote_string_len
- && i + quote_string_len <= argsize
- && memcmp (arg + i, quote_string, quote_string_len) == 0)
- STORE ('\\');
-
- c = arg[i];
- switch (c)
- {
- case '\0':
- if (backslash_escapes)
- {
- STORE ('\\');
- STORE ('0');
- STORE ('0');
- c = '0';
- }
- break;
-
- case '?':
- switch (quoting_style)
- {
- case shell_quoting_style:
- goto use_shell_always_quoting_style;
-
- case c_quoting_style:
- if (i + 2 < argsize && arg[i + 1] == '?')
- switch (arg[i + 2])
- {
- case '!': case '\'':
- case '(': case ')': case '-': case '/':
- case '<': case '=': case '>':
- /* Escape the second '?' in what would otherwise be
- a trigraph. */
- c = arg[i + 2];
- i += 2;
- STORE ('?');
- STORE ('\\');
- STORE ('?');
- break;
-
- default:
- break;
- }
- break;
-
- default:
- break;
- }
- break;
-
- case '\a': esc = 'a'; goto c_escape;
- case '\b': esc = 'b'; goto c_escape;
- case '\f': esc = 'f'; goto c_escape;
- case '\n': esc = 'n'; goto c_and_shell_escape;
- case '\r': esc = 'r'; goto c_and_shell_escape;
- case '\t': esc = 't'; goto c_and_shell_escape;
- case '\v': esc = 'v'; goto c_escape;
- case '\\': esc = c; goto c_and_shell_escape;
-
- c_and_shell_escape:
- if (quoting_style == shell_quoting_style)
- goto use_shell_always_quoting_style;
- c_escape:
- if (backslash_escapes)
- {
- c = esc;
- goto store_escape;
- }
- break;
-
- case '{': case '}': /* sometimes special if isolated */
- if (! (argsize == SIZE_MAX ? arg[1] == '\0' : argsize == 1))
- break;
- /* Fall through. */
- case '#': case '~':
- if (i != 0)
- break;
- /* Fall through. */
- case ' ':
- case '!': /* special in bash */
- case '"': case '$': case '&':
- case '(': case ')': case '*': case ';':
- case '<':
- case '=': /* sometimes special in 0th or (with "set -k") later args */
- case '>': case '[':
- case '^': /* special in old /bin/sh, e.g. SunOS 4.1.4 */
- case '`': case '|':
- /* A shell special character. In theory, '$' and '`' could
- be the first bytes of multibyte characters, which means
- we should check them with mbrtowc, but in practice this
- doesn't happen so it's not worth worrying about. */
- if (quoting_style == shell_quoting_style)
- goto use_shell_always_quoting_style;
- break;
-
- case '\'':
- switch (quoting_style)
- {
- case shell_quoting_style:
- goto use_shell_always_quoting_style;
-
- case shell_always_quoting_style:
- STORE ('\'');
- STORE ('\\');
- STORE ('\'');
- break;
-
- default:
- break;
- }
- break;
-
- 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 '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 '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':
- /* These characters don't cause problems, no matter what the
- quoting style is. They cannot start multibyte sequences. */
- break;
-
- default:
- /* If we have a multibyte sequence, copy it until we reach
- its end, find an error, or come back to the initial shift
- state. For C-like styles, if the sequence has
- unprintable characters, escape the whole sequence, since
- we can't easily escape single characters within it. */
- {
- /* Length of multibyte sequence found so far. */
- size_t m;
-
- bool printable;
-
- if (unibyte_locale)
- {
- m = 1;
- printable = isprint (c) != 0;
- }
- else
- {
- mbstate_t mbstate;
- memset (&mbstate, 0, sizeof mbstate);
-
- m = 0;
- printable = true;
- if (argsize == SIZE_MAX)
- argsize = strlen (arg);
-
- do
- {
- wchar_t w;
- size_t bytes = mbrtowc (&w, &arg[i + m],
- argsize - (i + m), &mbstate);
- if (bytes == 0)
- break;
- else if (bytes == (size_t) -1)
- {
- printable = false;
- break;
- }
- else if (bytes == (size_t) -2)
- {
- printable = false;
- while (i + m < argsize && arg[i + m])
- m++;
- break;
- }
- else
- {
- /* Work around a bug with older shells that "see" a '\'
- that is really the 2nd byte of a multibyte character.
- In practice the problem is limited to ASCII
- chars >= '@' that are shell special chars. */
- if ('[' == 0x5b && quoting_style == shell_quoting_style)
- {
- size_t j;
- for (j = 1; j < bytes; j++)
- switch (arg[i + m + j])
- {
- case '[': case '\\': case '^':
- case '`': case '|':
- goto use_shell_always_quoting_style;
-
- default:
- break;
- }
- }
-
- if (! iswprint (w))
- printable = false;
- m += bytes;
- }
- }
- while (! mbsinit (&mbstate));
- }
-
- if (1 < m || (backslash_escapes && ! printable))
- {
- /* Output a multibyte sequence, or an escaped
- unprintable unibyte character. */
- size_t ilim = i + m;
-
- for (;;)
- {
- if (backslash_escapes && ! printable)
- {
- STORE ('\\');
- STORE ('0' + (c >> 6));
- STORE ('0' + ((c >> 3) & 7));
- c = '0' + (c & 7);
- }
- if (ilim <= i + 1)
- break;
- STORE (c);
- c = arg[++i];
- }
-
- goto store_c;
- }
- }
- }
-
- if (! (backslash_escapes
- && o->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS))))
- goto store_c;
-
- store_escape:
- STORE ('\\');
-
- store_c:
- STORE (c);
- }
-
- if (i == 0 && quoting_style == shell_quoting_style)
- goto use_shell_always_quoting_style;
-
- if (quote_string)
- for (; *quote_string; quote_string++)
- STORE (*quote_string);
-
- if (len < buffersize)
- buffer[len] = '\0';
- return len;
-
- use_shell_always_quoting_style:
- return quotearg_buffer_restyled (buffer, buffersize, arg, argsize,
- shell_always_quoting_style, o);
-}
-
-/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
- argument ARG (of size ARGSIZE), using O to control quoting.
- If O is null, use the default.
- Terminate the output with a null character, and return the written
- size of the output, not counting the terminating null.
- If BUFFERSIZE is too small to store the output string, return the
- value that would have been returned had BUFFERSIZE been large enough.
- If ARGSIZE is SIZE_MAX, use the string length of the argument for
- ARGSIZE. */
-size_t
-quotearg_buffer (char *buffer, size_t buffersize,
- char const *arg, size_t argsize,
- struct quoting_options const *o)
-{
- struct quoting_options const *p = o ? o : &default_quoting_options;
- int e = errno;
- size_t r = quotearg_buffer_restyled (buffer, buffersize, arg, argsize,
- p->style, p);
- errno = e;
- return r;
-}
-
-/* Like quotearg_buffer (..., ARG, ARGSIZE, O), except return newly
- allocated storage containing the quoted string. */
-char *
-quotearg_alloc (char const *arg, size_t argsize,
- struct quoting_options const *o)
-{
- int e = errno;
- size_t bufsize = quotearg_buffer (0, 0, arg, argsize, o) + 1;
- char *buf = xmalloc (bufsize);
- quotearg_buffer (buf, bufsize, arg, argsize, o);
- errno = e;
- return buf;
-}
-
-/* Use storage slot N to return a quoted version of argument ARG.
- ARG is of size ARGSIZE, but if that is SIZE_MAX, ARG is a
- null-terminated string.
- OPTIONS specifies the quoting options.
- The returned value points to static storage that can be
- reused by the next call to this function with the same value of N.
- N must be nonnegative. N is deliberately declared with type "int"
- to allow for future extensions (using negative values). */
-static char *
-quotearg_n_options (int n, char const *arg, size_t argsize,
- struct quoting_options const *options)
-{
- int e = errno;
-
- /* Preallocate a slot 0 buffer, so that the caller can always quote
- one small component of a "memory exhausted" message in slot 0. */
- static char slot0[256];
- static unsigned int nslots = 1;
- unsigned int n0 = n;
- struct slotvec
- {
- size_t size;
- char *val;
- };
- static struct slotvec slotvec0 = {sizeof slot0, slot0};
- static struct slotvec *slotvec = &slotvec0;
-
- if (n < 0)
- abort ();
-
- if (nslots <= n0)
- {
- /* FIXME: technically, the type of n1 should be `unsigned int',
- but that evokes an unsuppressible warning from gcc-4.0.1 and
- older. If gcc ever provides an option to suppress that warning,
- revert to the original type, so that the test in xalloc_oversized
- is once again performed only at compile time. */
- size_t n1 = n0 + 1;
-
- if (xalloc_oversized (n1, sizeof *slotvec))
- xalloc_die ();
-
- if (slotvec == &slotvec0)
- {
- slotvec = xmalloc (sizeof *slotvec);
- *slotvec = slotvec0;
- }
- slotvec = xrealloc (slotvec, n1 * sizeof *slotvec);
- memset (slotvec + nslots, 0, (n1 - nslots) * sizeof *slotvec);
- nslots = n1;
- }
-
- {
- size_t size = slotvec[n].size;
- char *val = slotvec[n].val;
- size_t qsize = quotearg_buffer (val, size, arg, argsize, options);
-
- if (size <= qsize)
- {
- slotvec[n].size = size = qsize + 1;
- if (val != slot0)
- free (val);
- slotvec[n].val = val = xmalloc (size);
- quotearg_buffer (val, size, arg, argsize, options);
- }
-
- errno = e;
- return val;
- }
-}
-
-char *
-quotearg_n (int n, char const *arg)
-{
- return quotearg_n_options (n, arg, SIZE_MAX, &default_quoting_options);
-}
-
-char *
-quotearg (char const *arg)
-{
- return quotearg_n (0, arg);
-}
-
-/* Return quoting options for STYLE, with no extra quoting. */
-static struct quoting_options
-quoting_options_from_style (enum quoting_style style)
-{
- struct quoting_options o;
- o.style = style;
- memset (o.quote_these_too, 0, sizeof o.quote_these_too);
- return o;
-}
-
-char *
-quotearg_n_style (int n, enum quoting_style s, char const *arg)
-{
- struct quoting_options const o = quoting_options_from_style (s);
- return quotearg_n_options (n, arg, SIZE_MAX, &o);
-}
-
-char *
-quotearg_n_style_mem (int n, enum quoting_style s,
- char const *arg, size_t argsize)
-{
- struct quoting_options const o = quoting_options_from_style (s);
- return quotearg_n_options (n, arg, argsize, &o);
-}
-
-char *
-quotearg_style (enum quoting_style s, char const *arg)
-{
- return quotearg_n_style (0, s, arg);
-}
-
-char *
-quotearg_char (char const *arg, char ch)
-{
- struct quoting_options options;
- options = default_quoting_options;
- set_char_quoting (&options, ch, 1);
- return quotearg_n_options (0, arg, SIZE_MAX, &options);
-}
-
-char *
-quotearg_colon (char const *arg)
-{
- return quotearg_char (arg, ':');
-}
+++ /dev/null
-/* quotearg.h - quote arguments for output
-
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software
- Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Written by Paul Eggert <eggert@twinsun.com> */
-
-#ifndef QUOTEARG_H_
-# define QUOTEARG_H_ 1
-
-# include <stddef.h>
-
-/* Basic quoting styles. */
-enum quoting_style
- {
- /* Output names as-is (ls --quoting-style=literal). */
- literal_quoting_style,
-
- /* Quote names for the shell if they contain shell metacharacters
- or would cause ambiguous output (ls --quoting-style=shell). */
- shell_quoting_style,
-
- /* Quote names for the shell, even if they would normally not
- require quoting (ls --quoting-style=shell-always). */
- shell_always_quoting_style,
-
- /* Quote names as for a C language string (ls --quoting-style=c). */
- c_quoting_style,
-
- /* Like c_quoting_style except omit the surrounding double-quote
- characters (ls --quoting-style=escape). */
- escape_quoting_style,
-
- /* Like clocale_quoting_style, but quote `like this' instead of
- "like this" in the default C locale (ls --quoting-style=locale). */
- locale_quoting_style,
-
- /* Like c_quoting_style except use quotation marks appropriate for
- the locale (ls --quoting-style=clocale). */
- clocale_quoting_style
- };
-
-/* For now, --quoting-style=literal is the default, but this may change. */
-# ifndef DEFAULT_QUOTING_STYLE
-# define DEFAULT_QUOTING_STYLE literal_quoting_style
-# endif
-
-/* Names of quoting styles and their corresponding values. */
-extern char const *const quoting_style_args[];
-extern enum quoting_style const quoting_style_vals[];
-
-struct quoting_options;
-
-/* The functions listed below set and use a hidden variable
- that contains the default quoting style options. */
-
-/* Allocate a new set of quoting options, with contents initially identical
- to O if O is not null, or to the default if O is null.
- It is the caller's responsibility to free the result. */
-struct quoting_options *clone_quoting_options (struct quoting_options *o);
-
-/* Get the value of O's quoting style. If O is null, use the default. */
-enum quoting_style get_quoting_style (struct quoting_options *o);
-
-/* In O (or in the default if O is null),
- set the value of the quoting style to S. */
-void set_quoting_style (struct quoting_options *o, enum quoting_style s);
-
-/* In O (or in the default if O is null),
- set the value of the quoting options for character C to I.
- Return the old value. Currently, the only values defined for I are
- 0 (the default) and 1 (which means to quote the character even if
- it would not otherwise be quoted). */
-int set_char_quoting (struct quoting_options *o, char c, int i);
-
-/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
- argument ARG (of size ARGSIZE), using O to control quoting.
- If O is null, use the default.
- Terminate the output with a null character, and return the written
- size of the output, not counting the terminating null.
- If BUFFERSIZE is too small to store the output string, return the
- value that would have been returned had BUFFERSIZE been large enough.
- If ARGSIZE is -1, use the string length of the argument for ARGSIZE. */
-size_t quotearg_buffer (char *buffer, size_t buffersize,
- char const *arg, size_t argsize,
- struct quoting_options const *o);
-
-/* Like quotearg_buffer, except return the result in a newly allocated
- buffer. It is the caller's responsibility to free the result. */
-char *quotearg_alloc (char const *arg, size_t argsize,
- struct quoting_options const *o);
-
-/* Use storage slot N to return a quoted version of the string ARG.
- Use the default quoting options.
- The returned value points to static storage that can be
- reused by the next call to this function with the same value of N.
- N must be nonnegative. */
-char *quotearg_n (int n, char const *arg);
-
-/* Equivalent to quotearg_n (0, ARG). */
-char *quotearg (char const *arg);
-
-/* Use style S and storage slot N to return a quoted version of the string ARG.
- This is like quotearg_n (N, ARG), except that it uses S with no other
- options to specify the quoting method. */
-char *quotearg_n_style (int n, enum quoting_style s, char const *arg);
-
-/* Use style S and storage slot N to return a quoted version of the
- argument ARG of size ARGSIZE. This is like quotearg_n_style
- (N, S, ARG), except it can quote null bytes. */
-char *quotearg_n_style_mem (int n, enum quoting_style s,
- char const *arg, size_t argsize);
-
-/* Equivalent to quotearg_n_style (0, S, ARG). */
-char *quotearg_style (enum quoting_style s, char const *arg);
-
-/* Like quotearg (ARG), except also quote any instances of CH. */
-char *quotearg_char (char const *arg, char ch);
-
-/* Equivalent to quotearg_char (ARG, ':'). */
-char *quotearg_colon (char const *arg);
-
-#endif /* !QUOTEARG_H_ */
+++ /dev/null
-/* Stub for readlink().
- Copyright (C) 2003-2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stddef.h>
-
-#if !HAVE_READLINK
-
-/* readlink() substitute for systems that don't have a readlink() function,
- such as DJGPP 2.03 and mingw32. */
-
-/* The official POSIX return type of readlink() is ssize_t, but since here
- we have no declaration in a public header file, we use 'int' as return
- type. */
-
-int
-readlink (const char *path, char *buf, size_t bufsize)
-{
- struct stat statbuf;
-
- /* In general we should use lstat() here, not stat(). But on platforms
- without symbolic links lstat() - if it exists - would be equivalent to
- stat(), therefore we can use stat(). This saves us a configure check. */
- if (stat (path, &statbuf) >= 0)
- errno = EINVAL;
- return -1;
-}
-
-#endif
+++ /dev/null
-# Add this package to a list of references stored in a text file.
-#
-# Copyright (C) 2000 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Library General Public License as published
-# by the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-#
-# Written by Bruno Haible <haible@clisp.cons.org>.
-#
-/^# Packages using this file: / {
- s/# Packages using this file://
- ta
- :a
- s/ @PACKAGE@ / @PACKAGE@ /
- tb
- s/ $/ @PACKAGE@ /
- :b
- s/^/# Packages using this file:/
-}
+++ /dev/null
-# Remove this package from a list of references stored in a text file.
-#
-# Copyright (C) 2000 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Library General Public License as published
-# by the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-#
-# Written by Bruno Haible <haible@clisp.cons.org>.
-#
-/^# Packages using this file: / {
- s/# Packages using this file://
- s/ @PACKAGE@ / /
- s/^/# Packages using this file:/
-}
+++ /dev/null
-/* An interface to read and write that retries after interrupts.
-
- Copyright (C) 1993, 1994, 1998, 2002, 2003, 2004, 2005 Free Software
- Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#ifdef SAFE_WRITE
-# include "safe-write.h"
-#else
-# include "safe-read.h"
-#endif
-
-/* Get ssize_t. */
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <errno.h>
-
-#ifdef EINTR
-# define IS_EINTR(x) ((x) == EINTR)
-#else
-# define IS_EINTR(x) 0
-#endif
-
-#include <limits.h>
-
-#ifdef SAFE_WRITE
-# define safe_rw safe_write
-# define rw write
-#else
-# define safe_rw safe_read
-# define rw read
-# undef const
-# define const /* empty */
-#endif
-
-/* Read(write) up to COUNT bytes at BUF from(to) descriptor FD, retrying if
- interrupted. Return the actual number of bytes read(written), zero for EOF,
- or SAFE_READ_ERROR(SAFE_WRITE_ERROR) upon error. */
-size_t
-safe_rw (int fd, void const *buf, size_t count)
-{
- /* Work around a bug in Tru64 5.1. Attempting to read more than
- INT_MAX bytes fails with errno == EINVAL. See
- <http://lists.gnu.org/archive/html/bug-gnu-utils/2002-04/msg00010.html>.
- When decreasing COUNT, keep it block-aligned. */
- enum { BUGGY_READ_MAXIMUM = INT_MAX & ~8191 };
-
- for (;;)
- {
- ssize_t result = rw (fd, buf, count);
-
- if (0 <= result)
- return result;
- else if (IS_EINTR (errno))
- continue;
- else if (errno == EINVAL && BUGGY_READ_MAXIMUM < count)
- count = BUGGY_READ_MAXIMUM;
- else
- return result;
- }
-}
+++ /dev/null
-/* An interface to read() that retries after interrupts.
- Copyright (C) 2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#include <stddef.h>
-
-#define SAFE_READ_ERROR ((size_t) -1)
-
-/* Read up to COUNT bytes at BUF from descriptor FD, retrying if interrupted.
- Return the actual number of bytes read, zero for EOF, or SAFE_READ_ERROR
- upon error. */
-extern size_t safe_read (int fd, void *buf, size_t count);
+++ /dev/null
-/* An interface to write that retries after interrupts.
- Copyright (C) 2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#define SAFE_WRITE
-#include "safe-read.c"
+++ /dev/null
-/* An interface to write() that retries after interrupts.
- Copyright (C) 2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#include <stddef.h>
-
-#define SAFE_WRITE_ERROR ((size_t) -1)
-
-/* Write up to COUNT bytes at BUF to descriptor FD, retrying if interrupted.
- Return the actual number of bytes written, zero for EOF, or SAFE_WRITE_ERROR
- upon error. */
-extern size_t safe_write (int fd, const void *buf, size_t count);
+++ /dev/null
-/* Copyright (C) 1992,1995-1999,2000-2003,2005 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 51 Franklin Street,
- Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include <alloca.h>
-
-#include <errno.h>
-#ifndef __set_errno
-# define __set_errno(ev) ((errno) = (ev))
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#if _LIBC || HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if !_LIBC
-# include "allocsa.h"
-#endif
-
-#if !_LIBC
-# define __environ environ
-# ifndef HAVE_ENVIRON_DECL
-extern char **environ;
-# endif
-#endif
-
-#if _LIBC
-/* This lock protects against simultaneous modifications of `environ'. */
-# include <bits/libc-lock.h>
-__libc_lock_define_initialized (static, envlock)
-# define LOCK __libc_lock_lock (envlock)
-# define UNLOCK __libc_lock_unlock (envlock)
-#else
-# define LOCK
-# define UNLOCK
-#endif
-
-/* In the GNU C library we must keep the namespace clean. */
-#ifdef _LIBC
-# define setenv __setenv
-# define clearenv __clearenv
-# define tfind __tfind
-# define tsearch __tsearch
-#endif
-
-/* In the GNU C library implementation we try to be more clever and
- allow arbitrarily many changes of the environment given that the used
- values are from a small set. Outside glibc this will eat up all
- memory after a while. */
-#if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \
- && defined __GNUC__)
-# define USE_TSEARCH 1
-# include <search.h>
-typedef int (*compar_fn_t) (const void *, const void *);
-
-/* This is a pointer to the root of the search tree with the known
- values. */
-static void *known_values;
-
-# define KNOWN_VALUE(Str) \
- ({ \
- void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \
- value != NULL ? *(char **) value : NULL; \
- })
-# define STORE_VALUE(Str) \
- tsearch (Str, &known_values, (compar_fn_t) strcmp)
-
-#else
-# undef USE_TSEARCH
-
-# define KNOWN_VALUE(Str) NULL
-# define STORE_VALUE(Str) do { } while (0)
-
-#endif
-
-
-/* If this variable is not a null pointer we allocated the current
- environment. */
-static char **last_environ;
-
-
-/* This function is used by `setenv' and `putenv'. The difference between
- the two functions is that for the former must create a new string which
- is then placed in the environment, while the argument of `putenv'
- must be used directly. This is all complicated by the fact that we try
- to reuse values once generated for a `setenv' call since we can never
- free the strings. */
-int
-__add_to_environ (const char *name, const char *value, const char *combined,
- int replace)
-{
- register char **ep;
- register size_t size;
- const size_t namelen = strlen (name);
- const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
-
- LOCK;
-
- /* We have to get the pointer now that we have the lock and not earlier
- since another thread might have created a new environment. */
- ep = __environ;
-
- size = 0;
- if (ep != NULL)
- {
- for (; *ep != NULL; ++ep)
- if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
- break;
- else
- ++size;
- }
-
- if (ep == NULL || *ep == NULL)
- {
- char **new_environ;
-#ifdef USE_TSEARCH
- char *new_value;
-#endif
-
- /* We allocated this space; we can extend it. */
- new_environ =
- (char **) (last_environ == NULL
- ? malloc ((size + 2) * sizeof (char *))
- : realloc (last_environ, (size + 2) * sizeof (char *)));
- if (new_environ == NULL)
- {
- UNLOCK;
- return -1;
- }
-
- /* If the whole entry is given add it. */
- if (combined != NULL)
- /* We must not add the string to the search tree since it belongs
- to the user. */
- new_environ[size] = (char *) combined;
- else
- {
- /* See whether the value is already known. */
-#ifdef USE_TSEARCH
-# ifdef _LIBC
- new_value = (char *) alloca (namelen + 1 + vallen);
- __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
- value, vallen);
-# else
- new_value = (char *) allocsa (namelen + 1 + vallen);
- if (new_value == NULL)
- {
- __set_errno (ENOMEM);
- UNLOCK;
- return -1;
- }
- memcpy (new_value, name, namelen);
- new_value[namelen] = '=';
- memcpy (&new_value[namelen + 1], value, vallen);
-# endif
-
- new_environ[size] = KNOWN_VALUE (new_value);
- if (new_environ[size] == NULL)
-#endif
- {
- new_environ[size] = (char *) malloc (namelen + 1 + vallen);
- if (new_environ[size] == NULL)
- {
-#if defined USE_TSEARCH && !defined _LIBC
- freesa (new_value);
-#endif
- __set_errno (ENOMEM);
- UNLOCK;
- return -1;
- }
-
-#ifdef USE_TSEARCH
- memcpy (new_environ[size], new_value, namelen + 1 + vallen);
-#else
- memcpy (new_environ[size], name, namelen);
- new_environ[size][namelen] = '=';
- memcpy (&new_environ[size][namelen + 1], value, vallen);
-#endif
- /* And save the value now. We cannot do this when we remove
- the string since then we cannot decide whether it is a
- user string or not. */
- STORE_VALUE (new_environ[size]);
- }
-#if defined USE_TSEARCH && !defined _LIBC
- freesa (new_value);
-#endif
- }
-
- if (__environ != last_environ)
- memcpy ((char *) new_environ, (char *) __environ,
- size * sizeof (char *));
-
- new_environ[size + 1] = NULL;
-
- last_environ = __environ = new_environ;
- }
- else if (replace)
- {
- char *np;
-
- /* Use the user string if given. */
- if (combined != NULL)
- np = (char *) combined;
- else
- {
-#ifdef USE_TSEARCH
- char *new_value;
-# ifdef _LIBC
- new_value = alloca (namelen + 1 + vallen);
- __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
- value, vallen);
-# else
- new_value = allocsa (namelen + 1 + vallen);
- if (new_value == NULL)
- {
- __set_errno (ENOMEM);
- UNLOCK;
- return -1;
- }
- memcpy (new_value, name, namelen);
- new_value[namelen] = '=';
- memcpy (&new_value[namelen + 1], value, vallen);
-# endif
-
- np = KNOWN_VALUE (new_value);
- if (np == NULL)
-#endif
- {
- np = malloc (namelen + 1 + vallen);
- if (np == NULL)
- {
-#if defined USE_TSEARCH && !defined _LIBC
- freesa (new_value);
-#endif
- __set_errno (ENOMEM);
- UNLOCK;
- return -1;
- }
-
-#ifdef USE_TSEARCH
- memcpy (np, new_value, namelen + 1 + vallen);
-#else
- memcpy (np, name, namelen);
- np[namelen] = '=';
- memcpy (&np[namelen + 1], value, vallen);
-#endif
- /* And remember the value. */
- STORE_VALUE (np);
- }
-#if defined USE_TSEARCH && !defined _LIBC
- freesa (new_value);
-#endif
- }
-
- *ep = np;
- }
-
- UNLOCK;
-
- return 0;
-}
-
-int
-setenv (const char *name, const char *value, int replace)
-{
- return __add_to_environ (name, value, NULL, replace);
-}
-
-/* The `clearenv' was planned to be added to POSIX.1 but probably
- never made it. Nevertheless the POSIX.9 standard (POSIX bindings
- for Fortran 77) requires this function. */
-int
-clearenv (void)
-{
- LOCK;
-
- if (__environ == last_environ && __environ != NULL)
- {
- /* We allocated this environment so we can free it. */
- free (__environ);
- last_environ = NULL;
- }
-
- /* Clear the environment pointer removes the whole environment. */
- __environ = NULL;
-
- UNLOCK;
-
- return 0;
-}
-
-#ifdef _LIBC
-static void
-free_mem (void)
-{
- /* Remove all traces. */
- clearenv ();
-
- /* Now remove the search tree. */
- __tdestroy (known_values, free);
- known_values = NULL;
-}
-text_set_element (__libc_subfreeres, free_mem);
-
-
-# undef setenv
-# undef clearenv
-weak_alias (__setenv, setenv)
-weak_alias (__clearenv, clearenv)
-#endif
+++ /dev/null
-/* Setting environment variables.
- Copyright (C) 2001-2004 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#if HAVE_SETENV || HAVE_UNSETENV
-
-/* Get setenv(), unsetenv() declarations. */
-# include <stdlib.h>
-
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if !HAVE_SETENV
-
-/* Set NAME to VALUE in the environment.
- If REPLACE is nonzero, overwrite an existing value. */
-extern int setenv (const char *name, const char *value, int replace);
-
-#endif
-
-#if HAVE_UNSETENV
-
-# if VOID_UNSETENV
-/* On some systems, unsetenv() returns void.
- This is the case for FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */
-# define unsetenv(name) ((unsetenv)(name), 0)
-# endif
-
-#else
-
-/* Remove the variable NAME from the environment. */
-extern int unsetenv (const char *name);
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
+++ /dev/null
-/* Shell quoting.
- Copyright (C) 2001-2004 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "sh-quote.h"
-
-#include <string.h>
-
-#include "quotearg.h"
-#include "xalloc.h"
-
-/* Describes quoting for sh compatible shells. */
-static struct quoting_options *sh_quoting_options;
-
-/* Initializes the sh_quoting_options variable. */
-static void
-init_sh_quoting_options ()
-{
- sh_quoting_options = clone_quoting_options (NULL);
- set_quoting_style (sh_quoting_options, shell_quoting_style);
-}
-
-/* Returns the number of bytes needed for the quoted string. */
-size_t
-shell_quote_length (const char *string)
-{
- if (sh_quoting_options == NULL)
- init_sh_quoting_options ();
- return quotearg_buffer (NULL, 0, string, strlen (string),
- sh_quoting_options);
-}
-
-/* Copies the quoted string to p and returns the incremented p.
- There must be room for shell_quote_length (string) + 1 bytes at p. */
-char *
-shell_quote_copy (char *p, const char *string)
-{
- if (sh_quoting_options == NULL)
- init_sh_quoting_options ();
- return p + quotearg_buffer (p, (size_t)(-1), string, strlen (string),
- sh_quoting_options);
-}
-
-/* Returns the freshly allocated quoted string. */
-char *
-shell_quote (const char *string)
-{
- if (sh_quoting_options == NULL)
- init_sh_quoting_options ();
- return quotearg_alloc (string, strlen (string), sh_quoting_options);
-}
-
-/* Returns a freshly allocated string containing all argument strings, quoted,
- separated through spaces. */
-char *
-shell_quote_argv (char **argv)
-{
- if (*argv != NULL)
- {
- char **argp;
- size_t length;
- char *command;
- char *p;
-
- length = 0;
- for (argp = argv; ; )
- {
- length += shell_quote_length (*argp) + 1;
- argp++;
- if (*argp == NULL)
- break;
- }
-
- command = (char *) xmalloc (length);
-
- p = command;
- for (argp = argv; ; )
- {
- p = shell_quote_copy (p, *argp);
- argp++;
- if (*argp == NULL)
- break;
- *p++ = ' ';
- }
- *p = '\0';
-
- return command;
- }
- else
- return xstrdup ("");
-}
+++ /dev/null
-/* Shell quoting.
- Copyright (C) 2001-2002, 2004 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* When passing a command to a shell, we must quote the program name and
- arguments, since Unix shells interpret characters like " ", "'", "<", ">",
- "$" etc. in a special way. */
-
-#include <stddef.h>
-
-/* Returns the number of bytes needed for the quoted string. */
-extern size_t shell_quote_length (const char *string);
-
-/* Copies the quoted string to p and returns the incremented p.
- There must be room for shell_quote_length (string) + 1 bytes at p. */
-extern char * shell_quote_copy (char *p, const char *string);
-
-/* Returns the freshly allocated quoted string. */
-extern char * shell_quote (const char *string);
-
-/* Returns a freshly allocated string containing all argument strings, quoted,
- separated through spaces. */
-extern char * shell_quote_argv (char **argv);
+++ /dev/null
-/* size_max.h -- declare SIZE_MAX through system headers
- Copyright (C) 2005-2006 Free Software Foundation, Inc.
- Written by Simon Josefsson.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef GNULIB_SIZE_MAX_H
-#define GNULIB_SIZE_MAX_H
-
-/* Get SIZE_MAX declaration on systems like Solaris 7/8/9. */
-# include <limits.h>
-/* Get SIZE_MAX declaration on systems like glibc 2. */
-# if HAVE_STDINT_H
-# include <stdint.h>
-# endif
-/* On systems where these include files don't define it, SIZE_MAX is defined
- in config.h. */
-
-#endif /* GNULIB_SIZE_MAX_H */
+++ /dev/null
-/* Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _STDBOOL_H
-#define _STDBOOL_H
-
-/* ISO C 99 <stdbool.h> for platforms that lack it. */
-
-/* Usage suggestions:
-
- Programs that use <stdbool.h> should be aware of some limitations
- and standards compliance issues.
-
- Standards compliance:
-
- - <stdbool.h> must be #included before 'bool', 'false', 'true'
- can be used.
-
- - You cannot assume that sizeof (bool) == 1.
-
- - Programs should not undefine the macros bool, true, and false,
- as C99 lists that as an "obsolescent feature".
-
- Limitations of this substitute, when used in a C89 environment:
-
- - <stdbool.h> must be #included before the '_Bool' type can be used.
-
- - You cannot assume that _Bool is a typedef; it might be a macro.
-
- - In C99, casts and automatic conversions to '_Bool' or 'bool' are
- performed in such a way that every nonzero value gets converted
- to 'true', and zero gets converted to 'false'. This doesn't work
- with this substitute. With this substitute, only the values 0 and 1
- give the expected result when converted to _Bool' or 'bool'.
-
- Also, it is suggested that programs use 'bool' rather than '_Bool';
- this isn't required, but 'bool' is more common. */
-
-
-/* 7.16. Boolean type and values */
-
-/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same
- definitions below, but temporarily we have to #undef them. */
-#ifdef __BEOS__
-# include <OS.h> /* defines bool but not _Bool */
-# undef false
-# undef true
-#endif
-
-/* For the sake of symbolic names in gdb, we define true and false as
- enum constants, not only as macros.
- It is tempting to write
- typedef enum { false = 0, true = 1 } _Bool;
- so that gdb prints values of type 'bool' symbolically. But if we do
- this, values of type '_Bool' may promote to 'int' or 'unsigned int'
- (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
- (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the
- enum; this ensures that '_Bool' promotes to 'int'. */
-#if defined __cplusplus || defined __BEOS__
- /* A compiler known to have 'bool'. */
- /* If the compiler already has both 'bool' and '_Bool', we can assume they
- are the same types. */
-# if !@HAVE__BOOL@
-typedef bool _Bool;
-# endif
-#else
-# if !defined __GNUC__
- /* If @HAVE__BOOL@:
- Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
- the built-in _Bool type is used. See
- http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
- http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
- http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
- Similar bugs are likely with other compilers as well; this file
- wouldn't be used if <stdbool.h> was working.
- So we override the _Bool type.
- If !@HAVE__BOOL@:
- Need to define _Bool ourselves. As 'signed char' or as an enum type?
- Use of a typedef, with SunPRO C, leads to a stupid
- "warning: _Bool is a keyword in ISO C99".
- Use of an enum type, with IRIX cc, leads to a stupid
- "warning(1185): enumerated type mixed with another type".
- The only benefit of the enum type, debuggability, is not important
- with these compilers. So use 'signed char' and no typedef. */
-# define _Bool signed char
-enum { false = 0, true = 1 };
-# else
- /* With this compiler, trust the _Bool type if the compiler has it. */
-# if !@HAVE__BOOL@
-typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
-# endif
-# endif
-#endif
-#define bool _Bool
-
-/* The other macros must be usable in preprocessor directives. */
-#define false 0
-#define true 1
-#define __bool_true_false_are_defined 1
-
-#endif /* _STDBOOL_H */
+++ /dev/null
-/* stpcpy.c -- copy a string and return pointer to end of new string
- Copyright (C) 1992, 1995, 1997, 1998 Free Software Foundation, Inc.
-
- NOTE: The canonical source of this file is maintained with the GNU C Library.
- Bugs can be reported to bug-glibc@prep.ai.mit.edu.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-
-#undef __stpcpy
-#undef stpcpy
-
-#ifndef weak_alias
-# define __stpcpy stpcpy
-#endif
-
-/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
-char *
-__stpcpy (char *dest, const char *src)
-{
- register char *d = dest;
- register const char *s = src;
-
- do
- *d++ = *s;
- while (*s++ != '\0');
-
- return d - 1;
-}
-#ifdef weak_alias
-weak_alias (__stpcpy, stpcpy)
-#endif
+++ /dev/null
-/* String copying.
- Copyright (C) 1995, 2001, 2003 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _STPCPY_H
-#define _STPCPY_H
-
-#if HAVE_STPCPY
-
-/* Get stpcpy() declaration. */
-#include <string.h>
-
-#else
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */
-extern char *stpcpy (char *dst, const char *src);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-#endif /* _STPCPY_H */
+++ /dev/null
-/* Copyright (C) 1993, 1995-1997, 2002-2003, 2005 Free Software Foundation, Inc.
-
- NOTE: The canonical source of this file is maintained with the GNU C Library.
- Bugs can be reported to bug-glibc@gnu.org.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* This is almost copied from strncpy.c, written by Torbjorn Granlund. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "stpncpy.h"
-
-#ifndef weak_alias
-# define __stpncpy stpncpy
-#endif
-
-/* Copy no more than N bytes of SRC to DST, returning a pointer past the
- last non-NUL byte written into DST. */
-char *
-__stpncpy (char *dest, const char *src, size_t n)
-{
- char c;
- char *s = dest;
-
- if (n >= 4)
- {
- size_t n4 = n >> 2;
-
- for (;;)
- {
- c = *src++;
- *dest++ = c;
- if (c == '\0')
- break;
- c = *src++;
- *dest++ = c;
- if (c == '\0')
- break;
- c = *src++;
- *dest++ = c;
- if (c == '\0')
- break;
- c = *src++;
- *dest++ = c;
- if (c == '\0')
- break;
- if (--n4 == 0)
- goto last_chars;
- }
- n -= dest - s;
- goto zero_fill;
- }
-
- last_chars:
- n &= 3;
- if (n == 0)
- return dest;
-
- for (;;)
- {
- c = *src++;
- --n;
- *dest++ = c;
- if (c == '\0')
- break;
- if (n == 0)
- return dest;
- }
-
- zero_fill:
- while (n-- > 0)
- dest[n] = '\0';
-
- return dest - 1;
-}
-#ifdef weak_alias
-weak_alias (__stpncpy, stpncpy)
-#endif
+++ /dev/null
-/* String copying.
- Copyright (C) 1995, 2001-2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _STPNCPY_H
-#define _STPNCPY_H
-
-#include <string.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#if !HAVE_STPNCPY
-
-/* When not using the GNU libc we use the stpncpy implementation we
- provide here. */
-#define stpncpy gnu_stpncpy
-
-/* Copy no more than N bytes of SRC to DST, returning a pointer past the
- last non-NUL byte written into DST. */
-extern char *stpncpy (char *dst, const char *src, size_t n);
-
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _STPNCPY_H */
+++ /dev/null
-/* Copyright (C) 1991, 1994, 1996-1997, 2002-2003, 2005 Free Software Foundation, Inc.
-
- NOTE: The canonical source of this file is maintained with the GNU C Library.
- Bugs can be reported to bug-glibc@gnu.org.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stddef.h>
-#include <string.h>
-
-#undef strcspn
-
-/* Return the length of the maximum initial segment of S
- which contains no characters from REJECT. */
-size_t
-strcspn (const char *s, const char *reject)
-{
- size_t count = 0;
-
- while (*s != '\0')
- if (strchr (reject, *s++) == NULL)
- ++count;
- else
- return count;
-
- return count;
-}
+++ /dev/null
-/* strerror.c --- ANSI C compatible system error routine
-
- Copyright (C) 1986, 1988-1989, 1991, 2002-2003, 2005 Free Software
- Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#if !HAVE_STRERROR
-
-#include <limits.h>
-
-/* Don't include <stdio.h>, since it may or may not declare
- sys_errlist and its declarations may collide with ours. Just
- declare the stuff that we need directly. Standard hosted C89
- implementations define strerror and they don't need this strerror
- function, so take some liberties with the standard to cater to
- ancient or limited freestanding implementations. */
-int sprintf (char *, char const *, ...);
-extern int sys_nerr;
-extern char *sys_errlist[];
-
-char *
-strerror (int n)
-{
- static char const fmt[] = "Unknown error (%d)";
- static char mesg[sizeof fmt + sizeof n * CHAR_BIT / 3];
-
- if (n < 0 || n >= sys_nerr)
- {
- sprintf (mesg, fmt, n);
- return mesg;
- }
- else
- return sys_errlist[n];
-}
-
-#else
-
-/* This declaration is solely to ensure that after preprocessing
- this file is never empty. */
-typedef int dummy;
-
-#endif
+++ /dev/null
-/* Copyright (C) 1991, 1994, 2000, 2002-2003 Free Software Foundation, Inc.
- NOTE: The canonical source of this file is maintained with the GNU C Library.
- Bugs can be reported to bug-glibc@prep.ai.mit.edu.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stddef.h>
-#include <string.h>
-
-#undef strpbrk
-
-/* Find the first occurrence in S of any character in ACCEPT. */
-char *
-strpbrk (const char *s, const char *accept)
-{
- while (*s != '\0')
- {
- const char *a = accept;
- while (*a != '\0')
- if (*a++ == *s)
- return (char *) s;
- ++s;
- }
-
- return NULL;
-}
+++ /dev/null
-/* Searching in a string.
- Copyright (C) 2001-2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#if HAVE_STRPBRK
-
-/* Get strpbrk() declaration. */
-#include <string.h>
-
-#else
-
-/* Find the first occurrence in S of any character in ACCEPT. */
-extern char *strpbrk (const char *s, const char *accept);
-
-#endif
+++ /dev/null
-/* Convert string representation of a number into an integer value.
-
- Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2006 Free Software Foundation, Inc.
-
- NOTE: The canonical source of this file is maintained with the GNU C
- Library. Bugs can be reported to bug-glibc@gnu.org.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef _LIBC
-# define USE_NUMBER_GROUPING
-#endif
-
-#include <ctype.h>
-#include <errno.h>
-#ifndef __set_errno
-# define __set_errno(Val) errno = (Val)
-#endif
-
-#include <limits.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef USE_NUMBER_GROUPING
-# include "../locale/localeinfo.h"
-#endif
-
-/* Nonzero if we are defining `strtoul' or `strtoull', operating on
- unsigned integers. */
-#ifndef UNSIGNED
-# define UNSIGNED 0
-# define INT LONG int
-#else
-# define INT unsigned LONG int
-#endif
-
-/* Determine the name. */
-#ifdef USE_IN_EXTENDED_LOCALE_MODEL
-# if UNSIGNED
-# ifdef USE_WIDE_CHAR
-# ifdef QUAD
-# define strtol __wcstoull_l
-# else
-# define strtol __wcstoul_l
-# endif
-# else
-# ifdef QUAD
-# define strtol __strtoull_l
-# else
-# define strtol __strtoul_l
-# endif
-# endif
-# else
-# ifdef USE_WIDE_CHAR
-# ifdef QUAD
-# define strtol __wcstoll_l
-# else
-# define strtol __wcstol_l
-# endif
-# else
-# ifdef QUAD
-# define strtol __strtoll_l
-# else
-# define strtol __strtol_l
-# endif
-# endif
-# endif
-#else
-# if UNSIGNED
-# ifdef USE_WIDE_CHAR
-# ifdef QUAD
-# define strtol wcstoull
-# else
-# define strtol wcstoul
-# endif
-# else
-# ifdef QUAD
-# define strtol strtoull
-# else
-# define strtol strtoul
-# endif
-# endif
-# else
-# ifdef USE_WIDE_CHAR
-# ifdef QUAD
-# define strtol wcstoll
-# else
-# define strtol wcstol
-# endif
-# else
-# ifdef QUAD
-# define strtol strtoll
-# endif
-# endif
-# endif
-#endif
-
-/* If QUAD is defined, we are defining `strtoll' or `strtoull',
- operating on `long long int's. */
-#ifdef QUAD
-# define LONG long long
-# define STRTOL_LONG_MIN LONG_LONG_MIN
-# define STRTOL_LONG_MAX LONG_LONG_MAX
-# define STRTOL_ULONG_MAX ULONG_LONG_MAX
-
-/* The extra casts work around common compiler bugs,
- e.g. Cray C 5.0.3.0 when t == time_t. */
-# ifndef TYPE_SIGNED
-# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-# endif
-# ifndef TYPE_MINIMUM
-# define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
- ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
- : (t) 0))
-# endif
-# ifndef TYPE_MAXIMUM
-# define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
-# endif
-
-# ifndef ULONG_LONG_MAX
-# define ULONG_LONG_MAX TYPE_MAXIMUM (unsigned long long)
-# endif
-# ifndef LONG_LONG_MAX
-# define LONG_LONG_MAX TYPE_MAXIMUM (long long int)
-# endif
-# ifndef LONG_LONG_MIN
-# define LONG_LONG_MIN TYPE_MINIMUM (long long int)
-# endif
-
-# if __GNUC__ == 2 && __GNUC_MINOR__ < 7
- /* Work around gcc bug with using this constant. */
- static const unsigned long long int maxquad = ULONG_LONG_MAX;
-# undef STRTOL_ULONG_MAX
-# define STRTOL_ULONG_MAX maxquad
-# endif
-#else
-# define LONG long
-# define STRTOL_LONG_MIN LONG_MIN
-# define STRTOL_LONG_MAX LONG_MAX
-# define STRTOL_ULONG_MAX ULONG_MAX
-#endif
-
-
-/* We use this code also for the extended locale handling where the
- function gets as an additional argument the locale which has to be
- used. To access the values we have to redefine the _NL_CURRENT
- macro. */
-#ifdef USE_IN_EXTENDED_LOCALE_MODEL
-# undef _NL_CURRENT
-# define _NL_CURRENT(category, item) \
- (current->values[_NL_ITEM_INDEX (item)].string)
-# define LOCALE_PARAM , loc
-# define LOCALE_PARAM_PROTO , __locale_t loc
-#else
-# define LOCALE_PARAM
-# define LOCALE_PARAM_PROTO
-#endif
-
-#if defined _LIBC || defined HAVE_WCHAR_H
-# include <wchar.h>
-#endif
-
-#ifdef USE_WIDE_CHAR
-# include <wctype.h>
-# define L_(Ch) L##Ch
-# define UCHAR_TYPE wint_t
-# define STRING_TYPE wchar_t
-# ifdef USE_IN_EXTENDED_LOCALE_MODEL
-# define ISSPACE(Ch) __iswspace_l ((Ch), loc)
-# define ISALPHA(Ch) __iswalpha_l ((Ch), loc)
-# define TOUPPER(Ch) __towupper_l ((Ch), loc)
-# else
-# define ISSPACE(Ch) iswspace (Ch)
-# define ISALPHA(Ch) iswalpha (Ch)
-# define TOUPPER(Ch) towupper (Ch)
-# endif
-#else
-# define L_(Ch) Ch
-# define UCHAR_TYPE unsigned char
-# define STRING_TYPE char
-# ifdef USE_IN_EXTENDED_LOCALE_MODEL
-# define ISSPACE(Ch) __isspace_l ((Ch), loc)
-# define ISALPHA(Ch) __isalpha_l ((Ch), loc)
-# define TOUPPER(Ch) __toupper_l ((Ch), loc)
-# else
-# define ISSPACE(Ch) isspace (Ch)
-# define ISALPHA(Ch) isalpha (Ch)
-# define TOUPPER(Ch) toupper (Ch)
-# endif
-#endif
-
-#define INTERNAL(X) INTERNAL1(X)
-#define INTERNAL1(X) __##X##_internal
-#define WEAKNAME(X) WEAKNAME1(X)
-
-#ifdef USE_NUMBER_GROUPING
-/* This file defines a function to check for correct grouping. */
-# include "grouping.h"
-#endif
-
-
-
-/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
- If BASE is 0 the base is determined by the presence of a leading
- zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
- If BASE is < 2 or > 36, it is reset to 10.
- If ENDPTR is not NULL, a pointer to the character after the last
- one converted is stored in *ENDPTR. */
-
-INT
-INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
- int base, int group LOCALE_PARAM_PROTO)
-{
- int negative;
- register unsigned LONG int cutoff;
- register unsigned int cutlim;
- register unsigned LONG int i;
- register const STRING_TYPE *s;
- register UCHAR_TYPE c;
- const STRING_TYPE *save, *end;
- int overflow;
-
-#ifdef USE_NUMBER_GROUPING
-# ifdef USE_IN_EXTENDED_LOCALE_MODEL
- struct locale_data *current = loc->__locales[LC_NUMERIC];
-# endif
- /* The thousands character of the current locale. */
- wchar_t thousands = L'\0';
- /* The numeric grouping specification of the current locale,
- in the format described in <locale.h>. */
- const char *grouping;
-
- if (group)
- {
- grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
- if (*grouping <= 0 || *grouping == CHAR_MAX)
- grouping = NULL;
- else
- {
- /* Figure out the thousands separator character. */
-# if defined _LIBC || defined _HAVE_BTOWC
- thousands = __btowc (*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP));
- if (thousands == WEOF)
- thousands = L'\0';
-# endif
- if (thousands == L'\0')
- grouping = NULL;
- }
- }
- else
- grouping = NULL;
-#endif
-
- if (base < 0 || base == 1 || base > 36)
- {
- __set_errno (EINVAL);
- return 0;
- }
-
- save = s = nptr;
-
- /* Skip white space. */
- while (ISSPACE (*s))
- ++s;
- if (*s == L_('\0'))
- goto noconv;
-
- /* Check for a sign. */
- if (*s == L_('-'))
- {
- negative = 1;
- ++s;
- }
- else if (*s == L_('+'))
- {
- negative = 0;
- ++s;
- }
- else
- negative = 0;
-
- /* Recognize number prefix and if BASE is zero, figure it out ourselves. */
- if (*s == L_('0'))
- {
- if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X'))
- {
- s += 2;
- base = 16;
- }
- else if (base == 0)
- base = 8;
- }
- else if (base == 0)
- base = 10;
-
- /* Save the pointer so we can check later if anything happened. */
- save = s;
-
-#ifdef USE_NUMBER_GROUPING
- if (group)
- {
- /* Find the end of the digit string and check its grouping. */
- end = s;
- for (c = *end; c != L_('\0'); c = *++end)
- if ((wchar_t) c != thousands
- && ((wchar_t) c < L_('0') || (wchar_t) c > L_('9'))
- && (!ISALPHA (c) || (int) (TOUPPER (c) - L_('A') + 10) >= base))
- break;
- if (*s == thousands)
- end = s;
- else
- end = correctly_grouped_prefix (s, end, thousands, grouping);
- }
- else
-#endif
- end = NULL;
-
- cutoff = STRTOL_ULONG_MAX / (unsigned LONG int) base;
- cutlim = STRTOL_ULONG_MAX % (unsigned LONG int) base;
-
- overflow = 0;
- i = 0;
- for (c = *s; c != L_('\0'); c = *++s)
- {
- if (s == end)
- break;
- if (c >= L_('0') && c <= L_('9'))
- c -= L_('0');
- else if (ISALPHA (c))
- c = TOUPPER (c) - L_('A') + 10;
- else
- break;
- if ((int) c >= base)
- break;
- /* Check for overflow. */
- if (i > cutoff || (i == cutoff && c > cutlim))
- overflow = 1;
- else
- {
- i *= (unsigned LONG int) base;
- i += c;
- }
- }
-
- /* Check if anything actually happened. */
- if (s == save)
- goto noconv;
-
- /* Store in ENDPTR the address of one character
- past the last character we converted. */
- if (endptr != NULL)
- *endptr = (STRING_TYPE *) s;
-
-#if !UNSIGNED
- /* Check for a value that is within the range of
- `unsigned LONG int', but outside the range of `LONG int'. */
- if (overflow == 0
- && i > (negative
- ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1
- : (unsigned LONG int) STRTOL_LONG_MAX))
- overflow = 1;
-#endif
-
- if (overflow)
- {
- __set_errno (ERANGE);
-#if UNSIGNED
- return STRTOL_ULONG_MAX;
-#else
- return negative ? STRTOL_LONG_MIN : STRTOL_LONG_MAX;
-#endif
- }
-
- /* Return the result of the appropriate sign. */
- return negative ? -i : i;
-
-noconv:
- /* We must handle a special case here: the base is 0 or 16 and the
- first two characters are '0' and 'x', but the rest are no
- hexadecimal digits. This is no error case. We return 0 and
- ENDPTR points to the `x`. */
- if (endptr != NULL)
- {
- if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X')
- && save[-2] == L_('0'))
- *endptr = (STRING_TYPE *) &save[-1];
- else
- /* There was no number to convert. */
- *endptr = (STRING_TYPE *) nptr;
- }
-
- return 0L;
-}
-\f
-/* External user entry point. */
-
-
-INT
-#ifdef weak_function
-weak_function
-#endif
-strtol (const STRING_TYPE *nptr, STRING_TYPE **endptr,
- int base LOCALE_PARAM_PROTO)
-{
- return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM);
-}
+++ /dev/null
-/* Copyright (C) 1991, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#define UNSIGNED 1
-
-#include "strtol.c"
+++ /dev/null
-/* Thread-local storage in multithreaded situations.
- Copyright (C) 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published
- by the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2005. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "tls.h"
-
-/* ========================================================================= */
-
-#if USE_POSIX_THREADS
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_PTH_THREADS
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_SOLARIS_THREADS
-
-/* Use the old Solaris threads library. */
-
-/* ------------------------- gl_tls_key_t datatype ------------------------- */
-
-void
-glthread_tls_get (thread_key_t key)
-{
- void *value;
-
- if (thr_getspecific (key, &value) != 0)
- abort ();
- return value;
-}
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_WIN32_THREADS
-
-#endif
-
-/* ========================================================================= */
+++ /dev/null
-/* Thread-local storage in multithreaded situations.
- Copyright (C) 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published
- by the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2005. */
-
-/* This file contains thread-local storage primitives for use with a given
- thread library. It does not contain primitives for creating threads or
- for other multithreading primitives.
-
- Type: gl_tls_key_t
- Initialization: gl_tls_key_init (name, destructor);
- Getting per-thread value: gl_tls_get (name)
- Setting per-thread value: gl_tls_set (name, pointer);
- De-initialization: gl_tls_key_destroy (name);
-
- A per-thread value is of type 'void *'.
-
- A destructor is a function pointer of type 'void (*) (void *)', called
- when a thread exits, and taking the last per-thread value as argument. It
- is unspecified whether the destructor function is called when the last
- per-thread value is NULL. On some platforms, the destructor function is
- not called at all.
-*/
-
-
-#ifndef _TLS_H
-#define _TLS_H
-
-/* ========================================================================= */
-
-#if USE_POSIX_THREADS
-
-/* Use the POSIX threads library. */
-
-# include <pthread.h>
-# include <stdlib.h>
-
-# if PTHREAD_IN_USE_DETECTION_HARD
-
-/* The pthread_in_use() detection needs to be done at runtime. */
-# define pthread_in_use() \
- glthread_in_use ()
-extern int glthread_in_use (void);
-
-# endif
-
-# if USE_POSIX_THREADS_WEAK
-
-/* Use weak references to the POSIX threads library. */
-
-# pragma weak pthread_key_create
-# pragma weak pthread_getspecific
-# pragma weak pthread_setspecific
-# pragma weak pthread_key_delete
-# ifndef pthread_self
-# pragma weak pthread_self
-# endif
-
-# if !PTHREAD_IN_USE_DETECTION_HARD
-# pragma weak pthread_cancel
-# define pthread_in_use() (pthread_cancel != NULL)
-# endif
-
-# else
-
-# if !PTHREAD_IN_USE_DETECTION_HARD
-# define pthread_in_use() 1
-# endif
-
-# endif
-
-/* ------------------------- gl_tls_key_t datatype ------------------------- */
-
-typedef union
- {
- void *singlethread_value;
- pthread_key_t key;
- }
- gl_tls_key_t;
-# define gl_tls_key_init(NAME, DESTRUCTOR) \
- do \
- { \
- if (pthread_in_use ()) \
- { \
- if (pthread_key_create (&(NAME).key, DESTRUCTOR) != 0) \
- abort (); \
- } \
- else \
- (NAME).singlethread_value = NULL; \
- } \
- while (0)
-# define gl_tls_get(NAME) \
- (pthread_in_use () \
- ? pthread_getspecific ((NAME).key) \
- : (NAME).singlethread_value)
-# define gl_tls_set(NAME, POINTER) \
- do \
- { \
- if (pthread_in_use ()) \
- { \
- if (pthread_setspecific ((NAME).key, (POINTER)) != 0) \
- abort (); \
- } \
- else \
- (NAME).singlethread_value = (POINTER); \
- } \
- while (0)
-# define gl_tls_key_destroy(NAME) \
- if (pthread_in_use () && pthread_key_delete ((NAME).key) != 0) \
- abort ()
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_PTH_THREADS
-
-/* Use the GNU Pth threads library. */
-
-# include <pth.h>
-# include <stdlib.h>
-
-# if USE_PTH_THREADS_WEAK
-
-/* Use weak references to the GNU Pth threads library. */
-
-# pragma weak pth_key_create
-# pragma weak pth_key_getdata
-# pragma weak pth_key_setdata
-# pragma weak pth_key_delete
-
-# pragma weak pth_cancel
-# define pth_in_use() (pth_cancel != NULL)
-
-# else
-
-# define pth_in_use() 1
-
-# endif
-
-/* ------------------------- gl_tls_key_t datatype ------------------------- */
-
-typedef union
- {
- void *singlethread_value;
- pth_key_t key;
- }
- gl_tls_key_t;
-# define gl_tls_key_init(NAME, DESTRUCTOR) \
- do \
- { \
- if (pth_in_use ()) \
- { \
- if (!pth_key_create (&(NAME).key, DESTRUCTOR)) \
- abort (); \
- } \
- else \
- (NAME).singlethread_value = NULL; \
- } \
- while (0)
-# define gl_tls_get(NAME) \
- (pth_in_use () \
- ? pth_key_getdata ((NAME).key) \
- : (NAME).singlethread_value)
-# define gl_tls_set(NAME, POINTER) \
- do \
- { \
- if (pth_in_use ()) \
- { \
- if (!pth_key_setdata ((NAME).key, (POINTER))) \
- abort (); \
- } \
- else \
- (NAME).singlethread_value = (POINTER); \
- } \
- while (0)
-# define gl_tls_key_destroy(NAME) \
- if (pth_in_use () && !pth_key_delete ((NAME).key)) \
- abort ()
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_SOLARIS_THREADS
-
-/* Use the old Solaris threads library. */
-
-# include <thread.h>
-# include <stdlib.h>
-
-# if USE_SOLARIS_THREADS_WEAK
-
-/* Use weak references to the old Solaris threads library. */
-
-# pragma weak thr_keycreate
-# pragma weak thr_getspecific
-# pragma weak thr_setspecific
-
-# pragma weak thr_suspend
-# define thread_in_use() (thr_suspend != NULL)
-
-# else
-
-# define thread_in_use() 1
-
-# endif
-
-/* ------------------------- gl_tls_key_t datatype ------------------------- */
-
-typedef union
- {
- void *singlethread_value;
- thread_key_t key;
- }
- gl_tls_key_t;
-# define gl_tls_key_init(NAME, DESTRUCTOR) \
- do \
- { \
- if (thread_in_use ()) \
- { \
- if (thr_keycreate (&(NAME).key, DESTRUCTOR) != 0) \
- abort (); \
- } \
- else \
- (NAME).singlethread_value = NULL; \
- } \
- while (0)
-# define gl_tls_get(NAME) \
- (thread_in_use () \
- ? glthread_tls_get ((NAME).key) \
- : (NAME).singlethread_value)
-extern void *glthread_tls_get (thread_key_t key);
-# define gl_tls_set(NAME, POINTER) \
- do \
- { \
- if (thread_in_use ()) \
- { \
- if (thr_setspecific ((NAME).key, (POINTER)) != 0) \
- abort (); \
- } \
- else \
- (NAME).singlethread_value = (POINTER); \
- } \
- while (0)
-# define gl_tls_key_destroy(NAME) \
- /* Unsupported. */ \
- (void)0
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_WIN32_THREADS
-
-# include <windows.h>
-
-/* ------------------------- gl_tls_key_t datatype ------------------------- */
-
-typedef DWORD gl_tls_key_t;
-# define gl_tls_key_init(NAME, DESTRUCTOR) \
- /* The destructor is unsupported. */ \
- if (((NAME) = TlsAlloc ()) == (DWORD)-1) \
- abort ()
-# define gl_tls_get(NAME) \
- TlsGetValue (NAME)
-# define gl_tls_set(NAME, POINTER) \
- if (!TlsSetValue (NAME, POINTER)) \
- abort ()
-# define gl_tls_key_destroy(NAME) \
- if (!TlsFree (NAME)) \
- abort ()
-
-#endif
-
-/* ========================================================================= */
-
-#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || USE_WIN32_THREADS)
-
-/* Provide dummy implementation if threads are not supported. */
-
-/* ------------------------- gl_tls_key_t datatype ------------------------- */
-
-typedef struct
- {
- void *singlethread_value;
- }
- gl_tls_key_t;
-# define gl_tls_key_init(NAME, DESTRUCTOR) \
- (NAME).singlethread_value = NULL
-# define gl_tls_get(NAME) \
- (NAME).singlethread_value
-# define gl_tls_set(NAME, POINTER) \
- (NAME).singlethread_value = (POINTER)
-# define gl_tls_key_destroy(NAME) \
- (void)0
-
-#endif
-
-/* ========================================================================= */
-
-#endif /* _TLS_H */
+++ /dev/null
-/* Copyright (C) 1999, 2001-2002, 2006 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 51 Franklin Street,
- Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Extracted from sysdeps/posix/tempname.c. */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-/* Specification. */
-#include "tmpdir.h"
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <errno.h>
-#ifndef __set_errno
-# define __set_errno(Val) errno = (Val)
-#endif
-
-#include <stdio.h>
-#ifndef P_tmpdir
-# define P_tmpdir "/tmp"
-#endif
-
-#include <sys/stat.h>
-#if !defined S_ISDIR && defined S_IFDIR
-# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
-#endif
-#if !S_IRUSR && S_IREAD
-# define S_IRUSR S_IREAD
-#endif
-#if !S_IRUSR
-# define S_IRUSR 00400
-#endif
-#if !S_IWUSR && S_IWRITE
-# define S_IWUSR S_IWRITE
-#endif
-#if !S_IWUSR
-# define S_IWUSR 00200
-#endif
-#if !S_IXUSR && S_IEXEC
-# define S_IXUSR S_IEXEC
-#endif
-#if !S_IXUSR
-# define S_IXUSR 00100
-#endif
-
-#if _LIBC
-# define struct_stat64 struct stat64
-#else
-# define struct_stat64 struct stat
-# define __xstat64(version, path, buf) stat (path, buf)
-#endif
-
-#if ! (HAVE___SECURE_GETENV || _LIBC)
-# define __secure_getenv getenv
-#endif
-
-/* Pathname support.
- ISSLASH(C) tests whether C is a directory separator character.
- */
-#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
- /* Win32, Cygwin, OS/2, DOS */
-# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-#else
- /* Unix */
-# define ISSLASH(C) ((C) == '/')
-#endif
-
-
-/* Return nonzero if DIR is an existent directory. */
-static bool
-direxists (const char *dir)
-{
- struct_stat64 buf;
- return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode);
-}
-
-/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is
- non-null and exists, uses it; otherwise uses the first of $TMPDIR,
- P_tmpdir, /tmp that exists. Copies into TMPL a template suitable
- for use with mk[s]temp. Will fail (-1) if DIR is non-null and
- doesn't exist, none of the searched dirs exists, or there's not
- enough space in TMPL. */
-int
-path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
- bool try_tmpdir)
-{
- const char *d;
- size_t dlen, plen;
-
- if (!pfx || !pfx[0])
- {
- pfx = "file";
- plen = 4;
- }
- else
- {
- plen = strlen (pfx);
- if (plen > 5)
- plen = 5;
- }
-
- if (try_tmpdir)
- {
- d = __secure_getenv ("TMPDIR");
- if (d != NULL && direxists (d))
- dir = d;
- else if (dir != NULL && direxists (dir))
- /* nothing */ ;
- else
- dir = NULL;
- }
- if (dir == NULL)
- {
- if (direxists (P_tmpdir))
- dir = P_tmpdir;
- else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
- dir = "/tmp";
- else
- {
- __set_errno (ENOENT);
- return -1;
- }
- }
-
- dlen = strlen (dir);
- while (dlen >= 1 && ISSLASH (dir[dlen - 1]))
- dlen--; /* remove trailing slashes */
-
- /* check we have room for "${dir}/${pfx}XXXXXX\0" */
- if (tmpl_len < dlen + 1 + plen + 6 + 1)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
- return 0;
-}
+++ /dev/null
-/* Determine a temporary directory.
- Copyright (C) 2001-2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#include <stdbool.h>
-#include <stddef.h>
-
-/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is
- non-null and exists, uses it; otherwise uses the first of $TMPDIR,
- P_tmpdir, /tmp that exists. Copies into TMPL a template suitable
- for use with mk[s]temp. Will fail (-1) if DIR is non-null and
- doesn't exist, none of the searched dirs exists, or there's not
- enough space in TMPL. */
-extern int path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, bool try_tmpdir);
+++ /dev/null
-/* Conversion UCS-4 to UTF-16.
- Copyright (C) 2002 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2002.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation,
-Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-#include <stddef.h>
-
-/* Return the length (number of units) of the UTF-16 representation of uc,
- after storing it at S. Return -1 upon failure, -2 if the number of
- available units, N, is too small. */
-static int
-u16_uctomb_aux (unsigned short *s, unsigned int uc, int n)
-{
- if (uc >= 0x10000)
- {
- if (uc < 0x110000)
- {
- if (n >= 2)
- {
- s[0] = 0xd800 + ((uc - 0x10000) >> 10);
- s[1] = 0xdc00 + ((uc - 0x10000) & 0x3ff);
- return 2;
- }
- }
- else
- return -1;
- }
- return -2;
-}
-
-static inline int
-u16_uctomb (unsigned short *s, unsigned int uc, int n)
-{
- if (uc < 0x10000 && n > 0)
- {
- s[0] = uc;
- return 1;
- }
- else
- return u16_uctomb_aux (s, uc, n);
-}
+++ /dev/null
-/* Conversion UCS-4 to UTF-8.
- Copyright (C) 2002 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2002.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation,
-Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-#include <stddef.h>
-
-/* Return the length (number of units) of the UTF-8 representation of uc,
- after storing it at S. Return -1 upon failure, -2 if the number of
- available units, N, is too small. */
-static int
-u8_uctomb_aux (unsigned char *s, unsigned int uc, int n)
-{
- int count;
-
- if (uc < 0x80)
- count = 1;
- else if (uc < 0x800)
- count = 2;
- else if (uc < 0x10000)
- count = 3;
-#if 0
- else if (uc < 0x200000)
- count = 4;
- else if (uc < 0x4000000)
- count = 5;
- else if (uc <= 0x7fffffff)
- count = 6;
-#else
- else if (uc < 0x110000)
- count = 4;
-#endif
- else
- return -1;
-
- if (n < count)
- return -2;
-
- switch (count) /* note: code falls through cases! */
- {
-#if 0
- case 6: s[5] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x4000000;
- case 5: s[4] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x200000;
-#endif
- case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000;
- case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800;
- case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0;
- case 1: s[0] = uc;
- }
- return count;
-}
-
-static inline int
-u8_uctomb (unsigned char *s, unsigned int uc, int n)
-{
- if (uc < 0x80 && n > 0)
- {
- s[0] = uc;
- return 1;
- }
- else
- return u8_uctomb_aux (s, uc, n);
-}
+++ /dev/null
-/* Prefer faster, non-thread-safe stdio functions if available.
-
- Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Written by Jim Meyering. */
-
-#ifndef UNLOCKED_IO_H
-#define UNLOCKED_IO_H 1
-
-/* These are wrappers for functions/macros from the GNU C library, and
- from other C libraries supporting POSIX's optional thread-safe functions.
-
- The standard I/O functions are thread-safe. These *_unlocked ones are
- more efficient but not thread-safe. That they're not thread-safe is
- fine since all of the applications in this package are single threaded.
-
- Also, some code that is shared with the GNU C library may invoke
- the *_unlocked functions directly. On hosts that lack those
- functions, invoke the non-thread-safe versions instead. */
-
-#include <stdio.h>
-
-#if HAVE_DECL_CLEARERR_UNLOCKED
-# undef clearerr
-# define clearerr(x) clearerr_unlocked (x)
-#else
-# define clearerr_unlocked(x) clearerr (x)
-#endif
-
-#if HAVE_DECL_FEOF_UNLOCKED
-# undef feof
-# define feof(x) feof_unlocked (x)
-#else
-# define feof_unlocked(x) feof (x)
-#endif
-
-#if HAVE_DECL_FERROR_UNLOCKED
-# undef ferror
-# define ferror(x) ferror_unlocked (x)
-#else
-# define ferror_unlocked(x) ferror (x)
-#endif
-
-#if HAVE_DECL_FFLUSH_UNLOCKED
-# undef fflush
-# define fflush(x) fflush_unlocked (x)
-#else
-# define fflush_unlocked(x) fflush (x)
-#endif
-
-#if HAVE_DECL_FGETS_UNLOCKED
-# undef fgets
-# define fgets(x,y,z) fgets_unlocked (x,y,z)
-#else
-# define fgets_unlocked(x,y,z) fgets (x,y,z)
-#endif
-
-#if HAVE_DECL_FPUTC_UNLOCKED
-# undef fputc
-# define fputc(x,y) fputc_unlocked (x,y)
-#else
-# define fputc_unlocked(x,y) fputc (x,y)
-#endif
-
-#if HAVE_DECL_FPUTS_UNLOCKED
-# undef fputs
-# define fputs(x,y) fputs_unlocked (x,y)
-#else
-# define fputs_unlocked(x,y) fputs (x,y)
-#endif
-
-#if HAVE_DECL_FREAD_UNLOCKED
-# undef fread
-# define fread(w,x,y,z) fread_unlocked (w,x,y,z)
-#else
-# define fread_unlocked(w,x,y,z) fread (w,x,y,z)
-#endif
-
-#if HAVE_DECL_FWRITE_UNLOCKED
-# undef fwrite
-# define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z)
-#else
-# define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
-#endif
-
-#if HAVE_DECL_GETC_UNLOCKED
-# undef getc
-# define getc(x) getc_unlocked (x)
-#else
-# define getc_unlocked(x) getc (x)
-#endif
-
-#if HAVE_DECL_GETCHAR_UNLOCKED
-# undef getchar
-# define getchar() getchar_unlocked ()
-#else
-# define getchar_unlocked() getchar ()
-#endif
-
-#if HAVE_DECL_PUTC_UNLOCKED
-# undef putc
-# define putc(x,y) putc_unlocked (x,y)
-#else
-# define putc_unlocked(x,y) putc (x,y)
-#endif
-
-#if HAVE_DECL_PUTCHAR_UNLOCKED
-# undef putchar
-# define putchar(x) putchar_unlocked (x)
-#else
-# define putchar_unlocked(x) putchar (x)
-#endif
-
-#undef flockfile
-#define flockfile(x) ((void) 0)
-
-#undef ftrylockfile
-#define ftrylockfile(x) 0
-
-#undef funlockfile
-#define funlockfile(x) ((void) 0)
-
-#endif /* UNLOCKED_IO_H */
+++ /dev/null
-/* Copyright (C) 1992,1995-1999,2000-2002,2005-2006 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 51 Franklin Street,
- Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <errno.h>
-#if !_LIBC
-# define __set_errno(ev) ((errno) = (ev))
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#if !_LIBC
-# define __environ environ
-# ifndef HAVE_ENVIRON_DECL
-extern char **environ;
-# endif
-#endif
-
-#if _LIBC
-/* This lock protects against simultaneous modifications of `environ'. */
-# include <bits/libc-lock.h>
-__libc_lock_define_initialized (static, envlock)
-# define LOCK __libc_lock_lock (envlock)
-# define UNLOCK __libc_lock_unlock (envlock)
-#else
-# define LOCK
-# define UNLOCK
-#endif
-
-/* In the GNU C library we must keep the namespace clean. */
-#ifdef _LIBC
-# define unsetenv __unsetenv
-#endif
-
-
-int
-unsetenv (const char *name)
-{
- size_t len;
- char **ep;
-
- if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- len = strlen (name);
-
- LOCK;
-
- ep = __environ;
- while (*ep != NULL)
- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
- {
- /* Found it. Remove this pointer by moving later ones back. */
- char **dp = ep;
-
- do
- dp[0] = dp[1];
- while (*dp++);
- /* Continue the loop in case NAME appears again. */
- }
- else
- ++ep;
-
- UNLOCK;
-
- return 0;
-}
-
-#ifdef _LIBC
-# undef unsetenv
-weak_alias (__unsetenv, unsetenv)
-#endif
+++ /dev/null
-/* Conversion UTF-16 to UCS-4.
- Copyright (C) 2001-2002 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation,
-Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-#include <stddef.h>
-
-/* Return the length (number of units) of the first character in S, putting
- its 'ucs4_t' representation in *PUC. */
-static int
-u16_mbtouc_aux (unsigned int *puc, const unsigned short *s, size_t n)
-{
- unsigned short c = *s;
-
- if (c < 0xdc00)
- {
- if (n >= 2)
- {
- if (s[1] >= 0xdc00 && s[1] < 0xe000)
- {
- *puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00);
- return 2;
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return n;
- }
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 1;
-}
-static inline int
-u16_mbtouc (unsigned int *puc, const unsigned short *s, size_t n)
-{
- unsigned short c = *s;
-
- if (c < 0xd800 || c >= 0xe000)
- {
- *puc = c;
- return 1;
- }
- else
- return u16_mbtouc_aux (puc, s, n);
-}
+++ /dev/null
-/* Conversion UTF-8 to UCS-4.
- Copyright (C) 2001-2002 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation,
-Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-#include <stddef.h>
-
-/* Return the length (number of units) of the first character in S, putting
- its 'ucs4_t' representation in *PUC. */
-static int
-u8_mbtouc_aux (unsigned int *puc, const unsigned char *s, size_t n)
-{
- unsigned char c = *s;
-
- if (c >= 0xc2)
- {
- if (c < 0xe0)
- {
- if (n >= 2)
- {
- if ((s[1] ^ 0x80) < 0x40)
- {
- *puc = ((unsigned int) (c & 0x1f) << 6)
- | (unsigned int) (s[1] ^ 0x80);
- return 2;
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return n;
- }
- }
- else if (c < 0xf0)
- {
- if (n >= 3)
- {
- if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
- && (c >= 0xe1 || s[1] >= 0xa0))
- {
- *puc = ((unsigned int) (c & 0x0f) << 12)
- | ((unsigned int) (s[1] ^ 0x80) << 6)
- | (unsigned int) (s[2] ^ 0x80);
- return 3;
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return n;
- }
- }
- else if (c < 0xf8)
- {
- if (n >= 4)
- {
- if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
- && (s[3] ^ 0x80) < 0x40
- && (c >= 0xf1 || s[1] >= 0x90)
-#if 1
- && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
-#endif
- )
- {
- *puc = ((unsigned int) (c & 0x07) << 18)
- | ((unsigned int) (s[1] ^ 0x80) << 12)
- | ((unsigned int) (s[2] ^ 0x80) << 6)
- | (unsigned int) (s[3] ^ 0x80);
- return 4;
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return n;
- }
- }
-#if 0
- else if (c < 0xfc)
- {
- if (n >= 5)
- {
- if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
- && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
- && (c >= 0xf9 || s[1] >= 0x88))
- {
- *puc = ((unsigned int) (c & 0x03) << 24)
- | ((unsigned int) (s[1] ^ 0x80) << 18)
- | ((unsigned int) (s[2] ^ 0x80) << 12)
- | ((unsigned int) (s[3] ^ 0x80) << 6)
- | (unsigned int) (s[4] ^ 0x80);
- return 5;
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return n;
- }
- }
- else if (c < 0xfe)
- {
- if (n >= 6)
- {
- if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
- && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
- && (s[5] ^ 0x80) < 0x40
- && (c >= 0xfd || s[1] >= 0x84))
- {
- *puc = ((unsigned int) (c & 0x01) << 30)
- | ((unsigned int) (s[1] ^ 0x80) << 24)
- | ((unsigned int) (s[2] ^ 0x80) << 18)
- | ((unsigned int) (s[3] ^ 0x80) << 12)
- | ((unsigned int) (s[4] ^ 0x80) << 6)
- | (unsigned int) (s[5] ^ 0x80);
- return 6;
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return n;
- }
- }
-#endif
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 1;
-}
-static inline int
-u8_mbtouc (unsigned int *puc, const unsigned char *s, size_t n)
-{
- unsigned char c = *s;
-
- if (c < 0x80)
- {
- *puc = c;
- return 1;
- }
- else
- return u8_mbtouc_aux (puc, s, n);
-}
+++ /dev/null
-/* vsprintf with automatic memory allocation.
- Copyright (C) 2002-2003 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _VASPRINTF_H
-#define _VASPRINTF_H
-
-#if HAVE_VASPRINTF
-
-/* Get asprintf(), vasprintf() declarations. */
-#include <stdio.h>
-
-#else
-
-/* Get va_list. */
-#include <stdarg.h>
-
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
-# define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-# define __format__ format
-# define __printf__ printf
-# endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Write formatted output to a string dynamically allocated with malloc().
- If the memory allocation succeeds, store the address of the string in
- *RESULT and return the number of resulting bytes, excluding the trailing
- NUL. Upon memory allocation error, or some other error, return -1. */
-extern int asprintf (char **result, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)));
-extern int vasprintf (char **result, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-#endif /* _VASPRINTF_H */
+++ /dev/null
-/* Compile-time assert-like macros.
-
- Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */
-
-#ifndef VERIFY_H
-# define VERIFY_H 1
-
-/* Each of these macros verifies that its argument R is nonzero. To
- be portable, R should be an integer constant expression. Unlike
- assert (R), there is no run-time overhead.
-
- There are two macros, since no single macro can be used in all
- contexts in C. verify_true (R) is for scalar contexts, including
- integer constant expression contexts. verify (R) is for declaration
- contexts, e.g., the top level.
-
- Symbols ending in "__" are private to this header.
-
- The code below uses several ideas.
-
- * The first step is ((R) ? 1 : -1). Given an expression R, of
- integral or boolean or floating-point type, this yields an
- expression of integral type, whose value is later verified to be
- constant and nonnegative.
-
- * Next this expression W is wrapped in a type
- struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }.
- If W is negative, this yields a compile-time error. No compiler can
- deal with a bit-field of negative size.
-
- One might think that an array size check would have the same
- effect, that is, that the type struct { unsigned int dummy[W]; }
- would work as well. However, inside a function, some compilers
- (such as C++ compilers and GNU C) allow local parameters and
- variables inside array size expressions. With these compilers,
- an array size check would not properly diagnose this misuse of
- the verify macro:
-
- void function (int n) { verify (n < 0); }
-
- * For the verify macro, the struct verify_type__ will need to
- somehow be embedded into a declaration. To be portable, this
- declaration must declare an object, a constant, a function, or a
- typedef name. If the declared entity uses the type directly,
- such as in
-
- struct dummy {...};
- typedef struct {...} dummy;
- extern struct {...} *dummy;
- extern void dummy (struct {...} *);
- extern struct {...} *dummy (void);
-
- two uses of the verify macro would yield colliding declarations
- if the entity names are not disambiguated. A workaround is to
- attach the current line number to the entity name:
-
- #define GL_CONCAT0(x, y) x##y
- #define GL_CONCAT(x, y) GL_CONCAT0 (x, y)
- extern struct {...} * GL_CONCAT(dummy,__LINE__);
-
- But this has the problem that two invocations of verify from
- within the same macro would collide, since the __LINE__ value
- would be the same for both invocations.
-
- A solution is to use the sizeof operator. It yields a number,
- getting rid of the identity of the type. Declarations like
-
- extern int dummy [sizeof (struct {...})];
- extern void dummy (int [sizeof (struct {...})]);
- extern int (*dummy (void)) [sizeof (struct {...})];
-
- can be repeated.
-
- * Should the implementation use a named struct or an unnamed struct?
- Which of the following alternatives can be used?
-
- extern int dummy [sizeof (struct {...})];
- extern int dummy [sizeof (struct verify_type__ {...})];
- extern void dummy (int [sizeof (struct {...})]);
- extern void dummy (int [sizeof (struct verify_type__ {...})]);
- extern int (*dummy (void)) [sizeof (struct {...})];
- extern int (*dummy (void)) [sizeof (struct verify_type__ {...})];
-
- In the second and sixth case, the struct type is exported to the
- outer scope; two such declarations therefore collide. GCC warns
- about the first, third, and fourth cases. So the only remaining
- possibility is the fifth case:
-
- extern int (*dummy (void)) [sizeof (struct {...})];
-
- * This implementation exploits the fact that GCC does not warn about
- the last declaration mentioned above. If a future version of GCC
- introduces a warning for this, the problem could be worked around
- by using code specialized to GCC, e.g.,:
-
- #if 4 <= __GNUC__
- # define verify(R) \
- extern int (* verify_function__ (void)) \
- [__builtin_constant_p (R) && (R) ? 1 : -1]
- #endif
-
- * In C++, any struct definition inside sizeof is invalid.
- Use a template type to work around the problem. */
-
-
-/* Verify requirement R at compile-time, as an integer constant expression.
- Return 1. */
-
-# ifdef __cplusplus
-template <int w>
- struct verify_type__ { unsigned int verify_error_if_negative_size__: w; };
-# define verify_true(R) \
- (!!sizeof (verify_type__<(R) ? 1 : -1>))
-# else
-# define verify_true(R) \
- (!!sizeof \
- (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; }))
-# endif
-
-/* Verify requirement R at compile-time, as a declaration without a
- trailing ';'. */
-
-# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)]
-
-#endif
+++ /dev/null
-/* Auxiliary functions for the creation of subprocesses. Native Woe32 API.
- Copyright (C) 2003 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Get declarations of the Win32 API functions. */
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-/* Get _get_osfhandle() and _open_osfhandle(). */
-#include <io.h>
-
-#include <stdbool.h>
-#include <errno.h>
-
-#include "strpbrk.h"
-#include "xalloc.h"
-
-/* Duplicates a file handle, making the copy uninheritable. */
-static int
-dup_noinherit (int fd)
-{
- HANDLE curr_process = GetCurrentProcess ();
- HANDLE old_handle = (HANDLE) _get_osfhandle (fd);
- HANDLE new_handle;
- int nfd;
-
- if (!DuplicateHandle (curr_process, /* SourceProcessHandle */
- old_handle, /* SourceHandle */
- curr_process, /* TargetProcessHandle */
- (PHANDLE) &new_handle, /* TargetHandle */
- (DWORD) 0, /* DesiredAccess */
- FALSE, /* InheritHandle */
- DUPLICATE_SAME_ACCESS)) /* Options */
- error (EXIT_FAILURE, 0, _("DuplicateHandle failed with error code 0x%08x"),
- GetLastError ());
-
- nfd = _open_osfhandle ((long) new_handle, O_BINARY);
- if (nfd < 0)
- error (EXIT_FAILURE, errno, _("_open_osfhandle failed"));
-
- return nfd;
-}
-
-/* Prepares an argument vector before calling spawn().
- Note that spawn() does not by itself call the command interpreter
- (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
- ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&v);
- v.dwPlatformId == VER_PLATFORM_WIN32_NT;
- }) ? "cmd.exe" : "command.com").
- Instead it simply concatenates the arguments, separated by ' ', and calls
- CreateProcess(). We must quote the arguments since Win32 CreateProcess()
- interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
- special way:
- - Space and tab are interpreted as delimiters. They are not treated as
- delimiters if they are surrounded by double quotes: "...".
- - Unescaped double quotes are removed from the input. Their only effect is
- that within double quotes, space and tab are treated like normal
- characters.
- - Backslashes not followed by double quotes are not special.
- - But 2*n+1 backslashes followed by a double quote become
- n backslashes followed by a double quote (n >= 0):
- \" -> "
- \\\" -> \"
- \\\\\" -> \\"
- */
-#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
-#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
-static char **
-prepare_spawn (char **argv)
-{
- size_t argc;
- char **new_argv;
- size_t i;
-
- /* Count number of arguments. */
- for (argc = 0; argv[argc] != NULL; argc++)
- ;
-
- /* Allocate new argument vector. */
- new_argv = (char **) xmalloc ((argc + 1) * sizeof (char *));
-
- /* Put quoted arguments into the new argument vector. */
- for (i = 0; i < argc; i++)
- {
- const char *string = argv[i];
-
- if (string[0] == '\0')
- new_argv[i] = xstrdup ("\"\"");
- else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
- {
- bool quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
- size_t length;
- unsigned int backslashes;
- const char *s;
- char *quoted_string;
- char *p;
-
- length = 0;
- backslashes = 0;
- if (quote_around)
- length++;
- for (s = string; *s != '\0'; s++)
- {
- char c = *s;
- if (c == '"')
- length += backslashes + 1;
- length++;
- if (c == '\\')
- backslashes++;
- else
- backslashes = 0;
- }
- if (quote_around)
- length += backslashes + 1;
-
- quoted_string = (char *) xmalloc (length + 1);
-
- p = quoted_string;
- backslashes = 0;
- if (quote_around)
- *p++ = '"';
- for (s = string; *s != '\0'; s++)
- {
- char c = *s;
- if (c == '"')
- {
- unsigned int j;
- for (j = backslashes + 1; j > 0; j--)
- *p++ = '\\';
- }
- *p++ = c;
- if (c == '\\')
- backslashes++;
- else
- backslashes = 0;
- }
- if (quote_around)
- {
- unsigned int j;
- for (j = backslashes; j > 0; j--)
- *p++ = '\\';
- *p++ = '"';
- }
- *p = '\0';
-
- new_argv[i] = quoted_string;
- }
- else
- new_argv[i] = (char *) string;
- }
- new_argv[argc] = NULL;
-
- return new_argv;
-}
+++ /dev/null
-/* Waiting for a subprocess to finish.
- Copyright (C) 2001-2003, 2005 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "wait-process.h"
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-
-#if defined _MSC_VER || defined __MINGW32__
-
-/* Native Woe32 API. */
-#include <process.h>
-#define waitpid(pid,statusp,options) _cwait (statusp, pid, WAIT_CHILD)
-#define WAIT_T int
-#define WTERMSIG(x) ((x) & 0xff) /* or: SIGABRT ?? */
-#define WCOREDUMP(x) 0
-#define WEXITSTATUS(x) (((x) >> 8) & 0xff) /* or: (x) ?? */
-#define WIFSIGNALED(x) (WTERMSIG (x) != 0) /* or: ((x) == 3) ?? */
-#define WIFEXITED(x) (WTERMSIG (x) == 0) /* or: ((x) != 3) ?? */
-#define WIFSTOPPED(x) 0
-
-#else
-
-/* Unix API. */
-#include <sys/wait.h>
-/* On Linux, WEXITSTATUS are bits 15..8 and WTERMSIG are bits 7..0, while
- BeOS uses the contrary. Therefore we use the abstract macros. */
-#if HAVE_UNION_WAIT
-# define WAIT_T union wait
-# ifndef WTERMSIG
-# define WTERMSIG(x) ((x).w_termsig)
-# endif
-# ifndef WCOREDUMP
-# define WCOREDUMP(x) ((x).w_coredump)
-# endif
-# ifndef WEXITSTATUS
-# define WEXITSTATUS(x) ((x).w_retcode)
-# endif
-#else
-# define WAIT_T int
-# ifndef WTERMSIG
-# define WTERMSIG(x) ((x) & 0x7f)
-# endif
-# ifndef WCOREDUMP
-# define WCOREDUMP(x) ((x) & 0x80)
-# endif
-# ifndef WEXITSTATUS
-# define WEXITSTATUS(x) (((x) >> 8) & 0xff)
-# endif
-#endif
-/* For valid x, exactly one of WIFSIGNALED(x), WIFEXITED(x), WIFSTOPPED(x)
- is true. */
-#ifndef WIFSIGNALED
-# define WIFSIGNALED(x) (WTERMSIG (x) != 0 && WTERMSIG(x) != 0x7f)
-#endif
-#ifndef WIFEXITED
-# define WIFEXITED(x) (WTERMSIG (x) == 0)
-#endif
-#ifndef WIFSTOPPED
-# define WIFSTOPPED(x) (WTERMSIG (x) == 0x7f)
-#endif
-/* Note that portable applications may access
- WTERMSIG(x) only if WIFSIGNALED(x) is true, and
- WEXITSTATUS(x) only if WIFEXITED(x) is true. */
-
-#endif
-
-#include "error.h"
-#include "exit.h"
-#include "fatal-signal.h"
-#include "xalloc.h"
-#include "gettext.h"
-
-#define _(str) gettext (str)
-
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
-
-#if defined _MSC_VER || defined __MINGW32__
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-/* The return value of spawnvp() is really a process handle as returned
- by CreateProcess(). Therefore we can kill it using TerminateProcess. */
-#define kill(pid,sig) TerminateProcess ((HANDLE) (pid), sig)
-
-#endif
-
-
-/* Type of an entry in the slaves array.
- The 'used' bit determines whether this entry is currently in use.
- (If pid_t was an atomic type like sig_atomic_t, we could just set the
- 'child' field to 0 when unregistering a slave process, and wouldn't need
- the 'used' field.)
- The 'used' and 'child' fields are accessed from within the cleanup_slaves()
- action, therefore we mark them as 'volatile'. */
-typedef struct
-{
- volatile sig_atomic_t used;
- volatile pid_t child;
-}
-slaves_entry_t;
-
-/* The registered slave subprocesses. */
-static slaves_entry_t static_slaves[32];
-static slaves_entry_t * volatile slaves = static_slaves;
-static sig_atomic_t volatile slaves_count = 0;
-static size_t slaves_allocated = SIZEOF (static_slaves);
-
-/* The termination signal for slave subprocesses.
- 2003-10-07: Terminator becomes Governator. */
-#ifdef SIGHUP
-# define TERMINATOR SIGHUP
-#else
-# define TERMINATOR SIGTERM
-#endif
-
-/* The cleanup action. It gets called asynchronously. */
-static void
-cleanup_slaves (void)
-{
- for (;;)
- {
- /* Get the last registered slave. */
- size_t n = slaves_count;
- if (n == 0)
- break;
- n--;
- slaves_count = n;
- /* Skip unused entries in the slaves array. */
- if (slaves[n].used)
- {
- pid_t slave = slaves[n].child;
-
- /* Kill the slave. */
- kill (slave, TERMINATOR);
- }
- }
-}
-
-/* Register a subprocess as being a slave process. This means that the
- subprocess will be terminated when its creator receives a catchable fatal
- signal or exits normally. Registration ends when wait_subprocess()
- notices that the subprocess has exited. */
-void
-register_slave_subprocess (pid_t child)
-{
- static bool cleanup_slaves_registered = false;
- if (!cleanup_slaves_registered)
- {
- atexit (cleanup_slaves);
- at_fatal_signal (cleanup_slaves);
- cleanup_slaves_registered = true;
- }
-
- /* Try to store the new slave in an unused entry of the slaves array. */
- {
- slaves_entry_t *s = slaves;
- slaves_entry_t *s_end = s + slaves_count;
-
- for (; s < s_end; s++)
- if (!s->used)
- {
- /* The two uses of 'volatile' in the slaves_entry_t type above
- (and ISO C 99 section 5.1.2.3.(5)) ensure that we mark the
- entry as used only after the child pid has been written to the
- memory location s->child. */
- s->child = child;
- s->used = 1;
- return;
- }
- }
-
- if (slaves_count == slaves_allocated)
- {
- /* Extend the slaves array. Note that we cannot use xrealloc(),
- because then the cleanup_slaves() function could access an already
- deallocated array. */
- slaves_entry_t *old_slaves = slaves;
- size_t new_slaves_allocated = 2 * slaves_allocated;
- slaves_entry_t *new_slaves =
- malloc (new_slaves_allocated * sizeof (slaves_entry_t));
- if (new_slaves == NULL)
- {
- /* xalloc_die() will call exit() which will invoke cleanup_slaves().
- Additionally we need to kill child, because it's not yet among
- the slaves list. */
- kill (child, TERMINATOR);
- xalloc_die ();
- }
- memcpy (new_slaves, old_slaves,
- slaves_allocated * sizeof (slaves_entry_t));
- slaves = new_slaves;
- slaves_allocated = new_slaves_allocated;
- /* Now we can free the old slaves array. */
- if (old_slaves != static_slaves)
- free (old_slaves);
- }
- /* The three uses of 'volatile' in the types above (and ISO C 99 section
- 5.1.2.3.(5)) ensure that we increment the slaves_count only after the
- new slave and its 'used' bit have been written to the memory locations
- that make up slaves[slaves_count]. */
- slaves[slaves_count].child = child;
- slaves[slaves_count].used = 1;
- slaves_count++;
-}
-
-/* Unregister a child from the list of slave subprocesses. */
-static inline void
-unregister_slave_subprocess (pid_t child)
-{
- /* The easiest way to remove an entry from a list that can be used by
- an asynchronous signal handler is just to mark it as unused. For this,
- we rely on sig_atomic_t. */
- slaves_entry_t *s = slaves;
- slaves_entry_t *s_end = s + slaves_count;
-
- for (; s < s_end; s++)
- if (s->used && s->child == child)
- s->used = 0;
-}
-
-
-/* Wait for a subprocess to finish. Return its exit code.
- If it didn't terminate correctly, exit if exit_on_error is true, otherwise
- return 127. */
-int
-wait_subprocess (pid_t child, const char *progname,
- bool ignore_sigpipe, bool null_stderr,
- bool slave_process, bool exit_on_error)
-{
-#if HAVE_WAITID && defined WNOWAIT && 0
- /* Commented out because waitid() with WNOWAIT doesn't work: On Solaris 7
- and OSF/1 4.0, it returns -1 and sets errno = ECHILD, and on HP-UX 10.20
- it just hangs. */
- /* Use of waitid() with WNOWAIT avoids a race condition: If slave_process is
- true, and this process sleeps a very long time between the return from
- waitpid() and the execution of unregister_slave_subprocess(), and
- meanwhile another process acquires the same PID as child, and then - still
- before unregister_slave_subprocess() - this process gets a fatal signal,
- it would kill the other totally unrelated process. */
- siginfo_t info;
- for (;;)
- {
- if (waitid (P_PID, child, &info, slave_process ? WNOWAIT : 0) < 0)
- {
-# ifdef EINTR
- if (errno == EINTR)
- continue;
-# endif
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, errno,
- _("%s subprocess"), progname);
- return 127;
- }
-
- /* info.si_code is set to one of CLD_EXITED, CLD_KILLED, CLD_DUMPED,
- CLD_TRAPPED, CLD_STOPPED, CLD_CONTINUED. Loop until the program
- terminates. */
- if (info.si_code == CLD_EXITED
- || info.si_code == CLD_KILLED || info.si_code == CLD_DUMPED)
- break;
- }
-
- /* The child process has exited or was signalled. */
-
- if (slave_process)
- {
- /* Unregister the child from the list of slave subprocesses, so that
- later, when we exit, we don't kill a totally unrelated process which
- may have acquired the same pid. */
- unregister_slave_subprocess (child);
-
- /* Now remove the zombie from the process list. */
- for (;;)
- {
- if (waitid (P_PID, child, &info, 0) < 0)
- {
-# ifdef EINTR
- if (errno == EINTR)
- continue;
-# endif
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, errno,
- _("%s subprocess"), progname);
- return 127;
- }
- break;
- }
- }
-
- switch (info.si_code)
- {
- case CLD_KILLED:
- case CLD_DUMPED:
-# ifdef SIGPIPE
- if (info.si_status == SIGPIPE && ignore_sigpipe)
- return 0;
-# endif
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, 0,
- _("%s subprocess got fatal signal %d"),
- progname, info.si_status);
- return 127;
- case CLD_EXITED:
- if (info.si_status == 127)
- {
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, 0,
- _("%s subprocess failed"), progname);
- return 127;
- }
- return info.si_status;
- default:
- abort ();
- }
-#else
- /* waitpid() is just as portable as wait() nowadays. */
- WAIT_T status;
-
- *(int *) &status = 0;
- for (;;)
- {
- int result = waitpid (child, &status, 0);
-
- if (result != child)
- {
-# ifdef EINTR
- if (errno == EINTR)
- continue;
-# endif
-# if 0 /* defined ECHILD */
- if (errno == ECHILD)
- {
- /* Child process nonexistent?! Assume it terminated
- successfully. */
- *(int *) &status = 0;
- break;
- }
-# endif
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, errno,
- _("%s subprocess"), progname);
- return 127;
- }
-
- /* One of WIFSIGNALED (status), WIFEXITED (status), WIFSTOPPED (status)
- must always be true. Loop until the program terminates. */
- if (!WIFSTOPPED (status))
- break;
- }
-
- /* The child process has exited or was signalled. */
-
- if (slave_process)
- /* Unregister the child from the list of slave subprocesses, so that
- later, when we exit, we don't kill a totally unrelated process which
- may have acquired the same pid. */
- unregister_slave_subprocess (child);
-
- if (WIFSIGNALED (status))
- {
-# ifdef SIGPIPE
- if (WTERMSIG (status) == SIGPIPE && ignore_sigpipe)
- return 0;
-# endif
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, 0,
- _("%s subprocess got fatal signal %d"),
- progname, (int) WTERMSIG (status));
- return 127;
- }
- if (WEXITSTATUS (status) == 127)
- {
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, 0,
- _("%s subprocess failed"), progname);
- return 127;
- }
- return WEXITSTATUS (status);
-#endif
-}
+++ /dev/null
-/* Waiting for a subprocess to finish.
- Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _WAIT_PROCESS_H
-#define _WAIT_PROCESS_H
-
-/* Get pid_t. */
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-#include <stdbool.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Wait for a subprocess to finish. Return its exit code.
- If it didn't terminate correctly, exit if exit_on_error is true, otherwise
- return 127.
- Arguments:
- - child is the pid of the subprocess.
- - progname is the name of the program executed by the subprocess, used for
- error messages.
- - If ignore_sigpipe is true, consider a subprocess termination due to
- SIGPIPE as equivalent to a success. This is suitable for processes whose
- only purpose is to write to standard output. This flag can be safely set
- to false when the process' standard output is known to go to DEV_NULL.
- - If null_stderr is true, the usual error message to stderr will be omitted.
- This is suitable when the subprocess does not fulfill an important task.
- - slave_process should be set to true if the process has been launched as a
- slave process.
- - If exit_on_error is true, any error will cause the main process to exit
- with an error status. */
-extern int wait_subprocess (pid_t child, const char *progname,
- bool ignore_sigpipe, bool null_stderr,
- bool slave_process, bool exit_on_error);
-
-/* Register a subprocess as being a slave process. This means that the
- subprocess will be terminated when its creator receives a catchable fatal
- signal or exits normally. Registration ends when wait_subprocess()
- notices that the subprocess has exited. */
-extern void register_slave_subprocess (pid_t child);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _WAIT_PROCESS_H */
+++ /dev/null
-/* Determine the number of screen columns needed for a character.
- Copyright (C) 2006 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _gl_WCWIDTH_H
-#define _gl_WCWIDTH_H
-
-#if HAVE_WCHAR_T
-
-/* Get wcwidth if available, along with wchar_t. */
-# if HAVE_WCHAR_H
-/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
- <wchar.h>.
- BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
- <wchar.h>. */
-# include <stdio.h>
-# include <time.h>
-# include <wchar.h>
-# endif
-
-/* Get iswprint. */
-# if HAVE_WCTYPE_H
-# include <wctype.h>
-# endif
-# if !defined iswprint && !HAVE_ISWPRINT
-# define iswprint(wc) 1
-# endif
-
-# ifndef HAVE_DECL_WCWIDTH
-"this configure-time declaration test was not run"
-# endif
-# ifndef wcwidth
-# if !HAVE_WCWIDTH
-
-/* wcwidth doesn't exist, so assume all printable characters have
- width 1. */
-static inline int
-wcwidth (wchar_t wc)
-{
- return wc == 0 ? 0 : iswprint (wc) ? 1 : -1;
-}
-
-# elif !HAVE_DECL_WCWIDTH
-
-/* wcwidth exists but is not declared. */
-extern
-# ifdef __cplusplus
-"C"
-# endif
-int wcwidth (int /* actually wchar_t */);
-
-# endif
-# endif
-
-#endif /* HAVE_WCHAR_H */
-
-#endif /* _gl_WCWIDTH_H */
+++ /dev/null
-/* Safe automatic memory allocation with out of memory checking.
- Copyright (C) 2003 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "xallocsa.h"
-
-#include "xalloc.h"
-
-void *
-xmallocsa (size_t n)
-{
- void *p;
-
- p = mallocsa (n);
- if (p == NULL)
- xalloc_die ();
- return p;
-}
+++ /dev/null
-/* Safe automatic memory allocation with out of memory checking.
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _XALLOCSA_H
-#define _XALLOCSA_H
-
-#include "allocsa.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* xallocsa(N) is a checking safe variant of alloca(N). It allocates N bytes
- of memory allocated on the stack, that must be freed using freesa() before
- the function returns. Upon failure, it exits with an error message. */
-#if HAVE_ALLOCA
-# define xallocsa(N) \
- ((N) < 4032 - sa_increment \
- ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \
- : xmallocsa (N))
-extern void * xmallocsa (size_t n);
-#else
-# define xallocsa(N) \
- xmalloc (N)
-#endif
-
-/* Maybe we should also define a variant
- xnallocsa (size_t n, size_t s) - behaves like xallocsa (n * s)
- If this would be useful in your application. please speak up. */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _XALLOCSA_H */
+++ /dev/null
-/* vasprintf and asprintf with out-of-memory checking.
- Copyright (C) 1999, 2002-2004 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "xvasprintf.h"
-
-char *
-xasprintf (const char *format, ...)
-{
- va_list args;
- char *result;
-
- va_start (args, format);
- result = xvasprintf (format, args);
- va_end (args);
-
- return result;
-}
+++ /dev/null
-/* Setting environment variables, with out-of-memory checking.
- Copyright (C) 2001-2002, 2005 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "xsetenv.h"
-
-#include "setenv.h"
-#include "error.h"
-#include "exit.h"
-#include "gettext.h"
-
-#define _(str) gettext (str)
-
-
-/* Set NAME to VALUE in the environment.
- If REPLACE is nonzero, overwrite an existing value.
- With error checking. */
-void
-xsetenv (const char *name, const char *value, int replace)
-{
- if (setenv (name, value, replace) < 0)
- error (EXIT_FAILURE, 0, _("memory exhausted"));
-}
+++ /dev/null
-/* Setting environment variables, with out-of-memory checking.
- Copyright (C) 2001-2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Get unsetenv(). It can be used without error checking. */
-#include "setenv.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Set NAME to VALUE in the environment.
- If REPLACE is nonzero, overwrite an existing value.
- With error checking. */
-extern void xsetenv (const char *name, const char *value, int replace);
-
-#ifdef __cplusplus
-}
-#endif
+++ /dev/null
-/* xsize.h -- Checked size_t computations.
-
- Copyright (C) 2003 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _XSIZE_H
-#define _XSIZE_H
-
-/* Get size_t. */
-#include <stddef.h>
-
-/* Get SIZE_MAX. */
-#include <limits.h>
-#if HAVE_STDINT_H
-# include <stdint.h>
-#endif
-
-/* The size of memory objects is often computed through expressions of
- type size_t. Example:
- void* p = malloc (header_size + n * element_size).
- These computations can lead to overflow. When this happens, malloc()
- returns a piece of memory that is way too small, and the program then
- crashes while attempting to fill the memory.
- To avoid this, the functions and macros in this file check for overflow.
- The convention is that SIZE_MAX represents overflow.
- malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc
- implementation that uses mmap --, it's recommended to use size_overflow_p()
- or size_in_bounds_p() before invoking malloc().
- The example thus becomes:
- size_t size = xsum (header_size, xtimes (n, element_size));
- void *p = (size_in_bounds_p (size) ? malloc (size) : NULL);
-*/
-
-/* Convert an arbitrary value >= 0 to type size_t. */
-#define xcast_size_t(N) \
- ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX)
-
-/* Sum of two sizes, with overflow check. */
-static inline size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
-xsum (size_t size1, size_t size2)
-{
- size_t sum = size1 + size2;
- return (sum >= size1 ? sum : SIZE_MAX);
-}
-
-/* Sum of three sizes, with overflow check. */
-static inline size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
-xsum3 (size_t size1, size_t size2, size_t size3)
-{
- return xsum (xsum (size1, size2), size3);
-}
-
-/* Sum of four sizes, with overflow check. */
-static inline size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
-xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
-{
- return xsum (xsum (xsum (size1, size2), size3), size4);
-}
-
-/* Maximum of two sizes, with overflow check. */
-static inline size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
-xmax (size_t size1, size_t size2)
-{
- /* No explicit check is needed here, because for any n:
- max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */
- return (size1 >= size2 ? size1 : size2);
-}
-
-/* Multiplication of a count with an element size, with overflow check.
- The count must be >= 0 and the element size must be > 0.
- This is a macro, not an inline function, so that it works correctly even
- when N is of a wider tupe and N > SIZE_MAX. */
-#define xtimes(N, ELSIZE) \
- ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX)
-
-/* Check for overflow. */
-#define size_overflow_p(SIZE) \
- ((SIZE) == SIZE_MAX)
-/* Check against overflow. */
-#define size_in_bounds_p(SIZE) \
- ((SIZE) != SIZE_MAX)
-
-#endif /* _XSIZE_H */
+++ /dev/null
-/* vasprintf and asprintf with out-of-memory checking.
- Copyright (C) 1999, 2002-2004, 2006 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Specification. */
-#include "xvasprintf.h"
-
-#include <errno.h>
-#include <limits.h>
-#include <string.h>
-
-#include "vasprintf.h"
-#include "xalloc.h"
-
-/* Checked size_t computations. */
-#include "xsize.h"
-
-/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
-#ifndef EOVERFLOW
-# define EOVERFLOW E2BIG
-#endif
-
-static inline char *
-xstrcat (size_t argcount, va_list args)
-{
- char *result;
- va_list ap;
- size_t totalsize;
- size_t i;
- char *p;
-
- /* Determine the total size. */
- totalsize = 0;
- va_copy (ap, args);
- for (i = argcount; i > 0; i--)
- {
- const char *next = va_arg (ap, const char *);
- totalsize = xsum (totalsize, strlen (next));
- }
- va_end (ap);
-
- /* Test for overflow in the summing pass above or in (totalsize + 1) below.
- Also, don't return a string longer than INT_MAX, for consistency with
- vasprintf(). */
- if (totalsize == SIZE_MAX || totalsize > INT_MAX)
- {
- errno = EOVERFLOW;
- return NULL;
- }
-
- /* Allocate and fill the result string. */
- result = (char *) xmalloc (totalsize + 1);
- p = result;
- for (i = argcount; i > 0; i--)
- {
- const char *next = va_arg (args, const char *);
- size_t len = strlen (next);
- memcpy (p, next, len);
- p += len;
- }
- *p = '\0';
-
- return result;
-}
-
-char *
-xvasprintf (const char *format, va_list args)
-{
- char *result;
-
- /* Recognize the special case format = "%s...%s". It is a frequently used
- idiom for string concatenation and needs to be fast. We don't want to
- have a separate function xstrcat() for this purpose. */
- {
- size_t argcount = 0;
- const char *f;
-
- for (f = format;;)
- {
- if (*f == '\0')
- /* Recognized the special case of string concatenation. */
- return xstrcat (argcount, args);
- if (*f != '%')
- break;
- f++;
- if (*f != 's')
- break;
- f++;
- argcount++;
- }
- }
-
- if (vasprintf (&result, format, args) < 0)
- {
- if (errno == ENOMEM)
- xalloc_die ();
- return NULL;
- }
-
- return result;
-}
+++ /dev/null
-/* vasprintf and asprintf with out-of-memory checking.
- Copyright (C) 2002-2004, 2006 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _XVASPRINTF_H
-#define _XVASPRINTF_H
-
-/* Get va_list. */
-#include <stdarg.h>
-
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
-# define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-# define __format__ format
-# define __printf__ printf
-# endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Write formatted output to a string dynamically allocated with malloc(),
- and return it. Upon [ENOMEM] memory allocation error, call xalloc_die.
- On some other error
- - [EOVERFLOW] resulting string length is > INT_MAX,
- - [EINVAL] invalid format string,
- - [EILSEQ] error during conversion between wide and multibyte characters,
- return NULL. */
-extern char *xasprintf (const char *format, ...)
- __attribute__ ((__format__ (__printf__, 1, 2)));
-extern char *xvasprintf (const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 1, 0)));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _XVASPRINTF_H */
+++ /dev/null
-# allocsa.m4 serial 3
-dnl Copyright (C) 2003-2004 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_ALLOCSA],
-[
- dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables
- dnl @ALLOCA@ and @LTALLOCA@.
- AC_REQUIRE([gl_FUNC_ALLOCA])
- AC_REQUIRE([gl_EEMALLOC])
- AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
- AC_REQUIRE([gt_TYPE_LONGDOUBLE])
-])
+++ /dev/null
-# byteswap.m4 serial 1
-dnl Copyright (C) 2005 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl Written by Oskar Liljeblad.
-
-AC_DEFUN([gl_BYTESWAP],
-[
- dnl Prerequisites of lib/byteswap_.h.
- AC_CHECK_HEADERS([byteswap.h], [
- BYTESWAP_H=''
- ], [
- BYTESWAP_H='byteswap.h'
- ])
- AC_SUBST(BYTESWAP_H)
-])
+++ /dev/null
-# csharp.m4 serial 2 (gettext-0.14.2)
-dnl Copyright (C) 2004-2005 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.
-
-# Sets CSHARP_CHOICE to the preferred C# implementation:
-# 'pnet' or 'mono' or 'any' or 'no'.
-AC_DEFUN([gt_CSHARP_CHOICE],
-[
- AC_MSG_CHECKING([for preferred C[#] implementation])
- AC_ARG_ENABLE(csharp,
- [ --enable-csharp[[=IMPL]] choose preferred C[#] implementation (pnet or mono)],
- [CSHARP_CHOICE="$enableval"],
- CSHARP_CHOICE=any)
- AC_SUBST(CSHARP_CHOICE)
- AC_MSG_RESULT([$CSHARP_CHOICE])
- case "$CSHARP_CHOICE" in
- pnet)
- AC_DEFINE([CSHARP_CHOICE_PNET], 1,
- [Define if pnet is the preferred C# implementation.])
- ;;
- mono)
- AC_DEFINE([CSHARP_CHOICE_MONO], 1,
- [Define if mono is the preferred C# implementation.])
- ;;
- esac
-])
+++ /dev/null
-# csharpcomp.m4 serial 6 (gettext-0.15)
-dnl Copyright (C) 2003-2005 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.
-
-# Prerequisites of csharpcomp.sh.
-# Checks for a C# compiler.
-# Sets at most one of HAVE_CSCC, HAVE_MCS, HAVE_CSC.
-# Sets HAVE_CSHARPCOMP to nonempty if csharpcomp.sh will work.
-# Also sets CSHARPCOMPFLAGS.
-AC_DEFUN([gt_CSHARPCOMP],
-[
- AC_REQUIRE([gt_CSHARP_CHOICE])
- AC_MSG_CHECKING([for C[#] compiler])
- HAVE_CSHARPCOMP=1
- pushdef([AC_MSG_CHECKING],[:])dnl
- pushdef([AC_CHECKING],[:])dnl
- pushdef([AC_MSG_RESULT],[:])dnl
- AC_CHECK_PROG(HAVE_CSCC_IN_PATH, cscc, yes)
- AC_CHECK_PROG(HAVE_MCS_IN_PATH, mcs, yes)
- AC_CHECK_PROG(HAVE_CSC_IN_PATH, csc, yes)
- popdef([AC_MSG_RESULT])dnl
- popdef([AC_CHECKING])dnl
- popdef([AC_MSG_CHECKING])dnl
- for impl in "$CSHARP_CHOICE" pnet mono sscli no; do
- case "$impl" in
- pnet)
- if test -n "$HAVE_CSCC_IN_PATH" \
- && cscc --version >/dev/null 2>/dev/null \
- && (
- # See if pnetlib is well installed.
- echo 'class ConfTest { static void Main() { } }' > conftest.cs
- cscc -o conftest.exe conftest.cs 2>/dev/null
- error=$?
- rm -f conftest.cs conftest.exe
- exit $error
- ); then
- HAVE_CSCC=1
- ac_result="cscc"
- break
- fi
- ;;
- mono)
- if test -n "$HAVE_MCS_IN_PATH" \
- && mcs --version >/dev/null 2>/dev/null; then
- HAVE_MCS=1
- ac_result="mcs"
- break
- fi
- ;;
- sscli)
- if test -n "$HAVE_CSC_IN_PATH" \
- && csc -help >/dev/null 2>/dev/null \
- && { if csc -help 2>/dev/null | grep -i chicken > /dev/null; then false; else true; fi; }; then
- HAVE_CSC=1
- ac_result="csc"
- break
- fi
- ;;
- no)
- HAVE_CSHARPCOMP=
- ac_result="no"
- break
- ;;
- esac
- done
- AC_MSG_RESULT([$ac_result])
- AC_SUBST(HAVE_CSCC)
- AC_SUBST(HAVE_MCS)
- AC_SUBST(HAVE_CSC)
- dnl Provide a default for CSHARPCOMPFLAGS.
- if test -z "${CSHARPCOMPFLAGS+set}"; then
- CSHARPCOMPFLAGS="-O -g"
- fi
- AC_SUBST(CSHARPCOMPFLAGS)
-])
+++ /dev/null
-# csharpexec.m4 serial 3 (gettext-0.15)
-dnl Copyright (C) 2003-2005 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.
-
-# Prerequisites of csharpexec.sh.
-# Checks for a C# execution engine.
-# gt_CSHARPEXEC or gt_CSHARPEXEC(testexecutable, its-directory)
-# Sets at most one of HAVE_ILRUN, HAVE_MONO, HAVE_CLIX.
-# Sets HAVE_CSHARPEXEC to nonempty if csharpexec.sh will work.
-AC_DEFUN([gt_CSHARPEXEC],
-[
- AC_REQUIRE([gt_CSHARP_CHOICE])
- AC_MSG_CHECKING([for C[#] program execution engine])
- AC_EGREP_CPP(yes, [
-#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
- yes
-#endif
-], MONO_PATH_SEPARATOR=';', MONO_PATH_SEPARATOR=':')
- HAVE_CSHARPEXEC=1
- pushdef([AC_MSG_CHECKING],[:])dnl
- pushdef([AC_CHECKING],[:])dnl
- pushdef([AC_MSG_RESULT],[:])dnl
- AC_CHECK_PROG(HAVE_ILRUN_IN_PATH, ilrun, yes)
- AC_CHECK_PROG(HAVE_MONO_IN_PATH, mono, yes)
- AC_CHECK_PROG(HAVE_CLIX_IN_PATH, clix, yes)
- popdef([AC_MSG_RESULT])dnl
- popdef([AC_CHECKING])dnl
- popdef([AC_MSG_CHECKING])dnl
- for impl in "$CSHARP_CHOICE" pnet mono no; do
- case "$impl" in
- pnet)
- if test -n "$HAVE_ILRUN_IN_PATH" \
- && ilrun --version >/dev/null 2>/dev/null \
- ifelse([$1], , , [&& ilrun $2/$1 >/dev/null 2>/dev/null]); then
- HAVE_ILRUN=1
- ac_result="ilrun"
- break
- fi
- ;;
- mono)
- if test -n "$HAVE_MONO_IN_PATH" \
- && mono --version >/dev/null 2>/dev/null \
- ifelse([$1], , , [&& mono $2/$1 >/dev/null 2>/dev/null]); then
- HAVE_MONO=1
- ac_result="mono"
- break
- fi
- ;;
- sscli)
- if test -n "$HAVE_CLIX_IN_PATH" \
- ifelse([$1], , , [&& clix $2/$1 >/dev/null 2>/dev/null]); then
- HAVE_CLIX=1
- case $host_os in
- cygwin* | mingw* | pw32*)
- CLIX_PATH_VAR=PATH
- ;;
- darwin* | rhapsody*)
- CLIX_PATH_VAR=DYLD_LIBRARY_PATH
- ;;
- *)
- CLIX_PATH_VAR=LD_LIBRARY_PATH
- ;;
- esac
- eval CLIX_PATH=\"\$CLIX_PATH_VAR\"
- ac_result="clix"
- break
- fi
- ;;
- no)
- HAVE_CSHARPEXEC=
- ac_result="no"
- break
- ;;
- esac
- done
- AC_MSG_RESULT([$ac_result])
- AC_SUBST(MONO_PATH)
- AC_SUBST(MONO_PATH_SEPARATOR)
- AC_SUBST(CLIX_PATH_VAR)
- AC_SUBST(CLIX_PATH)
- AC_SUBST(HAVE_ILRUN)
- AC_SUBST(HAVE_MONO)
- AC_SUBST(HAVE_CLIX)
-])
+++ /dev/null
-# eaccess.m4 serial 1 (gettext-0.12)
-dnl Copyright (C) 2003 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_EACCESS],
-[
- AC_CHECK_FUNC(eaccess, ,
- [AC_DEFINE(eaccess, access,
- [Define as 'access' if you don't have the eaccess() function.])])
-])
+++ /dev/null
-# eealloc.m4 serial 1
-dnl Copyright (C) 2003 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_EEALLOC],
-[
- AC_REQUIRE([gl_EEMALLOC])
- AC_REQUIRE([gl_EEREALLOC])
- AC_REQUIRE([AC_C_INLINE])
-])
-
-AC_DEFUN([gl_EEMALLOC],
-[
- _AC_FUNC_MALLOC_IF(
- [gl_cv_func_malloc_0_nonnull=1],
- [gl_cv_func_malloc_0_nonnull=0])
- AC_DEFINE_UNQUOTED([MALLOC_0_IS_NONNULL], $gl_cv_func_malloc_0_nonnull,
- [If malloc(0) is != NULL, define this to 1. Otherwise define this
- to 0.])
-])
-
-AC_DEFUN([gl_EEREALLOC],
-[
- _AC_FUNC_REALLOC_IF(
- [gl_cv_func_realloc_0_nonnull=1],
- [gl_cv_func_realloc_0_nonnull=0])
- AC_DEFINE_UNQUOTED([REALLOC_0_IS_NONNULL], $gl_cv_func_realloc_0_nonnull,
- [If realloc(NULL,0) is != NULL, define this to 1. Otherwise define this
- to 0.])
-])
+++ /dev/null
-#serial 11
-
-# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004 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.
-
-AC_DEFUN([gl_ERROR],
-[
- AC_FUNC_ERROR_AT_LINE
- dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]).
- gl_PREREQ_ERROR
-])
-
-# Prerequisites of lib/error.c.
-AC_DEFUN([gl_PREREQ_ERROR],
-[
- AC_REQUIRE([AC_FUNC_STRERROR_R])
- :
-])
+++ /dev/null
-# exitfail.m4 serial 4
-dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_EXITFAIL],
-[
- dnl No prerequisites of lib/exitfail.c.
- :
-])
+++ /dev/null
-# Enable extensions on systems that normally disable them.
-
-# Copyright (C) 2003, 2006 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.
-
-# This file is only needed in autoconf <= 2.59. Newer versions of autoconf
-# have a macro AC_USE_SYSTEM_EXTENSIONS with identical semantics.
-
-# gl_USE_SYSTEM_EXTENSIONS
-# ------------------------
-# Enable extensions on systems that normally disable them,
-# typically due to standards-conformance issues.
-AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [
- AC_BEFORE([$0], [AC_COMPILE_IFELSE])
- AC_BEFORE([$0], [AC_RUN_IFELSE])
-
- AC_REQUIRE([AC_GNU_SOURCE])
- AC_REQUIRE([AC_AIX])
- AC_REQUIRE([AC_MINIX])
-
- AH_VERBATIM([__EXTENSIONS__],
-[/* Enable extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif])
- AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
- [ac_cv_safe_to_define___extensions__],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([
- #define __EXTENSIONS__ 1
- AC_INCLUDES_DEFAULT])],
- [ac_cv_safe_to_define___extensions__=yes],
- [ac_cv_safe_to_define___extensions__=no])])
- test $ac_cv_safe_to_define___extensions__ = yes &&
- AC_DEFINE([__EXTENSIONS__])
- AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-])
+++ /dev/null
-# Check for fnmatch.
-
-# This is a modified version of autoconf's AC_FUNC_FNMATCH.
-# This file should be simplified after Autoconf 2.57 is required.
-
-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 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.
-
-# _AC_FUNC_FNMATCH_IF(STANDARD = GNU | POSIX, CACHE_VAR, IF-TRUE, IF-FALSE)
-# -------------------------------------------------------------------------
-# If a STANDARD compliant fnmatch is found, run IF-TRUE, otherwise
-# IF-FALSE. Use CACHE_VAR.
-AC_DEFUN([_AC_FUNC_FNMATCH_IF],
-[AC_CACHE_CHECK(
- [for working $1 fnmatch],
- [$2],
- [dnl Some versions of Solaris, SCO, and the GNU C Library
- dnl have a broken or incompatible fnmatch.
- dnl So we run a test program. If we are cross-compiling, take no chance.
- dnl Thanks to John Oleynick, François Pinard, and Paul Eggert for this test.
- AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [
-# include <stdlib.h>
-# include <fnmatch.h>
-# define y(a, b, c) (fnmatch (a, b, c) == 0)
-# define n(a, b, c) (fnmatch (a, b, c) == FNM_NOMATCH)
- static int
- fnm (char const *pattern, char const *string, int flags)
- {
- return fnmatch (pattern, string, flags);
- }
- ],
- [exit
- (!((fnm ? fnm : fnmatch) ("a*", "", 0) == FNM_NOMATCH
- && y ("a*", "abc", 0)
- && n ("d*/*1", "d/s/1", FNM_PATHNAME)
- && y ("a\\\\bc", "abc", 0)
- && n ("a\\\\bc", "abc", FNM_NOESCAPE)
- && y ("*x", ".x", 0)
- && n ("*x", ".x", FNM_PERIOD)
- && m4_if([$1], [GNU],
- [y ("xxXX", "xXxX", FNM_CASEFOLD)
- && y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH)
- && n ("d*/*1", "d/s/1", FNM_FILE_NAME)
- && y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR)
- && y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR)
- && y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)],
- 1)));])],
- [$2=yes],
- [$2=no],
- [$2=cross])])
-AS_IF([test $$2 = yes], [$3], [$4])
-])# _AC_FUNC_FNMATCH_IF
-
-
-# _AC_LIBOBJ_FNMATCH
-# ------------------
-# Prepare the replacement of fnmatch.
-AC_DEFUN([_AC_LIBOBJ_FNMATCH],
-[AC_REQUIRE([AC_FUNC_ALLOCA])dnl
-AC_REQUIRE([AC_TYPE_MBSTATE_T])dnl
-AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
-AC_CHECK_FUNCS([btowc mbsrtowcs mempcpy wmemchr wmemcpy wmempcpy])
-AC_CHECK_HEADERS([wchar.h wctype.h])
-AC_LIBOBJ([fnmatch])
-FNMATCH_H=fnmatch.h
-])# _AC_LIBOBJ_FNMATCH
-
-
-AC_DEFUN([gl_FUNC_FNMATCH_POSIX],
-[
- FNMATCH_H=
- _AC_FUNC_FNMATCH_IF([POSIX], [ac_cv_func_fnmatch_posix],
- [rm -f lib/fnmatch.h],
- [_AC_LIBOBJ_FNMATCH])
- if test $ac_cv_func_fnmatch_posix != yes; then
- dnl We must choose a different name for our function, since on ELF systems
- dnl a broken fnmatch() in libc.so would override our fnmatch() if it is
- dnl compiled into a shared library.
- AC_DEFINE([fnmatch], [posix_fnmatch],
- [Define to a replacement function name for fnmatch().])
- fi
- AC_SUBST([FNMATCH_H])
-])
-
-
-AC_DEFUN([gl_FUNC_FNMATCH_GNU],
-[
- dnl Persuade glibc <fnmatch.h> to declare FNM_CASEFOLD etc.
- AC_REQUIRE([AC_GNU_SOURCE])
-
- FNMATCH_H=
- _AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu],
- [rm -f lib/fnmatch.h],
- [_AC_LIBOBJ_FNMATCH])
- if test $ac_cv_func_fnmatch_gnu != yes; then
- dnl We must choose a different name for our function, since on ELF systems
- dnl a broken fnmatch() in libc.so would override our fnmatch() if it is
- dnl compiled into a shared library.
- AC_DEFINE([fnmatch], [gnu_fnmatch],
- [Define to a replacement function name for fnmatch().])
- fi
- AC_SUBST([FNMATCH_H])
-])
+++ /dev/null
-# getopt.m4 serial 13
-dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-# The getopt module assume you want GNU getopt, with getopt_long etc,
-# rather than vanilla POSIX getopt. This means your code should
-# always include <getopt.h> for the getopt prototypes.
-
-AC_DEFUN([gl_GETOPT_SUBSTITUTE],
-[
- AC_LIBOBJ([getopt])
- AC_LIBOBJ([getopt1])
- gl_GETOPT_SUBSTITUTE_HEADER
- gl_PREREQ_GETOPT
-])
-
-AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
-[
- GETOPT_H=getopt.h
- AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
- [Define to rpl_ if the getopt replacement functions and variables
- should be used.])
- AC_SUBST([GETOPT_H])
-])
-
-AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
-[
- if test -z "$GETOPT_H"; then
- AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
- fi
-
- if test -z "$GETOPT_H"; then
- AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
- fi
-
- dnl BSD getopt_long uses an incompatible method to reset option processing,
- dnl and (as of 2004-10-15) mishandles optional option-arguments.
- if test -z "$GETOPT_H"; then
- AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>])
- fi
-
- dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
- dnl option string (as of 2005-05-05).
- if test -z "$GETOPT_H"; then
- AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt],
- [AC_RUN_IFELSE(
- [AC_LANG_PROGRAM([#include <getopt.h>],
- [[
- char *myargv[3];
- myargv[0] = "conftest";
- myargv[1] = "-+";
- myargv[2] = 0;
- return getopt (2, myargv, "+a") != '?';
- ]])],
- [gl_cv_func_gnu_getopt=yes],
- [gl_cv_func_gnu_getopt=no],
- [dnl cross compiling - pessimistically guess based on decls
- dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
- dnl option string (as of 2005-05-05).
- AC_CHECK_DECL([getopt_clip],
- [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes],
- [#include <getopt.h>])])])
- if test "$gl_cv_func_gnu_getopt" = "no"; then
- GETOPT_H=getopt.h
- fi
- fi
-])
-
-AC_DEFUN([gl_GETOPT_IFELSE],
-[
- AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
- AS_IF([test -n "$GETOPT_H"], [$1], [$2])
-])
-
-AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])])
-
-# Prerequisites of lib/getopt*.
-AC_DEFUN([gl_PREREQ_GETOPT],
-[
- AC_CHECK_DECLS_ONCE([getenv])
-])
+++ /dev/null
-# gl_list.m4 serial 1
-dnl Copyright (C) 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_LIST],
-[
- AC_REQUIRE([AC_C_INLINE])
- if test $ac_cv_c_inline != no; then
- AC_DEFINE([HAVE_INLINE], 1,
- [Define to 1 if the compiler supports one of the keywords 'inline', '__inline__', '__inline'.])
- fi
-])
+++ /dev/null
-# hard-locale.m4 serial 5
-dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl No prerequisites of lib/hard-locale.c.
-AC_DEFUN([gl_HARD_LOCALE], [:])
+++ /dev/null
-# javacomp.m4 serial 8 (gettext-0.15)
-dnl Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-# Prerequisites of javacomp.sh.
-# gt_JAVACOMP([source-version], [target-version])
-# Sets HAVE_JAVACOMP to nonempty if javacomp.sh will allow Java source code
-# according to source-version to be compiled to Java bytecode classes in the
-# target-version format.
-#
-# source-version can be: support for
-# 1.3 inner classes
-# 1.4 assert keyword
-# 1.5 generic classes and methods
-# 1.6 (not yet supported)
-#
-# target-version can be: classfile version:
-# 1.1 45.3
-# 1.2 46.0
-# 1.3 47.0
-# 1.4 48.0
-# 1.5 49.0
-# 1.6 50.0
-# The classfile version of a .class file can be determined through the "file"
-# command. More portably, the classfile major version can be determined through
-# "od -A n -t d1 -j 7 -N 1 classfile".
-# target-version can also be omitted. In this case, the required target-version
-# is determined from the found JVM (see macro gt_JAVAEXEC):
-# target-version for JVM
-# 1.1 JDK 1.1, jview
-# 1.2 JDK/JRE 1.2
-# 1.3 JDK/JRE 1.3, gij 3.3, 3.4
-# 1.4 JDK/JRE 1.4, gij 4.0, 4.1
-# 1.5 JDK/JRE 1.5
-# 1.6 JDK/JRE 1.6
-# Note: gij >= 3.3 can in some cases handle classes compiled with -target 1.4,
-# and gij >= 4.1 can in some cases partially handle classes compiled with
-# -target 1.5, but I have no idea how complete this support is.
-#
-# Specifying target-version is useful when building a library (.jar) that is
-# useful outside the given package. Omitting target-version is useful when
-# building an application.
-#
-# It is unreasonable to ask for:
-# - target-version < 1.4 with source-version >= 1.4, or
-# - target-version < 1.5 with source-version >= 1.5, or
-# - target-version < 1.6 with source-version >= 1.6,
-# because even Sun's javac doesn't support these combinations.
-#
-# It is redundant to ask for a target-version > source-version, since the
-# smaller target-version = source-version will also always work and newer JVMs
-# support the older target-versions too. Except for the case
-# target-version = 1.4, source-version = 1.3, which allows gcj versions 3.0
-# to 3.2 to be used.
-
-AC_DEFUN([gt_JAVACOMP],
-[
- ifelse([$2], [], [AC_REQUIRE([gt_JAVAEXEC])], [])
- AC_EGREP_CPP(yes, [
-#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
- yes
-#endif
-], CLASSPATH_SEPARATOR=';', CLASSPATH_SEPARATOR=':')
- source_version=$1
- test -n "$source_version" || {
- AC_MSG_ERROR([missing source-version argument to gt_@&t@JAVACOMP])
- }
- ifelse([$2], [],
- [if test -n "$HAVE_JAVAEXEC"; then
- dnl Use $CONF_JAVA to determine the JVM's version.
-changequote(,)dnl
- cat > conftestver.java <<EOF
-public class conftestver {
- public static void main (String[] args) {
- System.out.println(System.getProperty("java.specification.version"));
- }
-}
-EOF
-changequote([,])dnl
- dnl A precompiled version of conftestver.java, compiled with
- dnl "javac -target 1.1". This avoids having to compile conftestver.java
- dnl during each test for a suitable Java compiler.
- dnl For the conversion from binary to this ASCII encapsulation, avoiding
- dnl to assume the presence of uudecode, use the command
- dnl $ od -A n -t o1 < conftestver.class | tr ' ' '\012'| sort | uniq | sed -e '/^$/d' -e 's,^,\\,' | tr -d '\012'
- dnl and the long tr command in opposite direction.
- echo 'xyvw!$!H!C,!)!2+!3!4*!5,!3!6,!7!8)!9)!:"!(LdhdmM"!$EFV"!%Ni_a"!1PdhaQngYakUXYfa"!%gXdh"!8EWPeXoXJfXhcJTmkdhcKFV"!,TinkZaOdfa"!2ZihbmalmoakIeXoX.!*!+)!;.!<!="!<eXoXIljaZdbdZXmdihIoakldih.!>!?)!@.!A!B"!-Zihbmalmoak"!2eXoXJfXhcJRYeaZm"!2eXoXJfXhcJTplmag"!$inm"!7PeXoXJdiJSkdhmTmkaXgK"!-camSkijakmp"!DEPeXoXJfXhcJTmkdhcKFPeXoXJfXhcJTmkdhcK"!5eXoXJdiJSkdhmTmkaXg"!)jkdhmfh"!7EPeXoXJfXhcJTmkdhcKFV!C!(!)!!!!!#!"!*!+!"!,!!!?!"!"!!!&Gt!"q!!!"!-!!!(!"!!!"!+!.!/!"!,!!!E!#!"!!!.r!#4$u!%s!&q!!!"!-!!!,!#!!!$!-!%!"!0!!!#!1' \
- | tr -d '\012\015' \
- | tr '!"#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz' '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\046\050\051\052\055\056\057\073\074\076\103\106\114\116\117\120\123\124\126\133\141\142\143\144\145\146\147\151\152\154\155\156\157\160\162\163\164\165\166\171\261\262\266\267\270\272\276\312\376' \
- > conftestver.class
- target_version=`{
- unset JAVA_HOME
- echo "$as_me:__oline__: CLASSPATH=.${CLASSPATH:+$CLASSPATH_SEPARATOR$CLASSPATH} $CONF_JAVA conftestver" >&AS_MESSAGE_LOG_FD
- CLASSPATH=.${CLASSPATH:+$CLASSPATH_SEPARATOR$CLASSPATH} $CONF_JAVA conftestver 2>&AS_MESSAGE_LOG_FD
- }`
- case "$target_version" in
- 1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6) ;;
- null)
- dnl JDK 1.1.X returns null.
- target_version=1.1 ;;
- *) AC_MSG_WARN([unknown target-version $target_version, please update gt_@&t@JAVACOMP macro])
- target_version=1.1 ;;
- esac
- else
- target_version="1.1"
- fi
- ],
- [target_version=$2])
- case "$source_version" in
- 1.3) goodcode='class conftest {}'
- failcode='class conftestfail { static { assert(true); } }' ;;
- 1.4) goodcode='class conftest { static { assert(true); } }'
- failcode='class conftestfail<T> { T foo() { return null; } }' ;;
- 1.5) goodcode='class conftest<T> { T foo() { return null; } }'
- failcode='class conftestfail syntax error' ;;
- *) AC_MSG_ERROR([invalid source-version argument to gt_@&t@JAVACOMP: $source_version]) ;;
- esac
- case "$target_version" in
- 1.1) cfversion=45 ;;
- 1.2) cfversion=46 ;;
- 1.3) cfversion=47 ;;
- 1.4) cfversion=48 ;;
- 1.5) cfversion=49 ;;
- 1.6) cfversion=50 ;;
- *) AC_MSG_ERROR([invalid target-version argument to gt_@&t@JAVACOMP: $target_version]) ;;
- esac
- # Function to output the classfile version of a file (8th byte) in decimal.
- if od -A x < /dev/null >/dev/null 2>/dev/null; then
- # Use POSIX od.
- func_classfile_version ()
- {
- od -A n -t d1 -j 7 -N 1 "[$]1"
- }
- else
- # Use BSD hexdump.
- func_classfile_version ()
- {
- dd if="[$]1" bs=1 count=1 skip=7 2>/dev/null | hexdump -e '1/1 "%3d "'
- echo
- }
- fi
- AC_MSG_CHECKING([for Java compiler])
- dnl
- dnl The support of GNU gcj for target-version and source-version:
- dnl
- dnl gcj 3.0.4 to 4.1 does not have a way to specify the target-version.
- dnl It always assumes target-version=1.4 but labels the class files as 1.1.
- dnl One consequence of this is that gcj compiles GetURL.java to invalid
- dnl bytecode, which crashes with a VerifyError when executed by Sun Java
- dnl 1.3.1. The bug is registered as java/7066, see
- dnl http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7066
- dnl FIXME: Check new versions of gcj as they come out.
- dnl
- dnl For gcj < 3.3, the source-version always is 1.3.
- dnl For gcj >= 3.3, the source-version defaults to 1.4; option
- dnl "-fno-assert" switches to source-version 1.3.
- dnl
- dnl The support of Sun javac for target-version and source-version:
- dnl
- dnl javac 1.3: -target 1.1 1.2 1.3 default: 1.1
- dnl source always: 1.3
- dnl
- dnl javac 1.4: -target 1.1 1.2 1.3 1.4 default: 1.2
- dnl -source 1.3 1.4 default: 1.3
- dnl -target 1.1/1.2/1.3 only possible with -source 1.3 or no -source
- dnl
- dnl javac 1.5: -target 1.1 1.2 1.3 1.4 1.5 default: 1.5
- dnl -source 1.3 1.4 1.5 default: 1.5
- dnl -target 1.1/1.2/1.3 only possible with -source 1.3
- dnl -target 1.4 only possible with -source 1.3/1.4
- dnl
- dnl javac 1.6: -target 1.1 1.2 1.3 1.4 1.5 1.6 default: 1.6
- dnl -source 1.3 1.4 1.5 1.6 default: 1.5
- dnl -target 1.1/1.2/1.3 only possible with -source 1.3
- dnl -target 1.4 only possible with -source 1.3/1.4
- dnl -target 1.5 only possible with -source 1.3/1.4/1.5 or no -source
- dnl
- dnl The support of jikes for target-version and source-version:
- dnl
- dnl jikes 1.14 does not have a way to specify the target-version. It
- dnl always assumes target-version=1.1.
- dnl
- dnl For jikes 1.14, the source-version always is 1.3.
- dnl
- CONF_JAVAC=
- HAVE_JAVAC_ENVVAR=
- HAVE_GCJ_C=
- HAVE_JAVAC=
- HAVE_JIKES=
- HAVE_JAVACOMP=
-changequote(,)dnl
- cat > conftestlib.java <<EOF
-public class conftestlib {
- public static void main (String[] args) {
- }
-}
-EOF
-changequote([,])dnl
- echo "$goodcode" > conftest.java
- echo "$failcode" > conftestfail.java
- dnl If the user has set the JAVAC environment variable, use that, if it
- dnl satisfies the constraints (possibly after adding -target and -source
- dnl options).
- if test -n "$JAVAC"; then
- dnl Try the original $JAVAC.
- if $JAVAC --version 2>/dev/null | sed -e 1q | grep gcj > /dev/null; then
- dnl It's a version of gcj. Ignore the version of conftest.class.
- if test "$target_version" = 1.4 && test "$source_version" = 1.4; then
- dnl Try $JAVAC.
- rm -f conftest.class
- if { echo "$as_me:__oline__: $JAVAC -d . conftest.java" >&AS_MESSAGE_LOG_FD
- $JAVAC -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class; then
- CONF_JAVAC="$JAVAC"
- HAVE_JAVAC_ENVVAR=1
- HAVE_JAVACOMP=1
- fi
- else
- if test "$target_version" = 1.4 && test "$source_version" = 1.3; then
- dnl Try $JAVAC and "$JAVAC -fno-assert". But add -fno-assert only if
- dnl it makes a difference. (It could already be part of $JAVAC.)
- javac_works=
- rm -f conftest.class
- if { echo "$as_me:__oline__: $JAVAC -d . conftest.java" >&AS_MESSAGE_LOG_FD
- $JAVAC -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class; then
- javac_works=1
- fi
- javac_noassert_works=
- rm -f conftest.class
- if { echo "$as_me:__oline__: $JAVAC -fno-assert -d . conftest.java" >&AS_MESSAGE_LOG_FD
- $JAVAC -fno-assert -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class; then
- javac_noassert_works=1
- fi
- if test -n "$javac_works" && test -n "$javac_noassert_works"; then
- rm -f conftestfail.class
- if { echo "$as_me:__oline__: $JAVAC -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
- $JAVAC -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftestfail.class \
- && ! { echo "$as_me:__oline__: $JAVAC -fno-assert -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
- $JAVAC -fno-assert -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
- }; then
- dnl "$JAVAC -fno-assert" works better than $JAVAC.
- javac_works=
- fi
- fi
- if test -n "$javac_works"; then
- CONF_JAVAC="$JAVAC"
- HAVE_JAVAC_ENVVAR=1
- HAVE_JAVACOMP=1
- else
- if test -n "$javac_noassert_works"; then
- CONF_JAVAC="$JAVAC -fno-assert"
- HAVE_JAVAC_ENVVAR=1
- HAVE_JAVACOMP=1
- fi
- fi
- fi
- fi
- else
- dnl It's not gcj. Assume the classfile versions are correct.
- dnl Try $JAVAC.
- rm -f conftest.class
- if { echo "$as_me:__oline__: $JAVAC -d . conftest.java" >&AS_MESSAGE_LOG_FD
- $JAVAC -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class \
- && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then
- dnl Try adding -source option if it is useful.
- rm -f conftest.class
- rm -f conftestfail.class
- if { echo "$as_me:__oline__: $JAVAC -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
- $JAVAC -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class \
- && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD \
- && { echo "$as_me:__oline__: $JAVAC -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
- $JAVAC -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftestfail.class \
- && ! { echo "$as_me:__oline__: $JAVAC -source $source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
- $JAVAC -source "$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
- }; then
- CONF_JAVAC="$JAVAC -source $source_version"
- HAVE_JAVAC_ENVVAR=1
- HAVE_JAVACOMP=1
- else
- CONF_JAVAC="$JAVAC"
- HAVE_JAVAC_ENVVAR=1
- HAVE_JAVACOMP=1
- fi
- else
- dnl Try with -target option alone. (Sun javac 1.3.1 has the -target
- dnl option but no -source option.)
- rm -f conftest.class
- if { echo "$as_me:__oline__: $JAVAC -target $target_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
- $JAVAC -target "$target_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class \
- && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then
- dnl Try adding -source option if it is useful.
- rm -f conftest.class
- rm -f conftestfail.class
- if { echo "$as_me:__oline__: $JAVAC -target $target_version -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
- $JAVAC -target "$target_version" -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class \
- && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD \
- && { echo "$as_me:__oline__: $JAVAC -target $target_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
- $JAVAC -target "$target_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftestfail.class \
- && ! { echo "$as_me:__oline__: $JAVAC -target $target_version -source $source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
- $JAVAC -target "$target_version" -source "$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
- }; then
- CONF_JAVAC="$JAVAC -target $target_version -source $source_version"
- HAVE_JAVAC_ENVVAR=1
- HAVE_JAVACOMP=1
- else
- CONF_JAVAC="$JAVAC -target $target_version"
- HAVE_JAVAC_ENVVAR=1
- HAVE_JAVACOMP=1
- fi
- else
- dnl Maybe this -target option requires a -source option? Try with
- dnl -target and -source options. (Supported by Sun javac 1.4 and
- dnl higher.)
- rm -f conftest.class
- if { echo "$as_me:__oline__: $JAVAC -target $target_version -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
- $JAVAC -target "$target_version" -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class \
- && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then
- CONF_JAVAC="$JAVAC -target $target_version -source $source_version"
- HAVE_JAVAC_ENVVAR=1
- HAVE_JAVACOMP=1
- fi
- fi
- fi
- fi
- fi
- if test -z "$HAVE_JAVACOMP"; then
- pushdef([AC_MSG_CHECKING],[:])dnl
- pushdef([AC_CHECKING],[:])dnl
- pushdef([AC_MSG_RESULT],[:])dnl
- AC_CHECK_PROG(HAVE_GCJ_IN_PATH, gcj, yes)
- AC_CHECK_PROG(HAVE_JAVAC_IN_PATH, javac, yes)
- AC_CHECK_PROG(HAVE_JIKES_IN_PATH, jikes, yes)
- popdef([AC_MSG_RESULT])dnl
- popdef([AC_CHECKING])dnl
- popdef([AC_MSG_CHECKING])dnl
- if test -z "$HAVE_JAVACOMP" && test -n "$HAVE_GCJ_IN_PATH"; then
- dnl Test for a good gcj version (>= 3.0).
-changequote(,)dnl
- if gcj --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^3\.[01]/d' | grep '^[3-9]' >/dev/null; then
-changequote([,])dnl
- dnl See if libgcj.jar is well installed.
- if { echo "$as_me:__oline__: gcj -C -d . conftestlib.java" >&AS_MESSAGE_LOG_FD
- gcj -C -d . conftestlib.java >&AS_MESSAGE_LOG_FD 2>&1
- }; then
- dnl OK, gcj works.
- dnl Now test whether it supports the desired target-version and
- dnl source-version. But ignore the version of conftest.class.
- if test "$target_version" = 1.4 && test "$source_version" = 1.4; then
- rm -f conftest.class
- if { echo "$as_me:__oline__: gcj -C -d . conftest.java" >&AS_MESSAGE_LOG_FD
- gcj -C -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class; then
- CONF_JAVAC="gcj -C"
- HAVE_GCJ_C=1
- HAVE_JAVACOMP=1
- fi
- else
- if test "$target_version" = 1.4 && test "$source_version" = 1.3; then
- dnl Try gcj and "gcj -fno-assert". But add -fno-assert only if
- dnl it works (not gcj < 3.3).
- rm -f conftest.class
- if { echo "$as_me:__oline__: gcj -C -fno-assert -d . conftest.java" >&AS_MESSAGE_LOG_FD
- gcj -C -fno-assert -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class; then
- CONF_JAVAC="gcj -C -fno-assert"
- HAVE_GCJ_C=1
- HAVE_JAVACOMP=1
- else
- rm -f conftest.class
- if { echo "$as_me:__oline__: gcj -C -d . conftest.java" >&AS_MESSAGE_LOG_FD
- gcj -C -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class; then
- CONF_JAVAC="gcj -C"
- HAVE_GCJ_C=1
- HAVE_JAVACOMP=1
- fi
- fi
- fi
- fi
- fi
- fi
- fi
- if test -z "$HAVE_JAVACOMP" && test -n "$HAVE_JAVAC_IN_PATH"; then
- dnl Test whether javac is usable.
- if { javac -version >/dev/null 2>/dev/null || test $? -le 2; } \
- && ( if javac -help 2>&1 >/dev/null | grep at.dms.kjc.Main >/dev/null && javac -help 2>/dev/null | grep 'released.*2000' >/dev/null ; then exit 1; else exit 0; fi ); then
- dnl OK, javac works.
- dnl Now test whether it supports the desired target-version and
- dnl source-version.
- rm -f conftest.class
- if { echo "$as_me:__oline__: javac -d . conftest.java" >&AS_MESSAGE_LOG_FD
- javac -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class \
- && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then
- dnl Try adding -source option if it is useful.
- rm -f conftest.class
- rm -f conftestfail.class
- if { echo "$as_me:__oline__: javac -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
- javac -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class \
- && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD \
- && { echo "$as_me:__oline__: javac -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
- javac -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftestfail.class \
- && ! { echo "$as_me:__oline__: javac -source $source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
- javac -source "$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
- }; then
- CONF_JAVAC="javac -source $source_version"
- HAVE_JAVAC=1
- HAVE_JAVACOMP=1
- else
- CONF_JAVAC="javac"
- HAVE_JAVAC=1
- HAVE_JAVACOMP=1
- fi
- else
- dnl Try with -target option alone. (Sun javac 1.3.1 has the -target
- dnl option but no -source option.)
- rm -f conftest.class
- if { echo "$as_me:__oline__: javac -target $target_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
- javac -target "$target_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class \
- && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then
- dnl Try adding -source option if it is useful.
- rm -f conftest.class
- rm -f conftestfail.class
- if { echo "$as_me:__oline__: javac -target $target_version -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
- javac -target "$target_version" -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class \
- && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD \
- && { echo "$as_me:__oline__: javac -target $target_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
- javac -target "$target_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftestfail.class \
- && ! { echo "$as_me:__oline__: javac -target $target_version -source $source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
- javac -target "$target_version" -source "$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
- }; then
- CONF_JAVAC="javac -target $target_version -source $source_version"
- HAVE_JAVAC=1
- HAVE_JAVACOMP=1
- else
- CONF_JAVAC="javac -target $target_version"
- HAVE_JAVAC=1
- HAVE_JAVACOMP=1
- fi
- else
- dnl Maybe this -target option requires a -source option? Try with
- dnl -target and -source options. (Supported by Sun javac 1.4 and
- dnl higher.)
- rm -f conftest.class
- if { echo "$as_me:__oline__: javac -target $target_version -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
- javac -target "$target_version" -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
- } \
- && test -f conftest.class \
- && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then
- CONF_JAVAC="javac -target $target_version -source $source_version"
- HAVE_JAVAC=1
- HAVE_JAVACOMP=1
- fi
- fi
- fi
- fi
- fi
- if test -z "$HAVE_JAVACOMP" && test -n "$HAVE_JIKES_IN_PATH"; then
- dnl Test whether jikes is usable.
- if { jikes >/dev/null 2>/dev/null || test $? = 1; } \
- && (
- # See if the existing CLASSPATH is sufficient to make jikes work.
- unset JAVA_HOME
- jikes conftestlib.java >&AS_MESSAGE_LOG_FD 2>&1
- error=$?
- rm -f conftestlib.class
- exit $error
- ); then
- dnl OK, jikes works.
- dnl Now test whether it supports the desired target-version and
- dnl source-version.
- if test "$source_version" = 1.3; then
- CONF_JAVAC="jikes"
- HAVE_JIKES=1
- HAVE_JAVACOMP=1
- fi
- fi
- fi
- fi
- rm -f conftest*.java conftest*.class
- if test -n "$HAVE_JAVACOMP"; then
- ac_result="$CONF_JAVAC"
- else
- ac_result="no"
- fi
- AC_MSG_RESULT([$ac_result])
- AC_SUBST(CONF_JAVAC)
- AC_SUBST(CLASSPATH)
- AC_SUBST(CLASSPATH_SEPARATOR)
- AC_SUBST(HAVE_JAVAC_ENVVAR)
- AC_SUBST(HAVE_GCJ_C)
- AC_SUBST(HAVE_JAVAC)
- AC_SUBST(HAVE_JIKES)
-])
+++ /dev/null
-# javaexec.m4 serial 4 (gettext-0.15)
-dnl Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-# Prerequisites of javaexec.sh.
-# gt_JAVAEXEC or gt_JAVAEXEC(testclass, its-directory)
-# Sets HAVE_JAVAEXEC to nonempty if javaexec.sh will work.
-
-AC_DEFUN([gt_JAVAEXEC],
-[
- AC_MSG_CHECKING([for Java virtual machine])
- AC_EGREP_CPP(yes, [
-#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
- yes
-#endif
-], CLASSPATH_SEPARATOR=';', CLASSPATH_SEPARATOR=':')
- CONF_JAVA=
- HAVE_JAVA_ENVVAR=
- HAVE_GIJ=
- HAVE_JAVA=
- HAVE_JRE=
- HAVE_JVIEW=
- HAVE_JAVAEXEC=1
- if test -n "$JAVA"; then
- HAVE_JAVA_ENVVAR=1
- CONF_JAVA="$JAVA"
- else
- pushdef([AC_MSG_CHECKING],[:])dnl
- pushdef([AC_CHECKING],[:])dnl
- pushdef([AC_MSG_RESULT],[:])dnl
- AC_CHECK_PROG(HAVE_GIJ_IN_PATH, gij, yes)
- AC_CHECK_PROG(HAVE_JAVA_IN_PATH, java, yes)
- AC_CHECK_PROG(HAVE_JRE_IN_PATH, jre, yes)
- AC_CHECK_PROG(HAVE_JVIEW_IN_PATH, jview, yes)
- popdef([AC_MSG_RESULT])dnl
- popdef([AC_CHECKING])dnl
- popdef([AC_MSG_CHECKING])dnl
- ifelse([$1], , , [
- save_CLASSPATH="$CLASSPATH"
- CLASSPATH="$2"${CLASSPATH+"$CLASSPATH_SEPARATOR$CLASSPATH"}
- ])
- export CLASSPATH
- if test -n "$HAVE_GIJ_IN_PATH" \
- && gij --version >/dev/null 2>/dev/null \
- ifelse([$1], , , [&& {
- echo "$as_me:__oline__: gij $1" >&AS_MESSAGE_LOG_FD
- gij $1 >&AS_MESSAGE_LOG_FD 2>&1
- }]); then
- HAVE_GIJ=1
- CONF_JAVA="gij"
- else
- if test -n "$HAVE_JAVA_IN_PATH" \
- && java -version >/dev/null 2>/dev/null \
- ifelse([$1], , , [&& {
- echo "$as_me:__oline__: gij $1" >&AS_MESSAGE_LOG_FD
- java $1 >&AS_MESSAGE_LOG_FD 2>&1
- }]); then
- HAVE_JAVA=1
- CONF_JAVA="java"
- else
- if test -n "$HAVE_JRE_IN_PATH" \
- && (jre >/dev/null 2>/dev/null || test $? = 1) \
- ifelse([$1], , , [&& {
- echo "$as_me:__oline__: gij $1" >&AS_MESSAGE_LOG_FD
- jre $1 >&AS_MESSAGE_LOG_FD 2>&1
- }]); then
- HAVE_JRE=1
- CONF_JAVA="jre"
- else
- if test -n "$HAVE_JVIEW_IN_PATH" \
- && (jview -? >/dev/null 2>/dev/null || test $? = 1) \
- ifelse([$1], , , [&& {
- echo "$as_me:__oline__: gij $1" >&AS_MESSAGE_LOG_FD
- jview $1 >&AS_MESSAGE_LOG_FD 2>&1
- }]); then
- HAVE_JVIEW=1
- CONF_JAVA="jview"
- else
- HAVE_JAVAEXEC=
- fi
- fi
- fi
- fi
- ifelse([$1], , , [
- CLASSPATH="$save_CLASSPATH"
- ])
- fi
- if test -n "$HAVE_JAVAEXEC"; then
- ac_result="$CONF_JAVA"
- else
- ac_result="no"
- fi
- AC_MSG_RESULT([$ac_result])
- AC_SUBST(CONF_JAVA)
- AC_SUBST(CLASSPATH)
- AC_SUBST(CLASSPATH_SEPARATOR)
- AC_SUBST(HAVE_JAVA_ENVVAR)
- AC_SUBST(HAVE_GIJ)
- AC_SUBST(HAVE_JAVA)
- AC_SUBST(HAVE_JRE)
- AC_SUBST(HAVE_JVIEW)
-])
+++ /dev/null
-# mbrtowc.m4 serial 8
-dnl Copyright (C) 2001-2002, 2004-2005 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Paul Eggert
-
-dnl This file can be removed, and gl_FUNC_MBRTOWC replaced with
-dnl AC_FUNC_MBRTOWC, when autoconf 2.60 can be assumed everywhere.
-
-AC_DEFUN([gl_FUNC_MBRTOWC],
-[
- dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60.
- AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
- gl_cv_func_mbrtowc,
- [AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <wchar.h>]],
- [[wchar_t wc;
- char const s[] = "";
- size_t n = 1;
- mbstate_t state;
- return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])],
- gl_cv_func_mbrtowc=yes,
- gl_cv_func_mbrtowc=no)])
- if test $gl_cv_func_mbrtowc = yes; then
- AC_DEFINE([HAVE_MBRTOWC], 1,
- [Define to 1 if mbrtowc and mbstate_t are properly declared.])
- fi
-])
+++ /dev/null
-# mbstate_t.m4 serial 9
-dnl Copyright (C) 2000, 2001, 2002 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.
-
-# From Paul Eggert.
-
-# BeOS 5 has <wchar.h> but does not define mbstate_t,
-# so you can't declare an object of that type.
-# Check for this incompatibility with Standard C.
-
-# AC_TYPE_MBSTATE_T
-# -----------------
-AC_DEFUN([AC_TYPE_MBSTATE_T],
- [AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [AC_INCLUDES_DEFAULT
-# include <wchar.h>],
- [mbstate_t x; return sizeof x;])],
- [ac_cv_type_mbstate_t=yes],
- [ac_cv_type_mbstate_t=no])])
- if test $ac_cv_type_mbstate_t = yes; then
- AC_DEFINE([HAVE_MBSTATE_T], 1,
- [Define to 1 if <wchar.h> declares mbstate_t.])
- else
- AC_DEFINE([mbstate_t], int,
- [Define to a type if <wchar.h> does not define.])
- fi])
+++ /dev/null
-# mbswidth.m4 serial 12
-dnl Copyright (C) 2000-2002, 2004, 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl autoconf tests required for use of mbswidth.c
-dnl From Bruno Haible.
-
-AC_DEFUN([gl_MBSWIDTH],
-[
- AC_CHECK_HEADERS_ONCE([wchar.h wctype.h])
- AC_CHECK_FUNCS_ONCE([isascii mbsinit])
- AC_CHECK_FUNCS([iswcntrl])
- gl_FUNC_MBRTOWC
-
- dnl UnixWare 7.1.1 <wchar.h> has a declaration of a function mbswidth()
- dnl that clashes with ours.
- AC_CACHE_CHECK([whether mbswidth is declared in <wchar.h>],
- ac_cv_have_decl_mbswidth,
- [AC_TRY_COMPILE([
-#if HAVE_WCHAR_H
-# include <wchar.h>
-#endif
-], [
- char *p = (char *) mbswidth;
-], ac_cv_have_decl_mbswidth=yes, ac_cv_have_decl_mbswidth=no)])
- if test $ac_cv_have_decl_mbswidth = yes; then
- ac_val=1
- else
- ac_val=0
- fi
- AC_DEFINE_UNQUOTED(HAVE_DECL_MBSWIDTH_IN_WCHAR_H, $ac_val,
- [Define to 1 if you have a declaration of mbswidth() in <wchar.h>, and to 0 otherwise.])
-
- AC_TYPE_MBSTATE_T
-])
+++ /dev/null
-# memchr.m4 serial 4
-dnl Copyright (C) 2002, 2003, 2004 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_MEMCHR],
-[
- AC_REPLACE_FUNCS(memchr)
- if test $ac_cv_func_memchr = no; then
- gl_PREREQ_MEMCHR
- fi
-])
-
-# Prerequisites of lib/memchr.c.
-AC_DEFUN([gl_PREREQ_MEMCHR], [
- AC_CHECK_HEADERS(bp-sym.h)
-])
+++ /dev/null
-# minmax.m4 serial 2
-dnl Copyright (C) 2005 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_PREREQ(2.52)
-
-AC_DEFUN([gl_MINMAX],
-[
- AC_REQUIRE([gl_PREREQ_MINMAX])
-])
-
-# Prerequisites of lib/minmax.h.
-AC_DEFUN([gl_PREREQ_MINMAX],
-[
- gl_MINMAX_IN_HEADER([limits.h])
- gl_MINMAX_IN_HEADER([sys/param.h])
-])
-
-dnl gl_MINMAX_IN_HEADER(HEADER)
-dnl The parameter has to be a literal header name; it cannot be macro,
-dnl nor a shell variable. (Because autoheader collects only AC_DEFINE
-dnl invocations with a literal macro name.)
-AC_DEFUN([gl_MINMAX_IN_HEADER],
-[
- m4_pushdef([header], AS_TR_SH([$1]))
- m4_pushdef([HEADER], AS_TR_CPP([$1]))
- AC_CACHE_CHECK([whether <$1> defines MIN and MAX],
- [gl_cv_minmax_in_]header,
- [AC_TRY_COMPILE([#include <$1>
-int x = MIN (42, 17);], [],
- [gl_cv_minmax_in_]header[=yes],
- [gl_cv_minmax_in_]header[=no])])
- if test $gl_cv_minmax_in_[]header = yes; then
- AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1,
- [Define to 1 if <$1> defines the MIN and MAX macros.])
- fi
- m4_popdef([HEADER])
- m4_popdef([header])
-])
+++ /dev/null
-# mkdtemp.m4 serial 3
-dnl Copyright (C) 2001-2003 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([gt_FUNC_MKDTEMP],
-[
- AC_REPLACE_FUNCS(mkdtemp)
- if test $ac_cv_func_mkdtemp = no; then
- gl_PREREQ_MKDTEMP
- fi
-])
-
-# Prerequisites of lib/mkdtemp.c
-AC_DEFUN([gl_PREREQ_MKDTEMP],
-[
- AC_REQUIRE([AC_HEADER_STAT])
- AC_CHECK_HEADERS_ONCE(sys/time.h unistd.h)
- AC_CHECK_HEADERS(time.h)
- AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])
- AC_CHECK_FUNCS(gettimeofday)
-])
+++ /dev/null
-# onceonly.m4 serial 5 (gettext-0.15)
-dnl Copyright (C) 2002-2003, 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl This file defines some "once only" variants of standard autoconf macros.
-dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
-dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
-dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
-dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL
-dnl The advantage is that the check for each of the headers/functions/decls
-dnl will be put only once into the 'configure' file. It keeps the size of
-dnl the 'configure' file down, and avoids redundant output when 'configure'
-dnl is run.
-dnl The drawback is that the checks cannot be conditionalized. If you write
-dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
-dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
-dnl empty, and the check will be inserted before the body of the AC_DEFUNed
-dnl function.
-
-dnl This file is only needed in autoconf <= 2.59. Newer versions of autoconf
-dnl have this macro built-in. But about AC_CHECK_DECLS_ONCE: note that in
-dnl autoconf >= 2.60 the symbol separator is a comma, whereas here it is
-dnl whitespace.
-
-dnl Autoconf version 2.57 or newer is recommended.
-AC_PREREQ(2.54)
-
-# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
-# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
-AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
- :
- AC_FOREACH([gl_HEADER_NAME], [$1], [
- AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(m4_defn([gl_HEADER_NAME]),
- [-./], [___])), [
- AC_CHECK_HEADERS(gl_HEADER_NAME)
- ])
- AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
- [-./], [___])))
- ])
-])
-
-# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
-# AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
-AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
- :
- AC_FOREACH([gl_FUNC_NAME], [$1], [
- AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
- AC_CHECK_FUNCS(m4_defn([gl_FUNC_NAME]))
- ])
- AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
- ])
-])
-
-# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
-# AC_CHECK_DECLS(DECL1, DECL2, ...).
-AC_DEFUN([AC_CHECK_DECLS_ONCE], [
- :
- AC_FOREACH([gl_DECL_NAME], [$1], [
- AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
- AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
- ])
- AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
- ])
-])
+++ /dev/null
-# pathmax.m4 serial 3
-dnl Copyright (C) 2002, 2003 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_PATHMAX],
-[
- dnl Prerequisites of lib/pathmax.h.
- AC_CHECK_HEADERS_ONCE(sys/param.h unistd.h)
-])
+++ /dev/null
-# quote.m4 serial 3
-dnl Copyright (C) 2002, 2003 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_QUOTE],
-[
- dnl Prerequisites of lib/quote.c.
- dnl (none)
-])
+++ /dev/null
-# quotearg.m4 serial 3
-dnl Copyright (C) 2002, 2004 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_QUOTEARG],
-[
- dnl Prerequisites of lib/quotearg.c.
- AC_CHECK_HEADERS_ONCE(wchar.h wctype.h)
- AC_CHECK_FUNCS_ONCE(iswprint mbsinit)
- AC_TYPE_MBSTATE_T
- gl_FUNC_MBRTOWC
-])
+++ /dev/null
-# readlink.m4 serial 2
-dnl Copyright (C) 2003 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_READLINK],
-[
- AC_CHECK_FUNCS(readlink)
- if test $ac_cv_func_readlink = no; then
- AC_LIBOBJ(readlink)
- gl_PREREQ_READLINK
- fi
-])
-
-# Prerequisites of lib/readlink.c.
-AC_DEFUN([gl_PREREQ_READLINK],
-[
- :
-])
+++ /dev/null
-#serial 1003
-dnl Copyright (C) 2003 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.
-
-# This macro can be removed once we can rely on Autoconf 2.57a or later,
-# since we can then use its AC_C_RESTRICT.
-
-# gl_C_RESTRICT
-# --------------
-# Determine whether the C/C++ compiler supports the "restrict" keyword
-# introduced in ANSI C99, or an equivalent. Do nothing if the compiler
-# accepts it. Otherwise, if the compiler supports an equivalent,
-# define "restrict" to be that. Here are some variants:
-# - GCC supports both __restrict and __restrict__
-# - older DEC Alpha C compilers support only __restrict
-# - _Restrict is the only spelling accepted by Sun WorkShop 6 update 2 C
-# Otherwise, define "restrict" to be empty.
-AC_DEFUN([gl_C_RESTRICT],
-[AC_CACHE_CHECK([for C/C++ restrict keyword], gl_cv_c_restrict,
- [gl_cv_c_restrict=no
- # Try the official restrict keyword, then gcc's __restrict, and
- # the less common variants.
- for ac_kw in restrict __restrict __restrict__ _Restrict; do
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
- [float * $ac_kw x;])],
- [gl_cv_c_restrict=$ac_kw; break])
- done
- ])
- case $gl_cv_c_restrict in
- restrict) ;;
- no) AC_DEFINE(restrict,,
- [Define to equivalent of C99 restrict keyword, or to nothing if this
- is not supported. Do not define if restrict is supported directly.]) ;;
- *) AC_DEFINE_UNQUOTED(restrict, $gl_cv_c_restrict) ;;
- esac
-])
+++ /dev/null
-# setenv.m4 serial 6
-dnl Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gt_FUNC_SETENV],
-[
- AC_REPLACE_FUNCS(setenv unsetenv)
- if test $ac_cv_func_setenv = no; then
- gl_PREREQ_SETENV
- fi
- if test $ac_cv_func_unsetenv = no; then
- gl_PREREQ_UNSETENV
- else
- AC_CACHE_CHECK([for unsetenv() return type], gt_cv_func_unsetenv_ret,
- [AC_TRY_COMPILE([#include <stdlib.h>
-extern
-#ifdef __cplusplus
-"C"
-#endif
-#if defined(__STDC__) || defined(__cplusplus)
-int unsetenv (const char *name);
-#else
-int unsetenv();
-#endif
-], , gt_cv_func_unsetenv_ret='int', gt_cv_func_unsetenv_ret='void')])
- if test $gt_cv_func_unsetenv_ret = 'void'; then
- AC_DEFINE(VOID_UNSETENV, 1, [Define if unsetenv() returns void, not int.])
- fi
- fi
-])
-
-# Check if a variable is properly declared.
-# gt_CHECK_VAR_DECL(includes,variable)
-AC_DEFUN([gt_CHECK_VAR_DECL],
-[
- define([gt_cv_var], [gt_cv_var_]$2[_declaration])
- AC_MSG_CHECKING([if $2 is properly declared])
- AC_CACHE_VAL(gt_cv_var, [
- AC_TRY_COMPILE([$1
- extern struct { int foo; } $2;],
- [$2.foo = 1;],
- gt_cv_var=no,
- gt_cv_var=yes)])
- AC_MSG_RESULT($gt_cv_var)
- if test $gt_cv_var = yes; then
- AC_DEFINE([HAVE_]translit($2, [a-z], [A-Z])[_DECL], 1,
- [Define if you have the declaration of $2.])
- fi
-])
-
-# Prerequisites of lib/setenv.c.
-AC_DEFUN([gl_PREREQ_SETENV],
-[
- AC_REQUIRE([AC_FUNC_ALLOCA])
- AC_CHECK_HEADERS_ONCE(unistd.h)
- AC_CHECK_HEADERS(search.h)
- AC_CHECK_FUNCS(tsearch)
- gt_CHECK_VAR_DECL([#include <unistd.h>], environ)
-])
-
-# Prerequisites of lib/unsetenv.c.
-AC_DEFUN([gl_PREREQ_UNSETENV],
-[
- AC_CHECK_HEADERS_ONCE(unistd.h)
- gt_CHECK_VAR_DECL([#include <unistd.h>], environ)
-])
+++ /dev/null
-# sig_atomic_t.m4 serial 1 (gettext-0.13)
-dnl Copyright (C) 2003 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([gt_TYPE_SIG_ATOMIC_T],
-[
- AC_CHECK_TYPES(sig_atomic_t, ,
- [AC_DEFINE(sig_atomic_t, int,
- [Define as an integer type suitable for memory locations that can be
- accessed atomically even in the presence of asynchnonous signals.])],
- [#include <signal.h>])
-])
+++ /dev/null
-# signalblocking.m4 serial 1 (gettext-0.11)
-dnl Copyright (C) 2001-2002 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.
-
-# Determine available signal blocking primitives. Three different APIs exist:
-# 1) POSIX: sigemptyset, sigaddset, sigprocmask
-# 2) SYSV: sighold, sigrelse
-# 3) BSD: sigblock, sigsetmask
-# For simplicity, here we check only for the POSIX signal blocking.
-AC_DEFUN([gt_SIGNALBLOCKING],
-[
- signals_not_posix=
- AC_EGREP_HEADER(sigset_t, signal.h, , signals_not_posix=1)
- if test -z "$signals_not_posix"; then
- AC_CHECK_FUNC(sigprocmask,
- AC_DEFINE(HAVE_POSIX_SIGNALBLOCKING, 1,
- [Define to 1 if you have the sigset_t type and the sigprocmask function.]))
- fi
-])
+++ /dev/null
-# ssize_t.m4 serial 4 (gettext-0.15)
-dnl Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-dnl Test whether ssize_t is defined.
-
-AC_DEFUN([gt_TYPE_SSIZE_T],
-[
- AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t],
- [AC_TRY_COMPILE([#include <sys/types.h>],
- [int x = sizeof (ssize_t *) + sizeof (ssize_t);
- return !x;],
- [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])])
- if test $gt_cv_ssize_t = no; then
- AC_DEFINE([ssize_t], [int],
- [Define as a signed type of the same size as size_t.])
- fi
-])
+++ /dev/null
-# stdarg.m4 serial 1
-dnl Copyright (C) 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-dnl Provide a working va_copy in combination with <stdarg.h>.
-
-AC_DEFUN([gl_STDARG_H],
-[
- AC_MSG_CHECKING([for va_copy])
- AC_CACHE_VAL([gl_cv_func_va_copy], [
- AC_TRY_COMPILE([#include <stdarg.h>], [
-#ifndef va_copy
-void (*func) (va_list, va_list) = va_copy;
-#endif
-],
- [gl_cv_func_va_copy=yes], [gl_cv_func_va_copy=no])])
- AC_MSG_RESULT([$gl_cv_func_va_copy])
- if test $gl_cv_func_va_copy = no; then
- # Provide a substitute, either __va_copy or as a simple assignment.
- AC_CACHE_VAL([gl_cv_func___va_copy], [
- AC_TRY_COMPILE([#include <stdarg.h>], [
-#ifndef __va_copy
-error, bail out
-#endif
-],
- [gl_cv_func___va_copy=yes], [gl_cv_func___va_copy=no])])
- if test $gl_cv_func___va_copy = yes; then
- AC_DEFINE([va_copy], [__va_copy],
- [Define as a macro for copying va_list variables.])
- else
- AH_VERBATIM([gl_VA_COPY], [/* A replacement for va_copy, if needed. */
-#define gl_va_copy(a,b) ((a) = (b))])
- AC_DEFINE([va_copy], [gl_va_copy],
- [Define as a macro for copying va_list variables.])
- fi
- fi
-])
+++ /dev/null
-# Check for stdbool.h that conforms to C99.
-
-dnl Copyright (C) 2002-2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-# Prepare for substituting <stdbool.h> if it is not supported.
-
-AC_DEFUN([AM_STDBOOL_H],
-[
- AC_REQUIRE([AC_HEADER_STDBOOL])
-
- # Define two additional variables used in the Makefile substitution.
-
- if test "$ac_cv_header_stdbool_h" = yes; then
- STDBOOL_H=''
- else
- STDBOOL_H='stdbool.h'
- fi
- AC_SUBST([STDBOOL_H])
-
- if test "$ac_cv_type__Bool" = yes; then
- HAVE__BOOL=1
- else
- HAVE__BOOL=0
- fi
- AC_SUBST([HAVE__BOOL])
-])
-
-# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future.
-AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H])
-
-# This macro is only needed in autoconf <= 2.59. Newer versions of autoconf
-# have this macro built-in.
-
-AC_DEFUN([AC_HEADER_STDBOOL],
- [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
- [ac_cv_header_stdbool_h],
- [AC_TRY_COMPILE(
- [
- #include <stdbool.h>
- #ifndef bool
- "error: bool is not defined"
- #endif
- #ifndef false
- "error: false is not defined"
- #endif
- #if false
- "error: false is not 0"
- #endif
- #ifndef true
- "error: true is not defined"
- #endif
- #if true != 1
- "error: true is not 1"
- #endif
- #ifndef __bool_true_false_are_defined
- "error: __bool_true_false_are_defined is not defined"
- #endif
-
- struct s { _Bool s: 1; _Bool t; } s;
-
- char a[true == 1 ? 1 : -1];
- char b[false == 0 ? 1 : -1];
- char c[__bool_true_false_are_defined == 1 ? 1 : -1];
- char d[(bool) 0.5 == true ? 1 : -1];
- bool e = &s;
- char f[(_Bool) 0.0 == false ? 1 : -1];
- char g[true];
- char h[sizeof (_Bool)];
- char i[sizeof s.t];
- enum { j = false, k = true, l = false * true, m = true * 256 };
- _Bool n[m];
- char o[sizeof n == m * sizeof n[0] ? 1 : -1];
- char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
- #if defined __xlc__ || defined __GNUC__
- /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
- reported by James Lemley on 2005-10-05; see
- http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
- This test is not quite right, since xlc is allowed to
- reject this program, as the initializer for xlcbug is
- not one of the forms that C requires support for.
- However, doing the test right would require a run-time
- test, and that would make cross-compilation harder.
- Let us hope that IBM fixes the xlc bug, and also adds
- support for this kind of constant expression. In the
- meantime, this test will reject xlc, which is OK, since
- our stdbool.h substitute should suffice. We also test
- this with GCC, where it should work, to detect more
- quickly whether someone messes up the test in the
- future. */
- char digs[] = "0123456789";
- int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
- #endif
- /* Catch a bug in an HP-UX C compiler. See
- http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
- http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
- */
- _Bool q = true;
- _Bool *pq = &q;
- ],
- [
- *pq |= q;
- *pq |= ! q;
- /* Refer to every declared value, to avoid compiler optimizations. */
- return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
- + !m + !n + !o + !p + !q + !pq);
- ],
- [ac_cv_header_stdbool_h=yes],
- [ac_cv_header_stdbool_h=no])])
- AC_CHECK_TYPES([_Bool])
- if test $ac_cv_header_stdbool_h = yes; then
- AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])
- fi])
+++ /dev/null
-# stpncpy.m4 serial 3
-dnl Copyright (C) 2002-2003, 2005 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_STPNCPY],
-[
- dnl Persuade glibc <string.h> to declare stpncpy().
- AC_REQUIRE([AC_GNU_SOURCE])
-
- dnl Both glibc and AIX (4.3.3, 5.1) have an stpncpy() function
- dnl declared in <string.h>. Its side effects are the same as those
- dnl of strncpy():
- dnl stpncpy (dest, src, n)
- dnl overwrites dest[0..n-1], min(strlen(src),n) bytes coming from src,
- dnl and the remaining bytes being NULs. However, the return value is
- dnl in glibc: dest + min(strlen(src),n)
- dnl in AIX: dest + max(0,n-1)
- dnl Only the glibc return value is useful in practice.
-
- AC_CACHE_CHECK([for working stpncpy], gl_cv_func_stpncpy, [
- AC_TRY_RUN([
-#include <stdlib.h>
-extern char *stpncpy (char *dest, const char *src, size_t n);
-int main () {
- const char *src = "Hello";
- char dest[10];
- /* AIX 4.3.3 and AIX 5.1 stpncpy() returns dest+1 here. */
- strcpy (dest, "\377\377\377\377\377\377");
- if (stpncpy (dest, src, 2) != dest + 2) exit(1);
- /* AIX 4.3.3 and AIX 5.1 stpncpy() returns dest+4 here. */
- strcpy (dest, "\377\377\377\377\377\377");
- if (stpncpy (dest, src, 5) != dest + 5) exit(1);
- /* AIX 4.3.3 and AIX 5.1 stpncpy() returns dest+6 here. */
- strcpy (dest, "\377\377\377\377\377\377");
- if (stpncpy (dest, src, 7) != dest + 5) exit(1);
- exit(0);
-}
-], gl_cv_func_stpncpy=yes, gl_cv_func_stpncpy=no,
- [AC_EGREP_CPP([Thanks for using GNU], [
-#include <features.h>
-#ifdef __GNU_LIBRARY__
- Thanks for using GNU
-#endif
-], gl_cv_func_stpncpy=yes, gl_cv_func_stpncpy=no)])])
-
- if test $gl_cv_func_stpncpy = yes; then
- AC_DEFINE(HAVE_STPNCPY, 1,
- [Define if you have the stpncpy() function and it works.])
- else
- AC_LIBOBJ([stpncpy])
- gl_PREREQ_STPNCPY
- fi
-])
-
-# Prerequisites of lib/stpncpy.c.
-AC_DEFUN([gl_PREREQ_STPNCPY], [
- :
-])
-
+++ /dev/null
-# strdup.m4 serial 5
-dnl Copyright (C) 2002, 2003, 2004 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_STRDUP],
-[
- AC_REPLACE_FUNCS(strdup)
- AC_CHECK_DECLS_ONCE(strdup)
- gl_PREREQ_STRDUP
-])
-
-# Prerequisites of lib/strdup.c.
-AC_DEFUN([gl_PREREQ_STRDUP], [:])
+++ /dev/null
-# strerror.m4 serial 2
-dnl Copyright (C) 2002 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_STRERROR],
-[
- AC_REPLACE_FUNCS(strerror)
- if test $ac_cv_func_strerror = no; then
- gl_PREREQ_STRERROR
- fi
-])
-
-# Prerequisites of lib/strerror.c.
-AC_DEFUN([gl_PREREQ_STRERROR], [
- :
-])
+++ /dev/null
-#serial 1004
-# This file is not needed if you can assume Autoconf 2.54 or later.
-# Experimental replacement for the function in the latest CVS autoconf.
-# Use with the error.c file in ../lib.
-
-# Copyright (C) 2001 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.
-
-undefine([AC_FUNC_STRERROR_R])
-
-# AC_FUNC_STRERROR_R
-# ------------------
-AC_DEFUN([AC_FUNC_STRERROR_R],
-[AC_CHECK_DECLS([strerror_r])
-AC_CHECK_FUNCS([strerror_r])
-AC_CACHE_CHECK([whether strerror_r returns char *],
- ac_cv_func_strerror_r_char_p,
- [
- ac_cv_func_strerror_r_char_p=no
- if test $ac_cv_have_decl_strerror_r = yes; then
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
- [[
- char buf[100];
- char x = *strerror_r (0, buf, sizeof buf);
- char *p = strerror_r (0, buf, sizeof buf);
- return !p || x;
- ]])],
- ac_cv_func_strerror_r_char_p=yes)
- else
- # strerror_r is not declared. Choose between
- # systems that have relatively inaccessible declarations for the
- # function. BeOS and DEC UNIX 4.0 fall in this category, but the
- # former has a strerror_r that returns char*, while the latter
- # has a strerror_r that returns `int'.
- # This test should segfault on the DEC system.
- AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
- extern char *strerror_r ();],
- [[char buf[100];
- char x = *strerror_r (0, buf, sizeof buf);
- exit (!isalpha (x));]])],
- ac_cv_func_strerror_r_char_p=yes, , :)
- fi
- ])
-if test $ac_cv_func_strerror_r_char_p = yes; then
- AC_DEFINE([STRERROR_R_CHAR_P], 1,
- [Define to 1 if strerror_r returns char *.])
-fi
-])# AC_FUNC_STRERROR_R
+++ /dev/null
-# strtol.m4 serial 4
-dnl Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_STRTOL],
-[
- AC_REPLACE_FUNCS(strtol)
-])
+++ /dev/null
-# strtoul.m4 serial 3
-dnl Copyright (C) 2002, 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_STRTOUL],
-[
- AC_REPLACE_FUNCS(strtoul)
-])
+++ /dev/null
-# tls.m4 serial 1 (gettext-0.15)
-dnl Copyright (C) 2005 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-
-AC_DEFUN([gl_TLS],
-[
- AC_REQUIRE([gl_LOCK])
-])
+++ /dev/null
-# tmpdir.m4 serial 2 (gettext-0.15)
-dnl Copyright (C) 2001-2002, 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-# Prerequisites for lib/tmpdir.c
-
-AC_DEFUN([gt_TMPDIR],
-[
- AC_CHECK_FUNCS(__secure_getenv)
-])
+++ /dev/null
-# unistd_h.m4 serial 2
-dnl Copyright (C) 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl Written by Simon Josefsson
-
-AC_DEFUN([gl_HEADER_UNISTD],
-[
- dnl Prerequisites of lib/unistd.h.
- AC_CHECK_HEADERS([unistd.h], [
- UNISTD_H=''
- ], [
- UNISTD_H='unistd.h'
- ])
- AC_SUBST(UNISTD_H)
-])
+++ /dev/null
-# unlocked-io.m4 serial 10
-
-dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
-dnl Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Jim Meyering.
-dnl
-dnl See if the glibc *_unlocked I/O macros or functions are available.
-dnl Use only those *_unlocked macros or functions that are declared
-dnl (because some of them were declared in Solaris 2.5.1 but were removed
-dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run
-dnl on Solaris 2.6).
-
-AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO],
-[
- AC_DEFINE([USE_UNLOCKED_IO], 1,
- [Define to 1 if you want getc etc. to use unlocked I/O if available.
- Unlocked I/O can improve performance in unithreaded apps,
- but it is not safe for multithreaded apps.])
-
- dnl Persuade glibc and Solaris <stdio.h> to declare
- dnl fgets_unlocked(), fputs_unlocked() etc.
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- AC_CHECK_DECLS_ONCE(
- [clearerr_unlocked feof_unlocked ferror_unlocked
- fflush_unlocked fgets_unlocked fputc_unlocked fputs_unlocked
- fread_unlocked fwrite_unlocked getc_unlocked
- getchar_unlocked putc_unlocked putchar_unlocked])
-])
+++ /dev/null
-# wcwidth.m4 serial 3
-dnl Copyright (C) 2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_WCWIDTH],
-[
- dnl Persuade glibc <wchar.h> to declare wcwidth().
- AC_REQUIRE([AC_GNU_SOURCE])
-
- AC_REQUIRE([AC_C_INLINE])
- AC_REQUIRE([gt_TYPE_WCHAR_T])
-
- AC_CHECK_HEADERS_ONCE([wchar.h wctype.h])
- AC_CHECK_FUNCS_ONCE([iswprint wcwidth])
-
- AC_CHECK_DECLS([wcwidth], [], [], [
-/* AIX 3.2.5 declares wcwidth in <string.h>. */
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-#if HAVE_WCHAR_H
-# include <wchar.h>
-#endif
-])])