equal
deleted
inserted
replaced
192 |
192 |
193 |
193 |
194 (* IO *) |
194 (* IO *) |
195 |
195 |
196 fun read_block limit = |
196 fun read_block limit = |
197 File.input_size (if limit < 0 then chunk_size else Int.min (chunk_size, limit)); |
197 File_Stream.input_size (if limit < 0 then chunk_size else Int.min (chunk_size, limit)); |
198 |
198 |
199 fun read_stream limit stream = |
199 fun read_stream limit stream = |
200 let |
200 let |
201 fun read bytes = |
201 fun read bytes = |
202 (case read_block (limit - length bytes) stream of |
202 (case read_block (limit - length bytes) stream of |
203 "" => bytes |
203 "" => bytes |
204 | s => read (add s bytes)) |
204 | s => read (add s bytes)) |
205 in read empty end; |
205 in read empty end; |
206 |
206 |
207 fun write_stream stream bytes = |
207 fun write_stream stream bytes = |
208 File.outputs stream (contents bytes); |
208 File_Stream.outputs stream (contents bytes); |
209 |
209 |
210 fun read path = File.open_input (fn stream => read_stream ~1 stream) path; |
210 fun read path = File_Stream.open_input (fn stream => read_stream ~1 stream) path; |
211 |
211 |
212 fun write path bytes = File.open_output (fn stream => write_stream stream bytes) path; |
212 fun write path bytes = File_Stream.open_output (fn stream => write_stream stream bytes) path; |
213 |
213 |
214 |
214 |
215 (* ML pretty printing *) |
215 (* ML pretty printing *) |
216 |
216 |
217 val _ = |
217 val _ = |