From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20417 invoked by alias); 18 Jan 2014 20:52:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 20408 invoked by uid 89); 18 Jan 2014 20:52:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: hera.aquilenet.fr Received: from hera.aquilenet.fr (HELO hera.aquilenet.fr) (141.255.128.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 18 Jan 2014 20:52:54 +0000 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 162871991; Sat, 18 Jan 2014 21:52:52 +0100 (CET) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wLV2ig0OZ9wV; Sat, 18 Jan 2014 21:52:51 +0100 (CET) Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 9BA5A1831; Sat, 18 Jan 2014 21:52:51 +0100 (CET) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Doug Evans Cc: Eli Zaretskii , "gdb-patches\@sourceware.org" Subject: Re: [PATCH v1 02/36] Guile extension language: doc additions References: <52b9da59.64ab440a.0b0b.7e1c@mx.google.com> <83ha9w68av.fsf@gnu.org> <87sit4kb1t.fsf@gnu.org> <83eh4ow78t.fsf@gnu.org> <87k3egez8e.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 29 =?utf-8?Q?Niv=C3=B4se?= an 222 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu Date: Sat, 18 Jan 2014 20:52:00 -0000 In-Reply-To: (Doug Evans's message of "Sat, 18 Jan 2014 12:36:06 -0800") Message-ID: <87mwitovvh.fsf@gnu.org> User-Agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2014-01/txt/msg00704.txt.bz2 Doug Evans skribis: > On Sat, Jan 4, 2014 at 3:57 AM, Ludovic Court=C3=A8s 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=E2=80=99s behavior can be controlled with >>>> =E2=80=98%default-port-conversion-strategy=E2=80=99: it can raise an e= xception, 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=E2=80=99= s not >> =E2=80=9Cpreferred=E2=80=9D in any other way.) > > The default conversion strategy here (for make-value) is to throw an exce= ption. > 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 =E2=80=98string->bytevector=E2=80=99.) >>>> >> +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 fetc= hed >>>> >> +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=E2=80=99s 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 prov= ides. > 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=E2=80=99.