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 () = ...@@ -43,20 +43,22 @@ let printStatus () =
print_endline (CM.queuePrettyStatus ()); print_endline (CM.queuePrettyStatus ());
printResult () 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 if n <= 0
then () then ()
else (action() ; repeat (n-1) action) else (if action() then () else repeat (n-1) action)
let doStep args = let doStep args =
let action() = let action() =
if Reasoner.reasonerFinished () if Reasoner.reasonerFinished ()
then print_endline "Reasoner already finished!" then (print_endline "Reasoner already finished!"; true)
else else
try try
Reasoner.runReasonerStep (); Reasoner.runReasonerStep ();
if (Reasoner.reasonerFinished ()) then printResult(); if (Reasoner.reasonerFinished ()) then (printResult(); true)
with CoAlgMisc.CoAlg_finished _ -> printResult() else false
with CoAlgMisc.CoAlg_finished _ -> (printResult(); true)
in in
let steps = match args with let steps = match args with
| (str::_) -> (int_of_string str) | (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