blob: 1307a60a4637feef9aa65a8b86bc2e11d4cda2dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
signature STREAM = sig
type fileId = int
type fileOffset = int
type pos = fileId * fileOffset
type ppos (* pretty pos *)
type pposCache
type t
type fileInfo = fileId * string * string
val convert: t -> fileInfo
val ppos2str: ppos -> string
val getchar: t -> char option * t
(* Will throw UngetcError, if applied at the beginning of the stream.
* Can be always avoided, so is not provided in sig file *)
val ungetc: t -> t
val getPos: t -> pos
val getPosAfterCharRead: t -> pos
(* pos must come from t, see pos2pposWithFI *)
val pos2ppos: pos -> t -> ppos
(* #id pos must be equal to fileId of fileInfo,
* otherwise InvalidFileInfo is thrown *)
val pos2pposWithFI: pos -> fileInfo -> ppos
(* Assumed to be called once for given pos, so will throw Unreachable on
* second call *)
val pposWithoutCol: ppos -> ppos
val getSubstr: fileOffset -> fileOffset -> t -> string
val getFname: t -> string
val isFirstOnLine: pos -> t -> bool
(* both throw IO.Io *)
val create: string -> t
val createFromInstream: string -> TextIO.instream -> t
val pposCacheInit: fileInfo -> pposCache
val pposCacheGetId: pposCache -> fileId
val pposCacheGetLine: pposCache -> int
val pposCacheGetFname: pposCache -> string
val pposCacheAdvance: pos -> pposCache -> (int * int) * pposCache
end
|