mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-20 02:30:23 +02:00
Changes from arch/CVS synchronization
This commit is contained in:
parent
0bdb025f7b
commit
a2f00b9b36
18 changed files with 1732 additions and 419 deletions
|
@ -1,3 +1,38 @@
|
|||
2007-01-31 Ludovic Courtès <ludovic.courtes@laas.fr>
|
||||
|
||||
* i18n.c: Include "libguile/threads.h" and "libguile/posix.h"
|
||||
unconditionally. Include <langinfo.h> and <nl_types.h> when
|
||||
available.
|
||||
(SCM_I18N_STRINGIFY, SCM_LOCALE_CATEGORY_MASK,
|
||||
SCM_LIST_OR_INTEGER_P): New macros.
|
||||
(LC_*_MASK): When `USE_GNU_LOCALE_API' is undefined, define them
|
||||
as powers of two instead of `(1 << LC_*)'.
|
||||
(scm_i_locale_free): New function/macro.
|
||||
(scm_global_locale): New global variable.
|
||||
(smob_locale_free): Use `scm_i_locale_free ()'.
|
||||
(smob_locale_mark): Check whether the SMOB is `%global-locale'.
|
||||
(get_current_locale_settings): Return `EINVAL' instead of `errno'
|
||||
when `setlocale' fails.
|
||||
(restore_locale_settings): Likewise.
|
||||
(install_locale_categories): Likewise.
|
||||
(install_locale): Likewise. Stop the locale stack traversal when
|
||||
all categories have been handled.
|
||||
(get_current_locale, category_to_category_mask,
|
||||
category_list_to_category_mask): New function.
|
||||
(scm_make_locale): Use them. Accept both lists of `LC_*' values
|
||||
and single `LC_*' values as the first argument. Handle the case
|
||||
where BASE_LOCALE is `%global-locale'. When `USE_GNU_LOCALE_API',
|
||||
duplicate C_BASE_LOCALE before using it.
|
||||
(scm_nl_langinfo, define_langinfo_items): New functions.
|
||||
(scm_init_i18n): When `HAVE_NL_LANGINFO', add feature
|
||||
`nl-langinfo' and invoke `define_langinfo_items ()'.
|
||||
* i18n.h (scm_global_locale, scm_nl_langinfo): New declarations.
|
||||
* posix.c: Include <xlocale.h> when available.
|
||||
(scm_i_locale_mutex): Always define it. Statically initialized.
|
||||
(scm_set_locale): Invoke `scm_i_to_lc_category ()' before
|
||||
acquiring the locale mutex.
|
||||
(scm_init_posix): No longer initialize SCM_I_LOCALE_MUTEX here.
|
||||
|
||||
2007-01-25 Han-Wen Nienhuys <hanwen@lilypond.org>
|
||||
|
||||
* vector.c: remove comment as per kryde's request.
|
||||
|
|
864
libguile/i18n.c
864
libguile/i18n.c
File diff suppressed because it is too large
Load diff
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "libguile/__scm.h"
|
||||
|
||||
SCM_API SCM scm_global_locale;
|
||||
SCM_API SCM scm_make_locale (SCM category_mask, SCM locale_name, SCM base_locale);
|
||||
SCM_API SCM scm_locale_p (SCM obj);
|
||||
SCM_API SCM scm_string_locale_lt (SCM s1, SCM s2, SCM locale);
|
||||
|
@ -40,6 +41,7 @@ SCM_API SCM scm_string_locale_upcase (SCM chr, SCM locale);
|
|||
SCM_API SCM scm_string_locale_downcase (SCM chr, SCM locale);
|
||||
SCM_API SCM scm_locale_string_to_integer (SCM str, SCM base, SCM locale);
|
||||
SCM_API SCM scm_locale_string_to_inexact (SCM str, SCM locale);
|
||||
SCM_API SCM scm_nl_langinfo (SCM item, SCM locale);
|
||||
|
||||
SCM_API void scm_init_i18n (void);
|
||||
|
||||
|
|
|
@ -119,6 +119,10 @@ extern char ** environ;
|
|||
# define USE_GNU_LOCALE_API
|
||||
#endif
|
||||
|
||||
#if (defined USE_GNU_LOCALE_API) && (defined HAVE_XLOCALE_H)
|
||||
# include <xlocale.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_CRYPT_H
|
||||
# include <crypt.h>
|
||||
#endif
|
||||
|
@ -1399,12 +1403,11 @@ SCM_DEFINE (scm_putenv, "putenv", 1, 0, 0,
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
#ifndef USE_GNU_LOCALE_API
|
||||
/* This mutex is used to serialize invocations of `setlocale ()' on non-GNU
|
||||
systems (i.e., systems where a reentrant locale API is not available).
|
||||
See `i18n.c' for details. */
|
||||
scm_i_pthread_mutex_t scm_i_locale_mutex;
|
||||
#endif
|
||||
systems (i.e., systems where a reentrant locale API is not available). It
|
||||
is also acquired before calls to `nl_langinfo ()'. See `i18n.c' for
|
||||
details. */
|
||||
scm_i_pthread_mutex_t scm_i_locale_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
#ifdef HAVE_SETLOCALE
|
||||
|
||||
|
@ -1421,6 +1424,7 @@ SCM_DEFINE (scm_setlocale, "setlocale", 1, 1, 0,
|
|||
"the locale will be set using environment variables.")
|
||||
#define FUNC_NAME s_scm_setlocale
|
||||
{
|
||||
int c_category;
|
||||
char *clocale;
|
||||
char *rv;
|
||||
|
||||
|
@ -1436,13 +1440,11 @@ SCM_DEFINE (scm_setlocale, "setlocale", 1, 1, 0,
|
|||
scm_dynwind_free (clocale);
|
||||
}
|
||||
|
||||
#ifndef USE_GNU_LOCALE_API
|
||||
c_category = scm_i_to_lc_category (category, 1);
|
||||
|
||||
scm_i_pthread_mutex_lock (&scm_i_locale_mutex);
|
||||
#endif
|
||||
rv = setlocale (scm_i_to_lc_category (category, 1), clocale);
|
||||
#ifndef USE_GNU_LOCALE_API
|
||||
rv = setlocale (c_category, clocale);
|
||||
scm_i_pthread_mutex_unlock (&scm_i_locale_mutex);
|
||||
#endif
|
||||
|
||||
if (rv == NULL)
|
||||
{
|
||||
|
@ -1986,10 +1988,6 @@ SCM_DEFINE (scm_gethostname, "gethostname", 0, 0, 0,
|
|||
void
|
||||
scm_init_posix ()
|
||||
{
|
||||
#ifndef USE_GNU_LOCALE_API
|
||||
scm_i_pthread_mutex_init (&scm_i_locale_mutex, NULL);
|
||||
#endif
|
||||
|
||||
scm_add_feature ("posix");
|
||||
#ifdef HAVE_GETEUID
|
||||
scm_add_feature ("EIDs");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue