From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Luigi Semenzato" Newsgroups: gmane.lisp.guile.user Subject: Re: read-string!/partial on non-file ports Date: Mon, 10 Sep 2007 22:00:44 -0700 Message-ID: References: <87bqcacdmw.fsf@chbouib.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1189486903 24694 80.91.229.12 (11 Sep 2007 05:01:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 11 Sep 2007 05:01:43 +0000 (UTC) Cc: guile-user@gnu.org To: "=?ISO-8859-1?Q?Ludovic_Court=E8s?=" Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Sep 11 15:01:26 2007 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IV5Mm-0003Rr-NO for guile-user@m.gmane.org; Tue, 11 Sep 2007 15:01:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IUxsU-00080q-Ks for guile-user@m.gmane.org; Tue, 11 Sep 2007 01:01:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IUxrm-0007kZ-Fv for guile-user@gnu.org; Tue, 11 Sep 2007 01:00:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IUxrj-0007hf-Ka for guile-user@gnu.org; Tue, 11 Sep 2007 01:00:48 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IUxrj-0007hP-D0 for guile-user@gnu.org; Tue, 11 Sep 2007 01:00:47 -0400 Original-Received: from rv-out-0910.google.com ([209.85.198.187]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IUxri-000452-Pm for guile-user@gnu.org; Tue, 11 Sep 2007 01:00:47 -0400 Original-Received: by rv-out-0910.google.com with SMTP id c27so1148781rvf for ; Mon, 10 Sep 2007 22:00:45 -0700 (PDT) Original-Received: by 10.141.66.2 with SMTP id t2mr2182296rvk.1189486844966; Mon, 10 Sep 2007 22:00:44 -0700 (PDT) Original-Received: by 10.141.151.10 with HTTP; Mon, 10 Sep 2007 22:00:44 -0700 (PDT) In-Reply-To: <87bqcacdmw.fsf@chbouib.org> Content-Disposition: inline X-Detected-Kernel: Linux 2.6 (newer, 2) 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:6138 Archived-At: Wow, thanks for all the help. Mike and Kevin pointed out that it's probably best to use socketpair rather than pipe. Of course. I am such a troglodyte. Kevin's example looks robust and I used it almost verbatim (I assume it's OK). It works fine. Ludovic suggests that uniform vectors are better than strings for raw data. Yes. The distinction is not vital for me at this point, but if I get beyond a prototype, that's the right direction. For the moment I'll pass on the suggestion of using Guile-R6RS-Libs. The language is large enough as it is and I am learning it as I go along. Thanks again! Luigi On 9/10/07, Ludovic Court=E8s wrote: > Hi, > > "Luigi Semenzato" writes: > > > I would like to move binary data between two guile > > applications across a pipe (opened with open-input-output-pipe). > > Read-char and write-char in a loop are going to be too slow. > > Read-string!/partial and write-string/partial are exactly what > > I need but they only work on file ports. (I get this error: > > Wrong type argument in position 2 (expecting open file port): > > #). > > > > Two questions. > > > > 1. Do I have other choices? I cannot find any. > > Using strings for binary I/O is Bad because it assumes a specific > bit-representation of strings (namely, ASCII). > > SRFI-4 vectors and `uniform-vector-read!'/`uniform-vector-write' may be > a better match. > > If you're not afraid of using experimental code, you might also want to > try Guile-R6RS-Libs, which includes part of R6RS' binary I/O API > (actually based on R5.92RS): > > http://www.laas.fr/~lcourtes/software/guile/guile-r6rs-libs-0.0.tar.gz > > http://www.r6rs.org/document/lib-html-5.92/r6rs-lib-Z-H-4.html#node_cha= p_2 > http://www.r6rs.org/document/lib-html-5.92/r6rs-lib-Z-H-9.html#node_sec= _7.2 > > Thanks, > Ludovic. > > > > _______________________________________________ > Guile-user mailing list > Guile-user@gnu.org > http://lists.gnu.org/mailman/listinfo/guile-user > _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user