From 229d0d8ca88bc344bed89e46541b325c1d267996 Mon Sep 17 00:00:00 2001
From: Hans Bolinder
Date: Fri, 6 May 2011 15:58:09 +0200
Subject: r Use Erlang specs and types for documentation
---
lib/stdlib/doc/src/io_lib.xml | 179 ++++++++++++++++--------------------------
1 file changed, 66 insertions(+), 113 deletions(-)
(limited to 'lib/stdlib/doc/src/io_lib.xml')
diff --git a/lib/stdlib/doc/src/io_lib.xml b/lib/stdlib/doc/src/io_lib.xml
index 399f968c5f..506c1792f1 100644
--- a/lib/stdlib/doc/src/io_lib.xml
+++ b/lib/stdlib/doc/src/io_lib.xml
@@ -4,7 +4,7 @@
- 19962009
+ 19962011
Ericsson AB. All Rights Reserved.
@@ -38,14 +38,22 @@
flattening deep lists.
-
- DATA TYPES
-
-chars() = [char() | chars()]
-
+
+
+
+
+
+
+ A continuation as returned by fread/3.
+
+
+
+
+
+
- nl() -> chars()
+
Write a newline
Returns a character list which represents a new line
@@ -53,16 +61,12 @@ chars() = [char() | chars()]
- write(Term) ->
- write(Term, Depth) -> chars()
+
+
Write a term
-
- Term = term()
- Depth = int()
-
- Returns a character list which represents Term. The
- Depth (-1) argument controls the depth of the
+
Returns a character list which represents Term. The
+ Depth (-1) argument controls the depth of the
structures written. When the specified depth is reached,
everything below this level is replaced by "...". For
example:
@@ -74,36 +78,26 @@ chars() = [char() | chars()]
- print(Term) ->
- print(Term, Column, LineLength, Depth) -> chars()
+
+
Pretty print a term
-
- Term = term()
- Column = LineLenght = Depth = int()
-
Also returns a list of characters which represents
- Term, but breaks representations which are longer than
+ Term, but breaks representations which are longer than
one line into many lines and indents each line sensibly. It
also tries to detect and output lists of printable characters
- as strings. Column is the starting column (1),
- LineLength the maximum line length (80), and
- Depth (-1) the maximum print depth.
+ as strings. Column is the starting column (1),
+ LineLength the maximum line length (80), and
+ Depth (-1) the maximum print depth.
- fwrite(Format, Data) ->
- format(Format, Data) -> chars() | UnicodeList
+
+
Write formatted output
-
- Format = atom() | string() | binary()
- Data = [term()]
- UnicodeList = [Unicode]
- Unicode = int() representing valid unicode codepoint
-
- Returns a character list which represents Data
- formatted in accordance with Format. See
+
Returns a character list which represents Data
+ formatted in accordance with Format. See
io:fwrite/1,2,3 for a detailed
description of the available formatting options. A fault is
generated if there is an error in the format string or
@@ -119,42 +113,32 @@ chars() = [char() | chars()]
- fread(Format, String) -> Result
+
Read formatted input
-
- Format = String = string()
- Result = {ok, InputList, LeftOverChars} | {more, RestFormat, Nchars, InputStack} | {error, What}
- InputList = chars()
- LeftOverChars = string()
- RestFormat = string()
- Nchars = int()
- InputStack = chars()
- What = term()
-
- Tries to read String in accordance with the control
- sequences in Format. See
+
Tries to read String in accordance with the control
+ sequences in Format. See
io:fread/3 for a detailed
description of the available formatting options. It is
- assumed that String contains whole lines. It returns:
+ assumed that String contains whole lines. It returns:
- {ok, InputList, LeftOverChars}
+ {ok, InputList, LeftOverChars}
-
-
The string was read. InputList is the list of
+
The string was read. InputList is the list of
successfully matched and read items, and
- LeftOverChars are the input characters not used.
+ LeftOverChars are the input characters not used.
- {more, RestFormat, Nchars, InputStack}
+ {more, RestFormat, Nchars, InputStack}
-
The string was read, but more input is needed in order
- to complete the original format string. RestFormat
- is the remaining format string, NChars the number
- of characters scanned, and InputStack is the
+ to complete the original format string. RestFormat
+ is the remaining format string, Nchars the number
+ of characters scanned, and InputStack is the
reversed list of inputs matched up to that point.
- {error, What}
+ {error, What}
-
-
The read operation failed and the parameter What
+
The read operation failed and the parameter What
gives a hint about the error.
@@ -165,17 +149,8 @@ chars() = [char() | chars()]
- fread(Continuation, String, Format) -> Return
+
Re-entrant formatted reader
-
- Continuation = see below
- String = Format = string()
- Return = {done, Result, LeftOverChars} | {more, Continuation}
- Result = {ok, InputList} | eof | {error, What}
- InputList = chars()
- What = term()()
- LeftOverChars = string()
-
This is the re-entrant formatted reader. The continuation of
the first call to the functions must be []. Refer to
@@ -184,114 +159,92 @@ chars() = [char() | chars()]
re-entrant input scheme works.
The function returns:
- {done, Result, LeftOverChars}
+ {done, Result, LeftOverChars}
-
The input is complete. The result is one of the
following:
- {ok, InputList}
+ {ok, InputList}
-
-
The string was read. InputList is the list of
+
The string was read. InputList is the list of
successfully matched and read items, and
- LeftOverChars are the remaining characters.
+ LeftOverChars are the remaining characters.
eof
-
End of file has been encountered.
- LeftOverChars are the input characters not
+ LeftOverChars are the input characters not
used.
- {error, What}
+ {error, What}
-
-
An error occurred and the parameter What gives
+
An error occurred and the parameter What gives
a hint about the error.
- {more, Continuation}
+ {more, Continuation}
-
More data is required to build a term.
- Continuation must be passed to fread/3,
+ Continuation must be passed to fread/3,
when more data becomes available.
- write_atom(Atom) -> chars()
+
Write an atom
-
- Atom = atom()
-
Returns the list of characters needed to print the atom
- Atom.
+ Atom.
- write_string(String) -> chars()
+
Write a string
-
- String = string()
-
- Returns the list of characters needed to print String
+
Returns the list of characters needed to print String
as a string.
- write_char(Integer) -> chars()
+
Write a character
-
- Integer = int()
-
Returns the list of characters needed to print a character
constant in the ISO-latin-1 character set.
- indentation(String, StartIndent) -> int()
+
Indentation after printing string
-
- String = string()
- StartIndent = int()
-
- Returns the indentation if String has been printed,
- starting at StartIndent.
+ Returns the indentation if String has been printed,
+ starting at StartIndent.
- char_list(Term) -> bool()
+
Test for a list of characters
-
- Term = term()
-
- Returns true if Term is a flat list of
+
Returns true if Term is a flat list of
characters in the ISO-latin-1 range, otherwise it returns false.
- deep_char_list(Term) -> bool()
+
Test for a deep list of characters
-
- Term = term()
-
- Returns true if Term is a, possibly deep, list
+
Returns true if Term is a, possibly deep, list
of characters in the ISO-latin-1 range, otherwise it returns false.
- printable_list(Term) -> bool()
+
Test for a list of printable ISO-latin-1 characters
-
- Term = term()
-
- Returns true if Term is a flat list of
+
Returns true if Term is a flat list of
printable ISO-latin-1 characters, otherwise it returns false.
--
cgit v1.2.3