mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
i18n: Use Gnulib's `nl_langinfo' module.
* configure.ac: Remove checks for <langinfo.h> and <nl_types.h>, and `nl_langinfo'. * libguile/i18n.c: Remove #ifdefs for HAVE_LANGINFO_H, HAVE_NL_TYPES_H, HAVE_NL_ITEM, and HAVE_LANGINFO_CODESET. (SCM_VALIDATE_OPTIONAL_LOCALE_COPY): Use `SCM_UNBNDP'. * m4/gnulib-cache.m4 (gl_MODULES): Add `nl_langinfo'. * module/ice-9/i18n.scm (define-vector-langinfo-mapping): Remove `defaults' parameter; assume (provided? 'nl-langinfo) is always true. Update users accordingly. (define-simple-langinfo-mapping): Likewise. (define-monetary-langinfo-mapping): Likewise, but do not assume LOCAL-ITEM and INTL-ITEM are always defined.
This commit is contained in:
parent
eb4a14ed47
commit
a0919aefee
5 changed files with 50 additions and 103 deletions
16
configure.ac
16
configure.ac
|
@ -652,24 +652,13 @@ AC_SUBST([SCM_I_GSC_HAVE_STRUCT_DIRENT64])
|
||||||
# machine/fpu.h - on Tru64 5.1b, the declaration of fesetround(3) is in
|
# machine/fpu.h - on Tru64 5.1b, the declaration of fesetround(3) is in
|
||||||
# this file instead of <fenv.h>
|
# this file instead of <fenv.h>
|
||||||
# process.h - mingw specific
|
# process.h - mingw specific
|
||||||
# langinfo.h, nl_types.h - SuS v2
|
|
||||||
# sched.h - missing on MinGW
|
# sched.h - missing on MinGW
|
||||||
#
|
#
|
||||||
AC_CHECK_HEADERS([complex.h fenv.h io.h libc.h limits.h memory.h process.h string.h \
|
AC_CHECK_HEADERS([complex.h fenv.h io.h libc.h limits.h memory.h process.h string.h \
|
||||||
sys/dir.h sys/ioctl.h sys/select.h \
|
sys/dir.h sys/ioctl.h sys/select.h \
|
||||||
sys/time.h sys/timeb.h sys/times.h sys/stdtypes.h sys/types.h \
|
sys/time.h sys/timeb.h sys/times.h sys/stdtypes.h sys/types.h \
|
||||||
sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h \
|
sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h \
|
||||||
direct.h langinfo.h nl_types.h machine/fpu.h poll.h sched.h])
|
direct.h machine/fpu.h poll.h sched.h])
|
||||||
|
|
||||||
# Reasons for testing:
|
|
||||||
# nl_item - lacking on Cygwin
|
|
||||||
AC_CHECK_TYPES([nl_item], [], [],
|
|
||||||
[[#ifdef HAVE_LANGINFO_H
|
|
||||||
# include <langinfo.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_NL_TYPES_H
|
|
||||||
# include <nl_types.h>
|
|
||||||
#endif]])
|
|
||||||
|
|
||||||
# "complex double" is new in C99, and "complex" is only a keyword if
|
# "complex double" is new in C99, and "complex" is only a keyword if
|
||||||
# <complex.h> is included
|
# <complex.h> is included
|
||||||
|
@ -764,11 +753,10 @@ AC_CHECK_HEADERS([assert.h crt_externs.h])
|
||||||
# isblank - available as a GNU extension or in C99
|
# isblank - available as a GNU extension or in C99
|
||||||
# _NSGetEnviron - Darwin specific
|
# _NSGetEnviron - Darwin specific
|
||||||
# strcoll_l, newlocale - GNU extensions (glibc), also available on Darwin
|
# strcoll_l, newlocale - GNU extensions (glibc), also available on Darwin
|
||||||
# nl_langinfo - X/Open, not available on Windows.
|
|
||||||
# utimensat: posix.1-2008
|
# utimensat: posix.1-2008
|
||||||
# sched_getaffinity, sched_setaffinity: GNU extensions (glibc)
|
# sched_getaffinity, sched_setaffinity: GNU extensions (glibc)
|
||||||
#
|
#
|
||||||
AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime ftruncate fchown getcwd geteuid getsid gettimeofday gmtime_r ioctl lstat mkdir mknod nice pipe _pipe poll readdir_r readdir64_r readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction siginterrupt stat64 strftime strptime symlink sync sysconf tcgetpgrp tcsetpgrp times uname waitpid strdup system usleep atexit on_exit chown link fcntl ttyname getpwent getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp index bcopy memcpy rindex truncate unsetenv isblank _NSGetEnviron strcoll strcoll_l newlocale nl_langinfo utimensat sched_getaffinity sched_setaffinity])
|
AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime ftruncate fchown getcwd geteuid getsid gettimeofday gmtime_r ioctl lstat mkdir mknod nice pipe _pipe poll readdir_r readdir64_r readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction siginterrupt stat64 strftime strptime symlink sync sysconf tcgetpgrp tcsetpgrp times uname waitpid strdup system usleep atexit on_exit chown link fcntl ttyname getpwent getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp index bcopy memcpy rindex truncate unsetenv isblank _NSGetEnviron strcoll strcoll_l newlocale utimensat sched_getaffinity sched_setaffinity])
|
||||||
|
|
||||||
# Reasons for testing:
|
# Reasons for testing:
|
||||||
# netdb.h - not in mingw
|
# netdb.h - not in mingw
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
# the same distribution terms as the rest of that program.
|
# the same distribution terms as the rest of that program.
|
||||||
#
|
#
|
||||||
# Generated by gnulib-tool.
|
# Generated by gnulib-tool.
|
||||||
# Reproduce by: gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect dirfd duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nproc open pipe2 putenv recv recvfrom regex rename send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
|
# Reproduce by: gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect dirfd duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nl_langinfo nproc open pipe2 putenv recv recvfrom regex rename send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
|
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
|
||||||
|
|
||||||
|
|
|
@ -59,16 +59,8 @@
|
||||||
|
|
||||||
#include "libguile/posix.h" /* for `scm_i_locale_mutex' */
|
#include "libguile/posix.h" /* for `scm_i_locale_mutex' */
|
||||||
|
|
||||||
#ifdef HAVE_LANGINFO_H
|
/* Use Gnulib's header, which also provides `nl_item' & co. */
|
||||||
# include <langinfo.h>
|
#include <langinfo.h>
|
||||||
#endif
|
|
||||||
#ifdef HAVE_NL_TYPES_H
|
|
||||||
# include <nl_types.h>
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_NL_ITEM
|
|
||||||
/* Cygwin has <langinfo.h> but lacks <nl_types.h> and `nl_item'. */
|
|
||||||
typedef int nl_item;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_SETLOCALE
|
#ifndef HAVE_SETLOCALE
|
||||||
static inline char *
|
static inline char *
|
||||||
|
@ -223,7 +215,7 @@ SCM_GLOBAL_VARIABLE (scm_global_locale, "%global-locale");
|
||||||
#define SCM_VALIDATE_OPTIONAL_LOCALE_COPY(_pos, _arg, _c_locale) \
|
#define SCM_VALIDATE_OPTIONAL_LOCALE_COPY(_pos, _arg, _c_locale) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
if (!scm_is_eq ((_arg), SCM_UNDEFINED)) \
|
if (!SCM_UNBNDP (_arg)) \
|
||||||
SCM_VALIDATE_LOCALE_COPY (_pos, _arg, _c_locale); \
|
SCM_VALIDATE_LOCALE_COPY (_pos, _arg, _c_locale); \
|
||||||
else \
|
else \
|
||||||
(_c_locale) = NULL; \
|
(_c_locale) = NULL; \
|
||||||
|
@ -1481,14 +1473,11 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
|
||||||
"Reference Manual}).")
|
"Reference Manual}).")
|
||||||
#define FUNC_NAME s_scm_nl_langinfo
|
#define FUNC_NAME s_scm_nl_langinfo
|
||||||
{
|
{
|
||||||
#ifdef HAVE_NL_LANGINFO
|
|
||||||
SCM result;
|
SCM result;
|
||||||
nl_item c_item;
|
nl_item c_item;
|
||||||
char *c_result;
|
char *c_result;
|
||||||
scm_t_locale c_locale;
|
scm_t_locale c_locale;
|
||||||
#ifdef HAVE_LANGINFO_CODESET
|
|
||||||
char *codeset;
|
char *codeset;
|
||||||
#endif
|
|
||||||
|
|
||||||
SCM_VALIDATE_INT_COPY (2, item, c_item);
|
SCM_VALIDATE_INT_COPY (2, item, c_item);
|
||||||
SCM_VALIDATE_OPTIONAL_LOCALE_COPY (2, locale, c_locale);
|
SCM_VALIDATE_OPTIONAL_LOCALE_COPY (2, locale, c_locale);
|
||||||
|
@ -1505,9 +1494,7 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
|
||||||
{
|
{
|
||||||
#ifdef USE_GNU_LOCALE_API
|
#ifdef USE_GNU_LOCALE_API
|
||||||
c_result = nl_langinfo_l (c_item, c_locale);
|
c_result = nl_langinfo_l (c_item, c_locale);
|
||||||
#ifdef HAVE_LANGINFO_CODESET
|
|
||||||
codeset = nl_langinfo_l (CODESET, c_locale);
|
codeset = nl_langinfo_l (CODESET, c_locale);
|
||||||
#endif /* HAVE_LANGINFO_CODESET */
|
|
||||||
#else /* !USE_GNU_LOCALE_API */
|
#else /* !USE_GNU_LOCALE_API */
|
||||||
/* We can't use `RUN_IN_LOCALE_SECTION ()' here because the locale
|
/* We can't use `RUN_IN_LOCALE_SECTION ()' here because the locale
|
||||||
mutex is already taken. */
|
mutex is already taken. */
|
||||||
|
@ -1532,9 +1519,7 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
c_result = nl_langinfo (c_item);
|
c_result = nl_langinfo (c_item);
|
||||||
#ifdef HAVE_LANGINFO_CODESET
|
|
||||||
codeset = nl_langinfo (CODESET);
|
codeset = nl_langinfo (CODESET);
|
||||||
#endif /* HAVE_LANGINFO_CODESET */
|
|
||||||
|
|
||||||
restore_locale_settings (&lsec_prev_locale);
|
restore_locale_settings (&lsec_prev_locale);
|
||||||
free_locale_settings (&lsec_prev_locale);
|
free_locale_settings (&lsec_prev_locale);
|
||||||
|
@ -1544,9 +1529,7 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
c_result = nl_langinfo (c_item);
|
c_result = nl_langinfo (c_item);
|
||||||
#ifdef HAVE_LANGINFO_CODESET
|
|
||||||
codeset = nl_langinfo (CODESET);
|
codeset = nl_langinfo (CODESET);
|
||||||
#endif /* HAVE_LANGINFO_CODESET */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c_result = strdup (c_result);
|
c_result = strdup (c_result);
|
||||||
|
@ -1659,26 +1642,14 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
#ifdef HAVE_LANGINFO_CODESET
|
|
||||||
result = scm_from_stringn (c_result, strlen (c_result),
|
result = scm_from_stringn (c_result, strlen (c_result),
|
||||||
codeset,
|
codeset,
|
||||||
SCM_FAILED_CONVERSION_QUESTION_MARK);
|
SCM_FAILED_CONVERSION_QUESTION_MARK);
|
||||||
#else /* !HAVE_LANGINFO_CODESET */
|
|
||||||
/* This may be incorrectly encoded if the locale differs
|
|
||||||
from the c_locale. */
|
|
||||||
result = scm_from_locale_string (c_result);
|
|
||||||
#endif /* !HAVE_LANGINFO_CODESET */
|
|
||||||
free (c_result);
|
free (c_result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
#else
|
|
||||||
scm_syserror_msg (FUNC_NAME, "`nl-langinfo' not supported on your system",
|
|
||||||
SCM_EOL, ENOSYS);
|
|
||||||
|
|
||||||
return SCM_BOOL_F;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
@ -1686,8 +1657,6 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
|
||||||
static inline void
|
static inline void
|
||||||
define_langinfo_items (void)
|
define_langinfo_items (void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LANGINFO_H
|
|
||||||
|
|
||||||
#define DEFINE_NLITEM_CONSTANT(_item) \
|
#define DEFINE_NLITEM_CONSTANT(_item) \
|
||||||
scm_c_define (# _item, scm_from_int (_item))
|
scm_c_define (# _item, scm_from_int (_item))
|
||||||
|
|
||||||
|
@ -1852,8 +1821,6 @@ define_langinfo_items (void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef DEFINE_NLITEM_CONSTANT
|
#undef DEFINE_NLITEM_CONSTANT
|
||||||
|
|
||||||
#endif /* HAVE_NL_TYPES_H */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1862,10 +1829,8 @@ scm_init_i18n ()
|
||||||
{
|
{
|
||||||
SCM global_locale_smob;
|
SCM global_locale_smob;
|
||||||
|
|
||||||
#ifdef HAVE_NL_LANGINFO
|
|
||||||
scm_add_feature ("nl-langinfo");
|
scm_add_feature ("nl-langinfo");
|
||||||
define_langinfo_items ();
|
define_langinfo_items ();
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "libguile/i18n.x"
|
#include "libguile/i18n.x"
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
# Specification in the form of a command-line invocation:
|
# Specification in the form of a command-line invocation:
|
||||||
# gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect dirfd duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nproc open pipe2 putenv recv recvfrom regex rename send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
|
# gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect dirfd duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nl_langinfo nproc open pipe2 putenv recv recvfrom regex rename send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
|
||||||
|
|
||||||
# Specification in the form of a few gnulib-tool.m4 macro invocations:
|
# Specification in the form of a few gnulib-tool.m4 macro invocations:
|
||||||
gl_LOCAL_DIR([gnulib-local])
|
gl_LOCAL_DIR([gnulib-local])
|
||||||
|
@ -80,6 +80,7 @@ gl_MODULES([
|
||||||
maintainer-makefile
|
maintainer-makefile
|
||||||
malloc-gnu
|
malloc-gnu
|
||||||
malloca
|
malloca
|
||||||
|
nl_langinfo
|
||||||
nproc
|
nproc
|
||||||
open
|
open
|
||||||
pipe2
|
pipe2
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;;;; i18n.scm --- internationalization support -*- coding: utf-8 -*-
|
;;;; i18n.scm --- internationalization support -*- coding: utf-8 -*-
|
||||||
|
|
||||||
;;;; Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
|
;;;; Copyright (C) 2006, 2007, 2009, 2010, 2012 Free Software Foundation, Inc.
|
||||||
;;;;
|
;;;;
|
||||||
;;;; This library is free software; you can redistribute it and/or
|
;;;; This library is free software; you can redistribute it and/or
|
||||||
;;;; modify it under the terms of the GNU Lesser General Public
|
;;;; modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -101,13 +101,10 @@
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
;; Helper macro: Define a procedure named NAME that maps its argument to
|
;; Helper macro: Define a procedure named NAME that maps its argument to
|
||||||
;; NL-ITEMS (when `nl-langinfo' is provided) or DEFAULTS (when `nl-langinfo'
|
;; NL-ITEMS (when `nl-langinfo' is provided).
|
||||||
;; is not provided).
|
(define-macro (define-vector-langinfo-mapping name nl-items)
|
||||||
(define-macro (define-vector-langinfo-mapping name nl-items defaults)
|
|
||||||
(let* ((item-count (length nl-items))
|
(let* ((item-count (length nl-items))
|
||||||
(defines (if (provided? 'nl-langinfo)
|
(defines `(define %nl-items (vector #f ,@nl-items)))
|
||||||
`(define %nl-items (vector #f ,@nl-items))
|
|
||||||
`(define %defaults (vector #f ,@defaults))))
|
|
||||||
(make-body (lambda (result)
|
(make-body (lambda (result)
|
||||||
`(if (and (integer? item) (exact? item))
|
`(if (and (integer? item) (exact? item))
|
||||||
(if (and (>= item 1) (<= item ,item-count))
|
(if (and (>= item 1) (<= item ,item-count))
|
||||||
|
@ -116,28 +113,21 @@
|
||||||
(throw 'wrong-type-arg "wrong argument type" item)))))
|
(throw 'wrong-type-arg "wrong argument type" item)))))
|
||||||
`(define (,name item . locale)
|
`(define (,name item . locale)
|
||||||
,defines
|
,defines
|
||||||
,(make-body (if (provided? 'nl-langinfo)
|
,(make-body '(apply nl-langinfo (vector-ref %nl-items item) locale)))))
|
||||||
'(apply nl-langinfo (vector-ref %nl-items item) locale)
|
|
||||||
'(vector-ref %defaults item))))))
|
|
||||||
|
|
||||||
|
|
||||||
(define-vector-langinfo-mapping locale-day-short
|
(define-vector-langinfo-mapping locale-day-short
|
||||||
(ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7)
|
(ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7))
|
||||||
("Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat"))
|
|
||||||
|
|
||||||
(define-vector-langinfo-mapping locale-day
|
(define-vector-langinfo-mapping locale-day
|
||||||
(DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7)
|
(DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7))
|
||||||
("Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"))
|
|
||||||
|
|
||||||
(define-vector-langinfo-mapping locale-month-short
|
(define-vector-langinfo-mapping locale-month-short
|
||||||
(ABMON_1 ABMON_2 ABMON_3 ABMON_4 ABMON_5 ABMON_6
|
(ABMON_1 ABMON_2 ABMON_3 ABMON_4 ABMON_5 ABMON_6
|
||||||
ABMON_7 ABMON_8 ABMON_9 ABMON_10 ABMON_11 ABMON_12)
|
ABMON_7 ABMON_8 ABMON_9 ABMON_10 ABMON_11 ABMON_12))
|
||||||
("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"))
|
|
||||||
|
|
||||||
(define-vector-langinfo-mapping locale-month
|
(define-vector-langinfo-mapping locale-month
|
||||||
(MON_1 MON_2 MON_3 MON_4 MON_5 MON_6 MON_7 MON_8 MON_9 MON_10 MON_11 MON_12)
|
(MON_1 MON_2 MON_3 MON_4 MON_5 MON_6 MON_7 MON_8 MON_9 MON_10 MON_11 MON_12))
|
||||||
("January" "February" "March" "April" "May" "June" "July" "August"
|
|
||||||
"September" "October" "November" "December"))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,36 +135,34 @@
|
||||||
;;; Date and time.
|
;;; Date and time.
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
;; Helper macro: Define a procedure NAME that gets langinfo item ITEM.
|
;; Define a procedure NAME that gets langinfo item ITEM. Gnulib's
|
||||||
(define-macro (define-simple-langinfo-mapping name item default)
|
;; `nl_langinfo' guarantees that all these items are supported.
|
||||||
(let ((body (if (and (provided? 'nl-langinfo) (defined? item))
|
(define-syntax-rule (define-simple-langinfo-mapping name item)
|
||||||
`(apply nl-langinfo ,item locale)
|
(define* (name #:optional (locale %global-locale))
|
||||||
default)))
|
(nl-langinfo item locale)))
|
||||||
`(define (,name . locale)
|
|
||||||
,body)))
|
|
||||||
|
|
||||||
(define-simple-langinfo-mapping locale-am-string
|
(define-simple-langinfo-mapping locale-am-string
|
||||||
AM_STR "AM")
|
AM_STR)
|
||||||
(define-simple-langinfo-mapping locale-pm-string
|
(define-simple-langinfo-mapping locale-pm-string
|
||||||
PM_STR "PM")
|
PM_STR)
|
||||||
(define-simple-langinfo-mapping locale-date+time-format
|
(define-simple-langinfo-mapping locale-date+time-format
|
||||||
D_T_FMT "%a %b %e %H:%M:%S %Y")
|
D_T_FMT)
|
||||||
(define-simple-langinfo-mapping locale-date-format
|
(define-simple-langinfo-mapping locale-date-format
|
||||||
D_FMT "%m/%d/%y")
|
D_FMT)
|
||||||
(define-simple-langinfo-mapping locale-time-format
|
(define-simple-langinfo-mapping locale-time-format
|
||||||
T_FMT "%H:%M:%S")
|
T_FMT)
|
||||||
(define-simple-langinfo-mapping locale-time+am/pm-format
|
(define-simple-langinfo-mapping locale-time+am/pm-format
|
||||||
T_FMT_AMPM "%I:%M:%S %p")
|
T_FMT_AMPM)
|
||||||
(define-simple-langinfo-mapping locale-era
|
(define-simple-langinfo-mapping locale-era
|
||||||
ERA "")
|
ERA)
|
||||||
(define-simple-langinfo-mapping locale-era-year
|
(define-simple-langinfo-mapping locale-era-year
|
||||||
ERA_YEAR "")
|
ERA_YEAR)
|
||||||
(define-simple-langinfo-mapping locale-era-date+time-format
|
(define-simple-langinfo-mapping locale-era-date+time-format
|
||||||
ERA_D_T_FMT "")
|
ERA_D_T_FMT)
|
||||||
(define-simple-langinfo-mapping locale-era-date-format
|
(define-simple-langinfo-mapping locale-era-date-format
|
||||||
ERA_D_FMT "")
|
ERA_D_FMT)
|
||||||
(define-simple-langinfo-mapping locale-era-time-format
|
(define-simple-langinfo-mapping locale-era-time-format
|
||||||
ERA_T_FMT "")
|
ERA_T_FMT)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -182,13 +170,18 @@
|
||||||
;;; Monetary information.
|
;;; Monetary information.
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
|
;; Define a procedure NAME that gets item LOCAL-ITEM or INTL-ITEM,
|
||||||
|
;; depending on whether the caller asked for the international version
|
||||||
|
;; or not. Since Gnulib's `nl_langinfo' module doesn't guarantee that
|
||||||
|
;; all these items are available, use DEFAULT/LOCAL and DEFAULT/INTL as
|
||||||
|
;; default values when the system does not support them.
|
||||||
(define-macro (define-monetary-langinfo-mapping name local-item intl-item
|
(define-macro (define-monetary-langinfo-mapping name local-item intl-item
|
||||||
default/local default/intl)
|
default/local default/intl)
|
||||||
(let ((body
|
(let ((body
|
||||||
(let ((intl (if (and (provided? 'nl-langinfo) (defined? intl-item))
|
(let ((intl (if (defined? intl-item)
|
||||||
`(apply nl-langinfo ,intl-item locale)
|
`(apply nl-langinfo ,intl-item locale)
|
||||||
default/intl))
|
default/intl))
|
||||||
(local (if (and (provided? 'nl-langinfo) (defined? local-item))
|
(local (if (defined? local-item)
|
||||||
`(apply nl-langinfo ,local-item locale)
|
`(apply nl-langinfo ,local-item locale)
|
||||||
default/local)))
|
default/local)))
|
||||||
`(if intl? ,intl ,local))))
|
`(if intl? ,intl ,local))))
|
||||||
|
@ -205,15 +198,15 @@
|
||||||
2 2)
|
2 2)
|
||||||
|
|
||||||
(define-simple-langinfo-mapping locale-monetary-positive-sign
|
(define-simple-langinfo-mapping locale-monetary-positive-sign
|
||||||
POSITIVE_SIGN "+")
|
POSITIVE_SIGN)
|
||||||
(define-simple-langinfo-mapping locale-monetary-negative-sign
|
(define-simple-langinfo-mapping locale-monetary-negative-sign
|
||||||
NEGATIVE_SIGN "-")
|
NEGATIVE_SIGN)
|
||||||
(define-simple-langinfo-mapping locale-monetary-decimal-point
|
(define-simple-langinfo-mapping locale-monetary-decimal-point
|
||||||
MON_DECIMAL_POINT "")
|
MON_DECIMAL_POINT)
|
||||||
(define-simple-langinfo-mapping locale-monetary-thousands-separator
|
(define-simple-langinfo-mapping locale-monetary-thousands-separator
|
||||||
MON_THOUSANDS_SEP "")
|
MON_THOUSANDS_SEP)
|
||||||
(define-simple-langinfo-mapping locale-monetary-digit-grouping
|
(define-simple-langinfo-mapping locale-monetary-digit-grouping
|
||||||
MON_GROUPING '())
|
MON_GROUPING)
|
||||||
|
|
||||||
(define-monetary-langinfo-mapping locale-currency-symbol-precedes-positive?
|
(define-monetary-langinfo-mapping locale-currency-symbol-precedes-positive?
|
||||||
P_CS_PRECEDES INT_P_CS_PRECEDES
|
P_CS_PRECEDES INT_P_CS_PRECEDES
|
||||||
|
@ -359,11 +352,11 @@ locale is used."
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
(define-simple-langinfo-mapping locale-digit-grouping
|
(define-simple-langinfo-mapping locale-digit-grouping
|
||||||
GROUPING '())
|
GROUPING)
|
||||||
(define-simple-langinfo-mapping locale-decimal-point
|
(define-simple-langinfo-mapping locale-decimal-point
|
||||||
RADIXCHAR ".")
|
RADIXCHAR)
|
||||||
(define-simple-langinfo-mapping locale-thousands-separator
|
(define-simple-langinfo-mapping locale-thousands-separator
|
||||||
THOUSEP "")
|
THOUSEP)
|
||||||
|
|
||||||
(define* (number->locale-string number
|
(define* (number->locale-string number
|
||||||
#:optional (fraction-digits #t)
|
#:optional (fraction-digits #t)
|
||||||
|
@ -409,9 +402,9 @@ number of fractional digits to be displayed."
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
(define-simple-langinfo-mapping locale-yes-regexp
|
(define-simple-langinfo-mapping locale-yes-regexp
|
||||||
YESEXPR "^[yY]")
|
YESEXPR)
|
||||||
(define-simple-langinfo-mapping locale-no-regexp
|
(define-simple-langinfo-mapping locale-no-regexp
|
||||||
NOEXPR "^[nN]")
|
NOEXPR)
|
||||||
|
|
||||||
;; `YESSTR' and `NOSTR' are considered deprecated so we don't provide them.
|
;; `YESSTR' and `NOSTR' are considered deprecated so we don't provide them.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue