1996-11-29 08:55:09 -08:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Objective Caml *)
|
|
|
|
(* *)
|
|
|
|
(* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* Objective Caml port by John Malecki and Xavier Leroy *)
|
|
|
|
(* *)
|
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
1999-11-17 10:59:06 -08:00
|
|
|
(* en Automatique. All rights reserved. This file is distributed *)
|
|
|
|
(* under the terms of the Q Public License version 1.0. *)
|
1996-11-29 08:55:09 -08:00
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
|
|
|
(************************ Source management ****************************)
|
|
|
|
|
|
|
|
(*** Conversion function. ***)
|
|
|
|
|
2006-12-09 05:49:10 -08:00
|
|
|
val source_of_module: Lexing.position -> string -> string
|
1996-11-29 08:55:09 -08:00
|
|
|
|
|
|
|
(*** buffer cache ***)
|
|
|
|
|
|
|
|
type buffer
|
|
|
|
|
|
|
|
val buffer_max_count : int ref
|
|
|
|
|
|
|
|
val flush_buffer_list : unit -> unit
|
|
|
|
|
2006-12-09 05:49:10 -08:00
|
|
|
val get_buffer : Lexing.position -> string -> buffer
|
1996-11-29 08:55:09 -08:00
|
|
|
|
|
|
|
val buffer_content : buffer -> string
|
|
|
|
val buffer_length : buffer -> int
|
|
|
|
|
|
|
|
(*** Position conversions. ***)
|
|
|
|
|
|
|
|
(* Pair (position, line) where `position' is the position in character of *)
|
|
|
|
(* the beginning of the line (first character is 0) and `line' is its *)
|
|
|
|
(* number (first line number is 1). *)
|
|
|
|
type position = int * int
|
|
|
|
|
|
|
|
(* Position of the next linefeed after `pos'. *)
|
|
|
|
(* Position just after the buffer end if no linefeed found. *)
|
|
|
|
(* Raise `Out_of_range' if already there. *)
|
|
|
|
val next_linefeed : buffer -> int -> int
|
|
|
|
|
|
|
|
(* Go to next line. *)
|
|
|
|
val next_line : buffer -> position -> position
|
|
|
|
|
|
|
|
(* Convert a position in the buffer to a line number. *)
|
|
|
|
val line_of_pos : buffer -> int -> position
|
|
|
|
|
|
|
|
(* Convert a line number to a position. *)
|
|
|
|
val pos_of_line : buffer -> int -> position
|
|
|
|
|
|
|
|
(* Convert a coordinate (line / column) into a position. *)
|
|
|
|
(* --- The first line and column are line 1 and column 1. *)
|
|
|
|
val point_of_coord : buffer -> int -> int -> int
|
2010-01-20 08:26:46 -08:00
|
|
|
|
|
|
|
(* Return the offsets of both line start and cnum for the passed position. *)
|
|
|
|
val start_and_cnum : buffer -> Lexing.position -> (int * int)
|