From: Kevin Ryde <user42@zip.com.au>
Cc: guile-devel@gnu.org
Subject: Re: More i18n
Date: Tue, 12 Dec 2006 10:26:17 +1100 [thread overview]
Message-ID: <87ac1uhv52.fsf@zip.com.au> (raw)
In-Reply-To: <877iwzokpz.fsf@chbouib.org> (Ludovic Courtès's message of "Sun, 10 Dec 2006 16:04:56 +0100")
ludo@chbouib.org (Ludovic Courtès) writes:
>
> In order to be consistent with the rest of `(ice-9 i18n)',
> `language-information' accepts an optional argument which should be a
> locale object. Consequently, `language-information' has to perform
> appropriate charset conversion.
If you ask for something from a particular locale object, shouldn't
you get the charset of that object? That'd be what I'd expect.
(Just for the time being of course, while encodings in strings are
exposed.)
> +# iconv.h - SuS v2
> +# iconv - X/Open, SuS v2
AM_ICONV (from gettext, see its manual) is good for that detection, it
can cope with various oddities.
> +@example
> +(language-information DAY_1 (make-locale LC_ALL_MASK "C"))
> +@result{} "Sunday"
DAY_1 smells a lot like C, surely something more schemely is possible?
After all, guile isn't a C interpreter with parenthesized syntax! :-)
You should setup to use localeconv and strftime too, if nl_langinfo
isn't available, that'd cope with DOS systems. Or if you want to tie
only to nl_langinfo then calling the function nl-langinfo will make it
clearest what's being had.
> + scm_error (scm_system_error_key, func_name,
> + "Failed to install locale",
> + scm_cons (scm_strerror (s_err), SCM_EOL),
> + scm_cons (s_err, SCM_EOL));
SCM_SYSERROR ?
> + c_result = strdup (c_result);
> + if (c_result == NULL)
> + {
> + result = SCM_BOOL_F;
> + /* FIXME: Raise an error. */
The frames stuff is the easiest way to cope with errors like out of
memory from within a mutex lock.
Though I suspect there's quite a few places in existing code that may
leak resources of one type or another under out of memory errors. And
I doubt out of memory is even recoverable at all if genuinely almost
full.
> +#define SCM_DEFINE_LOCALE_CATEGORY(_name) \
> + scm_c_define ("LC_" SCM_I18N_STRINGIFY (_name) "_MASK", \
> SCM_I_MAKINUM (LC_ ## _name ## _MASK));
scm_from_int (or long, as the case may be) can protect against the
unlikely case of a mask bit outside the size of a fixnum.
> + nconv = iconv (cc, (char **)&str, &len,
> + &output, &output_avail);
Incidentally, if you're thinking about iconv (which I suspect is not
needed yet), then I've found it useful to also have conversions that
put in dummies for untranslatable chars. With glibc the charset names
"foo//TRANSLIT" etc give that effect, but elsewhere you have to watch
for EILSEQ and skip that char. Good for output to at least display
something.
> (define priv:locale-abbr-weekday-vector
> - (vector "Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat"))
> + (cond-feature (language-information
> + (vector ABDAY_1 ABDAY_2 ABDAY_3
> + ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7))
This raises a point about the interface. It should be possible to ask
for "day number N". If ABDAY and friends aren't consecutive then they
should be.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2006-12-11 23:26 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-10 15:04 More i18n Ludovic Courtès
2006-12-11 19:42 ` Neil Jerram
2006-12-12 9:09 ` Ludovic Courtès
2006-12-12 19:48 ` Kevin Ryde
2006-12-31 16:23 ` Neil Jerram
2006-12-31 16:22 ` Neil Jerram
2006-12-13 0:11 ` Kevin Ryde
2006-12-31 16:54 ` Neil Jerram
2006-12-11 23:26 ` Kevin Ryde [this message]
2006-12-12 9:36 ` Ludovic Courtès
2006-12-12 19:43 ` Kevin Ryde
2006-12-12 19:19 ` Kevin Ryde
2006-12-31 16:15 ` Neil Jerram
2007-01-01 22:32 ` Kevin Ryde
2007-01-16 21:46 ` Ludovic Courtès
2007-01-16 22:08 ` Ludovic Courtès
2007-01-23 0:49 ` Kevin Ryde
2007-01-23 0:46 ` Kevin Ryde
2007-01-23 23:44 ` Ludovic Courtès
2007-01-24 20:58 ` Kevin Ryde
2007-01-31 21:13 ` Ludovic Courtès
2007-01-31 22:06 ` Kevin Ryde
2007-01-25 1:05 ` Kevin Ryde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ac1uhv52.fsf@zip.com.au \
--to=user42@zip.com.au \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).