mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
update gettext sources
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@407 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7085256982
commit
1c467c80d7
@ -1,3 +1,75 @@
|
||||
1998-04-29 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* intl/localealias.c (read_alias_file): Use unsigned char for
|
||||
local variables. Remove unused variable tp.
|
||||
* intl/l10nflist.c (_nl_normalize_codeset): Use unsigned char *
|
||||
for type of codeset. For loosing Solaris systems.
|
||||
* intl/loadinfo.h: Adapt prototype of _nl_normalize_codeset.
|
||||
* intl/bindtextdom.c (BINDTEXTDOMAIN): Don't define local variable
|
||||
len if not needed.
|
||||
Patches by Jim Meyering.
|
||||
|
||||
1998-04-28 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* loadmsgcat.c (_nl_load_domain): Don't assign the element use_mmap if
|
||||
mmap is not supported.
|
||||
|
||||
* hash-string.h: Don't include <values.h>.
|
||||
|
||||
1998-04-27 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* textdomain.c: Use strdup is available.
|
||||
|
||||
* localealias.c: Define HAVE_MEMPCPY so that we can use this
|
||||
function. Define and use semapahores to protect modfication of
|
||||
global objects when compiling for glibc. Add code to allow
|
||||
freeing alias table.
|
||||
|
||||
* l10nflist.c: Don't assume stpcpy not being a macro.
|
||||
|
||||
* gettextP.h: Define internal_function macri if not already done.
|
||||
Use glibc byte-swap macros instead of defining SWAP when compiled
|
||||
for glibc.
|
||||
(struct loaded_domain): Add elements to allow unloading.
|
||||
|
||||
* Makefile.in (distclean): Don't remove libintl.h here.
|
||||
|
||||
* bindtextdomain.c: Carry over changes from glibc. Use strdup if
|
||||
available.
|
||||
|
||||
* dcgettext.c: Don't assume stpcpy not being a macro. Mark internal
|
||||
functions. Add memory freeing code for glibc.
|
||||
|
||||
* dgettext.c: Update copyright.
|
||||
|
||||
* explodename.c: Include stdlib.h and string.h only if they exist.
|
||||
Use strings.h eventually.
|
||||
|
||||
* finddomain.c: Mark internal functions. Use strdup if available.
|
||||
Add memory freeing code for glibc.
|
||||
|
||||
1997-10-10 20:00 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* libgettext.h: Fix dummy textdomain and bindtextdomain macros.
|
||||
They should return reasonable values.
|
||||
Reported by Tom Tromey <tromey@cygnus.com>.
|
||||
|
||||
1997-09-16 03:33 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* libgettext.h: Define PARAMS also to `args' if __cplusplus is defined.
|
||||
* intlh.inst.in: Likewise.
|
||||
Reported by Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>.
|
||||
|
||||
* libintl.glibc: Update from current glibc version.
|
||||
|
||||
1997-09-06 02:10 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* intlh.inst.in: Reformat copyright.
|
||||
|
||||
1997-08-19 15:22 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* dcgettext.c (DCGETTEXT): Remove wrong comment.
|
||||
|
||||
1997-08-16 00:13 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* Makefile.in (install-data): Don't change directory to install.
|
||||
|
@ -79,7 +79,7 @@ DISTFILES.gettext = libintl.glibc intlh.inst.in
|
||||
.c.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) $<
|
||||
|
||||
INCLUDES = -I../src -I. -I$(top_srcdir)/src -I$(top_srcdir)/intl
|
||||
INCLUDES = -I../src -I. -I$(top_srcdir)/intl -I$(top_srcdir)/lib
|
||||
|
||||
all: all-@USE_INCLUDED_LIBINTL@
|
||||
|
||||
@ -171,7 +171,7 @@ mostlyclean:
|
||||
clean: mostlyclean
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile ID TAGS po2msg.sed po2tbl.sed libintl.h
|
||||
rm -f Makefile ID TAGS po2msg.sed po2tbl.sed
|
||||
|
||||
maintainer-clean: distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
|
@ -1 +1 @@
|
||||
GNU gettext library from gettext-0.10.31
|
||||
GNU gettext library from gettext-0.10.35
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Implementation of the bindtextdomain(3) function
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -61,6 +61,9 @@ extern struct binding *_nl_domain_bindings;
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define BINDTEXTDOMAIN __bindtextdomain
|
||||
# ifndef strdup
|
||||
# define strdup(str) __strdup (str)
|
||||
# endif
|
||||
#else
|
||||
# define BINDTEXTDOMAIN bindtextdomain__
|
||||
#endif
|
||||
@ -98,51 +101,76 @@ BINDTEXTDOMAIN (domainname, dirname)
|
||||
|
||||
if (binding != NULL)
|
||||
{
|
||||
/* The domain is already bound. Replace the old binding. */
|
||||
char *new_dirname;
|
||||
|
||||
if (strcmp (dirname, _nl_default_dirname) == 0)
|
||||
new_dirname = (char *) _nl_default_dirname;
|
||||
else
|
||||
/* The domain is already bound. If the new value and the old
|
||||
one are equal we simply do nothing. Otherwise replace the
|
||||
old binding. */
|
||||
if (strcmp (dirname, binding->dirname) != 0)
|
||||
{
|
||||
size_t len = strlen (dirname) + 1;
|
||||
new_dirname = (char *) malloc (len);
|
||||
if (new_dirname == NULL)
|
||||
return NULL;
|
||||
char *new_dirname;
|
||||
|
||||
memcpy (new_dirname, dirname, len);
|
||||
if (strcmp (dirname, _nl_default_dirname) == 0)
|
||||
new_dirname = (char *) _nl_default_dirname;
|
||||
else
|
||||
{
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
new_dirname = strdup (dirname);
|
||||
if (new_dirname == NULL)
|
||||
return NULL;
|
||||
#else
|
||||
size_t len = strlen (dirname) + 1;
|
||||
new_dirname = (char *) malloc (len);
|
||||
if (new_dirname == NULL)
|
||||
return NULL;
|
||||
|
||||
memcpy (new_dirname, dirname, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (binding->dirname != _nl_default_dirname)
|
||||
free (binding->dirname);
|
||||
|
||||
binding->dirname = new_dirname;
|
||||
}
|
||||
|
||||
if (strcmp (binding->dirname, _nl_default_dirname) != 0)
|
||||
free (binding->dirname);
|
||||
|
||||
binding->dirname = new_dirname;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We have to create a new binding. */
|
||||
#if !defined _LIBC && !defined HAVE_STRDUP
|
||||
size_t len;
|
||||
#endif
|
||||
struct binding *new_binding =
|
||||
(struct binding *) malloc (sizeof (*new_binding));
|
||||
|
||||
if (new_binding == NULL)
|
||||
return NULL;
|
||||
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
new_binding->domainname = strdup (domainname);
|
||||
if (new_binding->domainname == NULL)
|
||||
return NULL;
|
||||
#else
|
||||
len = strlen (domainname) + 1;
|
||||
new_binding->domainname = (char *) malloc (len);
|
||||
if (new_binding->domainname == NULL)
|
||||
return NULL;
|
||||
return NULL;
|
||||
memcpy (new_binding->domainname, domainname, len);
|
||||
#endif
|
||||
|
||||
if (strcmp (dirname, _nl_default_dirname) == 0)
|
||||
new_binding->dirname = (char *) _nl_default_dirname;
|
||||
else
|
||||
{
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
new_binding->dirname = strdup (dirname);
|
||||
if (new_binding->dirname == NULL)
|
||||
return NULL;
|
||||
#else
|
||||
len = strlen (dirname) + 1;
|
||||
new_binding->dirname = (char *) malloc (len);
|
||||
if (new_binding->dirname == NULL)
|
||||
return NULL;
|
||||
memcpy (new_binding->dirname, dirname, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Now enqueue it. */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Implementation of the dcgettext(3) function
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
/* Implementation of the dcgettext(3) function.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -91,7 +91,9 @@ void free ();
|
||||
because some ANSI C functions will require linking with this object
|
||||
file and the name space must not be polluted. */
|
||||
# define getcwd __getcwd
|
||||
# define stpcpy __stpcpy
|
||||
# ifndef stpcpy
|
||||
# define stpcpy __stpcpy
|
||||
# endif
|
||||
#else
|
||||
# if !defined HAVE_GETCWD
|
||||
char *getwd ();
|
||||
@ -162,10 +164,11 @@ struct binding *_nl_domain_bindings;
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
static char *find_msg PARAMS ((struct loaded_l10nfile *domain_file,
|
||||
const char *msgid));
|
||||
static const char *category_to_name PARAMS ((int category));
|
||||
const char *msgid)) internal_function;
|
||||
static const char *category_to_name PARAMS ((int category)) internal_function;
|
||||
static const char *guess_category_value PARAMS ((int category,
|
||||
const char *categoryname));
|
||||
const char *categoryname))
|
||||
internal_function;
|
||||
|
||||
|
||||
/* For those loosing systems which don't have `alloca' we have to add
|
||||
@ -294,10 +297,6 @@ DCGETTEXT (domainname, msgid, category)
|
||||
return (char *) msgid;
|
||||
}
|
||||
|
||||
/* We don't want libintl.a to depend on any other library. So
|
||||
we avoid the non-standard function stpcpy. In GNU C Library
|
||||
this function is available, though. Also allow the symbol
|
||||
HAVE_STPCPY to be defined. */
|
||||
stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname);
|
||||
}
|
||||
|
||||
@ -308,10 +307,7 @@ DCGETTEXT (domainname, msgid, category)
|
||||
xdomainname = (char *) alloca (strlen (categoryname)
|
||||
+ strlen (domainname) + 5);
|
||||
ADD_BLOCK (block_list, xdomainname);
|
||||
/* We don't want libintl.a to depend on any other library. So we
|
||||
avoid the non-standard function stpcpy. In GNU C Library this
|
||||
function is available, though. Also allow the symbol HAVE_STPCPY
|
||||
to be defined. */
|
||||
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"),
|
||||
domainname),
|
||||
".mo");
|
||||
@ -395,6 +391,7 @@ weak_alias (__dcgettext, dcgettext);
|
||||
|
||||
|
||||
static char *
|
||||
internal_function
|
||||
find_msg (domain_file, msgid)
|
||||
struct loaded_l10nfile *domain_file;
|
||||
const char *msgid;
|
||||
@ -483,6 +480,7 @@ find_msg (domain_file, msgid)
|
||||
|
||||
/* Return string representation of locale CATEGORY. */
|
||||
static const char *
|
||||
internal_function
|
||||
category_to_name (category)
|
||||
int category;
|
||||
{
|
||||
@ -542,6 +540,7 @@ category_to_name (category)
|
||||
|
||||
/* Guess value of current locale from value of the environment variables. */
|
||||
static const char *
|
||||
internal_function
|
||||
guess_category_value (category, categoryname)
|
||||
int category;
|
||||
const char *categoryname;
|
||||
@ -598,3 +597,28 @@ stpcpy (dest, src)
|
||||
return dest - 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
/* If we want to free all resources we have to do some work at
|
||||
program's end. */
|
||||
static void __attribute__ ((unused))
|
||||
free_mem (void)
|
||||
{
|
||||
struct binding *runp;
|
||||
|
||||
for (runp = _nl_domain_bindings; runp != NULL; runp = runp->next)
|
||||
{
|
||||
free (runp->domainname);
|
||||
if (runp->dirname != _nl_default_dirname)
|
||||
/* Yes, this is a pointer comparison. */
|
||||
free (runp->dirname);
|
||||
}
|
||||
|
||||
if (_nl_current_default_domain != _nl_default_default_domain)
|
||||
/* Yes, again a pointer comparison. */
|
||||
free ((char *) _nl_current_default_domain);
|
||||
}
|
||||
|
||||
text_set_element (__libc_subfreeres, free_mem);
|
||||
#endif
|
||||
|
@ -1,19 +1,19 @@
|
||||
/* dgettext.c -- implementation of the dgettext(3) function
|
||||
Copyright (C) 1995 Software Foundation, Inc.
|
||||
/* Implementation of the dgettext(3) function
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can 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 free software; you can 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.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -19,8 +19,15 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if defined STDC_HEADERS || defined _LIBC
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if defined HAVE_STRING_H || defined _LIBC
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "loadinfo.h"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Handle list of needed message catalogs
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -70,6 +70,7 @@ static struct loaded_l10nfile *_nl_loaded_domains;
|
||||
the DOMAINNAME and CATEGORY parameters with respect to the currently
|
||||
established bindings. */
|
||||
struct loaded_l10nfile *
|
||||
internal_function
|
||||
_nl_find_domain (dirname, locale, domainname)
|
||||
const char *dirname;
|
||||
char *locale;
|
||||
@ -95,9 +96,9 @@ _nl_find_domain (dirname, locale, domainname)
|
||||
|
||||
language[_territory][+audience][+special][,[sponsor][_revision]]
|
||||
|
||||
Beside the first all of them are allowed to be missing. If the
|
||||
full specified locale is not found, the less specific one are
|
||||
looked for. The various part will be stripped of according to
|
||||
Beside the first part all of them are allowed to be missing. If
|
||||
the full specified locale is not found, the less specific one are
|
||||
looked for. The various parts will be stripped off according to
|
||||
the following order:
|
||||
(1) revision
|
||||
(2) sponsor
|
||||
@ -142,12 +143,18 @@ _nl_find_domain (dirname, locale, domainname)
|
||||
alias_value = _nl_expand_alias (locale);
|
||||
if (alias_value != NULL)
|
||||
{
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
locale = strdup (alias_value);
|
||||
if (locale == NULL)
|
||||
return NULL;
|
||||
#else
|
||||
size_t len = strlen (alias_value) + 1;
|
||||
locale = (char *) malloc (len);
|
||||
if (locale == NULL)
|
||||
return NULL;
|
||||
|
||||
memcpy (locale, alias_value, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Now we determine the single parts of the locale name. First
|
||||
@ -187,3 +194,23 @@ _nl_find_domain (dirname, locale, domainname)
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
static void __attribute__ ((unused))
|
||||
free_mem (void)
|
||||
{
|
||||
struct loaded_l10nfile *runp = _nl_loaded_domains;
|
||||
|
||||
while (runp != NULL)
|
||||
{
|
||||
struct loaded_l10nfile *here = runp;
|
||||
if (runp->data != NULL)
|
||||
_nl_unload_domain ((struct loaded_domain *) runp->data);
|
||||
runp = runp->next;
|
||||
free (here);
|
||||
}
|
||||
}
|
||||
|
||||
text_set_element (__libc_subfreeres, free_mem);
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Implementation of gettext(3) function
|
||||
/* Implementation of gettext(3) function.
|
||||
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Internal header for GNU gettext internationalization functions
|
||||
/* Internal header for GNU gettext internationalization functions.
|
||||
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* Header describing internals of gettext library
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -30,11 +31,19 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef internal_function
|
||||
# define internal_function
|
||||
#endif
|
||||
|
||||
#ifndef W
|
||||
# define W(flag, data) ((flag) ? SWAP (data) : (data))
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <byteswap.h>
|
||||
# define SWAP(i) bswap_32 (i)
|
||||
#else
|
||||
static nls_uint32 SWAP PARAMS ((nls_uint32 i));
|
||||
|
||||
static inline nls_uint32
|
||||
@ -43,11 +52,14 @@ SWAP (i)
|
||||
{
|
||||
return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
struct loaded_domain
|
||||
{
|
||||
const char *data;
|
||||
int use_mmap;
|
||||
size_t mmap_size;
|
||||
int must_swap;
|
||||
nls_uint32 nstrings;
|
||||
struct string_desc *orig_tab;
|
||||
@ -65,8 +77,12 @@ struct binding
|
||||
|
||||
struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
|
||||
char *__locale,
|
||||
const char *__domainname));
|
||||
void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain));
|
||||
const char *__domainname))
|
||||
internal_function;
|
||||
void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain))
|
||||
internal_function;
|
||||
void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
|
||||
internal_function;
|
||||
|
||||
/* @@ begin of epilog @@ */
|
||||
|
||||
|
@ -16,10 +16,6 @@
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_VALUES_H
|
||||
# include <values.h>
|
||||
#endif
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
#ifndef PARAMS
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Handle list of needed message catalogs
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -65,7 +65,9 @@
|
||||
/* Rename the non ANSI C functions. This is required by the standard
|
||||
because some ANSI C functions will require linking with this object
|
||||
file and the name space must not be polluted. */
|
||||
# define stpcpy(dest, src) __stpcpy(dest, src)
|
||||
# ifndef stpcpy
|
||||
# define stpcpy(dest, src) __stpcpy(dest, src)
|
||||
# endif
|
||||
#else
|
||||
# ifndef HAVE_STPCPY
|
||||
static char *stpcpy PARAMS ((char *dest, const char *src));
|
||||
@ -350,7 +352,7 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
|
||||
names. */
|
||||
const char *
|
||||
_nl_normalize_codeset (codeset, name_len)
|
||||
const char *codeset;
|
||||
const unsigned char *codeset;
|
||||
size_t name_len;
|
||||
{
|
||||
int len = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Message catalogs for internationalization.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -20,8 +20,8 @@
|
||||
include protection above. But the systems header might perhaps also
|
||||
define _LIBINTL_H and therefore we have to protect the definition here. */
|
||||
|
||||
#if !defined (_LIBINTL_H) || !defined (_LIBGETTEXT_H)
|
||||
#if !defined (_LIBINTL_H)
|
||||
#if !defined _LIBINTL_H || !defined _LIBGETTEXT_H
|
||||
#ifndef _LIBINTL_H
|
||||
# define _LIBINTL_H 1
|
||||
#endif
|
||||
#define _LIBGETTEXT_H 1
|
||||
@ -43,9 +43,8 @@ extern "C" {
|
||||
|
||||
/* @@ end of prolog @@ */
|
||||
|
||||
|
||||
#ifndef PARAMS
|
||||
# if defined(__STDC__) || defined(__cplusplus)
|
||||
# if __STDC__ || defined __cplusplus
|
||||
# define PARAMS(args) args
|
||||
# else
|
||||
# define PARAMS(args) ()
|
||||
@ -145,7 +144,7 @@ extern int _nl_msg_cat_cntr;
|
||||
(__extension__ \
|
||||
({ \
|
||||
char *__result; \
|
||||
if (__builtin_constant_p ((int)Msgid)) \
|
||||
if (__builtin_constant_p (Msgid)) \
|
||||
{ \
|
||||
static char *__translation__; \
|
||||
static int __catalog_counter__; \
|
||||
@ -169,8 +168,8 @@ extern int _nl_msg_cat_cntr;
|
||||
# define gettext(Msgid) (Msgid)
|
||||
# define dgettext(Domainname, Msgid) (Msgid)
|
||||
# define dcgettext(Domainname, Msgid, Category) (Msgid)
|
||||
# define textdomain(Domainname) while (0) /* nothing */
|
||||
# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
|
||||
# define textdomain(Domainname) ((char *) Domainname)
|
||||
# define bindtextdomain(Domainname, Dirname) ((char *) Dirname)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,3 +1,21 @@
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef PARAMS
|
||||
# if __STDC__
|
||||
# define PARAMS(args) args
|
||||
@ -32,7 +50,7 @@ struct loaded_l10nfile
|
||||
};
|
||||
|
||||
|
||||
extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
|
||||
extern const char *_nl_normalize_codeset PARAMS ((const unsigned char *codeset,
|
||||
size_t name_len));
|
||||
|
||||
extern struct loaded_l10nfile *
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Load needed message catalogs
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
/* Load needed message catalogs.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -44,7 +44,6 @@
|
||||
/* Rename the non ISO C functions. This is required by the standard
|
||||
because some ISO C functions will require linking with this object
|
||||
file and the name space must not be polluted. */
|
||||
# define fstat __fstat
|
||||
# define open __open
|
||||
# define close __close
|
||||
# define read __read
|
||||
@ -61,10 +60,12 @@ int _nl_msg_cat_cntr = 0;
|
||||
/* Load the message catalogs specified by FILENAME. If it is no valid
|
||||
message catalog do nothing. */
|
||||
void
|
||||
internal_function
|
||||
_nl_load_domain (domain_file)
|
||||
struct loaded_l10nfile *domain_file;
|
||||
{
|
||||
int fd;
|
||||
size_t size;
|
||||
struct stat st;
|
||||
struct mo_file_header *data = (struct mo_file_header *) -1;
|
||||
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|
||||
@ -90,7 +91,8 @@ _nl_load_domain (domain_file)
|
||||
|
||||
/* We must know about the size of the file. */
|
||||
if (fstat (fd, &st) != 0
|
||||
&& st.st_size < (off_t) sizeof (struct mo_file_header))
|
||||
|| (size = (size_t) st.st_size) != st.st_size
|
||||
|| size < sizeof (struct mo_file_header))
|
||||
{
|
||||
/* Something went wrong. */
|
||||
close (fd);
|
||||
@ -101,7 +103,7 @@ _nl_load_domain (domain_file)
|
||||
|| defined _LIBC
|
||||
/* Now we are ready to load the file. If mmap() is available we try
|
||||
this first. If not available or it failed we try to load it. */
|
||||
data = (struct mo_file_header *) mmap (NULL, st.st_size, PROT_READ,
|
||||
data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
|
||||
MAP_PRIVATE, fd, 0);
|
||||
|
||||
if (data != (struct mo_file_header *) -1)
|
||||
@ -116,14 +118,14 @@ _nl_load_domain (domain_file)
|
||||
it manually. */
|
||||
if (data == (struct mo_file_header *) -1)
|
||||
{
|
||||
off_t to_read;
|
||||
size_t to_read;
|
||||
char *read_ptr;
|
||||
|
||||
data = (struct mo_file_header *) malloc (st.st_size);
|
||||
data = (struct mo_file_header *) malloc (size);
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
to_read = st.st_size;
|
||||
to_read = size;
|
||||
read_ptr = (char *) data;
|
||||
do
|
||||
{
|
||||
@ -150,7 +152,7 @@ _nl_load_domain (domain_file)
|
||||
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|
||||
|| defined _LIBC
|
||||
if (use_mmap)
|
||||
munmap ((caddr_t) data, st.st_size);
|
||||
munmap ((caddr_t) data, size);
|
||||
else
|
||||
#endif
|
||||
free (data);
|
||||
@ -164,6 +166,11 @@ _nl_load_domain (domain_file)
|
||||
|
||||
domain = (struct loaded_domain *) domain_file->data;
|
||||
domain->data = (char *) data;
|
||||
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|
||||
|| defined _LIBC
|
||||
domain->use_mmap = use_mmap;
|
||||
#endif
|
||||
domain->mmap_size = size;
|
||||
domain->must_swap = data->magic != _MAGIC;
|
||||
|
||||
/* Fill in the information about the available tables. */
|
||||
@ -184,7 +191,7 @@ _nl_load_domain (domain_file)
|
||||
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|
||||
|| defined _LIBC
|
||||
if (use_mmap)
|
||||
munmap ((caddr_t) data, st.st_size);
|
||||
munmap ((caddr_t) data, size);
|
||||
else
|
||||
#endif
|
||||
free (data);
|
||||
@ -197,3 +204,19 @@ _nl_load_domain (domain_file)
|
||||
translations invalid. */
|
||||
++_nl_msg_cat_cntr;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
void
|
||||
internal_function
|
||||
_nl_unload_domain (domain)
|
||||
struct loaded_domain *domain;
|
||||
{
|
||||
if (domain->use_mmap)
|
||||
munmap ((caddr_t) domain->data, domain->mmap_size);
|
||||
else
|
||||
free ((void *) domain->data);
|
||||
|
||||
free (domain);
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Handle aliases for locale names
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
/* Handle aliases for locale names.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -79,6 +79,14 @@ void free ();
|
||||
because some ANSI C functions will require linking with this object
|
||||
file and the name space must not be polluted. */
|
||||
# define strcasecmp __strcasecmp
|
||||
|
||||
# define mempcpy __mempcpy
|
||||
# define HAVE_MEMPCPY 1
|
||||
|
||||
/* We need locking here since we can be called from different places. */
|
||||
# include <bits/libc-lock.h>
|
||||
|
||||
__libc_lock_define_initialized (static, lock);
|
||||
#endif
|
||||
|
||||
|
||||
@ -125,13 +133,17 @@ struct alias_map
|
||||
};
|
||||
|
||||
|
||||
static char *string_space = NULL;
|
||||
static size_t string_space_act = 0;
|
||||
static size_t string_space_max = 0;
|
||||
static struct alias_map *map;
|
||||
static size_t nmap = 0;
|
||||
static size_t maxmap = 0;
|
||||
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
static size_t read_alias_file PARAMS ((const char *fname, int fname_len));
|
||||
static size_t read_alias_file PARAMS ((const char *fname, int fname_len))
|
||||
internal_function;
|
||||
static void extend_alias_table PARAMS ((void));
|
||||
static int alias_compare PARAMS ((const struct alias_map *map1,
|
||||
const struct alias_map *map2));
|
||||
@ -143,8 +155,13 @@ _nl_expand_alias (name)
|
||||
{
|
||||
static const char *locale_alias_path = LOCALE_ALIAS_PATH;
|
||||
struct alias_map *retval;
|
||||
const char *result = NULL;
|
||||
size_t added;
|
||||
|
||||
#ifdef _LIBC
|
||||
__libc_lock_lock (lock);
|
||||
#endif
|
||||
|
||||
do
|
||||
{
|
||||
struct alias_map item;
|
||||
@ -162,7 +179,10 @@ _nl_expand_alias (name)
|
||||
|
||||
/* We really found an alias. Return the value. */
|
||||
if (retval != NULL)
|
||||
return retval->value;
|
||||
{
|
||||
result = retval->value;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Perhaps we can find another alias file. */
|
||||
added = 0;
|
||||
@ -183,11 +203,16 @@ _nl_expand_alias (name)
|
||||
}
|
||||
while (added != 0);
|
||||
|
||||
return NULL;
|
||||
#ifdef _LIBC
|
||||
__libc_lock_unlock (lock);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static size_t
|
||||
internal_function
|
||||
read_alias_file (fname, fname_len)
|
||||
const char *fname;
|
||||
int fname_len;
|
||||
@ -202,8 +227,13 @@ read_alias_file (fname, fname_len)
|
||||
|
||||
full_fname = (char *) alloca (fname_len + sizeof aliasfile);
|
||||
ADD_BLOCK (block_list, full_fname);
|
||||
#ifdef HAVE_MEMPCPY
|
||||
mempcpy (mempcpy (full_fname, fname, fname_len),
|
||||
aliasfile, sizeof aliasfile);
|
||||
#else
|
||||
memcpy (full_fname, fname, fname_len);
|
||||
memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
|
||||
#endif
|
||||
|
||||
fp = fopen (full_fname, "r");
|
||||
if (fp == NULL)
|
||||
@ -220,15 +250,28 @@ read_alias_file (fname, fname_len)
|
||||
b) these fields must be usable as file names and so must not
|
||||
be that long
|
||||
*/
|
||||
char buf[BUFSIZ];
|
||||
char *alias;
|
||||
char *value;
|
||||
char *cp;
|
||||
unsigned char buf[BUFSIZ];
|
||||
unsigned char *alias;
|
||||
unsigned char *value;
|
||||
unsigned char *cp;
|
||||
|
||||
if (fgets (buf, BUFSIZ, fp) == NULL)
|
||||
if (fgets (buf, sizeof buf, fp) == NULL)
|
||||
/* EOF reached. */
|
||||
break;
|
||||
|
||||
/* Possibly not the whole line fits into the buffer. Ignore
|
||||
the rest of the line. */
|
||||
if (strchr (buf, '\n') == NULL)
|
||||
{
|
||||
char altbuf[BUFSIZ];
|
||||
do
|
||||
if (fgets (altbuf, sizeof altbuf, fp) == NULL)
|
||||
/* Make sure the inner loop will be left. The outer loop
|
||||
will exit at the `feof' test. */
|
||||
break;
|
||||
while (strchr (altbuf, '\n') == NULL);
|
||||
}
|
||||
|
||||
cp = buf;
|
||||
/* Ignore leading white space. */
|
||||
while (isspace (cp[0]))
|
||||
@ -250,8 +293,8 @@ read_alias_file (fname, fname_len)
|
||||
|
||||
if (cp[0] != '\0')
|
||||
{
|
||||
char *tp;
|
||||
size_t len;
|
||||
size_t alias_len;
|
||||
size_t value_len;
|
||||
|
||||
value = cp++;
|
||||
while (cp[0] != '\0' && !isspace (cp[0]))
|
||||
@ -271,42 +314,37 @@ read_alias_file (fname, fname_len)
|
||||
if (nmap >= maxmap)
|
||||
extend_alias_table ();
|
||||
|
||||
/* We cannot depend on strdup available in the libc. Sigh! */
|
||||
len = strlen (alias) + 1;
|
||||
tp = (char *) malloc (len);
|
||||
if (tp == NULL)
|
||||
{
|
||||
FREE_BLOCKS (block_list);
|
||||
return added;
|
||||
}
|
||||
memcpy (tp, alias, len);
|
||||
map[nmap].alias = tp;
|
||||
alias_len = strlen (alias) + 1;
|
||||
value_len = strlen (value) + 1;
|
||||
|
||||
len = strlen (value) + 1;
|
||||
tp = (char *) malloc (len);
|
||||
if (tp == NULL)
|
||||
if (string_space_act + alias_len + value_len > string_space_max)
|
||||
{
|
||||
FREE_BLOCKS (block_list);
|
||||
return added;
|
||||
/* Increase size of memory pool. */
|
||||
size_t new_size = (string_space_max
|
||||
+ (alias_len + value_len > 1024
|
||||
? alias_len + value_len : 1024));
|
||||
char *new_pool = (char *) realloc (string_space, new_size);
|
||||
if (new_pool == NULL)
|
||||
{
|
||||
FREE_BLOCKS (block_list);
|
||||
return added;
|
||||
}
|
||||
string_space = new_pool;
|
||||
string_space_max = new_size;
|
||||
}
|
||||
memcpy (tp, value, len);
|
||||
map[nmap].value = tp;
|
||||
|
||||
map[nmap].alias = memcpy (&string_space[string_space_act],
|
||||
alias, alias_len);
|
||||
string_space_act += alias_len;
|
||||
|
||||
map[nmap].value = memcpy (&string_space[string_space_act],
|
||||
value, value_len);
|
||||
string_space_act += value_len;
|
||||
|
||||
++nmap;
|
||||
++added;
|
||||
}
|
||||
}
|
||||
|
||||
/* Possibly not the whole line fits into the buffer. Ignore
|
||||
the rest of the line. */
|
||||
while (strchr (cp, '\n') == NULL)
|
||||
{
|
||||
cp = buf;
|
||||
if (fgets (buf, BUFSIZ, fp) == NULL)
|
||||
/* Make sure the inner loop will be left. The outer loop
|
||||
will exit at the `feof' test. */
|
||||
*cp = '\n';
|
||||
}
|
||||
}
|
||||
|
||||
/* Should we test for ferror()? I think we have to silently ignore
|
||||
@ -329,22 +367,30 @@ extend_alias_table ()
|
||||
struct alias_map *new_map;
|
||||
|
||||
new_size = maxmap == 0 ? 100 : 2 * maxmap;
|
||||
new_map = (struct alias_map *) malloc (new_size
|
||||
* sizeof (struct alias_map));
|
||||
new_map = (struct alias_map *) realloc (map, (new_size
|
||||
* sizeof (struct alias_map)));
|
||||
if (new_map == NULL)
|
||||
/* Simply don't extend: we don't have any more core. */
|
||||
return;
|
||||
|
||||
memcpy (new_map, map, nmap * sizeof (struct alias_map));
|
||||
|
||||
if (maxmap != 0)
|
||||
free (map);
|
||||
|
||||
map = new_map;
|
||||
maxmap = new_size;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
static void __attribute__ ((unused))
|
||||
free_mem (void)
|
||||
{
|
||||
if (string_space != NULL)
|
||||
free (string_space);
|
||||
if (map != NULL)
|
||||
free (map);
|
||||
}
|
||||
text_set_element (__libc_subfreeres, free_mem);
|
||||
#endif
|
||||
|
||||
|
||||
static int
|
||||
alias_compare (map1, map2)
|
||||
const struct alias_map *map1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Implementation of the textdomain(3) function
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
/* Implementation of the textdomain(3) function.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -54,6 +54,9 @@ extern const char *_nl_current_default_domain;
|
||||
prefix. So we have to make a difference here. */
|
||||
#ifdef _LIBC
|
||||
# define TEXTDOMAIN __textdomain
|
||||
# ifndef strdup
|
||||
# define strdup(str) __strdup (str)
|
||||
# endif
|
||||
#else
|
||||
# define TEXTDOMAIN textdomain__
|
||||
#endif
|
||||
@ -82,11 +85,15 @@ TEXTDOMAIN (domainname)
|
||||
/* If the following malloc fails `_nl_current_default_domain'
|
||||
will be NULL. This value will be returned and so signals we
|
||||
are out of core. */
|
||||
#if defined _LIBC || defined HAVE_STRDUP
|
||||
_nl_current_default_domain = strdup (domainname);
|
||||
#else
|
||||
size_t len = strlen (domainname) + 1;
|
||||
char *cp = (char *) malloc (len);
|
||||
if (cp != NULL)
|
||||
memcpy (cp, domainname, len);
|
||||
_nl_current_default_domain = cp;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (old != _nl_default_default_domain)
|
||||
|
Loading…
Reference in New Issue
Block a user