@@ -3,6 +3,7 @@ open Printf
3
3
open Scanf
4
4
open TreeAggregation
5
5
open TreeAggregationNames
6
+ open Util
6
7
7
8
let serializeName : Names.name -> string = string_of_int
8
9
@@ -16,24 +17,24 @@ let deserializeMsg : string -> coq_Msg = fun s ->
16
17
let serializeMsg : coq_Msg -> string = fun msg ->
17
18
Marshal. to_string msg []
18
19
19
- let deserializeInput (s : string ) (client_id : int ) : coq_Input option =
20
+ let deserializeInput (s : string ) (c : string ) : coq_Input option =
20
21
match s with
21
22
| "SendAggregate" -> Some SendAggregate
22
23
| "Broadcast" -> Some Broadcast
23
- | "AggregateRequest" -> Some (AggregateRequest client_id )
24
- | "LevelRequest" -> Some (LevelRequest client_id )
24
+ | "AggregateRequest" -> Some (AggregateRequest (char_list_of_string c) )
25
+ | "LevelRequest" -> Some (LevelRequest (char_list_of_string c) )
25
26
| _ ->
26
- try sscanf s " Local %d" (fun x -> Some (Local (Obj. magic x)))
27
+ try Scanf. sscanf s " Local %d" (fun x -> Some (Local (Obj. magic x)))
27
28
with _ -> None
28
29
29
30
let serializeLevelOption olv : string =
30
31
match olv with
31
32
| Some lv -> string_of_int lv
32
33
| _ -> " "
33
34
34
- let serializeOutput : coq_Output -> int * string = function
35
- | AggregateResponse (client_id , x ) -> (client_id , sprintf " AggregateResponse %d" (Obj. magic x))
36
- | LevelResponse (client_id , olv ) -> (client_id , sprintf " LevelResponse %s" (serializeLevelOption olv))
35
+ let serializeOutput : coq_Output -> string * string = function
36
+ | AggregateResponse (c , x ) -> (string_of_char_list c , sprintf " AggregateResponse %d" (Obj. magic x))
37
+ | LevelResponse (c , olv ) -> (string_of_char_list c , sprintf " LevelResponse %s" (serializeLevelOption olv))
37
38
38
39
let debugSerializeInput : coq_Input -> string = function
39
40
| SendAggregate -> " SendAggregate"
0 commit comments