src/HOL/Tools/Nitpick/kodkod.ML
changeset 35695 80b2c22f8f00
parent 35336 ef3eba82465f
child 35696 17ae461d6133
equal deleted inserted replaced
35686:abf91fba0a70 35695:80b2c22f8f00
   891                  "int_bounds: " ^
   891                  "int_bounds: " ^
   892                  commas (map int_string_for_bound int_bounds) ^ "\n"));
   892                  commas (map int_string_for_bound int_bounds) ^ "\n"));
   893          map (fn b => (out_assign b; out ";")) expr_assigns;
   893          map (fn b => (out_assign b; out ";")) expr_assigns;
   894          out "solve "; out_outmost_f formula; out ";\n")
   894          out "solve "; out_outmost_f formula; out ";\n")
   895   in
   895   in
   896     out ("// This file was generated by Isabelle (probably Nitpick)\n" ^
   896     out ("// This file was generated by Isabelle (most likely Nitpick)\n" ^
   897          "// " ^ Date.fmt "%Y-%m-%d %H:%M:%S"
   897          "// " ^ Date.fmt "%Y-%m-%d %H:%M:%S"
   898                           (Date.fromTimeLocal (Time.now ())) ^ "\n");
   898                           (Date.fromTimeLocal (Time.now ())) ^ "\n");
   899     map out_problem problems
   899     map out_problem problems
   900   end
   900   end
   901 
   901 
  1081               val (io_error, (ps, nontriv_js)) =
  1081               val (io_error, (ps, nontriv_js)) =
  1082                 read_output_file out_path
  1082                 read_output_file out_path
  1083                 ||> apfst (map (apfst reindex)) ||> apsnd (map reindex)
  1083                 ||> apfst (map (apfst reindex)) ||> apsnd (map reindex)
  1084               val js = triv_js @ nontriv_js
  1084               val js = triv_js @ nontriv_js
  1085               val first_error =
  1085               val first_error =
  1086                 File.fold_lines (fn line => fn "" => line | s => s) err_path ""
  1086                 (File.fold_lines (fn line => fn "" => line | s => s) err_path ""
  1087                 handle IO.Io _ => "" | OS.SysErr _ => ""
  1087                  handle IO.Io _ => "" | OS.SysErr _ => "")
       
  1088                 |> perhaps (try (unsuffix "\r"))
       
  1089                 |> perhaps (try (unsuffix "."))
       
  1090                 |> perhaps (try (unprefix "Error: "))
  1088             in
  1091             in
  1089               if null ps then
  1092               if null ps then
  1090                 if code = 2 then
  1093                 if code = 2 then
  1091                   TimedOut js
  1094                   TimedOut js
  1092                 else if code = 0 then
  1095                 else if code = 0 then
  1094                 else if first_error |> Substring.full
  1097                 else if first_error |> Substring.full
  1095                         |> Substring.position "NoClassDefFoundError" |> snd
  1098                         |> Substring.position "NoClassDefFoundError" |> snd
  1096                         |> Substring.isEmpty |> not then
  1099                         |> Substring.isEmpty |> not then
  1097                   NotInstalled
  1100                   NotInstalled
  1098                 else if first_error <> "" then
  1101                 else if first_error <> "" then
  1099                   Error (first_error |> perhaps (try (unsuffix "."))
  1102                   Error (first_error, js)
  1100                                      |> perhaps (try (unprefix "Error: ")), js)
       
  1101                 else if io_error then
  1103                 else if io_error then
  1102                   Error ("I/O error", js)
  1104                   Error ("I/O error", js)
  1103                 else
  1105                 else
  1104                   Error ("Unknown error", js)
  1106                   Error ("Unknown error", js)
  1105               else
  1107               else