Debian Codegraph @

lib/feedback.mli

raw symbols SCIP
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 open Xml_datatype
12
13 (* Legacy-style logging messages (used to be in Pp) *)
14 type level =
15 | Debug
16 | Info
17 | Notice
18 | Warning
19 | Error
20
21
22 (** Document unique identifier for serialization *)
23 type doc_id = int
24
25 (** Rocq "semantic" infos obtained during execution *)
26 type route_id = int
27
28 val default_route : route_id
29
30 type feedback_content =
31 (* STM mandatory data (must be displayed) *)
32 | Processed
33 | Incomplete
34 | Complete
35 (* STM optional data *)
36 | ProcessingIn of string
37 | InProgress of int
38 | WorkerStatus of string * string
39 (* Generally useful metadata *)
40 | AddedAxiom
41 | GlobRef of Loc.t * string * string * string * string
42 | GlobDef of Loc.t * string * string * string
43 | FileDependency of string option * string
44 | FileLoaded of string * string
45 (* Extra metadata *)
46 | Custom of Loc.t option * string * xml
47 (* Generic messages *)
48 | Message of level * Loc.t option * Quickfix.t list * Pp.t
49
50 type feedback = {
51 doc_id : doc_id; (* The document being concerned *)
52 span_id : Stateid.t; (* The document part concerned *)
53 route : route_id; (* Extra routing info *)
54 contents : feedback_content; (* The payload *)
55 }
56
57 (** {6 Feedback sent, even asynchronously, to the user interface} *)
58
59 (* The interpreter assigns a state_id to the ast, and feedbacks happening
60 * during interpretation are attached to it.
61 *)
62
63 (** [add_feeder f] adds a feeder listiner [f], returning its id *)
64 val add_feeder : (feedback -> unit) -> int
65
66 (** [del_feeder fid] removes the feeder with id [fid] *)
67 val del_feeder : int -> unit
68
69 (** [feedback ?did ?sid ?route fb] produces feedback [fb], with
70 [route] and [did, sid] set appropiatedly, if absent, it will use
71 the defaults set by [set_id_for_feedback] *)
72 val feedback : ?did:doc_id -> ?id:Stateid.t -> ?route:route_id -> feedback_content -> unit
73
74 (** [set_id_for_feedback route id] Set the defaults for feedback *)
75 val set_id_for_feedback : ?route:route_id -> doc_id -> Stateid.t -> unit
76
77 (** {6 output functions} *)
78
79 (* Should we advertise these functions more? Should they be the ONLY
80 allowed way to output something? *)
81
82 val msg_info : ?loc:Loc.t -> Pp.t -> unit
83 (** Message that displays information, usually in verbose mode, such as [Foobar
84 is defined] *)
85
86 val msg_notice : ?loc:Loc.t -> Pp.t -> unit
87 (** Message that should be displayed, such as [Print Foo] or [Show Bar]. *)
88
89 val msg_warning : ?loc:Loc.t -> ?quickfix:Quickfix.t list -> Pp.t -> unit
90 (** Message indicating that something went wrong, but without serious
91 consequences. A list of quick fixes, in the VSCode sense, can be provided *)
92
93 val msg_debug : ?loc:Loc.t -> Pp.t -> unit
94 (** For debugging purposes *)
95
96 val console_feedback_listener : Format.formatter -> feedback -> unit
97 (** Helper for tools willing to print to the feedback system *)
98
99 val warn_no_listeners : bool ref
100 (** The library will print a warning to the console if no listener is
101 available by default; ML-clients willing to use Rocq without a
102 feedback handler should set this to false. *)