let init_file_names () =
  (* Intermediate functions for error display or fresh name of file generation *)
  let err= ref false in
  let dispErr mesg f =
    Ltl_to_acsl_option.error "Error. File '%s' %s.\n" f mesg;
    err:=true
  in
  let freshname pre suf =
    let rec fn p s n =
      if not (Sys.file_exists (p^(string_of_int n)^s)) then (p^(string_of_int n)^s)
      else fn p s (n+1)
    in
    if not (Sys.file_exists (pre^suf)) then pre^suf
    else fn pre suf 0
  in

  (* c_file name is given and has to point out a valid file. *)
  c_file := List.hd (Parameters.Files.get ());
  if (!c_file=""then dispErr ": invalid C file name" !c_file;
  if (not (Sys.file_exists !c_file)) then dispErr "not found" !c_file;

  (* The output C file has to be a valid file name if it is used. *)
  output_c_file := (Ltl_to_acsl_option.Output_C_File.get ()) ;
  if (!output_c_file=""then output_c_file:=freshname ((Filename.chop_extension !c_file)^"_annot"".c";
(*   else if Sys.file_exists !output_c_file then dispErr "already exists" !output_c_file; *)

  if Ltl_to_acsl_option.Dot.get () then
    dot_file:=freshname (Filename.chop_extension !c_file) ".dot";

  if Ltl_to_acsl_option.Ya.get () = "" then
    if Ltl_to_acsl_option.Buchi.get () = "" then
      begin
        (* ltl_file name is given and has to point out a valid file. *)
        ltl_file := Ltl_to_acsl_option.Ltl_File.get ();
        if (!ltl_file=""then dispErr ": invalid LTL file name" !ltl_file;
        if (not (Sys.file_exists !ltl_file)) then dispErr "not found" !ltl_file;
        
        (* The LTL file is always used. *)
        (* The promela file can be given or not. *)
        if Ltl_to_acsl_option.To_Buchi.get () <> "" then
          begin
            ltl_tmp_file:=
              freshname
                (Filename.chop_extension
                   (Ltl_to_acsl_option.promela_file ())) ".ltl";
            promela_file:= Ltl_to_acsl_option.promela_file ();
              toBeRemoved:=(!ltl_tmp_file)::!toBeRemoved
          end
        else
          begin
            ltl_tmp_file:=Filename.temp_file (Filename.basename !c_file) ".ltl";
            promela_file:=(freshname (Filename.chop_extension !ltl_tmp_file) ".promela");
            
            toBeRemoved:=(!promela_file)::!toBeRemoved;
              toBeRemoved:=(!ltl_tmp_file)::!toBeRemoved
          end
      end
    else
      begin
        if Ltl_to_acsl_option.To_Buchi.get () <> "" &&
          Ltl_to_acsl_option.Ltl_File.get () <> ""
        then begin
          Ltl_to_acsl_option.error "Error. '-buchi' option is incompatible with '-to-buchi' and '-ltl' options.";
          err:=true
        end;
        
        (* The promela file is used only if the process does not terminate after LTL generation. *)
        promela_file := Ltl_to_acsl_option.promela_file ();
      end
  else
    begin
      ya_file := Ltl_to_acsl_option.Ya.get ();
      if (!ya_file=""then dispErr ": invalid Ya file name" !ya_file;
      if (not (Sys.file_exists !ya_file)) then dispErr "not found" !ya_file
    end;


  if Globals.has_entry_point () then begin
    let ep,_ =Globals.entry_point () in
    root := Kernel_function.get_name ep
  end else begin
    Ltl_to_acsl_option.abort
      "The file '%s' does not have any entry point. Generation stopped" !c_file;

  end;
  display_status ();
  !err