summaryrefslogtreecommitdiff
path: root/stream.sig
blob: 98cfb65a44df2f791b69ea6a885832dcbfe507bc (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
signature STREAM = sig
  type fileId = int
  type fileOffset = int
  type pos = fileId * fileOffset
  type convPos = string * int * int option

  type filesInfo = (fileId * string * string) list

  exception EndOfStream
  exception EndOfFile

  exception LineWithoutNl

  type t

  val extractFilesInfo: t -> filesInfo

  val pos2str: convPos -> string
  val printPos: (fileId * string * string) list -> pos -> unit

  val getchar: t -> char * t
  val ungetc: t -> t
  val readline: t -> string * t

  val getOffset: t -> fileOffset
  val getPos: t -> pos
  val getPosAfterCharRead: t -> pos
  val getPposFromPos: pos -> t -> convPos

  val getSubstr: fileOffset -> fileOffset -> t -> string
  val isFirstOnLine: pos -> t -> bool

  val advanceToNewFile: t -> t

  val streamInit: string -> t
end