1 (***********************************************************************)
5 (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *)
6 (* Objective Caml port by John Malecki and Xavier Leroy *)
8 (* Copyright 1996 Institut National de Recherche en Informatique et *)
9 (* en Automatique. All rights reserved. This file is distributed *)
10 (* under the terms of the Q Public License version 1.0. *)
12 (***********************************************************************)
14 (* $Id: source.mli 9299 2009-06-17 08:15:39Z xclerc $ *)
16 (************************ Source management ****************************)
18 (*** Conversion function. ***)
20 val source_of_module: Lexing.position -> string -> string
22 (*** buffer cache ***)
26 val buffer_max_count : int ref
28 val flush_buffer_list : unit -> unit
30 val get_buffer : Lexing.position -> string -> buffer
32 val buffer_content : buffer -> string
33 val buffer_length : buffer -> int
35 (*** Position conversions. ***)
37 (* Pair (position, line) where `position' is the position in character of *)
38 (* the beginning of the line (first character is 0) and `line' is its *)
39 (* number (first line number is 1). *)
40 type position = int * int
42 (* Position of the next linefeed after `pos'. *)
43 (* Position just after the buffer end if no linefeed found. *)
44 (* Raise `Out_of_range' if already there. *)
45 val next_linefeed : buffer -> int -> int
47 (* Go to next line. *)
48 val next_line : buffer -> position -> position
50 (* Convert a position in the buffer to a line number. *)
51 val line_of_pos : buffer -> int -> position
53 (* Convert a line number to a position. *)
54 val pos_of_line : buffer -> int -> position
56 (* Convert a coordinate (line / column) into a position. *)
57 (* --- The first line and column are line 1 and column 1. *)
58 val point_of_coord : buffer -> int -> int -> int
60 (* Return the offsets of both line start and cnum for the passed position. *)
61 val start_and_cnum : buffer -> Lexing.position -> (int * int)