Commit | Line | Data |
---|---|---|
ce543a9f JG |
1 | ;;; simple.scm --- The R6RS simple I/O library |
2 | ||
3 | ;; Copyright (C) 2010 Free Software Foundation, Inc. | |
4 | ;; | |
5 | ;; This library is free software; you can redistribute it and/or | |
6 | ;; modify it under the terms of the GNU Lesser General Public | |
7 | ;; License as published by the Free Software Foundation; either | |
8 | ;; version 3 of the License, or (at your option) any later version. | |
9 | ;; | |
10 | ;; This library is distributed in the hope that it will be useful, | |
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | ;; Lesser General Public License for more details. | |
14 | ;; | |
15 | ;; You should have received a copy of the GNU Lesser General Public | |
16 | ;; License along with this library; if not, write to the Free Software | |
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | \f | |
19 | ||
20 | (library (rnrs io simple (6)) | |
21 | (export eof-object | |
22 | eof-object? | |
23 | ||
24 | call-with-input-file | |
25 | call-with-output-file | |
26 | ||
27 | input-port? | |
28 | output-port? | |
29 | ||
30 | current-input-port | |
31 | current-output-port | |
32 | current-error-port | |
33 | ||
34 | with-input-from-file | |
35 | with-output-to-file | |
36 | ||
37 | open-input-file | |
38 | open-output-file | |
39 | ||
40 | close-input-port | |
41 | close-output-port | |
42 | ||
43 | read-char | |
44 | peek-char | |
45 | read | |
46 | write-char | |
47 | newline | |
48 | display | |
0113507e JG |
49 | write |
50 | ||
51 | &i/o make-i/o-error i/o-error? | |
52 | &i/o-read make-i/o-read-error i/o-read-error? | |
53 | &i/o-write make-i/o-write-error i/o-write-error? | |
54 | ||
55 | &i/o-invalid-position | |
56 | make-i/o-invalid-position-error | |
57 | i/o-invalid-position-error? | |
58 | i/o-error-position | |
59 | ||
60 | &i/o-filename | |
61 | make-i/o-filename-error | |
62 | i/o-filename-error? | |
63 | i/o-error-filename | |
64 | ||
65 | &i/o-file-protection | |
66 | make-i/o-file-protection-error | |
67 | i/o-file-protection-error? | |
68 | ||
69 | &i/o-file-is-read-only | |
70 | make-i/o-file-is-read-only-error | |
71 | i/o-file-is-read-only-error? | |
72 | ||
73 | &i/o-file-already-exists | |
74 | make-i/o-file-already-exists-error | |
75 | i/o-file-already-exists-error? | |
76 | ||
77 | &i/o-file-does-not-exist | |
78 | make-i/o-file-does-not-exist-error | |
79 | i/o-file-does-not-exist-error? | |
80 | ||
81 | &i/o-port | |
82 | make-i/o-port-error | |
83 | i/o-port-error? | |
84 | i/o-error-port) | |
85 | ||
ce543a9f JG |
86 | (import (only (rnrs io ports) eof-object |
87 | eof-object? | |
88 | ||
89 | input-port? | |
90 | output-port?) | |
2470bda7 JG |
91 | (only (guile) @@ |
92 | call-with-input-file | |
ce543a9f JG |
93 | call-with-output-file |
94 | ||
95 | current-input-port | |
96 | current-output-port | |
97 | current-error-port | |
98 | ||
d9c40da9 JG |
99 | with-input-from-file |
100 | with-output-to-file | |
ce543a9f JG |
101 | |
102 | open-input-file | |
103 | open-output-file | |
104 | ||
105 | close-input-port | |
106 | close-output-port | |
107 | ||
108 | read-char | |
109 | peek-char | |
110 | read | |
111 | write-char | |
112 | newline | |
113 | display | |
0113507e JG |
114 | write) |
115 | (rnrs base (6)) | |
116 | (rnrs conditions (6))) | |
117 | ||
118 | (define &i/o (@@ (rnrs conditions) &i/o)) | |
119 | (define make-i/o-error (@@ (rnrs conditions) make-i/o-error)) | |
120 | (define i/o-error? (@@ (rnrs conditions) i/o-error?)) | |
121 | ||
122 | (define &i/o-read (@@ (rnrs conditions) &i/o-read)) | |
123 | (define make-i/o-read-error (@@ (rnrs conditions) make-i/o-read-error)) | |
124 | (define i/o-read-error? (@@ (rnrs conditions) i/o-read-error?)) | |
125 | ||
126 | (define &i/o-write (@@ (rnrs conditions) &i/o-write)) | |
127 | (define make-i/o-write-error (@@ (rnrs conditions) make-i/o-write-error)) | |
128 | (define i/o-write-error? (@@ (rnrs conditions) i/o-write-error?)) | |
129 | ||
130 | (define &i/o-invalid-position (@@ (rnrs conditions) &i/o-invalid-position)) | |
131 | (define make-i/o-invalid-position-error | |
132 | (@@ (rnrs conditions) make-i/o-invalid-position-error)) | |
133 | (define i/o-invalid-position-error? | |
134 | (@@ (rnrs conditions) i/o-invalid-position-error?)) | |
135 | (define i/o-error-position (@@ (rnrs conditions) i/o-error-position)) | |
136 | ||
137 | (define &i/o-filename (@@ (rnrs conditions) &i/o-filename)) | |
138 | (define make-i/o-filename-error | |
139 | (@@ (rnrs conditions) make-i/o-filename-error)) | |
140 | (define i/o-filename-error? (@@ (rnrs conditions) i/o-filename-error?)) | |
141 | (define i/o-error-filename (@@ (rnrs conditions) i/o-error-filename)) | |
142 | ||
143 | (define &i/o-file-protection (@@ (rnrs conditions) &i/o-file-protection)) | |
144 | (define make-i/o-file-protection-error | |
145 | (@@ (rnrs conditions) make-i/o-file-protection-error)) | |
146 | (define i/o-file-protection-error? | |
147 | (@@ (rnrs conditions) i/o-file-protection-error?)) | |
148 | ||
149 | (define &i/o-file-is-read-only (@@ (rnrs conditions) &i/o-file-is-read-only)) | |
150 | (define make-i/o-file-is-read-only-error | |
151 | (@@ (rnrs conditions) make-i/o-file-is-read-only-error)) | |
152 | (define i/o-file-is-read-only-error? | |
153 | (@@ (rnrs conditions) i/o-file-is-read-only-error?)) | |
154 | ||
155 | (define &i/o-file-already-exists | |
156 | (@@ (rnrs conditions) &i/o-file-already-exists)) | |
157 | (define make-i/o-file-already-exists-error | |
158 | (@@ (rnrs conditions) make-i/o-file-already-exists-error)) | |
159 | (define i/o-file-already-exists-error? | |
160 | (@@ (rnrs conditions) i/o-file-already-exists-error?)) | |
161 | ||
162 | (define &i/o-file-does-not-exist | |
163 | (@@ (rnrs conditions) &i/o-file-does-not-exist)) | |
164 | (define make-i/o-file-does-not-exist-error | |
165 | (@@ (rnrs conditions) make-i/o-file-does-not-exist-error)) | |
166 | (define i/o-file-does-not-exist-error? | |
167 | (@@ (rnrs conditions) i/o-file-does-not-exist-error?)) | |
168 | ||
169 | (define &i/o-port (@@ (rnrs conditions) &i/o-port)) | |
170 | (define make-i/o-port-error (@@ (rnrs conditions) make-i/o-port-error)) | |
171 | (define i/o-port-error? (@@ (rnrs conditions) i/o-port-error?)) | |
172 | (define i/o-error-port (@@ (rnrs conditions) i/o-error-port)) | |
173 | ) |