Project

General

Profile

« Previous | Next » 

Revision 57c96fb7

Added by LĂ©lio Brun 11 months ago

setup tests for dune

View differences:

src/compiler_stages.ml
17 17
  let destname = !Options.dest_dir ^ "/" ^ basename in
18 18
  let lusic_ext = ".lusic" in
19 19
  let header_name = destname ^ lusic_ext in
20
  let from_lusi = extension = ".lusi" in
20 21
  begin
21 22
    if (* Generating the lusic file *)
22
      extension = ".lusi" (* because input is a lusi *)
23
      || (extension = ".lus" &&
24
            not (Sys.file_exists header_name))
25
           (* or because it is a lus but not lusic exists *)
23
      (* because input is a lusi *)
24
      from_lusi
25
      (* or because it is a lus but no lusic exists *)
26
      || (extension = ".lus" && not (Sys.file_exists header_name))
27
      (* or the lusic exists but is not generated from a lusi, hence it
28
         has te be regenerated *)
26 29
      || (let lusic = Lusic.read_lusic destname lusic_ext in
27 30
          not lusic.Lusic.from_lusi)
28
         (* or the lusic exists but is not generated from a lusi, hence it
29
            has te be regenerated *)
30 31
    then
31 32
      begin
32
	Log.report ~level:1 (fun fmt -> fprintf fmt ".. generating compiled header file %s@," header_name);
33
	Lusic.write_lusic
34
          (extension = ".lusi") (* is it a lusi file ? *)
35
          (if extension = ".lusi" then prog else Lusic.extract_header dirname basename prog)
33
        Log.report ~level:1 (fun fmt -> fprintf fmt ".. generating compiled header file %s@," header_name);
34
        Lusic.write_lusic
35
          from_lusi (* is it a lusi file ? *)
36
          (if from_lusi then prog else Lusic.extract_header dirname basename prog)
36 37
          destname
37 38
          lusic_ext;
38
        let _ =
39
          match !Options.output with
40
          | "C" -> C_backend_lusic.print_lusic_to_h destname lusic_ext
41
          | _ -> ()
42
        in
43
        ()
39
        match !Options.output with
40
        | "C" -> C_backend_lusic.print_lusic_to_h destname lusic_ext
41
        | _ -> ()
44 42
      end
45 43
    else (* Lusic exists and is usable. Checking compatibility *)
46 44
      begin
47
	Log.report ~level:1 (fun fmt -> fprintf fmt ".. loading compiled header file %s@," header_name);
45
        Log.report ~level:1 (fun fmt -> fprintf fmt ".. loading compiled header file %s@," header_name);
48 46
        let lusic = Lusic.read_lusic destname lusic_ext in
49 47
        Lusic.check_obsolete lusic destname;
50
	let header = lusic.Lusic.contents in
51
	let (declared_types_env, declared_clocks_env) = Modules.get_envs_from_top_decls header in
52
	check_compatibility
53
	  (prog, computed_types_env, computed_clocks_env)
54
	  (header, declared_types_env, declared_clocks_env)
48
        let header = lusic.Lusic.contents in
49
        let (declared_types_env, declared_clocks_env) = Modules.get_envs_from_top_decls header in
50
        check_compatibility
51
          (prog, computed_types_env, computed_clocks_env)
52
          (header, declared_types_env, declared_clocks_env)
55 53
      end
56 54
  end
57 55

  

Also available in: Unified diff