equal
deleted
inserted
replaced
10 val start_line : int Config.T |
10 val start_line : int Config.T |
11 val end_line : int Config.T |
11 val end_line : int Config.T |
12 val setup : theory -> theory |
12 val setup : theory -> theory |
13 |
13 |
14 (*core*) |
14 (*core*) |
15 type init_action |
15 type init_action = int -> theory -> theory |
16 type done_action |
16 type done_args = {last: Toplevel.state, log: string -> unit} |
17 type run_action |
17 type done_action = int -> done_args -> unit |
18 type action |
18 type run_args = {pre: Proof.state, post: Toplevel.state option, |
|
19 timeout: Time.time, log: string -> unit, pos: Position.T} |
|
20 type run_action = int -> run_args -> unit |
|
21 type action = init_action * run_action * done_action |
19 val catch : (int -> string) -> run_action -> run_action |
22 val catch : (int -> string) -> run_action -> run_action |
20 val register : action -> theory -> theory |
23 val register : action -> theory -> theory |
21 val step_hook : Toplevel.transition -> Toplevel.state -> Toplevel.state -> |
24 val step_hook : Toplevel.transition -> Toplevel.state -> Toplevel.state -> |
22 unit |
25 unit |
23 |
26 |
48 |
51 |
49 |
52 |
50 (* Mirabelle core *) |
53 (* Mirabelle core *) |
51 |
54 |
52 type init_action = int -> theory -> theory |
55 type init_action = int -> theory -> theory |
53 type done_action = int -> {last: Toplevel.state, log: string -> unit} -> unit |
56 type done_args = {last: Toplevel.state, log: string -> unit} |
54 type run_action = int -> {pre: Proof.state, post: Toplevel.state option, |
57 type done_action = int -> done_args -> unit |
55 timeout: Time.time, log: string -> unit, pos: Position.T} -> unit |
58 type run_args = {pre: Proof.state, post: Toplevel.state option, |
|
59 timeout: Time.time, log: string -> unit, pos: Position.T} |
|
60 type run_action = int -> run_args -> unit |
56 type action = init_action * run_action * done_action |
61 type action = init_action * run_action * done_action |
57 |
62 |
58 structure Actions = TheoryDataFun |
63 structure Actions = TheoryDataFun |
59 ( |
64 ( |
60 type T = (int * run_action * done_action) list |
65 type T = (int * run_action * done_action) list |
66 |
71 |
67 |
72 |
68 fun app_with f g x = (g x; ()) |
73 fun app_with f g x = (g x; ()) |
69 handle (exn as Exn.Interrupt) => reraise exn | exn => (f exn; ()) |
74 handle (exn as Exn.Interrupt) => reraise exn | exn => (f exn; ()) |
70 |
75 |
71 fun catch tag f id (st as {log, ...}) = |
76 fun catch tag f id (st as {log, ...}: run_args) = |
72 let fun log_exn e = log (tag id ^ "exception:\n" ^ General.exnMessage e) |
77 let fun log_exn e = log (tag id ^ "exception:\n" ^ General.exnMessage e) |
73 in app_with log_exn (f id) st end |
78 in app_with log_exn (f id) st end |
74 |
79 |
75 fun register (init, run, done) thy = |
80 fun register (init, run, done) thy = |
76 let val id = length (Actions.get thy) + 1 |
81 let val id = length (Actions.get thy) + 1 |