mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
Do not use stateful-error style in io.m; minor bug fixes.
library/io.m:
Make remaining I/O primitives return error codes directly to Mercury
wrapper predicates, instead of saving the error in a global variable
to be looked up separately.
Delete stateful-error predicates and global variables.
Delete unnecessary foreign exported procedures.
Add `no_error' helper function.
Add `result_code' type to indicate whether a primitive succeeded,
reach the end-of-file, or an error occurred.
Make `read_char_code' and `read_byte_val' return the result code
and error separately from the value.
Add efficient implementations of `do_read_bitmap' for C# and Java.
Add Java methods `read_pushback' and `read_non_pushback' for binary
input streams to support `do_read_bitmap'.
Use a purpose-specific type for the return value of
`read_line_as_string_2'.
Fix a bug: the C version of `read_line_as_string_2' returned -2
(null character found) instead of -1 for an I/O error.
Move Mercury value construction for `read_file_as_string' out of
foreign procs.
In C version of `read_char_code', if we hit EOF or an error in the
middle of a multi-byte sequence then stop reading, and report `errno'
or EILSEQ. The old code would try to read the rest of the multi-byte
sequence and decode it, which should fail, then report EILSEQ.
Simplify how `do_open_text' and `do_open_binary' report attempts to
open directories as streams.
Fix a bug: the C version of `read_symlink' passed the wrong buffer
size to readlink(); fortunately it would only truncate very long
symbolic link targets.
Add comments for future changes.
tests/general/read_dir_regression.exp:
Update expected error message.
This commit is contained in:
1535
library/io.m
1535
library/io.m
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
open failed: can't open directory as file
|
||||
open failed: can't open input file: Is a directory
|
||||
|
||||
Reference in New Issue
Block a user