src/Pure/tctical.ML
changeset 5956 ab4d13e9e77a
parent 5906 1f58694fc3e2
child 5957 9c0c69ab7d02
equal deleted inserted replaced
5955:6727d29d164f 5956:ab4d13e9e77a
   196     (fn st => 
   196     (fn st => 
   197      (print_goals (!goals_limit) st; Seq.single st));
   197      (print_goals (!goals_limit) st; Seq.single st));
   198 
   198 
   199 (*Pause until a line is typed -- if non-empty then fail. *)
   199 (*Pause until a line is typed -- if non-empty then fail. *)
   200 fun pause_tac st =  
   200 fun pause_tac st =  
   201   (prs"** Press RETURN to continue: ";
   201   (writeln "** Press RETURN to continue: ";
   202    if TextIO.inputLine TextIO.stdIn = "\n" then Seq.single st
   202    if TextIO.inputLine TextIO.stdIn = "\n" then Seq.single st
   203    else (prs"Goodbye\n";  Seq.empty));
   203    else (writeln "Goodbye";  Seq.empty));
   204 
   204 
   205 exception TRACE_EXIT of thm
   205 exception TRACE_EXIT of thm
   206 and TRACE_QUIT;
   206 and TRACE_QUIT;
   207 
   207 
   208 (*Tracing flags*)
   208 (*Tracing flags*)
   214    case TextIO.inputLine(TextIO.stdIn) of
   214    case TextIO.inputLine(TextIO.stdIn) of
   215        "\n" => tac st
   215        "\n" => tac st
   216      | "f\n" => Seq.empty
   216      | "f\n" => Seq.empty
   217      | "o\n" => (flag:=false;  tac st)
   217      | "o\n" => (flag:=false;  tac st)
   218      | "s\n" => (suppress_tracing:=true;  tac st)
   218      | "s\n" => (suppress_tracing:=true;  tac st)
   219      | "x\n" => (prs"Exiting now\n";  raise (TRACE_EXIT st))
   219      | "x\n" => (writeln "Exiting now";  raise (TRACE_EXIT st))
   220      | "quit\n" => raise TRACE_QUIT
   220      | "quit\n" => raise TRACE_QUIT
   221      | _     => (prs
   221      | _     => (writeln
   222 "Type RETURN to continue or...\n\
   222 "Type RETURN to continue or...\n\
   223 \     f    - to fail here\n\
   223 \     f    - to fail here\n\
   224 \     o    - to switch tracing off\n\
   224 \     o    - to switch tracing off\n\
   225 \     s    - to suppress tracing until next entry to a tactical\n\
   225 \     s    - to suppress tracing until next entry to a tactical\n\
   226 \     x    - to exit at this point\n\
   226 \     x    - to exit at this point\n\
   230 
   230 
   231 (*Extract from a tactic, a thm->thm seq function that handles tracing*)
   231 (*Extract from a tactic, a thm->thm seq function that handles tracing*)
   232 fun tracify flag tac st =
   232 fun tracify flag tac st =
   233   if !flag andalso not (!suppress_tracing)
   233   if !flag andalso not (!suppress_tracing)
   234            then (print_goals (!goals_limit) st;
   234            then (print_goals (!goals_limit) st;
   235                  prs"** Press RETURN to continue: ";
   235                  writeln "** Press RETURN to continue: ";
   236                  exec_trace_command flag (tac,st))
   236                  exec_trace_command flag (tac,st))
   237   else tac st;
   237   else tac st;
   238 
   238 
   239 (*Create a tactic whose outcome is given by seqf, handling TRACE_EXIT*)
   239 (*Create a tactic whose outcome is given by seqf, handling TRACE_EXIT*)
   240 fun traced_tac seqf st = 
   240 fun traced_tac seqf st =