Skip to content
Snippets Groups Projects
Commit c17d1884 authored by Kylian Fontaine's avatar Kylian Fontaine
Browse files

graphe png genere dans meme fichier que les .v

parent 73e25248
No related branches found
No related tags found
1 merge request!1Module
...@@ -329,7 +329,7 @@ let graph_from_edges (el : edge list)= ...@@ -329,7 +329,7 @@ let graph_from_edges (el : edge list)=
@param g [G.t] @param g [G.t]
@param name [string] png file name @param name [string] png file name
@return[unit]*) @return[unit]*)
let png_from_graph g name= let png_from_graph g name dir =
let graph = G.fold_vertex (fun v acc -> let graph = G.fold_vertex (fun v acc ->
let succs = List.map string_of_expression (G.succ g v)in let succs = List.map string_of_expression (G.succ g v)in
let v' = string_of_expression v in let v' = string_of_expression v in
...@@ -338,10 +338,10 @@ let png_from_graph g name= ...@@ -338,10 +338,10 @@ let png_from_graph g name=
acc ^ "\"" ^ v' ^ "\";\n" ^ edges acc ^ "\"" ^ v' ^ "\";\n" ^ edges
) g "" in ) g "" in
let dot = "digraph G {\nrankdir=LR;\nranksep=1;\n" ^ graph ^"\nsplines=true;\noverlap=false; "^"}" in let dot = "digraph G {\nrankdir=LR;\nranksep=1;\n" ^ graph ^"\nsplines=true;\noverlap=false; "^"}" in
let oc = open_out ("./generate/"^name^"_measure.dot") in let oc = open_out (dir^"/"^name^"_measure.dot") in
Printf.fprintf oc "%s\n" dot; Printf.fprintf oc "%s\n" dot;
close_out oc; close_out oc;
ignore (Sys.command ("dot -Tpng ./generate/"^name^"_measure.dot -o ./generate/"^ name^"_measure.png")) ignore (Sys.command ("dot -Tpng ./generate/"^name^"_measure.dot -o "^dir^"/"^ name^"_measure.png"))
(**[assign_heigth g] returns the phase, phase weight association list. The phase weight is deduced from the order (**[assign_heigth g] returns the phase, phase weight association list. The phase weight is deduced from the order
topology of the phase topology of the phase
...@@ -448,7 +448,7 @@ let string_of_expr_list expr_list = ...@@ -448,7 +448,7 @@ let string_of_expr_list expr_list =
(**[png_from_graph2 g ] renvoie l'image au format png du graphe [g] (**[png_from_graph2 g ] renvoie l'image au format png du graphe [g]
@param g de type [G2.t] graphe de liste de liste d'expression, composants fortement connexe *) @param g de type [G2.t] graphe de liste de liste d'expression, composants fortement connexe *)
let png_from_graph2 (g:G2.t) (name : string) :unit = let png_from_graph2 (g:G2.t) (name : string) (dir : string) :unit =
let graph = G2.fold_vertex (fun v acc -> let graph = G2.fold_vertex (fun v acc ->
let succs = List.map string_of_expr_list (G2.succ g v)in let succs = List.map string_of_expr_list (G2.succ g v)in
let v' = string_of_expr_list v in let v' = string_of_expr_list v in
...@@ -457,10 +457,10 @@ let png_from_graph2 (g:G2.t) (name : string) :unit = ...@@ -457,10 +457,10 @@ let png_from_graph2 (g:G2.t) (name : string) :unit =
acc ^ "\"" ^ v' ^ "\";\n" ^ edges acc ^ "\"" ^ v' ^ "\";\n" ^ edges
) g "" in ) g "" in
let dot = "digraph G {\nrankdir=LR;\nranksep=1;\n" ^ graph ^"\nsplines=true;\noverlap=false; "^"}" in let dot = "digraph G {\nrankdir=LR;\nranksep=1;\n" ^ graph ^"\nsplines=true;\noverlap=false; "^"}" in
let oc = open_out ("./generate/"^name^"_measure.dot") in let oc = open_out (dir^"/"^name^"_measure.dot") in
Printf.fprintf oc "%s\n" dot; Printf.fprintf oc "%s\n" dot;
close_out oc; close_out oc;
ignore (Sys.command ("dot -Tpng ./generate/"^name^"_measure.dot -o ./generate/"^ name^"_measure.png")) ignore (Sys.command ("dot -Tpng ./generate/"^name^"_measure.dot -o "^dir^"/"^ name^"_measure.png"))
(** [scc_graph g] retourne le graphe G2.t correspondant au graphe de composants fortement connexe du graphe [g] (** [scc_graph g] retourne le graphe G2.t correspondant au graphe de composants fortement connexe du graphe [g]
......
...@@ -514,7 +514,7 @@ let write_coq_file (gen: stmt list) (filename : string) = ...@@ -514,7 +514,7 @@ let write_coq_file (gen: stmt list) (filename : string) =
print_endline(filename^ " has been generated");; print_endline(filename^ " has been generated");;
(*
(**[generate_coq d s] generates the coq file containing the world description module, the type module and the proof module (**[generate_coq d s] generates the coq file containing the world description module, the type module and the proof module
@param description of @param description of
@param string s @param string s
...@@ -524,7 +524,7 @@ let generate_coq (Description(d,r,Measure g) : description) (name : string)= ...@@ -524,7 +524,7 @@ let generate_coq (Description(d,r,Measure g) : description) (name : string)=
then then
let gmpptype, gmpp_proof = generate_measure_per_phase g in let gmpptype, gmpp_proof = generate_measure_per_phase g in
let gdp_type, gdp_proof = generate_definition_phase g in let gdp_type, gdp_proof = generate_definition_phase g in
Ast.png_from_graph g name; Ast.png_from_graph g name ;
Ast.png_from_graph2 (Ast.scc_graph g;) (name^"_scc_graph"); Ast.png_from_graph2 (Ast.scc_graph g;) (name^"_scc_graph");
let file_exists = let file_exists =
Sys.file_exists ("./generate/"^name^".v") in Sys.file_exists ("./generate/"^name^".v") in
...@@ -540,7 +540,7 @@ let generate_coq (Description(d,r,Measure g) : description) (name : string)= ...@@ -540,7 +540,7 @@ let generate_coq (Description(d,r,Measure g) : description) (name : string)=
else else
() ()
*)
(**[generate_filename base n dir] (**[generate_filename base n dir]
@param base : string, base file name @param base : string, base file name
@param n : integer, number of file iterations @param n : integer, number of file iterations
...@@ -566,8 +566,8 @@ let generate_coq_2files (Description(d,r,Measure g) : description) (name : strin ...@@ -566,8 +566,8 @@ let generate_coq_2files (Description(d,r,Measure g) : description) (name : strin
let gdp_type, gdp_proof = generate_definition_phase g in let gdp_type, gdp_proof = generate_definition_phase g in
let name_gen = if overwrite then type_name else generate_filename type_name 1 dir in let name_gen = if overwrite then type_name else generate_filename type_name 1 dir in
if gen_graph then begin if gen_graph then begin
Ast.png_from_graph g name_gen; Ast.png_from_graph g name_gen dir;
Ast.png_from_graph2 (Ast.scc_graph g) (name_gen^"_scc_graph"); Ast.png_from_graph2 (Ast.scc_graph g) (name_gen^"_scc_graph") dir;
end; end;
let module_world_type = (generate_requires d)@Module("World",(generate_instances d)@newline::generate_robogram r d) let module_world_type = (generate_requires d)@Module("World",(generate_instances d)@newline::generate_robogram r d)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment