From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Rottmann Newsgroups: gmane.lisp.guile.devel Subject: [PATCH 2/4] Reorganize the R6RS I/O condition types Date: Sun, 21 Nov 2010 23:17:52 +0100 Message-ID: <1290377874-13808-2-git-send-email-a.rottmann@gmx.at> References: <87d3pyz5yo.fsf@delenn.lan> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1290377898 28005 80.91.229.12 (21 Nov 2010 22:18:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 21 Nov 2010 22:18:18 +0000 (UTC) To: Guile Development Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Nov 21 23:18:14 2010 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.69) (envelope-from ) id 1PKIEe-0001y4-GF for guile-devel@m.gmane.org; Sun, 21 Nov 2010 23:18:13 +0100 Original-Received: from localhost ([127.0.0.1]:52900 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PKIEd-0000gf-K1 for guile-devel@m.gmane.org; Sun, 21 Nov 2010 17:18:11 -0500 Original-Received: from [140.186.70.92] (port=58652 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PKIEY-0000fG-UL for guile-devel@gnu.org; Sun, 21 Nov 2010 17:18:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PKIEX-0006xH-1H for guile-devel@gnu.org; Sun, 21 Nov 2010 17:18:06 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:53845 helo=mail.gmx.net) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PKIEW-0006xD-La for guile-devel@gnu.org; Sun, 21 Nov 2010 17:18:04 -0500 Original-Received: (qmail invoked by alias); 21 Nov 2010 22:18:03 -0000 Original-Received: from 83-215-154-5.hage.dyn.salzburg-online.at (EHLO nathot.lan) [83.215.154.5] by mail.gmx.net (mp013) with SMTP; 21 Nov 2010 23:18:03 +0100 X-Authenticated: #3102804 X-Provags-ID: V01U2FsdGVkX19nD0s3dktnk5z15img/8j7wAgo/RkJ6RjGd2NPga AwtATvPLjtbGVe Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by nathot.lan (Postfix) with ESMTP id 79B463A693 for ; Sun, 21 Nov 2010 23:18:02 +0100 (CET) Original-Received: from nathot.lan ([127.0.0.1]) by localhost (nathot.lan [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hkDlHRc3nnuw for ; Sun, 21 Nov 2010 23:17:54 +0100 (CET) Original-Received: from delenn.lan (delenn.lan [192.168.3.11]) by nathot.lan (Postfix) with ESMTP id 974CB3A695 for ; Sun, 21 Nov 2010 23:17:54 +0100 (CET) Original-Received: by delenn.lan (Postfix, from userid 1000) id 5B8662C0006; Sun, 21 Nov 2010 23:17:54 +0100 (CET) X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <87d3pyz5yo.fsf@delenn.lan> X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.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:11183 Archived-At: Move the I/O condition types from `(rnrs conditions)', where they were not exported, to `(rnrs files)', where they are. * module/rnrs/conditions.scm: Remove definition of I/O condition types. * module/rnrs/files.scm: Replace references to I/O condition types inside `(rnrs conditions)' with the actual definitions. * module/rnrs/io/simple.scm: Don't `@@'-reference the I/O condition types, just imported them from `(rnrs files)'. --- module/rnrs.scm | 40 +--------------------- module/rnrs/conditions.scm | 26 -------------- module/rnrs/files.scm | 81 ++++++++++++++------------------------------ module/rnrs/io/simple.scm | 60 ++------------------------------- 4 files changed, 30 insertions(+), 177 deletions(-) diff --git a/module/rnrs.scm b/module/rnrs.scm index c6f5db1..14218f0 100644 --- a/module/rnrs.scm +++ b/module/rnrs.scm @@ -244,45 +244,7 @@ (rnrs enums (6)) (rnrs exceptions (6)) - ;; These i/o conditions are exported by (io simple), (files), and - ;; should be exported by (ports) but are not yet. Avoid duplicate - ;; bindings warnings, then, by excluding these bindings from all but - ;; (io simple). - (except (rnrs files (6)) - &i/o make-i/o-error i/o-error? - &i/o-read make-i/o-read-error i/o-read-error? - &i/o-write make-i/o-write-error i/o-write-error? - - &i/o-invalid-position - make-i/o-invalid-position-error - i/o-invalid-position-error? - i/o-error-position - - &i/o-filename - make-i/o-filename-error - i/o-filename-error? - i/o-error-filename - - &i/o-file-protection - make-i/o-file-protection-error - i/o-file-protection-error? - - &i/o-file-is-read-only - make-i/o-file-is-read-only-error - i/o-file-is-read-only-error? - - &i/o-file-already-exists - make-i/o-file-already-exists-error - i/o-file-already-exists-error? - - &i/o-file-does-not-exist - make-i/o-file-does-not-exist-error - i/o-file-does-not-exist-error? - - &i/o-port - make-i/o-port-error - i/o-port-error? - i/o-error-port) + (rnrs files (6)) (rnrs hashtables (6)) diff --git a/module/rnrs/conditions.scm b/module/rnrs/conditions.scm index b897221..6885ada 100644 --- a/module/rnrs/conditions.scm +++ b/module/rnrs/conditions.scm @@ -229,30 +229,4 @@ (define-condition-type &undefined &violation make-undefined-violation undefined-violation?) - ;; Condition types that are used by (rnrs files), (rnrs io ports), and - ;; (rnrs io simple). These are defined here so as to be easily shareable by - ;; these three libraries. - - (define-condition-type &i/o &error make-i/o-error i/o-error?) - (define-condition-type &i/o-read &i/o make-i/o-read-error i/o-read-error?) - (define-condition-type &i/o-write &i/o make-i/o-write-error i/o-write-error?) - (define-condition-type &i/o-invalid-position - &i/o make-i/o-invalid-position-error i/o-invalid-position-error? - (position i/o-error-position)) - (define-condition-type &i/o-filename - &i/o make-i/o-filename-error i/o-filename-error? - (filename i/o-error-filename)) - (define-condition-type &i/o-file-protection - &i/o-filename make-i/o-file-protection-error i/o-file-protection-error?) - (define-condition-type &i/o-file-is-read-only - &i/o-file-protection make-i/o-file-is-read-only-error - i/o-file-is-read-only-error?) - (define-condition-type &i/o-file-already-exists - &i/o-filename make-i/o-file-already-exists-error - i/o-file-already-exists-error?) - (define-condition-type &i/o-file-does-not-exist - &i/o-filename make-i/o-file-does-not-exist-error - i/o-file-does-not-exist-error?) - (define-condition-type &i/o-port &i/o make-i/o-port-error i/o-port-error? - (port i/o-error-port)) ) diff --git a/module/rnrs/files.scm b/module/rnrs/files.scm index e6851d0..447b8b3 100644 --- a/module/rnrs/files.scm +++ b/module/rnrs/files.scm @@ -67,59 +67,30 @@ (lambda () (delete-file-internal filename)) (lambda (key . args) (raise (make-i/o-filename-error filename))))) - (define &i/o (@@ (rnrs conditions) &i/o)) - (define make-i/o-error (@@ (rnrs conditions) make-i/o-error)) - (define i/o-error? (@@ (rnrs conditions) i/o-error?)) - - (define &i/o-read (@@ (rnrs conditions) &i/o-read)) - (define make-i/o-read-error (@@ (rnrs conditions) make-i/o-read-error)) - (define i/o-read-error? (@@ (rnrs conditions) i/o-read-error?)) - - (define &i/o-write (@@ (rnrs conditions) &i/o-write)) - (define make-i/o-write-error (@@ (rnrs conditions) make-i/o-write-error)) - (define i/o-write-error? (@@ (rnrs conditions) i/o-write-error?)) - - (define &i/o-invalid-position (@@ (rnrs conditions) &i/o-invalid-position)) - (define make-i/o-invalid-position-error - (@@ (rnrs conditions) make-i/o-invalid-position-error)) - (define i/o-invalid-position-error? - (@@ (rnrs conditions) i/o-invalid-position-error?)) - (define i/o-error-position (@@ (rnrs conditions) i/o-error-position)) - - (define &i/o-filename (@@ (rnrs conditions) &i/o-filename)) - (define make-i/o-filename-error - (@@ (rnrs conditions) make-i/o-filename-error)) - (define i/o-filename-error? (@@ (rnrs conditions) i/o-filename-error?)) - (define i/o-error-filename (@@ (rnrs conditions) i/o-error-filename)) - - (define &i/o-file-protection (@@ (rnrs conditions) &i/o-file-protection)) - (define make-i/o-file-protection-error - (@@ (rnrs conditions) make-i/o-file-protection-error)) - (define i/o-file-protection-error? - (@@ (rnrs conditions) i/o-file-protection-error?)) - - (define &i/o-file-is-read-only (@@ (rnrs conditions) &i/o-file-is-read-only)) - (define make-i/o-file-is-read-only-error - (@@ (rnrs conditions) make-i/o-file-is-read-only-error)) - (define i/o-file-is-read-only-error? - (@@ (rnrs conditions) i/o-file-is-read-only-error?)) - - (define &i/o-file-already-exists - (@@ (rnrs conditions) &i/o-file-already-exists)) - (define make-i/o-file-already-exists-error - (@@ (rnrs conditions) make-i/o-file-already-exists-error)) - (define i/o-file-already-exists-error? - (@@ (rnrs conditions) i/o-file-already-exists-error?)) - - (define &i/o-file-does-not-exist - (@@ (rnrs conditions) &i/o-file-does-not-exist)) - (define make-i/o-file-does-not-exist-error - (@@ (rnrs conditions) make-i/o-file-does-not-exist-error)) - (define i/o-file-does-not-exist-error? - (@@ (rnrs conditions) i/o-file-does-not-exist-error?)) - - (define &i/o-port (@@ (rnrs conditions) &i/o-port)) - (define make-i/o-port-error (@@ (rnrs conditions) make-i/o-port-error)) - (define i/o-port-error? (@@ (rnrs conditions) i/o-port-error?)) - (define i/o-error-port (@@ (rnrs conditions) i/o-error-port)) + ;; Condition types that are used by (rnrs files), (rnrs io ports), and + ;; (rnrs io simple). These are defined here so as to be easily shareable by + ;; these three libraries. + + (define-condition-type &i/o &error make-i/o-error i/o-error?) + (define-condition-type &i/o-read &i/o make-i/o-read-error i/o-read-error?) + (define-condition-type &i/o-write &i/o make-i/o-write-error i/o-write-error?) + (define-condition-type &i/o-invalid-position + &i/o make-i/o-invalid-position-error i/o-invalid-position-error? + (position i/o-error-position)) + (define-condition-type &i/o-filename + &i/o make-i/o-filename-error i/o-filename-error? + (filename i/o-error-filename)) + (define-condition-type &i/o-file-protection + &i/o-filename make-i/o-file-protection-error i/o-file-protection-error?) + (define-condition-type &i/o-file-is-read-only + &i/o-file-protection make-i/o-file-is-read-only-error + i/o-file-is-read-only-error?) + (define-condition-type &i/o-file-already-exists + &i/o-filename make-i/o-file-already-exists-error + i/o-file-already-exists-error?) + (define-condition-type &i/o-file-does-not-exist + &i/o-filename make-i/o-file-does-not-exist-error + i/o-file-does-not-exist-error?) + (define-condition-type &i/o-port &i/o make-i/o-port-error i/o-port-error? + (port i/o-error-port)) ) diff --git a/module/rnrs/io/simple.scm b/module/rnrs/io/simple.scm index 6afae14..17acdf1 100644 --- a/module/rnrs/io/simple.scm +++ b/module/rnrs/io/simple.scm @@ -113,61 +113,7 @@ display write) (rnrs base (6)) - (rnrs conditions (6))) - - (define &i/o (@@ (rnrs conditions) &i/o)) - (define make-i/o-error (@@ (rnrs conditions) make-i/o-error)) - (define i/o-error? (@@ (rnrs conditions) i/o-error?)) - - (define &i/o-read (@@ (rnrs conditions) &i/o-read)) - (define make-i/o-read-error (@@ (rnrs conditions) make-i/o-read-error)) - (define i/o-read-error? (@@ (rnrs conditions) i/o-read-error?)) - - (define &i/o-write (@@ (rnrs conditions) &i/o-write)) - (define make-i/o-write-error (@@ (rnrs conditions) make-i/o-write-error)) - (define i/o-write-error? (@@ (rnrs conditions) i/o-write-error?)) - - (define &i/o-invalid-position (@@ (rnrs conditions) &i/o-invalid-position)) - (define make-i/o-invalid-position-error - (@@ (rnrs conditions) make-i/o-invalid-position-error)) - (define i/o-invalid-position-error? - (@@ (rnrs conditions) i/o-invalid-position-error?)) - (define i/o-error-position (@@ (rnrs conditions) i/o-error-position)) - - (define &i/o-filename (@@ (rnrs conditions) &i/o-filename)) - (define make-i/o-filename-error - (@@ (rnrs conditions) make-i/o-filename-error)) - (define i/o-filename-error? (@@ (rnrs conditions) i/o-filename-error?)) - (define i/o-error-filename (@@ (rnrs conditions) i/o-error-filename)) - - (define &i/o-file-protection (@@ (rnrs conditions) &i/o-file-protection)) - (define make-i/o-file-protection-error - (@@ (rnrs conditions) make-i/o-file-protection-error)) - (define i/o-file-protection-error? - (@@ (rnrs conditions) i/o-file-protection-error?)) - - (define &i/o-file-is-read-only (@@ (rnrs conditions) &i/o-file-is-read-only)) - (define make-i/o-file-is-read-only-error - (@@ (rnrs conditions) make-i/o-file-is-read-only-error)) - (define i/o-file-is-read-only-error? - (@@ (rnrs conditions) i/o-file-is-read-only-error?)) - - (define &i/o-file-already-exists - (@@ (rnrs conditions) &i/o-file-already-exists)) - (define make-i/o-file-already-exists-error - (@@ (rnrs conditions) make-i/o-file-already-exists-error)) - (define i/o-file-already-exists-error? - (@@ (rnrs conditions) i/o-file-already-exists-error?)) - - (define &i/o-file-does-not-exist - (@@ (rnrs conditions) &i/o-file-does-not-exist)) - (define make-i/o-file-does-not-exist-error - (@@ (rnrs conditions) make-i/o-file-does-not-exist-error)) - (define i/o-file-does-not-exist-error? - (@@ (rnrs conditions) i/o-file-does-not-exist-error?)) - - (define &i/o-port (@@ (rnrs conditions) &i/o-port)) - (define make-i/o-port-error (@@ (rnrs conditions) make-i/o-port-error)) - (define i/o-port-error? (@@ (rnrs conditions) i/o-port-error?)) - (define i/o-error-port (@@ (rnrs conditions) i/o-error-port)) + (rnrs files (6)) ;for the condition types + ) + ) -- 1.7.2.3