Skip to content
Snippets Groups Projects
Commit 83612ae5 authored by Hans-Peter Deifel's avatar Hans-Peter Deifel :turtle: Committed by Hans-Peter Deifel
Browse files

debugger: Stop and print result if reasoner finishes

The 'step' command takes an optional repeat count. Now it stops
stepping and prints the result if the reasoner finishes before
reaching the specified number of steps.
parent 86c2c2ee
No related branches found
No related tags found
No related merge requests found
......@@ -43,20 +43,22 @@ let printStatus () =
print_endline (CM.queuePrettyStatus ());
printResult ()
let rec repeat (n:int) (action: unit -> unit) =
(** Repeat either n times or until action returns true *)
let rec repeat (n:int) (action: unit -> bool) =
if n <= 0
then ()
else (action() ; repeat (n-1) action)
else (if action() then () else repeat (n-1) action)
let doStep args =
let action() =
if Reasoner.reasonerFinished ()
then print_endline "Reasoner already finished!"
then (print_endline "Reasoner already finished!"; true)
else
try
Reasoner.runReasonerStep ();
if (Reasoner.reasonerFinished ()) then printResult();
with CoAlgMisc.CoAlg_finished _ -> printResult()
if (Reasoner.reasonerFinished ()) then (printResult(); true)
else false
with CoAlgMisc.CoAlg_finished _ -> (printResult(); true)
in
let steps = match args with
| (str::_) -> (int_of_string str)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment