This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v1 02/36] Guile extension language: doc additions
- From: ludo at gnu dot org (Ludovic CourtÃs)
- To: Doug Evans <xdje42 at gmail dot com>
- Cc: Eli Zaretskii <eliz at gnu dot org>, "gdb-patches\ at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Sat, 18 Jan 2014 21:52:50 +0100
- Subject: Re: [PATCH v1 02/36] Guile extension language: doc additions
- Authentication-results: sourceware.org; auth=none
- References: <52b9da59 dot 64ab440a dot 0b0b dot 7e1c at mx dot google dot com> <83ha9w68av dot fsf at gnu dot org> <87sit4kb1t dot fsf at gnu dot org> <83eh4ow78t dot fsf at gnu dot org> <87k3egez8e dot fsf at gnu dot org> <CAP9bCMTR8Dv7ejLWs0yqeFLja8-fck08kvHHWiJdS09WAG5nbw at mail dot gmail dot com>
Doug Evans <xdje42@gmail.com> skribis:
> On Sat, Jan 4, 2014 at 3:57 AM, Ludovic CourtÃs <ludo@gnu.org> wrote:
>>>> >> +A Scheme string is converted to a target string, using the current
>>>> >> +target encoding.
>>>> >
>>>> > What if target encoding doesn't support some of the characters in the
>>>> > string?
>>>>
>>>> Guileâs behavior can be controlled with
>>>> â%default-port-conversion-strategyâ: it can raise an exception, or
>>>> substitute any characters that could not be converted, or escape them
>>>> (info "(guile) Ports").
>>>>
>>>> Perhaps this should be briefly mentioned, with a cross-ref.
>>>
>>> It should, because the issue will certainly arise, especially since
>>> (AFAIU) Guile prefers UTF-8.
>>
>> Right. (UTF-8 is just the default encoding for source code; itâs not
>> âpreferredâ in any other way.)
>
> The default conversion strategy here (for make-value) is to throw an exception.
> This isn't a port, and it doesn't feel right to use
> %default-port-conversion-strategy here.
Yes, but I mentioned it because scm_{fo,from}_locale_string use the
value of that fluid as their conversion strategy (info "(guile)
Conversion to/from C").
> It's easy enough to add #:encoding and #:errors options to make-value
> in a later patch.
Yes, that would be best.
(Actually, instead of keyword parameters, you could use optional
positional parameters like âstring->bytevectorâ.)
>>>> >> +If the optional @var{length} argument is given, the string will be
>>>> >> +fetched and encoded to the length of characters specified. If
>>>> >> +the @var{length} argument is not provided, the string will be fetched
>>>> >> +and encoded until a null of appropriate width is found.
>>>> >
>>>> > Isn't this null termination description skewed towards C-like
>>>> > languages? Aren't there languages where strings don't have to be
>>>> > null-terminated?
>>>>
>>>> Yes, and thatâs when LENGTH should be provided, AIUI.
>>>
>>> Then I guess the above should say that explicitly. But it would be
>>> nice if GDB could support strings in languages that don't
>>> null-terminate even without LENGTH.
>>
>> Agreed (I had misread the description above as saying that, if LENGTH is
>> provided, then the string is *not* assumed to be nul-terminated.)
>
> I think the text that is there now is sufficient, I'm not sure how I
> would change it.
> I'm happy to apply any suggested rewordings.
>
> Note that as far as functionality goes, what's there now is what gdb provides.
> ref: LA_GET_STRING, struct language_defn.la_get_string.
> Any additional functionality can be added later.
If the functionality is that only null-terminated strings are supported,
then the text is fine.
Eli was suggesting supporting non-null-terminated strings as well, but
indeed, that can always be added later.
Thanks,
Ludoâ.