method execution (fileName : string) (outText : Widget.text Widget.widget) : unit = (
let out_name = get_output_if fileName in
let error_if_file = (out_name^".error") in
if(Sys.file_exists out_name) then ignore(Sys.remove out_name);
if(Sys.file_exists error_if_file) then ignore(Sys.remove error_if_file);
ignore(Sys.command(hlpsl2if^" --stdout "^esc^fileName^esc^typesString^initString^rulesString^goalsString^" >"^esc^out_name^esc^" 2>"^esc^error_if_file^esc));
let txt = if(Sys.file_exists out_name) then (
let txt = readFile out_name in
(if(Sys.file_exists error_if_file)
then let (out_error, num_of_lines) = readFile_and_give_line_number error_if_file in
if(num_of_lines >2)
then ("\n----- Output error of if translator :\n\n"^out_error^(if(txt<>"") then ("\n--------------- \n"^txt) else ""))
else txt;
else txt)
)
else (if(Sys.file_exists error_if_file)
then ("\n----- Output error of if translator :\n\n"^(readFile error_if_file))
else "")
in
Text.delete outText ~start:(`Linechar(0, 0),[`Linestart]) ~stop:(`End,[]) ;
Text.insert ~index:(`End,[]) ~text:txt outText;
if(Sys.file_exists out_name) then ignore(Sys.remove out_name);
if(Sys.file_exists error_if_file) then ignore(Sys.remove error_if_file);
)