Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
057b8d9f
Commit
057b8d9f
authored
Sep 11, 2014
by
MARCHE Claude
Browse files
[run strategy] allow the user to provide callbacks
parent
853deb85
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/session/session_scheduler.ml
View file @
057b8d9f
...
...
@@ -926,10 +926,10 @@ let convert_unknown_prover =
open
Strategy
let
rec
exec_strategy
es
sched
pc
strat
g
=
let
rec
exec_strategy
~
todo
es
sched
pc
strat
g
=
if
pc
<
0
||
pc
>=
Array
.
length
strat
then
(* halt the strategy *)
()
Todo
.
_done
todo
()
else
match
Array
.
get
strat
pc
with
|
Icall_prover
(
p
,
timelimit
,
memlimit
)
->
...
...
@@ -940,10 +940,10 @@ let convert_unknown_prover =
()
|
Done
{
Call_provers
.
pr_answer
=
Call_provers
.
Valid
}
->
(* proof succeeded, nothing more to do *)
()
Todo
.
_done
todo
()
|
Interrupted
|
InternalFailure
_
|
Done
_
->
(* proof did not succeed, goto to next step *)
let
callback
()
=
exec_strategy
es
sched
(
pc
+
1
)
strat
g
in
let
callback
()
=
exec_strategy
~
todo
es
sched
(
pc
+
1
)
strat
g
in
schedule_delayed_action
sched
callback
|
Unedited
|
JustEdited
->
(* should not happen *)
...
...
@@ -954,25 +954,34 @@ let convert_unknown_prover =
let
callback
ntr
=
match
ntr
with
|
None
->
(* transformation failed *)
let
callback
()
=
exec_strategy
es
sched
(
pc
+
1
)
strat
g
in
let
callback
()
=
exec_strategy
~
todo
es
sched
(
pc
+
1
)
strat
g
in
schedule_delayed_action
sched
callback
|
Some
tr
->
List
.
iter
(
fun
g
->
Todo
.
start
todo
;
let
callback
()
=
exec_strategy
es
sched
pcsuccess
strat
g
exec_strategy
~
todo
es
sched
pcsuccess
strat
g
in
schedule_delayed_action
sched
callback
)
tr
.
transf_goals
tr
.
transf_goals
;
Todo
.
_done
todo
()
in
transform_goal
es
sched
~
callback
trname
g
|
Igoto
pc
->
exec_strategy
es
sched
pc
strat
g
exec_strategy
~
todo
es
sched
pc
strat
g
let
run_strategy_on_goal
es
sched
strat
g
=
let
callback
()
=
exec_strategy
es
sched
0
strat
g
in
let
run_strategy_on_goal
?
(
intermediate_callback
=
fun
()
->
()
)
?
(
final_callback
=
fun
()
->
()
)
es
sched
strat
g
=
let
todo
=
Todo
.
create
()
(
fun
()
->
intermediate_callback
)
final_callback
in
Todo
.
start
todo
;
let
callback
()
=
exec_strategy
~
todo
es
sched
0
strat
g
in
schedule_delayed_action
sched
callback
...
...
src/session/session_scheduler.mli
View file @
057b8d9f
...
...
@@ -296,6 +296,8 @@ module Make(O: OBSERVER) : sig
(** Same as {!Session_tools.convert_unknown_prover} *)
val
run_strategy_on_goal
:
?
intermediate_callback
:
(
unit
->
unit
)
->
?
final_callback
:
(
unit
->
unit
)
->
O
.
key
Session
.
env_session
->
t
->
Strategy
.
t
->
O
.
key
Session
.
goal
->
unit
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment