From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13950 invoked by alias); 18 Jan 2014 20:36:11 -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 13941 invoked by uid 89); 18 Jan 2014 20:36:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f173.google.com Received: from mail-wi0-f173.google.com (HELO mail-wi0-f173.google.com) (209.85.212.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 18 Jan 2014 20:36:09 +0000 Received: by mail-wi0-f173.google.com with SMTP id d13so1980122wiw.6 for ; Sat, 18 Jan 2014 12:36:06 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.194.250.34 with SMTP id yz2mr6992517wjc.18.1390077366768; Sat, 18 Jan 2014 12:36:06 -0800 (PST) Received: by 10.194.17.104 with HTTP; Sat, 18 Jan 2014 12:36:06 -0800 (PST) In-Reply-To: <87k3egez8e.fsf@gnu.org> References: <52b9da59.64ab440a.0b0b.7e1c@mx.google.com> <83ha9w68av.fsf@gnu.org> <87sit4kb1t.fsf@gnu.org> <83eh4ow78t.fsf@gnu.org> <87k3egez8e.fsf@gnu.org> Date: Sat, 18 Jan 2014 20:36:00 -0000 Message-ID: Subject: Re: [PATCH v1 02/36] Guile extension language: doc additions From: Doug Evans To: =?ISO-8859-1?Q?Ludovic_Court=E8s?= Cc: Eli Zaretskii , "gdb-patches@sourceware.org" Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-01/txt/msg00702.txt.bz2 On Sat, Jan 4, 2014 at 3:57 AM, Ludovic Court=E8s 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=92s behavior can be controlled with >>> =91%default-port-conversion-strategy=92: 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=92s not > =93preferred=94 in any other way.) The default conversion strategy here (for make-value) is to throw an except= ion. This isn't a port, and it doesn't feel right to use %default-port-conversion-strategy here. It's easy enough to add #:encoding and #:errors options to make-value in a later patch. >>> >> +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 fetch= ed >>> >> +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=92s 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 provid= es. ref: LA_GET_STRING, struct language_defn.la_get_string. Any additional functionality can be added later.