itp_server.mli 3.49 KB
Newer Older
Clément Fumex's avatar
Clément Fumex committed
1 2
open Call_provers

Sylvain Dailler's avatar
Sylvain Dailler committed
3 4 5
type prover = string
type transformation = string
type strategy = string
6 7

type node_ID = int
Clément Fumex's avatar
Clément Fumex committed
8 9 10
val root_node : node_ID


11 12 13 14 15 16 17 18 19 20 21
module type History_type = sig
  type history

  val create_history: unit -> history
  val print_next_command: history -> string option
  val print_prev_command: history -> string option
  val add_command: history -> string -> unit

end

module History : History_type
Clément Fumex's avatar
Clément Fumex committed
22

23
(* --------------------------- types to be expanded if needed --------------------------------- *)
Clément Fumex's avatar
Clément Fumex committed
24

25 26 27 28
(* Global information known when server process has started and that can be
   shared with the IDE through communication *)
type global_information =
    {
Clément Fumex's avatar
Clément Fumex committed
29 30 31
     provers         : prover list;
     transformations : transformation list;
     strategies      : strategy list;
32
     commands        : string list
33 34 35 36 37 38 39 40 41
     (* hidden_provers       : string list; *)
     (* session_time_limit   : int; *)
     (* session_mem_limit    : int; *)
     (* session_nb_processes : int; *)
     (* session_cntexample   : bool; *)
     (* main_dir             : string *)
    }

type message_notification =
42 43 44 45 46 47 48
  | Proof_error           of node_ID * string
  | Transf_error          of node_ID * string
  | Strat_error           of node_ID * string
  | Replay_Info           of string
  | Query_Info            of node_ID * string
  | Query_Error           of node_ID * string
  | Help                  of string
49
  (* General information *)
50 51 52
  | Information           of string
  (* Number               of task scheduled, running, etc *)
  | Task_Monitor          of int * int * int
53
  (* An error happened that could not be identified in server *)
54 55
  | Error                 of string
  | Open_File_Error       of string
Clément Fumex's avatar
Clément Fumex committed
56

57 58 59 60 61 62
type node_type =
  | NRoot
  | NFile
  | NTheory
  | NTransformation
  | NGoal
63
  | NProofAttempt
64 65 66 67 68 69 70 71

type update_info =
  | Proved of bool
  | Proof_status_change of
      Controller_itp.proof_attempt_status
      * bool   (* obsolete or not *)
      * Call_provers.resource_limit

Clément Fumex's avatar
Clément Fumex committed
72
type notification =
73
  | New_node     of node_ID * node_ID * node_type * string
74
  (* Notification of creation of new_node:
75 76 77
     New_node (new_node, parent_node, node_type, name). *)
  | Node_change  of node_ID * update_info
  (* inform that the data of the given node changed *)
Clément Fumex's avatar
Clément Fumex committed
78
  | Remove       of node_ID
79
  (* the given node was removed *)
Clément Fumex's avatar
Clément Fumex committed
80
  | Initialized  of global_information
81
  (* initial global data *)
Sylvain Dailler's avatar
Sylvain Dailler committed
82
  | Saved
83
  (* the session was saved on disk *)
Clément Fumex's avatar
Clément Fumex committed
84
  | Message      of message_notification
85
  (* an informative message, can be an error message *)
Clément Fumex's avatar
Clément Fumex committed
86
  | Dead         of string
87
  (* server exited *)
Clément Fumex's avatar
Clément Fumex committed
88
  | Task         of node_ID * string
89
  (* the node_ID's task *)
Clément Fumex's avatar
Clément Fumex committed
90

91 92 93 94 95 96 97
type ide_request =
  | Command_req       of node_ID * string
  | Prove_req         of node_ID * prover * resource_limit
  | Transform_req     of node_ID * transformation * string list
  | Strategy_req      of node_ID * strategy
  | Open_session_req  of string
  | Add_file_req      of string
Clément Fumex's avatar
Clément Fumex committed
98
  | Set_max_tasks_req of int
99
  | Get_task          of node_ID
100 101 102 103 104
  | Get_Session_Tree_req
  | Save_req
  | Reload_req
  | Replay_req
  | Exit_req
Clément Fumex's avatar
Clément Fumex committed
105

106
val print_request: Format.formatter -> ide_request -> unit
Sylvain Dailler's avatar
Sylvain Dailler committed
107 108
val print_msg: Format.formatter -> message_notification -> unit
val print_notify: Format.formatter -> notification -> unit
109

Sylvain Dailler's avatar
Sylvain Dailler committed
110
(* The server part of the protocol *)
Clément Fumex's avatar
Clément Fumex committed
111 112
module type Protocol = sig

Clément Fumex's avatar
Clément Fumex committed
113 114
  val get_requests : unit -> ide_request list
  val notify : notification -> unit
Clément Fumex's avatar
Clément Fumex committed
115 116 117

end

118
module Make (S:Controller_itp.Scheduler) (P:Protocol) : sig
Sylvain Dailler's avatar
Sylvain Dailler committed
119

Clément Fumex's avatar
Clément Fumex committed
120
  val get_configs: unit -> Whyconf.config * Whyconf.config
121 122

  (* Nothing ! *)
Sylvain Dailler's avatar
Sylvain Dailler committed
123 124

end