itp_server.mli 3.44 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 32
     provers         : prover list;
     transformations : transformation list;
     strategies      : strategy list;
     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 =
Clément Fumex's avatar
Clément Fumex committed
42 43
  | Proof_error  of node_ID * string
  | Transf_error of node_ID * string
Clément Fumex's avatar
Clément Fumex committed
44
  | Strat_error  of node_ID * string
45 46 47 48
  | Replay_Info  of string
  | Query_Info   of node_ID * string
  | Query_Error  of node_ID * string
  | Help         of string
49
  (* General information *)
50
  | Information  of string
51
  (* Number of task scheduled, running, etc *)
Clément Fumex's avatar
Clément Fumex committed
52
  | Task_Monitor of int * int * int
53 54
  (* An error happened that could not be identified in server *)
  | Error        of string
Clément Fumex's avatar
Clément Fumex committed
55

56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
type node_type =
  | NRoot
  | NFile
  | NTheory
  | NTransformation
  | NGoal
  | NProofAttempt (* of Call_provers.prover_answer option * bool *)

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

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

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

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

Clément Fumex's avatar
Clément Fumex committed
109
(* TODO: change to request_type * node_ID list ? *)
Clément Fumex's avatar
Clément Fumex committed
110 111
type ide_request = request_type * node_ID

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

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

end

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

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

  (* Nothing ! *)
Sylvain Dailler's avatar
Sylvain Dailler committed
125 126

end