Skip to content
Snippets Groups Projects
global.ml 998 B
Newer Older
(** Time-stamp: <modified the 14/08/2008 (at 15:31) by Erwan Jahier> *)
Erwan Jahier's avatar
Erwan Jahier committed

Erwan Jahier's avatar
Erwan Jahier committed

    It is quite ugly, but all this kind of uglyness is here and nowhere else
*)
Erwan Jahier's avatar
Erwan Jahier committed


(* to compute line/col *)
let line_num = ref 1
let line_start_pos = ref 0
let (outfile:string ref) = ref ""
let (infiles:string list ref) = ref []
let current_file = ref ""
let main_node = ref ""
let compile_all_items = ref false
let run_unit_test = ref false
let one_op_per_equation = ref true
let oc = ref Pervasives.stdout


(* those functions are here as they modify some global vars *)

let add_infile file_name =
  infiles := !infiles@[file_name]


let lexbuf_of_file_name file = 
  let inchannel = 
    Verbose.print_string ~level:1 
(*       ("Opening file " ^ (Filename.concat (Sys.getcwd ()) file) ^ "\n"); *)
      ("Opening file " ^ (file) ^ "\n");
    open_in file 
  in
    line_num := 1;
    line_start_pos := 0;
    current_file := file;
    Lexing.from_channel inchannel