itp_server.mli 3.35 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
type node_type =
  | NRoot
  | NFile
  | NTheory
  | NTransformation
  | NGoal
62
  | NProofAttempt
63 64 65 66 67 68 69 70

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

90 91 92 93 94 95 96
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
97
  | Set_max_tasks_req of int
98
  | Get_task          of node_ID
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 -> ide_request -> 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

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

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

end

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

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

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

end