diff --git a/medium_project/Makefile b/medium_project/Makefile index bcf222f..466c808 100644 --- a/medium_project/Makefile +++ b/medium_project/Makefile @@ -18,4 +18,4 @@ demo: build clean: -rm -rf _build/ - -rm ftest.native + -rm MSftest.native diff --git a/medium_project/src/MSftest.ml b/medium_project/src/MSftest.ml index 5df431c..fbba757 100644 --- a/medium_project/src/MSftest.ml +++ b/medium_project/src/MSftest.ml @@ -31,7 +31,7 @@ let () = (* Open file *) let (graph, l_id) = from_file infile in - let initGraph = g_to_float graph in + let initGraph = graph in (* Rewrite the graph that has been read. *) diff --git a/medium_project/src/MSgfile.ml b/medium_project/src/MSgfile.ml index 73862fe..8d6de19 100644 --- a/medium_project/src/MSgfile.ml +++ b/medium_project/src/MSgfile.ml @@ -38,8 +38,6 @@ let write_file path graph l_id= fprintf ff "\n%% End of reimbursements\n" ; - - close_out ff ; () @@ -51,15 +49,23 @@ let read_comment graph line l_id= (* Reads a line with a user. *) let read_user id graph l_id line = +<<<<<<< HEAD try Scanf.sscanf line "u %s" (fun user-> (init_node graph user id l_id ) +======= + try Scanf.sscanf line "u %s" (fun user -> init_node graph user id l_id ) +>>>>>>> 097a500b7df1b0d2233a4edb99973bee942814f9 with e -> Printf.printf "Cannot read node in line - %s:\n%s\n%!" (Printexc.to_string e) line ; failwith "from_file" (* Reads a line with a payement. *) -let read_payement graph line l_id= +let read_payement graph l_id line = try Scanf.sscanf line "p %s %s %f" +<<<<<<< HEAD (fun user l_user label -> ((paiement graph user (String.split_on_char ',' l_user) label, l_id) +======= + (fun user l_user label -> paiement graph user (String.split_on_char ',' l_user) label l_id) +>>>>>>> 097a500b7df1b0d2233a4edb99973bee942814f9 with e -> Printf.printf "Cannot read arc in line - %s:\n%s\n%!" (Printexc.to_string e) line ; failwith "from_file" @@ -81,10 +87,14 @@ let from_file path = (* Ignore empty lines *) if line = "" then (n, (graph, l_id)) - (* The first character of a line determines its content : n or e. *) + (* The first character of a line determines its content : u or p. *) else match line.[0] with | 'u' -> (n+1, read_user n graph l_id line) +<<<<<<< HEAD | 'p' -> (n, read_payement graph line l_id) +======= + | 'p' -> (n, read_payement graph l_id line) +>>>>>>> 097a500b7df1b0d2233a4edb99973bee942814f9 (* It should be a comment, otherwise we complain. *) | _ -> (n, read_comment graph line l_id) diff --git a/medium_project/src/MSgfile.mli b/medium_project/src/MSgfile.mli index c67744d..b69b937 100644 --- a/medium_project/src/MSgfile.mli +++ b/medium_project/src/MSgfile.mli @@ -2,9 +2,9 @@ open Graph type path = string -val from_file: path -> (string graph * (string * id) list) +val from_file: path -> (float graph * (string * id) list) -val write_file: path -> string graph -> (string * id) list-> unit +val write_file: path -> string graph -> (string * id) list -> unit val export: path -> string graph -> unit diff --git a/medium_project/src/moneySharing.mli b/medium_project/src/moneySharing.mli index af7cd4d..d7a5f8b 100644 --- a/medium_project/src/moneySharing.mli +++ b/medium_project/src/moneySharing.mli @@ -2,7 +2,7 @@ open Graph val paiement: float graph -> string -> string list -> float -> (string * id) list -> (float graph * (string * id) list) -val init_node: float graph -> string ->id -> (string * id) list-> (float graph * (string * id) list) +val init_node: float graph -> string -> id -> (string * id) list-> (float graph * (string * id) list) val get_id: string -> (string * id) list -> id