From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mike Gran Newsgroups: gmane.lisp.guile.devel Subject: Re: [Guile-commits] GNU Guile branch, string_abstraction2, updated. fc50695e8d6a5cc0cebc3a8fcd0833ec1ff316a2 Date: Fri, 05 Jun 2009 07:26:59 -0700 Message-ID: <1244212019.2499.8500.camel@localhost.localdomain> References: <87d49ibwk0.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1244212031 3596 80.91.229.12 (5 Jun 2009 14:27:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Jun 2009 14:27:11 +0000 (UTC) Cc: Guile Devel To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jun 05 16:27:09 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MCaNx-0008Ni-1m for guile-devel@m.gmane.org; Fri, 05 Jun 2009 16:27:09 +0200 Original-Received: from localhost ([127.0.0.1]:51206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MCaNw-0001rt-H0 for guile-devel@m.gmane.org; Fri, 05 Jun 2009 10:27:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MCaNt-0001rl-KX for guile-devel@gnu.org; Fri, 05 Jun 2009 10:27:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MCaNt-0001rZ-1z for guile-devel@gnu.org; Fri, 05 Jun 2009 10:27:05 -0400 Original-Received: from [199.232.76.173] (port=59629 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MCaNs-0001rW-TB for guile-devel@gnu.org; Fri, 05 Jun 2009 10:27:04 -0400 Original-Received: from smtp107.prem.mail.sp1.yahoo.com ([98.136.44.62]:20151) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1MCaNs-0003Mj-Ay for guile-devel@gnu.org; Fri, 05 Jun 2009 10:27:04 -0400 Original-Received: (qmail 50719 invoked from network); 5 Jun 2009 14:27:03 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Subject:From:To:Cc:In-Reply-To:References:Content-Type:Date:Message-Id:Mime-Version:X-Mailer:Content-Transfer-Encoding; b=wh95ZAGESUWPFTRk3N/ksUM5ss4QoHfnGYlNGbKdngFyXHqIkobdIQJkX2gyHa2E8knM/47P7lKFQccXOViXm1E9mb3rjZx/88tCLphrgZcTuBwIl84q3O1CVYohbnxvFnMyJgx6oXVFYHM8PJ+I6wBo3F0Xym8YCGTBjyx+rqU= ; Original-Received: from ppp-71-140-200-82.dsl.irvnca.pacbell.net (spk121@71.140.200.82 with plain) by smtp107.prem.mail.sp1.yahoo.com with SMTP; 05 Jun 2009 07:27:03 -0700 PDT X-Yahoo-SMTP: FzNaA9iswBDuBl1BmgaIRDaP9Q-- X-YMail-OSG: N_X4brcVM1nFNkviLCbclR1PcKkgaNRPXjGrkcPXXHpd7NsZDLi8nFCDse6YifMr.vYca95eQQxzeXjIk_gaVRpoEsScbBMdxPet7ItVJS071AcFsPKUKSxOfL1NSrm_iqQvsRCsOv.S5Dx_lHhTJPT4L9VGIYlL_xtz6Awage_NfhIMXO8FnHwK4bhDS0h.MnDUIuV4RpPWyWmHfpbsIFAcjRBknEdH8aYNkJeWD63EOrAoEZqY8DL8Zvji3iLA4n_nc7AhhZb5bcYfZVcaxvDiGYn.t6pGRLIMmcE1ZUDLiOftxBLogGoYBMcRR1KZ47Tx9uioZc8LiLJyd1eBQpLcLhim_BklbhK_ X-Yahoo-Newman-Property: ymail-3 In-Reply-To: <87d49ibwk0.fsf@gnu.org> X-Mailer: Evolution 2.24.5 (2.24.5-1.fc10) X-detected-operating-system: by monty-python.gnu.org: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (2) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:8622 Archived-At: On Fri, 2009-06-05 at 16:10 +0200, Ludovic Courtès wrote: > Hi Mike, > > A few random thoughts: > > "Michael Gran" writes: > > > - buf = scm_to_locale_stringn (scm_c_substring (str, start, end), &len); > > + buf = scm_to_encoded_stringn (scm_c_substring (str, start, end), &len, > > + pt->encoding, pt->ilseq_handler); > > I'd call that `scm_to_stringn ()' since it's the most generic form (and > a string is always "encoded", anyway). OK > > > +SCM_DEFINE (scm_setencoding, "setencoding", 1, 1, 0, > > + (SCM enc, SCM port), > > How about `set-port-encoding!' (for consistency with other procedure > names), with PORT being a required argument? > > > "Sets the character encoding that will be used to interpret all\n" > > - "port I/O. Normally, one would set this using @code{setlocale},\n" > > + "port I/O. Normally, a new port would inherit the encoding\n" > > + "set by using @code{setlocale},\n" > > It would seem simpler to me if a port's encoding defaulted to ASCII, > instead of the current locale's encoding. That would make semantics > clearer and easier to follow. What do you think? > It would make things easier to follow, but, pure 7-bit ASCII would hurt backwards compatibility. The libunistring conversion funcs do raise errors when 8-bit chars are converted into ASCII. ISO-8859-1 could be better so that 8-bit chars wouldn't cause errors by default. Also, I guess setlocale is where one should modify the encodings of current-input-port, current-output-port and current-error-port, since they need special handling. > > +SCM_DEFINE (scm_setbinary, "setbinary", 0, 1, 0, > > + (SCM port), > > Likewise, `set-port-binary-mode!' or some such. > > > +char * > > +scm_scan_for_encoding (SCM port) > > Since it's `SCM_INTERNAL', I'd suggest `scm_i_scan_for_encoding()'. > OK > In addition, from a memory management viewpoint, it might be easier to > have it return an `SCM'. OK > > > -SCM_DEFINE (scm_set_conversion_error_behavior_x, "set-conversion-error-behavior!", > > I'm wondering whether this should be a per-port (eventually, > per-transcoder) setting. What's your opinion? I believe that is how it should work. I'm working toward that. > > Thanks, > Ludo'. Thanks, Mike