From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: [Guile-commits] GNU Guile branch, string_abstraction2, updated. fc50695e8d6a5cc0cebc3a8fcd0833ec1ff316a2 Date: Fri, 05 Jun 2009 16:10:55 +0200 Message-ID: <87d49ibwk0.fsf@gnu.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1244211070 32752 80.91.229.12 (5 Jun 2009 14:11:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Jun 2009 14:11:10 +0000 (UTC) Cc: guile-devel@gnu.org To: "Michael Gran" Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jun 05 16:11:07 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 1MCa8Q-00066q-Rd for guile-devel@m.gmane.org; Fri, 05 Jun 2009 16:11:07 +0200 Original-Received: from localhost ([127.0.0.1]:51788 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MCa8Q-0006S3-4I for guile-devel@m.gmane.org; Fri, 05 Jun 2009 10:11:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MCa8M-0006PB-Kx for guile-devel@gnu.org; Fri, 05 Jun 2009 10:11:02 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MCa8I-0006M7-5H for guile-devel@gnu.org; Fri, 05 Jun 2009 10:11:02 -0400 Original-Received: from [199.232.76.173] (port=55150 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MCa8I-0006Lx-25 for guile-devel@gnu.org; Fri, 05 Jun 2009 10:10:58 -0400 Original-Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:5557) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1MCa8G-0000Si-It for guile-devel@gnu.org; Fri, 05 Jun 2009 10:10:57 -0400 X-IronPort-AV: E=Sophos;i="4.41,312,1241388000"; d="scan'208";a="27418179" Original-Received: from vpn88.saclay.inria.fr (HELO nixey) ([195.83.213.88]) by mail2-relais-roc.national.inria.fr with ESMTP; 05 Jun 2009 16:10:54 +0200 X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 17 Prairial an 217 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: i686-pc-linux-gnu In-Reply-To: (Michael Gran's message of "Fri, 05 Jun 2009 13:40:40 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.90 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:8621 Archived-At: 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). > +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? > +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()'. In addition, from a memory management viewpoint, it might be easier to have it return an `SCM'. > -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? Thanks, Ludo'.