summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stdlib/scanf.ml20
-rw-r--r--stdlib/scanf.mli13
2 files changed, 19 insertions, 14 deletions
diff --git a/stdlib/scanf.ml b/stdlib/scanf.ml
index 3d3d16c233..b6498a85e5 100644
--- a/stdlib/scanf.ml
+++ b/stdlib/scanf.ml
@@ -22,6 +22,8 @@ module type SCANNING = sig
type scanbuf = in_channel;;
+ type file_name = string;;
+
val stdin : in_channel;;
(* The scanning buffer reading from [Pervasives.stdin].
[stdib] is equivalent to [Scanning.from_channel Pervasives.stdin]. *)
@@ -104,15 +106,15 @@ module type SCANNING = sig
(* [Scanning.name_of_input ib] returns the name of the character
source for input buffer [ib]. *)
- val open_in : string -> scanbuf;;
- val open_in_bin : string -> scanbuf;;
- val from_file : string -> scanbuf;;
- val from_file_bin : string -> scanbuf;;
- val from_string : string -> scanbuf;;
- val from_function : (unit -> char) -> scanbuf;;
- val from_channel : Pervasives.in_channel -> scanbuf;;
+ val open_in : file_name -> in_channel;;
+ val open_in_bin : file_name -> in_channel;;
+ val from_file : file_name -> in_channel;;
+ val from_file_bin : file_name -> in_channel;;
+ val from_string : string -> in_channel;;
+ val from_function : (unit -> char) -> in_channel;;
+ val from_channel : Pervasives.in_channel -> in_channel;;
- val close_in : scanbuf -> unit;;
+ val close_in : in_channel -> unit;;
end
;;
@@ -142,6 +144,8 @@ module Scanning : SCANNING = struct
type scanbuf = in_channel;;
+ type file_name = string;;
+
let null_char = '\000';;
(* Reads a new character from input buffer. Next_char never fails,
diff --git a/stdlib/scanf.mli b/stdlib/scanf.mli
index 620b731918..c595f1d0c7 100644
--- a/stdlib/scanf.mli
+++ b/stdlib/scanf.mli
@@ -103,7 +103,8 @@ type scanbuf = in_channel;;
val stdin : in_channel;;
(** The standard input notion for the [Scanf] module.
- [Scanning.stdin] is the formatted input channel attached to [Pervasives.stdin].
+ [Scanning.stdin] is the formatted input channel attached to
+ [Pervasives.stdin].
Note: in the interactive system, when input is read from [stdin], the
newline character that triggers the evaluation is incorporated in the
@@ -272,11 +273,11 @@ val bscanf : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner;;
- [x] or [X]: reads an unsigned hexadecimal integer ([[0-9a-f]+] or [[0-9A-F]+]).
- [o]: reads an unsigned octal integer ([[0-7]+]).
- [s]: reads a string argument that spreads as much as possible, until the
- following bounding condition holds:
- - a whitespace has been found (see {!Scanf.space}),
- - a scanning indication (see scanning {!Scanf.indication}) has been
- encountered,
- - the end-of-input has been reached.
+ following bounding condition holds: {ul
+ {- a whitespace has been found (see {!Scanf.space}),}
+ {- a scanning indication (see scanning {!Scanf.indication}) has been
+ encountered,}
+ {- the end-of-input has been reached.}}
Hence, this conversion always succeeds: it returns an empty
string, if the bounding condition holds when the scan begins.
- [S]: reads a delimited string argument (delimiters and special