src/HOL/Tools/Predicate_Compile/code_prolog.ML
changeset 51709 19b47bfac6ef
parent 51704 0b0fc7dc4ce4
child 52788 da1fdbfebd39
equal deleted inserted replaced
51708:5188a18c33b1 51709:19b47bfac6ef
   748     "writelist([(" ^ space_implode ", " vnames ^ ")|SolutionTail]) :- " ^
   748     "writelist([(" ^ space_implode ", " vnames ^ ")|SolutionTail]) :- " ^
   749     "writef('" ^ space_implode ";" (map (fn v => v ^ " = %w") vnames) ^
   749     "writef('" ^ space_implode ";" (map (fn v => v ^ " = %w") vnames) ^
   750     "\\n', [" ^ space_implode ", " vnames ^ "]), writelist(SolutionTail).\n"
   750     "\\n', [" ^ space_implode ", " vnames ^ "]), writelist(SolutionTail).\n"
   751   
   751   
   752 val swi_prolog_prelude =
   752 val swi_prolog_prelude =
   753   "#!/usr/bin/swipl -q -t main -f\n\n" ^  (* FIXME hardwired executable!? *)
       
   754   ":- use_module(library('dialect/ciao/aggregates')).\n" ^
   753   ":- use_module(library('dialect/ciao/aggregates')).\n" ^
   755   ":- style_check(-singleton).\n" ^
   754   ":- style_check(-singleton).\n" ^
   756   ":- style_check(-discontiguous).\n" ^
   755   ":- style_check(-discontiguous).\n" ^
   757   ":- style_check(-atom).\n\n" ^
   756   ":- style_check(-atom).\n\n" ^
   758   "main :- catch(eval, E, (print_message(error, E), fail)), halt.\n" ^
   757   "main :- catch(eval, E, (print_message(error, E), fail)), halt.\n" ^
   764   "eval :- once(" ^ rel ^ "(" ^ space_implode ", " (map write_term args) ^ ")),\n" ^
   763   "eval :- once(" ^ rel ^ "(" ^ space_implode ", " (map write_term args) ^ ")),\n" ^
   765   "format('" ^ space_implode ";" (map (fn v => v ^ " = ~w") vnames) ^
   764   "format('" ^ space_implode ";" (map (fn v => v ^ " = ~w") vnames) ^
   766   "\\n', [" ^ space_implode ", " vnames ^ "]).\n"
   765   "\\n', [" ^ space_implode ", " vnames ^ "]).\n"
   767 
   766 
   768 val yap_prelude =
   767 val yap_prelude =
   769   "#!/usr/bin/yap -L\n\n" ^
       
   770   ":- initialization(eval).\n"
   768   ":- initialization(eval).\n"
   771 
   769 
   772 (* system-dependent query, prelude and invocation *)
   770 (* system-dependent query, prelude and invocation *)
   773 
   771 
   774 fun query system nsols = 
   772 fun query system nsols = 
   784 
   782 
   785 fun invoke system file =
   783 fun invoke system file =
   786   let
   784   let
   787     val (env_var, cmd) =
   785     val (env_var, cmd) =
   788       (case system of
   786       (case system of
   789         SWI_PROLOG => ("ISABELLE_SWIPL", "\"$ISABELLE_SWIPL\" -f ")
   787         SWI_PROLOG => ("ISABELLE_SWIPL", "\"$ISABELLE_SWIPL\" -q -t main -f ")
   790       | YAP => ("ISABELLE_YAP", "\"$ISABELLE_YAP\" -L "))
   788       | YAP => ("ISABELLE_YAP", "\"$ISABELLE_YAP\" -L "))
   791   in
   789   in
   792     if getenv env_var = "" then
   790     if getenv env_var = "" then
   793       (warning (env_var ^ " not set; could not execute code for " ^ string_of_system system); "")
   791       (warning (env_var ^ " not set; could not execute code for " ^ string_of_system system); "")
   794     else
   792     else