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:
Peter Wang
2016-09-27 16:44:46 +10:00
parent c388b8aad7
commit d8c59a8d79
2 changed files with 757 additions and 780 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1 @@
open failed: can't open directory as file
open failed: can't open input file: Is a directory