let output_dot_automata (states_l,trans_l) fichier =
let cout = open_out fichier in
let fmt = formatter_of_out_channel cout in
escape_newline fmt;
let one_line_comment s =
let l = String.length s in
let fill = if l >= 75 then 0 else 75 - l in
let spaces = String.make fill ' ' in
Format.fprintf fmt "@[/* %s%s*/@\n@]" s spaces
in
one_line_comment "File generated by Aorai LTL2ACSL Plug-in";
one_line_comment "";
one_line_comment "Usage of dot files '.dot' :";
one_line_comment " dot <MyFile.dot> -T<DesiredType> > <OutputFile>";
one_line_comment "";
one_line_comment " Allowed types : canon,dot,xdot,fig,gd,gd2,";
one_line_comment " gif,hpgl,imap,cmap,ismap,jpg,jpeg,mif,mp,pcl,pic,plain,";
one_line_comment " plain-ext,png,ps,ps2,svg,svgz,vrml,vtx,wbmp";
one_line_comment "";
one_line_comment " Example with postscript file :";
one_line_comment " dot property.dot -Tps > property.ps";
Format.fprintf fmt "@[<2>@\ndigraph %s {@\n@\n%a@\n%a@\n%t}@\n@]"
(Filename.chop_extension (Filename.basename fichier))
(Pretty_utils.pp_list dot_state) states_l
(Pretty_utils.pp_list dot_trans) trans_l
(fun fmt ->
if DotSeparatedLabels.get () then
(Format.fprintf fmt
"/* guards of transitions */@\ncomment=%t\"%a\"%t;@\n"
escape_newline
(Pretty_utils.pp_list ~sep:"@\n" print_trans) trans_l
normal_newline
));
normal_newline fmt;
close_out cout