| 1 | (************************************************************************) |
| 2 | (* * The Rocq Prover / The Rocq Development Team *) |
| 3 | (* v * Copyright INRIA, CNRS and contributors *) |
| 4 | (* <O___,, * (see version control and CREDITS file for authors & dates) *) |
| 5 | (* \VV/ **************************************************************) |
| 6 | (* // * This file is distributed under the terms of the *) |
| 7 | (* * GNU Lesser General Public License Version 2.1 *) |
| 8 | (* * (see LICENSE file for the text of the license) *) |
| 9 | (************************************************************************) |
| 10 | |
| 11 | (** Partially interpreted control flags. *) |
| 12 | type 'state control_entry |
| 13 | |
| 14 | type 'state control_entries = 'state control_entry list |
| 15 | |
| 16 | (** Translate from syntax and add default timeout. *) |
| 17 | val from_syntax : Vernacexpr.control_flag list -> unit control_entries |
| 18 | |
| 19 | type ('st0,'st) with_local_state = { with_local_state : 'a. 'st0 -> (unit -> 'a) -> 'st * 'a } |
| 20 | (** [with_local_state state0 f] should run [f] with [state0] installed, |
| 21 | capture the state produced by running [f] and revert the global state afterwards. |
| 22 | *) |
| 23 | |
| 24 | val trivial_state : (unit,unit) with_local_state |
| 25 | |
| 26 | (** [under_control ~loc ~with_local_state control ~noop f] |
| 27 | runs [f ()] in the context given by the [control]. |
| 28 | |
| 29 | If the [control] cause execution to end with no more work to be |
| 30 | done and no error (eg [Fail] when [f] raised an exception) then |
| 31 | [noop] is returned. |
| 32 | *) |
| 33 | val under_control : loc:Loc.t option -> |
| 34 | with_local_state:('state0,'state) with_local_state -> |
| 35 | 'state0 control_entries -> |
| 36 | noop:'b -> |
| 37 | (unit -> 'b) -> |
| 38 | 'state control_entries * 'b |
| 39 | |
| 40 | (** Print any final messages (eg from [Time]) and raise final |
| 41 | exceptions (eg from [Fail] when the command did not fail). The |
| 42 | returned boolean tells if we should be noop ([Fail] where the |
| 43 | command failed or [Succeed] where it succeeded). |
| 44 | *) |
| 45 | val after_last_phase : loc:Loc.t option -> _ control_entries -> bool |
| 46 | |
| 47 | (** Exposed so that waterproof can change the error message. *) |
| 48 | exception CmdTimeout |