Commit d3306f06 authored by Stephane Glondu's avatar Stephane Glondu

Core_datatypes -> Serializable_builtin

parent 256be0a5
......@@ -14,11 +14,11 @@
#load "lib.cma";;
let pp_print_datetime ppf x =
Format.pp_print_string ppf (Core_datatypes_j.string_of_datetime x)
Format.pp_print_string ppf (Serializable_builtin_j.string_of_datetime x)
;;
let pp_print_uuid ppf x =
Format.pp_print_string ppf (Core_datatypes_j.string_of_uuid x)
Format.pp_print_string ppf (Serializable_builtin_j.string_of_uuid x)
;;
#install_printer Z.pp_print;;
......
......@@ -30,12 +30,12 @@ let load_elections_and_votes dirname =
enforce_single_element
in
let election = Serializable_compat_j.election_of_string
Core_datatypes_j.read_number raw
Serializable_builtin_j.read_number raw
in
(assert_lwt (Uuidm.equal uuid election.e_uuid)) >>
let public_data =
data "public.json" |>
load_from_file (Serializable_compat_j.read_election_public_data Core_datatypes_j.read_number)
load_from_file (Serializable_compat_j.read_election_public_data Serializable_builtin_j.read_number)
in
let fingerprint = hashB raw in
let ballots =
......@@ -43,7 +43,7 @@ let load_elections_and_votes dirname =
if Sys.file_exists file then (
Lwt_io.lines_of_file file |>
Lwt_stream.map (fun x ->
let v = Serializable_compat_j.ballot_of_string Core_datatypes_j.read_number x in
let v = Serializable_compat_j.ballot_of_string Serializable_builtin_j.read_number x in
assert (Uuidm.equal uuid v.election_uuid);
v
)
......
......@@ -118,7 +118,7 @@ let () = Eliom_registration.String.register
(fun uuid election user () ->
return (
Serializable_compat_j.string_of_election_public_data
Core_datatypes_j.write_number
Serializable_builtin_j.write_number
election.Common.public_data,
"application/json"
)
......@@ -132,7 +132,7 @@ let () = Eliom_registration.String.register
let uuid_underscored = String.map (function '-' -> '_' | c -> c) (Uuidm.to_string uuid) in
let table = Ocsipersist.open_table ("ballots_" ^ uuid_underscored) in
lwt ballots = Ocsipersist.fold_step (fun hash v res ->
let s = Serializable_compat_j.string_of_ballot Core_datatypes_j.write_number v ^ "\n" in
let s = Serializable_compat_j.string_of_ballot Serializable_builtin_j.write_number v ^ "\n" in
return (s :: res)
) table [] in
let result = String.concat "" ballots in
......@@ -182,7 +182,7 @@ let () = Eliom_registration.Html5.register
(fun uuid election user raw_ballot ->
let result =
try
let ballot = Serializable_compat_j.ballot_of_string Core_datatypes_j.read_number raw_ballot in
let ballot = Serializable_compat_j.ballot_of_string Serializable_builtin_j.read_number raw_ballot in
let {g; p; q; y} = election.Common.election.e_public_key in
let module G = (val ElGamal.make_ff_msubgroup p q g : ElGamal.GROUP with type t = Z.t) in
let module Crypto = ElGamal.Make (G) in
......
Util
Core_datatypes_j
Serializable_builtin_j
Serializable_t
Serializable_j
Crypto
......
......@@ -2,8 +2,8 @@
(** {2 Predefined types} *)
type number <ocaml predef from="Core_datatypes"> = abstract
type uuid <ocaml predef from="Core_datatypes"> = abstract
type number <ocaml predef from="Serializable_builtin"> = abstract
type uuid <ocaml predef from="Serializable_builtin"> = abstract
(** {2 Basic cryptographic datastructures} *)
......
open Core_datatypes_t
open Serializable_builtin_t
(** {1 Serializers for type number} *)
......
open Core_datatypes_t
open Serializable_builtin_t
(** {1 Serializers for type number} *)
......
......@@ -2,10 +2,10 @@
(** {1 Core types} *)
type number <ocaml predef from="Core_datatypes"> = abstract
type uuid <ocaml predef from="Core_datatypes"> = abstract
type datetime <ocaml predef from="Core_datatypes"> = abstract
type int_or_null <ocaml predef from="Core_datatypes"> = abstract
type number <ocaml predef from="Serializable_builtin"> = abstract
type uuid <ocaml predef from="Serializable_builtin"> = abstract
type datetime <ocaml predef from="Serializable_builtin"> = abstract
type int_or_null <ocaml predef from="Serializable_builtin"> = abstract
(** {1 ElGamal keys} *)
......
Util
Core_datatypes_j
Serializable_builtin_j
Serializable_compat_j
ElGamal
Common
......
......@@ -25,8 +25,8 @@ end
module SFiniteFieldMult : SGROUP with type t = Z.t = struct
type t = Z.t
let write = Core_datatypes_j.write_number
let read = Core_datatypes_j.read_number
let write = Serializable_builtin_j.write_number
let read = Serializable_builtin_j.read_number
end
module MakeTypes (G : SGROUP) : TYPES with type elt = G.t = struct
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment