diff options
author | Hans Bolinder <[email protected]> | 2013-01-08 13:37:23 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2013-01-25 12:54:27 +0100 |
commit | 788ddf07630d84085d2e6cfc803d432a4e8c8325 (patch) | |
tree | 84011f22a57956b871cd06be21d66bf3447556b5 /lib | |
parent | ec8343bec35fcb941712a22cc0b150c5d24be2df (diff) | |
download | otp-788ddf07630d84085d2e6cfc803d432a4e8c8325.tar.gz otp-788ddf07630d84085d2e6cfc803d432a4e8c8325.tar.bz2 otp-788ddf07630d84085d2e6cfc803d432a4e8c8325.zip |
[stdlib] Fix a contract bug
Also minor corrections of the docs of io(3)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/stdlib/doc/src/io.xml | 51 | ||||
-rw-r--r-- | lib/stdlib/src/io.erl | 4 | ||||
-rw-r--r-- | lib/stdlib/src/io_lib.erl | 6 | ||||
-rw-r--r-- | lib/stdlib/src/io_lib_fread.erl | 6 |
4 files changed, 52 insertions, 15 deletions
diff --git a/lib/stdlib/doc/src/io.xml b/lib/stdlib/doc/src/io.xml index e904f0f0c8..67edc013d4 100644 --- a/lib/stdlib/doc/src/io.xml +++ b/lib/stdlib/doc/src/io.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2012</year> + <year>1996</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -306,6 +306,11 @@ <item> <p>The parsing failed.</p> </item> + <tag><c>{error, <anno>ErrorDescription</anno>}</c></tag> + <item> + <p>Other (rare) error condition, for instance <c>{error, estale}</c> + if reading from an NFS file system.</p> + </item> </taglist> </desc> </func> @@ -333,6 +338,11 @@ <item> <p>The parsing failed.</p> </item> + <tag><c>{error, <anno>ErrorDescription</anno>}</c></tag> + <item> + <p>Other (rare) error condition, for instance <c>{error, estale}</c> + if reading from an NFS file system.</p> + </item> </taglist> </desc> </func> @@ -851,12 +861,21 @@ enter><input>:</input> <input>alan</input> <input>:</input> <input>joe</in </item> <tag><c>{eof, EndLocation}</c></tag> <item> - <p>End of file was encountered.</p> + <p>End of file was encountered by the tokenizer.</p> + </item> + <tag><c>eof</c></tag> + <item> + <p>End of file was encountered by the I/O-server.</p> </item> <tag><c>{error, ErrorInfo, ErrorLocation}</c></tag> <item> - <p>An error occurred.</p> + <p>An error occurred while tokenizing.</p> </item> + <tag><c>{error, <anno>ErrorDescription</anno>}</c></tag> + <item> + <p>Other (rare) error condition, for instance <c>{error, estale}</c> + if reading from an NFS file system.</p> + </item> </taglist> <p>Example:</p> <pre> @@ -913,12 +932,21 @@ enter><input>1.0er.</input> </item> <tag><c>{eof, EndLocation}</c></tag> <item> - <p>End of file was encountered.</p> + <p>End of file was encountered by the tokenizer.</p> + </item> + <tag><c>eof</c></tag> + <item> + <p>End of file was encountered by the I/O-server.</p> </item> <tag><c>{error, ErrorInfo, ErrorLocation}</c></tag> <item> - <p>An error occurred.</p> + <p>An error occurred while tokenizing or parsing.</p> </item> + <tag><c>{error, <anno>ErrorDescription</anno>}</c></tag> + <item> + <p>Other (rare) error condition, for instance <c>{error, estale}</c> + if reading from an NFS file system.</p> + </item> </taglist> <p>Example:</p> <pre> @@ -955,12 +983,21 @@ enter><input>abc("hey".</input> </item> <tag><c>{eof, EndLocation}</c></tag> <item> - <p>End of file was encountered.</p> + <p>End of file was encountered by the tokenizer.</p> + </item> + <tag><c>eof</c></tag> + <item> + <p>End of file was encountered by the I/O-server.</p> </item> <tag><c>{error, ErrorInfo, ErrorLocation}</c></tag> <item> - <p>An error occurred.</p> + <p>An error occurred while tokenizing or parsing.</p> </item> + <tag><c>{error, <anno>ErrorDescription</anno>}</c></tag> + <item> + <p>Other (rare) error condition, for instance <c>{error, estale}</c> + if reading from an NFS file system.</p> + </item> </taglist> </desc> </func> diff --git a/lib/stdlib/src/io.erl b/lib/stdlib/src/io.erl index ecf2aeb375..9b436c224c 100644 --- a/lib/stdlib/src/io.erl +++ b/lib/stdlib/src/io.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2012. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -331,7 +331,7 @@ fread(Prompt, Format) -> Prompt :: prompt(), Format :: format(), Result :: {'ok', Terms :: [term()]} - | {'error', FreadError :: io_lib:fread_error()} + | {'error', {'fread', FreadError :: io_lib:fread_error()}} | server_no_data(). fread(Io, Prompt, Format) -> diff --git a/lib/stdlib/src/io_lib.erl b/lib/stdlib/src/io_lib.erl index 5ad505f683..df5f9b8c25 100644 --- a/lib/stdlib/src/io_lib.erl +++ b/lib/stdlib/src/io_lib.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2012. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -124,7 +124,7 @@ fwrite(Format, Args) -> | {'more', RestFormat :: string(), Nchars :: non_neg_integer(), InputStack :: chars()} - | {'error', What :: fread_error()}. + | {'error', {'fread', What :: fread_error()}}. fread(Chars, Format) -> io_lib_fread:fread(Chars, Format). @@ -137,7 +137,7 @@ fread(Chars, Format) -> | {'done', Result, LeftOverChars :: string()}, Result :: {'ok', InputList :: [term()]} | 'eof' - | {'error', What :: fread_error()}. + | {'error', {'fread', What :: fread_error()}}. fread(Cont, Chars, Format) -> io_lib_fread:fread(Cont, Chars, Format). diff --git a/lib/stdlib/src/io_lib_fread.erl b/lib/stdlib/src/io_lib_fread.erl index 84d4b8bba0..92a34995b8 100644 --- a/lib/stdlib/src/io_lib_fread.erl +++ b/lib/stdlib/src/io_lib_fread.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2011. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -22,7 +22,7 @@ -export([fread/2,fread/3]). --import(lists, [reverse/1,reverse/2]). +-import(lists, [reverse/1]). -define(is_whitespace(C), ((C) =:= $\s orelse (C) =:= $\t @@ -43,7 +43,7 @@ | {'done', Result, LeftOverChars :: string()}, Result :: {'ok', InputList :: io_lib:chars()} | 'eof' - | {'error', What :: io_lib:fread_error()}. + | {'error', {'read', What :: io_lib:fread_error()}}. fread([], Chars, Format) -> %%io:format("FREAD: ~w `~s'~n", [Format,Chars]), |