From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.user Subject: Re: [PATCH] Improved string writing Date: Fri, 22 Apr 2005 08:10:21 +1000 Message-ID: <87d5sn93xu.fsf@zip.com.au> References: <87is2h39ab.fsf@laas.fr> <878y3di0ku.fsf@zip.com.au> <87fyxky404.fsf@laas.fr> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1114121303 6466 80.91.229.2 (21 Apr 2005 22:08:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 21 Apr 2005 22:08:23 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Apr 22 00:08:16 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DOjpb-0005Hm-8Z for guile-user@m.gmane.org; Fri, 22 Apr 2005 00:07:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DOjuO-0004D1-IA for guile-user@m.gmane.org; Thu, 21 Apr 2005 18:12:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DOjte-000439-5b for guile-user@gnu.org; Thu, 21 Apr 2005 18:11:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DOjtd-00042f-2h for guile-user@gnu.org; Thu, 21 Apr 2005 18:11:41 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DOjtc-0000eF-Pc for guile-user@gnu.org; Thu, 21 Apr 2005 18:11:40 -0400 Original-Received: from [61.8.0.85] (helo=mailout2.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DOjv9-0004x7-8y for guile-user@gnu.org; Thu, 21 Apr 2005 18:13:15 -0400 Original-Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86]) by mailout2.pacific.net.au (8.12.3/8.12.3/Debian-7.1) with ESMTP id j3LMAZml002484; Fri, 22 Apr 2005 08:10:35 +1000 Original-Received: from localhost (ppp2BE0.dyn.pacific.net.au [61.8.43.224]) by mailproxy1.pacific.net.au (8.12.3/8.12.3/Debian-7.1) with ESMTP id j3LMAWIn003605; Fri, 22 Apr 2005 08:10:34 +1000 Original-Received: from gg by localhost with local (Exim 3.36 #1 (Debian)) id 1DOjsL-0000e5-00; Fri, 22 Apr 2005 08:10:21 +1000 Original-To: ludovic.courtes@laas.fr (Ludovic =?iso-8859-1?Q?Court=E8s?=) In-Reply-To: <87fyxky404.fsf@laas.fr> (Ludovic =?iso-8859-1?Q?Court=E8s's?= message of "Thu, 21 Apr 2005 09:37:31 +0200") User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:4399 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:4399 ludovic.courtes@laas.fr (Ludovic Court=E8s) writes: > > Actually, I hadn't considered using it because `stdout' is line-buffered > by default, at least on GNU/Linux Guile doesn't actually use stdio. > (SUSv2 states that it shall be "fully-buffered" by default [1, 2]). Fully buffered on a non-tty. On a tty you're right the tradition is line buffered output. > But it looks like Guile's file ports are unbuffered by default. Ah yes, on a tty. (scm_init_standard_ports in init.c.) > Maybe _this_ should be changed? Alas I think that'd be an incompatible change, programs printing a prompt or progress info probably depend on immediate output as the default. (In C stdio a prompt is handled by stdout automatically flushing when stdin is read, but there's no such interlock in guile, I think.) It'd be good to add a bit to the manual somewhere about this. I just realized I struck something similar to what you're talking about only the other day, running a guile subprocess from emacs. I fiddled about with strings to ensure decent size chunks got written for performance. (Emacs uses a pseudo-tty to talk to subprocesses, rather than a pipe.) > It looks better to call `scm_lfwrite ()' once than `scm_putc ()' for > each character, especially since `scm_putc ()' calls `scm_lfwrite ()' Yes, but I would limit that to what can be done easily locally, like two adjacent putcs turned into one write. I'd leave general sort of buffering to the port or an application. > `scm_lfwrite ()' does this so Guile code doesn't have to care about it. Yep, format.scm started as portable to systems without builtin output column tracking, I think. I thought of changing to use the port as a simplification, I guess it's also an optimization. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user