Work towards a more complete implementation of `(rnrs io ports)'
[bpt/guile.git] / module / rnrs.scm
CommitLineData
2d56d2df
JG
1;;; rnrs.scm --- The R6RS composite 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 (6))
21 (export ;; (rnrs arithmetic bitwise)
22
23 bitwise-not bitwise-and bitwise-ior bitwise-xor bitwise-if
24 bitwise-bit-count bitwise-length bitwise-first-bit-set
25 bitwise-bit-set? bitwise-copy-bit bitwise-bit-field
26 bitwise-copy-bit-field bitwise-arithmetic-shift
27 bitwise-arithmetic-shift-left bitwise-arithmetic-shift-right
28 bitwise-rotate-bit-field bitwise-reverse-bit-field
29
30 ;; (rnrs arithmetic fixnums)
31
32 fixnum? fixnum-width least-fixnum greatest-fixnum fx=? fx>? fx<? fx>=?
33 fx<=? fxzero? fxpositive? fxnegative? fxodd? fxeven? fxmax fxmin fx+
34 fx* fx- fxdiv-and-mod fxdiv fxmod fxdiv0-and-mod0 fxdiv0 fxmod0
35 fx+/carry fx-/carry fx*/carry fxnot fxand fxior fxxor fxif fxbit-count
36 fxlength fxfirst-bit-set fxbit-set? fxcopy-bit fxbit-field
37 fxcopy-bit-field fxarithmetic-shift fxarithmetic-shift-left
38 fxarithmetic-shift-right fxrotate-bit-field fxreverse-bit-field
39
40 ;; (rnrs arithmetic flonums)
41
42 flonum? real->flonum fl=? fl<? fl<=? fl>? fl>=? flinteger? flzero?
43 flpositive? flnegative? flodd? fleven? flfinite? flinfinite? flnan?
44 flmax flmin fl+ fl* fl- fl/ flabs fldiv-and-mod fldiv flmod
45 fldiv0-and-mod0 fldiv0 flmod0 flnumerator fldenominator flfloor
46 flceiling fltruncate flround flexp fllog flsin flcos fltan flacos
47 flasin flatan flsqrt flexpt &no-infinities
48 make-no-infinities-violation no-infinities-violation? &no-nans
49 make-no-nans-violation no-nans-violation? fixnum->flonum
50
51 ;; (rnrs base)
52
53 boolean? symbol? char? vector? null? pair? number? string? procedure?
54 define define-syntax syntax-rules lambda let let* let-values
b98d5a5a
JG
55 let*-values letrec letrec* begin quote lambda if set! cond case or
56 and not eqv? equal? eq? + - * / max min abs numerator denominator gcd
57 lcm floor ceiling truncate round rationalize real-part imag-part
2d56d2df
JG
58 make-rectangular angle div mod div-and-mod div0 mod0 div0-and-mod0
59 expt exact-integer-sqrt sqrt exp log sin cos tan asin acos atan
60 make-polar magnitude angle complex? real? rational? integer? exact?
b98d5a5a 61 inexact? real-valued? rational-valued? integer-valued? zero?
2d56d2df 62 positive? negative? odd? even? nan? finite? infinite? exact inexact =
b98d5a5a
JG
63 < > <= >= number->string string->number boolean=? cons car cdr caar
64 cadr cdar cddr caaar caadr cadar cdaar caddr cdadr cddar cdddr caaaar
65 caaadr caadar cadaar cdaaar cddaar cdadar cdaadr cadadr caaddr caddar
66 cadddr cdaddr cddadr cdddar cddddr list? list length append reverse
2d56d2df
JG
67 list-tail list-ref map for-each symbol->string string->symbol symbol=?
68 char->integer integer->char char=? char<? char>? char<=? char>=?
69 make-string string string-length string-ref string=? string<? string>?
70 string<=? string>=? substring string-append string->list list->string
71 string-for-each string-copy vector? make-vector vector vector-length
72 vector-ref vector-set! vector->list list->vector vector-fill!
73 vector-map vector-for-each error assertion-violation assert
74 call-with-current-continuation call/cc call-with-values dynamic-wind
75 values apply quasiquote unquote unquote-splicing let-syntax
76 letrec-syntax syntax-rules identifier-syntax
77
07d22c02 78 ;; (rnrs bytevectors)
2d56d2df
JG
79
80 endianness native-endianness bytevector? make-bytevector
81 bytevector-length bytevector=? bytevector-fill! bytevector-copy!
82 bytevector-copy uniform-array->bytevector bytevector-u8-ref
83 bytevector-s8-ref bytevector-u8-set! bytevector-s8-set!
84 bytevector->u8-list u8-list->bytevector bytevector-uint-ref
85 bytevector-uint-set! bytevector-sint-ref bytevector-sint-set!
86 bytevector->sint-list bytevector->uint-list uint-list->bytevector
87 sint-list->bytevector bytevector-u16-ref bytevector-s16-ref
88 bytevector-u16-set! bytevector-s16-set! bytevector-u16-native-ref
89 bytevector-s16-native-ref bytevector-u16-native-set!
90 bytevector-s16-native-set! bytevector-u32-ref bytevector-s32-ref
91 bytevector-u32-set! bytevector-s32-set! bytevector-u32-native-ref
92 bytevector-s32-native-ref bytevector-u32-native-set!
93 bytevector-s32-native-set! bytevector-u64-ref bytevector-s64-ref
94 bytevector-u64-set! bytevector-s64-set! bytevector-u64-native-ref
95 bytevector-s64-native-ref bytevector-u64-native-set!
96 bytevector-s64-native-set! bytevector-ieee-single-ref
97 bytevector-ieee-single-set! bytevector-ieee-single-native-ref
98 bytevector-ieee-single-native-set! bytevector-ieee-double-ref
99 bytevector-ieee-double-set! bytevector-ieee-double-native-ref
100 bytevector-ieee-double-native-set! string->utf8 string->utf16
101 string->utf32 utf8->string utf16->string utf32->string
102
103 ;; (rnrs conditions)
104
105 &condition condition simple-conditions condition? condition-predicate
106 condition-accessor define-condition-type &message
107 make-message-condition message-condition? condition-message &warning
108 make-warning warning? &serious make-serious-condition
109 serious-condition? &error make-error error? &violation make-violation
110 violation? &assertion make-assertion-violation assertion-violation?
111 &irritants make-irritants-condition irritants-condition?
112 condition-irritants &who make-who-condition who-condition?
113 condition-who &non-continuable make-non-continuable-violation
114 non-continuable-violation? &implementation-restriction
115 make-implementation-restriction-violation
116 implementation-restriction-violation? &lexical make-lexical-violation
117 lexical-violation? &syntax make-syntax-violation syntax-violation?
118 syntax-violation-form syntax-violation-subform &undefined
119 make-undefined-violation undefined-violation?
120
121 ;; (rnrs control)
122
123 when unless do case-lambda
124
125 ;; (rnrs enums)
126
127 make-enumeration enum-set-universe enum-set-indexer
128 enum-set-constructor enum-set->list enum-set-member? enum-set-subset?
129 enum-set=? enum-set-union enum-set-intersection enum-set-difference
130 enum-set-complement enum-set-projection define-enumeration
131
132 ;; (rnrs exceptions)
133
134 guard with-exception-handler raise raise-continuable
135
136 ;; (rnrs files)
137
138 file-exists? delete-file &i/o make-i/o-error i/o-error? &i/o-read
139 make-i/o-read-error i/o-read-error? &i/o-write make-i/o-write-error
140 i/o-write-error? &i/o-invalid-position
141 make-i/o-invalid-position-error i/o-invalid-position-error?
142 i/o-error-position &i/o-filename make-i/o-filename-error
143 i/o-filename-error? i/o-error-filename &i/o-file-protection
144 make-i/o-file-protection-error i/o-file-protection-error?
145 &i/o-file-is-read-only make-i/o-file-is-read-only-error
146 i/o-file-is-read-only-error? &i/o-file-already-exists
147 make-i/o-file-already-exists-error i/o-file-already-exists-error?
148 &i/o-file-does-not-exist make-i/o-file-does-not-exist-error
149 i/o-file-does-not-exist-error? &i/o-port make-i/o-port-error
150 i/o-port-error? i/o-error-port
151
152 ;; (rnrs hashtables)
153
154 make-eq-hashtable make-eqv-hashtable make-hashtable hashtable?
155 hashtable-size hashtable-ref hashtable-set! hashtable-delete!
156 hashtable-contains? hashtable-update! hashtable-copy hashtable-clear!
157 hashtable-keys hashtable-entries hashtable-equivalence-function
158 hashtable-hash-function hashtable-mutable? equal-hash string-hash
159 string-ci-hash symbol-hash
160
161 ;; (rnrs io ports)
162
a5484153
AR
163 file-options buffer-mode buffer-mode?
164 eol-style native-eol-style error-handling-mode
165 make-transcoder transcoder-codec native-transcoder
166 latin-1-codec utf-8-codec utf-16-codec
167
2d56d2df
JG
168 eof-object? port? input-port? output-port? eof-object port-transcoder
169 binary-port? transcoded-port port-position set-port-position!
a5484153
AR
170 port-has-port-position? port-has-set-port-position!?
171 close-port call-with-port
2d56d2df
JG
172 open-bytevector-input-port make-custom-binary-input-port get-u8
173 lookahead-u8 get-bytevector-n get-bytevector-n! get-bytevector-some
174 get-bytevector-all open-bytevector-output-port
175 make-custom-binary-output-port put-u8 put-bytevector
c3993330 176 open-string-input-port open-string-output-port
a5484153
AR
177 call-with-bytevector-output-port
178 call-with-string-output-port
179 latin-1-codec utf-8-codec utf-16-codec
180 open-file-input-port open-file-output-port
181 make-custom-textual-output-port
182 call-with-string-output-port
183 flush-output-port put-string
184 get-char get-datum get-line get-string-all lookahead-char
185 put-char put-datum put-string
186 standard-input-port standard-output-port standard-error-port
187
2d56d2df
JG
188 ;; (rnrs io simple)
189
190 call-with-input-file call-with-output-file current-input-port
191 current-output-port current-error-port with-input-from-file
192 with-output-to-file open-input-file open-output-file close-input-port
193 close-output-port read-char peek-char read write-char newline display
194 write
195
196 ;; (rnrs lists)
197
198 find for-all exists filter partition fold-left fold-right remp remove
199 remv remq memp member memv memq assp assoc assv assq cons*
200
201 ;; (rnrs programs)
202
203 command-line exit
204
205 ;; (rnrs records inspection)
206
207 record? record-rtd record-type-name record-type-parent
208 record-type-uid record-type-generative? record-type-sealed?
209 record-type-opaque? record-type-field-names record-field-mutable?
210
211 ;; (rnrs records procedural)
212
213 make-record-type-descriptor record-type-descriptor?
214 make-record-constructor-descriptor record-constructor record-predicate
215 record-accessor record-mutator
216
217 ;; (rnrs records syntactic)
218
219 define-record-type record-type-descriptor
220 record-constructor-descriptor
221
222 ;; (rnrs sorting)
223
224 list-sort vector-sort vector-sort!
225
226 ;; (rnrs syntax-case)
227
61bac799
AW
228 make-variable-transformer syntax
229 ;; Until the deprecated support for a unified modules and
230 ;; bindings namespace is removed, we need to manually resolve
231 ;; a conflict between two bindings: that of the (rnrs
232 ;; syntax-case) module, and the imported `syntax-case'
233 ;; binding. We do so here and below by renaming the macro
234 ;; import.
235 (rename (syntax-case-hack syntax-case))
236 identifier? bound-identifier=? free-identifier=?
237 syntax->datum datum->syntax generate-temporaries with-syntax
238 quasisyntax unsyntax unsyntax-splicing syntax-violation
a2e0b126
AR
239
240 ;; (rnrs unicode)
241
242 char-upcase char-downcase char-titlecase char-foldcase
243 char-ci=? char-ci<? char-ci>? char-ci<=? char-ci>=?
244 char-alphabetic? char-numeric? char-whitespace? char-upper-case?
245 char-lower-case? char-title-case? char-general-category
246 string-upcase string-downcase string-titlecase string-foldcase
247 string-ci=? string-ci<? string-ci>? string-ci<=? string-ci>=?
248 string-normalize-nfd string-normalize-nfkd string-normalize-nfc
249 string-normalize-nfkc)
2d56d2df
JG
250
251 (import (rnrs arithmetic bitwise (6))
252 (rnrs arithmetic fixnums (6))
253 (rnrs arithmetic flonums (6))
254 (rnrs base (6))
255
c08adae4
AW
256 (rnrs bytevectors (6))
257
2d56d2df
JG
258 (rnrs conditions (6))
259 (rnrs control (6))
260 (rnrs enums (6))
261 (rnrs exceptions (6))
8d10ccae 262
50851f1d 263 (rnrs files (6))
8d10ccae 264
2d56d2df
JG
265 (rnrs hashtables (6))
266
c08adae4 267 (rnrs io ports (6))
2d56d2df
JG
268
269 (rnrs io simple (6))
270 (rnrs lists (6))
271 (rnrs programs (6))
272 (rnrs records inspection (6))
273 (rnrs records procedural (6))
274 (rnrs records syntactic (6))
275 (rnrs sorting (6))
61bac799
AW
276 ;; See note above on exporting syntax-case.
277 (rename (rnrs syntax-case (6))
278 (syntax-case syntax-case-hack))
a2e0b126 279 (rnrs unicode (6))))