From: Bruce Korb <bkorb@gnu.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: bug-guile@gnu.org, bug-autogen@gnu.org,
Elias Pipping <pipping@lavabit.com>
Subject: Re: ‘scm_from_locale_string’ and locale character encoding
Date: Mon, 18 Jul 2011 09:18:13 -0700 [thread overview]
Message-ID: <4E245CC5.4040505__24262.3642822311$1311010296$gmane$org@gnu.org> (raw)
In-Reply-To: <877h7gljlv.fsf_-_@gnu.org>
On 07/17/11 13:47, Ludovic Courtès wrote:
> FWIW, I do understand the inconvenience and frustration reported here.
>
> But as Andy suggests, I think it should come as no surprise that
> ‘scm_from_locale_string’ returns a string from a locale-encoded one.
> Guile 1.8 already documented things this way [0].
The issue is less about scm_from_locale_string than:
* This appears to me to be habitual. If it were not, my glue layer
would not be so large.
* This is a behavioral change in a bug fix release. The kind of
change one might more readily anticipate in a 2.0.x to 2.1 transition.
* There was no warning mechanism put in place. Release docs don't
count because code I ship now will be built against Guile releases
that have not been released yet. I've not seen 2.0.2 even yet.
WRT the misuse of this particular function, what happened from
my perspective is that I was happily using the SCM_CHARS stuff with:
export GUILE_WARN_DEPRECATED=detailed
in my testing environment and not getting any testing errors.
Then my clients report that they cannot build it any more.
(Why didn't the deprecation warning fire? How about adding
GUILE_ERROR_DEPRECATED?? Then my testing should fail immediately!
In any event, I scan the test logs for "warn" and saw nothing.)
Somebody somewhere said, "use scm_from_locale_string". I looked
it up and saw no better alternative, used it and it worked as I
needed it to. Now it doesn't.
My biggest desire is to not have to read release documents and
figure out if somewhere in there is something that affects
my usage of the guile library interface. I want to be thumped
with GUILE_WARN_DEPRECATED and have an obvious replacement.
Thank you.
/**
* Get the NUL terminated string from an SCM.
* As of Guile 1.7.x, access to the NUL terminated string referenced by
* an SCM is no longer guaranteed. Therefore, we must extract the string
* into one of our "scribble" buffers.
*
* @param s the string to convert
* @param type a string describing the string
* @return a NUL terminated string, or it aborts.
*/
LOCAL char *
ag_scm2zchars(SCM s, const char * type)
{
#if GUILE_VERSION < 107000 /* pre-Guile 1.7.x */
if (! AG_SCM_STRING_P(s))
AG_ABEND(aprf(zNotStr, type));
if (SCM_SUBSTRP(s))
s = scm_makfromstr(SCM_CHARS(s), SCM_LENGTH(s), 0);
return SCM_CHARS(s);
#else
static char const bad_val[] =
"scm_string_length returned wrong value: %d != %d\n";
size_t len;
char * buf;
if (! AG_SCM_STRING_P(s))
AG_ABEND(aprf("%s is not a string", type));
len = scm_c_string_length(s);
if (len == 0) {
static char z = NUL;
return &z;
}
buf = ag_scribble(len+1);
{
size_t buflen = scm_to_locale_stringbuf(s, buf, len);
if (buflen != len)
AG_ABEND(aprf(bad_val, buflen, len));
}
buf[len] = NUL;
return buf;
#endif
}
next prev parent reply other threads:[~2011-07-18 16:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20110710.001131.2114114687665811411.pipping@lavabit.com>
2011-07-11 13:28 ` [Bug-autogen] test failure with guile-2.0.2 Bruce Korb
[not found] ` <20110711.160906.808950167011716776.pipping@lavabit.com>
2011-07-11 17:32 ` Bruce Korb
[not found] ` <4E1AFA72.2050803@gnu.org>
2011-07-13 8:48 ` Andy Wingo
2011-07-13 12:54 ` Bruce Korb
[not found] ` <4E1D95A0.60504@gnu.org>
2011-07-13 13:41 ` Andy Wingo
2011-07-13 15:01 ` Thien-Thi Nguyen
2011-07-15 16:25 ` Thien-Thi Nguyen
2011-07-18 9:30 ` Andy Wingo
2011-07-13 15:11 ` Bruce Korb
[not found] ` <4E1DB59B.9070700@gnu.org>
2011-07-14 9:01 ` Andy Wingo
2011-07-17 20:47 ` ‘scm_from_locale_string’ and locale character encoding Ludovic Courtès
2011-07-18 16:18 ` Bruce Korb [this message]
[not found] ` <4E245CC5.4040505@gnu.org>
2011-07-19 9:35 ` Ludovic Courtès
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='4E245CC5.4040505__24262.3642822311$1311010296$gmane$org@gnu.org' \
--to=bkorb@gnu.org \
--cc=bug-autogen@gnu.org \
--cc=bug-guile@gnu.org \
--cc=ludo@gnu.org \
--cc=pipping@lavabit.com \
/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).