diff --git a/atd.opam b/atd.opam index a1e368d..c2bc105 100644 --- a/atd.opam +++ b/atd.opam @@ -27,7 +27,7 @@ license: "MIT" homepage: "https://github.com/ahrefs/atd" bug-reports: "https://github.com/ahrefs/atd/issues" depends: [ - "ocaml" {>= "4.02"} + "ocaml" {>= "4.03"} "dune" {>= "1.11"} "menhir" "easy-format" diff --git a/atd/src/import.ml b/atd/src/import.ml index 11759e4..da85e84 100644 --- a/atd/src/import.ml +++ b/atd/src/import.ml @@ -1,17 +1,3 @@ -module String = struct - [@@@ocaml.warning "-3-32"] - let lowercase_ascii = StringLabels.lowercase - let uppercase_ascii = StringLabels.uppercase - let capitalize_ascii = StringLabels.capitalize - include String -end - -module Char = struct - [@@@ocaml.warning "-3-32"] - let uppercase_ascii = Char.uppercase - include Char -end - module List = struct include List diff --git a/atdgen-codec-runtime.opam b/atdgen-codec-runtime.opam index 6ae6bbb..99b5ae3 100644 --- a/atdgen-codec-runtime.opam +++ b/atdgen-codec-runtime.opam @@ -26,7 +26,7 @@ homepage: "https://github.com/ahrefs/atd" bug-reports: "https://github.com/ahrefs/atd/issues" depends: [ "dune" {>= "1.11"} - "ocaml" {>= "4.02"} + "ocaml" {>= "4.03"} "odoc" {with-doc} ] dev-repo: "git+https://github.com/ahrefs/atd.git" diff --git a/atdgen-cppo/dune b/atdgen-cppo/dune index 7d89c3a..4b4062d 100644 --- a/atdgen-cppo/dune +++ b/atdgen-cppo/dune @@ -1,4 +1,4 @@ (install (section bin) - (package atdgen) + (package atdgen-www) (files atdgen-cppo cppo-json)) diff --git a/atdgen-runtime/src/dune b/atdgen-runtime/src/dune index d6d09f2..54e5f24 100644 --- a/atdgen-runtime/src/dune +++ b/atdgen-runtime/src/dune @@ -1,4 +1,4 @@ (library - (name atdgen_runtime) - (public_name atdgen-runtime) + (name atdgen_www_runtime) + (public_name atdgen-www-runtime) (libraries biniou yojson)) diff --git a/atdgen-runtime/src/json_adapter.mli b/atdgen-runtime/src/json_adapter.mli index 59990ec..0104119 100644 --- a/atdgen-runtime/src/json_adapter.mli +++ b/atdgen-runtime/src/json_adapter.mli @@ -8,9 +8,9 @@ (** Module signature required of any json adapter. For example, an ATD annotation [ +] type user = { id: string; @@ -102,7 +102,7 @@ end type obj = [ | User of user | ... -] +] type user = { id: string; @@ -169,7 +169,7 @@ type payload = [ ]} and the module [My_adapter] defined as follows: {[ -module My_adapter = Atdgen_runtime.Json_adapter.Type_and_value_fields.Make( +module My_adapter = Atdgen_www_runtime.Json_adapter.Type_and_value_fields.Make( struct let type_field_name = "type" let value_field_name = "payload" diff --git a/atdgen-runtime/src/oj_run.ml b/atdgen-runtime/src/oj_run.ml index f5c1217..ef164e7 100644 --- a/atdgen-runtime/src/oj_run.ml +++ b/atdgen-runtime/src/oj_run.ml @@ -4,7 +4,7 @@ open Printf -type 'a write = Bi_outbuf.t -> 'a -> unit +type 'a write = Buffer.t -> 'a -> unit exception Error of string @@ -47,65 +47,67 @@ let array_iter f sep x a = ) let write_comma ob = - Bi_outbuf.add_char ob ',' + Buffer.add_char ob ',' let write_list write_item ob l = - Bi_outbuf.add_char ob '['; + Buffer.add_char ob '['; list_iter write_item write_comma ob l; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' let write_array write_item ob a = - Bi_outbuf.add_char ob '['; + Buffer.add_char ob '['; array_iter write_item write_comma ob a; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' let write_assoc_list write_key write_item ob l = - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; list_iter ( fun ob (k, v) -> write_key ob k; - Bi_outbuf.add_char ob ':'; + Buffer.add_char ob ':'; write_item ob v ) write_comma ob l; - Bi_outbuf.add_char ob '}' + Buffer.add_char ob '}' let write_assoc_array write_key write_item ob l = - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; array_iter ( fun ob (k, v) -> write_key ob k; - Bi_outbuf.add_char ob ':'; + Buffer.add_char ob ':'; write_item ob v ) write_comma ob l; - Bi_outbuf.add_char ob '}' + Buffer.add_char ob '}' let write_option write_item ob = function - None -> Bi_outbuf.add_string ob "<\"None\">" + None -> Buffer.add_string ob "<\"None\">" | Some x -> - Bi_outbuf.add_string ob "<\"Some\":"; + Buffer.add_string ob "<\"Some\":"; write_item ob x; - Bi_outbuf.add_string ob ">" + Buffer.add_string ob ">" let write_std_option write_item ob = function - None -> Bi_outbuf.add_string ob "\"None\"" + None -> Buffer.add_string ob "\"None\"" | Some x -> - Bi_outbuf.add_string ob "[\"Some\","; + Buffer.add_string ob "[\"Some\","; write_item ob x; - Bi_outbuf.add_string ob "]" + Buffer.add_string ob "]" let write_nullable write_item ob = function - None -> Bi_outbuf.add_string ob "null" + None -> Buffer.add_string ob "null" | Some x -> write_item ob x let write_int8 ob x = Yojson.Safe.write_int ob (int_of_char x) let write_int32 ob x = - Bi_outbuf.add_string ob (Int32.to_string x) + Buffer.add_string ob (Int32.to_string x) let write_int64 ob x = - Bi_outbuf.add_string ob (Int64.to_string x) + Buffer.add_char ob '"'; + Buffer.add_string ob (Int64.to_string x); + Buffer.add_char ob '"' let min_float = float min_int let max_float = float max_int @@ -118,7 +120,7 @@ let write_float_as_int ob x = match classify_float x with FP_normal | FP_subnormal - | FP_zero -> Bi_outbuf.add_string ob (Printf.sprintf "%.0f" x) + | FP_zero -> Buffer.add_string ob (Printf.sprintf "%.0f" x) | FP_infinite -> error "Cannot convert inf or -inf into a JSON int" | FP_nan -> error "Cannot convert NaN into a JSON int" @@ -229,12 +231,12 @@ let read_with_adapter normalize reader p lb = reader p lb' let write_with_adapter restore writer ob x = - let ob_tmp = Bi_outbuf.create 1024 in + let ob_tmp = Buffer.create 1024 in writer ob_tmp x; - let s_tmp = Bi_outbuf.contents ob_tmp in + let s_tmp = Buffer.contents ob_tmp in let ast = Yojson.Safe.from_string s_tmp in let ast' = restore ast in - Yojson.Safe.to_outbuf ob ast' + Yojson.Safe.to_buffer ob ast' (* We want an identity function that is not inlined *) type identity_t = { mutable _identity : 'a. 'a -> 'a } diff --git a/atdgen-runtime/src/oj_run.mli b/atdgen-runtime/src/oj_run.mli index a9bb5ac..d7d32da 100644 --- a/atdgen-runtime/src/oj_run.mli +++ b/atdgen-runtime/src/oj_run.mli @@ -2,7 +2,7 @@ exception Error of string -type 'a write = Bi_outbuf.t -> 'a -> unit +type 'a write = Buffer.t -> 'a -> unit val error : string -> _ diff --git a/atdgen-runtime/src/ow_run.ml b/atdgen-runtime/src/ow_run.ml new file mode 100644 index 0000000..8415484 --- /dev/null +++ b/atdgen-runtime/src/ow_run.ml @@ -0,0 +1,131 @@ +(* Runtime library for WWW-form *) + +open Printf + +type state = { + top : bool; + prefix : string list; + suffix : string list; +} + +type acc = (string list * string) list + +type 'a write = state -> acc -> 'a -> acc + +exception Error of string + +let error s = raise (Error s) + +let make_item ?index ?(depth_first=false) { top = _; prefix; suffix; } = + match depth_first with + | false -> + let prefix = match index with Some index -> "]" :: string_of_int index :: "[" :: prefix | None -> "[]" :: prefix in + { top = false; prefix; suffix; } + | true -> + let suffix = match index with Some index -> "[" :: string_of_int index :: "]" :: suffix | None -> "[]" :: suffix in + { top = false; prefix; suffix; } + +let make_field = function + | { top = true; prefix; suffix; } -> (fun key -> { top = false; prefix = key :: prefix; suffix; }) + | { top = false; prefix; suffix; } -> (fun key -> { top = false; prefix = "]" :: key :: "[" :: prefix; suffix; }) + +let write_list_simple write_item acc l = + List.fold_left write_item acc l + +let rec write_list_indexed index write_item acc = function + | [] -> acc + | hd :: tl -> write_list_indexed (succ index) write_item (write_item index acc hd) tl + +let write_list ?start_index ?depth_first write_item state acc l = + match start_index with + | None -> + let write_item = write_item (make_item ?depth_first state) in + write_list_simple write_item acc l + | Some start_index -> + let write_item index = write_item (make_item ~index ?depth_first state) in + write_list_indexed start_index write_item acc l + +let write_array_simple write_item acc l = + Array.fold_left write_item acc l + +let write_array_indexed index write_item acc l = + let rec aux index acc i len = + match i >= len with + | true -> acc + | false -> aux (succ index) (write_item index acc (Array.unsafe_get l i)) (succ i) len + in + aux index acc 0 (Array.length l) + +let write_array ?start_index ?depth_first write_item state acc l = + match start_index with + | None -> + let write_item = write_item (make_item ?depth_first state) in + write_array_simple write_item acc l + | Some start_index -> + let write_item index = write_item (make_item ~index ?depth_first state) in + write_array_indexed start_index write_item acc l + +let write_string write s = + match write { top = true; prefix = []; suffix = []; } [] s with + | [ [], key ] -> key + | _ -> error "wrong write_string output" + +let write_assoc_list write_key write_item state acc l = + let field = make_field state in + List.fold_left begin fun acc (key, value) -> + let key = write_string write_key key in + write_item (field key) acc value + end acc l + +let write_assoc_array write_key write_item state acc l = + let field = make_field state in + Array.fold_left begin fun acc (key, value) -> + let key = write_string write_key key in + write_item (field key) acc value + end acc l + +let write_null _state acc () = acc + +let write_option write_item state acc x = + match x with + | Some x -> write_item state acc x + | None -> acc + +let write_nullable = write_option + +let write_string { top = _; prefix; suffix; } acc x = (List.rev_append suffix prefix, x) :: acc + +let write_bool state acc x = write_string state acc (string_of_bool x) + +let write_int state acc x = write_string state acc (string_of_int x) + +let write_int8 state acc x = write_int state acc (int_of_char x) + +let write_int32 state acc x = write_string state acc (Int32.to_string x) + +let write_int64 state acc x = write_string state acc (Int64.to_string x) + +let write_float state acc x = write_string state acc (string_of_float x) + +let write_float_as_int state acc x = + if x >= min_float && x <= max_float then + write_int state acc (int_of_float (if x < 0. then x -. 0.5 else x +. 0.5)) + else + match classify_float x with + | FP_normal + | FP_subnormal + | FP_zero -> write_string state acc (sprintf "%.0f" x) + | FP_infinite -> error "Cannot convert inf or -inf into a WWW-form int" + | FP_nan -> error "Cannot convert NaN into a WWW-form int" + +let write_float_prec prec state acc x = + match classify_float x with + | FP_normal + | FP_subnormal + | FP_zero -> write_string state acc (sprintf "%.*f" prec x) + | FP_infinite -> error "Cannot convert inf or -inf into a WWW-form float" + | FP_nan -> error "Cannot convert NaN into a WWW-form float" + +let www_form_of_acc write x = + let acc = write { top = true; prefix = []; suffix = []; } [] x in + List.rev_map (fun (key, value) -> String.concat "" (List.rev key), value) acc diff --git a/atdgen-runtime/src/ow_run.mli b/atdgen-runtime/src/ow_run.mli new file mode 100644 index 0000000..593cd3a --- /dev/null +++ b/atdgen-runtime/src/ow_run.mli @@ -0,0 +1,33 @@ +(** OCaml-WWW-form runtime library. *) + +exception Error of string + +type state + +type acc = (string list * string) list + +type 'a write = state -> acc -> 'a -> acc + +val error : string -> _ + +val make_item : ?index:int -> ?depth_first:bool -> state -> state +val make_field : state -> string -> state + +val write_bool : bool write +val write_list : ?start_index:int -> ?depth_first:bool -> 'a write -> 'a list write +val write_array : ?start_index:int -> ?depth_first:bool -> 'a write -> 'a array write +val write_float : float write +val write_float_as_int : float write +val write_float_prec : int -> float write +val write_assoc_list : 'a write -> 'b write -> ('a * 'b) list write +val write_assoc_array : 'a write -> 'b write -> ('a * 'b) array write +val write_null : unit write +val write_option : 'a write -> 'a option write +val write_nullable : 'a write -> 'a option write +val write_int : int write +val write_int8 : char write +val write_int32 : int32 write +val write_int64 : int64 write +val write_string : string write + +val www_form_of_acc : 'a write -> 'a -> (string * string) list diff --git a/atdgen-runtime/src/util.ml b/atdgen-runtime/src/util.ml index 6d762df..43bd320 100644 --- a/atdgen-runtime/src/util.ml +++ b/atdgen-runtime/src/util.ml @@ -44,7 +44,7 @@ end module Json = struct type 'a reader = Yojson.Safe.lexer_state -> Lexing.lexbuf -> 'a - type 'a writer = Bi_outbuf.t -> 'a -> unit + type 'a writer = Buffer.t -> 'a -> unit let finish ls lexbuf = Yojson.Safe.read_space ls lexbuf; @@ -84,10 +84,11 @@ struct in input_file fname (fun ic -> from_channel ?buf ~fname:fname0 ?lnum read ic) - let stream_from_lexbuf ?(fin = fun () -> ()) read ls lexbuf = - let stream = Some true in - let f _ = - try Some (from_lexbuf ?stream read ls lexbuf) + let seq_from_lexbuf ?(fin = fun () -> ()) read ls lexbuf = + let f () = + try + let v = from_lexbuf ~stream:true read ls lexbuf in + Some (v, ()) with Yojson.End_of_input -> fin (); @@ -96,19 +97,19 @@ struct (try fin () with _ -> ()); raise e in - Stream.from f + Seq.unfold f () - let stream_from_string ?buf ?fin ?fname ?lnum read ic = + let seq_from_string ?buf ?fin ?fname ?lnum read ic = let lexbuf = Lexing.from_string ic in let ls = Yojson.Safe.init_lexer ?buf ?fname ?lnum () in - stream_from_lexbuf ?fin read ls lexbuf + seq_from_lexbuf ?fin read ls lexbuf - let stream_from_channel ?buf ?fin ?fname ?lnum read ic = + let seq_from_channel ?buf ?fin ?fname ?lnum read ic = let lexbuf = Lexing.from_channel ic in let ls = Yojson.Safe.init_lexer ?buf ?fname ?lnum () in - stream_from_lexbuf ?fin read ls lexbuf + seq_from_lexbuf ?fin read ls lexbuf - let stream_from_file ?buf ?(fin = fun () -> ()) ?fname:src ?lnum read fname = + let seq_from_file ?buf ?(fin = fun () -> ()) ?fname:src ?lnum read fname = let fname0 = match src with None -> fname @@ -116,19 +117,15 @@ struct in let ic = open_in_bin fname in let fin () = close_in_noerr ic; fin () in - stream_from_channel ?buf ~fin ~fname:fname0 ?lnum read ic + seq_from_channel ?buf ~fin ~fname:fname0 ?lnum read ic let list_from_string ?buf ?fin ?fname ?lnum read ic = - let stream = stream_from_string ?buf ?fin ?fname ?lnum read ic in - let acc = ref [] in - Stream.iter (fun x -> acc := x :: !acc) stream; - List.rev !acc + let seq = seq_from_string ?buf ?fin ?fname ?lnum read ic in + List.of_seq seq let list_from_channel ?buf ?fin ?fname ?lnum read ic = - let stream = stream_from_channel ?buf ?fin ?fname ?lnum read ic in - let acc = ref [] in - Stream.iter (fun x -> acc := x :: !acc) stream; - List.rev !acc + let seq = seq_from_channel ?buf ?fin ?fname ?lnum read ic in + List.of_seq seq let list_from_file ?buf ?fname:src ?lnum read fname = let fname0 = @@ -141,34 +138,39 @@ struct list_from_channel ?buf ~fin ~fname:fname0 ?lnum read ic let to_string ?(len = 1024) write x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in + write ob x; + Buffer.contents ob + + let to_channel ?(len = 1024) write oc x = + let ob = Buffer.create len in write ob x; - Bi_outbuf.contents ob + Buffer.output_buffer oc ob - let to_channel ?len write oc x = Biniou.to_channel ?len ~shrlen:0 write oc x - let to_file ?len write fname x = Biniou.to_file ?len ~shrlen:0 write fname x + let to_file ?len write fname x = + output_file fname (fun oc -> to_channel ?len write oc x) - let stream_to_string ?(len = 1024) ?(lf = "\n") write stream = - let ob = Bi_outbuf.create len in - Stream.iter (fun x -> write ob x; Bi_outbuf.add_string ob lf) stream; - Bi_outbuf.contents ob + let seq_to_string ?(len = 1024) ?(lf = "\n") write seq = + let ob = Buffer.create len in + Seq.iter (fun x -> write ob x; Buffer.add_string ob lf) seq; + Buffer.contents ob - let stream_to_channel ?len ?(lf = "\n") write oc stream = - let ob = Bi_outbuf.create_channel_writer ?len ~shrlen:0 oc in - Stream.iter (fun x -> write ob x; Bi_outbuf.add_string ob lf) stream; - Bi_outbuf.flush_channel_writer ob + let seq_to_channel ?(len = 1024) ?(lf = "\n") write oc seq = + let ob = Buffer.create len in + Seq.iter (fun x -> write ob x; Buffer.add_string ob lf) seq; + Buffer.output_buffer oc ob - let stream_to_file ?len ?lf write fname stream = - output_file fname (fun oc -> stream_to_channel ?len ?lf write oc stream) + let seq_to_file ?len ?lf write fname seq = + output_file fname (fun oc -> seq_to_channel ?len ?lf write oc seq) let list_to_string ?len ?lf write l = - stream_to_string ?len ?lf write (Stream.of_list l) + seq_to_string ?len ?lf write (List.to_seq l) let list_to_channel ?len ?lf write oc l = - stream_to_channel ?len ?lf write oc (Stream.of_list l) + seq_to_channel ?len ?lf write oc (List.to_seq l) let list_to_file ?len ?lf write fname l = - stream_to_file ?len ?lf write fname (Stream.of_list l) + seq_to_file ?len ?lf write fname (List.to_seq l) let preset_unknown_field_handler loc name = let msg = diff --git a/atdgen-runtime/src/util.mli b/atdgen-runtime/src/util.mli index 0d529e4..2e16365 100644 --- a/atdgen-runtime/src/util.mli +++ b/atdgen-runtime/src/util.mli @@ -59,7 +59,7 @@ sig [Yojson.lexer_state], [Yojson.Basic.lexer_state] and [Yojson.Raw.lexer_state]. *) - type 'a writer = Bi_outbuf.t -> 'a -> unit + type 'a writer = Buffer.t -> 'a -> unit (** Type of a [write_] function as produced by [atdgen -json]. *) val from_lexbuf : @@ -74,7 +74,7 @@ sig *) val from_string : - ?buf:Bi_outbuf.t -> + ?buf:Buffer.t -> ?fname:string -> ?lnum:int -> 'a reader -> string -> 'a @@ -91,7 +91,7 @@ sig *) val from_channel : - ?buf:Bi_outbuf.t -> + ?buf:Buffer.t -> ?fname:string -> ?lnum:int -> 'a reader -> in_channel -> 'a @@ -108,7 +108,7 @@ sig *) val from_file : - ?buf:Bi_outbuf.t -> + ?buf:Buffer.t -> ?fname:string -> ?lnum:int -> 'a reader -> string -> 'a @@ -124,9 +124,9 @@ sig Default: 1. *) - val stream_from_lexbuf : + val seq_from_lexbuf : ?fin:(unit -> unit) -> - 'a reader -> Yojson.Safe.lexer_state -> Lexing.lexbuf -> 'a Stream.t + 'a reader -> Yojson.Safe.lexer_state -> Lexing.lexbuf -> 'a Seq.t (** Read a stream of JSON values from a lexbuf. @param fin finalization function executed once when the end of the stream is reached either because there is no more @@ -135,12 +135,12 @@ sig [fun () -> close_in_noerr ic]. *) - val stream_from_string : - ?buf:Bi_outbuf.t -> + val seq_from_string : + ?buf:Buffer.t -> ?fin:(unit -> unit) -> ?fname:string -> ?lnum:int -> - 'a reader -> string -> 'a Stream.t + 'a reader -> string -> 'a Seq.t (** Read a stream of JSON values from a channel. Values do not have to be separated by newline characters. @param buf buffer used to accumulate string data @@ -158,12 +158,12 @@ sig Default: 1. *) - val stream_from_channel : - ?buf:Bi_outbuf.t -> + val seq_from_channel : + ?buf:Buffer.t -> ?fin:(unit -> unit) -> ?fname:string -> ?lnum:int -> - 'a reader -> in_channel -> 'a Stream.t + 'a reader -> in_channel -> 'a Seq.t (** Read a stream of JSON values from a channel. Values do not have to be separated by newline characters. @param buf buffer used to accumulate string data @@ -182,12 +182,12 @@ sig Default: 1. *) - val stream_from_file : - ?buf:Bi_outbuf.t -> + val seq_from_file : + ?buf:Buffer.t -> ?fin:(unit -> unit) -> ?fname:string -> ?lnum:int -> - 'a reader -> string -> 'a Stream.t + 'a reader -> string -> 'a Seq.t (** Read a stream of JSON values from a file. Values do not have to be separated by newline characters. @param buf buffer used to accumulate string data @@ -207,7 +207,7 @@ sig *) val list_from_string : - ?buf:Bi_outbuf.t -> + ?buf:Buffer.t -> ?fin:(unit -> unit) -> ?fname:string -> ?lnum:int -> @@ -230,7 +230,7 @@ sig *) val list_from_channel : - ?buf:Bi_outbuf.t -> + ?buf:Buffer.t -> ?fin:(unit -> unit) -> ?fname:string -> ?lnum:int -> @@ -254,7 +254,7 @@ sig *) val list_from_file : - ?buf:Bi_outbuf.t -> + ?buf:Buffer.t -> ?fname:string -> ?lnum:int -> 'a reader -> string -> 'a list @@ -292,28 +292,28 @@ sig @param len output buffer length. *) - val stream_to_string : + val seq_to_string : ?len:int -> ?lf:string -> - 'a writer -> 'a Stream.t -> string + 'a writer -> 'a Seq.t -> string (** Write a stream of values to a string. @param len output buffer length. @param lf additional element terminator. Default: ["\n"]. *) - val stream_to_channel : + val seq_to_channel : ?len:int -> ?lf:string -> - 'a writer -> out_channel -> 'a Stream.t -> unit + 'a writer -> out_channel -> 'a Seq.t -> unit (** Write a stream of values to a channel. @param len output buffer length. @param lf additional element terminator. Default: ["\n"]. *) - val stream_to_file : + val seq_to_file : ?len:int -> ?lf:string -> - 'a writer -> string -> 'a Stream.t -> unit + 'a writer -> string -> 'a Seq.t -> unit (** Write a stream of values to a file. @param len output buffer length. @param lf additional element terminator. Default: ["\n"]. @@ -361,7 +361,7 @@ sig Its preset behavior is to call [preset_unknown_field_handler] which raises a [Failure] exception. - Usage: [!Atdgen_runtime.Util.Json.unknown_field_handler src_loc field_name] + Usage: [!Atdgen_www_runtime.Util.Json.unknown_field_handler src_loc field_name] where [src_loc] is the location of the type definition in the source ATD file and [field_name] is the unknown JSON field name. diff --git a/atdgen-runtime.opam b/atdgen-www-runtime.opam similarity index 84% rename from atdgen-runtime.opam rename to atdgen-www-runtime.opam index 48cf248..caf1a86 100644 --- a/atdgen-runtime.opam +++ b/atdgen-www-runtime.opam @@ -1,8 +1,8 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -synopsis: "Runtime library for code generated by atdgen" +synopsis: "Runtime library for code generated by atdgen-www" description: """ -This package should be used only in conjunction with the stdgen code +This package should be used only in conjunction with the atdgen-www code generator""" maintainer: ["Rudi Grinberg "] authors: [ @@ -25,13 +25,12 @@ license: "MIT" homepage: "https://github.com/ahrefs/atd" bug-reports: "https://github.com/ahrefs/atd/issues" depends: [ - "ocaml" {>= "4.02"} "dune" {>= "1.11"} - "yojson" {>= "1.7.0"} + "ocaml" {>= "4.08"} + "yojson" {>= "2.0.1"} "biniou" {>= "1.0.6"} "odoc" {with-doc} ] -dev-repo: "git+https://github.com/ahrefs/atd.git" build: [ ["dune" "subst"] {pinned} [ @@ -42,6 +41,8 @@ build: [ "-j" jobs "@install" + "@runtest" {with-test} "@doc" {with-doc} ] ] +dev-repo: "git+https://github.com/ahrefs/atd.git" diff --git a/atdgen.opam b/atdgen-www.opam similarity index 95% rename from atdgen.opam rename to atdgen-www.opam index 82bc04c..2b9d735 100644 --- a/atdgen.opam +++ b/atdgen-www.opam @@ -33,17 +33,16 @@ license: "MIT" homepage: "https://github.com/ahrefs/atd" bug-reports: "https://github.com/ahrefs/atd/issues" depends: [ - "ocaml" {>= "4.02"} + "ocaml" {>= "4.03"} "dune" {>= "1.11"} "atd" {>= "2.0.0"} - "atdgen-runtime" {>= "2.0.0"} + "atdgen-www-runtime" {>= "2.0.0"} "atdgen-codec-runtime" {with-test} "biniou" {>= "1.0.6"} "yojson" {>= "1.7.0"} "odoc" {with-doc} "re" ] -dev-repo: "git+https://github.com/ahrefs/atd.git" build: [ ["dune" "subst"] {pinned} [ @@ -54,6 +53,8 @@ build: [ "-j" jobs "@install" + "@runtest" {with-test} "@doc" {with-doc} ] ] +dev-repo: "git+https://github.com/ahrefs/atd.git" diff --git a/atdgen/bin/ag_main.ml b/atdgen/bin/ag_main.ml index b9c179c..9fb03f7 100644 --- a/atdgen/bin/ag_main.ml +++ b/atdgen/bin/ag_main.ml @@ -32,6 +32,7 @@ type mode = | T (* -t (type defs and create_* functions) *) | B (* -b (biniou serialization) *) | J (* -j (json serialization) *) + | W (* -w (www-form serialization) *) | V (* -v (validators) *) | Dep (* -dep (print all file dependencies produced by -t -b -j -v) *) | List (* -list (list all files produced by -t -b -j -v) *) @@ -113,6 +114,12 @@ let main () = data format from the specifications in example.atd using bucklescript's json api."; + "-w", Arg.Unit (fun () -> set_once "output type" mode W), + " + Produce files example_w.mli and example_w.ml + containing OCaml serializers and deserializers for the www-form + data format from the specifications in example.atd."; + "-v", Arg.Unit (fun () -> set_once "output type" mode V), " @@ -192,10 +199,10 @@ let main () = Arg.Unit ( fun () -> set_once "unknown field handler" unknown_field_handler - "!Atdgen_runtime.Util.Json.unknown_field_handler" + "!Atdgen_www_runtime.Util.Json.unknown_field_handler" ), " - Call !Atdgen_runtime.Util.Json.unknown_field_handler for every unknown JSON field + Call !Atdgen_www_runtime.Util.Json.unknown_field_handler for every unknown JSON field found in the input instead of simply skipping them. The initial behavior is to raise an exception."; @@ -267,10 +274,11 @@ Generate OCaml code offering: * OCaml type definitions translated from ATD file (-t) * serializers and deserializers for Biniou (-b) * serializers and deserializers for JSON (-j) + * serializers and deserializers for www-form (-w) * record-creating functions supporting default fields (-v) * user-specified data validators (-v) -Recommended usage: %s (-t|-b|-j|-v|-dep|-list|-bs) example.atd" Sys.argv.(0) in +Recommended usage: %s (-t|-b|-j|-w|-v|-dep|-list|-bs) example.atd" Sys.argv.(0) in Arg.parse options (fun file -> files := file :: !files) msg; if (!std_json @@ -288,7 +296,7 @@ Recommended usage: %s (-t|-b|-j|-v|-dep|-list|-bs) example.atd" Sys.argv.(0) in Some x -> x | None -> match mode with - T | B | J | Bucklescript -> false + T | B | J | W | Bucklescript -> false | V -> true | Biniou | Json | Validate -> true | Dep | List -> true (* don't care *) @@ -299,6 +307,7 @@ Recommended usage: %s (-t|-b|-j|-v|-dep|-list|-bs) example.atd" Sys.argv.(0) in J | Json -> !j_defaults | T | B | Biniou + | W | V | Validate | Bucklescript | Dep | List -> false (* don't care *) @@ -333,6 +342,7 @@ Recommended usage: %s (-t|-b|-j|-v|-dep|-list|-bs) example.atd" Sys.argv.(0) in T -> base ^ "_t" | B -> base ^ "_b" | J -> base ^ "_j" + | W -> base ^ "_w" | V -> base ^ "_v" | Bucklescript -> base ^ "_bs" | Dep @@ -346,7 +356,7 @@ Recommended usage: %s (-t|-b|-j|-v|-dep|-list|-bs) example.atd" Sys.argv.(0) in match base_prefix with None -> (match mode with - B | J | V | Bucklescript -> Some "T" + B | J | W | V | Bucklescript -> Some "T" | Biniou | Validate | T | Dep | List | Json -> None @@ -356,7 +366,7 @@ Recommended usage: %s (-t|-b|-j|-v|-dep|-list|-bs) example.atd" Sys.argv.(0) in Some _ as x -> x | None -> (match mode with - B | J | V | Bucklescript -> + B | J | W | V | Bucklescript -> Some (String.capitalize_ascii (Filename.basename base) ^ "_t") | T | Json | Dep | List | Validate | Biniou -> None @@ -371,7 +381,7 @@ Recommended usage: %s (-t|-b|-j|-v|-dep|-list|-bs) example.atd" Sys.argv.(0) in Dep -> print_deps (get_base_prefix ()) | List -> print_file_list (get_base_prefix ()) | Bucklescript - | T | B | J | V | Biniou | Json | Validate -> + | T | B | J | W | V | Biniou | Json | Validate -> let opens = List.rev !opens in let make_ocaml_files = @@ -385,6 +395,10 @@ Recommended usage: %s (-t|-b|-j|-v|-dep|-list|-bs) example.atd" Sys.argv.(0) in ~std: !std_json ~unknown_field_handler: !unknown_field_handler ~preprocess_input: !j_preprocess_input + | W -> + Ow_emit.make_ocaml_files + ~unknown_field_handler: !unknown_field_handler + ~preprocess_input: !j_preprocess_input | V | Validate -> Ov_emit.make_ocaml_files | Bucklescript -> diff --git a/atdgen/bin/dune b/atdgen/bin/dune index f085d83..0598af5 100644 --- a/atdgen/bin/dune +++ b/atdgen/bin/dune @@ -1,5 +1,5 @@ (executables (libraries re atd atdgen_emit) (names ag_main) - (public_names atdgen) - (package atdgen)) + (public_names atdgen-www) + (package atdgen-www)) diff --git a/atdgen/src/deprecated/atdgen.ml b/atdgen/src/deprecated/atdgen.ml index 249035b..6b0fc49 100644 --- a/atdgen/src/deprecated/atdgen.ml +++ b/atdgen/src/deprecated/atdgen.ml @@ -1,3 +1,3 @@ -[@@@deprecated "The runtime for Atdgen is now the module Atdgen_runtime existing -in the atdgen-runtime opam package"] -include Atdgen_runtime +[@@@deprecated "The runtime for Atdgen-www is now the module Atdgen_www_runtime existing +in the atdgen-www-runtime opam package"] +include Atdgen_www_runtime diff --git a/atdgen/src/deprecated/dune b/atdgen/src/deprecated/dune index 3ac722c..2961d52 100644 --- a/atdgen/src/deprecated/dune +++ b/atdgen/src/deprecated/dune @@ -1,6 +1,6 @@ ;; this is a deprecated library whose only purpose is to re-export the runtime -;; new users should be using atdgen_runtime +;; new users should be using atdgen_www_runtime (library - (name atdgen) - (public_name atdgen) - (libraries atdgen-runtime)) + (name atdgen_www) + (public_name atdgen-www) + (libraries atdgen_www_runtime)) diff --git a/atdgen/src/ob_emit.ml b/atdgen/src/ob_emit.ml index 8c1bfff..9f67114 100644 --- a/atdgen/src/ob_emit.ml +++ b/atdgen/src/ob_emit.ml @@ -271,9 +271,9 @@ let rec get_reader_name let xreader s = if tagged then - sprintf "Atdgen_runtime.Ob_run.read_%s" s + sprintf "Atdgen_www_runtime.Ob_run.read_%s" s else - sprintf "Atdgen_runtime.Ob_run.get_%s_reader" s + sprintf "Atdgen_www_runtime.Ob_run.get_%s_reader" s in match x with Unit (_, Unit, Unit) -> xreader "unit" @@ -424,7 +424,7 @@ let rec make_writer ~tagged deref (x : ob_mapping) : Indent.t list = List, `Array -> let tag = get_biniou_tag x in [ - Line (sprintf "Atdgen_runtime.Ob_run.write_%slist" un); + Line (sprintf "Atdgen_www_runtime.Ob_run.write_%slist" un); Block [ Line tag; Line "("; @@ -435,7 +435,7 @@ let rec make_writer ~tagged deref (x : ob_mapping) : Indent.t list = | Array, `Array -> let tag = get_biniou_tag x in [ - Line (sprintf "Atdgen_runtime.Ob_run.write_%sarray" un); + Line (sprintf "Atdgen_www_runtime.Ob_run.write_%sarray" un); Block [ Line tag; Line "("; @@ -454,7 +454,7 @@ let rec make_writer ~tagged deref (x : ob_mapping) : Indent.t list = | Option (_, x, Option, Option) | Nullable (_, x, Nullable, Nullable) -> [ - Line (sprintf "Atdgen_runtime.Ob_run.write_%soption (" un); + Line (sprintf "Atdgen_www_runtime.Ob_run.write_%soption (" un); Block (make_writer ~tagged:true deref x); Line ")"; ] @@ -605,8 +605,8 @@ and make_table_writer deref tagged list_kind x = in let iter2 = match list_kind with - List -> "Atdgen_runtime.Ob_run.list_iter2" - | Array -> "Atdgen_runtime.Ob_run.array_iter2" + List -> "Atdgen_www_runtime.Ob_run.list_iter2" + | Array -> "Atdgen_www_runtime.Ob_run.array_iter2" in let l = Array.to_list a in let write_header = @@ -726,7 +726,7 @@ let study_record ~ocaml_version fields = in if k = 0 then [] else - [ Line (sprintf "if %s then Atdgen_runtime.Ob_run.missing_fields %s %s;" + [ Line (sprintf "if %s then Atdgen_www_runtime.Ob_run.missing_fields %s %s;" bool_expr bit_fields field_names) ] in init_fields, init_bits, set_bit, check_bits, create_record @@ -738,7 +738,7 @@ let wrap_body ~tagged expected_tag body = Annot ("fun", Line "fun ib ->"); Block [ Line (sprintf "if Bi_io.read_tag ib <> %i then \ - Atdgen_runtime.Ob_run.read_error_at ib;" + Atdgen_www_runtime.Ob_run.read_error_at ib;" expected_tag); Inline body; ] @@ -748,7 +748,7 @@ let wrap_body ~tagged expected_tag body = Annot ("fun", Line "fun tag ->"); Block [ Line (sprintf "if tag <> %i then \ - Atdgen_runtime.Ob_run.read_error () else" + Atdgen_www_runtime.Ob_run.read_error () else" expected_tag); Block [ Line "fun ib ->"; @@ -774,7 +774,7 @@ let wrap_bodies ~tagged l = Line "match Bi_io.read_tag ib with"; Block [ Inline cases; - Line "| _ -> Atdgen_runtime.Ob_run.read_error_at ib" + Line "| _ -> Atdgen_www_runtime.Ob_run.read_error_at ib" ] ] ] @@ -796,7 +796,7 @@ let wrap_bodies ~tagged l = Line "function"; Block [ Inline cases; - Line "| _ -> Atdgen_runtime.Ob_run.read_error ()" + Line "| _ -> Atdgen_www_runtime.Ob_run.read_error ()" ] ] @@ -832,7 +832,7 @@ let rec make_reader a ) ); - Line "| _ -> Atdgen_runtime.Ob_run.unsupported_variant h has_arg"; + Line "| _ -> Atdgen_www_runtime.Ob_run.unsupported_variant h has_arg"; ] ]; Line ")" @@ -853,8 +853,8 @@ let rec make_reader (match o, b with List, `Array -> let f = - if tagged then "Atdgen_runtime.Ob_run.read_list" - else "Atdgen_runtime.Ob_run.get_list_reader" + if tagged then "Atdgen_www_runtime.Ob_run.read_list" + else "Atdgen_www_runtime.Ob_run.get_list_reader" in [ Line (f ^ " ("); @@ -863,8 +863,8 @@ let rec make_reader ] | Array, `Array -> let f = - if tagged then "Atdgen_runtime.Ob_run.read_array" - else "Atdgen_runtime.Ob_run.get_array_reader" + if tagged then "Atdgen_www_runtime.Ob_run.read_array" + else "Atdgen_www_runtime.Ob_run.get_array_reader" in [ Line (f ^ " ("); @@ -878,8 +878,8 @@ let rec make_reader let body2 = let f = match list_kind with - List -> "Atdgen_runtime.Ob_run.read_list_value" - | Array -> "Atdgen_runtime.Ob_run.read_array_value" + List -> "Atdgen_www_runtime.Ob_run.read_list_value" + | Array -> "Atdgen_www_runtime.Ob_run.read_array_value" in [ Line (f ^ " ("); @@ -908,7 +908,7 @@ let rec make_reader ]; Line ")" ]; - Line "| _ -> Atdgen_runtime.Ob_run.read_error_at ib"; + Line "| _ -> Atdgen_www_runtime.Ob_run.read_error_at ib"; ] ] in @@ -1112,7 +1112,7 @@ and make_tuple_reader deref ~ocaml_version a = [ Line "let len = Bi_vint.read_uvint ib in"; Line (sprintf - "if len < %i then Atdgen_runtime.Ob_run.missing_tuple_fields len %s;" + "if len < %i then Atdgen_www_runtime.Ob_run.missing_tuple_fields len %s;" min_length req_fields); Inline read_cells; Line (sprintf "for i = %i to len - 1 do Bi_io.skip ib done;" tup_len); @@ -1169,7 +1169,7 @@ and make_table_reader deref ~ocaml_version loc list_kind x = Inline init_bits; Line "let readers ="; Block [ - Line "Atdgen_runtime.Ob_run.array_init2 col_num ib ("; + Line "Atdgen_www_runtime.Ob_run.array_init2 col_num ib ("; Block [ Line "fun col ib ->"; Block [ @@ -1283,7 +1283,7 @@ let make_ocaml_biniou_reader ~original_types ~ocaml_version ] ] -let make_ocaml_biniou_impl ~with_create ~original_types ~ocaml_version +let make_ocaml_biniou_impl ~with_create ~original_types ~force_defaults:_ ~ocaml_version buf deref defs = defs |> List.concat_map (fun (is_rec, l) -> @@ -1310,99 +1310,9 @@ let make_ocaml_biniou_impl ~with_create ~original_types ~ocaml_version (* Glue *) - -let make_mli - ~header ~opens ~with_typedefs ~with_create ~with_fundefs - ocaml_typedefs deref defs = - let buf = Buffer.create 1000 in - bprintf buf "%s\n" header; - Ox_emit.write_opens buf opens; - if with_typedefs then - bprintf buf "%s\n" ocaml_typedefs; - if with_typedefs && with_fundefs then - bprintf buf "\n"; - if with_fundefs then - make_ocaml_biniou_intf ~with_create buf deref defs; - Buffer.contents buf - -let make_ml - ~header ~opens ~with_typedefs ~with_create ~with_fundefs ~original_types - ~ocaml_version - ocaml_typedefs deref defs = - let buf = Buffer.create 1000 in - bprintf buf "%s\n" header; - Ox_emit.write_opens buf opens; - if with_typedefs then - bprintf buf "%s\n" ocaml_typedefs; - if with_typedefs && with_fundefs then - bprintf buf "\n"; - if with_fundefs then - make_ocaml_biniou_impl - ~with_create ~original_types ~ocaml_version - buf deref defs; - Buffer.contents buf - -let make_ocaml_files - ~opens - ~with_typedefs - ~with_create - ~with_fundefs - ~all_rec - ~pos_fname - ~pos_lnum - ~type_aliases - ~force_defaults:_ - ~ocaml_version - ~pp_convs - atd_file out = - let ((head, m0), _) = - match atd_file with - Some file -> - Atd.Util.load_file - ~expand:false ~inherit_fields:true ~inherit_variants:true - ?pos_fname ?pos_lnum - file - | None -> - Atd.Util.read_channel - ~expand:false ~inherit_fields:true ~inherit_variants:true - ?pos_fname ?pos_lnum - stdin - in - let tsort = - if all_rec then - function m -> [ (true, m) ] - else - Atd.Util.tsort - in - let m1 = tsort m0 in - let defs1 = defs_of_atd_modules m1 in - Xb_emit.check defs1; - let (m1', original_types) = - Atd.Expand.expand_module_body ~keep_poly:true m0 - in - let m2 = tsort m1' in - (* m0 = original type definitions - m1 = original type definitions after dependency analysis - m2 = monomorphic type definitions after dependency analysis *) - let ocaml_typedefs = - Ocaml.ocaml_of_atd ~pp_convs ~target:Biniou ~type_aliases (head, m1) in - let defs = defs_of_atd_modules m2 in - let header = - let src = - match atd_file with - None -> "stdin" - | Some path -> sprintf "%S" (Filename.basename path) - in - sprintf {|(* Auto-generated from %s *) - [@@@ocaml.warning "-27-32-33-35-39"]|} src - in - let mli = - make_mli ~header ~opens ~with_typedefs ~with_create ~with_fundefs - ocaml_typedefs (Mapping.make_deref defs1) defs1 - in - let ml = - make_ml ~header ~opens ~with_typedefs ~with_create ~with_fundefs - ~original_types ~ocaml_version ocaml_typedefs - (Mapping.make_deref defs) defs - in - Ox_emit.write_ocaml out mli ml +let make_ocaml_files = + Ox_emit.make_ocaml_files + ~defs_of_atd_modules + ~make_ocaml_intf:make_ocaml_biniou_intf + ~make_ocaml_impl:make_ocaml_biniou_impl + ~target:Biniou diff --git a/atdgen/src/ob_emit.mli b/atdgen/src/ob_emit.mli index eabcd21..34ef9e4 100644 --- a/atdgen/src/ob_emit.mli +++ b/atdgen/src/ob_emit.mli @@ -9,7 +9,7 @@ val make_ocaml_files -> pos_fname:string option -> pos_lnum:int option -> type_aliases:string option - -> force_defaults:_ (* not used *) + -> force_defaults:bool (* not used *) -> ocaml_version:(int * int) option -> pp_convs:Ocaml.pp_convs -> string option -> Ox_emit.target -> unit diff --git a/atdgen/src/ocaml.ml b/atdgen/src/ocaml.ml index ef48990..53f7e64 100644 --- a/atdgen/src/ocaml.ml +++ b/atdgen/src/ocaml.ml @@ -82,7 +82,7 @@ module Repr = struct | Def of atd_ocaml_def end -type target = Default | Biniou | Json | Validate | Bucklescript +type target = Default | Biniou | Json | WWW | Validate | Bucklescript let ocaml_int_of_string s : atd_ocaml_int option = @@ -123,7 +123,7 @@ let ocaml_list_of_string s : atd_ocaml_list option = let string_of_ocaml_list (x : atd_ocaml_list) = match x with List -> "list" - | Array -> "Atdgen_runtime.Util.ocaml_array" + | Array -> "Atdgen_www_runtime.Util.ocaml_array" let path_of_target (target : target) = match target with @@ -131,6 +131,7 @@ let path_of_target (target : target) = | Biniou -> [ "ocaml_biniou"; "ocaml" ] | Json -> [ "ocaml_json"; "ocaml" ] | Bucklescript -> ["ocaml_bs"; "ocaml"] + | WWW -> [ "ocaml_www"; "ocaml" ] | Validate -> [ "ocaml_validate"; "ocaml" ] let get_ocaml_int target an = @@ -313,6 +314,7 @@ let get_ocaml_module target an = | Biniou -> s ^ "_b" | Json -> s ^ "_j" | Bucklescript -> s ^ "_bs" + | WWW -> s ^ "_w" | Validate -> s ^ "_v" in (type_module, main_module)) diff --git a/atdgen/src/ocaml.mli b/atdgen/src/ocaml.mli index 9835c48..86c6516 100644 --- a/atdgen/src/ocaml.mli +++ b/atdgen/src/ocaml.mli @@ -8,7 +8,7 @@ type atd_ocaml_sum = Classic | Poly type atd_ocaml_record = Record | Object type atd_ocaml_int = Int | Char | Int32 | Int64 | Float type atd_ocaml_list = List | Array -type target = Default | Biniou | Json | Validate | Bucklescript +type target = Default | Biniou | Json | WWW | Validate | Bucklescript type atd_ocaml_wrap = { ocaml_wrap_t : string; diff --git a/atdgen/src/oj_emit.ml b/atdgen/src/oj_emit.ml index 9aec6a1..acb3913 100644 --- a/atdgen/src/oj_emit.ml +++ b/atdgen/src/oj_emit.ml @@ -41,7 +41,7 @@ let make_ocaml_json_intf ~with_create buf deref defs = let writer_params = String.concat "" ( List.map - (fun s -> sprintf "\n (Bi_outbuf.t -> '%s -> unit) ->" s) + (fun s -> sprintf "\n (Buffer.t -> '%s -> unit) ->" s) x.def_param ) in @@ -56,8 +56,8 @@ let make_ocaml_json_intf ~with_create buf deref defs = in bprintf buf "\ val write_%s :%s - Bi_outbuf.t -> %s -> unit - (** Output a JSON value of type {!%s}. *) + Buffer.t -> %s -> unit + (** Output a JSON value of type {!type:%s}. *) " s writer_params @@ -128,10 +128,10 @@ let rec get_writer_name | Int (_, Int o, Int) -> (match o with Int -> "Yojson.Safe.write_int" - | Char -> "Atdgen_runtime.Oj_run.write_int8" - | Int32 -> "Atdgen_runtime.Oj_run.write_int32" - | Int64 -> "Atdgen_runtime.Oj_run.write_int64" - | Float -> "Atdgen_runtime.Oj_run.write_float_as_int" + | Char -> "Atdgen_www_runtime.Oj_run.write_int8" + | Int32 -> "Atdgen_www_runtime.Oj_run.write_int32" + | Int64 -> "Atdgen_www_runtime.Oj_run.write_int64" + | Float -> "Atdgen_www_runtime.Oj_run.write_float_as_int" ) | Float (_, Float, Float j) -> @@ -145,7 +145,7 @@ let rec get_writer_name else sprintf "Yojson.Safe.write_float_prec %i" precision | Int -> - "Atdgen_runtime.Oj_run.write_float_as_int" + "Atdgen_www_runtime.Oj_run.write_float_as_int" ) | String (_, String, String) -> @@ -187,20 +187,20 @@ let rec get_reader_name p (x : Oj_mapping.t) : string = match x with - Unit (_, Unit, Unit) -> "Atdgen_runtime.Oj_run.read_null" - | Bool (_, Bool, Bool) -> "Atdgen_runtime.Oj_run.read_bool" + Unit (_, Unit, Unit) -> "Atdgen_www_runtime.Oj_run.read_null" + | Bool (_, Bool, Bool) -> "Atdgen_www_runtime.Oj_run.read_bool" | Int (_, Int o, Int) -> (match o with - Int -> "Atdgen_runtime.Oj_run.read_int" - | Char -> "Atdgen_runtime.Oj_run.read_int8" - | Int32 -> "Atdgen_runtime.Oj_run.read_int32" - | Int64 -> "Atdgen_runtime.Oj_run.read_int64" - | Float -> "Atdgen_runtime.Oj_run.read_number" + Int -> "Atdgen_www_runtime.Oj_run.read_int" + | Char -> "Atdgen_www_runtime.Oj_run.read_int8" + | Int32 -> "Atdgen_www_runtime.Oj_run.read_int32" + | Int64 -> "Atdgen_www_runtime.Oj_run.read_int64" + | Float -> "Atdgen_www_runtime.Oj_run.read_number" ) - | Float (_, Float, Float _) -> "Atdgen_runtime.Oj_run.read_number" + | Float (_, Float, Float _) -> "Atdgen_www_runtime.Oj_run.read_number" - | String (_, String, String) -> "Atdgen_runtime.Oj_run.read_string" + | String (_, String, String) -> "Atdgen_www_runtime.Oj_run.read_string" | Tvar (_, s) -> "read_" ^ Ox_emit.name_of_var s @@ -239,7 +239,7 @@ let write_with_adapter adapter writer = Oj_mapping.json_restorer_of_adapter_path adapter_path in [ Line ( - sprintf "Atdgen_runtime.Oj_run.write_with_adapter %s (" restore + sprintf "Atdgen_www_runtime.Oj_run.write_with_adapter %s (" restore ); Block writer; Line ")"; @@ -312,7 +312,7 @@ let rec make_writer ?type_constraint p (x : Oj_mapping.t) : Indent.t list = ) a in let l = - insert (Line "Bi_outbuf.add_char ob ',';") (Array.to_list a) + insert (Line "Buffer.add_char ob ',';") (Array.to_list a) in let op, cl = if p.std then '[', ']' @@ -321,9 +321,9 @@ let rec make_writer ?type_constraint p (x : Oj_mapping.t) : Indent.t list = [ Annot ("fun", Line "fun ob x ->"); Block [ - Line (sprintf "Bi_outbuf.add_char ob %C;" op); + Line (sprintf "Buffer.add_char ob %C;" op); Inline l; - Line (sprintf "Bi_outbuf.add_char ob %C;" cl); + Line (sprintf "Buffer.add_char ob %C;" cl); ] ] @@ -332,8 +332,8 @@ let rec make_writer ?type_constraint p (x : Oj_mapping.t) : Indent.t list = Array -> let write = match o with - List -> "Atdgen_runtime.Oj_run.write_list (" - | Array -> "Atdgen_runtime.Oj_run.write_array (" + List -> "Atdgen_www_runtime.Oj_run.write_list (" + | Array -> "Atdgen_www_runtime.Oj_run.write_array (" in [ Line write; @@ -345,8 +345,8 @@ let rec make_writer ?type_constraint p (x : Oj_mapping.t) : Indent.t list = let k, v = Ox_emit.get_assoc_type p.deref loc x in let write = match o with - List -> "Atdgen_runtime.Oj_run.write_assoc_list (" - | Array -> "Atdgen_runtime.Oj_run.write_assoc_array (" + List -> "Atdgen_www_runtime.Oj_run.write_assoc_list (" + | Array -> "Atdgen_www_runtime.Oj_run.write_assoc_array (" in [ Line write; @@ -359,7 +359,7 @@ let rec make_writer ?type_constraint p (x : Oj_mapping.t) : Indent.t list = | Option (_, x, Option, Option) -> [ - Line (sprintf "Atdgen_runtime.Oj_run.write_%soption (" + Line (sprintf "Atdgen_www_runtime.Oj_run.write_%soption (" (if p.std then "std_" else "")); Block (make_writer p x); Line ")"; @@ -367,7 +367,7 @@ let rec make_writer ?type_constraint p (x : Oj_mapping.t) : Indent.t list = | Nullable (_, x, Nullable, Nullable) -> [ - Line "Atdgen_runtime.Oj_run.write_nullable ("; + Line "Atdgen_www_runtime.Oj_run.write_nullable ("; Block (make_writer p x); Line ")"; ] @@ -404,7 +404,7 @@ and make_variant_writer p ~tick ~open_enum x : Indent.t list = else "<" ^ s ^ ">" in [ - Line (sprintf "| %s%s -> Bi_outbuf.add_string ob %S" + Line (sprintf "| %s%s -> Buffer.add_string ob %S" tick ocaml_cons (enclose (make_json_string json_cons))) ] @@ -425,12 +425,12 @@ and make_variant_writer p ~tick ~open_enum x : Indent.t list = [ Line (sprintf "| %s%s x ->" tick ocaml_cons); Block [ - Line (sprintf "Bi_outbuf.add_string ob %S;" + Line (sprintf "Buffer.add_string ob %S;" (op ^ make_json_string json_cons ^ sep)); Line "("; Block (make_writer p v); Line ") ob x;"; - Line (sprintf "Bi_outbuf.add_char ob %C" cl); + Line (sprintf "Buffer.add_char ob %C" cl); ] ] @@ -445,7 +445,7 @@ and make_record_writer p a record_kind = ]; Line "else"; Block [ - Line "Bi_outbuf.add_char ob ',';"; + Line "Buffer.add_char ob ',';"; ]; ] in @@ -456,7 +456,7 @@ and make_record_writer p a record_kind = ; json_fname ; optional ; unwrapped } as field) -> let f_value = unwrap_f_value field p in let write_field_tag = - sprintf "Bi_outbuf.add_string ob %S;" + sprintf "Buffer.add_string ob %S;" (make_json_string json_fname ^ ":") in let app v = @@ -496,10 +496,10 @@ and make_record_writer p a record_kind = ) fields in [ - Line "Bi_outbuf.add_char ob '{';"; + Line "Buffer.add_char ob '{';"; Line "let is_first = ref true in"; Inline write_fields; - Line "Bi_outbuf.add_char ob '}';"; + Line "Buffer.add_char ob '}';"; ] let wrap_tmp_required_value value = @@ -511,7 +511,7 @@ let wrap_tmp_required_value value = let unwrap_tmp_required_value ocaml_fname var = sprintf "(match !%s with Some x -> x \ - | None -> Atdgen_runtime.Oj_run.missing_field p %S)" + | None -> Atdgen_www_runtime.Oj_run.missing_field p %S)" var ocaml_fname (* @@ -588,7 +588,7 @@ let read_with_adapter adapter reader = Oj_mapping.json_normalizer_of_adapter_path adapter_path in [ Line ( - sprintf "Atdgen_runtime.Oj_run.read_with_adapter %s (" normalize + sprintf "Atdgen_www_runtime.Oj_run.read_with_adapter %s (" normalize ); Block reader; Line ")"; @@ -610,7 +610,7 @@ let rec make_reader p type_annot (x : Oj_mapping.t) : Indent.t list = let open_enum = j.Json.json_open_enum in let l = Array.to_list a in let fallback_expr = - [ Line "Atdgen_runtime.Oj_run.invalid_variant_tag p x" ] + [ Line "Atdgen_www_runtime.Oj_run.invalid_variant_tag p x" ] in let cases = make_cases_reader p type_annot @@ -651,7 +651,7 @@ let rec make_reader p type_annot (x : Oj_mapping.t) : Indent.t list = Line "| `Square_bracket -> ("; Block [ Block [ - Line "match Atdgen_runtime.Oj_run.read_string p lb with"; + Line "match Atdgen_www_runtime.Oj_run.read_string p lb with"; Block cases1; ]; Line ")"; @@ -688,8 +688,8 @@ let rec make_reader p type_annot (x : Oj_mapping.t) : Indent.t list = Array -> let read = match o with - List -> "Atdgen_runtime.Oj_run.read_list (" - | Array -> "Atdgen_runtime.Oj_run.read_array (" + List -> "Atdgen_www_runtime.Oj_run.read_list (" + | Array -> "Atdgen_www_runtime.Oj_run.read_array (" in [ Line read; @@ -701,8 +701,8 @@ let rec make_reader p type_annot (x : Oj_mapping.t) : Indent.t list = let k, v = Ox_emit.get_assoc_type p.deref loc x in let read = match o with - List -> "Atdgen_runtime.Oj_run.read_assoc_list (" - | Array -> "Atdgen_runtime.Oj_run.read_assoc_array (" + List -> "Atdgen_www_runtime.Oj_run.read_assoc_list (" + | Array -> "Atdgen_www_runtime.Oj_run.read_assoc_array (" in [ Line read; @@ -832,7 +832,7 @@ and make_case_reader ] else [ - Line "Atdgen_runtime.Oj_run.read_until_field_value p lb;"; + Line "Atdgen_www_runtime.Oj_run.read_until_field_value p lb;"; Line "let x = ("; Block [ Block (make_reader p None v); @@ -966,7 +966,7 @@ and make_record_reader p type_annot loc a json_options = Block int_mapping_function; Line "in"; Line "let i = Yojson.Safe.map_ident p f lb in"; - Line "Atdgen_runtime.Oj_run.read_until_field_value p lb;"; + Line "Atdgen_www_runtime.Oj_run.read_until_field_value p lb;"; Line "("; Block int_matching; Line ");"; @@ -1156,7 +1156,7 @@ and make_tuple_reader p a = Line "with Yojson.End_of_tuple ->"; Block [ Line (sprintf - "Atdgen_runtime.Oj_run.missing_tuple_fields p !len %s);" + "Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len %s);" req_fields); ]; ] @@ -1189,9 +1189,9 @@ let make_ocaml_json_writer p ~original_types is_rec let1 let2 def = Line (sprintf ")%s" extra_args); Line (sprintf "%s %s ?(len = 1024) x =" let2 to_string); Block [ - Line "let ob = Bi_outbuf.create len in"; + Line "let ob = Buffer.create len in"; Line (sprintf "%s ob x;" write); - Line "Bi_outbuf.contents ob" + Line "Buffer.contents ob" ] ] diff --git a/atdgen/src/ov_emit.ml b/atdgen/src/ov_emit.ml index c93c6db..4ca9103 100644 --- a/atdgen/src/ov_emit.ml +++ b/atdgen/src/ov_emit.ml @@ -24,8 +24,8 @@ let make_ocaml_validate_intf ~with_create buf deref defs = String.concat "" ( List.map (fun s -> - sprintf "\n (Atdgen_runtime.Util.Validation.path -> '%s -> \ - Atdgen_runtime.Util.Validation.error option) ->" s) + sprintf "\n (Atdgen_www_runtime.Util.Validation.path -> '%s -> \ + Atdgen_www_runtime.Util.Validation.error option) ->" s) x.def_param ) in @@ -33,7 +33,7 @@ let make_ocaml_validate_intf ~with_create buf deref defs = if Ox_emit.is_exportable x then ( bprintf buf "\ val validate_%s :%s - Atdgen_runtime.Util.Validation.path -> %s -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> %s -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!%s}. *) " @@ -264,8 +264,8 @@ let rec make_validator (x : ov_mapping) : Indent.t list = else let validate = match o with - List -> "Atdgen_runtime.Ov_run.validate_list (" - | Array -> "Atdgen_runtime.Ov_run.validate_array (" + List -> "Atdgen_www_runtime.Ov_run.validate_list (" + | Array -> "Atdgen_www_runtime.Ov_run.validate_array (" in prepend_validator_f v [ Line validate; @@ -279,7 +279,7 @@ let rec make_validator (x : ov_mapping) : Indent.t list = opt_validator v else prepend_validator_f v [ - Line "Atdgen_runtime.Ov_run.validate_option ("; + Line "Atdgen_www_runtime.Ov_run.validate_option ("; Block (make_validator x); Line ")"; ] @@ -359,7 +359,7 @@ let make_ocaml_validator ~original_types is_rec let1 def = ] -let make_ocaml_validate_impl ~with_create ~original_types buf deref defs = +let make_ocaml_validate_impl ~with_create ~original_types ~force_defaults:_ ~ocaml_version:_ buf deref defs = defs |> List.concat_map (fun (is_rec, l) -> let l = List.filter (fun x -> x.def_value <> None) l in @@ -377,95 +377,9 @@ let make_ocaml_validate_impl ~with_create ~original_types buf deref defs = (* Glue *) - -let make_mli - ~header ~opens ~with_typedefs ~with_create ~with_fundefs - ocaml_typedefs deref defs = - let buf = Buffer.create 1000 in - bprintf buf "%s\n" header; - Ox_emit.write_opens buf opens; - if with_typedefs then - bprintf buf "%s\n" ocaml_typedefs; - if with_typedefs && with_fundefs then - bprintf buf "\n"; - if with_fundefs then - make_ocaml_validate_intf ~with_create buf deref defs; - Buffer.contents buf - -let make_ml - ~header ~opens ~with_typedefs ~with_create ~with_fundefs - ~original_types ocaml_typedefs deref defs = - let buf = Buffer.create 1000 in - bprintf buf "%s\n" header; - Ox_emit.write_opens buf opens; - if with_typedefs then - bprintf buf "%s\n" ocaml_typedefs; - if with_typedefs && with_fundefs then - bprintf buf "\n"; - if with_fundefs then - make_ocaml_validate_impl ~with_create ~original_types buf deref defs; - Buffer.contents buf - -let make_ocaml_files - ~opens - ~with_typedefs - ~with_create - ~with_fundefs - ~all_rec - ~pos_fname - ~pos_lnum - ~type_aliases - ~force_defaults:_ - ~ocaml_version:_ - ~pp_convs - atd_file out = - let ((head, m0), _) = - match atd_file with - Some file -> - Atd.Util.load_file - ~expand:false ~inherit_fields:true ~inherit_variants:true - ?pos_fname ?pos_lnum - file - | None -> - Atd.Util.read_channel - ~expand:false ~inherit_fields:true ~inherit_variants:true - ?pos_fname ?pos_lnum - stdin - in - let tsort = - if all_rec then - function m -> [ (true, m) ] - else - Atd.Util.tsort - in - let m1 = tsort m0 - in - let defs1 = Ov_mapping.defs_of_atd_modules m1 in - let (m1', original_types) = - Atd.Expand.expand_module_body ~keep_poly:true m0 - in - let m2 = tsort m1' in - (* m0 = original type definitions - m1 = original type definitions after dependency analysis - m2 = monomorphic type definitions after dependency analysis *) - let ocaml_typedefs = - Ocaml.ocaml_of_atd ~pp_convs ~target:Validate ~type_aliases (head, m1) in - let defs = Ov_mapping.defs_of_atd_modules m2 in - let header = - let src = - match atd_file with - None -> "stdin" - | Some path -> sprintf "%S" (Filename.basename path) - in - sprintf {|(* Auto-generated from %s *) - [@@@ocaml.warning "-27-32-33-35-39"]|} src - in - let mli = - make_mli ~header ~opens ~with_typedefs ~with_create ~with_fundefs - ocaml_typedefs (Mapping.make_deref defs1) defs1 - in - let ml = - make_ml ~header ~opens ~with_typedefs ~with_create ~with_fundefs - ~original_types ocaml_typedefs (Mapping.make_deref defs) defs - in - Ox_emit.write_ocaml out mli ml +let make_ocaml_files = + Ox_emit.make_ocaml_files + ~defs_of_atd_modules + ~make_ocaml_intf:make_ocaml_validate_intf + ~make_ocaml_impl:make_ocaml_validate_impl + ~target:Validate diff --git a/atdgen/src/ov_emit.mli b/atdgen/src/ov_emit.mli index afc0295..ad9bfd0 100644 --- a/atdgen/src/ov_emit.mli +++ b/atdgen/src/ov_emit.mli @@ -9,7 +9,7 @@ val make_ocaml_files -> pos_fname:string option -> pos_lnum:int option -> type_aliases:string option - -> force_defaults:_ (* TODO unused *) - -> ocaml_version:_ (* TODO unused *) + -> force_defaults:bool (* not used *) + -> ocaml_version:(int * int) option -> pp_convs:Ocaml.pp_convs -> string option -> Ox_emit.target -> unit diff --git a/atdgen/src/ow_emit.ml b/atdgen/src/ow_emit.ml new file mode 100644 index 0000000..a15570e --- /dev/null +++ b/atdgen/src/ow_emit.ml @@ -0,0 +1,661 @@ +(* + OCaml code generator for www-form data serialization. +*) + +open Atd.Import +open Indent + +open Atd.Ast +open Mapping + +let target : Ocaml.target = WWW + +let runtime_module = "Atdgen_www_runtime.Ow_run" + +let runtime fmt = Printf.ksprintf (fun x -> sprintf "%s.%s" runtime_module x) fmt + +let runtime_state = runtime "state" + +let runtime_acc = runtime "acc" + +type mapping = (Ocaml.Repr.t, Www_form.www_repr) Mapping.mapping +type field_mapping = (Ocaml.Repr.t, Www_form.www_repr) Mapping.field_mapping + +type field = + { mapping : field_mapping + ; ocaml_fname : string + ; www_fname : string + ; ocaml_default : string option + ; optional : bool + ; unwrapped : bool + } + +type param = { + deref : mapping -> mapping; + unknown_field_handler : string option; + (* Optional handler that takes a field name as argument + and does something with it such as displaying a warning message. *) + + force_defaults : bool; + + preprocess_input : string option; + (* intended for UTF-8 validation *) + + ocaml_version: (int * int) option; + +} + +let get_fields deref a = + List.map (fun x -> + let ocamlf, wwwf = + match x.f_arepr, x.f_brepr with + | Ocaml.Repr.Field o, Www_form.Field j -> o, j + | _ -> assert false + in + let ocaml_fname = ocamlf.Ocaml.ocaml_fname in + let ocaml_default = + match x.f_kind, ocamlf.Ocaml.ocaml_default with + | With_default, None -> + (match Ocaml.get_implicit_ocaml_default (deref x.f_value) with + | None -> Error.error x.f_loc "Missing default field value" + | Some d -> Some d + ) + | With_default, Some d -> Some d + | Optional, _ -> Some "None" + | Required, _ -> None + in + let www_fname = wwwf.Www_form.www_fname in + let optional = not (Atd.Ast.is_required x.f_kind) in + let unwrapped = wwwf.Www_form.www_unwrapped in + { mapping = x + ; ocaml_fname + ; ocaml_default + ; www_fname + ; optional + ; unwrapped + } + ) (Array.to_list a) + +let get_assoc_type deref loc x = + match deref x with + | Tuple (_, [| k; v |], Ocaml.Repr.Tuple, Www_form.Tuple) -> + if not (Ox_emit.is_string deref k.cel_value) then + Error.error loc "Due to keys must be strings"; + (k.cel_value, v.cel_value) + | _ -> + Error.error loc "Expected due to : (string * _) list" + +let make_ocaml_www_form_intf ~with_create buf deref defs = + List.concat_map snd defs + |> List.filter Ox_emit.include_intf + |> List.iter (fun x -> + let s = x.def_name in + let full_name = Ox_emit.get_full_type_name x in + let writer_params = + String.concat "" ( + List.map + (fun s -> sprintf "\n (%s -> %s -> '%s -> %s) ->" runtime_state runtime_acc s runtime_acc) + x.def_param + ) + in + bprintf buf "\ +val write_%s :%s + %s -> %s -> %s -> %s + (** Output a www-form data of type {!%s}. *) + +" + s writer_params + runtime_state runtime_acc full_name runtime_acc + s; + + bprintf buf "\ +val www_form_of_%s :%s + %s -> (string * string) list + (** Serialize a value of type {!%s} + into a www-form assoc list. *) + +" + s writer_params + full_name + s; + ) + +(* + ('a, 'b) t -> write_t write__a write__b + ('a, foo) t -> write_t write__a write_foo + ('a, (foo, 'b) bar) t -> write_t write__a (write_bar write_foo write__b) +*) +let rec get_writer_name + ?(paren = false) + ?(name_f = fun s -> "write_" ^ s) + p (x : mapping) : string = + match x with + Unit (_, Ocaml.Repr.Unit, Unit) -> + runtime "write_null" + | Bool (_, Bool, Bool) -> + runtime "write_bool" + | Int (_, Int o, Int) -> + (match o with + Int -> runtime "write_int" + | Char -> runtime "write_int8" + | Int32 -> runtime "write_int32" + | Int64 -> runtime "write_int64" + | Float -> runtime "write_float_as_int" + ) + + | Float (_, Float, Float j) -> + (match j with + Float None -> + runtime "write_float" + | Float (Some precision) -> + runtime "write_float_prec %i" precision + | Int -> + runtime "write_float_as_int" + ) + + | String (_, String, String) -> + runtime "write_string" + + | Tvar (_, s) -> "write_" ^ (Ox_emit.name_of_var s) + + | Name (_, s, args, None, None) -> + let l = List.map (get_writer_name ~paren:true p) args in + let s = String.concat " " (name_f s :: l) in + if paren && l <> [] then "(" ^ s ^ ")" + else s + + | External (_, _, args, + External (_, main_module, ext_name), + External) -> + let f = main_module ^ "." ^ name_f ext_name in + let l = List.map (get_writer_name ~paren:true p) args in + let s = String.concat " " (f :: l) in + if paren && l <> [] then "(" ^ s ^ ")" + else s + + | _ -> assert false + + +let get_left_writer_name p name param = + let args = List.map (fun s -> Tvar (dummy_loc, s)) param in + get_writer_name p (Name (dummy_loc, name, args, None, None)) + +let get_left_to_string_name p name param = + let name_f s = "www_form_of_" ^ s in + let args = List.map (fun s -> Tvar (dummy_loc, s)) param in + get_writer_name ~name_f p (Name (dummy_loc, name, args, None, None)) + + +let write_with_adapter adapter writer = + match adapter.Www_form.ocaml_adapter with + | None -> writer + | Some adapter_path -> + let restore = + Oj_mapping.json_restorer_of_adapter_path adapter_path in + [ + Line ( + runtime "write_with_adapter %s (" restore + ); + Block writer; + Line ")"; + ] + +let unwrap_f_value ({ mapping; unwrapped; _} : field) (p : param) = + if unwrapped then + Ocaml.unwrap_option (p.deref mapping.f_value) + else + mapping.f_value + +let rec make_writer ?type_constraint p (x : mapping) : Indent.t list = + match x with + Unit _ + | Bool _ + | Int _ + | Float _ + | String _ + | Name _ + | External _ + | Tvar _ -> [ Line (get_writer_name p x) ] + + | Sum (_, a, Sum o, Sum j) -> + let tick = Ocaml.tick o in + let open_enum = j.Www_form.www_open_enum in + let body : Indent.t list = + [ + Line "match x with"; + Block ( + Array.to_list ( + Array.map + (fun x -> Inline (make_variant_writer p ~tick ~open_enum x)) + a + ) + ) + ] + in + let standard_writer = [ + Annot ("fun", Line "fun state acc x ->"); + Block body + ] in + let adapter = j.www_sum_adapter in + write_with_adapter adapter standard_writer + + | Record (_, a, Record o, Record j) -> + let xval = + match type_constraint with + | Some x -> sprintf "(x : %s)" x + | None -> "x" + in + let standard_writer = [ + Annot ("fun", Line (sprintf "fun state acc %s ->" xval)); + Block (make_record_writer p a o); + ] in + let adapter = j.www_record_adapter in + write_with_adapter adapter standard_writer + + | Tuple (_, a, Tuple, Tuple) -> + let len = Array.length a in + let a = + Array.mapi ( + fun i x -> + Inline [ + Line "let acc ="; + Block [ + Line (sprintf "let %s = x in" (Ox_emit.nth "x" i len)); + Line "("; + Block (make_writer p x.cel_value); + Line ") state acc x"; + ]; + Line "in"; + ] + ) a + in + let l = Array.to_list a in + [ + Annot ("fun", Line "fun state acc x ->"); + Block [ + Inline l; + Line "acc"; + ]; + ] + + | List (loc, x, List o, List w) -> + (match w with + Array { start_index; depth_first; } -> + let repr = match o with List -> "list" | Array -> "array" in + let start_index = match start_index with Some start_index -> Printf.sprintf "~start_index:%d" start_index | None -> "" in + let depth_first = match depth_first with true -> Printf.sprintf "~depth_first:%B" depth_first | false -> "" in + [ + Line (runtime "write_%s %s%s(" repr start_index depth_first); + Block (make_writer p x); + Line ")"; + ] + + | Object -> + let k, v = get_assoc_type p.deref loc x in + let write = + match o with + List -> runtime "write_assoc_list (" + | Array -> runtime "write_assoc_array (" + in + [ + Line write; + Block (make_writer p k); + Line ") ("; + Block (make_writer p v); + Line ")"; + ] + ) + + | Option (_, x, Option, Option) -> + [ + Line (runtime "write_option ("); + Block (make_writer p x); + Line ")"; + ] + + | Nullable (_, x, Nullable, Nullable) -> + [ + Line (runtime "write_nullable ("); + Block (make_writer p x); + Line ")"; + ] + + | Wrap (_, x, Wrap o, Wrap) -> + (match o with + None -> make_writer p x + | Some { Ocaml.ocaml_unwrap; _} -> + [ + Line "fun state acc x -> ("; + Block [ + Line (sprintf "let x = ( %s ) x in (" ocaml_unwrap); + Block (make_writer p x); + Line ") state acc x)"; + ] + ] + ) + + | _ -> assert false + + +and make_variant_writer p ~tick ~open_enum x : Indent.t list = + let o, j = + match x.var_arepr, x.var_brepr with + Variant o, Variant j -> o, j + | _ -> assert false + in + let ocaml_cons = o.Ocaml.ocaml_cons in + let www_cons = j.Www_form.www_cons in + match x.var_arg with + | None -> + [ + Line (sprintf "| %s%s -> %s state acc %S" + tick ocaml_cons + (runtime "write_string") + www_cons) + ] + | Some v when open_enum -> + (* v should resolve to type string. *) + [ + Line (sprintf "| %s%s x -> (" tick ocaml_cons); + Block [ + Block (make_writer p v); + Line ") state acc x"; + ]; + ] + | Some v -> + [ + Line (sprintf "| %s%s x ->" tick ocaml_cons); + Block [ + Line (sprintf "let state = %s state in" (runtime "make_item")); + Line (sprintf "let acc = %s state acc %S in" (runtime "write_string") www_cons); + Line "("; + Block (make_writer p v); + Line ") state acc x"; + ] + ] + +and make_record_writer p a record_kind = + let dot = Ocaml.dot record_kind in + let fields = get_fields p.deref a in + let write_fields = + List.map ( + fun ({ mapping ; ocaml_fname ; ocaml_default + ; www_fname ; optional ; unwrapped } as field) -> + let f_value = unwrap_f_value field p in + let app v = + [ + Line "("; + Block (make_writer p f_value); + Line ")"; + Block [ + Line (sprintf "(%s state %S) acc %s" (runtime "make_field") www_fname v) + ]; + ] + in + let v = + if optional then + sprintf "x.%s" ocaml_fname + else + sprintf "x%s%s" dot ocaml_fname + in + let l = + if unwrapped then + [ + Line (sprintf "match %s with None -> acc | Some x ->" v); + Block (app "x"); + ] + else if optional && not p.force_defaults then + [ + Line (sprintf "if %s <> %s then (" + v (Option.value_exn ocaml_default)); + Block (app v); + Line ") else acc" + ] + else + app v + in + Inline [ + Line "let acc ="; + Block l; + Line "in"; + ] + ) fields + in + [ + Inline write_fields; + Line "acc"; + ] + +let make_ocaml_www_data_writer p ~original_types is_rec let1 let2 def = + let x = Option.value_exn def.def_value in + let name = def.def_name in + let type_constraint = Ox_emit.get_type_constraint ~original_types def in + let param = def.def_param in + let write = get_left_writer_name p name param in + let to_string = get_left_to_string_name p name param in + let needs_annot = Ox_emit.needs_type_annot x in + let writer_expr = + if needs_annot + then make_writer ~type_constraint p x + else make_writer p x + in + let eta_expand = is_rec && not (Ox_emit.is_lambda writer_expr) in + let extra_param, extra_args, type_annot = + match eta_expand, needs_annot with + | true, false -> " state acc x", " state acc x", None + | true, true -> sprintf " state acc (x : %s)" type_constraint, " state acc x", None + | false, false -> "", "", None + | false, true -> "", "", Some (sprintf "_ -> _ -> %s -> _" type_constraint) + in + [ + Line (sprintf "%s %s = (" + let1 (Ox_emit.opt_annot_def type_annot (write ^ extra_param))); + Block (List.map Indent.strip writer_expr); + Line (sprintf ")%s" extra_args); + Line (sprintf "%s %s x =" let2 to_string); + Block [ + Line (sprintf "%s (" (runtime "www_form_of_acc")); + Block [ + Line write; + ]; + Line ") x"; + ] + ] + +let make_ocaml_www_form_impl + ~unknown_field_handler + ~with_create ~preprocess_input ~original_types + ~force_defaults ~ocaml_version + buf deref defs = + let p = + { deref + ; unknown_field_handler + ; force_defaults + ; preprocess_input + ; ocaml_version + } in + defs + |> List.concat_map (fun (is_rec, l) -> + let l = List.filter (fun x -> x.def_value <> None) l in + let writers = + List.map_first (fun ~is_first def -> + let let1, let2 = Ox_emit.get_let ~is_rec ~is_first in + make_ocaml_www_data_writer p ~original_types is_rec let1 let2 def + ) l + in + List.flatten writers) + |> Indent.to_buffer buf; + Ox_emit.maybe_write_creator_impl ~with_create deref buf defs + + +(* + Translation of the types into the ocaml/www-form mapping. +*) + +let check_www_sum loc www_sum_param variants = + if www_sum_param.Www_form.www_open_enum then ( + let variants_with_arg = + List.filter (function {var_arg = Some _; _} -> true | _ -> false) variants + in + match variants_with_arg with + | [] -> + Error.error loc + "Missing catch-all case of the form `| Other of string`, \ + required by ." + | [x] -> ( + match x.var_arg with + | None -> assert false + | Some (String _) -> () + | Some mapping -> + let loc = Mapping.loc_of_mapping mapping in + Error.error loc + "The argument of this variant must be of type string \ + as imposed by ." + ) + | _ -> + Error.error loc + "Multiple variants have arguments, which doesn't make sense \ + when combined with ." + ) + +let rec mapping_of_expr (x : type_expr) = + match x with + | Sum (loc, l, an) -> + let ocaml_t = Ocaml.Repr.Sum (Ocaml.get_ocaml_sum WWW an) in + let www_sum_param = Www_form.get_www_sum an in + let www_t = Www_form.Sum (Www_form.get_www_sum an) in + let variants = List.map mapping_of_variant l in + check_www_sum loc www_sum_param variants; + Sum (loc, Array.of_list variants, + ocaml_t, www_t) + + | Record (loc, l, an) -> + let ocaml_t = Ocaml.Repr.Record (Ocaml.get_ocaml_record WWW an) in + let ocaml_field_prefix = Ocaml.get_ocaml_field_prefix WWW an in + let www_t = Www_form.Record (Www_form.get_www_record an) in + Record (loc, + Array.of_list + (List.map (mapping_of_field ocaml_field_prefix) l), + ocaml_t, www_t) + + | Tuple (loc, l, _) -> + let ocaml_t = Ocaml.Repr.Tuple in + let www_t = Www_form.Tuple in + Tuple (loc, Array.of_list (List.map mapping_of_cell l), + ocaml_t, www_t) + + | List (loc, x, an) -> + let ocaml_t = Ocaml.Repr.List (Ocaml.get_ocaml_list WWW an) in + let www_t = Www_form.List (Www_form.get_www_list an) in + List (loc, mapping_of_expr x, ocaml_t, www_t) + + | Option (loc, x, _) -> + let ocaml_t = Ocaml.Repr.Option in + let www_t = Www_form.Option in + Option (loc, mapping_of_expr x, ocaml_t, www_t) + + | Nullable (loc, x, _) -> + let ocaml_t = Ocaml.Repr.Nullable in + let www_t = Www_form.Nullable in + Nullable (loc, mapping_of_expr x, ocaml_t, www_t) + + | Shared (loc, _, _) -> + Error.error loc "Sharing is not supported by the WWW-form interface" + + | Wrap (loc, x, an) -> + let ocaml_t = + Ocaml.Repr.Wrap (Ocaml.get_ocaml_wrap ~type_param:[] WWW loc an) in + let www_t = Www_form.Wrap in + Wrap (loc, mapping_of_expr x, ocaml_t, www_t) + + | Name (loc, (_, s, l), an) -> + (match s with + "unit" -> + Unit (loc, Unit, Unit) + | "bool" -> + Bool (loc, Bool, Bool) + | "int" -> + let o = Ocaml.get_ocaml_int WWW an in + Int (loc, Int o, Int) + | "float" -> + let j = Www_form.get_www_float an in + Float (loc, Float, Float j) + | "string" -> + String (loc, String, String) + | s -> + Name (loc, s, List.map mapping_of_expr l, None, None) + ) + | Tvar (loc, s) -> + Tvar (loc, s) + +and mapping_of_cell (cel_loc, x, an) = + { cel_loc + ; cel_value = mapping_of_expr x + ; cel_arepr = + Ocaml.Repr.Cell + { Ocaml.ocaml_default = Ocaml.get_ocaml_default WWW an + ; ocaml_fname = "" + ; ocaml_mutable = false + ; ocaml_fdoc = Atd.Doc.get_doc cel_loc an + } + ; cel_brepr = Www_form.Cell + } + +and mapping_of_variant = function + | Inherit _ -> assert false + | Variant (var_loc, (var_cons, an), o) -> + { var_loc + ; var_cons + ; var_arg = Option.map mapping_of_expr o + ; var_arepr = Ocaml.Repr.Variant + { Ocaml.ocaml_cons = Ocaml.get_ocaml_cons WWW var_cons an + ; ocaml_vdoc = Atd.Doc.get_doc var_loc an + } + ; var_brepr = + Www_form.Variant + { Www_form.www_cons = Www_form.get_www_cons var_cons an + } + } + +and mapping_of_field ocaml_field_prefix = function + | `Inherit _ -> assert false + | `Field (f_loc, (f_name, f_kind, an), x) -> + let { Ox_mapping.ocaml_default; unwrapped } = + Ox_mapping.analyze_field WWW f_loc f_kind an in + { f_loc + ; f_name + ; f_kind + ; f_value = mapping_of_expr x + ; f_arepr = Ocaml.Repr.Field + { Ocaml.ocaml_default + ; ocaml_fname = + Ocaml.get_ocaml_fname WWW (ocaml_field_prefix ^ f_name) an + ; ocaml_mutable = Ocaml.get_ocaml_mutable WWW an + ; ocaml_fdoc = Atd.Doc.get_doc f_loc an + } + ; f_brepr = Www_form.Field + { Www_form.www_fname = Www_form.get_www_fname f_name an + ; www_unwrapped = unwrapped + } + } + +let defs_of_atd_modules l = + List.map (fun (is_rec, l) -> + ( is_rec + , List.map (function Atd.Ast.Type atd -> + Ox_emit.def_of_atd atd ~target ~external_:Www_form.External + ~mapping_of_expr ~def:Www_form.Def + ) l + ) + ) l + + +(* + Glue +*) +let make_ocaml_files ~unknown_field_handler ~preprocess_input = + Ox_emit.make_ocaml_files + ~defs_of_atd_modules + ~make_ocaml_intf:make_ocaml_www_form_intf + ~make_ocaml_impl:(make_ocaml_www_form_impl ~unknown_field_handler ~preprocess_input) + ~target:WWW diff --git a/atdgen/src/ow_emit.mli b/atdgen/src/ow_emit.mli new file mode 100644 index 0000000..e691c50 --- /dev/null +++ b/atdgen/src/ow_emit.mli @@ -0,0 +1,26 @@ +(** Code generator for www-form data serialization. *) + +type field = + { mapping : (Ocaml.Repr.t, Www_form.www_repr) Mapping.field_mapping + ; ocaml_fname : string + ; www_fname : string + ; ocaml_default : string option + ; optional : bool + ; unwrapped : bool + } + +val make_ocaml_files + : unknown_field_handler:string option + -> preprocess_input:string option + -> opens:string list + -> with_typedefs:bool + -> with_create:bool + -> with_fundefs:bool + -> all_rec:bool + -> pos_fname:string option + -> pos_lnum:int option + -> type_aliases:string option + -> force_defaults:bool + -> ocaml_version:(int * int) option + -> pp_convs:Ocaml.pp_convs + -> string option -> Ox_emit.target -> unit diff --git a/atdgen/src/ox_emit.ml b/atdgen/src/ox_emit.ml index e1a8be7..214fd65 100644 --- a/atdgen/src/ox_emit.ml +++ b/atdgen/src/ox_emit.ml @@ -435,3 +435,132 @@ let get_assoc_type deref loc x = (k.cel_value, v.cel_value) | _ -> Error.error loc "Expected due to : (string * _) list" + +(* Glue *) +let make_mli + ~make_ocaml_intf + ~header ~opens ~with_typedefs ~with_create ~with_fundefs + ocaml_typedefs deref defs = + let buf = Buffer.create 1000 in + bprintf buf "%s\n" header; + write_opens buf opens; + if with_typedefs then + bprintf buf "%s\n" ocaml_typedefs; + if with_typedefs && with_fundefs then + bprintf buf "\n"; + if with_fundefs then + make_ocaml_intf ~with_create buf deref defs; + Buffer.contents buf + +let make_ml + ~make_ocaml_impl + ~header ~opens ~with_typedefs ~with_create ~with_fundefs ~original_types + ~force_defaults ~ocaml_version + ocaml_typedefs deref defs = + let buf = Buffer.create 1000 in + bprintf buf "%s\n" header; + write_opens buf opens; + if with_typedefs then + bprintf buf "%s\n" ocaml_typedefs; + if with_typedefs && with_fundefs then + bprintf buf "\n"; + if with_fundefs then + make_ocaml_impl + ~with_create ~original_types ~force_defaults ~ocaml_version + buf deref defs; + Buffer.contents buf + +type 't make_ocaml_intf = + with_create:bool -> + Buffer.t -> + ('t expr -> 't expr) -> + (bool * 't def list) list -> unit + +type 't make_ocaml_impl = + with_create:bool -> + original_types:(string, string * int) Hashtbl.t -> + force_defaults:bool -> + ocaml_version:(int * int) option -> + Buffer.t -> + ('t expr -> 't expr) -> + (bool * 't def list) list -> unit + +type 't defs_of_atd_modules = + (bool * Atd.Ast.module_body) list -> + (bool * 't def list) list + +let make_ocaml_files + ~opens + ~with_typedefs + ~with_create + ~with_fundefs + ~all_rec + ~pos_fname + ~pos_lnum + ~type_aliases + ~force_defaults + ~ocaml_version + ~pp_convs + ~defs_of_atd_modules + ~make_ocaml_intf + ~make_ocaml_impl + ~target + atd_file out + = + let ((head, m0), _) = + match atd_file with + Some file -> + Atd.Util.load_file + ~expand:false ~inherit_fields:true ~inherit_variants:true + ?pos_fname ?pos_lnum + file + | None -> + Atd.Util.read_channel + ~expand:false ~inherit_fields:true ~inherit_variants:true + ?pos_fname ?pos_lnum + stdin + in + let tsort = + if all_rec then + function m -> [ (true, m) ] + else + Atd.Util.tsort + in + let m1 = tsort m0 in + let defs1 = defs_of_atd_modules m1 in +(* + check defs1; +*) + let (m1', original_types) = + Atd.Expand.expand_module_body ~keep_poly:true m0 + in + let m2 = tsort m1' in + (* m0 = original type definitions + m1 = original type definitions after dependency analysis + m2 = monomorphic type definitions after dependency analysis *) + let ocaml_typedefs = + Ocaml.ocaml_of_atd ~pp_convs ~target ~type_aliases (head, m1) in + let defs = defs_of_atd_modules m2 in + let header = + let src = + match atd_file with + None -> "stdin" + | Some path -> sprintf "%S" (Filename.basename path) + in + sprintf {|(* Auto-generated from %s *) + [@@@ocaml.warning "-27-32-33-35-39"]|} src + in + let mli = + make_mli + ~make_ocaml_intf + ~header ~opens ~with_typedefs ~with_create ~with_fundefs + ocaml_typedefs (Mapping.make_deref defs1) defs1 + in + let ml = + make_ml + ~make_ocaml_impl + ~header ~opens ~with_typedefs ~with_create ~with_fundefs + ~original_types ~force_defaults ~ocaml_version ocaml_typedefs + (Mapping.make_deref defs) defs + in + write_ocaml out mli ml diff --git a/atdgen/src/ox_emit.mli b/atdgen/src/ox_emit.mli index d8f51f5..ce98412 100644 --- a/atdgen/src/ox_emit.mli +++ b/atdgen/src/ox_emit.mli @@ -13,9 +13,8 @@ val get_full_type_name : (_, _) Mapping.def -> string val is_exportable : (_, _) Mapping.def -> bool val make_record_creator - : ((Ocaml.Repr.t, 'a) Mapping.mapping - -> (Ocaml.Repr.t, 'b) Mapping.mapping) - -> (Ocaml.Repr.t, 'a) Mapping.def + : ('a expr -> 'b expr) + -> 'a def -> string * string val opt_annot : string option -> string -> string @@ -58,31 +57,29 @@ val def_of_atd -> target:Ocaml.target -> def:'a -> external_:'a - -> mapping_of_expr:(Atd.Ast.type_expr -> (Ocaml.Repr.t, 'a) Mapping.mapping) - -> (Ocaml.Repr.t, 'a) Mapping.def + -> mapping_of_expr:(Atd.Ast.type_expr -> 'a expr) + -> 'a def val maybe_write_creator_impl : with_create:bool - -> ((Ocaml.Repr.t, 'a) Mapping.mapping -> - (Ocaml.Repr.t, 'b) Mapping.mapping) + -> ('a expr -> 'b expr) -> Buffer.t - -> ('c * (Ocaml.Repr.t, 'a) Mapping.def list) list + -> ('c * 'a def list) list -> unit val maybe_write_creator_intf : with_create:bool - -> ((Ocaml.Repr.t, 'a) Mapping.mapping -> - (Ocaml.Repr.t, 'b) Mapping.mapping) + -> ('a expr -> 'b expr) -> Buffer.t - -> (Ocaml.Repr.t, 'a) Mapping.def + -> 'a def -> unit val default_value : (Ocaml.Repr.t, 'a) Mapping.field_mapping - -> ((Ocaml.Repr.t, 'a) Mapping.mapping -> (Ocaml.Repr.t, 'b) Mapping.mapping) + -> ('a expr -> 'b expr) -> string option -val include_intf : (Ocaml.Repr.t, 'a) Mapping.def -> bool +val include_intf : 'a def -> bool type field = { mapping : (Ocaml.Repr.t, Json.json_repr) Mapping.field_mapping @@ -94,16 +91,52 @@ type field = } val get_fields - : ((Ocaml.Repr.t, Json.json_repr) Mapping.mapping - -> (Ocaml.Repr.t, 'a) Mapping.mapping) + : (Json.json_repr expr -> 'a expr) -> (Ocaml.Repr.t, Json.json_repr) Mapping.field_mapping array -> field list -val is_string : (('a, 'b) Mapping.mapping -> ('a, 'b) Mapping.mapping) -> ('a, 'b) Mapping.mapping -> bool +val is_string : ('a expr -> 'a expr) -> 'a expr -> bool -val get_assoc_type : ((Ocaml.Repr.t, Json.json_repr) Mapping.mapping -> - (Ocaml.Repr.t, Json.json_repr) Mapping.mapping) -> +val get_assoc_type : (Json.json_repr expr -> Json.json_repr expr) -> Mapping.loc -> - (Ocaml.Repr.t, Json.json_repr) Mapping.mapping -> - (Ocaml.Repr.t, Json.json_repr) Mapping.mapping * - (Ocaml.Repr.t, Json.json_repr) Mapping.mapping + Json.json_repr expr -> + Json.json_repr expr * + Json.json_repr expr + +(* Glue *) +type 't make_ocaml_intf = + with_create:bool -> + Buffer.t -> + ('t expr -> 't expr) -> + (bool * 't def list) list -> unit + +type 't make_ocaml_impl = + with_create:bool -> + original_types:(string, string * int) Hashtbl.t -> + force_defaults:bool -> + ocaml_version:(int * int) option -> + Buffer.t -> + ('t expr -> 't expr) -> + (bool * 't def list) list -> unit + +type 't defs_of_atd_modules = + (bool * Atd.Ast.module_body) list -> + (bool * 't def list) list + +val make_ocaml_files + : opens:string list + -> with_typedefs:bool + -> with_create:bool + -> with_fundefs:bool + -> all_rec:bool + -> pos_fname:string option + -> pos_lnum:int option + -> type_aliases:string option + -> force_defaults:bool + -> ocaml_version:(int * int) option + -> pp_convs:Ocaml.pp_convs + -> defs_of_atd_modules:'t defs_of_atd_modules + -> make_ocaml_intf:'t make_ocaml_intf + -> make_ocaml_impl:'t make_ocaml_impl + -> target:Ocaml.target + -> string option -> target -> unit diff --git a/atdgen/src/validate.ml b/atdgen/src/validate.ml index fe815d8..a5b9bb2 100644 --- a/atdgen/src/validate.ml +++ b/atdgen/src/validate.ml @@ -29,7 +29,7 @@ let make_full_validator s = if (%s) x then None else - Some (Atdgen_runtime.Util.Validation.error ~msg path)" + Some (Atdgen_www_runtime.Util.Validation.error ~msg path)" (String.escaped s) s let get_validator an = diff --git a/atdgen/src/www_form.ml b/atdgen/src/www_form.ml new file mode 100644 index 0000000..ea21050 --- /dev/null +++ b/atdgen/src/www_form.ml @@ -0,0 +1,185 @@ +(* + Mapping from ATD to WWW-form data +*) + +type www_adapter = { + ocaml_adapter : string option; +} + +let no_adapter = { + ocaml_adapter = None; +} + +type www_float = + | Float of int option (* max decimal places *) + | Int + +type www_list_array = { + start_index : int option; + depth_first : bool; +} + +type www_list = Array of www_list_array | Object + +type www_variant = { www_cons : string } + +type www_field = { + www_fname : string; (* *) + www_unwrapped : bool; +} + +type www_record = { + www_record_adapter : www_adapter; +} + +type www_sum = { + www_sum_adapter : www_adapter; + www_open_enum : bool; + www_lowercase_tags : bool; +} + +let section = "www" + +let sections = [ section ] + +(* + Note that www adapters are supported only by records and sums + at this time. + TODO: Support www adapters for all kinds of nodes rather than just + sums and records, preferably without major code duplication. + Maybe this can be achieved by turning www_repr + into (www_repr * www_adapter). +*) +type www_repr = + | Bool + | Cell + | Def + | External + | Field of www_field + | Float of www_float + | Int + | List of www_list + | Nullable + | Option + | Record of www_record + | String + | Sum of www_sum + | Tuple + | Unit + | Variant of www_variant + | Wrap (* should we add support for Base64 encoding of binary data? *) + +let www_float_of_string s : [ `Float | `Int ] option = + match s with + "float" -> Some `Float + | "int" -> Some `Int + | _ -> None + +let www_precision_of_string s = + try Some (int_of_string s) + with _ -> None + +let get_www_precision an = + Atd.Annot.get_opt_field + ~parse:www_precision_of_string + ~sections + ~field:"precision" + an + +let get_www_float an : www_float = + match + Atd.Annot.get_field + ~parse:www_float_of_string + ~default:`Float + ~sections + ~field:"repr" + an + with + `Float -> Float (get_www_precision an) + | `Int -> Int + +let www_list_repr_of_string s : [ `Array | `Object ] option = + match s with + | "array" -> Some `Array + | "object" -> Some `Object + | _ -> (* error *) None + +(* + + --> { ocaml_adapter = Some "Foo.Bar"; } +*) +let get_www_adapter an = + let ocaml_adapter = + Atd.Annot.get_opt_field + ~parse:(fun s -> Some s) + ~sections + ~field:"adapter.ocaml" + an + in + { ocaml_adapter } + +let get_www_open_enum an = + Atd.Annot.get_flag ~sections ~field:"open_enum" an + +let get_www_lowercase_tags an = + Atd.Annot.get_flag ~sections ~field:"lowercase_tags" an + +let get_www_sum an = { + www_sum_adapter = get_www_adapter an; + www_open_enum = get_www_open_enum an; + www_lowercase_tags = get_www_lowercase_tags an; +} + +let get_www_list an = + let repr = + Atd.Annot.get_field + ~parse:www_list_repr_of_string + ~default:`Array + ~sections + ~field:"repr" + an + in + match repr with + | `Object -> Object + | `Array -> + let start_index = + Atd.Annot.get_field + ~parse:(function "none" -> Some None | x -> Some (Some (int_of_string x))) + ~default:None + ~sections + ~field:"start" + an + in + let depth_first = + Atd.Annot.get_field + ~parse:(fun s -> Some (bool_of_string s)) + ~default:false + ~sections + ~field:"depth" + an + in + Array { start_index; depth_first; } + +let get_www_cons default an = + Atd.Annot.get_field + ~parse:(fun s -> Some s) + ~default + ~sections + ~field:"name" + an + +let get_www_fname default an = + Atd.Annot.get_field + ~parse:(fun s -> Some s) + ~default + ~sections + ~field:"name" + an + +let get_www_record an = + { + www_record_adapter = get_www_adapter an; + } + +let tests = [ +] diff --git a/atdgen/src/www_form.mli b/atdgen/src/www_form.mli new file mode 100644 index 0000000..e788e7d --- /dev/null +++ b/atdgen/src/www_form.mli @@ -0,0 +1,75 @@ +(** + Mapping from ATD to WWW-form data +*) + +(** Association between languages and www adapter for that language. + The specification of each www adapter is language-specific. *) +type www_adapter = { + ocaml_adapter : string option; + (** A module implementing [normalize] and [restore]. *) +} + +val no_adapter : www_adapter + +type www_float = + | Float of int option (* max decimal places *) + | Int + +type www_list_array = { + start_index : int option; + depth_first : bool; +} + +type www_list = Array of www_list_array | Object + +type www_variant = { www_cons : string } + +type www_field = { + www_fname : string; (* *) + www_unwrapped : bool; +} + +type www_record = { + www_record_adapter : www_adapter; +} + +type www_sum = { + www_sum_adapter : www_adapter; + www_open_enum : bool; + www_lowercase_tags : bool; +} + +(** The different kinds of ATD nodes with their www-specific options. *) +type www_repr = + | Bool + | Cell + | Def + | External + | Field of www_field + | Float of www_float + | Int + | List of www_list + | Nullable + | Option + | Record of www_record + | String + | Sum of www_sum + | Tuple + | Unit + | Variant of www_variant + | Wrap + +val get_www_list : Atd.Annot.t -> www_list + +val get_www_float : Atd.Annot.t -> www_float + +val get_www_cons : string -> Atd.Annot.t -> string + +val get_www_fname : string -> Atd.Annot.t -> string + +val get_www_record : Atd.Annot.t -> www_record + +val get_www_sum : Atd.Annot.t -> www_sum + +val tests : (string * (unit -> bool)) list + diff --git a/atdgen/test/bucklescript/bucklespec_j.expected.ml b/atdgen/test/bucklescript/bucklespec_j.expected.ml index 989e229..b2cfcd5 100644 --- a/atdgen/test/bucklescript/bucklespec_j.expected.ml +++ b/atdgen/test/bucklescript/bucklespec_j.expected.ml @@ -62,42 +62,42 @@ type adapted = Bucklespec_t.adapted let rec write_mutual_recurse1 : _ -> mutual_recurse1 -> _ = ( fun ob (x : mutual_recurse1) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"mutual_recurse2\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"mutual_recurse2\":"; ( write_mutual_recurse2 ) ob x.mutual_recurse2; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) and string_of_mutual_recurse1 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_mutual_recurse1 ob x; - Bi_outbuf.contents ob + Buffer.contents ob and write_mutual_recurse2 : _ -> mutual_recurse2 -> _ = ( fun ob (x : mutual_recurse2) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"mutual_recurse1\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"mutual_recurse1\":"; ( write_mutual_recurse1 ) ob x.mutual_recurse1; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) and string_of_mutual_recurse2 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_mutual_recurse2 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let rec read_mutual_recurse1 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -119,7 +119,7 @@ let rec read_mutual_recurse1 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -150,7 +150,7 @@ let rec read_mutual_recurse1 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -170,7 +170,7 @@ let rec read_mutual_recurse1 = ( with Yojson.End_of_object -> ( ( { - mutual_recurse2 = (match !field_mutual_recurse2 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "mutual_recurse2"); + mutual_recurse2 = (match !field_mutual_recurse2 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "mutual_recurse2"); } : mutual_recurse1) ) @@ -198,7 +198,7 @@ and read_mutual_recurse2 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -229,7 +229,7 @@ and read_mutual_recurse2 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -249,7 +249,7 @@ and read_mutual_recurse2 = ( with Yojson.End_of_object -> ( ( { - mutual_recurse1 = (match !field_mutual_recurse1 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "mutual_recurse1"); + mutual_recurse1 = (match !field_mutual_recurse1 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "mutual_recurse1"); } : mutual_recurse2) ) @@ -257,35 +257,35 @@ and read_mutual_recurse2 = ( and mutual_recurse2_of_string s = read_mutual_recurse2 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let rec write__5 ob x = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( write_recurse ) ) ob x and string_of__5 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__5 ob x; - Bi_outbuf.contents ob + Buffer.contents ob and write_recurse : _ -> recurse -> _ = ( fun ob (x : recurse) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"recurse_items\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"recurse_items\":"; ( write__5 ) ob x.recurse_items; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) and string_of_recurse ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_recurse ob x; - Bi_outbuf.contents ob + Buffer.contents ob let rec read__5 p lb = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( read_recurse ) ) p lb @@ -312,7 +312,7 @@ and read_recurse = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -343,7 +343,7 @@ and read_recurse = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -363,7 +363,7 @@ and read_recurse = ( with Yojson.End_of_object -> ( ( { - recurse_items = (match !field_recurse_items with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "recurse_items"); + recurse_items = (match !field_recurse_items with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "recurse_items"); } : recurse) ) @@ -373,13 +373,13 @@ and recurse_of_string s = let write_variant2 : _ -> variant2 -> _ = ( fun ob x -> match x with - | A -> Bi_outbuf.add_string ob "\"A\"" - | C -> Bi_outbuf.add_string ob "\"C\"" + | A -> Buffer.add_string ob "\"A\"" + | C -> Buffer.add_string ob "\"C\"" ) let string_of_variant2 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_variant2 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_variant2 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -395,7 +395,7 @@ let read_variant2 = ( Yojson.Safe.read_gt p lb; (C : variant2) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with @@ -404,12 +404,12 @@ let read_variant2 = ( | "C" -> (C : variant2) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let variant2_of_string s = @@ -418,17 +418,17 @@ let write_variant1 : _ -> variant1 -> _ = ( fun ob x -> match x with | A x -> - Bi_outbuf.add_string ob "[\"A\","; + Buffer.add_string ob "[\"A\","; ( Yojson.Safe.write_string ) ob x; - Bi_outbuf.add_char ob ']' - | B -> Bi_outbuf.add_string ob "\"B\"" + Buffer.add_char ob ']' + | B -> Buffer.add_string ob "\"B\"" ) let string_of_variant1 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_variant1 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_variant1 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -436,9 +436,9 @@ let read_variant1 = ( | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with | "A" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; @@ -449,30 +449,30 @@ let read_variant1 = ( Yojson.Safe.read_gt p lb; (B : variant1) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "B" -> (B : variant1) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "A" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (A x : variant1) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let variant1_of_string s = @@ -481,11 +481,11 @@ let write_valid = ( Yojson.Safe.write_bool ) let string_of_valid ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_valid ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_valid = ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) let valid_of_string s = read_valid (Yojson.Safe.init_lexer ()) (Lexing.from_string s) @@ -493,22 +493,22 @@ let write_v2 : _ -> v2 -> _ = ( fun ob x -> match x with | V1_foo x -> - Bi_outbuf.add_string ob "[\"V1_foo\","; + Buffer.add_string ob "[\"V1_foo\","; ( Yojson.Safe.write_int ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' | V2_bar x -> - Bi_outbuf.add_string ob "[\"V2_bar\","; + Buffer.add_string ob "[\"V2_bar\","; ( Yojson.Safe.write_bool ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' ) let string_of_v2 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_v2 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_v2 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -516,39 +516,39 @@ let read_v2 = ( | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with | "V1_foo" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (V1_foo x : v2) | "V2_bar" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (V2_bar x : v2) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "V1_foo" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; @@ -559,14 +559,14 @@ let read_v2 = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (V2_bar x : v2) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let v2_of_string s = @@ -575,22 +575,22 @@ let write_v1 : _ -> v1 -> _ = ( fun ob x -> match x with | V1_foo x -> - Bi_outbuf.add_string ob "[\"V1_foo\","; + Buffer.add_string ob "[\"V1_foo\","; ( Yojson.Safe.write_bool ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' | V2_bar x -> - Bi_outbuf.add_string ob "[\"V2_bar\","; + Buffer.add_string ob "[\"V2_bar\","; ( Yojson.Safe.write_int ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' ) let string_of_v1 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_v1 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_v1 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -598,39 +598,39 @@ let read_v1 = ( | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with | "V1_foo" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (V1_foo x : v1) | "V2_bar" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (V2_bar x : v1) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "V1_foo" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb in Yojson.Safe.read_space p lb; @@ -641,57 +641,57 @@ let read_v1 = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (V2_bar x : v1) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let v1_of_string s = read_v1 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__6 = ( - Atdgen_runtime.Oj_run.write_assoc_list ( + Atdgen_www_runtime.Oj_run.write_assoc_list ( Yojson.Safe.write_string ) ( Yojson.Safe.write_int ) ) let string_of__6 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__6 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__6 = ( - Atdgen_runtime.Oj_run.read_assoc_list ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_assoc_list ( + Atdgen_www_runtime.Oj_run.read_string ) ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) ) let _6_of_string s = read__6 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_using_object : _ -> using_object -> _ = ( fun ob (x : using_object) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"f\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"f\":"; ( write__6 ) ob x.f; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_using_object ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_using_object ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_using_object = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -713,7 +713,7 @@ let read_using_object = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -744,7 +744,7 @@ let read_using_object = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -764,7 +764,7 @@ let read_using_object = ( with Yojson.End_of_object -> ( ( { - f = (match !field_f with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "f"); + f = (match !field_f with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "f"); } : using_object) ) @@ -775,23 +775,23 @@ let write_single_tuple = ( fun ob x -> match x with | `Single_tuple x -> - Bi_outbuf.add_string ob "[\"Single_tuple\","; + Buffer.add_string ob "[\"Single_tuple\","; ( fun ob x -> - Bi_outbuf.add_char ob '['; + Buffer.add_char ob '['; (let x = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ']'; + Buffer.add_char ob ']'; ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' ) let string_of_single_tuple ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_single_tuple ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_single_tuple = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -799,7 +799,7 @@ let read_single_tuple = ( | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with | "Single_tuple" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -810,7 +810,7 @@ let read_single_tuple = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -831,22 +831,22 @@ let read_single_tuple = ( ); (x0) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0 ]); ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; `Single_tuple x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Single_tuple" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -861,7 +861,7 @@ let read_single_tuple = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -882,14 +882,14 @@ let read_single_tuple = ( ); (x0) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0 ]); ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; `Single_tuple x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let single_tuple_of_string s = @@ -901,13 +901,13 @@ let write__2 = ( ) ob x) ) let string_of__2 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__2 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__2 = ( fun p lb -> let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in ( fun s -> `Id s ) x ) @@ -917,9 +917,9 @@ let write_id = ( write__2 ) let string_of_id ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_id ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_id = ( read__2 ) @@ -929,42 +929,42 @@ let write__3 = ( fun ob x -> match x with | `Foo x -> - Bi_outbuf.add_string ob "[\"Foo\","; + Buffer.add_string ob "[\"Foo\","; ( fun ob x -> - Bi_outbuf.add_char ob '['; + Buffer.add_char ob '['; (let x, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ']'; + Buffer.add_char ob ']'; ) ob x; - Bi_outbuf.add_char ob ']' - | `Bar -> Bi_outbuf.add_string ob "\"Bar\"" + Buffer.add_char ob ']' + | `Bar -> Buffer.add_string ob "\"Bar\"" | `Foobar x -> - Bi_outbuf.add_string ob "[\"Foobar\","; + Buffer.add_string ob "[\"Foobar\","; ( Yojson.Safe.write_null ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' | `Foo_id x -> - Bi_outbuf.add_string ob "[\"Foo_id\","; + Buffer.add_string ob "[\"Foo_id\","; ( write_id ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' ) let string_of__3 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__3 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__3 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -972,7 +972,7 @@ let read__3 = ( | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with | "Foo" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -983,7 +983,7 @@ let read__3 = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -994,7 +994,7 @@ let read__3 = ( let x1 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -1015,7 +1015,7 @@ let read__3 = ( ); (x0, x1) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); ) p lb in Yojson.Safe.read_space p lb; @@ -1026,16 +1026,16 @@ let read__3 = ( Yojson.Safe.read_gt p lb; `Bar | "Foobar" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_null + Atdgen_www_runtime.Oj_run.read_null ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; `Foobar x | "Foo_id" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read_id ) p lb @@ -1044,17 +1044,17 @@ let read__3 = ( Yojson.Safe.read_gt p lb; `Foo_id x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "Bar" -> `Bar | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Foo" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -1069,7 +1069,7 @@ let read__3 = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -1080,7 +1080,7 @@ let read__3 = ( let x1 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -1101,7 +1101,7 @@ let read__3 = ( ); (x0, x1) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); ) p lb in Yojson.Safe.read_space p lb; @@ -1112,7 +1112,7 @@ let read__3 = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_null + Atdgen_www_runtime.Oj_run.read_null ) p lb in Yojson.Safe.read_space p lb; @@ -1130,22 +1130,22 @@ let read__3 = ( Yojson.Safe.read_rbr p lb; `Foo_id x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let _3_of_string s = read__3 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__4 = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( write__3 ) ) let string_of__4 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__4 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__4 = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( read__3 ) ) @@ -1155,9 +1155,9 @@ let write_simple_vars = ( write__4 ) let string_of_simple_vars ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_simple_vars ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_simple_vars = ( read__4 ) @@ -1167,42 +1167,42 @@ let write_simple_var write__a = ( fun ob x -> match x with | `Foo x -> - Bi_outbuf.add_string ob "[\"Foo\","; + Buffer.add_string ob "[\"Foo\","; ( fun ob x -> - Bi_outbuf.add_char ob '['; + Buffer.add_char ob '['; (let x, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ']'; + Buffer.add_char ob ']'; ) ob x; - Bi_outbuf.add_char ob ']' - | `Bar -> Bi_outbuf.add_string ob "\"Bar\"" + Buffer.add_char ob ']' + | `Bar -> Buffer.add_string ob "\"Bar\"" | `Foobar x -> - Bi_outbuf.add_string ob "[\"Foobar\","; + Buffer.add_string ob "[\"Foobar\","; ( write__a ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' | `Foo_id x -> - Bi_outbuf.add_string ob "[\"Foo_id\","; + Buffer.add_string ob "[\"Foo_id\","; ( write_id ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' ) let string_of_simple_var write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_simple_var write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_simple_var read__a = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1210,7 +1210,7 @@ let read_simple_var read__a = ( | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with | "Foo" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1221,7 +1221,7 @@ let read_simple_var read__a = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -1232,7 +1232,7 @@ let read_simple_var read__a = ( let x1 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -1253,7 +1253,7 @@ let read_simple_var read__a = ( ); (x0, x1) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); ) p lb in Yojson.Safe.read_space p lb; @@ -1264,7 +1264,7 @@ let read_simple_var read__a = ( Yojson.Safe.read_gt p lb; `Bar | "Foobar" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read__a ) p lb @@ -1273,7 +1273,7 @@ let read_simple_var read__a = ( Yojson.Safe.read_gt p lb; `Foobar x | "Foo_id" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read_id ) p lb @@ -1282,17 +1282,17 @@ let read_simple_var read__a = ( Yojson.Safe.read_gt p lb; `Foo_id x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "Bar" -> `Bar | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Foo" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -1307,7 +1307,7 @@ let read_simple_var read__a = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -1318,7 +1318,7 @@ let read_simple_var read__a = ( let x1 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -1339,7 +1339,7 @@ let read_simple_var read__a = ( ); (x0, x1) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); ) p lb in Yojson.Safe.read_space p lb; @@ -1368,31 +1368,31 @@ let read_simple_var read__a = ( Yojson.Safe.read_rbr p lb; `Foo_id x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let simple_var_of_string read__a s = read_simple_var read__a (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_same_pair write__a = ( fun ob x -> - Bi_outbuf.add_char ob '['; + Buffer.add_char ob '['; (let x, _ = x in ( write__a ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x = x in ( write__a ) ob x ); - Bi_outbuf.add_char ob ']'; + Buffer.add_char ob ']'; ) let string_of_same_pair write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_same_pair write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_same_pair read__a = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1435,29 +1435,29 @@ let read_same_pair read__a = ( ); (x0, x1) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); ) let same_pair_of_string read__a s = read_same_pair read__a (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_record_json_name : _ -> record_json_name -> _ = ( fun ob (x : record_json_name) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"bar\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"bar\":"; ( Yojson.Safe.write_int ) ob x.foo; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_record_json_name ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_record_json_name ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_record_json_name = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1479,14 +1479,14 @@ let read_record_json_name = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_foo := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -1510,14 +1510,14 @@ let read_record_json_name = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_foo := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -1530,7 +1530,7 @@ let read_record_json_name = ( with Yojson.End_of_object -> ( ( { - foo = (match !field_foo with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "foo"); + foo = (match !field_foo with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "foo"); } : record_json_name) ) @@ -1539,36 +1539,36 @@ let record_json_name_of_string s = read_record_json_name (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_point = ( fun ob x -> - Bi_outbuf.add_char ob '['; + Buffer.add_char ob '['; (let x, _, _, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x, _, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, x, _ = x in ( Yojson.Safe.write_string ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, _, x = x in ( Yojson.Safe.write_null ) ob x ); - Bi_outbuf.add_char ob ']'; + Buffer.add_char ob ']'; ) let string_of_point ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_point ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_point = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1579,7 +1579,7 @@ let read_point = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -1590,7 +1590,7 @@ let read_point = ( let x1 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -1601,7 +1601,7 @@ let read_point = ( let x2 = let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in incr len; @@ -1612,7 +1612,7 @@ let read_point = ( let x3 = let x = ( - Atdgen_runtime.Oj_run.read_null + Atdgen_www_runtime.Oj_run.read_null ) p lb in incr len; @@ -1633,19 +1633,19 @@ let read_point = ( ); (x0, x1, x2, x3) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3 ]); ) let point_of_string s = read_point (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_param_similar write__a : _ -> 'a param_similar -> _ = ( fun ob (x : 'a param_similar) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"data\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"data\":"; ( write__a ) @@ -1653,18 +1653,18 @@ let write_param_similar write__a : _ -> 'a param_similar -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"something\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"something\":"; ( Yojson.Safe.write_int ) ob x.something; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_param_similar write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_param_similar write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_param_similar read__a = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1701,7 +1701,7 @@ let read_param_similar read__a = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -1716,7 +1716,7 @@ let read_param_similar read__a = ( field_something := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -1754,7 +1754,7 @@ let read_param_similar read__a = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -1769,7 +1769,7 @@ let read_param_similar read__a = ( field_something := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -1782,8 +1782,8 @@ let read_param_similar read__a = ( with Yojson.End_of_object -> ( ( { - data = (match !field_data with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "data"); - something = (match !field_something with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "something"); + data = (match !field_data with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "data"); + something = (match !field_something with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "something"); } : 'a param_similar) ) @@ -1792,13 +1792,13 @@ let param_similar_of_string read__a s = read_param_similar read__a (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_param write__a : _ -> 'a param -> _ = ( fun ob (x : 'a param) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"data\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"data\":"; ( write__a ) @@ -1806,18 +1806,18 @@ let write_param write__a : _ -> 'a param -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"nothing\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"nothing\":"; ( Yojson.Safe.write_null ) ob x.nothing; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_param write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_param write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_param read__a = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1854,7 +1854,7 @@ let read_param read__a = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -1869,7 +1869,7 @@ let read_param read__a = ( field_nothing := ( Some ( ( - Atdgen_runtime.Oj_run.read_null + Atdgen_www_runtime.Oj_run.read_null ) p lb ) ); @@ -1907,7 +1907,7 @@ let read_param read__a = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -1922,7 +1922,7 @@ let read_param read__a = ( field_nothing := ( Some ( ( - Atdgen_runtime.Oj_run.read_null + Atdgen_www_runtime.Oj_run.read_null ) p lb ) ); @@ -1935,8 +1935,8 @@ let read_param read__a = ( with Yojson.End_of_object -> ( ( { - data = (match !field_data with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "data"); - nothing = (match !field_nothing with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "nothing"); + data = (match !field_data with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "data"); + nothing = (match !field_nothing with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "nothing"); } : 'a param) ) @@ -1945,13 +1945,13 @@ let param_of_string read__a s = read_param read__a (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_pair write__a write__b : _ -> ('a, 'b) pair -> _ = ( fun ob (x : ('a, 'b) pair) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"left\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"left\":"; ( write__a ) @@ -1959,18 +1959,18 @@ let write_pair write__a write__b : _ -> ('a, 'b) pair -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"right\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"right\":"; ( write__b ) ob x.right; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_pair write__a write__b ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_pair write__a write__b ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_pair read__a read__b = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -2007,7 +2007,7 @@ let read_pair read__a read__b = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -2060,7 +2060,7 @@ let read_pair read__a read__b = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -2088,8 +2088,8 @@ let read_pair read__a read__b = ( with Yojson.End_of_object -> ( ( { - left = (match !field_left with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "left"); - right = (match !field_right with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "right"); + left = (match !field_left with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "left"); + right = (match !field_right with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "right"); } : ('a, 'b) pair) ) @@ -2097,16 +2097,16 @@ let read_pair read__a read__b = ( let pair_of_string read__a read__b s = read_pair read__a read__b (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__1 write__a write__b = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( write_pair write__a write__a ) ) let string_of__1 write__a write__b ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__1 write__a write__b ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__1 read__a read__b = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( read_pair read__a read__a ) ) @@ -2116,9 +2116,9 @@ let write_pairs write__a = ( write__1 write__a write__a ) let string_of_pairs write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_pairs write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_pairs read__a = ( read__1 read__a read__a ) @@ -2128,23 +2128,23 @@ let write_label = ( Yojson.Safe.write_string ) let string_of_label ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_label ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_label = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) let label_of_string s = read_label (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_labeled : _ -> labeled -> _ = ( fun ob (x : labeled) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"flag\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"flag\":"; ( write_valid ) @@ -2152,8 +2152,8 @@ let write_labeled : _ -> labeled -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"lb\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"lb\":"; ( write_label ) @@ -2161,18 +2161,18 @@ let write_labeled : _ -> labeled -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"count\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"count\":"; ( Yojson.Safe.write_int ) ob x.count; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_labeled ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_labeled ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_labeled = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -2218,7 +2218,7 @@ let read_labeled = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -2241,7 +2241,7 @@ let read_labeled = ( field_count := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -2287,7 +2287,7 @@ let read_labeled = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -2310,7 +2310,7 @@ let read_labeled = ( field_count := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -2323,9 +2323,9 @@ let read_labeled = ( with Yojson.End_of_object -> ( ( { - flag = (match !field_flag with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "flag"); - lb = (match !field_lb with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "lb"); - count = (match !field_count with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "count"); + flag = (match !field_flag with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "flag"); + lb = (match !field_lb with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "lb"); + count = (match !field_count with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "count"); } : labeled) ) @@ -2336,9 +2336,9 @@ let write_from_module_a = ( A_j.write_from_module_a ) let string_of_from_module_a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_from_module_a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_from_module_a = ( A_j.read_from_module_a ) @@ -2346,23 +2346,23 @@ let from_module_a_of_string s = read_from_module_a (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_b : _ -> b -> _ = ( fun ob (x : b) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"thing\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"thing\":"; ( Yojson.Safe.write_int ) ob x.thing; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_b ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_b ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_b = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -2384,14 +2384,14 @@ let read_b = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_thing := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -2415,14 +2415,14 @@ let read_b = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_thing := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -2435,7 +2435,7 @@ let read_b = ( with Yojson.End_of_object -> ( ( { - thing = (match !field_thing with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "thing"); + thing = (match !field_thing with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "thing"); } : b) ) @@ -2444,13 +2444,13 @@ let b_of_string s = read_b (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_a : _ -> a -> _ = ( fun ob (x : a) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"thing\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"thing\":"; ( Yojson.Safe.write_string ) @@ -2458,18 +2458,18 @@ let write_a : _ -> a -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"other_thing\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"other_thing\":"; ( Yojson.Safe.write_bool ) ob x.other_thing; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_a = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -2506,14 +2506,14 @@ let read_a = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_thing := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -2521,7 +2521,7 @@ let read_a = ( field_other_thing := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -2559,14 +2559,14 @@ let read_a = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_thing := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -2574,7 +2574,7 @@ let read_a = ( field_other_thing := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -2587,8 +2587,8 @@ let read_a = ( with Yojson.End_of_object -> ( ( { - thing = (match !field_thing with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "thing"); - other_thing = (match !field_other_thing with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "other_thing"); + thing = (match !field_thing with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "thing"); + other_thing = (match !field_other_thing with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "other_thing"); } : a) ) @@ -2596,36 +2596,36 @@ let read_a = ( let a_of_string s = read_a (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_adapted = ( - Atdgen_runtime.Oj_run.write_with_adapter Atdgen_codec_runtime.Json_adapter.Type_field.restore ( + Atdgen_www_runtime.Oj_run.write_with_adapter Atdgen_codec_runtime.Json_adapter.Type_field.restore ( fun ob x -> match x with | `A x -> - Bi_outbuf.add_string ob "[\"A\","; + Buffer.add_string ob "[\"A\","; ( write_a ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' | `B x -> - Bi_outbuf.add_string ob "[\"B\","; + Buffer.add_string ob "[\"B\","; ( write_b ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' ) ) let string_of_adapted ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_adapted ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_adapted = ( - Atdgen_runtime.Oj_run.read_with_adapter Atdgen_codec_runtime.Json_adapter.Type_field.normalize ( + Atdgen_www_runtime.Oj_run.read_with_adapter Atdgen_codec_runtime.Json_adapter.Type_field.normalize ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with | "A" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read_a ) p lb @@ -2634,7 +2634,7 @@ let read_adapted = ( Yojson.Safe.read_gt p lb; `A x | "B" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read_b ) p lb @@ -2643,15 +2643,15 @@ let read_adapted = ( Yojson.Safe.read_gt p lb; `B x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "A" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -2675,7 +2675,7 @@ let read_adapted = ( Yojson.Safe.read_rbr p lb; `B x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) ) diff --git a/atdgen/test/bucklescript/dune b/atdgen/test/bucklescript/dune index 1820841..548cae5 100644 --- a/atdgen/test/bucklescript/dune +++ b/atdgen/test/bucklescript/dune @@ -1,17 +1,17 @@ (rule (targets bucklespec_bs.ml bucklespec_bs.mli) (deps bucklespec.atd) - (action (run atdgen %{deps} -bs))) + (action (run atdgen-www %{deps} -bs))) (rule (targets bucklespec_t.ml bucklespec_t.mli) (deps bucklespec.atd) - (action (run atdgen %{deps} -t))) + (action (run atdgen-www %{deps} -t))) (rule (targets bucklespec_j.ml bucklespec_j.mli) (deps bucklespec.atd) - (action (run atdgen %{deps} -j -j-std))) + (action (run atdgen-www %{deps} -j -j-std))) (library (name bucklespec_types) @@ -28,24 +28,24 @@ (executable (name bucklespec_roundtrip) (modules bucklespec_roundtrip bucklespec_j a_j) - (libraries bucklespec_types bucklespec_bs atdgen-runtime atdgen-codec-runtime biniou yojson)) + (libraries bucklespec_types bucklespec_bs atdgen-www-runtime atdgen-codec-runtime biniou yojson)) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff bucklespec_bs.expected.ml bucklespec_bs.ml))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff bucklespec_bs.expected.mli bucklespec_bs.mli))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff bucklespec_j.expected.ml bucklespec_j.ml))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (run ./bucklespec_roundtrip.exe))) diff --git a/atdgen/test/dune b/atdgen/test/dune index d1730a0..d50681b 100644 --- a/atdgen/test/dune +++ b/atdgen/test/dune @@ -1,31 +1,31 @@ (rule (targets test.ml test.mli) (deps test.atd) - (action (run %{bin:atdgen} %{deps}))) + (action (run %{bin:atdgen-www} %{deps}))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test.expected.ml test.ml))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test.expected.mli test.mli))) (rule (targets test2.ml test2.mli) (deps test2.atd) - (action (run %{bin:atdgen} -open Test %{deps}))) + (action (run %{bin:atdgen-www} -open Test %{deps}))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test2.expected.ml test2.ml))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test2.expected.mli test2.mli))) (rule @@ -33,7 +33,7 @@ (deps (:atd test.atd) test.ml test.mli) (action (run - %{bin:atdgen} -json -extend Test -j-custom-fields + %{bin:atdgen-www} -json -extend Test -j-custom-fields "fun loc s -> Printf.eprintf \"Warning: skipping field %s (def: %s)\n\" s loc" %{atd} -o testj))) @@ -41,262 +41,262 @@ (rule (targets test_unit_biniou_b.ml test_unit_biniou_b.mli) (deps test_unit_biniou.atd) - (action (run %{bin:atdgen} -b %{deps}))) + (action (run %{bin:atdgen-www} -b %{deps}))) (rule (targets test_unit_biniou_t.ml test_unit_biniou_t.mli) (deps test_unit_biniou.atd) - (action (run %{bin:atdgen} -t %{deps}))) + (action (run %{bin:atdgen-www} -t %{deps}))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff testj.expected.ml testj.ml))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff testj.expected.mli testj.mli))) (rule (targets test2j.ml test2j.mli) (deps test2.atd) (action - (run %{bin:atdgen} -json -std-json -o test2j -open Test,Test2,Testj -ntd %{deps}))) + (run %{bin:atdgen-www} -json -std-json -o test2j -open Test,Test2,Testj -ntd %{deps}))) (rule (targets test_ambiguous_record_t.ml test_ambiguous_record_t.mli) (deps test_ambiguous_record.atd) (action - (run %{bin:atdgen} -t %{deps}))) + (run %{bin:atdgen-www} -t %{deps}))) (rule (targets test_ambiguous_record_j.ml test_ambiguous_record_j.mli) (deps test_ambiguous_record.atd) (action - (run %{bin:atdgen} -json -std-json -o test_ambiguous_record_j -open Test_ambiguous_record_t -ntd %{deps}))) + (run %{bin:atdgen-www} -json -std-json -o test_ambiguous_record_j -open Test_ambiguous_record_t -ntd %{deps}))) (rule (targets test_polymorphic_wrap_t.ml test_polymorphic_wrap_t.mli) (deps test_polymorphic_wrap.atd) (action - (run %{bin:atdgen} -t %{deps}))) + (run %{bin:atdgen-www} -t %{deps}))) (rule (targets test_polymorphic_wrap_j.ml test_polymorphic_wrap_j.mli) (deps test_polymorphic_wrap.atd) (action - (run %{bin:atdgen} -json -std-json -o test_polymorphic_wrap_j %{deps}))) + (run %{bin:atdgen-www} -json -std-json -o test_polymorphic_wrap_j %{deps}))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test2j.expected.ml test2j.ml))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test2j.expected.mli test2j.mli))) (rule (targets test3j_t.ml test3j_t.mli) (deps test3j.atd) - (action (run %{bin:atdgen} -t %{deps}))) + (action (run %{bin:atdgen-www} -t %{deps}))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test3j_t.expected.ml test3j_t.ml))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test3j_t.expected.mli test3j_t.mli))) (rule (targets test3j_j.ml test3j_j.mli) (deps test3j.atd) - (action (run %{bin:atdgen} -j -j-std %{deps}))) + (action (run %{bin:atdgen-www} -j -j-std %{deps}))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test3j_j.expected.ml test3j_j.ml))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test3j_j.expected.mli test3j_j.mli))) (rule (targets testjstd.ml testjstd.mli) (deps test.atd) - (action (run %{bin:atdgen} -std-json -extend Test test.atd -o testjstd))) + (action (run %{bin:atdgen-www} -std-json -extend Test test.atd -o testjstd))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff testjstd.expected.ml testjstd.ml))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff testjstd.expected.mli testjstd.mli))) (rule (targets testv.ml testv.mli) (deps test.atd) - (action (run %{bin:atdgen} -validate -extend Test test.atd -o testv))) + (action (run %{bin:atdgen-www} -validate -extend Test test.atd -o testv))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff testv.expected.ml testv.ml))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff testv.expected.mli testv.mli))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_ambiguous_record_j.expected.ml test_ambiguous_record_j.ml))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_polymorphic_wrap_t.expected.ml test_polymorphic_wrap_t.ml))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_polymorphic_wrap_j.expected.ml test_polymorphic_wrap_j.ml))) (rule (targets test_annot_t.ml test_annot_t.mli) (deps test_annot.atd) - (action (run %{bin:atdgen} -t %{deps}))) + (action (run %{bin:atdgen-www} -t %{deps}))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_annot_t.expected.ml test_annot_t.ml))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_annot_t.expected.mli test_annot_t.mli))) (rule (targets test_annot_j.ml test_annot_j.mli) (deps test_annot.atd) - (action (run %{bin:atdgen} -j -j-std %{deps}))) + (action (run %{bin:atdgen-www} -j -j-std %{deps}))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_annot_j.expected.ml test_annot_j.ml))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_annot_j.expected.mli test_annot_j.mli))) (rule (targets test_annot_error.stderr) - (deps (:atd test_annot_error.atd) %{bin:atdgen}) + (deps (:atd test_annot_error.atd) %{bin:atdgen-www}) (action (with-stderr-to test_annot_error.stderr (with-stdout-to test_annot_error.stdout - (bash "%{bin:atdgen} -t %{atd} || echo 'Failed succesfully!'"))))) + (bash "%{bin:atdgen-www} -t %{atd} || echo 'Failed succesfully!'"))))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_annot_error.expected.stderr test_annot_error.stderr))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_annot_error.expected.stdout test_annot_error.stdout))) ;; inline records are not allowed within poly variant, but allowed in classic (rule (targets test_poly_inline_record_error.stderr) - (deps (:atd test_poly_inline_record_error.atd) %{bin:atdgen}) + (deps (:atd test_poly_inline_record_error.atd) %{bin:atdgen-www}) (action (with-stderr-to test_poly_inline_record_error.stderr (with-stdout-to test_poly_inline_record_error.stdout - (bash "%{bin:atdgen} -t %{atd} || echo 'Failed succesfully!'"))))) + (bash "%{bin:atdgen-www} -t %{atd} || echo 'Failed succesfully!'"))))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_poly_inline_record_error.expected.stderr test_poly_inline_record_error.stderr))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_poly_inline_record_error.expected.stdout test_poly_inline_record_error.stdout))) (rule (targets test_classic_inline_record_t.ml test_classic_inline_record_t.mli) (deps test_classic_inline_record.atd) - (action (run %{bin:atdgen} -t %{deps}))) + (action (run %{bin:atdgen-www} -t %{deps}))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_classic_inline_record_t.expected.ml test_classic_inline_record_t.ml))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_classic_inline_record_t.expected.mli test_classic_inline_record_t.mli))) ;; OCaml keywords cannot be used as type names or record field names (rule (targets test_ocaml_keyword_error1.stderr) - (deps (:atd test_ocaml_keyword_error1.atd) %{bin:atdgen}) + (deps (:atd test_ocaml_keyword_error1.atd) %{bin:atdgen-www}) (action (with-stderr-to test_ocaml_keyword_error1.stderr (with-stdout-to test_ocaml_keyword_error1.stdout - (bash "%{bin:atdgen} -t %{atd} || echo 'Failed succesfully!'"))))) + (bash "%{bin:atdgen-www} -t %{atd} || echo 'Failed succesfully!'"))))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_ocaml_keyword_error1.expected.stderr test_ocaml_keyword_error1.stderr))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_ocaml_keyword_error1.expected.stdout test_ocaml_keyword_error1.stdout))) (rule (targets test_ocaml_keyword_error2.stderr) - (deps (:atd test_ocaml_keyword_error2.atd) %{bin:atdgen}) + (deps (:atd test_ocaml_keyword_error2.atd) %{bin:atdgen-www}) (action (with-stderr-to test_ocaml_keyword_error2.stderr (with-stdout-to test_ocaml_keyword_error2.stdout - (bash "%{bin:atdgen} -t %{atd} || echo 'Failed succesfully!'"))))) + (bash "%{bin:atdgen-www} -t %{atd} || echo 'Failed succesfully!'"))))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_ocaml_keyword_error2.expected.stderr test_ocaml_keyword_error2.stderr))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff test_ocaml_keyword_error2.expected.stdout test_ocaml_keyword_error2.stdout))) (executables - (libraries atd atdgen-runtime biniou yojson) + (libraries atd atdgen-www-runtime biniou yojson) (names test_atdgen_main) (modules test @@ -319,5 +319,5 @@ (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (run ./test_atdgen_main.exe))) diff --git a/atdgen/test/spec_js/dune b/atdgen/test/spec_js/dune index 13e0e71..29d436a 100644 --- a/atdgen/test/spec_js/dune +++ b/atdgen/test/spec_js/dune @@ -1,40 +1,50 @@ (library (name spec_js) - (modules spec_t spec_j spec_js spec_bs) - (libraries atdgen-runtime atdgen-codec-runtime biniou yojson)) + (modules spec_t spec_j spec_js spec_bs spec_w) + (libraries atdgen-www-runtime atdgen-codec-runtime biniou yojson)) (rule (targets spec_t.ml spec_t.mli) (deps spec.atd) - (action (run atdgen %{deps} -t))) + (action (run atdgen-www %{deps} -t))) (rule (targets spec_j.ml spec_j.mli) (deps spec.atd) - (action (run atdgen %{deps} -j -j-std))) + (action (run atdgen-www %{deps} -j -j-std))) (rule (targets spec_bs.ml spec_bs.mli) (deps spec.atd) - (action (run atdgen %{deps} -bs))) + (action (run atdgen-www %{deps} -bs))) + +(rule + (targets spec_w.ml spec_w.mli) + (deps spec.atd) + (action (run atdgen-www %{deps} -w))) (executable (name test_j) (modules test_j) - (libraries spec_js atdgen-runtime yojson)) + (libraries spec_js atdgen-www-runtime yojson)) (executable (name test_bs) (modules test_bs) (libraries spec_js atdgen-codec-runtime yojson)) +(executable + (name test_w) + (modules test_w) + (libraries spec_js atdgen-www-runtime yojson)) + (rule (targets spec_j.json) (action (with-stdout-to %{targets} (run ./test_j.exe)))) (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff spec_j.expected.json spec_j.json))) (rule @@ -43,5 +53,13 @@ (alias (name runtest) - (package atdgen) + (package atdgen-www) (action (diff spec_bs.expected.json spec_bs.json))) + +(rule + (targets spec_w.json) + (action (with-stdout-to %{targets} (run ./test_w.exe)))) + +(alias + (name runtest) + (action (diff spec_w.expected.json spec_w.json))) diff --git a/atdgen/test/spec_js/spec_js.ml b/atdgen/test/spec_js/spec_js.ml index e50fdbd..b7419cd 100644 --- a/atdgen/test/spec_js/spec_js.ml +++ b/atdgen/test/spec_js/spec_js.ml @@ -1,5 +1,6 @@ module Bs = Spec_bs module J = Spec_j +module W = Spec_w open Spec_t diff --git a/atdgen/test/spec_js/spec_w.expected.json b/atdgen/test/spec_js/spec_w.expected.json new file mode 100644 index 0000000..5d324ed --- /dev/null +++ b/atdgen/test/spec_js/spec_w.expected.json @@ -0,0 +1,48 @@ +[ + { "r1": "testing" }, + { "r2": "2" }, + {}, + { "r3": "3" }, + {}, + { "r4": "true" }, + { "r5": "5" }, + {}, + { "r6": "6" }, + {}, + { "r7": "-1000" }, + { "r8[]": "1", "r8[]": "2", "r8[]": "3" }, + { "[]": "foo", "[]": "bar" }, + {}, + {}, + { "[]": "1", "[]": "2", "[]": "3" }, + { "": "99" }, + { "[]": "foo", "[]": "7", "[]": "bar", "[]": "8", "[]": "baz", "[]": "43" }, + { + "[]": "foo2", + "[]": "5", + "[]": "bar2", + "[]": "6", + "[]": "baz2", + "[]": "41", + "[]": "42", + "[]": "42" + }, + { "": "100", "": "foo" }, + { "": "100", "": "200", "": "42" }, + { "": "100", "": "200", "": "-1" }, + { + "[]": "V1", + "[]": "V2", + "[][]": "V3", + "[][]": "testing", + "[][]": "V4", + "[][]": "255", + "[][]": "V5", + "[][]": "V5", + "[][]": "true" + }, + { "v2": "A" }, + { "v2[]": "B", "v2[]": "100" }, + { "[]": "C1", "[][]": "C2", "[][]": "true", "[][]": "C2", "[][]": "false" }, + { "[]": "50", "[]": "30", "[]": "1", "[]": "100" } +] \ No newline at end of file diff --git a/atdgen/test/spec_js/test_w.ml b/atdgen/test/spec_js/test_w.ml new file mode 100644 index 0000000..7ddfda8 --- /dev/null +++ b/atdgen/test/spec_js/test_w.ml @@ -0,0 +1,32 @@ +open Spec_js.W + +let make f x = + let x = f x in + let x = List.map (fun (k, v) -> k, `String v) x in + `Assoc x + +module M = Spec_js.Make(struct + let r1 = make www_form_of_r1 + let r2 = make www_form_of_r2 + let r3 = make www_form_of_r3 + let r4 = make www_form_of_r4 + let r5 = make www_form_of_r5 + let r6 = make www_form_of_r6 + let r7 = make www_form_of_r7 + let r8 = make www_form_of_r8 + let j1 = make www_form_of_j1 + let j2 = make www_form_of_j2 + let j3 = make www_form_of_j3 + let j4 = make www_form_of_j4 + let o1 = make www_form_of_o1 + let o2 = make www_form_of_o2 + let t1 = make www_form_of_t1 + let t2 = make www_form_of_t2 + let v1list = make www_form_of_v1list + let v2 = make www_form_of_v2 + let v3list = make www_form_of_v3list + let ages = make www_form_of_ages + end) + +let () = M.run() + diff --git a/atdgen/test/test.atd b/atdgen/test/test.atd index 64b741c..6435d35 100644 --- a/atdgen/test/test.atd +++ b/atdgen/test/test.atd @@ -33,7 +33,7 @@ type p = type star_rating = int @@ -105,7 +105,7 @@ type extended = { b1 : bool ; + if x = false then None else Some (Atdgen_www_runtime.Util.Validation.error path)">; b2 : string; ?b3 : string option; b4 : string option; @@ -113,11 +113,11 @@ type extended = { } + else Some (Atdgen_www_runtime.Util.Validation.error path)"> type val1 = { val1_x : int } + Some (Atdgen_www_runtime.Util.Validation.error path)"> } type val2 = { val2_x : val1; ?val2_y : val1 option; @@ -127,7 +127,7 @@ type base_tuple = (int * float) + else Some (Atdgen_www_runtime.Util.Validation.error ~msg:\"i < f\" path)"> type extended_tuple = (int * float @@ -137,7 +137,7 @@ type extended_tuple = * : string list) type option_validation = - int + int option type ('x, 'y) poly = { diff --git a/atdgen/test/test.expected.ml b/atdgen/test/test.expected.ml index b58c619..2953eca 100644 --- a/atdgen/test/test.expected.ml +++ b/atdgen/test/test.expected.ml @@ -35,11 +35,11 @@ type mixed_record = { field1: float option; field2: string option; field3: Int64.t; - field4: float Atdgen_runtime.Util.ocaml_array; + field4: float Atdgen_www_runtime.Util.ocaml_array; field5: bool option; field6: string option; field7: test_variant; - field8: string Atdgen_runtime.Util.ocaml_array; + field8: string Atdgen_www_runtime.Util.ocaml_array; field9: (int * int * Char.t * int * Int32.t * Int64.t); field10: bool; field11: bool; @@ -50,8 +50,8 @@ type mixed_record = { type mixed = ( - mixed_record Atdgen_runtime.Util.ocaml_array - * mixed_record Atdgen_runtime.Util.ocaml_array + mixed_record Atdgen_www_runtime.Util.ocaml_array + * mixed_record Atdgen_www_runtime.Util.ocaml_array ) list type test = { @@ -90,7 +90,7 @@ type intopt = int option type int_assoc_list = (string * int) list -type int_assoc_array = (string * int) Atdgen_runtime.Util.ocaml_array +type int_assoc_array = (string * int) Atdgen_www_runtime.Util.ocaml_array type int8 = int @@ -153,7 +153,7 @@ type base_tuple = (int * float) type base = { b0: int; b1: bool } -type 'a array = 'a Atdgen_runtime.Util.ocaml_array +type 'a array = 'a Atdgen_www_runtime.Util.ocaml_array type 'a abs3 = 'a list @@ -163,7 +163,7 @@ type 'a abs1 = 'a list let _19_tag = Bi_io.array_tag let write_untagged__19 _a_tag write_untagged__a write__a = ( - Atdgen_runtime.Ob_run.write_untagged_list + Atdgen_www_runtime.Ob_run.write_untagged_list _a_tag ( write_untagged__a @@ -177,12 +177,12 @@ let string_of__19 _a_tag write_untagged__a write__a ?(len = 1024) x = write__19 _a_tag write_untagged__a write__a ob x; Bi_outbuf.contents ob let get__19_reader get__a_reader read__a = ( - Atdgen_runtime.Ob_run.get_list_reader ( + Atdgen_www_runtime.Ob_run.get_list_reader ( get__a_reader ) ) let read__19 get__a_reader read__a = ( - Atdgen_runtime.Ob_run.read_list ( + Atdgen_www_runtime.Ob_run.read_list ( get__a_reader ) ) @@ -213,7 +213,7 @@ and string_of_p' _a_tag write_untagged__a write__a ?(len = 1024) x = Bi_outbuf.contents ob let rec get_p'_reader get__a_reader read__a = ( fun tag -> - if tag <> 23 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 23 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> Bi_io.read_hashtag ib (fun ib h has_arg -> match h, has_arg with @@ -228,12 +228,12 @@ let rec get_p'_reader get__a_reader read__a = ( read__a ) ib ) : 'a p') - | _ -> Atdgen_runtime.Ob_run.unsupported_variant h has_arg + | _ -> Atdgen_www_runtime.Ob_run.unsupported_variant h has_arg ) ) and read_p' get__a_reader read__a = ( fun ib -> - if Bi_io.read_tag ib <> 23 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 23 then Atdgen_www_runtime.Ob_run.read_error_at ib; Bi_io.read_hashtag ib (fun ib h has_arg -> match h, has_arg with | 65, false -> (A : 'a p') @@ -247,7 +247,7 @@ and read_p' get__a_reader read__a = ( read__a ) ib ) : 'a p') - | _ -> Atdgen_runtime.Ob_run.unsupported_variant h has_arg + | _ -> Atdgen_www_runtime.Ob_run.unsupported_variant h has_arg ) ) and p'_of_string get__a_reader read__a ?pos s = @@ -297,7 +297,7 @@ and string_of_r ?(len = 1024) x = Bi_outbuf.contents ob let rec get_p_reader = ( fun tag -> - if tag <> 23 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 23 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> Bi_io.read_hashtag ib (fun ib h has_arg -> match h, has_arg with @@ -308,12 +308,12 @@ let rec get_p_reader = ( ) ib )) | 67, false -> `C - | _ -> Atdgen_runtime.Ob_run.unsupported_variant h has_arg + | _ -> Atdgen_www_runtime.Ob_run.unsupported_variant h has_arg ) ) and read_p = ( fun ib -> - if Bi_io.read_tag ib <> 23 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 23 then Atdgen_www_runtime.Ob_run.read_error_at ib; Bi_io.read_hashtag ib (fun ib h has_arg -> match h, has_arg with | 65, false -> `A @@ -323,14 +323,14 @@ and read_p = ( ) ib )) | 67, false -> `C - | _ -> Atdgen_runtime.Ob_run.unsupported_variant h has_arg + | _ -> Atdgen_www_runtime.Ob_run.unsupported_variant h has_arg ) ) and p_of_string ?pos s = read_p (Bi_inbuf.from_string ?pos s) and get_r_reader = ( fun tag -> - if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 21 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let field_a = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_b = ref (Obj.magic (Sys.opaque_identity 0.0)) in @@ -342,14 +342,14 @@ and get_r_reader = ( | 97 -> field_a := ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ); bits0 := !bits0 lor 0x1; | 98 -> field_b := ( ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib ); bits0 := !bits0 lor 0x2; @@ -362,7 +362,7 @@ and get_r_reader = ( bits0 := !bits0 lor 0x4; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x7 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "a"; "b"; "c" |]; + if !bits0 <> 0x7 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "a"; "b"; "c" |]; ( { a = !field_a; @@ -373,7 +373,7 @@ and get_r_reader = ( ) and read_r = ( fun ib -> - if Bi_io.read_tag ib <> 21 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 21 then Atdgen_www_runtime.Ob_run.read_error_at ib; let field_a = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_b = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_c = ref (Obj.magic (Sys.opaque_identity 0.0)) in @@ -384,14 +384,14 @@ and read_r = ( | 97 -> field_a := ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ); bits0 := !bits0 lor 0x1; | 98 -> field_b := ( ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib ); bits0 := !bits0 lor 0x2; @@ -404,7 +404,7 @@ and read_r = ( bits0 := !bits0 lor 0x4; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x7 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "a"; "b"; "c" |]; + if !bits0 <> 0x7 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "a"; "b"; "c" |]; ( { a = !field_a; @@ -417,7 +417,7 @@ and r_of_string ?pos s = read_r (Bi_inbuf.from_string ?pos s) let rec _20_tag = Bi_io.num_variant_tag and write_untagged__20 _a_tag write_untagged__a write__a _b_tag write_untagged__b write__b ob x = ( - Atdgen_runtime.Ob_run.write_untagged_option ( + Atdgen_www_runtime.Ob_run.write_untagged_option ( write_poly _a_tag write_untagged__a write__a _b_tag write_untagged__b write__b ) ) ob x @@ -450,7 +450,7 @@ and string_of_poly _x_tag write_untagged__x write__x _y_tag write_untagged__y wr Bi_outbuf.contents ob let rec get__20_reader get__a_reader read__a get__b_reader read__b = ( fun tag -> - if tag <> 22 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 22 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> match Char.code (Bi_inbuf.read_char ib) with | 0 -> None @@ -461,11 +461,11 @@ let rec get__20_reader get__a_reader read__a get__b_reader read__b = ( ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) and read__20 get__a_reader read__a get__b_reader read__b = ( fun ib -> - if Bi_io.read_tag ib <> 22 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 22 then Atdgen_www_runtime.Ob_run.read_error_at ib; match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> @@ -475,13 +475,13 @@ and read__20 get__a_reader read__a get__b_reader read__b = ( ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) and _20_of_string get__a_reader read__a get__b_reader read__b ?pos s = read__20 get__a_reader read__a get__b_reader read__b (Bi_inbuf.from_string ?pos s) and get_poly_reader get__x_reader read__x get__y_reader read__y = ( fun tag -> - if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 21 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let field_fst = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_snd = ref (Obj.magic (Sys.opaque_identity 0.0)) in @@ -505,7 +505,7 @@ and get_poly_reader get__x_reader read__x get__y_reader read__y = ( bits0 := !bits0 lor 0x2; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x3 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "fst"; "snd" |]; + if !bits0 <> 0x3 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "fst"; "snd" |]; ( { fst = !field_fst; @@ -515,7 +515,7 @@ and get_poly_reader get__x_reader read__x get__y_reader read__y = ( ) and read_poly get__x_reader read__x get__y_reader read__y = ( fun ib -> - if Bi_io.read_tag ib <> 21 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 21 then Atdgen_www_runtime.Ob_run.read_error_at ib; let field_fst = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_snd = ref (Obj.magic (Sys.opaque_identity 0.0)) in let bits0 = ref 0 in @@ -538,7 +538,7 @@ and read_poly get__x_reader read__x get__y_reader read__y = ( bits0 := !bits0 lor 0x2; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x3 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "fst"; "snd" |]; + if !bits0 <> 0x3 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "fst"; "snd" |]; ( { fst = !field_fst; @@ -550,7 +550,7 @@ and poly_of_string get__x_reader read__x get__y_reader read__y ?pos s = read_poly get__x_reader read__x get__y_reader read__y (Bi_inbuf.from_string ?pos s) let rec _2_tag = Bi_io.array_tag and write_untagged__2 ob x = ( - Atdgen_runtime.Ob_run.write_untagged_list + Atdgen_www_runtime.Ob_run.write_untagged_list test_variant_tag ( write_untagged_test_variant @@ -592,12 +592,12 @@ and string_of_test_variant ?(len = 1024) x = write_test_variant ob x; Bi_outbuf.contents ob let rec get__2_reader tag = ( - Atdgen_runtime.Ob_run.get_list_reader ( + Atdgen_www_runtime.Ob_run.get_list_reader ( get_test_variant_reader ) ) tag and read__2 ib = ( - Atdgen_runtime.Ob_run.read_list ( + Atdgen_www_runtime.Ob_run.read_list ( get_test_variant_reader ) ) ib @@ -605,19 +605,19 @@ and _2_of_string ?pos s = read__2 (Bi_inbuf.from_string ?pos s) and get_test_variant_reader = ( fun tag -> - if tag <> 23 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 23 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> Bi_io.read_hashtag ib (fun ib h has_arg -> match h, has_arg with | -733074591, false -> `Case1 | -733074590, true -> (`Case2 ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib )) | -733074589, true -> (`Case3 ( ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib )) | -733074588, true -> (`Case4 ( @@ -625,23 +625,23 @@ and get_test_variant_reader = ( read__2 ) ib )) - | _ -> Atdgen_runtime.Ob_run.unsupported_variant h has_arg + | _ -> Atdgen_www_runtime.Ob_run.unsupported_variant h has_arg ) ) and read_test_variant = ( fun ib -> - if Bi_io.read_tag ib <> 23 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 23 then Atdgen_www_runtime.Ob_run.read_error_at ib; Bi_io.read_hashtag ib (fun ib h has_arg -> match h, has_arg with | -733074591, false -> `Case1 | -733074590, true -> (`Case2 ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib )) | -733074589, true -> (`Case3 ( ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib )) | -733074588, true -> (`Case4 ( @@ -649,7 +649,7 @@ and read_test_variant = ( read__2 ) ib )) - | _ -> Atdgen_runtime.Ob_run.unsupported_variant h has_arg + | _ -> Atdgen_www_runtime.Ob_run.unsupported_variant h has_arg ) ) and test_variant_of_string ?pos s = @@ -679,7 +679,7 @@ and string_of__1 ?(len = 1024) x = Bi_outbuf.contents ob let rec get__1_reader = ( fun tag -> - if tag <> 23 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 23 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> Bi_io.read_hashtag ib (fun ib h has_arg -> match h, has_arg with @@ -691,15 +691,15 @@ let rec get__1_reader = ( ) : _ p') | -711691517, true -> (Ccccc ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ) : _ p') - | _ -> Atdgen_runtime.Ob_run.unsupported_variant h has_arg + | _ -> Atdgen_www_runtime.Ob_run.unsupported_variant h has_arg ) ) and read__1 = ( fun ib -> - if Bi_io.read_tag ib <> 23 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 23 then Atdgen_www_runtime.Ob_run.read_error_at ib; Bi_io.read_hashtag ib (fun ib h has_arg -> match h, has_arg with | 65, false -> (A : _ p') @@ -710,10 +710,10 @@ and read__1 = ( ) : _ p') | -711691517, true -> (Ccccc ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ) : _ p') - | _ -> Atdgen_runtime.Ob_run.unsupported_variant h has_arg + | _ -> Atdgen_www_runtime.Ob_run.unsupported_variant h has_arg ) ) and _1_of_string ?pos s = @@ -730,16 +730,16 @@ let string_of_validated_string_check ?(len = 1024) x = write_validated_string_check ob x; Bi_outbuf.contents ob let get_validated_string_check_reader = ( - Atdgen_runtime.Ob_run.get_string_reader + Atdgen_www_runtime.Ob_run.get_string_reader ) let read_validated_string_check = ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) let validated_string_check_of_string ?pos s = read_validated_string_check (Bi_inbuf.from_string ?pos s) let _31_tag = Bi_io.array_tag let write_untagged__31 = ( - Atdgen_runtime.Ob_run.write_untagged_list + Atdgen_www_runtime.Ob_run.write_untagged_list Bi_io.string_tag ( Bi_io.write_untagged_string @@ -753,13 +753,13 @@ let string_of__31 ?(len = 1024) x = write__31 ob x; Bi_outbuf.contents ob let get__31_reader = ( - Atdgen_runtime.Ob_run.get_list_reader ( - Atdgen_runtime.Ob_run.get_string_reader + Atdgen_www_runtime.Ob_run.get_list_reader ( + Atdgen_www_runtime.Ob_run.get_string_reader ) ) let read__31 = ( - Atdgen_runtime.Ob_run.read_list ( - Atdgen_runtime.Ob_run.get_string_reader + Atdgen_www_runtime.Ob_run.read_list ( + Atdgen_www_runtime.Ob_run.get_string_reader ) ) let _31_of_string ?pos s = @@ -801,7 +801,7 @@ let string_of_val1 ?(len = 1024) x = Bi_outbuf.contents ob let get_val1_reader = ( fun tag -> - if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 21 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let field_val1_x = ref (Obj.magic (Sys.opaque_identity 0.0)) in let bits0 = ref 0 in @@ -811,13 +811,13 @@ let get_val1_reader = ( | -813472407 -> field_val1_x := ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ); bits0 := !bits0 lor 0x1; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x1 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "val1_x" |]; + if !bits0 <> 0x1 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "val1_x" |]; ( { val1_x = !field_val1_x; @@ -826,7 +826,7 @@ let get_val1_reader = ( ) let read_val1 = ( fun ib -> - if Bi_io.read_tag ib <> 21 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 21 then Atdgen_www_runtime.Ob_run.read_error_at ib; let field_val1_x = ref (Obj.magic (Sys.opaque_identity 0.0)) in let bits0 = ref 0 in let len = Bi_vint.read_uvint ib in @@ -835,13 +835,13 @@ let read_val1 = ( | -813472407 -> field_val1_x := ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ); bits0 := !bits0 lor 0x1; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x1 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "val1_x" |]; + if !bits0 <> 0x1 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "val1_x" |]; ( { val1_x = !field_val1_x; @@ -852,7 +852,7 @@ let val1_of_string ?pos s = read_val1 (Bi_inbuf.from_string ?pos s) let _16_tag = Bi_io.num_variant_tag let write_untagged__16 = ( - Atdgen_runtime.Ob_run.write_untagged_option ( + Atdgen_www_runtime.Ob_run.write_untagged_option ( write_val1 ) ) @@ -865,7 +865,7 @@ let string_of__16 ?(len = 1024) x = Bi_outbuf.contents ob let get__16_reader = ( fun tag -> - if tag <> 22 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 22 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> match Char.code (Bi_inbuf.read_char ib) with | 0 -> None @@ -876,11 +876,11 @@ let get__16_reader = ( ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let read__16 = ( fun ib -> - if Bi_io.read_tag ib <> 22 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 22 then Atdgen_www_runtime.Ob_run.read_error_at ib; match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> @@ -890,7 +890,7 @@ let read__16 = ( ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let _16_of_string ?pos s = read__16 (Bi_inbuf.from_string ?pos s) @@ -921,7 +921,7 @@ let string_of_val2 ?(len = 1024) x = Bi_outbuf.contents ob let get_val2_reader = ( fun tag -> - if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 21 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let field_val2_x = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_val2_y = ref (None) in @@ -946,7 +946,7 @@ let get_val2_reader = ( ); | _ -> Bi_io.skip ib done; - if !bits0 <> 0x1 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "val2_x" |]; + if !bits0 <> 0x1 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "val2_x" |]; ( { val2_x = !field_val2_x; @@ -956,7 +956,7 @@ let get_val2_reader = ( ) let read_val2 = ( fun ib -> - if Bi_io.read_tag ib <> 21 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 21 then Atdgen_www_runtime.Ob_run.read_error_at ib; let field_val2_x = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_val2_y = ref (None) in let bits0 = ref 0 in @@ -980,7 +980,7 @@ let read_val2 = ( ); | _ -> Bi_io.skip ib done; - if !bits0 <> 0x1 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "val2_x" |]; + if !bits0 <> 0x1 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "val2_x" |]; ( { val2_x = !field_val2_x; @@ -992,7 +992,7 @@ let val2_of_string ?pos s = read_val2 (Bi_inbuf.from_string ?pos s) let _29_tag = Bi_io.array_tag let write_untagged__29 = ( - Atdgen_runtime.Ob_run.write_untagged_list + Atdgen_www_runtime.Ob_run.write_untagged_list Bi_io.float64_tag ( Bi_io.write_untagged_float64 @@ -1006,13 +1006,13 @@ let string_of__29 ?(len = 1024) x = write__29 ob x; Bi_outbuf.contents ob let get__29_reader = ( - Atdgen_runtime.Ob_run.get_list_reader ( - Atdgen_runtime.Ob_run.get_float64_reader + Atdgen_www_runtime.Ob_run.get_list_reader ( + Atdgen_www_runtime.Ob_run.get_float64_reader ) ) let read__29 = ( - Atdgen_runtime.Ob_run.read_list ( - Atdgen_runtime.Ob_run.get_float64_reader + Atdgen_www_runtime.Ob_run.read_list ( + Atdgen_www_runtime.Ob_run.get_float64_reader ) ) let _29_of_string ?pos s = @@ -1038,7 +1038,7 @@ let unixtime_list_of_string ?pos s = read_unixtime_list (Bi_inbuf.from_string ?pos s) let _3_tag = Bi_io.num_variant_tag let write_untagged__3 = ( - Atdgen_runtime.Ob_run.write_untagged_option ( + Atdgen_www_runtime.Ob_run.write_untagged_option ( Bi_io.write_svint ) ) @@ -1051,32 +1051,32 @@ let string_of__3 ?(len = 1024) x = Bi_outbuf.contents ob let get__3_reader = ( fun tag -> - if tag <> 22 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 22 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> Some ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let read__3 = ( fun ib -> - if Bi_io.read_tag ib <> 22 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 22 then Atdgen_www_runtime.Ob_run.read_error_at ib; match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> Some ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let _3_of_string ?pos s = read__3 (Bi_inbuf.from_string ?pos s) @@ -1109,13 +1109,13 @@ let string_of_date ?(len = 1024) x = Bi_outbuf.contents ob let get_date_reader = ( fun tag -> - if tag <> 20 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 20 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let len = Bi_vint.read_uvint ib in - if len < 3 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 2 ]; + if len < 3 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 2 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x1 = @@ -1133,12 +1133,12 @@ let get_date_reader = ( ) let read_date = ( fun ib -> - if Bi_io.read_tag ib <> 20 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 20 then Atdgen_www_runtime.Ob_run.read_error_at ib; let len = Bi_vint.read_uvint ib in - if len < 3 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 2 ]; + if len < 3 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 2 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x1 = @@ -1158,7 +1158,7 @@ let date_of_string ?pos s = read_date (Bi_inbuf.from_string ?pos s) let _9_tag = Bi_io.array_tag let write_untagged__9 = ( - Atdgen_runtime.Ob_run.write_untagged_array + Atdgen_www_runtime.Ob_run.write_untagged_array Bi_io.string_tag ( Bi_io.write_untagged_string @@ -1172,20 +1172,20 @@ let string_of__9 ?(len = 1024) x = write__9 ob x; Bi_outbuf.contents ob let get__9_reader = ( - Atdgen_runtime.Ob_run.get_array_reader ( - Atdgen_runtime.Ob_run.get_string_reader + Atdgen_www_runtime.Ob_run.get_array_reader ( + Atdgen_www_runtime.Ob_run.get_string_reader ) ) let read__9 = ( - Atdgen_runtime.Ob_run.read_array ( - Atdgen_runtime.Ob_run.get_string_reader + Atdgen_www_runtime.Ob_run.read_array ( + Atdgen_www_runtime.Ob_run.get_string_reader ) ) let _9_of_string ?pos s = read__9 (Bi_inbuf.from_string ?pos s) let _8_tag = Bi_io.num_variant_tag let write_untagged__8 = ( - Atdgen_runtime.Ob_run.write_untagged_option ( + Atdgen_www_runtime.Ob_run.write_untagged_option ( Bi_io.write_bool ) ) @@ -1198,38 +1198,38 @@ let string_of__8 ?(len = 1024) x = Bi_outbuf.contents ob let get__8_reader = ( fun tag -> - if tag <> 22 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 22 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> Some ( ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let read__8 = ( fun ib -> - if Bi_io.read_tag ib <> 22 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 22 then Atdgen_www_runtime.Ob_run.read_error_at ib; match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> Some ( ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let _8_of_string ?pos s = read__8 (Bi_inbuf.from_string ?pos s) let _7_tag = Bi_io.array_tag let write_untagged__7 = ( - Atdgen_runtime.Ob_run.write_untagged_array + Atdgen_www_runtime.Ob_run.write_untagged_array Bi_io.float64_tag ( Bi_io.write_untagged_float64 @@ -1243,20 +1243,20 @@ let string_of__7 ?(len = 1024) x = write__7 ob x; Bi_outbuf.contents ob let get__7_reader = ( - Atdgen_runtime.Ob_run.get_array_reader ( - Atdgen_runtime.Ob_run.get_float64_reader + Atdgen_www_runtime.Ob_run.get_array_reader ( + Atdgen_www_runtime.Ob_run.get_float64_reader ) ) let read__7 = ( - Atdgen_runtime.Ob_run.read_array ( - Atdgen_runtime.Ob_run.get_float64_reader + Atdgen_www_runtime.Ob_run.read_array ( + Atdgen_www_runtime.Ob_run.get_float64_reader ) ) let _7_of_string ?pos s = read__7 (Bi_inbuf.from_string ?pos s) let _6_tag = Bi_io.num_variant_tag let write_untagged__6 = ( - Atdgen_runtime.Ob_run.write_untagged_option ( + Atdgen_www_runtime.Ob_run.write_untagged_option ( Bi_io.write_string ) ) @@ -1269,38 +1269,38 @@ let string_of__6 ?(len = 1024) x = Bi_outbuf.contents ob let get__6_reader = ( fun tag -> - if tag <> 22 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 22 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> Some ( ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let read__6 = ( fun ib -> - if Bi_io.read_tag ib <> 22 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 22 then Atdgen_www_runtime.Ob_run.read_error_at ib; match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> Some ( ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let _6_of_string ?pos s = read__6 (Bi_inbuf.from_string ?pos s) let _5_tag = Bi_io.num_variant_tag let write_untagged__5 = ( - Atdgen_runtime.Ob_run.write_untagged_option ( + Atdgen_www_runtime.Ob_run.write_untagged_option ( Bi_io.write_float64 ) ) @@ -1313,38 +1313,38 @@ let string_of__5 ?(len = 1024) x = Bi_outbuf.contents ob let get__5_reader = ( fun tag -> - if tag <> 22 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 22 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> Some ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let read__5 = ( fun ib -> - if Bi_io.read_tag ib <> 22 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 22 then Atdgen_www_runtime.Ob_run.read_error_at ib; match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> Some ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let _5_of_string ?pos s = read__5 (Bi_inbuf.from_string ?pos s) let _4_tag = Bi_io.num_variant_tag let write_untagged__4 = ( - Atdgen_runtime.Ob_run.write_untagged_option ( + Atdgen_www_runtime.Ob_run.write_untagged_option ( Bi_io.write_svint ) ) @@ -1357,38 +1357,38 @@ let string_of__4 ?(len = 1024) x = Bi_outbuf.contents ob let get__4_reader = ( fun tag -> - if tag <> 22 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 22 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> Some ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let read__4 = ( fun ib -> - if Bi_io.read_tag ib <> 22 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 22 then Atdgen_www_runtime.Ob_run.read_error_at ib; match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> Some ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let _4_of_string ?pos s = read__4 (Bi_inbuf.from_string ?pos s) let _11_tag = Bi_io.array_tag let write_untagged__11 = ( - Atdgen_runtime.Ob_run.write_untagged_list + Atdgen_www_runtime.Ob_run.write_untagged_list _6_tag ( write_untagged__6 @@ -1402,12 +1402,12 @@ let string_of__11 ?(len = 1024) x = write__11 ob x; Bi_outbuf.contents ob let get__11_reader = ( - Atdgen_runtime.Ob_run.get_list_reader ( + Atdgen_www_runtime.Ob_run.get_list_reader ( get__6_reader ) ) let read__11 = ( - Atdgen_runtime.Ob_run.read_list ( + Atdgen_www_runtime.Ob_run.read_list ( get__6_reader ) ) @@ -1415,7 +1415,7 @@ let _11_of_string ?pos s = read__11 (Bi_inbuf.from_string ?pos s) let _10_tag = Bi_io.array_tag let write_untagged__10 = ( - Atdgen_runtime.Ob_run.write_untagged_list + Atdgen_www_runtime.Ob_run.write_untagged_list Bi_io.unit_tag ( Bi_io.write_untagged_unit @@ -1429,13 +1429,13 @@ let string_of__10 ?(len = 1024) x = write__10 ob x; Bi_outbuf.contents ob let get__10_reader = ( - Atdgen_runtime.Ob_run.get_list_reader ( - Atdgen_runtime.Ob_run.get_unit_reader + Atdgen_www_runtime.Ob_run.get_list_reader ( + Atdgen_www_runtime.Ob_run.get_unit_reader ) ) let read__10 = ( - Atdgen_runtime.Ob_run.read_list ( - Atdgen_runtime.Ob_run.get_unit_reader + Atdgen_www_runtime.Ob_run.read_list ( + Atdgen_www_runtime.Ob_run.get_unit_reader ) ) let _10_of_string ?pos s = @@ -1567,7 +1567,7 @@ let string_of_mixed_record ?(len = 1024) x = Bi_outbuf.contents ob let get_mixed_record_reader = ( fun tag -> - if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 21 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let field_field0 = ref (None) in let field_field1 = ref (None) in @@ -1592,7 +1592,7 @@ let get_mixed_record_reader = ( field_field0 := ( Some ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ) ); @@ -1600,7 +1600,7 @@ let get_mixed_record_reader = ( field_field1 := ( Some ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ) ); @@ -1614,7 +1614,7 @@ let get_mixed_record_reader = ( | 9342521 -> field_field3 := ( ( - Atdgen_runtime.Ob_run.read_int64 + Atdgen_www_runtime.Ob_run.read_int64 ) ib ); bits0 := !bits0 lor 0x2; @@ -1629,7 +1629,7 @@ let get_mixed_record_reader = ( field_field5 := ( Some ( ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib ) ); @@ -1637,7 +1637,7 @@ let get_mixed_record_reader = ( field_field6 := ( Some ( ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib ) ); @@ -1659,37 +1659,37 @@ let get_mixed_record_reader = ( field_field9 := ( ( fun ib -> - if Bi_io.read_tag ib <> 20 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 20 then Atdgen_www_runtime.Ob_run.read_error_at ib; let len = Bi_vint.read_uvint ib in - if len < 6 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 2; 3; 4; 5 ]; + if len < 6 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 2; 3; 4; 5 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x1 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x2 = ( - Atdgen_runtime.Ob_run.read_char + Atdgen_www_runtime.Ob_run.read_char ) ib in let x3 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x4 = ( - Atdgen_runtime.Ob_run.read_int32 + Atdgen_www_runtime.Ob_run.read_int32 ) ib in let x5 = ( - Atdgen_runtime.Ob_run.read_int64 + Atdgen_www_runtime.Ob_run.read_int64 ) ib in for i = 6 to len - 1 do Bi_io.skip ib done; @@ -1700,14 +1700,14 @@ let get_mixed_record_reader = ( | -64101863 -> field_field10 := ( ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib ); bits0 := !bits0 lor 0x40; | -64101862 -> field_field11 := ( ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib ); | -64101861 -> @@ -1733,7 +1733,7 @@ let get_mixed_record_reader = ( bits0 := !bits0 lor 0x200; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x3ff then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "field2"; "field3"; "field4"; "field7"; "field8"; "field9"; "field10"; "field12"; "field13"; "field14" |]; + if !bits0 <> 0x3ff then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "field2"; "field3"; "field4"; "field7"; "field8"; "field9"; "field10"; "field12"; "field13"; "field14" |]; ( { field0 = !field_field0; @@ -1756,7 +1756,7 @@ let get_mixed_record_reader = ( ) let read_mixed_record = ( fun ib -> - if Bi_io.read_tag ib <> 21 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 21 then Atdgen_www_runtime.Ob_run.read_error_at ib; let field_field0 = ref (None) in let field_field1 = ref (None) in let field_field2 = ref (Obj.magic (Sys.opaque_identity 0.0)) in @@ -1780,7 +1780,7 @@ let read_mixed_record = ( field_field0 := ( Some ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ) ); @@ -1788,7 +1788,7 @@ let read_mixed_record = ( field_field1 := ( Some ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ) ); @@ -1802,7 +1802,7 @@ let read_mixed_record = ( | 9342521 -> field_field3 := ( ( - Atdgen_runtime.Ob_run.read_int64 + Atdgen_www_runtime.Ob_run.read_int64 ) ib ); bits0 := !bits0 lor 0x2; @@ -1817,7 +1817,7 @@ let read_mixed_record = ( field_field5 := ( Some ( ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib ) ); @@ -1825,7 +1825,7 @@ let read_mixed_record = ( field_field6 := ( Some ( ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib ) ); @@ -1847,37 +1847,37 @@ let read_mixed_record = ( field_field9 := ( ( fun ib -> - if Bi_io.read_tag ib <> 20 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 20 then Atdgen_www_runtime.Ob_run.read_error_at ib; let len = Bi_vint.read_uvint ib in - if len < 6 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 2; 3; 4; 5 ]; + if len < 6 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 2; 3; 4; 5 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x1 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x2 = ( - Atdgen_runtime.Ob_run.read_char + Atdgen_www_runtime.Ob_run.read_char ) ib in let x3 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x4 = ( - Atdgen_runtime.Ob_run.read_int32 + Atdgen_www_runtime.Ob_run.read_int32 ) ib in let x5 = ( - Atdgen_runtime.Ob_run.read_int64 + Atdgen_www_runtime.Ob_run.read_int64 ) ib in for i = 6 to len - 1 do Bi_io.skip ib done; @@ -1888,14 +1888,14 @@ let read_mixed_record = ( | -64101863 -> field_field10 := ( ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib ); bits0 := !bits0 lor 0x40; | -64101862 -> field_field11 := ( ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib ); | -64101861 -> @@ -1921,7 +1921,7 @@ let read_mixed_record = ( bits0 := !bits0 lor 0x200; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x3ff then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "field2"; "field3"; "field4"; "field7"; "field8"; "field9"; "field10"; "field12"; "field13"; "field14" |]; + if !bits0 <> 0x3ff then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "field2"; "field3"; "field4"; "field7"; "field8"; "field9"; "field10"; "field12"; "field13"; "field14" |]; ( { field0 = !field_field0; @@ -1946,7 +1946,7 @@ let mixed_record_of_string ?pos s = read_mixed_record (Bi_inbuf.from_string ?pos s) let _13_tag = Bi_io.array_tag let write_untagged__13 = ( - Atdgen_runtime.Ob_run.write_untagged_array + Atdgen_www_runtime.Ob_run.write_untagged_array mixed_record_tag ( write_untagged_mixed_record @@ -1960,12 +1960,12 @@ let string_of__13 ?(len = 1024) x = write__13 ob x; Bi_outbuf.contents ob let get__13_reader = ( - Atdgen_runtime.Ob_run.get_array_reader ( + Atdgen_www_runtime.Ob_run.get_array_reader ( get_mixed_record_reader ) ) let read__13 = ( - Atdgen_runtime.Ob_run.read_array ( + Atdgen_www_runtime.Ob_run.read_array ( get_mixed_record_reader ) ) @@ -2008,7 +2008,7 @@ let write_untagged__12 = ( Bi_io.write_tag ob _11_tag; Bi_io.write_hashtag ob (-64101859) true; Bi_io.write_tag ob date_tag; - Atdgen_runtime.Ob_run.array_iter2 (fun ob x -> + Atdgen_www_runtime.Ob_run.array_iter2 (fun ob x -> ( write_untagged__4 ) @@ -2135,7 +2135,7 @@ let get__12_reader = ( let field_field14 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let bits0 = ref 0 in let readers = - Atdgen_runtime.Ob_run.array_init2 col_num ib ( + Atdgen_www_runtime.Ob_run.array_init2 col_num ib ( fun col ib -> let h = Bi_io.read_field_hashtag ib in let tag = Bi_io.read_tag ib in @@ -2169,7 +2169,7 @@ let get__12_reader = ( bits0 := !bits0 lor 0x2; let read = ( - Atdgen_runtime.Ob_run.get_int64_reader + Atdgen_www_runtime.Ob_run.get_int64_reader ) tag in @@ -2222,38 +2222,38 @@ let get__12_reader = ( let read = ( fun tag -> - if tag <> 20 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 20 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let len = Bi_vint.read_uvint ib in - if len < 6 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 2; 3; 4; 5 ]; + if len < 6 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 2; 3; 4; 5 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x1 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x2 = ( - Atdgen_runtime.Ob_run.read_char + Atdgen_www_runtime.Ob_run.read_char ) ib in let x3 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x4 = ( - Atdgen_runtime.Ob_run.read_int32 + Atdgen_www_runtime.Ob_run.read_int32 ) ib in let x5 = ( - Atdgen_runtime.Ob_run.read_int64 + Atdgen_www_runtime.Ob_run.read_int64 ) ib in for i = 6 to len - 1 do Bi_io.skip ib done; @@ -2266,7 +2266,7 @@ let get__12_reader = ( bits0 := !bits0 lor 0x40; let read = ( - Atdgen_runtime.Ob_run.get_bool_reader + Atdgen_www_runtime.Ob_run.get_bool_reader ) tag in @@ -2274,7 +2274,7 @@ let get__12_reader = ( | -64101862 -> let read = ( - Atdgen_runtime.Ob_run.get_bool_reader + Atdgen_www_runtime.Ob_run.get_bool_reader ) tag in @@ -2309,7 +2309,7 @@ let get__12_reader = ( | _ -> (fun ib -> Bi_io.skip ib) ) in - if !bits0 <> 0x3ff then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "field2"; "field3"; "field4"; "field7"; "field8"; "field9"; "field10"; "field12"; "field13"; "field14" |]; + if !bits0 <> 0x3ff then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "field2"; "field3"; "field4"; "field7"; "field8"; "field9"; "field10"; "field12"; "field13"; "field14" |]; let a = Array.make row_num (Obj.magic 0) in for row = 0 to row_num - 1 do for i = 0 to Array.length readers - 1 do @@ -2338,11 +2338,11 @@ let get__12_reader = ( ) | 19 -> (fun ib -> - Atdgen_runtime.Ob_run.read_array_value ( + Atdgen_www_runtime.Ob_run.read_array_value ( get_mixed_record_reader ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error () + | _ -> Atdgen_www_runtime.Ob_run.read_error () ) let read__12 = ( fun ib -> @@ -2369,7 +2369,7 @@ let read__12 = ( let field_field14 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let bits0 = ref 0 in let readers = - Atdgen_runtime.Ob_run.array_init2 col_num ib ( + Atdgen_www_runtime.Ob_run.array_init2 col_num ib ( fun col ib -> let h = Bi_io.read_field_hashtag ib in let tag = Bi_io.read_tag ib in @@ -2403,7 +2403,7 @@ let read__12 = ( bits0 := !bits0 lor 0x2; let read = ( - Atdgen_runtime.Ob_run.get_int64_reader + Atdgen_www_runtime.Ob_run.get_int64_reader ) tag in @@ -2456,38 +2456,38 @@ let read__12 = ( let read = ( fun tag -> - if tag <> 20 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 20 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let len = Bi_vint.read_uvint ib in - if len < 6 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 2; 3; 4; 5 ]; + if len < 6 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 2; 3; 4; 5 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x1 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x2 = ( - Atdgen_runtime.Ob_run.read_char + Atdgen_www_runtime.Ob_run.read_char ) ib in let x3 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x4 = ( - Atdgen_runtime.Ob_run.read_int32 + Atdgen_www_runtime.Ob_run.read_int32 ) ib in let x5 = ( - Atdgen_runtime.Ob_run.read_int64 + Atdgen_www_runtime.Ob_run.read_int64 ) ib in for i = 6 to len - 1 do Bi_io.skip ib done; @@ -2500,7 +2500,7 @@ let read__12 = ( bits0 := !bits0 lor 0x40; let read = ( - Atdgen_runtime.Ob_run.get_bool_reader + Atdgen_www_runtime.Ob_run.get_bool_reader ) tag in @@ -2508,7 +2508,7 @@ let read__12 = ( | -64101862 -> let read = ( - Atdgen_runtime.Ob_run.get_bool_reader + Atdgen_www_runtime.Ob_run.get_bool_reader ) tag in @@ -2543,7 +2543,7 @@ let read__12 = ( | _ -> (fun ib -> Bi_io.skip ib) ) in - if !bits0 <> 0x3ff then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "field2"; "field3"; "field4"; "field7"; "field8"; "field9"; "field10"; "field12"; "field13"; "field14" |]; + if !bits0 <> 0x3ff then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "field2"; "field3"; "field4"; "field7"; "field8"; "field9"; "field10"; "field12"; "field13"; "field14" |]; let a = Array.make row_num (Obj.magic 0) in for row = 0 to row_num - 1 do for i = 0 to Array.length readers - 1 do @@ -2570,16 +2570,16 @@ let read__12 = ( done; a | 19 -> - Atdgen_runtime.Ob_run.read_array_value ( + Atdgen_www_runtime.Ob_run.read_array_value ( get_mixed_record_reader ) ib - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let _12_of_string ?pos s = read__12 (Bi_inbuf.from_string ?pos s) let _14_tag = Bi_io.array_tag let write_untagged__14 = ( - Atdgen_runtime.Ob_run.write_untagged_list + Atdgen_www_runtime.Ob_run.write_untagged_list Bi_io.tuple_tag ( fun ob x -> @@ -2604,12 +2604,12 @@ let string_of__14 ?(len = 1024) x = write__14 ob x; Bi_outbuf.contents ob let get__14_reader = ( - Atdgen_runtime.Ob_run.get_list_reader ( + Atdgen_www_runtime.Ob_run.get_list_reader ( fun tag -> - if tag <> 20 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 20 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let len = Bi_vint.read_uvint ib in - if len < 2 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; + if len < 2 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; let x0 = ( read__12 @@ -2625,12 +2625,12 @@ let get__14_reader = ( ) ) let read__14 = ( - Atdgen_runtime.Ob_run.read_list ( + Atdgen_www_runtime.Ob_run.read_list ( fun tag -> - if tag <> 20 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 20 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let len = Bi_vint.read_uvint ib in - if len < 2 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; + if len < 2 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; let x0 = ( read__12 @@ -2668,7 +2668,7 @@ let mixed_of_string ?pos s = read_mixed (Bi_inbuf.from_string ?pos s) let _15_tag = Bi_io.array_tag let write_untagged__15 = ( - Atdgen_runtime.Ob_run.write_untagged_list + Atdgen_www_runtime.Ob_run.write_untagged_list mixed_record_tag ( write_untagged_mixed_record @@ -2682,12 +2682,12 @@ let string_of__15 ?(len = 1024) x = write__15 ob x; Bi_outbuf.contents ob let get__15_reader = ( - Atdgen_runtime.Ob_run.get_list_reader ( + Atdgen_www_runtime.Ob_run.get_list_reader ( get_mixed_record_reader ) ) let read__15 = ( - Atdgen_runtime.Ob_run.read_list ( + Atdgen_www_runtime.Ob_run.read_list ( get_mixed_record_reader ) ) @@ -2736,7 +2736,7 @@ let string_of_test ?(len = 1024) x = Bi_outbuf.contents ob let get_test_reader = ( fun tag -> - if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 21 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let field_x0 = ref (None) in let field_x1 = ref (None) in @@ -2751,7 +2751,7 @@ let get_test_reader = ( field_x0 := ( Some ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ) ); @@ -2759,7 +2759,7 @@ let get_test_reader = ( field_x1 := ( Some ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ) ); @@ -2780,13 +2780,13 @@ let get_test_reader = ( | 26812 -> field_x4 := ( ( - Atdgen_runtime.Ob_run.read_int64 + Atdgen_www_runtime.Ob_run.read_int64 ) ib ); bits0 := !bits0 lor 0x4; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x7 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "x2"; "x3"; "x4" |]; + if !bits0 <> 0x7 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "x2"; "x3"; "x4" |]; ( { x0 = !field_x0; @@ -2799,7 +2799,7 @@ let get_test_reader = ( ) let read_test = ( fun ib -> - if Bi_io.read_tag ib <> 21 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 21 then Atdgen_www_runtime.Ob_run.read_error_at ib; let field_x0 = ref (None) in let field_x1 = ref (None) in let field_x2 = ref (Obj.magic (Sys.opaque_identity 0.0)) in @@ -2813,7 +2813,7 @@ let read_test = ( field_x0 := ( Some ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ) ); @@ -2821,7 +2821,7 @@ let read_test = ( field_x1 := ( Some ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ) ); @@ -2842,13 +2842,13 @@ let read_test = ( | 26812 -> field_x4 := ( ( - Atdgen_runtime.Ob_run.read_int64 + Atdgen_www_runtime.Ob_run.read_int64 ) ib ); bits0 := !bits0 lor 0x4; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x7 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "x2"; "x3"; "x4" |]; + if !bits0 <> 0x7 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "x2"; "x3"; "x4" |]; ( { x0 = !field_x0; @@ -2885,13 +2885,13 @@ let string_of_tup ?(len = 1024) x = Bi_outbuf.contents ob let get_tup_reader = ( fun tag -> - if tag <> 20 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 20 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let len = Bi_vint.read_uvint ib in - if len < 2 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; + if len < 2 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x1 = @@ -2904,12 +2904,12 @@ let get_tup_reader = ( ) let read_tup = ( fun ib -> - if Bi_io.read_tag ib <> 20 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 20 then Atdgen_www_runtime.Ob_run.read_error_at ib; let len = Bi_vint.read_uvint ib in - if len < 2 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; + if len < 2 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x1 = @@ -2934,10 +2934,10 @@ let string_of_star_rating ?(len = 1024) x = write_star_rating ob x; Bi_outbuf.contents ob let get_star_rating_reader = ( - Atdgen_runtime.Ob_run.get_int_reader + Atdgen_www_runtime.Ob_run.get_int_reader ) let read_star_rating = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) let star_rating_of_string ?pos s = read_star_rating (Bi_inbuf.from_string ?pos s) @@ -2959,7 +2959,7 @@ let string_of__30 ?(len = 1024) x = Bi_outbuf.contents ob let get__30_reader = ( fun tag -> - if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 21 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let field_x294623 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let bits0 = ref 0 in @@ -2969,13 +2969,13 @@ let get__30_reader = ( | -263781502 -> field_x294623 := ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ); bits0 := !bits0 lor 0x1; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x1 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "x294623" |]; + if !bits0 <> 0x1 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "x294623" |]; ( { x294623 = !field_x294623; @@ -2984,7 +2984,7 @@ let get__30_reader = ( ) let read__30 = ( fun ib -> - if Bi_io.read_tag ib <> 21 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 21 then Atdgen_www_runtime.Ob_run.read_error_at ib; let field_x294623 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let bits0 = ref 0 in let len = Bi_vint.read_uvint ib in @@ -2993,13 +2993,13 @@ let read__30 = ( | -263781502 -> field_x294623 := ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ); bits0 := !bits0 lor 0x1; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x1 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "x294623" |]; + if !bits0 <> 0x1 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "x294623" |]; ( { x294623 = !field_x294623; @@ -3045,7 +3045,7 @@ let string_of_some_record ?(len = 1024) x = Bi_outbuf.contents ob let get_some_record_reader = ( fun tag -> - if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 21 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let field_some_field = ref (Obj.magic (Sys.opaque_identity 0.0)) in let bits0 = ref 0 in @@ -3055,13 +3055,13 @@ let get_some_record_reader = ( | 386772463 -> field_some_field := ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ); bits0 := !bits0 lor 0x1; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x1 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "some_field" |]; + if !bits0 <> 0x1 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "some_field" |]; ( { some_field = !field_some_field; @@ -3070,7 +3070,7 @@ let get_some_record_reader = ( ) let read_some_record = ( fun ib -> - if Bi_io.read_tag ib <> 21 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 21 then Atdgen_www_runtime.Ob_run.read_error_at ib; let field_some_field = ref (Obj.magic (Sys.opaque_identity 0.0)) in let bits0 = ref 0 in let len = Bi_vint.read_uvint ib in @@ -3079,13 +3079,13 @@ let read_some_record = ( | 386772463 -> field_some_field := ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ); bits0 := !bits0 lor 0x1; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x1 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "some_field" |]; + if !bits0 <> 0x1 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "some_field" |]; ( { some_field = !field_some_field; @@ -3120,7 +3120,7 @@ let string_of_precision ?(len = 1024) x = Bi_outbuf.contents ob let get_precision_reader = ( fun tag -> - if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 21 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let field_sqrt2_5 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_small_2 = ref (Obj.magic (Sys.opaque_identity 0.0)) in @@ -3132,27 +3132,27 @@ let get_precision_reader = ( | -856079416 -> field_sqrt2_5 := ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ); bits0 := !bits0 lor 0x1; | -459390086 -> field_small_2 := ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ); bits0 := !bits0 lor 0x2; | 1002187630 -> field_large_2 := ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ); bits0 := !bits0 lor 0x4; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x7 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "sqrt2_5"; "small_2"; "large_2" |]; + if !bits0 <> 0x7 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "sqrt2_5"; "small_2"; "large_2" |]; ( { sqrt2_5 = !field_sqrt2_5; @@ -3163,7 +3163,7 @@ let get_precision_reader = ( ) let read_precision = ( fun ib -> - if Bi_io.read_tag ib <> 21 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 21 then Atdgen_www_runtime.Ob_run.read_error_at ib; let field_sqrt2_5 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_small_2 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_large_2 = ref (Obj.magic (Sys.opaque_identity 0.0)) in @@ -3174,27 +3174,27 @@ let read_precision = ( | -856079416 -> field_sqrt2_5 := ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ); bits0 := !bits0 lor 0x1; | -459390086 -> field_small_2 := ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ); bits0 := !bits0 lor 0x2; | 1002187630 -> field_large_2 := ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ); bits0 := !bits0 lor 0x4; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x7 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "sqrt2_5"; "small_2"; "large_2" |]; + if !bits0 <> 0x7 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "sqrt2_5"; "small_2"; "large_2" |]; ( { sqrt2_5 = !field_sqrt2_5; @@ -3226,7 +3226,7 @@ let p''_of_string ?pos s = read_p'' (Bi_inbuf.from_string ?pos s) let _18_tag = Bi_io.num_variant_tag let write_untagged__18 = ( - Atdgen_runtime.Ob_run.write_untagged_option ( + Atdgen_www_runtime.Ob_run.write_untagged_option ( Bi_io.write_svint ) ) @@ -3239,32 +3239,32 @@ let string_of__18 ?(len = 1024) x = Bi_outbuf.contents ob let get__18_reader = ( fun tag -> - if tag <> 22 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 22 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> Some ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let read__18 = ( fun ib -> - if Bi_io.read_tag ib <> 22 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 22 then Atdgen_www_runtime.Ob_run.read_error_at ib; match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> Some ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let _18_of_string ?pos s = read__18 (Bi_inbuf.from_string ?pos s) @@ -3342,13 +3342,13 @@ let string_of__26 ?(len = 1024) x = let get__26_reader = ( fun tag ib -> ( Test_lib.Natural.wrap ) (( - Atdgen_runtime.Ob_run.get_int_reader + Atdgen_www_runtime.Ob_run.get_int_reader ) tag ib) ) let read__26 = ( fun ib -> ( Test_lib.Natural.wrap ) (( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib) ) let _26_of_string ?pos s = @@ -3389,13 +3389,13 @@ let string_of__24 ?(len = 1024) x = let get__24_reader = ( fun tag ib -> ( fun s -> `Id s ) (( - Atdgen_runtime.Ob_run.get_string_reader + Atdgen_www_runtime.Ob_run.get_string_reader ) tag ib) ) let read__24 = ( fun ib -> ( fun s -> `Id s ) (( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib) ) let _24_of_string ?pos s = @@ -3421,7 +3421,7 @@ let id_of_string ?pos s = read_id (Bi_inbuf.from_string ?pos s) let _25_tag = Bi_io.array_tag let write_untagged__25 = ( - Atdgen_runtime.Ob_run.write_untagged_list + Atdgen_www_runtime.Ob_run.write_untagged_list Bi_io.tuple_tag ( fun ob x -> @@ -3446,12 +3446,12 @@ let string_of__25 ?(len = 1024) x = write__25 ob x; Bi_outbuf.contents ob let get__25_reader = ( - Atdgen_runtime.Ob_run.get_list_reader ( + Atdgen_www_runtime.Ob_run.get_list_reader ( fun tag -> - if tag <> 20 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 20 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let len = Bi_vint.read_uvint ib in - if len < 2 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; + if len < 2 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; let x0 = ( read_id @@ -3459,7 +3459,7 @@ let get__25_reader = ( in let x1 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in for i = 2 to len - 1 do Bi_io.skip ib done; @@ -3467,12 +3467,12 @@ let get__25_reader = ( ) ) let read__25 = ( - Atdgen_runtime.Ob_run.read_list ( + Atdgen_www_runtime.Ob_run.read_list ( fun tag -> - if tag <> 20 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 20 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let len = Bi_vint.read_uvint ib in - if len < 2 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; + if len < 2 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; let x0 = ( read_id @@ -3480,7 +3480,7 @@ let read__25 = ( in let x1 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in for i = 2 to len - 1 do Bi_io.skip ib done; @@ -3529,7 +3529,7 @@ let intopt_of_string ?pos s = read_intopt (Bi_inbuf.from_string ?pos s) let _21_tag = Bi_io.array_tag let write_untagged__21 = ( - Atdgen_runtime.Ob_run.write_untagged_list + Atdgen_www_runtime.Ob_run.write_untagged_list Bi_io.tuple_tag ( fun ob x -> @@ -3554,20 +3554,20 @@ let string_of__21 ?(len = 1024) x = write__21 ob x; Bi_outbuf.contents ob let get__21_reader = ( - Atdgen_runtime.Ob_run.get_list_reader ( + Atdgen_www_runtime.Ob_run.get_list_reader ( fun tag -> - if tag <> 20 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 20 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let len = Bi_vint.read_uvint ib in - if len < 2 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; + if len < 2 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib in let x1 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in for i = 2 to len - 1 do Bi_io.skip ib done; @@ -3575,20 +3575,20 @@ let get__21_reader = ( ) ) let read__21 = ( - Atdgen_runtime.Ob_run.read_list ( + Atdgen_www_runtime.Ob_run.read_list ( fun tag -> - if tag <> 20 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 20 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let len = Bi_vint.read_uvint ib in - if len < 2 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; + if len < 2 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib in let x1 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in for i = 2 to len - 1 do Bi_io.skip ib done; @@ -3618,7 +3618,7 @@ let int_assoc_list_of_string ?pos s = read_int_assoc_list (Bi_inbuf.from_string ?pos s) let _22_tag = Bi_io.array_tag let write_untagged__22 = ( - Atdgen_runtime.Ob_run.write_untagged_array + Atdgen_www_runtime.Ob_run.write_untagged_array Bi_io.tuple_tag ( fun ob x -> @@ -3643,20 +3643,20 @@ let string_of__22 ?(len = 1024) x = write__22 ob x; Bi_outbuf.contents ob let get__22_reader = ( - Atdgen_runtime.Ob_run.get_array_reader ( + Atdgen_www_runtime.Ob_run.get_array_reader ( fun tag -> - if tag <> 20 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 20 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let len = Bi_vint.read_uvint ib in - if len < 2 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; + if len < 2 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib in let x1 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in for i = 2 to len - 1 do Bi_io.skip ib done; @@ -3664,20 +3664,20 @@ let get__22_reader = ( ) ) let read__22 = ( - Atdgen_runtime.Ob_run.read_array ( + Atdgen_www_runtime.Ob_run.read_array ( fun tag -> - if tag <> 20 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 20 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let len = Bi_vint.read_uvint ib in - if len < 2 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; + if len < 2 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib in let x1 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in for i = 2 to len - 1 do Bi_io.skip ib done; @@ -3717,10 +3717,10 @@ let string_of_int8 ?(len = 1024) x = write_int8 ob x; Bi_outbuf.contents ob let get_int8_reader = ( - Atdgen_runtime.Ob_run.get_int_reader + Atdgen_www_runtime.Ob_run.get_int_reader ) let read_int8 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) let int8_of_string ?pos s = read_int8 (Bi_inbuf.from_string ?pos s) @@ -3736,10 +3736,10 @@ let string_of_int64 ?(len = 1024) x = write_int64 ob x; Bi_outbuf.contents ob let get_int64_reader = ( - Atdgen_runtime.Ob_run.get_int64_reader + Atdgen_www_runtime.Ob_run.get_int64_reader ) let read_int64 = ( - Atdgen_runtime.Ob_run.read_int64 + Atdgen_www_runtime.Ob_run.read_int64 ) let int64_of_string ?pos s = read_int64 (Bi_inbuf.from_string ?pos s) @@ -3755,10 +3755,10 @@ let string_of_int32 ?(len = 1024) x = write_int32 ob x; Bi_outbuf.contents ob let get_int32_reader = ( - Atdgen_runtime.Ob_run.get_int32_reader + Atdgen_www_runtime.Ob_run.get_int32_reader ) let read_int32 = ( - Atdgen_runtime.Ob_run.read_int32 + Atdgen_www_runtime.Ob_run.read_int32 ) let int32_of_string ?pos s = read_int32 (Bi_inbuf.from_string ?pos s) @@ -3782,31 +3782,31 @@ let string_of_hello ?(len = 1024) x = Bi_outbuf.contents ob let get_hello_reader = ( fun tag -> - if tag <> 23 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 23 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> Bi_io.read_hashtag ib (fun ib h has_arg -> match h, has_arg with | 938386162, true -> (`Hello ( ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib )) | -510523854, false -> `World - | _ -> Atdgen_runtime.Ob_run.unsupported_variant h has_arg + | _ -> Atdgen_www_runtime.Ob_run.unsupported_variant h has_arg ) ) let read_hello = ( fun ib -> - if Bi_io.read_tag ib <> 23 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 23 then Atdgen_www_runtime.Ob_run.read_error_at ib; Bi_io.read_hashtag ib (fun ib h has_arg -> match h, has_arg with | 938386162, true -> (`Hello ( ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib )) | -510523854, false -> `World - | _ -> Atdgen_runtime.Ob_run.unsupported_variant h has_arg + | _ -> Atdgen_www_runtime.Ob_run.unsupported_variant h has_arg ) ) let hello_of_string ?pos s = @@ -3829,7 +3829,7 @@ let string_of_generic _a_tag write_untagged__a write__a ?(len = 1024) x = Bi_outbuf.contents ob let get_generic_reader get__a_reader read__a = ( fun tag -> - if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 21 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let field_x294623 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let bits0 = ref 0 in @@ -3839,13 +3839,13 @@ let get_generic_reader get__a_reader read__a = ( | -263781502 -> field_x294623 := ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ); bits0 := !bits0 lor 0x1; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x1 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "x294623" |]; + if !bits0 <> 0x1 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "x294623" |]; ( { x294623 = !field_x294623; @@ -3854,7 +3854,7 @@ let get_generic_reader get__a_reader read__a = ( ) let read_generic get__a_reader read__a = ( fun ib -> - if Bi_io.read_tag ib <> 21 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 21 then Atdgen_www_runtime.Ob_run.read_error_at ib; let field_x294623 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let bits0 = ref 0 in let len = Bi_vint.read_uvint ib in @@ -3863,13 +3863,13 @@ let read_generic get__a_reader read__a = ( | -263781502 -> field_x294623 := ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ); bits0 := !bits0 lor 0x1; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x1 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "x294623" |]; + if !bits0 <> 0x1 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "x294623" |]; ( { x294623 = !field_x294623; @@ -3900,7 +3900,7 @@ let string_of_floats ?(len = 1024) x = Bi_outbuf.contents ob let get_floats_reader = ( fun tag -> - if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 21 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let field_f32 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_f64 = ref (Obj.magic (Sys.opaque_identity 0.0)) in @@ -3911,20 +3911,20 @@ let get_floats_reader = ( | 5083781 -> field_f32 := ( ( - Atdgen_runtime.Ob_run.read_float32 + Atdgen_www_runtime.Ob_run.read_float32 ) ib ); bits0 := !bits0 lor 0x1; | 5084452 -> field_f64 := ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ); bits0 := !bits0 lor 0x2; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x3 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "f32"; "f64" |]; + if !bits0 <> 0x3 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "f32"; "f64" |]; ( { f32 = !field_f32; @@ -3934,7 +3934,7 @@ let get_floats_reader = ( ) let read_floats = ( fun ib -> - if Bi_io.read_tag ib <> 21 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 21 then Atdgen_www_runtime.Ob_run.read_error_at ib; let field_f32 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_f64 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let bits0 = ref 0 in @@ -3944,20 +3944,20 @@ let read_floats = ( | 5083781 -> field_f32 := ( ( - Atdgen_runtime.Ob_run.read_float32 + Atdgen_www_runtime.Ob_run.read_float32 ) ib ); bits0 := !bits0 lor 0x1; | 5084452 -> field_f64 := ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ); bits0 := !bits0 lor 0x2; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x3 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "f32"; "f64" |]; + if !bits0 <> 0x3 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "f32"; "f64" |]; ( { f32 = !field_f32; @@ -3969,7 +3969,7 @@ let floats_of_string ?pos s = read_floats (Bi_inbuf.from_string ?pos s) let _17_tag = Bi_io.array_tag let write_untagged__17 = ( - Atdgen_runtime.Ob_run.write_untagged_list + Atdgen_www_runtime.Ob_run.write_untagged_list Bi_io.string_tag ( Bi_io.write_untagged_string @@ -3983,13 +3983,13 @@ let string_of__17 ?(len = 1024) x = write__17 ob x; Bi_outbuf.contents ob let get__17_reader = ( - Atdgen_runtime.Ob_run.get_list_reader ( - Atdgen_runtime.Ob_run.get_string_reader + Atdgen_www_runtime.Ob_run.get_list_reader ( + Atdgen_www_runtime.Ob_run.get_string_reader ) ) let read__17 = ( - Atdgen_runtime.Ob_run.read_list ( - Atdgen_runtime.Ob_run.get_string_reader + Atdgen_www_runtime.Ob_run.read_list ( + Atdgen_www_runtime.Ob_run.get_string_reader ) ) let _17_of_string ?pos s = @@ -4038,23 +4038,23 @@ let string_of_extended_tuple ?(len = 1024) x = Bi_outbuf.contents ob let get_extended_tuple_reader = ( fun tag -> - if tag <> 20 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 20 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let len = Bi_vint.read_uvint ib in - if len < 5 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 4 ]; + if len < 5 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 4 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x1 = ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib in let x2 = ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib in let x3 = @@ -4064,7 +4064,7 @@ let get_extended_tuple_reader = ( in let x4 = ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib in let x5 = @@ -4079,22 +4079,22 @@ let get_extended_tuple_reader = ( ) let read_extended_tuple = ( fun ib -> - if Bi_io.read_tag ib <> 20 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 20 then Atdgen_www_runtime.Ob_run.read_error_at ib; let len = Bi_vint.read_uvint ib in - if len < 5 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 4 ]; + if len < 5 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1; 4 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x1 = ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib in let x2 = ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib in let x3 = @@ -4104,7 +4104,7 @@ let read_extended_tuple = ( in let x4 = ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib in let x5 = @@ -4166,7 +4166,7 @@ let string_of_extended ?(len = 1024) x = Bi_outbuf.contents ob let get_extended_reader = ( fun tag -> - if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 21 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let field_b0x = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_b1x = ref (Obj.magic (Sys.opaque_identity 0.0)) in @@ -4181,21 +4181,21 @@ let get_extended_reader = ( | 21902 -> field_b0x := ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ); bits0 := !bits0 lor 0x1; | 21903 -> field_b1x := ( ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib ); bits0 := !bits0 lor 0x2; | 21904 -> field_b2x := ( ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib ); bits0 := !bits0 lor 0x4; @@ -4203,7 +4203,7 @@ let get_extended_reader = ( field_b3x := ( Some ( ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib ) ); @@ -4217,12 +4217,12 @@ let get_extended_reader = ( | 21907 -> field_b5x := ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ); | _ -> Bi_io.skip ib done; - if !bits0 <> 0xf then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "b0"; "b1"; "b2"; "b4" |]; + if !bits0 <> 0xf then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "b0"; "b1"; "b2"; "b4" |]; ( { b0x = !field_b0x; @@ -4236,7 +4236,7 @@ let get_extended_reader = ( ) let read_extended = ( fun ib -> - if Bi_io.read_tag ib <> 21 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 21 then Atdgen_www_runtime.Ob_run.read_error_at ib; let field_b0x = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_b1x = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_b2x = ref (Obj.magic (Sys.opaque_identity 0.0)) in @@ -4250,21 +4250,21 @@ let read_extended = ( | 21902 -> field_b0x := ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ); bits0 := !bits0 lor 0x1; | 21903 -> field_b1x := ( ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib ); bits0 := !bits0 lor 0x2; | 21904 -> field_b2x := ( ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib ); bits0 := !bits0 lor 0x4; @@ -4272,7 +4272,7 @@ let read_extended = ( field_b3x := ( Some ( ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib ) ); @@ -4286,12 +4286,12 @@ let read_extended = ( | 21907 -> field_b5x := ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ); | _ -> Bi_io.skip ib done; - if !bits0 <> 0xf then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "b0"; "b1"; "b2"; "b4" |]; + if !bits0 <> 0xf then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "b0"; "b1"; "b2"; "b4" |]; ( { b0x = !field_b0x; @@ -4383,10 +4383,10 @@ let string_of_char ?(len = 1024) x = write_char ob x; Bi_outbuf.contents ob let get_char_reader = ( - Atdgen_runtime.Ob_run.get_char_reader + Atdgen_www_runtime.Ob_run.get_char_reader ) let read_char = ( - Atdgen_runtime.Ob_run.read_char + Atdgen_www_runtime.Ob_run.read_char ) let char_of_string ?pos s = read_char (Bi_inbuf.from_string ?pos s) @@ -4414,18 +4414,18 @@ let string_of_base_tuple ?(len = 1024) x = Bi_outbuf.contents ob let get_base_tuple_reader = ( fun tag -> - if tag <> 20 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 20 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let len = Bi_vint.read_uvint ib in - if len < 2 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; + if len < 2 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x1 = ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib in for i = 2 to len - 1 do Bi_io.skip ib done; @@ -4433,17 +4433,17 @@ let get_base_tuple_reader = ( ) let read_base_tuple = ( fun ib -> - if Bi_io.read_tag ib <> 20 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 20 then Atdgen_www_runtime.Ob_run.read_error_at ib; let len = Bi_vint.read_uvint ib in - if len < 2 then Atdgen_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; + if len < 2 then Atdgen_www_runtime.Ob_run.missing_tuple_fields len [ 0; 1 ]; let x0 = ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib in let x1 = ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib in for i = 2 to len - 1 do Bi_io.skip ib done; @@ -4473,7 +4473,7 @@ let string_of_base ?(len = 1024) x = Bi_outbuf.contents ob let get_base_reader = ( fun tag -> - if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 21 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let field_b0 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_b1 = ref (Obj.magic (Sys.opaque_identity 0.0)) in @@ -4484,20 +4484,20 @@ let get_base_reader = ( | 21902 -> field_b0 := ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ); bits0 := !bits0 lor 0x1; | 21903 -> field_b1 := ( ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib ); bits0 := !bits0 lor 0x2; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x3 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "b0"; "b1" |]; + if !bits0 <> 0x3 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "b0"; "b1" |]; ( { b0 = !field_b0; @@ -4507,7 +4507,7 @@ let get_base_reader = ( ) let read_base = ( fun ib -> - if Bi_io.read_tag ib <> 21 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 21 then Atdgen_www_runtime.Ob_run.read_error_at ib; let field_b0 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_b1 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let bits0 = ref 0 in @@ -4517,20 +4517,20 @@ let read_base = ( | 21902 -> field_b0 := ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ); bits0 := !bits0 lor 0x1; | 21903 -> field_b1 := ( ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib ); bits0 := !bits0 lor 0x2; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x3 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "b0"; "b1" |]; + if !bits0 <> 0x3 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "b0"; "b1" |]; ( { b0 = !field_b0; @@ -4542,7 +4542,7 @@ let base_of_string ?pos s = read_base (Bi_inbuf.from_string ?pos s) let _23_tag = Bi_io.array_tag let write_untagged__23 _a_tag write_untagged__a write__a = ( - Atdgen_runtime.Ob_run.write_untagged_array + Atdgen_www_runtime.Ob_run.write_untagged_array _a_tag ( write_untagged__a @@ -4556,12 +4556,12 @@ let string_of__23 _a_tag write_untagged__a write__a ?(len = 1024) x = write__23 _a_tag write_untagged__a write__a ob x; Bi_outbuf.contents ob let get__23_reader get__a_reader read__a = ( - Atdgen_runtime.Ob_run.get_array_reader ( + Atdgen_www_runtime.Ob_run.get_array_reader ( get__a_reader ) ) let read__23 get__a_reader read__a = ( - Atdgen_runtime.Ob_run.read_array ( + Atdgen_www_runtime.Ob_run.read_array ( get__a_reader ) ) diff --git a/atdgen/test/test.expected.mli b/atdgen/test/test.expected.mli index cafea75..2043b61 100644 --- a/atdgen/test/test.expected.mli +++ b/atdgen/test/test.expected.mli @@ -35,11 +35,11 @@ type mixed_record = { field1: float option; field2: string option; field3: Int64.t; - field4: float Atdgen_runtime.Util.ocaml_array; + field4: float Atdgen_www_runtime.Util.ocaml_array; field5: bool option; field6: string option; field7: test_variant; - field8: string Atdgen_runtime.Util.ocaml_array; + field8: string Atdgen_www_runtime.Util.ocaml_array; field9: (int * int * Char.t * int * Int32.t * Int64.t); field10: bool; field11: bool; @@ -50,8 +50,8 @@ type mixed_record = { type mixed = ( - mixed_record Atdgen_runtime.Util.ocaml_array - * mixed_record Atdgen_runtime.Util.ocaml_array + mixed_record Atdgen_www_runtime.Util.ocaml_array + * mixed_record Atdgen_www_runtime.Util.ocaml_array ) list type test = { @@ -90,7 +90,7 @@ type intopt = int option type int_assoc_list = (string * int) list -type int_assoc_array = (string * int) Atdgen_runtime.Util.ocaml_array +type int_assoc_array = (string * int) Atdgen_www_runtime.Util.ocaml_array type int8 = int @@ -153,7 +153,7 @@ type base_tuple = (int * float) type base = { b0: int; b1: bool } -type 'a array = 'a Atdgen_runtime.Util.ocaml_array +type 'a array = 'a Atdgen_www_runtime.Util.ocaml_array type 'a abs3 = 'a list @@ -678,11 +678,11 @@ val create_mixed_record : ?field1: float -> field2: string option -> field3: Int64.t -> - field4: float Atdgen_runtime.Util.ocaml_array -> + field4: float Atdgen_www_runtime.Util.ocaml_array -> ?field5: bool -> ?field6: string -> field7: test_variant -> - field8: string Atdgen_runtime.Util.ocaml_array -> + field8: string Atdgen_www_runtime.Util.ocaml_array -> field9: (int * int * Char.t * int * Int32.t * Int64.t) -> field10: bool -> ?field11: bool -> diff --git a/atdgen/test/test2.expected.ml b/atdgen/test/test2.expected.ml index 7cd9974..c0470ae 100644 --- a/atdgen/test/test2.expected.ml +++ b/atdgen/test/test2.expected.ml @@ -41,10 +41,10 @@ let string_of__1 ?(len = 1024) x = write__1 ob x; Bi_outbuf.contents ob let get__1_reader = ( - get_poly_reader Atdgen_runtime.Ob_run.get_int_reader Atdgen_runtime.Ob_run.read_int Atdgen_runtime.Ob_run.get_int_reader Atdgen_runtime.Ob_run.read_int + get_poly_reader Atdgen_www_runtime.Ob_run.get_int_reader Atdgen_www_runtime.Ob_run.read_int Atdgen_www_runtime.Ob_run.get_int_reader Atdgen_www_runtime.Ob_run.read_int ) let read__1 = ( - read_poly Atdgen_runtime.Ob_run.get_int_reader Atdgen_runtime.Ob_run.read_int Atdgen_runtime.Ob_run.get_int_reader Atdgen_runtime.Ob_run.read_int + read_poly Atdgen_www_runtime.Ob_run.get_int_reader Atdgen_www_runtime.Ob_run.read_int Atdgen_www_runtime.Ob_run.get_int_reader Atdgen_www_runtime.Ob_run.read_int ) let _1_of_string ?pos s = read__1 (Bi_inbuf.from_string ?pos s) @@ -69,7 +69,7 @@ let poly_int2_of_string ?pos s = read_poly_int2 (Bi_inbuf.from_string ?pos s) let _3_tag = Bi_io.num_variant_tag let write_untagged__3 = ( - Atdgen_runtime.Ob_run.write_untagged_option ( + Atdgen_www_runtime.Ob_run.write_untagged_option ( Bi_io.write_string ) ) @@ -82,32 +82,32 @@ let string_of__3 ?(len = 1024) x = Bi_outbuf.contents ob let get__3_reader = ( fun tag -> - if tag <> 22 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 22 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> Some ( ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let read__3 = ( fun ib -> - if Bi_io.read_tag ib <> 22 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 22 then Atdgen_www_runtime.Ob_run.read_error_at ib; match Char.code (Bi_inbuf.read_char ib) with | 0 -> None | 0x80 -> Some ( ( - Atdgen_runtime.Ob_run.read_string + Atdgen_www_runtime.Ob_run.read_string ) ib ) - | _ -> Atdgen_runtime.Ob_run.read_error_at ib + | _ -> Atdgen_www_runtime.Ob_run.read_error_at ib ) let _3_of_string ?pos s = read__3 (Bi_inbuf.from_string ?pos s) @@ -123,10 +123,10 @@ let string_of__4 ?(len = 1024) x = write__4 ob x; Bi_outbuf.contents ob let get__4_reader = ( - get_poly_reader Atdgen_runtime.Ob_run.get_int_reader Atdgen_runtime.Ob_run.read_int get__3_reader read__3 + get_poly_reader Atdgen_www_runtime.Ob_run.get_int_reader Atdgen_www_runtime.Ob_run.read_int get__3_reader read__3 ) let read__4 = ( - read_poly Atdgen_runtime.Ob_run.get_int_reader Atdgen_runtime.Ob_run.read_int get__3_reader read__3 + read_poly Atdgen_www_runtime.Ob_run.get_int_reader Atdgen_www_runtime.Ob_run.read_int get__3_reader read__3 ) let _4_of_string ?pos s = read__4 (Bi_inbuf.from_string ?pos s) @@ -152,7 +152,7 @@ let string_of_test2 ?(len = 1024) x = Bi_outbuf.contents ob let get_test2_reader = ( fun tag -> - if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 21 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let field_test0 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_test1 = ref (Obj.magic (Sys.opaque_identity 0.0)) in @@ -176,7 +176,7 @@ let get_test2_reader = ( bits0 := !bits0 lor 0x2; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x3 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "test0"; "test1" |]; + if !bits0 <> 0x3 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "test0"; "test1" |]; ( { test0 = !field_test0; @@ -186,7 +186,7 @@ let get_test2_reader = ( ) let read_test2 = ( fun ib -> - if Bi_io.read_tag ib <> 21 then Atdgen_runtime.Ob_run.read_error_at ib; + if Bi_io.read_tag ib <> 21 then Atdgen_www_runtime.Ob_run.read_error_at ib; let field_test0 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_test1 = ref (Obj.magic (Sys.opaque_identity 0.0)) in let bits0 = ref 0 in @@ -209,7 +209,7 @@ let read_test2 = ( bits0 := !bits0 lor 0x2; | _ -> Bi_io.skip ib done; - if !bits0 <> 0x3 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "test0"; "test1" |]; + if !bits0 <> 0x3 then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "test0"; "test1" |]; ( { test0 = !field_test0; @@ -231,10 +231,10 @@ let string_of__2 ?(len = 1024) x = write__2 ob x; Bi_outbuf.contents ob let get__2_reader = ( - get_poly_reader Atdgen_runtime.Ob_run.get_int_reader Atdgen_runtime.Ob_run.read_int Atdgen_runtime.Ob_run.get_string_reader Atdgen_runtime.Ob_run.read_string + get_poly_reader Atdgen_www_runtime.Ob_run.get_int_reader Atdgen_www_runtime.Ob_run.read_int Atdgen_www_runtime.Ob_run.get_string_reader Atdgen_www_runtime.Ob_run.read_string ) let read__2 = ( - read_poly Atdgen_runtime.Ob_run.get_int_reader Atdgen_runtime.Ob_run.read_int Atdgen_runtime.Ob_run.get_string_reader Atdgen_runtime.Ob_run.read_string + read_poly Atdgen_www_runtime.Ob_run.get_int_reader Atdgen_www_runtime.Ob_run.read_int Atdgen_www_runtime.Ob_run.get_string_reader Atdgen_www_runtime.Ob_run.read_string ) let _2_of_string ?pos s = read__2 (Bi_inbuf.from_string ?pos s) diff --git a/atdgen/test/test2j.expected.ml b/atdgen/test/test2j.expected.ml index 18f4dda..9c262e8 100644 --- a/atdgen/test/test2j.expected.ml +++ b/atdgen/test/test2j.expected.ml @@ -8,9 +8,9 @@ let write_poly write__aa write__bb = ( Testj.write_poly write__aa write__bb ) let string_of_poly write__aa write__bb ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_poly write__aa write__bb ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_poly read__aa read__bb = ( Testj.read_poly read__aa read__bb ) @@ -20,11 +20,11 @@ let write__1 = ( write_poly Yojson.Safe.write_int Yojson.Safe.write_int ) let string_of__1 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__1 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__1 = ( - read_poly Atdgen_runtime.Oj_run.read_int Atdgen_runtime.Oj_run.read_int + read_poly Atdgen_www_runtime.Oj_run.read_int Atdgen_www_runtime.Oj_run.read_int ) let _1_of_string s = read__1 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) @@ -32,23 +32,23 @@ let write_poly_int2 = ( write__1 ) let string_of_poly_int2 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_poly_int2 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_poly_int2 = ( read__1 ) let poly_int2_of_string s = read_poly_int2 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__3 = ( - Atdgen_runtime.Oj_run.write_std_option ( + Atdgen_www_runtime.Oj_run.write_std_option ( Yojson.Safe.write_string ) ) let string_of__3 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__3 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__3 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -60,39 +60,39 @@ let read__3 = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let _3_of_string s = @@ -101,23 +101,23 @@ let write__4 = ( write_poly Yojson.Safe.write_int write__3 ) let string_of__4 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__4 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__4 = ( - read_poly Atdgen_runtime.Oj_run.read_int read__3 + read_poly Atdgen_www_runtime.Oj_run.read_int read__3 ) let _4_of_string s = read__4 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_test2 : _ -> test2 -> _ = ( fun ob (x : test2) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"test0\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"test0\":"; ( write_poly_int2 ) @@ -125,18 +125,18 @@ let write_test2 : _ -> test2 -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"test1\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"test1\":"; ( write__4 ) ob x.test1; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_test2 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_test2 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_test2 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -168,7 +168,7 @@ let read_test2 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -216,7 +216,7 @@ let read_test2 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -244,8 +244,8 @@ let read_test2 = ( with Yojson.End_of_object -> ( ( { - test0 = (match !field_test0 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "test0"); - test1 = (match !field_test1 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "test1"); + test0 = (match !field_test0 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "test0"); + test1 = (match !field_test1 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "test1"); } : test2) ) @@ -256,11 +256,11 @@ let write__2 = ( write_poly Yojson.Safe.write_int Yojson.Safe.write_string ) let string_of__2 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__2 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__2 = ( - read_poly Atdgen_runtime.Oj_run.read_int Atdgen_runtime.Oj_run.read_string + read_poly Atdgen_www_runtime.Oj_run.read_int Atdgen_www_runtime.Oj_run.read_string ) let _2_of_string s = read__2 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) @@ -268,9 +268,9 @@ let write_poly_int_string = ( write__2 ) let string_of_poly_int_string ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_poly_int_string ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_poly_int_string = ( read__2 ) diff --git a/atdgen/test/test2j.expected.mli b/atdgen/test/test2j.expected.mli index a422ddf..fd4bbb3 100644 --- a/atdgen/test/test2j.expected.mli +++ b/atdgen/test/test2j.expected.mli @@ -5,14 +5,14 @@ open Test2 open Testj val write_poly : - (Bi_outbuf.t -> 'aa -> unit) -> - (Bi_outbuf.t -> 'bb -> unit) -> - Bi_outbuf.t -> ('aa, 'bb) poly -> unit - (** Output a JSON value of type {!poly}. *) + (Buffer.t -> 'aa -> unit) -> + (Buffer.t -> 'bb -> unit) -> + Buffer.t -> ('aa, 'bb) poly -> unit + (** Output a JSON value of type {!type:poly}. *) val string_of_poly : - (Bi_outbuf.t -> 'aa -> unit) -> - (Bi_outbuf.t -> 'bb -> unit) -> + (Buffer.t -> 'aa -> unit) -> + (Buffer.t -> 'bb -> unit) -> ?len:int -> ('aa, 'bb) poly -> string (** Serialize a value of type {!poly} into a JSON string. @@ -34,8 +34,8 @@ val poly_of_string : val write_poly_int2 : - Bi_outbuf.t -> poly_int2 -> unit - (** Output a JSON value of type {!poly_int2}. *) + Buffer.t -> poly_int2 -> unit + (** Output a JSON value of type {!type:poly_int2}. *) val string_of_poly_int2 : ?len:int -> poly_int2 -> string @@ -55,8 +55,8 @@ val poly_int2_of_string : val write_test2 : - Bi_outbuf.t -> test2 -> unit - (** Output a JSON value of type {!test2}. *) + Buffer.t -> test2 -> unit + (** Output a JSON value of type {!type:test2}. *) val string_of_test2 : ?len:int -> test2 -> string @@ -82,8 +82,8 @@ val create_test2 : val write_poly_int_string : - Bi_outbuf.t -> poly_int_string -> unit - (** Output a JSON value of type {!poly_int_string}. *) + Buffer.t -> poly_int_string -> unit + (** Output a JSON value of type {!type:poly_int_string}. *) val string_of_poly_int_string : ?len:int -> poly_int_string -> string diff --git a/atdgen/test/test3j.atd b/atdgen/test/test3j.atd index b48e91c..0341a6a 100644 --- a/atdgen/test/test3j.atd +++ b/atdgen/test/test3j.atd @@ -29,7 +29,7 @@ type patch = { type adapted = [ | A of a | B of b -] +] type a = { thing: string; @@ -52,7 +52,7 @@ type rec_type = { type sf_adapted = [ | A of bool | B of int -] +] (* Test substitute for the retired tag_field feature. diff --git a/atdgen/test/test3j_j.expected.ml b/atdgen/test/test3j_j.expected.ml index f1b3c74..9eed8ee 100644 --- a/atdgen/test/test3j_j.expected.ml +++ b/atdgen/test/test3j_j.expected.ml @@ -41,44 +41,44 @@ type a = Test3j_t.a = { thing: string; other_thing: bool } type adapted = Test3j_t.adapted let rec write__4 ob x = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( write_rec_type ) ) ob x and string_of__4 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__4 ob x; - Bi_outbuf.contents ob + Buffer.contents ob and write_rec_type ob (x : rec_type) = ( - Atdgen_runtime.Oj_run.write_with_adapter Json_adapters.Identity.restore ( + Atdgen_www_runtime.Oj_run.write_with_adapter Json_adapters.Identity.restore ( fun ob (x : rec_type) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"more\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"more\":"; ( write__4 ) ob x.more; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) ) ob x and string_of_rec_type ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_rec_type ob x; - Bi_outbuf.contents ob + Buffer.contents ob let rec read__4 p lb = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( read_rec_type ) ) p lb and _4_of_string s = read__4 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) and read_rec_type p lb = ( - Atdgen_runtime.Oj_run.read_with_adapter Json_adapters.Identity.normalize ( + Atdgen_www_runtime.Oj_run.read_with_adapter Json_adapters.Identity.normalize ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; @@ -99,7 +99,7 @@ and read_rec_type p lb = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -130,7 +130,7 @@ and read_rec_type p lb = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -150,7 +150,7 @@ and read_rec_type p lb = ( with Yojson.End_of_object -> ( ( { - more = (match !field_more with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "more"); + more = (match !field_more with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "more"); } : rec_type) ) @@ -159,17 +159,17 @@ and read_rec_type p lb = ( and rec_type_of_string s = read_rec_type (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__1 = ( - Atdgen_runtime.Oj_run.write_list ( - Atdgen_runtime.Oj_run.write_float_as_int + Atdgen_www_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_float_as_int ) ) let string_of__1 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__1 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__1 = ( - Atdgen_runtime.Oj_run.read_list ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_number ) ) let _1_of_string s = @@ -178,9 +178,9 @@ let write_unixtime_list = ( write__1 ) let string_of_unixtime_list ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_unixtime_list ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_unixtime_list = ( read__1 ) @@ -190,23 +190,23 @@ let write_json = ( Yojson.Safe.write_t ) let string_of_json ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_json ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_json = ( Yojson.Safe.read_t ) let json_of_string s = read_json (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__5 = ( - Atdgen_runtime.Oj_run.write_nullable ( + Atdgen_www_runtime.Oj_run.write_nullable ( write_json ) ) let string_of__5 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__5 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__5 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -221,41 +221,41 @@ let write_tf_variant2 = ( fun ob x -> match x with | `A x -> - Bi_outbuf.add_string ob "[\"a\","; + Buffer.add_string ob "[\"a\","; ( Yojson.Safe.write_int ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' | `B x -> - Bi_outbuf.add_string ob "[\"b\","; + Buffer.add_string ob "[\"b\","; ( Yojson.Safe.write_int ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' | `Unknown x -> - Bi_outbuf.add_string ob "[\"Unknown\","; + Buffer.add_string ob "[\"Unknown\","; ( fun ob x -> - Bi_outbuf.add_char ob '['; + Buffer.add_char ob '['; (let x, _ = x in ( Yojson.Safe.write_string ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x = x in ( write__5 ) ob x ); - Bi_outbuf.add_char ob ']'; + Buffer.add_char ob ']'; ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' ) let string_of_tf_variant2 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_tf_variant2 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_tf_variant2 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -263,25 +263,25 @@ let read_tf_variant2 = ( | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with | "a" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; `A x | "b" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; `B x | "Unknown" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -292,7 +292,7 @@ let read_tf_variant2 = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in incr len; @@ -324,28 +324,28 @@ let read_tf_variant2 = ( ); (x0, x1) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; `Unknown x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "a" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; @@ -356,7 +356,7 @@ let read_tf_variant2 = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; @@ -376,7 +376,7 @@ let read_tf_variant2 = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in incr len; @@ -408,14 +408,14 @@ let read_tf_variant2 = ( ); (x0, x1) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; `Unknown x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let tf_variant2_of_string s = @@ -424,22 +424,22 @@ let write_tf_variant = ( fun ob x -> match x with | `A x -> - Bi_outbuf.add_string ob "[\"a\","; + Buffer.add_string ob "[\"a\","; ( Yojson.Safe.write_int ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' | `B x -> - Bi_outbuf.add_string ob "[\"b\","; + Buffer.add_string ob "[\"b\","; ( Yojson.Safe.write_int ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' ) let string_of_tf_variant ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_tf_variant ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_tf_variant = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -447,39 +447,39 @@ let read_tf_variant = ( | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with | "a" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; `A x | "b" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; `B x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "a" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; @@ -490,28 +490,28 @@ let read_tf_variant = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; `B x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let tf_variant_of_string s = read_tf_variant (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_tf_record2 : _ -> tf_record2 -> _ = ( - Atdgen_runtime.Oj_run.write_with_adapter Test_lib.Tag_field_with_catchall.restore ( + Atdgen_www_runtime.Oj_run.write_with_adapter Test_lib.Tag_field_with_catchall.restore ( fun ob (x : tf_record2) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"the_value2\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"the_value2\":"; ( write_tf_variant2 ) @@ -519,21 +519,21 @@ let write_tf_record2 : _ -> tf_record2 -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"etc2\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"etc2\":"; ( Yojson.Safe.write_string ) ob x.etc2; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) ) let string_of_tf_record2 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_tf_record2 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_tf_record2 = ( - Atdgen_runtime.Oj_run.read_with_adapter Test_lib.Tag_field_with_catchall.normalize ( + Atdgen_www_runtime.Oj_run.read_with_adapter Test_lib.Tag_field_with_catchall.normalize ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; @@ -569,7 +569,7 @@ let read_tf_record2 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -584,7 +584,7 @@ let read_tf_record2 = ( field_etc2 := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -622,7 +622,7 @@ let read_tf_record2 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -637,7 +637,7 @@ let read_tf_record2 = ( field_etc2 := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -650,8 +650,8 @@ let read_tf_record2 = ( with Yojson.End_of_object -> ( ( { - the_value2 = (match !field_the_value2 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "the_value2"); - etc2 = (match !field_etc2 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "etc2"); + the_value2 = (match !field_the_value2 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "the_value2"); + etc2 = (match !field_etc2 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "etc2"); } : tf_record2) ) @@ -660,15 +660,15 @@ let read_tf_record2 = ( let tf_record2_of_string s = read_tf_record2 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_tf_record : _ -> tf_record -> _ = ( - Atdgen_runtime.Oj_run.write_with_adapter Test_lib.Tag_field_example.restore ( + Atdgen_www_runtime.Oj_run.write_with_adapter Test_lib.Tag_field_example.restore ( fun ob (x : tf_record) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"the_value\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"the_value\":"; ( write_tf_variant ) @@ -676,21 +676,21 @@ let write_tf_record : _ -> tf_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"etc\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"etc\":"; ( Yojson.Safe.write_string ) ob x.etc; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) ) let string_of_tf_record ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_tf_record ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_tf_record = ( - Atdgen_runtime.Oj_run.read_with_adapter Test_lib.Tag_field_example.normalize ( + Atdgen_www_runtime.Oj_run.read_with_adapter Test_lib.Tag_field_example.normalize ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; @@ -726,7 +726,7 @@ let read_tf_record = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -741,7 +741,7 @@ let read_tf_record = ( field_etc := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -779,7 +779,7 @@ let read_tf_record = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -794,7 +794,7 @@ let read_tf_record = ( field_etc := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -807,8 +807,8 @@ let read_tf_record = ( with Yojson.End_of_object -> ( ( { - the_value = (match !field_the_value with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "the_value"); - etc = (match !field_etc with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "etc"); + the_value = (match !field_the_value with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "the_value"); + etc = (match !field_etc with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "etc"); } : tf_record) ) @@ -820,9 +820,9 @@ let write_dyn = ( Yojson.Safe.write_t ) let string_of_dyn ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_dyn ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_dyn = ( Yojson.Safe.read_t ) @@ -830,13 +830,13 @@ let dyn_of_string s = read_dyn (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_t : _ -> t -> _ = ( fun ob (x : t) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"foo\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"foo\":"; ( Yojson.Safe.write_int ) @@ -844,8 +844,8 @@ let write_t : _ -> t -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"bar\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"bar\":"; ( write_json ) @@ -853,18 +853,18 @@ let write_t : _ -> t -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"baz\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"baz\":"; ( write_dyn ) ob x.baz; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_t ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_t ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_t = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -916,14 +916,14 @@ let read_t = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_foo := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -991,14 +991,14 @@ let read_t = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_foo := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -1027,9 +1027,9 @@ let read_t = ( with Yojson.End_of_object -> ( ( { - foo = (match !field_foo with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "foo"); - bar = (match !field_bar with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "bar"); - baz = (match !field_baz with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "baz"); + foo = (match !field_foo with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "foo"); + bar = (match !field_bar with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "bar"); + baz = (match !field_baz with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "baz"); } : t) ) @@ -1037,68 +1037,68 @@ let read_t = ( let t_of_string s = read_t (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_sf_adapted = ( - Atdgen_runtime.Oj_run.write_with_adapter Atdgen_runtime.Json_adapter.One_field.restore ( + Atdgen_www_runtime.Oj_run.write_with_adapter Atdgen_www_runtime.Json_adapter.One_field.restore ( fun ob x -> match x with | `A x -> - Bi_outbuf.add_string ob "[\"a\","; + Buffer.add_string ob "[\"a\","; ( Yojson.Safe.write_bool ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' | `B x -> - Bi_outbuf.add_string ob "[\"b\","; + Buffer.add_string ob "[\"b\","; ( Yojson.Safe.write_int ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' ) ) let string_of_sf_adapted ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_sf_adapted ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_sf_adapted = ( - Atdgen_runtime.Oj_run.read_with_adapter Atdgen_runtime.Json_adapter.One_field.normalize ( + Atdgen_www_runtime.Oj_run.read_with_adapter Atdgen_www_runtime.Json_adapter.One_field.normalize ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with | "a" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; `A x | "b" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; `B x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "a" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb in Yojson.Safe.read_space p lb; @@ -1109,14 +1109,14 @@ let read_sf_adapted = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; `B x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) ) @@ -1125,16 +1125,16 @@ let sf_adapted_of_string s = let write_sample_open_enum = ( fun ob x -> match x with - | `Alpha -> Bi_outbuf.add_string ob "\"Alpha\"" - | `Beta -> Bi_outbuf.add_string ob "\"Beta\"" + | `Alpha -> Buffer.add_string ob "\"Alpha\"" + | `Beta -> Buffer.add_string ob "\"Beta\"" | `Other x -> ( Yojson.Safe.write_string ) ob x; ) let string_of_sample_open_enum ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_sample_open_enum ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_sample_open_enum = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1162,24 +1162,24 @@ let read_sample_open_enum = ( `Other x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let sample_open_enum_of_string s = read_sample_open_enum (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__6 = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( write_sample_open_enum ) ) let string_of__6 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__6 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__6 = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( read_sample_open_enum ) ) @@ -1189,42 +1189,42 @@ let write_sample_open_enums = ( write__6 ) let string_of_sample_open_enums ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_sample_open_enums ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_sample_open_enums = ( read__6 ) let sample_open_enums_of_string s = read_sample_open_enums (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__2 = ( - Atdgen_runtime.Oj_run.write_nullable ( + Atdgen_www_runtime.Oj_run.write_nullable ( Yojson.Safe.write_int ) ) let string_of__2 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__2 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__2 = ( fun p lb -> Yojson.Safe.read_space p lb; (if Yojson.Safe.read_null_if_possible p lb then None else Some (( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb) : _ option) ) let _2_of_string s = read__2 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__3 = ( - Atdgen_runtime.Oj_run.write_std_option ( + Atdgen_www_runtime.Oj_run.write_std_option ( write__2 ) ) let string_of__3 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__3 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__3 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1236,7 +1236,7 @@ let read__3 = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read__2 ) p lb @@ -1245,17 +1245,17 @@ let read__3 = ( Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -1268,21 +1268,21 @@ let read__3 = ( Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let _3_of_string s = read__3 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_patch : _ -> patch -> _ = ( fun ob (x : patch) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in (match x.patch1 with None -> () | Some x -> if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"patch1\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"patch1\":"; ( write__2 ) @@ -1292,8 +1292,8 @@ let write_patch : _ -> patch -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"patch2\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"patch2\":"; ( write__2 ) @@ -1303,19 +1303,19 @@ let write_patch : _ -> patch -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"patch3\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"patch3\":"; ( write__2 ) ob x; ); - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_patch ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_patch ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_patch = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1351,7 +1351,7 @@ let read_patch = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -1410,7 +1410,7 @@ let read_patch = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -1457,23 +1457,23 @@ let patch_of_string s = read_patch (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_b : _ -> b -> _ = ( fun ob (x : b) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"thing\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"thing\":"; ( Yojson.Safe.write_int ) ob x.thing; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_b ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_b ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_b = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1495,14 +1495,14 @@ let read_b = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_thing := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -1526,14 +1526,14 @@ let read_b = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_thing := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -1546,7 +1546,7 @@ let read_b = ( with Yojson.End_of_object -> ( ( { - thing = (match !field_thing with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "thing"); + thing = (match !field_thing with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "thing"); } : b) ) @@ -1555,13 +1555,13 @@ let b_of_string s = read_b (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_a : _ -> a -> _ = ( fun ob (x : a) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"thing\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"thing\":"; ( Yojson.Safe.write_string ) @@ -1569,18 +1569,18 @@ let write_a : _ -> a -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"other_thing\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"other_thing\":"; ( Yojson.Safe.write_bool ) ob x.other_thing; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_a = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1617,14 +1617,14 @@ let read_a = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_thing := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -1632,7 +1632,7 @@ let read_a = ( field_other_thing := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -1670,14 +1670,14 @@ let read_a = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_thing := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -1685,7 +1685,7 @@ let read_a = ( field_other_thing := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -1698,8 +1698,8 @@ let read_a = ( with Yojson.End_of_object -> ( ( { - thing = (match !field_thing with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "thing"); - other_thing = (match !field_other_thing with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "other_thing"); + thing = (match !field_thing with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "thing"); + other_thing = (match !field_other_thing with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "other_thing"); } : a) ) @@ -1707,36 +1707,36 @@ let read_a = ( let a_of_string s = read_a (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_adapted = ( - Atdgen_runtime.Oj_run.write_with_adapter Atdgen_runtime.Json_adapter.Type_field.restore ( + Atdgen_www_runtime.Oj_run.write_with_adapter Atdgen_www_runtime.Json_adapter.Type_field.restore ( fun ob x -> match x with | `A x -> - Bi_outbuf.add_string ob "[\"a\","; + Buffer.add_string ob "[\"a\","; ( write_a ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' | `B x -> - Bi_outbuf.add_string ob "[\"b\","; + Buffer.add_string ob "[\"b\","; ( write_b ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' ) ) let string_of_adapted ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_adapted ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_adapted = ( - Atdgen_runtime.Oj_run.read_with_adapter Atdgen_runtime.Json_adapter.Type_field.normalize ( + Atdgen_www_runtime.Oj_run.read_with_adapter Atdgen_www_runtime.Json_adapter.Type_field.normalize ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with | "a" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read_a ) p lb @@ -1745,7 +1745,7 @@ let read_adapted = ( Yojson.Safe.read_gt p lb; `A x | "b" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read_b ) p lb @@ -1754,15 +1754,15 @@ let read_adapted = ( Yojson.Safe.read_gt p lb; `B x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "a" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -1786,7 +1786,7 @@ let read_adapted = ( Yojson.Safe.read_rbr p lb; `B x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) ) diff --git a/atdgen/test/test3j_j.expected.mli b/atdgen/test/test3j_j.expected.mli index 595b7ac..58871e0 100644 --- a/atdgen/test/test3j_j.expected.mli +++ b/atdgen/test/test3j_j.expected.mli @@ -41,8 +41,8 @@ type a = Test3j_t.a = { thing: string; other_thing: bool } type adapted = Test3j_t.adapted val write_rec_type : - Bi_outbuf.t -> rec_type -> unit - (** Output a JSON value of type {!rec_type}. *) + Buffer.t -> rec_type -> unit + (** Output a JSON value of type {!type:rec_type}. *) val string_of_rec_type : ?len:int -> rec_type -> string @@ -61,8 +61,8 @@ val rec_type_of_string : (** Deserialize JSON data of type {!rec_type}. *) val write_unixtime_list : - Bi_outbuf.t -> unixtime_list -> unit - (** Output a JSON value of type {!unixtime_list}. *) + Buffer.t -> unixtime_list -> unit + (** Output a JSON value of type {!type:unixtime_list}. *) val string_of_unixtime_list : ?len:int -> unixtime_list -> string @@ -81,8 +81,8 @@ val unixtime_list_of_string : (** Deserialize JSON data of type {!unixtime_list}. *) val write_json : - Bi_outbuf.t -> json -> unit - (** Output a JSON value of type {!json}. *) + Buffer.t -> json -> unit + (** Output a JSON value of type {!type:json}. *) val string_of_json : ?len:int -> json -> string @@ -101,8 +101,8 @@ val json_of_string : (** Deserialize JSON data of type {!json}. *) val write_tf_variant2 : - Bi_outbuf.t -> tf_variant2 -> unit - (** Output a JSON value of type {!tf_variant2}. *) + Buffer.t -> tf_variant2 -> unit + (** Output a JSON value of type {!type:tf_variant2}. *) val string_of_tf_variant2 : ?len:int -> tf_variant2 -> string @@ -121,8 +121,8 @@ val tf_variant2_of_string : (** Deserialize JSON data of type {!tf_variant2}. *) val write_tf_variant : - Bi_outbuf.t -> tf_variant -> unit - (** Output a JSON value of type {!tf_variant}. *) + Buffer.t -> tf_variant -> unit + (** Output a JSON value of type {!type:tf_variant}. *) val string_of_tf_variant : ?len:int -> tf_variant -> string @@ -141,8 +141,8 @@ val tf_variant_of_string : (** Deserialize JSON data of type {!tf_variant}. *) val write_tf_record2 : - Bi_outbuf.t -> tf_record2 -> unit - (** Output a JSON value of type {!tf_record2}. *) + Buffer.t -> tf_record2 -> unit + (** Output a JSON value of type {!type:tf_record2}. *) val string_of_tf_record2 : ?len:int -> tf_record2 -> string @@ -161,8 +161,8 @@ val tf_record2_of_string : (** Deserialize JSON data of type {!tf_record2}. *) val write_tf_record : - Bi_outbuf.t -> tf_record -> unit - (** Output a JSON value of type {!tf_record}. *) + Buffer.t -> tf_record -> unit + (** Output a JSON value of type {!type:tf_record}. *) val string_of_tf_record : ?len:int -> tf_record -> string @@ -181,8 +181,8 @@ val tf_record_of_string : (** Deserialize JSON data of type {!tf_record}. *) val write_dyn : - Bi_outbuf.t -> dyn -> unit - (** Output a JSON value of type {!dyn}. *) + Buffer.t -> dyn -> unit + (** Output a JSON value of type {!type:dyn}. *) val string_of_dyn : ?len:int -> dyn -> string @@ -201,8 +201,8 @@ val dyn_of_string : (** Deserialize JSON data of type {!dyn}. *) val write_t : - Bi_outbuf.t -> t -> unit - (** Output a JSON value of type {!t}. *) + Buffer.t -> t -> unit + (** Output a JSON value of type {!type:t}. *) val string_of_t : ?len:int -> t -> string @@ -221,8 +221,8 @@ val t_of_string : (** Deserialize JSON data of type {!t}. *) val write_sf_adapted : - Bi_outbuf.t -> sf_adapted -> unit - (** Output a JSON value of type {!sf_adapted}. *) + Buffer.t -> sf_adapted -> unit + (** Output a JSON value of type {!type:sf_adapted}. *) val string_of_sf_adapted : ?len:int -> sf_adapted -> string @@ -241,8 +241,8 @@ val sf_adapted_of_string : (** Deserialize JSON data of type {!sf_adapted}. *) val write_sample_open_enum : - Bi_outbuf.t -> sample_open_enum -> unit - (** Output a JSON value of type {!sample_open_enum}. *) + Buffer.t -> sample_open_enum -> unit + (** Output a JSON value of type {!type:sample_open_enum}. *) val string_of_sample_open_enum : ?len:int -> sample_open_enum -> string @@ -261,8 +261,8 @@ val sample_open_enum_of_string : (** Deserialize JSON data of type {!sample_open_enum}. *) val write_sample_open_enums : - Bi_outbuf.t -> sample_open_enums -> unit - (** Output a JSON value of type {!sample_open_enums}. *) + Buffer.t -> sample_open_enums -> unit + (** Output a JSON value of type {!type:sample_open_enums}. *) val string_of_sample_open_enums : ?len:int -> sample_open_enums -> string @@ -281,8 +281,8 @@ val sample_open_enums_of_string : (** Deserialize JSON data of type {!sample_open_enums}. *) val write_patch : - Bi_outbuf.t -> patch -> unit - (** Output a JSON value of type {!patch}. *) + Buffer.t -> patch -> unit + (** Output a JSON value of type {!type:patch}. *) val string_of_patch : ?len:int -> patch -> string @@ -301,8 +301,8 @@ val patch_of_string : (** Deserialize JSON data of type {!patch}. *) val write_b : - Bi_outbuf.t -> b -> unit - (** Output a JSON value of type {!b}. *) + Buffer.t -> b -> unit + (** Output a JSON value of type {!type:b}. *) val string_of_b : ?len:int -> b -> string @@ -321,8 +321,8 @@ val b_of_string : (** Deserialize JSON data of type {!b}. *) val write_a : - Bi_outbuf.t -> a -> unit - (** Output a JSON value of type {!a}. *) + Buffer.t -> a -> unit + (** Output a JSON value of type {!type:a}. *) val string_of_a : ?len:int -> a -> string @@ -341,8 +341,8 @@ val a_of_string : (** Deserialize JSON data of type {!a}. *) val write_adapted : - Bi_outbuf.t -> adapted -> unit - (** Output a JSON value of type {!adapted}. *) + Buffer.t -> adapted -> unit + (** Output a JSON value of type {!type:adapted}. *) val string_of_adapted : ?len:int -> adapted -> string diff --git a/atdgen/test/test_ambiguous_record_j.expected.ml b/atdgen/test/test_ambiguous_record_j.expected.ml index 7c61e1a..4e18aa8 100644 --- a/atdgen/test/test_ambiguous_record_j.expected.ml +++ b/atdgen/test/test_ambiguous_record_j.expected.ml @@ -3,15 +3,15 @@ open Test_ambiguous_record_t let write_ambiguous' : _ -> ambiguous' -> _ = ( - Atdgen_runtime.Oj_run.write_with_adapter Json_adapters.Identity.restore ( + Atdgen_www_runtime.Oj_run.write_with_adapter Json_adapters.Identity.restore ( fun ob (x : ambiguous') -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"ambiguous\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"ambiguous\":"; ( Yojson.Safe.write_string ) @@ -19,21 +19,21 @@ let write_ambiguous' : _ -> ambiguous' -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"not_ambiguous2\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"not_ambiguous2\":"; ( Yojson.Safe.write_int ) ob x.not_ambiguous2; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) ) let string_of_ambiguous' ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_ambiguous' ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_ambiguous' = ( - Atdgen_runtime.Oj_run.read_with_adapter Json_adapters.Identity.normalize ( + Atdgen_www_runtime.Oj_run.read_with_adapter Json_adapters.Identity.normalize ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; @@ -69,14 +69,14 @@ let read_ambiguous' = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_ambiguous := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -84,7 +84,7 @@ let read_ambiguous' = ( field_not_ambiguous2 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -122,14 +122,14 @@ let read_ambiguous' = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_ambiguous := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -137,7 +137,7 @@ let read_ambiguous' = ( field_not_ambiguous2 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -150,8 +150,8 @@ let read_ambiguous' = ( with Yojson.End_of_object -> ( ( { - ambiguous = (match !field_ambiguous with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ambiguous"); - not_ambiguous2 = (match !field_not_ambiguous2 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "not_ambiguous2"); + ambiguous = (match !field_ambiguous with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "ambiguous"); + not_ambiguous2 = (match !field_not_ambiguous2 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "not_ambiguous2"); } : ambiguous') ) @@ -161,13 +161,13 @@ let ambiguous'_of_string s = read_ambiguous' (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_ambiguous : _ -> ambiguous -> _ = ( fun ob (x : ambiguous) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"ambiguous\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"ambiguous\":"; ( Yojson.Safe.write_string ) @@ -175,18 +175,18 @@ let write_ambiguous : _ -> ambiguous -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"not_ambiguous1\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"not_ambiguous1\":"; ( Yojson.Safe.write_int ) ob x.not_ambiguous1; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_ambiguous ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_ambiguous ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_ambiguous = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -223,14 +223,14 @@ let read_ambiguous = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_ambiguous := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -238,7 +238,7 @@ let read_ambiguous = ( field_not_ambiguous1 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -276,14 +276,14 @@ let read_ambiguous = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_ambiguous := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -291,7 +291,7 @@ let read_ambiguous = ( field_not_ambiguous1 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -304,8 +304,8 @@ let read_ambiguous = ( with Yojson.End_of_object -> ( ( { - ambiguous = (match !field_ambiguous with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ambiguous"); - not_ambiguous1 = (match !field_not_ambiguous1 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "not_ambiguous1"); + ambiguous = (match !field_ambiguous with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "ambiguous"); + not_ambiguous1 = (match !field_not_ambiguous1 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "not_ambiguous1"); } : ambiguous) ) diff --git a/atdgen/test/test_annot_j.expected.ml b/atdgen/test/test_annot_j.expected.ml index 57320d8..ad68f0f 100644 --- a/atdgen/test/test_annot_j.expected.ml +++ b/atdgen/test/test_annot_j.expected.ml @@ -9,23 +9,23 @@ type pointA = ProtoA_t.pointA = { f: float } let write_pointC : _ -> pointC -> _ = ( fun ob (x : pointC) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"f\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"f\":"; ( Yojson.Safe.write_std_float ) ob x.f; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_pointC ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_pointC ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_pointC = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -47,14 +47,14 @@ let read_pointC = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_f := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -78,14 +78,14 @@ let read_pointC = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_f := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -98,7 +98,7 @@ let read_pointC = ( with Yojson.End_of_object -> ( ( { - f = (match !field_f with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "f"); + f = (match !field_f with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "f"); } : pointC) ) @@ -107,23 +107,23 @@ let pointC_of_string s = read_pointC (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_pointB : _ -> pointB -> _ = ( fun ob (x : pointB) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"f\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"f\":"; ( Yojson.Safe.write_std_float ) ob x.f; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_pointB ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_pointB ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_pointB = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -145,14 +145,14 @@ let read_pointB = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_f := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -176,14 +176,14 @@ let read_pointB = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_f := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -196,7 +196,7 @@ let read_pointB = ( with Yojson.End_of_object -> ( ( { - f = (match !field_f with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "f"); + f = (match !field_f with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "f"); } : pointB) ) @@ -205,23 +205,23 @@ let pointB_of_string s = read_pointB (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_pointA : _ -> pointA -> _ = ( fun ob (x : pointA) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"f\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"f\":"; ( Yojson.Safe.write_std_float ) ob x.f; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_pointA ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_pointA ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_pointA = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -243,14 +243,14 @@ let read_pointA = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_f := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -274,14 +274,14 @@ let read_pointA = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_f := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -294,7 +294,7 @@ let read_pointA = ( with Yojson.End_of_object -> ( ( { - f = (match !field_f with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "f"); + f = (match !field_f with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "f"); } : pointA) ) diff --git a/atdgen/test/test_annot_j.expected.mli b/atdgen/test/test_annot_j.expected.mli index 5d3e31c..39e3ced 100644 --- a/atdgen/test/test_annot_j.expected.mli +++ b/atdgen/test/test_annot_j.expected.mli @@ -8,8 +8,8 @@ type pointB = ProtoD_t.pointB = { f: float } type pointA = ProtoA_t.pointA = { f: float } val write_pointC : - Bi_outbuf.t -> pointC -> unit - (** Output a JSON value of type {!pointC}. *) + Buffer.t -> pointC -> unit + (** Output a JSON value of type {!type:pointC}. *) val string_of_pointC : ?len:int -> pointC -> string @@ -28,8 +28,8 @@ val pointC_of_string : (** Deserialize JSON data of type {!pointC}. *) val write_pointB : - Bi_outbuf.t -> pointB -> unit - (** Output a JSON value of type {!pointB}. *) + Buffer.t -> pointB -> unit + (** Output a JSON value of type {!type:pointB}. *) val string_of_pointB : ?len:int -> pointB -> string @@ -48,8 +48,8 @@ val pointB_of_string : (** Deserialize JSON data of type {!pointB}. *) val write_pointA : - Bi_outbuf.t -> pointA -> unit - (** Output a JSON value of type {!pointA}. *) + Buffer.t -> pointA -> unit + (** Output a JSON value of type {!type:pointA}. *) val string_of_pointA : ?len:int -> pointA -> string diff --git a/atdgen/test/test_atdgen_main.ml b/atdgen/test/test_atdgen_main.ml index 063cbe6..f93e03c 100644 --- a/atdgen/test/test_atdgen_main.ml +++ b/atdgen/test/test_atdgen_main.ml @@ -34,8 +34,8 @@ let expect_error f x = eprintf "Did not get expected error\n%!"; fail () with - Atdgen_runtime.Ob_run.Error _ - | Atdgen_runtime.Oj_run.Error _ -> () + Atdgen_www_runtime.Ob_run.Error _ + | Atdgen_www_runtime.Oj_run.Error _ -> () let test_missing_record = { Test.b0 = 123; @@ -77,7 +77,7 @@ type extended = { let get_extended_reader = ( fun tag -> - if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else + if tag <> 21 then Atdgen_www_runtime.Ob_run.read_error () else fun ib -> let field_b0x = ref (Obj.magic (Sys.opaque_identity 0.0)) in let field_b1x = ref (Obj.magic (Sys.opaque_identity 0.0)) in @@ -92,14 +92,14 @@ let get_extended_reader = ( | 21902 -> field_b0x := ( ( - Atdgen_runtime.Ob_run.read_int + Atdgen_www_runtime.Ob_run.read_int ) ib ); bits0 := !bits0 lor 0x1; | 21903 -> field_b1x := ( ( - Atdgen_runtime.Ob_run.read_bool + Atdgen_www_runtime.Ob_run.read_bool ) ib ); bits0 := !bits0 lor 0x2; @@ -107,12 +107,12 @@ let get_extended_reader = ( | 21907 -> field_b5x := ( ( - Atdgen_runtime.Ob_run.read_float64 + Atdgen_www_runtime.Ob_run.read_float64 ) ib ); | _ -> Bi_io.skip ib done; - if !bits0 <> 0xf then Atdgen_runtime.Ob_run.missing_fields + if !bits0 <> 0xf then Atdgen_www_runtime.Ob_run.missing_fields [| !bits0 |] [| "b0"; "b1"; "b2"; "b4" |]; ( { @@ -453,22 +453,22 @@ let test_validators4 () = let test_json_files () = section "json files"; let x = Some 123 in - let s = Atdgen_runtime.Util.Json.to_string Testj.write_intopt x in - let x' = Atdgen_runtime.Util.Json.from_string Testj.read_intopt s in + let s = Atdgen_www_runtime.Util.Json.to_string Testj.write_intopt x in + let x' = Atdgen_www_runtime.Util.Json.from_string Testj.read_intopt s in check (x = x'); - Atdgen_runtime.Util.Json.to_file Testj.write_intopt "test-json-files.json" x; - let x'' = Atdgen_runtime.Util.Json.from_file Testj.read_intopt "test-json-files.json" in + Atdgen_www_runtime.Util.Json.to_file Testj.write_intopt "test-json-files.json" x; + let x'' = Atdgen_www_runtime.Util.Json.from_file Testj.read_intopt "test-json-files.json" in check (x = x'') let test_json_streams () = section "json streams"; let l = [ Some 1; None; Some 2; Some 3 ] in - let s = Atdgen_runtime.Util.Json.list_to_string Testj.write_intopt l in - let l' = Atdgen_runtime.Util.Json.list_from_string Testj.read_intopt s in + let s = Atdgen_www_runtime.Util.Json.list_to_string Testj.write_intopt l in + let l' = Atdgen_www_runtime.Util.Json.list_from_string Testj.read_intopt s in check (l = l'); - Atdgen_runtime.Util.Json.list_to_file Testj.write_intopt "test-json-streams.json" l; + Atdgen_www_runtime.Util.Json.list_to_file Testj.write_intopt "test-json-streams.json" l; let l'' = - Atdgen_runtime.Util.Json.list_from_file Testj.read_intopt "test-json-streams.json" + Atdgen_www_runtime.Util.Json.list_from_file Testj.read_intopt "test-json-streams.json" in check (l = l'') diff --git a/atdgen/test/test_lib.ml b/atdgen/test/test_lib.ml index 25e5de8..d1b830f 100644 --- a/atdgen/test/test_lib.ml +++ b/atdgen/test/test_lib.ml @@ -57,14 +57,14 @@ struct end module Tag_field_example = - Atdgen_runtime.Json_adapter.Type_and_value_fields.Make (struct + Atdgen_www_runtime.Json_adapter.Type_and_value_fields.Make (struct let type_field_name = "the_type" let value_field_name = "the_value" let known_tags = None end) module Tag_field_with_catchall = - Atdgen_runtime.Json_adapter.Type_and_value_fields.Make (struct + Atdgen_www_runtime.Json_adapter.Type_and_value_fields.Make (struct let type_field_name = "the_type" let value_field_name = "the_value2" let known_tags = Some (["a";"b"], "Unknown") diff --git a/atdgen/test/test_polymorphic_wrap_j.expected.ml b/atdgen/test/test_polymorphic_wrap_j.expected.ml index a15c48c..5af727d 100644 --- a/atdgen/test/test_polymorphic_wrap_j.expected.ml +++ b/atdgen/test/test_polymorphic_wrap_j.expected.ml @@ -4,16 +4,16 @@ type 'a t = 'a Array_wrap.t let write__1 write__a = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( write__a ) ) let string_of__1 write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__1 write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__1 read__a = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( read__a ) ) @@ -26,9 +26,9 @@ let write__2 write__a = ( ) ob x) ) let string_of__2 write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__2 write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__2 read__a = ( fun p lb -> let x = ( @@ -42,9 +42,9 @@ let write_t write__a = ( write__2 write__a ) let string_of_t write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_t write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_t read__a = ( read__2 read__a ) diff --git a/atdgen/test/testj.expected.ml b/atdgen/test/testj.expected.ml index e9f76ed..45925cc 100644 --- a/atdgen/test/testj.expected.ml +++ b/atdgen/test/testj.expected.ml @@ -33,11 +33,11 @@ type mixed_record = Test.mixed_record = { field1: float option; field2: string option; field3: Int64.t; - field4: float Atdgen_runtime.Util.ocaml_array; + field4: float Atdgen_www_runtime.Util.ocaml_array; field5: bool option; field6: string option; field7: test_variant; - field8: string Atdgen_runtime.Util.ocaml_array; + field8: string Atdgen_www_runtime.Util.ocaml_array; field9: (int * int * Char.t * int * Int32.t * Int64.t); field10: bool; field11: bool; @@ -153,16 +153,16 @@ type 'a abs2 = 'a Test.abs2 type 'a abs1 = 'a Test.abs1 let write__19 write__a = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( write__a ) ) let string_of__19 write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__19 write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__19 read__a = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( read__a ) ) @@ -171,24 +171,24 @@ let _19_of_string read__a s = let rec write_p' write__a : _ -> 'a p' -> _ = ( fun ob x -> match x with - | A -> Bi_outbuf.add_string ob "<\"A\">" + | A -> Buffer.add_string ob "<\"A\">" | Bb x -> - Bi_outbuf.add_string ob "<\"Bb\":"; + Buffer.add_string ob "<\"Bb\":"; ( write_p' write__a ) ob x; - Bi_outbuf.add_char ob '>' + Buffer.add_char ob '>' | Ccccc x -> - Bi_outbuf.add_string ob "<\"Ccccc\":"; + Buffer.add_string ob "<\"Ccccc\":"; ( write__a ) ob x; - Bi_outbuf.add_char ob '>' + Buffer.add_char ob '>' ) and string_of_p' write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_p' write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let rec read_p' read__a = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -200,7 +200,7 @@ let rec read_p' read__a = ( Yojson.Safe.read_gt p lb; (A : 'a p') | "Bb" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read_p' read__a ) p lb @@ -209,7 +209,7 @@ let rec read_p' read__a = ( Yojson.Safe.read_gt p lb; (Bb x : 'a p') | "Ccccc" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read__a ) p lb @@ -218,17 +218,17 @@ let rec read_p' read__a = ( Yojson.Safe.read_gt p lb; (Ccccc x : 'a p') | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "A" -> (A : 'a p') | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Bb" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -252,7 +252,7 @@ let rec read_p' read__a = ( Yojson.Safe.read_rbr p lb; (Ccccc x : 'a p') | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) and p'_of_string read__a s = @@ -260,28 +260,28 @@ and p'_of_string read__a s = let rec write_p = ( fun ob x -> match x with - | `A -> Bi_outbuf.add_string ob "<\"A\">" + | `A -> Buffer.add_string ob "<\"A\">" | `B x -> - Bi_outbuf.add_string ob "<\"B\":"; + Buffer.add_string ob "<\"B\":"; ( write_r ) ob x; - Bi_outbuf.add_char ob '>' - | `C -> Bi_outbuf.add_string ob "<\"C\">" + Buffer.add_char ob '>' + | `C -> Buffer.add_string ob "<\"C\">" ) and string_of_p ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_p ob x; - Bi_outbuf.contents ob + Buffer.contents ob and write_r : _ -> r -> _ = ( fun ob (x : r) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"a\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"a\":"; ( Yojson.Safe.write_int ) @@ -289,8 +289,8 @@ and write_r : _ -> r -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b\":"; ( Yojson.Safe.write_bool ) @@ -298,18 +298,18 @@ and write_r : _ -> r -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"c\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"c\":"; ( write_p ) ob x.c; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) and string_of_r ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_r ob x; - Bi_outbuf.contents ob + Buffer.contents ob let rec read_p = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -321,7 +321,7 @@ let rec read_p = ( Yojson.Safe.read_gt p lb; `A | "B" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read_r ) p lb @@ -334,7 +334,7 @@ let rec read_p = ( Yojson.Safe.read_gt p lb; `C | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with @@ -343,10 +343,10 @@ let rec read_p = ( | "C" -> `C | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "B" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -359,7 +359,7 @@ let rec read_p = ( Yojson.Safe.read_rbr p lb; `B x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) and p_of_string s = @@ -401,14 +401,14 @@ and read_r = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_a := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -416,7 +416,7 @@ and read_r = ( field_b := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -462,14 +462,14 @@ and read_r = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_a := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -477,7 +477,7 @@ and read_r = ( field_b := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -498,9 +498,9 @@ and read_r = ( with Yojson.End_of_object -> ( ( { - a = (match !field_a with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "a"); - b = (match !field_b with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "b"); - c = (match !field_c with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "c"); + a = (match !field_a with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "a"); + b = (match !field_b with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "b"); + c = (match !field_c with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "c"); } : r) ) @@ -508,23 +508,23 @@ and read_r = ( and r_of_string s = read_r (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let rec write__20 write__a write__b ob x = ( - Atdgen_runtime.Oj_run.write_option ( + Atdgen_www_runtime.Oj_run.write_option ( write_poly write__a write__b ) ) ob x and string_of__20 write__a write__b ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__20 write__a write__b ob x; - Bi_outbuf.contents ob + Buffer.contents ob and write_poly write__x write__y : _ -> ('x, 'y) poly -> _ = ( fun ob (x : ('x, 'y) poly) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"fst\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"fst\":"; ( write__19 write__x ) @@ -532,18 +532,18 @@ and write_poly write__x write__y : _ -> ('x, 'y) poly -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"snd\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"snd\":"; ( write__20 write__x write__y ) ob x.snd; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) and string_of_poly write__x write__y ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_poly write__x write__y ob x; - Bi_outbuf.contents ob + Buffer.contents ob let rec read__20 read__a read__b = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -555,7 +555,7 @@ let rec read__20 read__a read__b = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read_poly read__a read__b ) p lb @@ -564,17 +564,17 @@ let rec read__20 read__a read__b = ( Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -587,7 +587,7 @@ let rec read__20 read__a read__b = ( Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) and _20_of_string read__a read__b s = @@ -637,7 +637,7 @@ and read_poly read__x read__y = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -699,7 +699,7 @@ and read_poly read__x read__y = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -727,8 +727,8 @@ and read_poly read__x read__y = ( with Yojson.End_of_object -> ( ( { - fst = (match !field_fst with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "fst"); - snd = (match !field_snd with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "snd"); + fst = (match !field_fst with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "fst"); + snd = (match !field_snd with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "snd"); } : ('x, 'y) poly) ) @@ -736,43 +736,43 @@ and read_poly read__x read__y = ( and poly_of_string read__x read__y s = read_poly read__x read__y (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let rec write__2 ob x = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( write_test_variant ) ) ob x and string_of__2 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__2 ob x; - Bi_outbuf.contents ob + Buffer.contents ob and write_test_variant = ( fun ob x -> match x with - | `Case1 -> Bi_outbuf.add_string ob "<\"Case1\">" + | `Case1 -> Buffer.add_string ob "<\"Case1\">" | `Case2 x -> - Bi_outbuf.add_string ob "<\"Case2\":"; + Buffer.add_string ob "<\"Case2\":"; ( Yojson.Safe.write_int ) ob x; - Bi_outbuf.add_char ob '>' + Buffer.add_char ob '>' | `Case3 x -> - Bi_outbuf.add_string ob "<\"Case3\":"; + Buffer.add_string ob "<\"Case3\":"; ( Yojson.Safe.write_string ) ob x; - Bi_outbuf.add_char ob '>' + Buffer.add_char ob '>' | `Case4 x -> - Bi_outbuf.add_string ob "<\"Case4\":"; + Buffer.add_string ob "<\"Case4\":"; ( write__2 ) ob x; - Bi_outbuf.add_char ob '>' + Buffer.add_char ob '>' ) and string_of_test_variant ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_test_variant ob x; - Bi_outbuf.contents ob + Buffer.contents ob let rec read__2 p lb = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( read_test_variant ) ) p lb @@ -789,25 +789,25 @@ and read_test_variant = ( Yojson.Safe.read_gt p lb; `Case1 | "Case2" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; `Case2 x | "Case3" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; `Case3 x | "Case4" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read__2 ) p lb @@ -816,23 +816,23 @@ and read_test_variant = ( Yojson.Safe.read_gt p lb; `Case4 x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "Case1" -> `Case1 | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Case2" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; @@ -843,7 +843,7 @@ and read_test_variant = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; @@ -861,7 +861,7 @@ and read_test_variant = ( Yojson.Safe.read_rbr p lb; `Case4 x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) and test_variant_of_string s = @@ -869,24 +869,24 @@ and test_variant_of_string s = let rec write__1 : _ -> _ p' -> _ = ( fun ob x -> match x with - | A -> Bi_outbuf.add_string ob "<\"A\">" + | A -> Buffer.add_string ob "<\"A\">" | Bb x -> - Bi_outbuf.add_string ob "<\"Bb\":"; + Buffer.add_string ob "<\"Bb\":"; ( write__1 ) ob x; - Bi_outbuf.add_char ob '>' + Buffer.add_char ob '>' | Ccccc x -> - Bi_outbuf.add_string ob "<\"Ccccc\":"; + Buffer.add_string ob "<\"Ccccc\":"; ( Yojson.Safe.write_int ) ob x; - Bi_outbuf.add_char ob '>' + Buffer.add_char ob '>' ) and string_of__1 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__1 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let rec read__1 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -898,7 +898,7 @@ let rec read__1 = ( Yojson.Safe.read_gt p lb; (A : _ p') | "Bb" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read__1 ) p lb @@ -907,26 +907,26 @@ let rec read__1 = ( Yojson.Safe.read_gt p lb; (Bb x : _ p') | "Ccccc" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (Ccccc x : _ p') | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "A" -> (A : _ p') | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Bb" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -943,14 +943,14 @@ let rec read__1 = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (Ccccc x : _ p') | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) and _1_of_string s = @@ -959,26 +959,26 @@ let write_validated_string_check = ( Yojson.Safe.write_string ) let string_of_validated_string_check ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_validated_string_check ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_validated_string_check = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) let validated_string_check_of_string s = read_validated_string_check (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__31 = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( Yojson.Safe.write_string ) ) let string_of__31 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__31 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__31 = ( - Atdgen_runtime.Oj_run.read_list ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_string ) ) let _31_of_string s = @@ -987,9 +987,9 @@ let write_validate_me = ( write__31 ) let string_of_validate_me ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_validate_me ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_validate_me = ( read__31 ) @@ -997,23 +997,23 @@ let validate_me_of_string s = read_validate_me (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_val1 : _ -> val1 -> _ = ( fun ob (x : val1) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"val1_x\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"val1_x\":"; ( Yojson.Safe.write_int ) ob x.val1_x; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_val1 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_val1 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_val1 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1032,18 +1032,18 @@ let read_val1 = ( ) else ( (fun loc s -> Printf.eprintf "Warning: skipping field %s (def: %s) -" s loc) "File \"test.atd\", line 118, characters 12-161" (String.sub s pos len); -1 +" s loc) "File \"test.atd\", line 118, characters 12-165" (String.sub s pos len); -1 ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_val1_x := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -1064,18 +1064,18 @@ let read_val1 = ( ) else ( (fun loc s -> Printf.eprintf "Warning: skipping field %s (def: %s) -" s loc) "File \"test.atd\", line 118, characters 12-161" (String.sub s pos len); -1 +" s loc) "File \"test.atd\", line 118, characters 12-165" (String.sub s pos len); -1 ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_val1_x := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -1088,7 +1088,7 @@ let read_val1 = ( with Yojson.End_of_object -> ( ( { - val1_x = (match !field_val1_x with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "val1_x"); + val1_x = (match !field_val1_x with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "val1_x"); } : val1) ) @@ -1096,14 +1096,14 @@ let read_val1 = ( let val1_of_string s = read_val1 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__16 = ( - Atdgen_runtime.Oj_run.write_option ( + Atdgen_www_runtime.Oj_run.write_option ( write_val1 ) ) let string_of__16 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__16 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__16 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1115,7 +1115,7 @@ let read__16 = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read_val1 ) p lb @@ -1124,17 +1124,17 @@ let read__16 = ( Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -1147,20 +1147,20 @@ let read__16 = ( Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let _16_of_string s = read__16 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_val2 : _ -> val2 -> _ = ( fun ob (x : val2) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"val2_x\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"val2_x\":"; ( write_val1 ) @@ -1169,19 +1169,19 @@ let write_val2 : _ -> val2 -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"val2_y\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"val2_y\":"; ( write_val1 ) ob x; ); - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_val2 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_val2 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_val2 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1215,7 +1215,7 @@ let read_val2 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -1267,7 +1267,7 @@ let read_val2 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -1297,7 +1297,7 @@ let read_val2 = ( with Yojson.End_of_object -> ( ( { - val2_x = (match !field_val2_x with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "val2_x"); + val2_x = (match !field_val2_x with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "val2_x"); val2_y = !field_val2_y; } : val2) @@ -1306,17 +1306,17 @@ let read_val2 = ( let val2_of_string s = read_val2 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__29 = ( - Atdgen_runtime.Oj_run.write_list ( - Atdgen_runtime.Oj_run.write_float_as_int + Atdgen_www_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_float_as_int ) ) let string_of__29 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__29 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__29 = ( - Atdgen_runtime.Oj_run.read_list ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_number ) ) let _29_of_string s = @@ -1325,59 +1325,59 @@ let write_unixtime_list = ( write__29 ) let string_of_unixtime_list ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_unixtime_list ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_unixtime_list = ( read__29 ) let unixtime_list_of_string s = read_unixtime_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__3 = ( - Atdgen_runtime.Oj_run.write_nullable ( + Atdgen_www_runtime.Oj_run.write_nullable ( Yojson.Safe.write_int ) ) let string_of__3 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__3 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__3 = ( fun p lb -> Yojson.Safe.read_space p lb; (if Yojson.Safe.read_null_if_possible p lb then None else Some (( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb) : _ option) ) let _3_of_string s = read__3 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_date = ( fun ob x -> - Bi_outbuf.add_char ob '('; + Buffer.add_char ob '('; (let x, _, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x, _ = x in ( write__3 ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, x = x in ( write__3 ) ob x ); - Bi_outbuf.add_char ob ')'; + Buffer.add_char ob ')'; ) let string_of_date ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_date ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_date = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1388,7 +1388,7 @@ let read_date = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -1431,35 +1431,35 @@ let read_date = ( ); (x0, x1, x2) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); ) let date_of_string s = read_date (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__9 = ( - Atdgen_runtime.Oj_run.write_array ( + Atdgen_www_runtime.Oj_run.write_array ( Yojson.Safe.write_string ) ) let string_of__9 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__9 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__9 = ( - Atdgen_runtime.Oj_run.read_array ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_array ( + Atdgen_www_runtime.Oj_run.read_string ) ) let _9_of_string s = read__9 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__8 = ( - Atdgen_runtime.Oj_run.write_option ( + Atdgen_www_runtime.Oj_run.write_option ( Yojson.Safe.write_bool ) ) let string_of__8 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__8 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__8 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1471,68 +1471,68 @@ let read__8 = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let _8_of_string s = read__8 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__7 = ( - Atdgen_runtime.Oj_run.write_array ( + Atdgen_www_runtime.Oj_run.write_array ( Yojson.Safe.write_float ) ) let string_of__7 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__7 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__7 = ( - Atdgen_runtime.Oj_run.read_array ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_array ( + Atdgen_www_runtime.Oj_run.read_number ) ) let _7_of_string s = read__7 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__6 = ( - Atdgen_runtime.Oj_run.write_option ( + Atdgen_www_runtime.Oj_run.write_option ( Yojson.Safe.write_string ) ) let string_of__6 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__6 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__6 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1544,52 +1544,52 @@ let read__6 = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let _6_of_string s = read__6 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__5 = ( - Atdgen_runtime.Oj_run.write_option ( + Atdgen_www_runtime.Oj_run.write_option ( Yojson.Safe.write_float ) ) let string_of__5 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__5 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__5 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1601,52 +1601,52 @@ let read__5 = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let _5_of_string s = read__5 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__4 = ( - Atdgen_runtime.Oj_run.write_option ( + Atdgen_www_runtime.Oj_run.write_option ( Yojson.Safe.write_int ) ) let string_of__4 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__4 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__4 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1658,85 +1658,85 @@ let read__4 = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let _4_of_string s = read__4 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__11 = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( write__6 ) ) let string_of__11 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__11 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__11 = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( read__6 ) ) let _11_of_string s = read__11 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__10 = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( Yojson.Safe.write_null ) ) let string_of__10 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__10 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__10 = ( - Atdgen_runtime.Oj_run.read_list ( - Atdgen_runtime.Oj_run.read_null + Atdgen_www_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_null ) ) let _10_of_string s = read__10 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_mixed_record : _ -> mixed_record -> _ = ( fun ob (x : mixed_record) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in (match x.field0 with None -> () | Some x -> if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field0\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field0\":"; ( Yojson.Safe.write_int ) @@ -1746,8 +1746,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field1\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field1\":"; ( Yojson.Safe.write_float ) @@ -1756,8 +1756,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field2\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field2\":"; ( write__6 ) @@ -1765,17 +1765,17 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field3\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field3\":"; ( - Atdgen_runtime.Oj_run.write_int64 + Atdgen_www_runtime.Oj_run.write_int64 ) ob x.field3; if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field4\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field4\":"; ( write__7 ) @@ -1784,8 +1784,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field5\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field5\":"; ( Yojson.Safe.write_bool ) @@ -1795,8 +1795,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field6\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field6\":"; ( Yojson.Safe.write_string ) @@ -1805,8 +1805,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field7\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field7\":"; ( write_test_variant ) @@ -1814,8 +1814,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field8\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field8\":"; ( write__9 ) @@ -1823,54 +1823,54 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field9\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field9\":"; ( fun ob x -> - Bi_outbuf.add_char ob '('; + Buffer.add_char ob '('; (let x, _, _, _, _, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x, _, _, _, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, x, _, _, _ = x in ( - Atdgen_runtime.Oj_run.write_int8 + Atdgen_www_runtime.Oj_run.write_int8 ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, _, x, _, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, _, _, x, _ = x in ( - Atdgen_runtime.Oj_run.write_int32 + Atdgen_www_runtime.Oj_run.write_int32 ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, _, _, _, x = x in ( - Atdgen_runtime.Oj_run.write_int64 + Atdgen_www_runtime.Oj_run.write_int64 ) ob x ); - Bi_outbuf.add_char ob ')'; + Buffer.add_char ob ')'; ) ob x.field9; if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field10\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field10\":"; ( Yojson.Safe.write_bool ) @@ -1879,8 +1879,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field11\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field11\":"; ( Yojson.Safe.write_bool ) @@ -1889,8 +1889,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field12\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field12\":"; ( write__10 ) @@ -1898,8 +1898,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field13\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field13\":"; ( write__11 ) @@ -1907,18 +1907,18 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field14\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field14\":"; ( write_date ) ob x.field14; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_mixed_record ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_mixed_record ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_mixed_record = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -2024,7 +2024,7 @@ let read_mixed_record = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -2032,7 +2032,7 @@ let read_mixed_record = ( field_field0 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -2042,7 +2042,7 @@ let read_mixed_record = ( field_field1 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -2059,7 +2059,7 @@ let read_mixed_record = ( field_field3 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int64 + Atdgen_www_runtime.Oj_run.read_int64 ) p lb ) ); @@ -2076,7 +2076,7 @@ let read_mixed_record = ( field_field5 := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -2086,7 +2086,7 @@ let read_mixed_record = ( field_field6 := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -2120,7 +2120,7 @@ let read_mixed_record = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -2131,7 +2131,7 @@ let read_mixed_record = ( let x1 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -2142,7 +2142,7 @@ let read_mixed_record = ( let x2 = let x = ( - Atdgen_runtime.Oj_run.read_int8 + Atdgen_www_runtime.Oj_run.read_int8 ) p lb in incr len; @@ -2153,7 +2153,7 @@ let read_mixed_record = ( let x3 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -2164,7 +2164,7 @@ let read_mixed_record = ( let x4 = let x = ( - Atdgen_runtime.Oj_run.read_int32 + Atdgen_www_runtime.Oj_run.read_int32 ) p lb in incr len; @@ -2175,7 +2175,7 @@ let read_mixed_record = ( let x5 = let x = ( - Atdgen_runtime.Oj_run.read_int64 + Atdgen_www_runtime.Oj_run.read_int64 ) p lb in incr len; @@ -2196,7 +2196,7 @@ let read_mixed_record = ( ); (x0, x1, x2, x3, x4, x5) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3; 4; 5 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3; 4; 5 ]); ) p lb ) ); @@ -2204,7 +2204,7 @@ let read_mixed_record = ( field_field10 := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -2212,7 +2212,7 @@ let read_mixed_record = ( if not (Yojson.Safe.read_null_if_possible p lb) then ( field_field11 := ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ); ) @@ -2330,7 +2330,7 @@ let read_mixed_record = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -2338,7 +2338,7 @@ let read_mixed_record = ( field_field0 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -2348,7 +2348,7 @@ let read_mixed_record = ( field_field1 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -2365,7 +2365,7 @@ let read_mixed_record = ( field_field3 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int64 + Atdgen_www_runtime.Oj_run.read_int64 ) p lb ) ); @@ -2382,7 +2382,7 @@ let read_mixed_record = ( field_field5 := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -2392,7 +2392,7 @@ let read_mixed_record = ( field_field6 := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -2426,7 +2426,7 @@ let read_mixed_record = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -2437,7 +2437,7 @@ let read_mixed_record = ( let x1 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -2448,7 +2448,7 @@ let read_mixed_record = ( let x2 = let x = ( - Atdgen_runtime.Oj_run.read_int8 + Atdgen_www_runtime.Oj_run.read_int8 ) p lb in incr len; @@ -2459,7 +2459,7 @@ let read_mixed_record = ( let x3 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -2470,7 +2470,7 @@ let read_mixed_record = ( let x4 = let x = ( - Atdgen_runtime.Oj_run.read_int32 + Atdgen_www_runtime.Oj_run.read_int32 ) p lb in incr len; @@ -2481,7 +2481,7 @@ let read_mixed_record = ( let x5 = let x = ( - Atdgen_runtime.Oj_run.read_int64 + Atdgen_www_runtime.Oj_run.read_int64 ) p lb in incr len; @@ -2502,7 +2502,7 @@ let read_mixed_record = ( ); (x0, x1, x2, x3, x4, x5) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3; 4; 5 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3; 4; 5 ]); ) p lb ) ); @@ -2510,7 +2510,7 @@ let read_mixed_record = ( field_field10 := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -2518,7 +2518,7 @@ let read_mixed_record = ( if not (Yojson.Safe.read_null_if_possible p lb) then ( field_field11 := ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ); ) @@ -2557,19 +2557,19 @@ let read_mixed_record = ( { field0 = !field_field0; field1 = !field_field1; - field2 = (match !field_field2 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field2"); - field3 = (match !field_field3 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field3"); - field4 = (match !field_field4 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field4"); + field2 = (match !field_field2 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field2"); + field3 = (match !field_field3 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field3"); + field4 = (match !field_field4 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field4"); field5 = !field_field5; field6 = !field_field6; - field7 = (match !field_field7 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field7"); - field8 = (match !field_field8 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field8"); - field9 = (match !field_field9 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field9"); - field10 = (match !field_field10 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field10"); + field7 = (match !field_field7 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field7"); + field8 = (match !field_field8 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field8"); + field9 = (match !field_field9 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field9"); + field10 = (match !field_field10 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field10"); field11 = !field_field11; - field12 = (match !field_field12 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field12"); - field13 = (match !field_field13 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field13"); - field14 = (match !field_field14 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field14"); + field12 = (match !field_field12 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field12"); + field13 = (match !field_field13 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field13"); + field14 = (match !field_field14 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field14"); } : mixed_record) ) @@ -2577,61 +2577,61 @@ let read_mixed_record = ( let mixed_record_of_string s = read_mixed_record (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__13 = ( - Atdgen_runtime.Oj_run.write_array ( + Atdgen_www_runtime.Oj_run.write_array ( write_mixed_record ) ) let string_of__13 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__13 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__13 = ( - Atdgen_runtime.Oj_run.read_array ( + Atdgen_www_runtime.Oj_run.read_array ( read_mixed_record ) ) let _13_of_string s = read__13 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__12 = ( - Atdgen_runtime.Oj_run.write_array ( + Atdgen_www_runtime.Oj_run.write_array ( write_mixed_record ) ) let string_of__12 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__12 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__12 = ( - Atdgen_runtime.Oj_run.read_array ( + Atdgen_www_runtime.Oj_run.read_array ( read_mixed_record ) ) let _12_of_string s = read__12 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__14 = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( fun ob x -> - Bi_outbuf.add_char ob '('; + Buffer.add_char ob '('; (let x, _ = x in ( write__12 ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x = x in ( write__13 ) ob x ); - Bi_outbuf.add_char ob ')'; + Buffer.add_char ob ')'; ) ) let string_of__14 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__14 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__14 = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( fun p lb -> Yojson.Safe.read_space p lb; let std_tuple = Yojson.Safe.start_any_tuple p lb in @@ -2673,7 +2673,7 @@ let read__14 = ( ); (x0, x1) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); ) ) let _14_of_string s = @@ -2682,25 +2682,25 @@ let write_mixed = ( write__14 ) let string_of_mixed ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_mixed ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_mixed = ( read__14 ) let mixed_of_string s = read_mixed (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__15 = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( write_mixed_record ) ) let string_of__15 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__15 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__15 = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( read_mixed_record ) ) @@ -2708,14 +2708,14 @@ let _15_of_string s = read__15 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_test : _ -> test -> _ = ( fun ob (x : test) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in (match x.x0 with None -> () | Some x -> if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"x0\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"x0\":"; ( Yojson.Safe.write_int ) @@ -2725,8 +2725,8 @@ let write_test : _ -> test -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"x1\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"x1\":"; ( Yojson.Safe.write_float ) @@ -2735,8 +2735,8 @@ let write_test : _ -> test -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"x2\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"x2\":"; ( write_mixed ) @@ -2744,8 +2744,8 @@ let write_test : _ -> test -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"x3\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"x3\":"; ( write__15 ) @@ -2753,18 +2753,18 @@ let write_test : _ -> test -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"x4\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"x4\":"; ( - Atdgen_runtime.Oj_run.write_int64 + Atdgen_www_runtime.Oj_run.write_int64 ) ob x.x4; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_test ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_test ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_test = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -2810,7 +2810,7 @@ let read_test = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -2818,7 +2818,7 @@ let read_test = ( field_x0 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -2828,7 +2828,7 @@ let read_test = ( field_x1 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -2853,7 +2853,7 @@ let read_test = ( field_x4 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int64 + Atdgen_www_runtime.Oj_run.read_int64 ) p lb ) ); @@ -2897,7 +2897,7 @@ let read_test = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -2905,7 +2905,7 @@ let read_test = ( field_x0 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -2915,7 +2915,7 @@ let read_test = ( field_x1 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -2940,7 +2940,7 @@ let read_test = ( field_x4 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int64 + Atdgen_www_runtime.Oj_run.read_int64 ) p lb ) ); @@ -2955,9 +2955,9 @@ let read_test = ( { x0 = !field_x0; x1 = !field_x1; - x2 = (match !field_x2 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "x2"); - x3 = (match !field_x3 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "x3"); - x4 = (match !field_x4 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "x4"); + x2 = (match !field_x2 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "x2"); + x3 = (match !field_x3 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "x3"); + x4 = (match !field_x4 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "x4"); } : test) ) @@ -2966,24 +2966,24 @@ let test_of_string s = read_test (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_tup = ( fun ob x -> - Bi_outbuf.add_char ob '('; + Buffer.add_char ob '('; (let x, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x = x in ( write_test ) ob x ); - Bi_outbuf.add_char ob ')'; + Buffer.add_char ob ')'; ) let string_of_tup ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_tup ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_tup = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -2994,7 +2994,7 @@ let read_tup = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -3026,7 +3026,7 @@ let read_tup = ( ); (x0, x1) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); ) let tup_of_string s = read_tup (Yojson.Safe.init_lexer ()) (Lexing.from_string s) @@ -3034,33 +3034,33 @@ let write_star_rating = ( Yojson.Safe.write_int ) let string_of_star_rating ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_star_rating ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_star_rating = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) let star_rating_of_string s = read_star_rating (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__30 : _ -> _ generic -> _ = ( fun ob (x : _ generic) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"x294623\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"x294623\":"; ( Yojson.Safe.write_int ) ob x.x294623; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of__30 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__30 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__30 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -3083,14 +3083,14 @@ let read__30 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_x294623 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -3115,14 +3115,14 @@ let read__30 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_x294623 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -3135,7 +3135,7 @@ let read__30 = ( with Yojson.End_of_object -> ( ( { - x294623 = (match !field_x294623 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "x294623"); + x294623 = (match !field_x294623 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "x294623"); } : _ generic) ) @@ -3146,9 +3146,9 @@ let write_specialized = ( write__30 ) let string_of_specialized ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_specialized ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_specialized = ( read__30 ) @@ -3156,23 +3156,23 @@ let specialized_of_string s = read_specialized (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_some_record : _ -> some_record -> _ = ( fun ob (x : some_record) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"some_field\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"some_field\":"; ( Yojson.Safe.write_int ) ob x.some_field; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_some_record ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_some_record ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_some_record = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -3195,14 +3195,14 @@ let read_some_record = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_some_field := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -3227,14 +3227,14 @@ let read_some_record = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_some_field := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -3247,7 +3247,7 @@ let read_some_record = ( with Yojson.End_of_object -> ( ( { - some_field = (match !field_some_field with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "some_field"); + some_field = (match !field_some_field with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "some_field"); } : some_record) ) @@ -3256,13 +3256,13 @@ let some_record_of_string s = read_some_record (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_precision : _ -> precision -> _ = ( fun ob (x : precision) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"sqrt2_5\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"sqrt2_5\":"; ( Yojson.Safe.write_float_prec 5 ) @@ -3270,8 +3270,8 @@ let write_precision : _ -> precision -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"small_2\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"small_2\":"; ( Yojson.Safe.write_float_prec 2 ) @@ -3279,18 +3279,18 @@ let write_precision : _ -> precision -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"large_2\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"large_2\":"; ( Yojson.Safe.write_float_prec 2 ) ob x.large_2; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_precision ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_precision ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_precision = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -3353,14 +3353,14 @@ let read_precision = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_sqrt2_5 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -3368,7 +3368,7 @@ let read_precision = ( field_small_2 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -3376,7 +3376,7 @@ let read_precision = ( field_large_2 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -3439,14 +3439,14 @@ let read_precision = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_sqrt2_5 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -3454,7 +3454,7 @@ let read_precision = ( field_small_2 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -3462,7 +3462,7 @@ let read_precision = ( field_large_2 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -3475,9 +3475,9 @@ let read_precision = ( with Yojson.End_of_object -> ( ( { - sqrt2_5 = (match !field_sqrt2_5 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "sqrt2_5"); - small_2 = (match !field_small_2 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "small_2"); - large_2 = (match !field_large_2 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "large_2"); + sqrt2_5 = (match !field_sqrt2_5 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "sqrt2_5"); + small_2 = (match !field_small_2 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "small_2"); + large_2 = (match !field_large_2 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "large_2"); } : precision) ) @@ -3488,23 +3488,23 @@ let write_p'' = ( write__1 ) let string_of_p'' ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_p'' ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_p'' = ( read__1 ) let p''_of_string s = read_p'' (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__18 = ( - Atdgen_runtime.Oj_run.write_option ( + Atdgen_www_runtime.Oj_run.write_option ( Yojson.Safe.write_int ) ) let string_of__18 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__18 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__18 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -3516,39 +3516,39 @@ let read__18 = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let _18_of_string s = @@ -3557,9 +3557,9 @@ let write_option_validation = ( write__18 ) let string_of_option_validation ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_option_validation ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_option_validation = ( read__18 ) @@ -3569,9 +3569,9 @@ let write__28 = ( write_some_record ) let string_of__28 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__28 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__28 = ( read_some_record ) @@ -3581,9 +3581,9 @@ let write_no_real_wrap = ( write__28 ) let string_of_no_real_wrap ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_no_real_wrap ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_no_real_wrap = ( read__28 ) @@ -3596,13 +3596,13 @@ let write__26 = ( ) ob x) ) let string_of__26 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__26 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__26 = ( fun p lb -> let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in ( Test_lib.Natural.wrap ) x ) @@ -3612,9 +3612,9 @@ let write_natural = ( write__26 ) let string_of_natural ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_natural ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_natural = ( read__26 ) @@ -3627,13 +3627,13 @@ let write__24 = ( ) ob x) ) let string_of__24 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__24 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__24 = ( fun p lb -> let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in ( fun s -> `Id s ) x ) @@ -3643,30 +3643,30 @@ let write_id = ( write__24 ) let string_of_id ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_id ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_id = ( read__24 ) let id_of_string s = read_id (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__25 = ( - Atdgen_runtime.Oj_run.write_assoc_list ( + Atdgen_www_runtime.Oj_run.write_assoc_list ( write_id ) ( Yojson.Safe.write_int ) ) let string_of__25 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__25 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__25 = ( - Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_www_runtime.Oj_run.read_assoc_list ( read_id ) ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) ) let _25_of_string s = @@ -3675,9 +3675,9 @@ let write_json_map = ( write__25 ) let string_of_json_map ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_json_map ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_json_map = ( read__25 ) @@ -3687,30 +3687,30 @@ let write_intopt = ( write__4 ) let string_of_intopt ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_intopt ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_intopt = ( read__4 ) let intopt_of_string s = read_intopt (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__21 = ( - Atdgen_runtime.Oj_run.write_assoc_list ( + Atdgen_www_runtime.Oj_run.write_assoc_list ( Yojson.Safe.write_string ) ( Yojson.Safe.write_int ) ) let string_of__21 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__21 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__21 = ( - Atdgen_runtime.Oj_run.read_assoc_list ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_assoc_list ( + Atdgen_www_runtime.Oj_run.read_string ) ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) ) let _21_of_string s = @@ -3719,30 +3719,30 @@ let write_int_assoc_list = ( write__21 ) let string_of_int_assoc_list ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_int_assoc_list ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_int_assoc_list = ( read__21 ) let int_assoc_list_of_string s = read_int_assoc_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__22 = ( - Atdgen_runtime.Oj_run.write_assoc_array ( + Atdgen_www_runtime.Oj_run.write_assoc_array ( Yojson.Safe.write_string ) ( Yojson.Safe.write_int ) ) let string_of__22 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__22 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__22 = ( - Atdgen_runtime.Oj_run.read_assoc_array ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_assoc_array ( + Atdgen_www_runtime.Oj_run.read_string ) ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) ) let _22_of_string s = @@ -3751,9 +3751,9 @@ let write_int_assoc_array = ( write__22 ) let string_of_int_assoc_array ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_int_assoc_array ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_int_assoc_array = ( read__22 ) @@ -3763,35 +3763,35 @@ let write_int8 = ( Yojson.Safe.write_int ) let string_of_int8 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_int8 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_int8 = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) let int8_of_string s = read_int8 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_int64 = ( - Atdgen_runtime.Oj_run.write_int64 + Atdgen_www_runtime.Oj_run.write_int64 ) let string_of_int64 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_int64 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_int64 = ( - Atdgen_runtime.Oj_run.read_int64 + Atdgen_www_runtime.Oj_run.read_int64 ) let int64_of_string s = read_int64 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_int32 = ( - Atdgen_runtime.Oj_run.write_int32 + Atdgen_www_runtime.Oj_run.write_int32 ) let string_of_int32 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_int32 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_int32 = ( - Atdgen_runtime.Oj_run.read_int32 + Atdgen_www_runtime.Oj_run.read_int32 ) let int32_of_string s = read_int32 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) @@ -3799,17 +3799,17 @@ let write_hello = ( fun ob x -> match x with | `Hello x -> - Bi_outbuf.add_string ob "<\"Hello\":"; + Buffer.add_string ob "<\"Hello\":"; ( Yojson.Safe.write_string ) ob x; - Bi_outbuf.add_char ob '>' - | `World -> Bi_outbuf.add_string ob "<\"World\">" + Buffer.add_char ob '>' + | `World -> Buffer.add_string ob "<\"World\">" ) let string_of_hello ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_hello ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_hello = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -3817,9 +3817,9 @@ let read_hello = ( | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with | "Hello" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; @@ -3830,53 +3830,53 @@ let read_hello = ( Yojson.Safe.read_gt p lb; `World | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "World" -> `World | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Hello" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; `Hello x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let hello_of_string s = read_hello (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_generic write__a : _ -> 'a generic -> _ = ( fun ob (x : 'a generic) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"x294623\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"x294623\":"; ( Yojson.Safe.write_int ) ob x.x294623; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_generic write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_generic write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_generic read__a = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -3899,14 +3899,14 @@ let read_generic read__a = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_x294623 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -3931,14 +3931,14 @@ let read_generic read__a = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_x294623 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -3951,7 +3951,7 @@ let read_generic read__a = ( with Yojson.End_of_object -> ( ( { - x294623 = (match !field_x294623 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "x294623"); + x294623 = (match !field_x294623 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "x294623"); } : 'a generic) ) @@ -3960,13 +3960,13 @@ let generic_of_string read__a s = read_generic read__a (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_floats : _ -> floats -> _ = ( fun ob (x : floats) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"f32\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"f32\":"; ( Yojson.Safe.write_float ) @@ -3974,18 +3974,18 @@ let write_floats : _ -> floats -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"f64\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"f64\":"; ( Yojson.Safe.write_float ) ob x.f64; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_floats ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_floats ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_floats = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -4031,14 +4031,14 @@ let read_floats = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_f32 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -4046,7 +4046,7 @@ let read_floats = ( field_f64 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -4093,14 +4093,14 @@ let read_floats = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_f32 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -4108,7 +4108,7 @@ let read_floats = ( field_f64 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -4121,8 +4121,8 @@ let read_floats = ( with Yojson.End_of_object -> ( ( { - f32 = (match !field_f32 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "f32"); - f64 = (match !field_f64 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "f64"); + f32 = (match !field_f32 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "f32"); + f64 = (match !field_f64 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "f64"); } : floats) ) @@ -4130,65 +4130,65 @@ let read_floats = ( let floats_of_string s = read_floats (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__17 = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( Yojson.Safe.write_string ) ) let string_of__17 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__17 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__17 = ( - Atdgen_runtime.Oj_run.read_list ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_string ) ) let _17_of_string s = read__17 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_extended_tuple = ( fun ob x -> - Bi_outbuf.add_char ob '('; + Buffer.add_char ob '('; (let x, _, _, _, _, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x, _, _, _, _ = x in ( Yojson.Safe.write_float ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, x, _, _, _ = x in ( Yojson.Safe.write_bool ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, _, x, _, _ = x in ( write__4 ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, _, _, x, _ = x in ( Yojson.Safe.write_string ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, _, _, _, x = x in ( write__17 ) ob x ); - Bi_outbuf.add_char ob ')'; + Buffer.add_char ob ')'; ) let string_of_extended_tuple ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_extended_tuple ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_extended_tuple = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -4199,7 +4199,7 @@ let read_extended_tuple = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -4210,7 +4210,7 @@ let read_extended_tuple = ( let x1 = let x = ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb in incr len; @@ -4221,7 +4221,7 @@ let read_extended_tuple = ( let x2 = let x = ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb in incr len; @@ -4243,7 +4243,7 @@ let read_extended_tuple = ( let x4 = let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in incr len; @@ -4281,19 +4281,19 @@ let read_extended_tuple = ( ); (x0, x1, x2, x3, x4, x5) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 4 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 4 ]); ) let extended_tuple_of_string s = read_extended_tuple (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_extended : _ -> extended -> _ = ( fun ob (x : extended) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b0\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b0\":"; ( Yojson.Safe.write_int ) @@ -4301,8 +4301,8 @@ let write_extended : _ -> extended -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b1\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b1\":"; ( Yojson.Safe.write_bool ) @@ -4310,8 +4310,8 @@ let write_extended : _ -> extended -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b2\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b2\":"; ( Yojson.Safe.write_string ) @@ -4320,8 +4320,8 @@ let write_extended : _ -> extended -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b3\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b3\":"; ( Yojson.Safe.write_string ) @@ -4330,8 +4330,8 @@ let write_extended : _ -> extended -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b4\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b4\":"; ( write__6 ) @@ -4340,19 +4340,19 @@ let write_extended : _ -> extended -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b5\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b5\":"; ( Yojson.Safe.write_float ) ob x.b5x; ); - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_extended ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_extended ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_extended = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -4393,23 +4393,23 @@ let read_extended = ( ) | _ -> ( (fun loc s -> Printf.eprintf "Warning: skipping field %s (def: %s) -" s loc) "File \"test.atd\", line 103, characters 16-508" (String.sub s pos len); -1 +" s loc) "File \"test.atd\", line 103, characters 16-516" (String.sub s pos len); -1 ) ) else ( (fun loc s -> Printf.eprintf "Warning: skipping field %s (def: %s) -" s loc) "File \"test.atd\", line 103, characters 16-508" (String.sub s pos len); -1 +" s loc) "File \"test.atd\", line 103, characters 16-516" (String.sub s pos len); -1 ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_b0x := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -4417,7 +4417,7 @@ let read_extended = ( field_b1x := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -4425,7 +4425,7 @@ let read_extended = ( field_b2x := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -4434,7 +4434,7 @@ let read_extended = ( field_b3x := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -4451,7 +4451,7 @@ let read_extended = ( if not (Yojson.Safe.read_null_if_possible p lb) then ( field_b5x := ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ); ) @@ -4489,23 +4489,23 @@ let read_extended = ( ) | _ -> ( (fun loc s -> Printf.eprintf "Warning: skipping field %s (def: %s) -" s loc) "File \"test.atd\", line 103, characters 16-508" (String.sub s pos len); -1 +" s loc) "File \"test.atd\", line 103, characters 16-516" (String.sub s pos len); -1 ) ) else ( (fun loc s -> Printf.eprintf "Warning: skipping field %s (def: %s) -" s loc) "File \"test.atd\", line 103, characters 16-508" (String.sub s pos len); -1 +" s loc) "File \"test.atd\", line 103, characters 16-516" (String.sub s pos len); -1 ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_b0x := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -4513,7 +4513,7 @@ let read_extended = ( field_b1x := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -4521,7 +4521,7 @@ let read_extended = ( field_b2x := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -4530,7 +4530,7 @@ let read_extended = ( field_b3x := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -4547,7 +4547,7 @@ let read_extended = ( if not (Yojson.Safe.read_null_if_possible p lb) then ( field_b5x := ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ); ) @@ -4560,11 +4560,11 @@ let read_extended = ( with Yojson.End_of_object -> ( ( { - b0x = (match !field_b0x with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "b0x"); - b1x = (match !field_b1x with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "b1x"); - b2x = (match !field_b2x with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "b2x"); + b0x = (match !field_b0x with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "b0x"); + b1x = (match !field_b1x with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "b1x"); + b2x = (match !field_b2x with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "b2x"); b3x = !field_b3x; - b4x = (match !field_b4x with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "b4x"); + b4x = (match !field_b4x with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "b4x"); b5x = !field_b5x; } : extended) @@ -4579,9 +4579,9 @@ let write__27 = ( ) ob x) ) let string_of__27 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__27 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__27 = ( fun p lb -> let x = ( @@ -4595,9 +4595,9 @@ let write_even_natural = ( write__27 ) let string_of_even_natural ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_even_natural ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_even_natural = ( read__27 ) @@ -4607,46 +4607,46 @@ let write_def = ( Test_lib.Json.write_def ) let string_of_def ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_def ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_def = ( Test_lib.Json.read_def ) let def_of_string s = read_def (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_char = ( - Atdgen_runtime.Oj_run.write_int8 + Atdgen_www_runtime.Oj_run.write_int8 ) let string_of_char ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_char ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_char = ( - Atdgen_runtime.Oj_run.read_int8 + Atdgen_www_runtime.Oj_run.read_int8 ) let char_of_string s = read_char (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_base_tuple = ( fun ob x -> - Bi_outbuf.add_char ob '('; + Buffer.add_char ob '('; (let x, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x = x in ( Yojson.Safe.write_float ) ob x ); - Bi_outbuf.add_char ob ')'; + Buffer.add_char ob ')'; ) let string_of_base_tuple ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_base_tuple ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_base_tuple = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -4657,7 +4657,7 @@ let read_base_tuple = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -4668,7 +4668,7 @@ let read_base_tuple = ( let x1 = let x = ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb in incr len; @@ -4689,19 +4689,19 @@ let read_base_tuple = ( ); (x0, x1) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); ) let base_tuple_of_string s = read_base_tuple (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_base : _ -> base -> _ = ( fun ob (x : base) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b0\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b0\":"; ( Yojson.Safe.write_int ) @@ -4709,18 +4709,18 @@ let write_base : _ -> base -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b1\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b1\":"; ( Yojson.Safe.write_bool ) ob x.b1; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_base ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_base ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_base = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -4754,14 +4754,14 @@ let read_base = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_b0 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -4769,7 +4769,7 @@ let read_base = ( field_b1 := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -4804,14 +4804,14 @@ let read_base = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_b0 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -4819,7 +4819,7 @@ let read_base = ( field_b1 := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -4832,8 +4832,8 @@ let read_base = ( with Yojson.End_of_object -> ( ( { - b0 = (match !field_b0 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "b0"); - b1 = (match !field_b1 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "b1"); + b0 = (match !field_b0 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "b0"); + b1 = (match !field_b1 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "b1"); } : base) ) @@ -4841,16 +4841,16 @@ let read_base = ( let base_of_string s = read_base (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__23 write__a = ( - Atdgen_runtime.Oj_run.write_array ( + Atdgen_www_runtime.Oj_run.write_array ( write__a ) ) let string_of__23 write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__23 write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__23 read__a = ( - Atdgen_runtime.Oj_run.read_array ( + Atdgen_www_runtime.Oj_run.read_array ( read__a ) ) @@ -4860,9 +4860,9 @@ let write_array write__a = ( write__23 write__a ) let string_of_array write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_array write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_array read__a = ( read__23 read__a ) @@ -4872,9 +4872,9 @@ let write_abs3 write__a = ( write__19 write__a ) let string_of_abs3 write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_abs3 write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_abs3 read__a = ( read__19 read__a ) @@ -4884,9 +4884,9 @@ let write_abs2 write__a = ( write__19 write__a ) let string_of_abs2 write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_abs2 write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_abs2 read__a = ( read__19 read__a ) @@ -4896,9 +4896,9 @@ let write_abs1 write__a = ( write__19 write__a ) let string_of_abs1 write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_abs1 write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_abs1 read__a = ( read__19 read__a ) diff --git a/atdgen/test/testj.expected.mli b/atdgen/test/testj.expected.mli index d0a1479..d14e9ec 100644 --- a/atdgen/test/testj.expected.mli +++ b/atdgen/test/testj.expected.mli @@ -33,11 +33,11 @@ type mixed_record = Test.mixed_record = { field1: float option; field2: string option; field3: Int64.t; - field4: float Atdgen_runtime.Util.ocaml_array; + field4: float Atdgen_www_runtime.Util.ocaml_array; field5: bool option; field6: string option; field7: test_variant; - field8: string Atdgen_runtime.Util.ocaml_array; + field8: string Atdgen_www_runtime.Util.ocaml_array; field9: (int * int * Char.t * int * Int32.t * Int64.t); field10: bool; field11: bool; @@ -153,8 +153,8 @@ type 'a abs2 = 'a Test.abs2 type 'a abs1 = 'a Test.abs1 val write_test_variant : - Bi_outbuf.t -> test_variant -> unit - (** Output a JSON value of type {!test_variant}. *) + Buffer.t -> test_variant -> unit + (** Output a JSON value of type {!type:test_variant}. *) val string_of_test_variant : ?len:int -> test_variant -> string @@ -174,14 +174,14 @@ val test_variant_of_string : val write_poly : - (Bi_outbuf.t -> 'x -> unit) -> - (Bi_outbuf.t -> 'y -> unit) -> - Bi_outbuf.t -> ('x, 'y) poly -> unit - (** Output a JSON value of type {!poly}. *) + (Buffer.t -> 'x -> unit) -> + (Buffer.t -> 'y -> unit) -> + Buffer.t -> ('x, 'y) poly -> unit + (** Output a JSON value of type {!type:poly}. *) val string_of_poly : - (Bi_outbuf.t -> 'x -> unit) -> - (Bi_outbuf.t -> 'y -> unit) -> + (Buffer.t -> 'x -> unit) -> + (Buffer.t -> 'y -> unit) -> ?len:int -> ('x, 'y) poly -> string (** Serialize a value of type {!poly} into a JSON string. @@ -209,12 +209,12 @@ val create_poly : val write_p' : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a p' -> unit - (** Output a JSON value of type {!p'}. *) + (Buffer.t -> 'a -> unit) -> + Buffer.t -> 'a p' -> unit + (** Output a JSON value of type {!type:p'}. *) val string_of_p' : - (Bi_outbuf.t -> 'a -> unit) -> + (Buffer.t -> 'a -> unit) -> ?len:int -> 'a p' -> string (** Serialize a value of type {!p'} into a JSON string. @@ -234,8 +234,8 @@ val p'_of_string : val write_p : - Bi_outbuf.t -> p -> unit - (** Output a JSON value of type {!p}. *) + Buffer.t -> p -> unit + (** Output a JSON value of type {!type:p}. *) val string_of_p : ?len:int -> p -> string @@ -255,8 +255,8 @@ val p_of_string : val write_r : - Bi_outbuf.t -> r -> unit - (** Output a JSON value of type {!r}. *) + Buffer.t -> r -> unit + (** Output a JSON value of type {!type:r}. *) val string_of_r : ?len:int -> r -> string @@ -283,8 +283,8 @@ val create_r : val write_validated_string_check : - Bi_outbuf.t -> validated_string_check -> unit - (** Output a JSON value of type {!validated_string_check}. *) + Buffer.t -> validated_string_check -> unit + (** Output a JSON value of type {!type:validated_string_check}. *) val string_of_validated_string_check : ?len:int -> validated_string_check -> string @@ -304,8 +304,8 @@ val validated_string_check_of_string : val write_validate_me : - Bi_outbuf.t -> validate_me -> unit - (** Output a JSON value of type {!validate_me}. *) + Buffer.t -> validate_me -> unit + (** Output a JSON value of type {!type:validate_me}. *) val string_of_validate_me : ?len:int -> validate_me -> string @@ -325,8 +325,8 @@ val validate_me_of_string : val write_val1 : - Bi_outbuf.t -> val1 -> unit - (** Output a JSON value of type {!val1}. *) + Buffer.t -> val1 -> unit + (** Output a JSON value of type {!type:val1}. *) val string_of_val1 : ?len:int -> val1 -> string @@ -351,8 +351,8 @@ val create_val1 : val write_val2 : - Bi_outbuf.t -> val2 -> unit - (** Output a JSON value of type {!val2}. *) + Buffer.t -> val2 -> unit + (** Output a JSON value of type {!type:val2}. *) val string_of_val2 : ?len:int -> val2 -> string @@ -378,8 +378,8 @@ val create_val2 : val write_unixtime_list : - Bi_outbuf.t -> unixtime_list -> unit - (** Output a JSON value of type {!unixtime_list}. *) + Buffer.t -> unixtime_list -> unit + (** Output a JSON value of type {!type:unixtime_list}. *) val string_of_unixtime_list : ?len:int -> unixtime_list -> string @@ -399,8 +399,8 @@ val unixtime_list_of_string : val write_date : - Bi_outbuf.t -> date -> unit - (** Output a JSON value of type {!date}. *) + Buffer.t -> date -> unit + (** Output a JSON value of type {!type:date}. *) val string_of_date : ?len:int -> date -> string @@ -420,8 +420,8 @@ val date_of_string : val write_mixed_record : - Bi_outbuf.t -> mixed_record -> unit - (** Output a JSON value of type {!mixed_record}. *) + Buffer.t -> mixed_record -> unit + (** Output a JSON value of type {!type:mixed_record}. *) val string_of_mixed_record : ?len:int -> mixed_record -> string @@ -444,11 +444,11 @@ val create_mixed_record : ?field1: float -> field2: string option -> field3: Int64.t -> - field4: float Atdgen_runtime.Util.ocaml_array -> + field4: float Atdgen_www_runtime.Util.ocaml_array -> ?field5: bool -> ?field6: string -> field7: test_variant -> - field8: string Atdgen_runtime.Util.ocaml_array -> + field8: string Atdgen_www_runtime.Util.ocaml_array -> field9: (int * int * Char.t * int * Int32.t * Int64.t) -> field10: bool -> ?field11: bool -> @@ -460,8 +460,8 @@ val create_mixed_record : val write_mixed : - Bi_outbuf.t -> mixed -> unit - (** Output a JSON value of type {!mixed}. *) + Buffer.t -> mixed -> unit + (** Output a JSON value of type {!type:mixed}. *) val string_of_mixed : ?len:int -> mixed -> string @@ -481,8 +481,8 @@ val mixed_of_string : val write_test : - Bi_outbuf.t -> test -> unit - (** Output a JSON value of type {!test}. *) + Buffer.t -> test -> unit + (** Output a JSON value of type {!type:test}. *) val string_of_test : ?len:int -> test -> string @@ -511,8 +511,8 @@ val create_test : val write_tup : - Bi_outbuf.t -> tup -> unit - (** Output a JSON value of type {!tup}. *) + Buffer.t -> tup -> unit + (** Output a JSON value of type {!type:tup}. *) val string_of_tup : ?len:int -> tup -> string @@ -532,8 +532,8 @@ val tup_of_string : val write_star_rating : - Bi_outbuf.t -> star_rating -> unit - (** Output a JSON value of type {!star_rating}. *) + Buffer.t -> star_rating -> unit + (** Output a JSON value of type {!type:star_rating}. *) val string_of_star_rating : ?len:int -> star_rating -> string @@ -553,12 +553,12 @@ val star_rating_of_string : val write_generic : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a generic -> unit - (** Output a JSON value of type {!generic}. *) + (Buffer.t -> 'a -> unit) -> + Buffer.t -> 'a generic -> unit + (** Output a JSON value of type {!type:generic}. *) val string_of_generic : - (Bi_outbuf.t -> 'a -> unit) -> + (Buffer.t -> 'a -> unit) -> ?len:int -> 'a generic -> string (** Serialize a value of type {!generic} into a JSON string. @@ -583,8 +583,8 @@ val create_generic : val write_specialized : - Bi_outbuf.t -> specialized -> unit - (** Output a JSON value of type {!specialized}. *) + Buffer.t -> specialized -> unit + (** Output a JSON value of type {!type:specialized}. *) val string_of_specialized : ?len:int -> specialized -> string @@ -604,8 +604,8 @@ val specialized_of_string : val write_some_record : - Bi_outbuf.t -> some_record -> unit - (** Output a JSON value of type {!some_record}. *) + Buffer.t -> some_record -> unit + (** Output a JSON value of type {!type:some_record}. *) val string_of_some_record : ?len:int -> some_record -> string @@ -630,8 +630,8 @@ val create_some_record : val write_precision : - Bi_outbuf.t -> precision -> unit - (** Output a JSON value of type {!precision}. *) + Buffer.t -> precision -> unit + (** Output a JSON value of type {!type:precision}. *) val string_of_precision : ?len:int -> precision -> string @@ -658,8 +658,8 @@ val create_precision : val write_p'' : - Bi_outbuf.t -> p'' -> unit - (** Output a JSON value of type {!p''}. *) + Buffer.t -> p'' -> unit + (** Output a JSON value of type {!type:p''}. *) val string_of_p'' : ?len:int -> p'' -> string @@ -679,8 +679,8 @@ val p''_of_string : val write_option_validation : - Bi_outbuf.t -> option_validation -> unit - (** Output a JSON value of type {!option_validation}. *) + Buffer.t -> option_validation -> unit + (** Output a JSON value of type {!type:option_validation}. *) val string_of_option_validation : ?len:int -> option_validation -> string @@ -700,8 +700,8 @@ val option_validation_of_string : val write_no_real_wrap : - Bi_outbuf.t -> no_real_wrap -> unit - (** Output a JSON value of type {!no_real_wrap}. *) + Buffer.t -> no_real_wrap -> unit + (** Output a JSON value of type {!type:no_real_wrap}. *) val string_of_no_real_wrap : ?len:int -> no_real_wrap -> string @@ -721,8 +721,8 @@ val no_real_wrap_of_string : val write_natural : - Bi_outbuf.t -> natural -> unit - (** Output a JSON value of type {!natural}. *) + Buffer.t -> natural -> unit + (** Output a JSON value of type {!type:natural}. *) val string_of_natural : ?len:int -> natural -> string @@ -742,8 +742,8 @@ val natural_of_string : val write_id : - Bi_outbuf.t -> id -> unit - (** Output a JSON value of type {!id}. *) + Buffer.t -> id -> unit + (** Output a JSON value of type {!type:id}. *) val string_of_id : ?len:int -> id -> string @@ -763,8 +763,8 @@ val id_of_string : val write_json_map : - Bi_outbuf.t -> json_map -> unit - (** Output a JSON value of type {!json_map}. *) + Buffer.t -> json_map -> unit + (** Output a JSON value of type {!type:json_map}. *) val string_of_json_map : ?len:int -> json_map -> string @@ -784,8 +784,8 @@ val json_map_of_string : val write_intopt : - Bi_outbuf.t -> intopt -> unit - (** Output a JSON value of type {!intopt}. *) + Buffer.t -> intopt -> unit + (** Output a JSON value of type {!type:intopt}. *) val string_of_intopt : ?len:int -> intopt -> string @@ -805,8 +805,8 @@ val intopt_of_string : val write_int_assoc_list : - Bi_outbuf.t -> int_assoc_list -> unit - (** Output a JSON value of type {!int_assoc_list}. *) + Buffer.t -> int_assoc_list -> unit + (** Output a JSON value of type {!type:int_assoc_list}. *) val string_of_int_assoc_list : ?len:int -> int_assoc_list -> string @@ -826,8 +826,8 @@ val int_assoc_list_of_string : val write_int_assoc_array : - Bi_outbuf.t -> int_assoc_array -> unit - (** Output a JSON value of type {!int_assoc_array}. *) + Buffer.t -> int_assoc_array -> unit + (** Output a JSON value of type {!type:int_assoc_array}. *) val string_of_int_assoc_array : ?len:int -> int_assoc_array -> string @@ -847,8 +847,8 @@ val int_assoc_array_of_string : val write_int8 : - Bi_outbuf.t -> int8 -> unit - (** Output a JSON value of type {!int8}. *) + Buffer.t -> int8 -> unit + (** Output a JSON value of type {!type:int8}. *) val string_of_int8 : ?len:int -> int8 -> string @@ -868,8 +868,8 @@ val int8_of_string : val write_int64 : - Bi_outbuf.t -> int64 -> unit - (** Output a JSON value of type {!int64}. *) + Buffer.t -> int64 -> unit + (** Output a JSON value of type {!type:int64}. *) val string_of_int64 : ?len:int -> int64 -> string @@ -889,8 +889,8 @@ val int64_of_string : val write_int32 : - Bi_outbuf.t -> int32 -> unit - (** Output a JSON value of type {!int32}. *) + Buffer.t -> int32 -> unit + (** Output a JSON value of type {!type:int32}. *) val string_of_int32 : ?len:int -> int32 -> string @@ -910,8 +910,8 @@ val int32_of_string : val write_hello : - Bi_outbuf.t -> hello -> unit - (** Output a JSON value of type {!hello}. *) + Buffer.t -> hello -> unit + (** Output a JSON value of type {!type:hello}. *) val string_of_hello : ?len:int -> hello -> string @@ -931,8 +931,8 @@ val hello_of_string : val write_floats : - Bi_outbuf.t -> floats -> unit - (** Output a JSON value of type {!floats}. *) + Buffer.t -> floats -> unit + (** Output a JSON value of type {!type:floats}. *) val string_of_floats : ?len:int -> floats -> string @@ -958,8 +958,8 @@ val create_floats : val write_extended_tuple : - Bi_outbuf.t -> extended_tuple -> unit - (** Output a JSON value of type {!extended_tuple}. *) + Buffer.t -> extended_tuple -> unit + (** Output a JSON value of type {!type:extended_tuple}. *) val string_of_extended_tuple : ?len:int -> extended_tuple -> string @@ -979,8 +979,8 @@ val extended_tuple_of_string : val write_extended : - Bi_outbuf.t -> extended -> unit - (** Output a JSON value of type {!extended}. *) + Buffer.t -> extended -> unit + (** Output a JSON value of type {!type:extended}. *) val string_of_extended : ?len:int -> extended -> string @@ -1010,8 +1010,8 @@ val create_extended : val write_even_natural : - Bi_outbuf.t -> even_natural -> unit - (** Output a JSON value of type {!even_natural}. *) + Buffer.t -> even_natural -> unit + (** Output a JSON value of type {!type:even_natural}. *) val string_of_even_natural : ?len:int -> even_natural -> string @@ -1031,8 +1031,8 @@ val even_natural_of_string : val write_def : - Bi_outbuf.t -> def -> unit - (** Output a JSON value of type {!def}. *) + Buffer.t -> def -> unit + (** Output a JSON value of type {!type:def}. *) val string_of_def : ?len:int -> def -> string @@ -1052,8 +1052,8 @@ val def_of_string : val write_char : - Bi_outbuf.t -> char -> unit - (** Output a JSON value of type {!char}. *) + Buffer.t -> char -> unit + (** Output a JSON value of type {!type:char}. *) val string_of_char : ?len:int -> char -> string @@ -1073,8 +1073,8 @@ val char_of_string : val write_base_tuple : - Bi_outbuf.t -> base_tuple -> unit - (** Output a JSON value of type {!base_tuple}. *) + Buffer.t -> base_tuple -> unit + (** Output a JSON value of type {!type:base_tuple}. *) val string_of_base_tuple : ?len:int -> base_tuple -> string @@ -1094,8 +1094,8 @@ val base_tuple_of_string : val write_base : - Bi_outbuf.t -> base -> unit - (** Output a JSON value of type {!base}. *) + Buffer.t -> base -> unit + (** Output a JSON value of type {!type:base}. *) val string_of_base : ?len:int -> base -> string @@ -1121,12 +1121,12 @@ val create_base : val write_array : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a array -> unit - (** Output a JSON value of type {!array}. *) + (Buffer.t -> 'a -> unit) -> + Buffer.t -> 'a array -> unit + (** Output a JSON value of type {!type:array}. *) val string_of_array : - (Bi_outbuf.t -> 'a -> unit) -> + (Buffer.t -> 'a -> unit) -> ?len:int -> 'a array -> string (** Serialize a value of type {!array} into a JSON string. @@ -1146,12 +1146,12 @@ val array_of_string : val write_abs3 : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a abs3 -> unit - (** Output a JSON value of type {!abs3}. *) + (Buffer.t -> 'a -> unit) -> + Buffer.t -> 'a abs3 -> unit + (** Output a JSON value of type {!type:abs3}. *) val string_of_abs3 : - (Bi_outbuf.t -> 'a -> unit) -> + (Buffer.t -> 'a -> unit) -> ?len:int -> 'a abs3 -> string (** Serialize a value of type {!abs3} into a JSON string. @@ -1171,12 +1171,12 @@ val abs3_of_string : val write_abs2 : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a abs2 -> unit - (** Output a JSON value of type {!abs2}. *) + (Buffer.t -> 'a -> unit) -> + Buffer.t -> 'a abs2 -> unit + (** Output a JSON value of type {!type:abs2}. *) val string_of_abs2 : - (Bi_outbuf.t -> 'a -> unit) -> + (Buffer.t -> 'a -> unit) -> ?len:int -> 'a abs2 -> string (** Serialize a value of type {!abs2} into a JSON string. @@ -1196,12 +1196,12 @@ val abs2_of_string : val write_abs1 : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a abs1 -> unit - (** Output a JSON value of type {!abs1}. *) + (Buffer.t -> 'a -> unit) -> + Buffer.t -> 'a abs1 -> unit + (** Output a JSON value of type {!type:abs1}. *) val string_of_abs1 : - (Bi_outbuf.t -> 'a -> unit) -> + (Buffer.t -> 'a -> unit) -> ?len:int -> 'a abs1 -> string (** Serialize a value of type {!abs1} into a JSON string. diff --git a/atdgen/test/testjstd.expected.ml b/atdgen/test/testjstd.expected.ml index b7078d8..07277b7 100644 --- a/atdgen/test/testjstd.expected.ml +++ b/atdgen/test/testjstd.expected.ml @@ -33,11 +33,11 @@ type mixed_record = Test.mixed_record = { field1: float option; field2: string option; field3: Int64.t; - field4: float Atdgen_runtime.Util.ocaml_array; + field4: float Atdgen_www_runtime.Util.ocaml_array; field5: bool option; field6: string option; field7: test_variant; - field8: string Atdgen_runtime.Util.ocaml_array; + field8: string Atdgen_www_runtime.Util.ocaml_array; field9: (int * int * Char.t * int * Int32.t * Int64.t); field10: bool; field11: bool; @@ -153,16 +153,16 @@ type 'a abs2 = 'a Test.abs2 type 'a abs1 = 'a Test.abs1 let write__19 write__a = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( write__a ) ) let string_of__19 write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__19 write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__19 read__a = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( read__a ) ) @@ -171,24 +171,24 @@ let _19_of_string read__a s = let rec write_p' write__a : _ -> 'a p' -> _ = ( fun ob x -> match x with - | A -> Bi_outbuf.add_string ob "\"A\"" + | A -> Buffer.add_string ob "\"A\"" | Bb x -> - Bi_outbuf.add_string ob "[\"Bb\","; + Buffer.add_string ob "[\"Bb\","; ( write_p' write__a ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' | Ccccc x -> - Bi_outbuf.add_string ob "[\"Ccccc\","; + Buffer.add_string ob "[\"Ccccc\","; ( write__a ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' ) and string_of_p' write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_p' write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let rec read_p' read__a = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -200,7 +200,7 @@ let rec read_p' read__a = ( Yojson.Safe.read_gt p lb; (A : 'a p') | "Bb" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read_p' read__a ) p lb @@ -209,7 +209,7 @@ let rec read_p' read__a = ( Yojson.Safe.read_gt p lb; (Bb x : 'a p') | "Ccccc" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read__a ) p lb @@ -218,17 +218,17 @@ let rec read_p' read__a = ( Yojson.Safe.read_gt p lb; (Ccccc x : 'a p') | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "A" -> (A : 'a p') | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Bb" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -252,7 +252,7 @@ let rec read_p' read__a = ( Yojson.Safe.read_rbr p lb; (Ccccc x : 'a p') | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) and p'_of_string read__a s = @@ -260,28 +260,28 @@ and p'_of_string read__a s = let rec write_p = ( fun ob x -> match x with - | `A -> Bi_outbuf.add_string ob "\"A\"" + | `A -> Buffer.add_string ob "\"A\"" | `B x -> - Bi_outbuf.add_string ob "[\"B\","; + Buffer.add_string ob "[\"B\","; ( write_r ) ob x; - Bi_outbuf.add_char ob ']' - | `C -> Bi_outbuf.add_string ob "\"C\"" + Buffer.add_char ob ']' + | `C -> Buffer.add_string ob "\"C\"" ) and string_of_p ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_p ob x; - Bi_outbuf.contents ob + Buffer.contents ob and write_r : _ -> r -> _ = ( fun ob (x : r) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"a\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"a\":"; ( Yojson.Safe.write_int ) @@ -289,8 +289,8 @@ and write_r : _ -> r -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b\":"; ( Yojson.Safe.write_bool ) @@ -298,18 +298,18 @@ and write_r : _ -> r -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"c\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"c\":"; ( write_p ) ob x.c; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) and string_of_r ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_r ob x; - Bi_outbuf.contents ob + Buffer.contents ob let rec read_p = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -321,7 +321,7 @@ let rec read_p = ( Yojson.Safe.read_gt p lb; `A | "B" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read_r ) p lb @@ -334,7 +334,7 @@ let rec read_p = ( Yojson.Safe.read_gt p lb; `C | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with @@ -343,10 +343,10 @@ let rec read_p = ( | "C" -> `C | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "B" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -359,7 +359,7 @@ let rec read_p = ( Yojson.Safe.read_rbr p lb; `B x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) and p_of_string s = @@ -399,14 +399,14 @@ and read_r = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_a := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -414,7 +414,7 @@ and read_r = ( field_b := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -458,14 +458,14 @@ and read_r = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_a := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -473,7 +473,7 @@ and read_r = ( field_b := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -494,9 +494,9 @@ and read_r = ( with Yojson.End_of_object -> ( ( { - a = (match !field_a with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "a"); - b = (match !field_b with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "b"); - c = (match !field_c with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "c"); + a = (match !field_a with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "a"); + b = (match !field_b with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "b"); + c = (match !field_c with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "c"); } : r) ) @@ -504,23 +504,23 @@ and read_r = ( and r_of_string s = read_r (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let rec write__20 write__a write__b ob x = ( - Atdgen_runtime.Oj_run.write_std_option ( + Atdgen_www_runtime.Oj_run.write_std_option ( write_poly write__a write__b ) ) ob x and string_of__20 write__a write__b ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__20 write__a write__b ob x; - Bi_outbuf.contents ob + Buffer.contents ob and write_poly write__x write__y : _ -> ('x, 'y) poly -> _ = ( fun ob (x : ('x, 'y) poly) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"fst\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"fst\":"; ( write__19 write__x ) @@ -528,18 +528,18 @@ and write_poly write__x write__y : _ -> ('x, 'y) poly -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"snd\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"snd\":"; ( write__20 write__x write__y ) ob x.snd; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) and string_of_poly write__x write__y ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_poly write__x write__y ob x; - Bi_outbuf.contents ob + Buffer.contents ob let rec read__20 read__a read__b = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -551,7 +551,7 @@ let rec read__20 read__a read__b = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read_poly read__a read__b ) p lb @@ -560,17 +560,17 @@ let rec read__20 read__a read__b = ( Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -583,7 +583,7 @@ let rec read__20 read__a read__b = ( Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) and _20_of_string read__a read__b s = @@ -629,7 +629,7 @@ and read_poly read__x read__y = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -687,7 +687,7 @@ and read_poly read__x read__y = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -715,8 +715,8 @@ and read_poly read__x read__y = ( with Yojson.End_of_object -> ( ( { - fst = (match !field_fst with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "fst"); - snd = (match !field_snd with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "snd"); + fst = (match !field_fst with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "fst"); + snd = (match !field_snd with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "snd"); } : ('x, 'y) poly) ) @@ -724,43 +724,43 @@ and read_poly read__x read__y = ( and poly_of_string read__x read__y s = read_poly read__x read__y (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let rec write__2 ob x = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( write_test_variant ) ) ob x and string_of__2 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__2 ob x; - Bi_outbuf.contents ob + Buffer.contents ob and write_test_variant = ( fun ob x -> match x with - | `Case1 -> Bi_outbuf.add_string ob "\"Case1\"" + | `Case1 -> Buffer.add_string ob "\"Case1\"" | `Case2 x -> - Bi_outbuf.add_string ob "[\"Case2\","; + Buffer.add_string ob "[\"Case2\","; ( Yojson.Safe.write_int ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' | `Case3 x -> - Bi_outbuf.add_string ob "[\"Case3\","; + Buffer.add_string ob "[\"Case3\","; ( Yojson.Safe.write_string ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' | `Case4 x -> - Bi_outbuf.add_string ob "[\"Case4\","; + Buffer.add_string ob "[\"Case4\","; ( write__2 ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' ) and string_of_test_variant ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_test_variant ob x; - Bi_outbuf.contents ob + Buffer.contents ob let rec read__2 p lb = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( read_test_variant ) ) p lb @@ -777,25 +777,25 @@ and read_test_variant = ( Yojson.Safe.read_gt p lb; `Case1 | "Case2" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; `Case2 x | "Case3" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; `Case3 x | "Case4" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read__2 ) p lb @@ -804,23 +804,23 @@ and read_test_variant = ( Yojson.Safe.read_gt p lb; `Case4 x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "Case1" -> `Case1 | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Case2" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; @@ -831,7 +831,7 @@ and read_test_variant = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; @@ -849,7 +849,7 @@ and read_test_variant = ( Yojson.Safe.read_rbr p lb; `Case4 x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) and test_variant_of_string s = @@ -857,24 +857,24 @@ and test_variant_of_string s = let rec write__1 : _ -> _ p' -> _ = ( fun ob x -> match x with - | A -> Bi_outbuf.add_string ob "\"A\"" + | A -> Buffer.add_string ob "\"A\"" | Bb x -> - Bi_outbuf.add_string ob "[\"Bb\","; + Buffer.add_string ob "[\"Bb\","; ( write__1 ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' | Ccccc x -> - Bi_outbuf.add_string ob "[\"Ccccc\","; + Buffer.add_string ob "[\"Ccccc\","; ( Yojson.Safe.write_int ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' ) and string_of__1 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__1 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let rec read__1 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -886,7 +886,7 @@ let rec read__1 = ( Yojson.Safe.read_gt p lb; (A : _ p') | "Bb" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read__1 ) p lb @@ -895,26 +895,26 @@ let rec read__1 = ( Yojson.Safe.read_gt p lb; (Bb x : _ p') | "Ccccc" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (Ccccc x : _ p') | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "A" -> (A : _ p') | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Bb" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -931,14 +931,14 @@ let rec read__1 = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (Ccccc x : _ p') | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) and _1_of_string s = @@ -947,26 +947,26 @@ let write_validated_string_check = ( Yojson.Safe.write_string ) let string_of_validated_string_check ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_validated_string_check ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_validated_string_check = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) let validated_string_check_of_string s = read_validated_string_check (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__31 = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( Yojson.Safe.write_string ) ) let string_of__31 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__31 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__31 = ( - Atdgen_runtime.Oj_run.read_list ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_string ) ) let _31_of_string s = @@ -975,9 +975,9 @@ let write_validate_me = ( write__31 ) let string_of_validate_me ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_validate_me ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_validate_me = ( read__31 ) @@ -985,23 +985,23 @@ let validate_me_of_string s = read_validate_me (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_val1 : _ -> val1 -> _ = ( fun ob (x : val1) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"val1_x\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"val1_x\":"; ( Yojson.Safe.write_int ) ob x.val1_x; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_val1 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_val1 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_val1 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1023,14 +1023,14 @@ let read_val1 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_val1_x := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -1054,14 +1054,14 @@ let read_val1 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_val1_x := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -1074,7 +1074,7 @@ let read_val1 = ( with Yojson.End_of_object -> ( ( { - val1_x = (match !field_val1_x with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "val1_x"); + val1_x = (match !field_val1_x with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "val1_x"); } : val1) ) @@ -1082,14 +1082,14 @@ let read_val1 = ( let val1_of_string s = read_val1 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__16 = ( - Atdgen_runtime.Oj_run.write_std_option ( + Atdgen_www_runtime.Oj_run.write_std_option ( write_val1 ) ) let string_of__16 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__16 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__16 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1101,7 +1101,7 @@ let read__16 = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( read_val1 ) p lb @@ -1110,17 +1110,17 @@ let read__16 = ( Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; @@ -1133,20 +1133,20 @@ let read__16 = ( Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let _16_of_string s = read__16 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_val2 : _ -> val2 -> _ = ( fun ob (x : val2) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"val2_x\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"val2_x\":"; ( write_val1 ) @@ -1155,19 +1155,19 @@ let write_val2 : _ -> val2 -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"val2_y\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"val2_y\":"; ( write_val1 ) ob x; ); - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_val2 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_val2 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_val2 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1199,7 +1199,7 @@ let read_val2 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -1249,7 +1249,7 @@ let read_val2 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -1279,7 +1279,7 @@ let read_val2 = ( with Yojson.End_of_object -> ( ( { - val2_x = (match !field_val2_x with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "val2_x"); + val2_x = (match !field_val2_x with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "val2_x"); val2_y = !field_val2_y; } : val2) @@ -1288,17 +1288,17 @@ let read_val2 = ( let val2_of_string s = read_val2 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__29 = ( - Atdgen_runtime.Oj_run.write_list ( - Atdgen_runtime.Oj_run.write_float_as_int + Atdgen_www_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_float_as_int ) ) let string_of__29 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__29 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__29 = ( - Atdgen_runtime.Oj_run.read_list ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_number ) ) let _29_of_string s = @@ -1307,59 +1307,59 @@ let write_unixtime_list = ( write__29 ) let string_of_unixtime_list ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_unixtime_list ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_unixtime_list = ( read__29 ) let unixtime_list_of_string s = read_unixtime_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__3 = ( - Atdgen_runtime.Oj_run.write_nullable ( + Atdgen_www_runtime.Oj_run.write_nullable ( Yojson.Safe.write_int ) ) let string_of__3 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__3 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__3 = ( fun p lb -> Yojson.Safe.read_space p lb; (if Yojson.Safe.read_null_if_possible p lb then None else Some (( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb) : _ option) ) let _3_of_string s = read__3 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_date = ( fun ob x -> - Bi_outbuf.add_char ob '['; + Buffer.add_char ob '['; (let x, _, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x, _ = x in ( write__3 ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, x = x in ( write__3 ) ob x ); - Bi_outbuf.add_char ob ']'; + Buffer.add_char ob ']'; ) let string_of_date ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_date ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_date = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1370,7 +1370,7 @@ let read_date = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -1413,35 +1413,35 @@ let read_date = ( ); (x0, x1, x2) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); ) let date_of_string s = read_date (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__9 = ( - Atdgen_runtime.Oj_run.write_array ( + Atdgen_www_runtime.Oj_run.write_array ( Yojson.Safe.write_string ) ) let string_of__9 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__9 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__9 = ( - Atdgen_runtime.Oj_run.read_array ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_array ( + Atdgen_www_runtime.Oj_run.read_string ) ) let _9_of_string s = read__9 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__8 = ( - Atdgen_runtime.Oj_run.write_std_option ( + Atdgen_www_runtime.Oj_run.write_std_option ( Yojson.Safe.write_bool ) ) let string_of__8 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__8 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__8 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1453,68 +1453,68 @@ let read__8 = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let _8_of_string s = read__8 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__7 = ( - Atdgen_runtime.Oj_run.write_array ( + Atdgen_www_runtime.Oj_run.write_array ( Yojson.Safe.write_std_float ) ) let string_of__7 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__7 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__7 = ( - Atdgen_runtime.Oj_run.read_array ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_array ( + Atdgen_www_runtime.Oj_run.read_number ) ) let _7_of_string s = read__7 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__6 = ( - Atdgen_runtime.Oj_run.write_std_option ( + Atdgen_www_runtime.Oj_run.write_std_option ( Yojson.Safe.write_string ) ) let string_of__6 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__6 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__6 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1526,52 +1526,52 @@ let read__6 = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let _6_of_string s = read__6 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__5 = ( - Atdgen_runtime.Oj_run.write_std_option ( + Atdgen_www_runtime.Oj_run.write_std_option ( Yojson.Safe.write_std_float ) ) let string_of__5 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__5 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__5 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1583,52 +1583,52 @@ let read__5 = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let _5_of_string s = read__5 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__4 = ( - Atdgen_runtime.Oj_run.write_std_option ( + Atdgen_www_runtime.Oj_run.write_std_option ( Yojson.Safe.write_int ) ) let string_of__4 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__4 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__4 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -1640,85 +1640,85 @@ let read__4 = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let _4_of_string s = read__4 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__11 = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( write__6 ) ) let string_of__11 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__11 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__11 = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( read__6 ) ) let _11_of_string s = read__11 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__10 = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( Yojson.Safe.write_null ) ) let string_of__10 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__10 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__10 = ( - Atdgen_runtime.Oj_run.read_list ( - Atdgen_runtime.Oj_run.read_null + Atdgen_www_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_null ) ) let _10_of_string s = read__10 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_mixed_record : _ -> mixed_record -> _ = ( fun ob (x : mixed_record) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in (match x.field0 with None -> () | Some x -> if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field0\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field0\":"; ( Yojson.Safe.write_int ) @@ -1728,8 +1728,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field1\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field1\":"; ( Yojson.Safe.write_std_float ) @@ -1738,8 +1738,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field2\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field2\":"; ( write__6 ) @@ -1747,17 +1747,17 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field3\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field3\":"; ( - Atdgen_runtime.Oj_run.write_int64 + Atdgen_www_runtime.Oj_run.write_int64 ) ob x.field3; if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field4\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field4\":"; ( write__7 ) @@ -1766,8 +1766,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field5\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field5\":"; ( Yojson.Safe.write_bool ) @@ -1777,8 +1777,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field6\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field6\":"; ( Yojson.Safe.write_string ) @@ -1787,8 +1787,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field7\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field7\":"; ( write_test_variant ) @@ -1796,8 +1796,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field8\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field8\":"; ( write__9 ) @@ -1805,54 +1805,54 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field9\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field9\":"; ( fun ob x -> - Bi_outbuf.add_char ob '['; + Buffer.add_char ob '['; (let x, _, _, _, _, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x, _, _, _, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, x, _, _, _ = x in ( - Atdgen_runtime.Oj_run.write_int8 + Atdgen_www_runtime.Oj_run.write_int8 ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, _, x, _, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, _, _, x, _ = x in ( - Atdgen_runtime.Oj_run.write_int32 + Atdgen_www_runtime.Oj_run.write_int32 ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, _, _, _, x = x in ( - Atdgen_runtime.Oj_run.write_int64 + Atdgen_www_runtime.Oj_run.write_int64 ) ob x ); - Bi_outbuf.add_char ob ']'; + Buffer.add_char ob ']'; ) ob x.field9; if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field10\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field10\":"; ( Yojson.Safe.write_bool ) @@ -1861,8 +1861,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field11\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field11\":"; ( Yojson.Safe.write_bool ) @@ -1871,8 +1871,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field12\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field12\":"; ( write__10 ) @@ -1880,8 +1880,8 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field13\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field13\":"; ( write__11 ) @@ -1889,18 +1889,18 @@ let write_mixed_record : _ -> mixed_record -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"field14\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field14\":"; ( write_date ) ob x.field14; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_mixed_record ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_mixed_record ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_mixed_record = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -2001,7 +2001,7 @@ let read_mixed_record = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -2009,7 +2009,7 @@ let read_mixed_record = ( field_field0 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -2019,7 +2019,7 @@ let read_mixed_record = ( field_field1 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -2036,7 +2036,7 @@ let read_mixed_record = ( field_field3 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int64 + Atdgen_www_runtime.Oj_run.read_int64 ) p lb ) ); @@ -2053,7 +2053,7 @@ let read_mixed_record = ( field_field5 := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -2063,7 +2063,7 @@ let read_mixed_record = ( field_field6 := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -2097,7 +2097,7 @@ let read_mixed_record = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -2108,7 +2108,7 @@ let read_mixed_record = ( let x1 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -2119,7 +2119,7 @@ let read_mixed_record = ( let x2 = let x = ( - Atdgen_runtime.Oj_run.read_int8 + Atdgen_www_runtime.Oj_run.read_int8 ) p lb in incr len; @@ -2130,7 +2130,7 @@ let read_mixed_record = ( let x3 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -2141,7 +2141,7 @@ let read_mixed_record = ( let x4 = let x = ( - Atdgen_runtime.Oj_run.read_int32 + Atdgen_www_runtime.Oj_run.read_int32 ) p lb in incr len; @@ -2152,7 +2152,7 @@ let read_mixed_record = ( let x5 = let x = ( - Atdgen_runtime.Oj_run.read_int64 + Atdgen_www_runtime.Oj_run.read_int64 ) p lb in incr len; @@ -2173,7 +2173,7 @@ let read_mixed_record = ( ); (x0, x1, x2, x3, x4, x5) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3; 4; 5 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3; 4; 5 ]); ) p lb ) ); @@ -2181,7 +2181,7 @@ let read_mixed_record = ( field_field10 := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -2189,7 +2189,7 @@ let read_mixed_record = ( if not (Yojson.Safe.read_null_if_possible p lb) then ( field_field11 := ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ); ) @@ -2302,7 +2302,7 @@ let read_mixed_record = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -2310,7 +2310,7 @@ let read_mixed_record = ( field_field0 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -2320,7 +2320,7 @@ let read_mixed_record = ( field_field1 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -2337,7 +2337,7 @@ let read_mixed_record = ( field_field3 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int64 + Atdgen_www_runtime.Oj_run.read_int64 ) p lb ) ); @@ -2354,7 +2354,7 @@ let read_mixed_record = ( field_field5 := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -2364,7 +2364,7 @@ let read_mixed_record = ( field_field6 := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -2398,7 +2398,7 @@ let read_mixed_record = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -2409,7 +2409,7 @@ let read_mixed_record = ( let x1 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -2420,7 +2420,7 @@ let read_mixed_record = ( let x2 = let x = ( - Atdgen_runtime.Oj_run.read_int8 + Atdgen_www_runtime.Oj_run.read_int8 ) p lb in incr len; @@ -2431,7 +2431,7 @@ let read_mixed_record = ( let x3 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -2442,7 +2442,7 @@ let read_mixed_record = ( let x4 = let x = ( - Atdgen_runtime.Oj_run.read_int32 + Atdgen_www_runtime.Oj_run.read_int32 ) p lb in incr len; @@ -2453,7 +2453,7 @@ let read_mixed_record = ( let x5 = let x = ( - Atdgen_runtime.Oj_run.read_int64 + Atdgen_www_runtime.Oj_run.read_int64 ) p lb in incr len; @@ -2474,7 +2474,7 @@ let read_mixed_record = ( ); (x0, x1, x2, x3, x4, x5) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3; 4; 5 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3; 4; 5 ]); ) p lb ) ); @@ -2482,7 +2482,7 @@ let read_mixed_record = ( field_field10 := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -2490,7 +2490,7 @@ let read_mixed_record = ( if not (Yojson.Safe.read_null_if_possible p lb) then ( field_field11 := ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ); ) @@ -2529,19 +2529,19 @@ let read_mixed_record = ( { field0 = !field_field0; field1 = !field_field1; - field2 = (match !field_field2 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field2"); - field3 = (match !field_field3 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field3"); - field4 = (match !field_field4 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field4"); + field2 = (match !field_field2 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field2"); + field3 = (match !field_field3 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field3"); + field4 = (match !field_field4 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field4"); field5 = !field_field5; field6 = !field_field6; - field7 = (match !field_field7 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field7"); - field8 = (match !field_field8 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field8"); - field9 = (match !field_field9 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field9"); - field10 = (match !field_field10 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field10"); + field7 = (match !field_field7 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field7"); + field8 = (match !field_field8 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field8"); + field9 = (match !field_field9 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field9"); + field10 = (match !field_field10 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field10"); field11 = !field_field11; - field12 = (match !field_field12 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field12"); - field13 = (match !field_field13 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field13"); - field14 = (match !field_field14 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "field14"); + field12 = (match !field_field12 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field12"); + field13 = (match !field_field13 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field13"); + field14 = (match !field_field14 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "field14"); } : mixed_record) ) @@ -2549,61 +2549,61 @@ let read_mixed_record = ( let mixed_record_of_string s = read_mixed_record (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__13 = ( - Atdgen_runtime.Oj_run.write_array ( + Atdgen_www_runtime.Oj_run.write_array ( write_mixed_record ) ) let string_of__13 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__13 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__13 = ( - Atdgen_runtime.Oj_run.read_array ( + Atdgen_www_runtime.Oj_run.read_array ( read_mixed_record ) ) let _13_of_string s = read__13 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__12 = ( - Atdgen_runtime.Oj_run.write_array ( + Atdgen_www_runtime.Oj_run.write_array ( write_mixed_record ) ) let string_of__12 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__12 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__12 = ( - Atdgen_runtime.Oj_run.read_array ( + Atdgen_www_runtime.Oj_run.read_array ( read_mixed_record ) ) let _12_of_string s = read__12 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__14 = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( fun ob x -> - Bi_outbuf.add_char ob '['; + Buffer.add_char ob '['; (let x, _ = x in ( write__12 ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x = x in ( write__13 ) ob x ); - Bi_outbuf.add_char ob ']'; + Buffer.add_char ob ']'; ) ) let string_of__14 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__14 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__14 = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( fun p lb -> Yojson.Safe.read_space p lb; let std_tuple = Yojson.Safe.start_any_tuple p lb in @@ -2645,7 +2645,7 @@ let read__14 = ( ); (x0, x1) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); ) ) let _14_of_string s = @@ -2654,25 +2654,25 @@ let write_mixed = ( write__14 ) let string_of_mixed ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_mixed ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_mixed = ( read__14 ) let mixed_of_string s = read_mixed (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__15 = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( write_mixed_record ) ) let string_of__15 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__15 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__15 = ( - Atdgen_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_list ( read_mixed_record ) ) @@ -2680,14 +2680,14 @@ let _15_of_string s = read__15 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_test : _ -> test -> _ = ( fun ob (x : test) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in (match x.x0 with None -> () | Some x -> if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"x0\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"x0\":"; ( Yojson.Safe.write_int ) @@ -2697,8 +2697,8 @@ let write_test : _ -> test -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"x1\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"x1\":"; ( Yojson.Safe.write_std_float ) @@ -2707,8 +2707,8 @@ let write_test : _ -> test -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"x2\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"x2\":"; ( write_mixed ) @@ -2716,8 +2716,8 @@ let write_test : _ -> test -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"x3\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"x3\":"; ( write__15 ) @@ -2725,18 +2725,18 @@ let write_test : _ -> test -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"x4\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"x4\":"; ( - Atdgen_runtime.Oj_run.write_int64 + Atdgen_www_runtime.Oj_run.write_int64 ) ob x.x4; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_test ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_test ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_test = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -2780,7 +2780,7 @@ let read_test = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -2788,7 +2788,7 @@ let read_test = ( field_x0 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -2798,7 +2798,7 @@ let read_test = ( field_x1 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -2823,7 +2823,7 @@ let read_test = ( field_x4 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int64 + Atdgen_www_runtime.Oj_run.read_int64 ) p lb ) ); @@ -2865,7 +2865,7 @@ let read_test = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> @@ -2873,7 +2873,7 @@ let read_test = ( field_x0 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -2883,7 +2883,7 @@ let read_test = ( field_x1 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -2908,7 +2908,7 @@ let read_test = ( field_x4 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int64 + Atdgen_www_runtime.Oj_run.read_int64 ) p lb ) ); @@ -2923,9 +2923,9 @@ let read_test = ( { x0 = !field_x0; x1 = !field_x1; - x2 = (match !field_x2 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "x2"); - x3 = (match !field_x3 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "x3"); - x4 = (match !field_x4 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "x4"); + x2 = (match !field_x2 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "x2"); + x3 = (match !field_x3 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "x3"); + x4 = (match !field_x4 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "x4"); } : test) ) @@ -2934,24 +2934,24 @@ let test_of_string s = read_test (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_tup = ( fun ob x -> - Bi_outbuf.add_char ob '['; + Buffer.add_char ob '['; (let x, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x = x in ( write_test ) ob x ); - Bi_outbuf.add_char ob ']'; + Buffer.add_char ob ']'; ) let string_of_tup ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_tup ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_tup = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -2962,7 +2962,7 @@ let read_tup = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -2994,7 +2994,7 @@ let read_tup = ( ); (x0, x1) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); ) let tup_of_string s = read_tup (Yojson.Safe.init_lexer ()) (Lexing.from_string s) @@ -3002,33 +3002,33 @@ let write_star_rating = ( Yojson.Safe.write_int ) let string_of_star_rating ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_star_rating ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_star_rating = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) let star_rating_of_string s = read_star_rating (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__30 : _ -> _ generic -> _ = ( fun ob (x : _ generic) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"x294623\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"x294623\":"; ( Yojson.Safe.write_int ) ob x.x294623; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of__30 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__30 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__30 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -3050,14 +3050,14 @@ let read__30 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_x294623 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -3081,14 +3081,14 @@ let read__30 = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_x294623 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -3101,7 +3101,7 @@ let read__30 = ( with Yojson.End_of_object -> ( ( { - x294623 = (match !field_x294623 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "x294623"); + x294623 = (match !field_x294623 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "x294623"); } : _ generic) ) @@ -3112,9 +3112,9 @@ let write_specialized = ( write__30 ) let string_of_specialized ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_specialized ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_specialized = ( read__30 ) @@ -3122,23 +3122,23 @@ let specialized_of_string s = read_specialized (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_some_record : _ -> some_record -> _ = ( fun ob (x : some_record) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"some_field\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"some_field\":"; ( Yojson.Safe.write_int ) ob x.some_field; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_some_record ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_some_record ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_some_record = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -3160,14 +3160,14 @@ let read_some_record = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_some_field := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -3191,14 +3191,14 @@ let read_some_record = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_some_field := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -3211,7 +3211,7 @@ let read_some_record = ( with Yojson.End_of_object -> ( ( { - some_field = (match !field_some_field with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "some_field"); + some_field = (match !field_some_field with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "some_field"); } : some_record) ) @@ -3220,13 +3220,13 @@ let some_record_of_string s = read_some_record (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_precision : _ -> precision -> _ = ( fun ob (x : precision) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"sqrt2_5\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"sqrt2_5\":"; ( Yojson.Safe.write_std_float_prec 5 ) @@ -3234,8 +3234,8 @@ let write_precision : _ -> precision -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"small_2\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"small_2\":"; ( Yojson.Safe.write_std_float_prec 2 ) @@ -3243,18 +3243,18 @@ let write_precision : _ -> precision -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"large_2\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"large_2\":"; ( Yojson.Safe.write_std_float_prec 2 ) ob x.large_2; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_precision ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_precision ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_precision = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -3311,14 +3311,14 @@ let read_precision = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_sqrt2_5 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -3326,7 +3326,7 @@ let read_precision = ( field_small_2 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -3334,7 +3334,7 @@ let read_precision = ( field_large_2 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -3391,14 +3391,14 @@ let read_precision = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_sqrt2_5 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -3406,7 +3406,7 @@ let read_precision = ( field_small_2 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -3414,7 +3414,7 @@ let read_precision = ( field_large_2 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -3427,9 +3427,9 @@ let read_precision = ( with Yojson.End_of_object -> ( ( { - sqrt2_5 = (match !field_sqrt2_5 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "sqrt2_5"); - small_2 = (match !field_small_2 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "small_2"); - large_2 = (match !field_large_2 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "large_2"); + sqrt2_5 = (match !field_sqrt2_5 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "sqrt2_5"); + small_2 = (match !field_small_2 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "small_2"); + large_2 = (match !field_large_2 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "large_2"); } : precision) ) @@ -3440,23 +3440,23 @@ let write_p'' = ( write__1 ) let string_of_p'' ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_p'' ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_p'' = ( read__1 ) let p''_of_string s = read_p'' (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__18 = ( - Atdgen_runtime.Oj_run.write_std_option ( + Atdgen_www_runtime.Oj_run.write_std_option ( Yojson.Safe.write_int ) ) let string_of__18 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__18 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__18 = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -3468,39 +3468,39 @@ let read__18 = ( Yojson.Safe.read_gt p lb; (None : _ option) | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "None" -> (None : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; (Some x : _ option) | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let _18_of_string s = @@ -3509,9 +3509,9 @@ let write_option_validation = ( write__18 ) let string_of_option_validation ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_option_validation ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_option_validation = ( read__18 ) @@ -3521,9 +3521,9 @@ let write__28 = ( write_some_record ) let string_of__28 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__28 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__28 = ( read_some_record ) @@ -3533,9 +3533,9 @@ let write_no_real_wrap = ( write__28 ) let string_of_no_real_wrap ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_no_real_wrap ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_no_real_wrap = ( read__28 ) @@ -3548,13 +3548,13 @@ let write__26 = ( ) ob x) ) let string_of__26 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__26 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__26 = ( fun p lb -> let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in ( Test_lib.Natural.wrap ) x ) @@ -3564,9 +3564,9 @@ let write_natural = ( write__26 ) let string_of_natural ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_natural ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_natural = ( read__26 ) @@ -3579,13 +3579,13 @@ let write__24 = ( ) ob x) ) let string_of__24 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__24 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__24 = ( fun p lb -> let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in ( fun s -> `Id s ) x ) @@ -3595,30 +3595,30 @@ let write_id = ( write__24 ) let string_of_id ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_id ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_id = ( read__24 ) let id_of_string s = read_id (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__25 = ( - Atdgen_runtime.Oj_run.write_assoc_list ( + Atdgen_www_runtime.Oj_run.write_assoc_list ( write_id ) ( Yojson.Safe.write_int ) ) let string_of__25 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__25 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__25 = ( - Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_www_runtime.Oj_run.read_assoc_list ( read_id ) ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) ) let _25_of_string s = @@ -3627,9 +3627,9 @@ let write_json_map = ( write__25 ) let string_of_json_map ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_json_map ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_json_map = ( read__25 ) @@ -3639,30 +3639,30 @@ let write_intopt = ( write__4 ) let string_of_intopt ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_intopt ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_intopt = ( read__4 ) let intopt_of_string s = read_intopt (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__21 = ( - Atdgen_runtime.Oj_run.write_assoc_list ( + Atdgen_www_runtime.Oj_run.write_assoc_list ( Yojson.Safe.write_string ) ( Yojson.Safe.write_int ) ) let string_of__21 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__21 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__21 = ( - Atdgen_runtime.Oj_run.read_assoc_list ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_assoc_list ( + Atdgen_www_runtime.Oj_run.read_string ) ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) ) let _21_of_string s = @@ -3671,30 +3671,30 @@ let write_int_assoc_list = ( write__21 ) let string_of_int_assoc_list ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_int_assoc_list ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_int_assoc_list = ( read__21 ) let int_assoc_list_of_string s = read_int_assoc_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__22 = ( - Atdgen_runtime.Oj_run.write_assoc_array ( + Atdgen_www_runtime.Oj_run.write_assoc_array ( Yojson.Safe.write_string ) ( Yojson.Safe.write_int ) ) let string_of__22 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__22 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__22 = ( - Atdgen_runtime.Oj_run.read_assoc_array ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_assoc_array ( + Atdgen_www_runtime.Oj_run.read_string ) ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) ) let _22_of_string s = @@ -3703,9 +3703,9 @@ let write_int_assoc_array = ( write__22 ) let string_of_int_assoc_array ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_int_assoc_array ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_int_assoc_array = ( read__22 ) @@ -3715,35 +3715,35 @@ let write_int8 = ( Yojson.Safe.write_int ) let string_of_int8 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_int8 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_int8 = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) let int8_of_string s = read_int8 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_int64 = ( - Atdgen_runtime.Oj_run.write_int64 + Atdgen_www_runtime.Oj_run.write_int64 ) let string_of_int64 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_int64 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_int64 = ( - Atdgen_runtime.Oj_run.read_int64 + Atdgen_www_runtime.Oj_run.read_int64 ) let int64_of_string s = read_int64 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_int32 = ( - Atdgen_runtime.Oj_run.write_int32 + Atdgen_www_runtime.Oj_run.write_int32 ) let string_of_int32 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_int32 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_int32 = ( - Atdgen_runtime.Oj_run.read_int32 + Atdgen_www_runtime.Oj_run.read_int32 ) let int32_of_string s = read_int32 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) @@ -3751,17 +3751,17 @@ let write_hello = ( fun ob x -> match x with | `Hello x -> - Bi_outbuf.add_string ob "[\"Hello\","; + Buffer.add_string ob "[\"Hello\","; ( Yojson.Safe.write_string ) ob x; - Bi_outbuf.add_char ob ']' - | `World -> Bi_outbuf.add_string ob "\"World\"" + Buffer.add_char ob ']' + | `World -> Buffer.add_string ob "\"World\"" ) let string_of_hello ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_hello ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_hello = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -3769,9 +3769,9 @@ let read_hello = ( | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with | "Hello" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; @@ -3782,53 +3782,53 @@ let read_hello = ( Yojson.Safe.read_gt p lb; `World | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with | "World" -> `World | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + match Atdgen_www_runtime.Oj_run.read_string p lb with | "Hello" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; `Hello x | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x + Atdgen_www_runtime.Oj_run.invalid_variant_tag p x ) ) let hello_of_string s = read_hello (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_generic write__a : _ -> 'a generic -> _ = ( fun ob (x : 'a generic) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"x294623\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"x294623\":"; ( Yojson.Safe.write_int ) ob x.x294623; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_generic write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_generic write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_generic read__a = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -3850,14 +3850,14 @@ let read_generic read__a = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_x294623 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -3881,14 +3881,14 @@ let read_generic read__a = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_x294623 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -3901,7 +3901,7 @@ let read_generic read__a = ( with Yojson.End_of_object -> ( ( { - x294623 = (match !field_x294623 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "x294623"); + x294623 = (match !field_x294623 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "x294623"); } : 'a generic) ) @@ -3910,13 +3910,13 @@ let generic_of_string read__a s = read_generic read__a (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_floats : _ -> floats -> _ = ( fun ob (x : floats) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"f32\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"f32\":"; ( Yojson.Safe.write_std_float ) @@ -3924,18 +3924,18 @@ let write_floats : _ -> floats -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"f64\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"f64\":"; ( Yojson.Safe.write_std_float ) ob x.f64; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_floats ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_floats ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_floats = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -3977,14 +3977,14 @@ let read_floats = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_f32 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -3992,7 +3992,7 @@ let read_floats = ( field_f64 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -4035,14 +4035,14 @@ let read_floats = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_f32 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -4050,7 +4050,7 @@ let read_floats = ( field_f64 := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ) ); @@ -4063,8 +4063,8 @@ let read_floats = ( with Yojson.End_of_object -> ( ( { - f32 = (match !field_f32 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "f32"); - f64 = (match !field_f64 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "f64"); + f32 = (match !field_f32 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "f32"); + f64 = (match !field_f64 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "f64"); } : floats) ) @@ -4072,65 +4072,65 @@ let read_floats = ( let floats_of_string s = read_floats (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__17 = ( - Atdgen_runtime.Oj_run.write_list ( + Atdgen_www_runtime.Oj_run.write_list ( Yojson.Safe.write_string ) ) let string_of__17 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__17 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__17 = ( - Atdgen_runtime.Oj_run.read_list ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_list ( + Atdgen_www_runtime.Oj_run.read_string ) ) let _17_of_string s = read__17 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_extended_tuple = ( fun ob x -> - Bi_outbuf.add_char ob '['; + Buffer.add_char ob '['; (let x, _, _, _, _, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x, _, _, _, _ = x in ( Yojson.Safe.write_std_float ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, x, _, _, _ = x in ( Yojson.Safe.write_bool ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, _, x, _, _ = x in ( write__4 ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, _, _, x, _ = x in ( Yojson.Safe.write_string ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, _, _, _, x = x in ( write__17 ) ob x ); - Bi_outbuf.add_char ob ']'; + Buffer.add_char ob ']'; ) let string_of_extended_tuple ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_extended_tuple ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_extended_tuple = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -4141,7 +4141,7 @@ let read_extended_tuple = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -4152,7 +4152,7 @@ let read_extended_tuple = ( let x1 = let x = ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb in incr len; @@ -4163,7 +4163,7 @@ let read_extended_tuple = ( let x2 = let x = ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb in incr len; @@ -4185,7 +4185,7 @@ let read_extended_tuple = ( let x4 = let x = ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb in incr len; @@ -4223,19 +4223,19 @@ let read_extended_tuple = ( ); (x0, x1, x2, x3, x4, x5) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 4 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 4 ]); ) let extended_tuple_of_string s = read_extended_tuple (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_extended : _ -> extended -> _ = ( fun ob (x : extended) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b0\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b0\":"; ( Yojson.Safe.write_int ) @@ -4243,8 +4243,8 @@ let write_extended : _ -> extended -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b1\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b1\":"; ( Yojson.Safe.write_bool ) @@ -4252,8 +4252,8 @@ let write_extended : _ -> extended -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b2\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b2\":"; ( Yojson.Safe.write_string ) @@ -4262,8 +4262,8 @@ let write_extended : _ -> extended -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b3\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b3\":"; ( Yojson.Safe.write_string ) @@ -4272,8 +4272,8 @@ let write_extended : _ -> extended -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b4\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b4\":"; ( write__6 ) @@ -4282,19 +4282,19 @@ let write_extended : _ -> extended -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b5\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b5\":"; ( Yojson.Safe.write_std_float ) ob x.b5x; ); - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_extended ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_extended ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_extended = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -4342,14 +4342,14 @@ let read_extended = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_b0x := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -4357,7 +4357,7 @@ let read_extended = ( field_b1x := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -4365,7 +4365,7 @@ let read_extended = ( field_b2x := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -4374,7 +4374,7 @@ let read_extended = ( field_b3x := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -4391,7 +4391,7 @@ let read_extended = ( if not (Yojson.Safe.read_null_if_possible p lb) then ( field_b5x := ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ); ) @@ -4436,14 +4436,14 @@ let read_extended = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_b0x := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -4451,7 +4451,7 @@ let read_extended = ( field_b1x := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -4459,7 +4459,7 @@ let read_extended = ( field_b2x := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -4468,7 +4468,7 @@ let read_extended = ( field_b3x := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_www_runtime.Oj_run.read_string ) p lb ) ); @@ -4485,7 +4485,7 @@ let read_extended = ( if not (Yojson.Safe.read_null_if_possible p lb) then ( field_b5x := ( ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb ); ) @@ -4498,11 +4498,11 @@ let read_extended = ( with Yojson.End_of_object -> ( ( { - b0x = (match !field_b0x with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "b0x"); - b1x = (match !field_b1x with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "b1x"); - b2x = (match !field_b2x with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "b2x"); + b0x = (match !field_b0x with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "b0x"); + b1x = (match !field_b1x with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "b1x"); + b2x = (match !field_b2x with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "b2x"); b3x = !field_b3x; - b4x = (match !field_b4x with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "b4x"); + b4x = (match !field_b4x with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "b4x"); b5x = !field_b5x; } : extended) @@ -4517,9 +4517,9 @@ let write__27 = ( ) ob x) ) let string_of__27 ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__27 ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__27 = ( fun p lb -> let x = ( @@ -4533,9 +4533,9 @@ let write_even_natural = ( write__27 ) let string_of_even_natural ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_even_natural ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_even_natural = ( read__27 ) @@ -4545,46 +4545,46 @@ let write_def = ( Test_lib.Json.write_def ) let string_of_def ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_def ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_def = ( Test_lib.Json.read_def ) let def_of_string s = read_def (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_char = ( - Atdgen_runtime.Oj_run.write_int8 + Atdgen_www_runtime.Oj_run.write_int8 ) let string_of_char ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_char ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_char = ( - Atdgen_runtime.Oj_run.read_int8 + Atdgen_www_runtime.Oj_run.read_int8 ) let char_of_string s = read_char (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_base_tuple = ( fun ob x -> - Bi_outbuf.add_char ob '['; + Buffer.add_char ob '['; (let x, _ = x in ( Yojson.Safe.write_int ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, x = x in ( Yojson.Safe.write_std_float ) ob x ); - Bi_outbuf.add_char ob ']'; + Buffer.add_char ob ']'; ) let string_of_base_tuple ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_base_tuple ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_base_tuple = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -4595,7 +4595,7 @@ let read_base_tuple = ( let x0 = let x = ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb in incr len; @@ -4606,7 +4606,7 @@ let read_base_tuple = ( let x1 = let x = ( - Atdgen_runtime.Oj_run.read_number + Atdgen_www_runtime.Oj_run.read_number ) p lb in incr len; @@ -4627,19 +4627,19 @@ let read_base_tuple = ( ); (x0, x1) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + Atdgen_www_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); ) let base_tuple_of_string s = read_base_tuple (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_base : _ -> base -> _ = ( fun ob (x : base) -> - Bi_outbuf.add_char ob '{'; + Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b0\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b0\":"; ( Yojson.Safe.write_int ) @@ -4647,18 +4647,18 @@ let write_base : _ -> base -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"b1\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"b1\":"; ( Yojson.Safe.write_bool ) ob x.b1; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_base ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_base ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_base = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -4690,14 +4690,14 @@ let read_base = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_b0 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -4705,7 +4705,7 @@ let read_base = ( field_b1 := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -4738,14 +4738,14 @@ let read_base = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + Atdgen_www_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_b0 := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_www_runtime.Oj_run.read_int ) p lb ) ); @@ -4753,7 +4753,7 @@ let read_base = ( field_b1 := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_www_runtime.Oj_run.read_bool ) p lb ) ); @@ -4766,8 +4766,8 @@ let read_base = ( with Yojson.End_of_object -> ( ( { - b0 = (match !field_b0 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "b0"); - b1 = (match !field_b1 with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "b1"); + b0 = (match !field_b0 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "b0"); + b1 = (match !field_b1 with Some x -> x | None -> Atdgen_www_runtime.Oj_run.missing_field p "b1"); } : base) ) @@ -4775,16 +4775,16 @@ let read_base = ( let base_of_string s = read_base (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__23 write__a = ( - Atdgen_runtime.Oj_run.write_array ( + Atdgen_www_runtime.Oj_run.write_array ( write__a ) ) let string_of__23 write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write__23 write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read__23 read__a = ( - Atdgen_runtime.Oj_run.read_array ( + Atdgen_www_runtime.Oj_run.read_array ( read__a ) ) @@ -4794,9 +4794,9 @@ let write_array write__a = ( write__23 write__a ) let string_of_array write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_array write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_array read__a = ( read__23 read__a ) @@ -4806,9 +4806,9 @@ let write_abs3 write__a = ( write__19 write__a ) let string_of_abs3 write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_abs3 write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_abs3 read__a = ( read__19 read__a ) @@ -4818,9 +4818,9 @@ let write_abs2 write__a = ( write__19 write__a ) let string_of_abs2 write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_abs2 write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_abs2 read__a = ( read__19 read__a ) @@ -4830,9 +4830,9 @@ let write_abs1 write__a = ( write__19 write__a ) let string_of_abs1 write__a ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_abs1 write__a ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_abs1 read__a = ( read__19 read__a ) diff --git a/atdgen/test/testjstd.expected.mli b/atdgen/test/testjstd.expected.mli index d0a1479..d14e9ec 100644 --- a/atdgen/test/testjstd.expected.mli +++ b/atdgen/test/testjstd.expected.mli @@ -33,11 +33,11 @@ type mixed_record = Test.mixed_record = { field1: float option; field2: string option; field3: Int64.t; - field4: float Atdgen_runtime.Util.ocaml_array; + field4: float Atdgen_www_runtime.Util.ocaml_array; field5: bool option; field6: string option; field7: test_variant; - field8: string Atdgen_runtime.Util.ocaml_array; + field8: string Atdgen_www_runtime.Util.ocaml_array; field9: (int * int * Char.t * int * Int32.t * Int64.t); field10: bool; field11: bool; @@ -153,8 +153,8 @@ type 'a abs2 = 'a Test.abs2 type 'a abs1 = 'a Test.abs1 val write_test_variant : - Bi_outbuf.t -> test_variant -> unit - (** Output a JSON value of type {!test_variant}. *) + Buffer.t -> test_variant -> unit + (** Output a JSON value of type {!type:test_variant}. *) val string_of_test_variant : ?len:int -> test_variant -> string @@ -174,14 +174,14 @@ val test_variant_of_string : val write_poly : - (Bi_outbuf.t -> 'x -> unit) -> - (Bi_outbuf.t -> 'y -> unit) -> - Bi_outbuf.t -> ('x, 'y) poly -> unit - (** Output a JSON value of type {!poly}. *) + (Buffer.t -> 'x -> unit) -> + (Buffer.t -> 'y -> unit) -> + Buffer.t -> ('x, 'y) poly -> unit + (** Output a JSON value of type {!type:poly}. *) val string_of_poly : - (Bi_outbuf.t -> 'x -> unit) -> - (Bi_outbuf.t -> 'y -> unit) -> + (Buffer.t -> 'x -> unit) -> + (Buffer.t -> 'y -> unit) -> ?len:int -> ('x, 'y) poly -> string (** Serialize a value of type {!poly} into a JSON string. @@ -209,12 +209,12 @@ val create_poly : val write_p' : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a p' -> unit - (** Output a JSON value of type {!p'}. *) + (Buffer.t -> 'a -> unit) -> + Buffer.t -> 'a p' -> unit + (** Output a JSON value of type {!type:p'}. *) val string_of_p' : - (Bi_outbuf.t -> 'a -> unit) -> + (Buffer.t -> 'a -> unit) -> ?len:int -> 'a p' -> string (** Serialize a value of type {!p'} into a JSON string. @@ -234,8 +234,8 @@ val p'_of_string : val write_p : - Bi_outbuf.t -> p -> unit - (** Output a JSON value of type {!p}. *) + Buffer.t -> p -> unit + (** Output a JSON value of type {!type:p}. *) val string_of_p : ?len:int -> p -> string @@ -255,8 +255,8 @@ val p_of_string : val write_r : - Bi_outbuf.t -> r -> unit - (** Output a JSON value of type {!r}. *) + Buffer.t -> r -> unit + (** Output a JSON value of type {!type:r}. *) val string_of_r : ?len:int -> r -> string @@ -283,8 +283,8 @@ val create_r : val write_validated_string_check : - Bi_outbuf.t -> validated_string_check -> unit - (** Output a JSON value of type {!validated_string_check}. *) + Buffer.t -> validated_string_check -> unit + (** Output a JSON value of type {!type:validated_string_check}. *) val string_of_validated_string_check : ?len:int -> validated_string_check -> string @@ -304,8 +304,8 @@ val validated_string_check_of_string : val write_validate_me : - Bi_outbuf.t -> validate_me -> unit - (** Output a JSON value of type {!validate_me}. *) + Buffer.t -> validate_me -> unit + (** Output a JSON value of type {!type:validate_me}. *) val string_of_validate_me : ?len:int -> validate_me -> string @@ -325,8 +325,8 @@ val validate_me_of_string : val write_val1 : - Bi_outbuf.t -> val1 -> unit - (** Output a JSON value of type {!val1}. *) + Buffer.t -> val1 -> unit + (** Output a JSON value of type {!type:val1}. *) val string_of_val1 : ?len:int -> val1 -> string @@ -351,8 +351,8 @@ val create_val1 : val write_val2 : - Bi_outbuf.t -> val2 -> unit - (** Output a JSON value of type {!val2}. *) + Buffer.t -> val2 -> unit + (** Output a JSON value of type {!type:val2}. *) val string_of_val2 : ?len:int -> val2 -> string @@ -378,8 +378,8 @@ val create_val2 : val write_unixtime_list : - Bi_outbuf.t -> unixtime_list -> unit - (** Output a JSON value of type {!unixtime_list}. *) + Buffer.t -> unixtime_list -> unit + (** Output a JSON value of type {!type:unixtime_list}. *) val string_of_unixtime_list : ?len:int -> unixtime_list -> string @@ -399,8 +399,8 @@ val unixtime_list_of_string : val write_date : - Bi_outbuf.t -> date -> unit - (** Output a JSON value of type {!date}. *) + Buffer.t -> date -> unit + (** Output a JSON value of type {!type:date}. *) val string_of_date : ?len:int -> date -> string @@ -420,8 +420,8 @@ val date_of_string : val write_mixed_record : - Bi_outbuf.t -> mixed_record -> unit - (** Output a JSON value of type {!mixed_record}. *) + Buffer.t -> mixed_record -> unit + (** Output a JSON value of type {!type:mixed_record}. *) val string_of_mixed_record : ?len:int -> mixed_record -> string @@ -444,11 +444,11 @@ val create_mixed_record : ?field1: float -> field2: string option -> field3: Int64.t -> - field4: float Atdgen_runtime.Util.ocaml_array -> + field4: float Atdgen_www_runtime.Util.ocaml_array -> ?field5: bool -> ?field6: string -> field7: test_variant -> - field8: string Atdgen_runtime.Util.ocaml_array -> + field8: string Atdgen_www_runtime.Util.ocaml_array -> field9: (int * int * Char.t * int * Int32.t * Int64.t) -> field10: bool -> ?field11: bool -> @@ -460,8 +460,8 @@ val create_mixed_record : val write_mixed : - Bi_outbuf.t -> mixed -> unit - (** Output a JSON value of type {!mixed}. *) + Buffer.t -> mixed -> unit + (** Output a JSON value of type {!type:mixed}. *) val string_of_mixed : ?len:int -> mixed -> string @@ -481,8 +481,8 @@ val mixed_of_string : val write_test : - Bi_outbuf.t -> test -> unit - (** Output a JSON value of type {!test}. *) + Buffer.t -> test -> unit + (** Output a JSON value of type {!type:test}. *) val string_of_test : ?len:int -> test -> string @@ -511,8 +511,8 @@ val create_test : val write_tup : - Bi_outbuf.t -> tup -> unit - (** Output a JSON value of type {!tup}. *) + Buffer.t -> tup -> unit + (** Output a JSON value of type {!type:tup}. *) val string_of_tup : ?len:int -> tup -> string @@ -532,8 +532,8 @@ val tup_of_string : val write_star_rating : - Bi_outbuf.t -> star_rating -> unit - (** Output a JSON value of type {!star_rating}. *) + Buffer.t -> star_rating -> unit + (** Output a JSON value of type {!type:star_rating}. *) val string_of_star_rating : ?len:int -> star_rating -> string @@ -553,12 +553,12 @@ val star_rating_of_string : val write_generic : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a generic -> unit - (** Output a JSON value of type {!generic}. *) + (Buffer.t -> 'a -> unit) -> + Buffer.t -> 'a generic -> unit + (** Output a JSON value of type {!type:generic}. *) val string_of_generic : - (Bi_outbuf.t -> 'a -> unit) -> + (Buffer.t -> 'a -> unit) -> ?len:int -> 'a generic -> string (** Serialize a value of type {!generic} into a JSON string. @@ -583,8 +583,8 @@ val create_generic : val write_specialized : - Bi_outbuf.t -> specialized -> unit - (** Output a JSON value of type {!specialized}. *) + Buffer.t -> specialized -> unit + (** Output a JSON value of type {!type:specialized}. *) val string_of_specialized : ?len:int -> specialized -> string @@ -604,8 +604,8 @@ val specialized_of_string : val write_some_record : - Bi_outbuf.t -> some_record -> unit - (** Output a JSON value of type {!some_record}. *) + Buffer.t -> some_record -> unit + (** Output a JSON value of type {!type:some_record}. *) val string_of_some_record : ?len:int -> some_record -> string @@ -630,8 +630,8 @@ val create_some_record : val write_precision : - Bi_outbuf.t -> precision -> unit - (** Output a JSON value of type {!precision}. *) + Buffer.t -> precision -> unit + (** Output a JSON value of type {!type:precision}. *) val string_of_precision : ?len:int -> precision -> string @@ -658,8 +658,8 @@ val create_precision : val write_p'' : - Bi_outbuf.t -> p'' -> unit - (** Output a JSON value of type {!p''}. *) + Buffer.t -> p'' -> unit + (** Output a JSON value of type {!type:p''}. *) val string_of_p'' : ?len:int -> p'' -> string @@ -679,8 +679,8 @@ val p''_of_string : val write_option_validation : - Bi_outbuf.t -> option_validation -> unit - (** Output a JSON value of type {!option_validation}. *) + Buffer.t -> option_validation -> unit + (** Output a JSON value of type {!type:option_validation}. *) val string_of_option_validation : ?len:int -> option_validation -> string @@ -700,8 +700,8 @@ val option_validation_of_string : val write_no_real_wrap : - Bi_outbuf.t -> no_real_wrap -> unit - (** Output a JSON value of type {!no_real_wrap}. *) + Buffer.t -> no_real_wrap -> unit + (** Output a JSON value of type {!type:no_real_wrap}. *) val string_of_no_real_wrap : ?len:int -> no_real_wrap -> string @@ -721,8 +721,8 @@ val no_real_wrap_of_string : val write_natural : - Bi_outbuf.t -> natural -> unit - (** Output a JSON value of type {!natural}. *) + Buffer.t -> natural -> unit + (** Output a JSON value of type {!type:natural}. *) val string_of_natural : ?len:int -> natural -> string @@ -742,8 +742,8 @@ val natural_of_string : val write_id : - Bi_outbuf.t -> id -> unit - (** Output a JSON value of type {!id}. *) + Buffer.t -> id -> unit + (** Output a JSON value of type {!type:id}. *) val string_of_id : ?len:int -> id -> string @@ -763,8 +763,8 @@ val id_of_string : val write_json_map : - Bi_outbuf.t -> json_map -> unit - (** Output a JSON value of type {!json_map}. *) + Buffer.t -> json_map -> unit + (** Output a JSON value of type {!type:json_map}. *) val string_of_json_map : ?len:int -> json_map -> string @@ -784,8 +784,8 @@ val json_map_of_string : val write_intopt : - Bi_outbuf.t -> intopt -> unit - (** Output a JSON value of type {!intopt}. *) + Buffer.t -> intopt -> unit + (** Output a JSON value of type {!type:intopt}. *) val string_of_intopt : ?len:int -> intopt -> string @@ -805,8 +805,8 @@ val intopt_of_string : val write_int_assoc_list : - Bi_outbuf.t -> int_assoc_list -> unit - (** Output a JSON value of type {!int_assoc_list}. *) + Buffer.t -> int_assoc_list -> unit + (** Output a JSON value of type {!type:int_assoc_list}. *) val string_of_int_assoc_list : ?len:int -> int_assoc_list -> string @@ -826,8 +826,8 @@ val int_assoc_list_of_string : val write_int_assoc_array : - Bi_outbuf.t -> int_assoc_array -> unit - (** Output a JSON value of type {!int_assoc_array}. *) + Buffer.t -> int_assoc_array -> unit + (** Output a JSON value of type {!type:int_assoc_array}. *) val string_of_int_assoc_array : ?len:int -> int_assoc_array -> string @@ -847,8 +847,8 @@ val int_assoc_array_of_string : val write_int8 : - Bi_outbuf.t -> int8 -> unit - (** Output a JSON value of type {!int8}. *) + Buffer.t -> int8 -> unit + (** Output a JSON value of type {!type:int8}. *) val string_of_int8 : ?len:int -> int8 -> string @@ -868,8 +868,8 @@ val int8_of_string : val write_int64 : - Bi_outbuf.t -> int64 -> unit - (** Output a JSON value of type {!int64}. *) + Buffer.t -> int64 -> unit + (** Output a JSON value of type {!type:int64}. *) val string_of_int64 : ?len:int -> int64 -> string @@ -889,8 +889,8 @@ val int64_of_string : val write_int32 : - Bi_outbuf.t -> int32 -> unit - (** Output a JSON value of type {!int32}. *) + Buffer.t -> int32 -> unit + (** Output a JSON value of type {!type:int32}. *) val string_of_int32 : ?len:int -> int32 -> string @@ -910,8 +910,8 @@ val int32_of_string : val write_hello : - Bi_outbuf.t -> hello -> unit - (** Output a JSON value of type {!hello}. *) + Buffer.t -> hello -> unit + (** Output a JSON value of type {!type:hello}. *) val string_of_hello : ?len:int -> hello -> string @@ -931,8 +931,8 @@ val hello_of_string : val write_floats : - Bi_outbuf.t -> floats -> unit - (** Output a JSON value of type {!floats}. *) + Buffer.t -> floats -> unit + (** Output a JSON value of type {!type:floats}. *) val string_of_floats : ?len:int -> floats -> string @@ -958,8 +958,8 @@ val create_floats : val write_extended_tuple : - Bi_outbuf.t -> extended_tuple -> unit - (** Output a JSON value of type {!extended_tuple}. *) + Buffer.t -> extended_tuple -> unit + (** Output a JSON value of type {!type:extended_tuple}. *) val string_of_extended_tuple : ?len:int -> extended_tuple -> string @@ -979,8 +979,8 @@ val extended_tuple_of_string : val write_extended : - Bi_outbuf.t -> extended -> unit - (** Output a JSON value of type {!extended}. *) + Buffer.t -> extended -> unit + (** Output a JSON value of type {!type:extended}. *) val string_of_extended : ?len:int -> extended -> string @@ -1010,8 +1010,8 @@ val create_extended : val write_even_natural : - Bi_outbuf.t -> even_natural -> unit - (** Output a JSON value of type {!even_natural}. *) + Buffer.t -> even_natural -> unit + (** Output a JSON value of type {!type:even_natural}. *) val string_of_even_natural : ?len:int -> even_natural -> string @@ -1031,8 +1031,8 @@ val even_natural_of_string : val write_def : - Bi_outbuf.t -> def -> unit - (** Output a JSON value of type {!def}. *) + Buffer.t -> def -> unit + (** Output a JSON value of type {!type:def}. *) val string_of_def : ?len:int -> def -> string @@ -1052,8 +1052,8 @@ val def_of_string : val write_char : - Bi_outbuf.t -> char -> unit - (** Output a JSON value of type {!char}. *) + Buffer.t -> char -> unit + (** Output a JSON value of type {!type:char}. *) val string_of_char : ?len:int -> char -> string @@ -1073,8 +1073,8 @@ val char_of_string : val write_base_tuple : - Bi_outbuf.t -> base_tuple -> unit - (** Output a JSON value of type {!base_tuple}. *) + Buffer.t -> base_tuple -> unit + (** Output a JSON value of type {!type:base_tuple}. *) val string_of_base_tuple : ?len:int -> base_tuple -> string @@ -1094,8 +1094,8 @@ val base_tuple_of_string : val write_base : - Bi_outbuf.t -> base -> unit - (** Output a JSON value of type {!base}. *) + Buffer.t -> base -> unit + (** Output a JSON value of type {!type:base}. *) val string_of_base : ?len:int -> base -> string @@ -1121,12 +1121,12 @@ val create_base : val write_array : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a array -> unit - (** Output a JSON value of type {!array}. *) + (Buffer.t -> 'a -> unit) -> + Buffer.t -> 'a array -> unit + (** Output a JSON value of type {!type:array}. *) val string_of_array : - (Bi_outbuf.t -> 'a -> unit) -> + (Buffer.t -> 'a -> unit) -> ?len:int -> 'a array -> string (** Serialize a value of type {!array} into a JSON string. @@ -1146,12 +1146,12 @@ val array_of_string : val write_abs3 : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a abs3 -> unit - (** Output a JSON value of type {!abs3}. *) + (Buffer.t -> 'a -> unit) -> + Buffer.t -> 'a abs3 -> unit + (** Output a JSON value of type {!type:abs3}. *) val string_of_abs3 : - (Bi_outbuf.t -> 'a -> unit) -> + (Buffer.t -> 'a -> unit) -> ?len:int -> 'a abs3 -> string (** Serialize a value of type {!abs3} into a JSON string. @@ -1171,12 +1171,12 @@ val abs3_of_string : val write_abs2 : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a abs2 -> unit - (** Output a JSON value of type {!abs2}. *) + (Buffer.t -> 'a -> unit) -> + Buffer.t -> 'a abs2 -> unit + (** Output a JSON value of type {!type:abs2}. *) val string_of_abs2 : - (Bi_outbuf.t -> 'a -> unit) -> + (Buffer.t -> 'a -> unit) -> ?len:int -> 'a abs2 -> string (** Serialize a value of type {!abs2} into a JSON string. @@ -1196,12 +1196,12 @@ val abs2_of_string : val write_abs1 : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a abs1 -> unit - (** Output a JSON value of type {!abs1}. *) + (Buffer.t -> 'a -> unit) -> + Buffer.t -> 'a abs1 -> unit + (** Output a JSON value of type {!type:abs1}. *) val string_of_abs1 : - (Bi_outbuf.t -> 'a -> unit) -> + (Buffer.t -> 'a -> unit) -> ?len:int -> 'a abs1 -> string (** Serialize a value of type {!abs1} into a JSON string. diff --git a/atdgen/test/testv.expected.ml b/atdgen/test/testv.expected.ml index 668585e..e7e63ca 100644 --- a/atdgen/test/testv.expected.ml +++ b/atdgen/test/testv.expected.ml @@ -33,11 +33,11 @@ type mixed_record = Test.mixed_record = { field1: float option; field2: string option; field3: Int64.t; - field4: float Atdgen_runtime.Util.ocaml_array; + field4: float Atdgen_www_runtime.Util.ocaml_array; field5: bool option; field6: string option; field7: test_variant; - field8: string Atdgen_runtime.Util.ocaml_array; + field8: string Atdgen_www_runtime.Util.ocaml_array; field9: (int * int * Char.t * int * Int32.t * Int64.t); field10: bool; field11: bool; @@ -153,7 +153,7 @@ type 'a abs2 = 'a Test.abs2 type 'a abs1 = 'a Test.abs1 let validate__19 validate__a = ( - Atdgen_runtime.Ov_run.validate_list ( + Atdgen_www_runtime.Ov_run.validate_list ( validate__a ) ) @@ -174,7 +174,7 @@ let rec validate_p = ( fun path x -> match ( fun path x -> match x with - `A -> Some (Atdgen_runtime.Util.Validation.error path) + `A -> Some (Atdgen_www_runtime.Util.Validation.error path) | _ -> None ) path x with | Some _ as err -> err | None -> @@ -200,7 +200,7 @@ and validate_r : _ -> r -> _ = ( ) (`Field "c" :: path) x.c ) let rec validate__20 validate__a validate__b path x = ( - Atdgen_runtime.Ov_run.validate_option ( + Atdgen_www_runtime.Ov_run.validate_option ( validate_poly validate__a validate__b ) ) path x @@ -232,7 +232,7 @@ let validate_validated_string_check = ( if (fun s -> s = "abc") x then None else - Some (Atdgen_runtime.Util.Validation.error ~msg path) + Some (Atdgen_www_runtime.Util.Validation.error ~msg path) ) let validate__31 = ( (fun path x -> @@ -241,16 +241,16 @@ let validate__31 = ( if (fun l -> true) x then None else - Some (Atdgen_runtime.Util.Validation.error ~msg path) ) path x with + Some (Atdgen_www_runtime.Util.Validation.error ~msg path) ) path x with | Some _ as err -> err | None -> ( - Atdgen_runtime.Ov_run.validate_list ( + Atdgen_www_runtime.Ov_run.validate_list ( fun path x -> let msg = "Failed check by fun s -> true" in if (fun s -> true) x then None else - Some (Atdgen_runtime.Util.Validation.error ~msg path) + Some (Atdgen_www_runtime.Util.Validation.error ~msg path) ) ) path x ) @@ -262,11 +262,11 @@ let validate_validate_me = ( let validate_val1 : _ -> val1 -> _ = ( fun path x -> ( - fun path _ -> Some (Atdgen_runtime.Util.Validation.error path) + fun path _ -> Some (Atdgen_www_runtime.Util.Validation.error path) ) (`Field "val1_x" :: path) x.val1_x ) let validate__16 = ( - Atdgen_runtime.Ov_run.validate_option ( + Atdgen_www_runtime.Ov_run.validate_option ( validate_val1 ) ) @@ -349,7 +349,7 @@ let validate_star_rating = ( if (fun x -> x >= 1 && x <= 5) x then None else - Some (Atdgen_runtime.Util.Validation.error ~msg path) + Some (Atdgen_www_runtime.Util.Validation.error ~msg path) ) let validate__30 : _ -> _ generic -> _ = ( fun _ _ -> None @@ -370,8 +370,8 @@ let validate_p'' = ( validate__1 ) let validate__18 = ( - Atdgen_runtime.Ov_run.validate_option ( - fun path _ -> Some (Atdgen_runtime.Util.Validation.error path) + Atdgen_www_runtime.Ov_run.validate_option ( + fun path _ -> Some (Atdgen_www_runtime.Util.Validation.error path) ) ) let validate_option_validation = ( @@ -399,7 +399,7 @@ let validate_id = ( validate__24 ) let validate__25 = ( - Atdgen_runtime.Ov_run.validate_list ( + Atdgen_www_runtime.Ov_run.validate_list ( fun path x -> (let x, _ = x in ( @@ -454,12 +454,12 @@ let validate_extended : _ -> extended -> _ = ( fun path x -> match ( fun path x -> if x.b0x >= 0 then None - else Some (Atdgen_runtime.Util.Validation.error path) ) path x with + else Some (Atdgen_www_runtime.Util.Validation.error path) ) path x with | Some _ as err -> err | None -> ( fun path x -> - if x = false then None else Some (Atdgen_runtime.Util.Validation.error path) + if x = false then None else Some (Atdgen_www_runtime.Util.Validation.error path) ) (`Field "b1x" :: path) x.b1x ) let validate__27 = ( @@ -472,13 +472,13 @@ let validate_char = ( (fun _ _ -> None) ) let validate_base_tuple = ( - fun path (i, f) -> if float i < f then None else Some (Atdgen_runtime.Util.Validation.error ~msg:"i < f" path) + fun path (i, f) -> if float i < f then None else Some (Atdgen_www_runtime.Util.Validation.error ~msg:"i < f" path) ) let validate_base : _ -> base -> _ = ( fun _ _ -> None ) let validate__23 validate__a = ( - Atdgen_runtime.Ov_run.validate_array ( + Atdgen_www_runtime.Ov_run.validate_array ( validate__a ) ) diff --git a/atdgen/test/testv.expected.mli b/atdgen/test/testv.expected.mli index 40444da..485da1d 100644 --- a/atdgen/test/testv.expected.mli +++ b/atdgen/test/testv.expected.mli @@ -33,11 +33,11 @@ type mixed_record = Test.mixed_record = { field1: float option; field2: string option; field3: Int64.t; - field4: float Atdgen_runtime.Util.ocaml_array; + field4: float Atdgen_www_runtime.Util.ocaml_array; field5: bool option; field6: string option; field7: test_variant; - field8: string Atdgen_runtime.Util.ocaml_array; + field8: string Atdgen_www_runtime.Util.ocaml_array; field9: (int * int * Char.t * int * Int32.t * Int64.t); field10: bool; field11: bool; @@ -153,7 +153,7 @@ type 'a abs2 = 'a Test.abs2 type 'a abs1 = 'a Test.abs1 val validate_test_variant : - Atdgen_runtime.Util.Validation.path -> test_variant -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> test_variant -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!test_variant}. *) val create_poly : @@ -163,18 +163,18 @@ val create_poly : (** Create a record of type {!poly}. *) val validate_poly : - (Atdgen_runtime.Util.Validation.path -> 'x -> Atdgen_runtime.Util.Validation.error option) -> - (Atdgen_runtime.Util.Validation.path -> 'y -> Atdgen_runtime.Util.Validation.error option) -> - Atdgen_runtime.Util.Validation.path -> ('x, 'y) poly -> Atdgen_runtime.Util.Validation.error option + (Atdgen_www_runtime.Util.Validation.path -> 'x -> Atdgen_www_runtime.Util.Validation.error option) -> + (Atdgen_www_runtime.Util.Validation.path -> 'y -> Atdgen_www_runtime.Util.Validation.error option) -> + Atdgen_www_runtime.Util.Validation.path -> ('x, 'y) poly -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!poly}. *) val validate_p' : - (Atdgen_runtime.Util.Validation.path -> 'a -> Atdgen_runtime.Util.Validation.error option) -> - Atdgen_runtime.Util.Validation.path -> 'a p' -> Atdgen_runtime.Util.Validation.error option + (Atdgen_www_runtime.Util.Validation.path -> 'a -> Atdgen_www_runtime.Util.Validation.error option) -> + Atdgen_www_runtime.Util.Validation.path -> 'a p' -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!p'}. *) val validate_p : - Atdgen_runtime.Util.Validation.path -> p -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> p -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!p}. *) val create_r : @@ -185,15 +185,15 @@ val create_r : (** Create a record of type {!r}. *) val validate_r : - Atdgen_runtime.Util.Validation.path -> r -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> r -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!r}. *) val validate_validated_string_check : - Atdgen_runtime.Util.Validation.path -> validated_string_check -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> validated_string_check -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!validated_string_check}. *) val validate_validate_me : - Atdgen_runtime.Util.Validation.path -> validate_me -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> validate_me -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!validate_me}. *) val create_val1 : @@ -202,7 +202,7 @@ val create_val1 : (** Create a record of type {!val1}. *) val validate_val1 : - Atdgen_runtime.Util.Validation.path -> val1 -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> val1 -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!val1}. *) val create_val2 : @@ -212,15 +212,15 @@ val create_val2 : (** Create a record of type {!val2}. *) val validate_val2 : - Atdgen_runtime.Util.Validation.path -> val2 -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> val2 -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!val2}. *) val validate_unixtime_list : - Atdgen_runtime.Util.Validation.path -> unixtime_list -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> unixtime_list -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!unixtime_list}. *) val validate_date : - Atdgen_runtime.Util.Validation.path -> date -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> date -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!date}. *) val create_mixed_record : @@ -228,11 +228,11 @@ val create_mixed_record : ?field1: float -> field2: string option -> field3: Int64.t -> - field4: float Atdgen_runtime.Util.ocaml_array -> + field4: float Atdgen_www_runtime.Util.ocaml_array -> ?field5: bool -> ?field6: string -> field7: test_variant -> - field8: string Atdgen_runtime.Util.ocaml_array -> + field8: string Atdgen_www_runtime.Util.ocaml_array -> field9: (int * int * Char.t * int * Int32.t * Int64.t) -> field10: bool -> ?field11: bool -> @@ -243,11 +243,11 @@ val create_mixed_record : (** Create a record of type {!mixed_record}. *) val validate_mixed_record : - Atdgen_runtime.Util.Validation.path -> mixed_record -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> mixed_record -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!mixed_record}. *) val validate_mixed : - Atdgen_runtime.Util.Validation.path -> mixed -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> mixed -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!mixed}. *) val create_test : @@ -260,15 +260,15 @@ val create_test : (** Create a record of type {!test}. *) val validate_test : - Atdgen_runtime.Util.Validation.path -> test -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> test -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!test}. *) val validate_tup : - Atdgen_runtime.Util.Validation.path -> tup -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> tup -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!tup}. *) val validate_star_rating : - Atdgen_runtime.Util.Validation.path -> star_rating -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> star_rating -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!star_rating}. *) val create_generic : @@ -277,12 +277,12 @@ val create_generic : (** Create a record of type {!generic}. *) val validate_generic : - (Atdgen_runtime.Util.Validation.path -> 'a -> Atdgen_runtime.Util.Validation.error option) -> - Atdgen_runtime.Util.Validation.path -> 'a generic -> Atdgen_runtime.Util.Validation.error option + (Atdgen_www_runtime.Util.Validation.path -> 'a -> Atdgen_www_runtime.Util.Validation.error option) -> + Atdgen_www_runtime.Util.Validation.path -> 'a generic -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!generic}. *) val validate_specialized : - Atdgen_runtime.Util.Validation.path -> specialized -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> specialized -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!specialized}. *) val create_some_record : @@ -291,7 +291,7 @@ val create_some_record : (** Create a record of type {!some_record}. *) val validate_some_record : - Atdgen_runtime.Util.Validation.path -> some_record -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> some_record -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!some_record}. *) val create_precision : @@ -302,59 +302,59 @@ val create_precision : (** Create a record of type {!precision}. *) val validate_precision : - Atdgen_runtime.Util.Validation.path -> precision -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> precision -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!precision}. *) val validate_p'' : - Atdgen_runtime.Util.Validation.path -> p'' -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> p'' -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!p''}. *) val validate_option_validation : - Atdgen_runtime.Util.Validation.path -> option_validation -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> option_validation -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!option_validation}. *) val validate_no_real_wrap : - Atdgen_runtime.Util.Validation.path -> no_real_wrap -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> no_real_wrap -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!no_real_wrap}. *) val validate_natural : - Atdgen_runtime.Util.Validation.path -> natural -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> natural -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!natural}. *) val validate_id : - Atdgen_runtime.Util.Validation.path -> id -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> id -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!id}. *) val validate_json_map : - Atdgen_runtime.Util.Validation.path -> json_map -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> json_map -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!json_map}. *) val validate_intopt : - Atdgen_runtime.Util.Validation.path -> intopt -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> intopt -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!intopt}. *) val validate_int_assoc_list : - Atdgen_runtime.Util.Validation.path -> int_assoc_list -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> int_assoc_list -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!int_assoc_list}. *) val validate_int_assoc_array : - Atdgen_runtime.Util.Validation.path -> int_assoc_array -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> int_assoc_array -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!int_assoc_array}. *) val validate_int8 : - Atdgen_runtime.Util.Validation.path -> int8 -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> int8 -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!int8}. *) val validate_int64 : - Atdgen_runtime.Util.Validation.path -> int64 -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> int64 -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!int64}. *) val validate_int32 : - Atdgen_runtime.Util.Validation.path -> int32 -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> int32 -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!int32}. *) val validate_hello : - Atdgen_runtime.Util.Validation.path -> hello -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> hello -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!hello}. *) val create_floats : @@ -364,11 +364,11 @@ val create_floats : (** Create a record of type {!floats}. *) val validate_floats : - Atdgen_runtime.Util.Validation.path -> floats -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> floats -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!floats}. *) val validate_extended_tuple : - Atdgen_runtime.Util.Validation.path -> extended_tuple -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> extended_tuple -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!extended_tuple}. *) val create_extended : @@ -382,19 +382,19 @@ val create_extended : (** Create a record of type {!extended}. *) val validate_extended : - Atdgen_runtime.Util.Validation.path -> extended -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> extended -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!extended}. *) val validate_even_natural : - Atdgen_runtime.Util.Validation.path -> even_natural -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> even_natural -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!even_natural}. *) val validate_char : - Atdgen_runtime.Util.Validation.path -> char -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> char -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!char}. *) val validate_base_tuple : - Atdgen_runtime.Util.Validation.path -> base_tuple -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> base_tuple -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!base_tuple}. *) val create_base : @@ -404,26 +404,26 @@ val create_base : (** Create a record of type {!base}. *) val validate_base : - Atdgen_runtime.Util.Validation.path -> base -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> base -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!base}. *) val validate_array : - (Atdgen_runtime.Util.Validation.path -> 'a -> Atdgen_runtime.Util.Validation.error option) -> - Atdgen_runtime.Util.Validation.path -> 'a array -> Atdgen_runtime.Util.Validation.error option + (Atdgen_www_runtime.Util.Validation.path -> 'a -> Atdgen_www_runtime.Util.Validation.error option) -> + Atdgen_www_runtime.Util.Validation.path -> 'a array -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!array}. *) val validate_abs3 : - (Atdgen_runtime.Util.Validation.path -> 'a -> Atdgen_runtime.Util.Validation.error option) -> - Atdgen_runtime.Util.Validation.path -> 'a abs3 -> Atdgen_runtime.Util.Validation.error option + (Atdgen_www_runtime.Util.Validation.path -> 'a -> Atdgen_www_runtime.Util.Validation.error option) -> + Atdgen_www_runtime.Util.Validation.path -> 'a abs3 -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!abs3}. *) val validate_abs2 : - (Atdgen_runtime.Util.Validation.path -> 'a -> Atdgen_runtime.Util.Validation.error option) -> - Atdgen_runtime.Util.Validation.path -> 'a abs2 -> Atdgen_runtime.Util.Validation.error option + (Atdgen_www_runtime.Util.Validation.path -> 'a -> Atdgen_www_runtime.Util.Validation.error option) -> + Atdgen_www_runtime.Util.Validation.path -> 'a abs2 -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!abs2}. *) val validate_abs1 : - (Atdgen_runtime.Util.Validation.path -> 'a -> Atdgen_runtime.Util.Validation.error option) -> - Atdgen_runtime.Util.Validation.path -> 'a abs1 -> Atdgen_runtime.Util.Validation.error option + (Atdgen_www_runtime.Util.Validation.path -> 'a -> Atdgen_www_runtime.Util.Validation.error option) -> + Atdgen_www_runtime.Util.Validation.path -> 'a abs1 -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!abs1}. *) diff --git a/atdj.opam b/atdj.opam index e49113d..af8e754 100644 --- a/atdj.opam +++ b/atdj.opam @@ -37,7 +37,7 @@ license: "MIT" homepage: "https://github.com/ahrefs/atd" bug-reports: "https://github.com/ahrefs/atd/issues" depends: [ - "ocaml" {>= "4.02"} + "ocaml" {>= "4.03"} "dune" {>= "1.11"} "atd" {>= "2.0.0"} "re" diff --git a/atds.opam b/atds.opam index 7bedd25..f031d48 100644 --- a/atds.opam +++ b/atds.opam @@ -23,7 +23,7 @@ license: "MIT" homepage: "https://github.com/ahrefs/atd" bug-reports: "https://github.com/ahrefs/atd/issues" depends: [ - "ocaml" {>= "4.02"} + "ocaml" {>= "4.03"} "dune" {>= "1.11"} "atd" {>= "2.0.0"} "odoc" {with-doc} diff --git a/doc/atdgen.rst b/doc/atdgen.rst index 7b381c2..b29e711 100644 --- a/doc/atdgen.rst +++ b/doc/atdgen.rst @@ -383,7 +383,7 @@ showing how the user-specified validators are used: } val validate_gender : - Atdgen_runtime.Util.Validation.path -> gender -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> gender -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!gender}. *) val create_date : @@ -394,7 +394,7 @@ showing how the user-specified validators are used: (** Create a record of type {!date}. *) val validate_date : - Atdgen_runtime.Util.Validation.path -> date -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> date -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!date}. *) val create_profile : @@ -410,7 +410,7 @@ showing how the user-specified validators are used: (** Create a record of type {!profile}. *) val validate_profile : - Atdgen_runtime.Util.Validation.path -> profile -> Atdgen_runtime.Util.Validation.error option + Atdgen_www_runtime.Util.Validation.path -> profile -> Atdgen_www_runtime.Util.Validation.error option (** Validate a value of type {!profile}. *) Default type mapping @@ -740,7 +740,7 @@ as to make them compatible with ATD. The programmer must provide an OCaml module that provides converters between the original json representation and the ATD-compatible representation. The signature of the user-provided module must be equal to -``Atdgen_runtime.Json_adapter.S``, which is: +``Atdgen_www_runtime.Json_adapter.S``, which is: .. code:: ocaml @@ -758,7 +758,7 @@ the yojson library. Position: on a variant type or on a record type. Value: an OCaml module identifier. Note that -``Atdgen_runtime.Json_adapter`` provides a few modules and functors that +``Atdgen_www_runtime.Json_adapter`` provides a few modules and functors that are ready to use. Users are however encouraged to write their own to suit their needs. @@ -769,7 +769,7 @@ Sample ATD definitions: type document = [ | Image of image | Text of text - ] + ] type image = { url: string; @@ -1359,7 +1359,7 @@ Semantics: ``atdgen -v`` produces for each type named *t* a function .. code:: ocaml - val validate_t : Atdgen_runtime.Util.Validation.path -> t -> Atdgen_runtime.Util.Validation.error option + val validate_t : Atdgen_www_runtime.Util.Validation.path -> t -> Atdgen_www_runtime.Util.Validation.error option Such a function returns ``None`` if and only if the value and all of its subnodes pass all the validators specified by annotations of the form @@ -1390,7 +1390,7 @@ containing object first (``Point.validate``) and continues on its fields | None -> () | Some e -> Printf.eprintf "Error: %s\n%!" - (Atdgen_runtime.Util.Validation.string_of_error e) + (Atdgen_www_runtime.Util.Validation.string_of_error e) The above code prints the following error message: @@ -1417,7 +1417,7 @@ Semantics: ``atdgen -v`` produces for each type named *t* a function .. code:: ocaml - val validate_t : Atdgen_runtime.Util.Validation.path -> t -> Atdgen_runtime.Util.Validation.error option + val validate_t : Atdgen_www_runtime.Util.Validation.path -> t -> Atdgen_www_runtime.Util.Validation.error option Such a function returns ``None`` if and only if the value and all of its subnodes pass all the validators specified by annotations of the form @@ -1433,7 +1433,7 @@ Example: if x > 0 then None else Some ( - Atdgen_runtime.Util.Validation.error + Atdgen_www_runtime.Util.Validation.error ~msg: (\"Not a positive integer: \" ^ string_of_int x) path ) @@ -1455,7 +1455,7 @@ The following user code | None -> () | Some e -> Printf.eprintf "Error: %s\n%!" - (Atdgen_runtime.Util.Validation.string_of_error e) + (Atdgen_www_runtime.Util.Validation.string_of_error e) results in printing: diff --git a/doc/tutorial-data/config-file/config.ml b/doc/tutorial-data/config-file/config.ml index 8881e72..c66fee2 100644 --- a/doc/tutorial-data/config-file/config.ml +++ b/doc/tutorial-data/config-file/config.ml @@ -34,7 +34,7 @@ let validate fname = let x = try (* Read config data structure from JSON file *) - let x = Atdgen_runtime.Util.Json.from_file Config_j.read_config fname in + let x = Atdgen_www_runtime.Util.Json.from_file Config_j.read_config fname in (* Call the validators specified by *) if not (Config_v.validate_config x) then failwith "Some fields are invalid" diff --git a/doc/tutorial-data/inspect-biniou/tree.ml b/doc/tutorial-data/inspect-biniou/tree.ml index c08d70b..bd82152 100644 --- a/doc/tutorial-data/inspect-biniou/tree.ml +++ b/doc/tutorial-data/inspect-biniou/tree.ml @@ -15,7 +15,7 @@ let tree : Tree_t.tree = let () = (* write sample value to file *) let fname = "tree.dat" in - Atdgen_runtime.Util.Biniou.to_file Tree_b.write_tree fname tree; + Atdgen_www_runtime.Util.Biniou.to_file Tree_b.write_tree fname tree; (* write sample value to string *) let s = Tree_b.string_of_tree tree in diff --git a/doc/tutorial-data/modularity/main.ml b/doc/tutorial-data/modularity/main.ml index c799ba8..03f4633 100644 --- a/doc/tutorial-data/modularity/main.ml +++ b/doc/tutorial-data/modularity/main.ml @@ -7,5 +7,5 @@ let v = { } let () = - Atdgen_runtime.Util.Json.to_channel Part3_j.write_t3 stdout v; + Atdgen_www_runtime.Util.Json.to_channel Part3_j.write_t3 stdout v; print_newline () diff --git a/doc/tutorial.rst b/doc/tutorial.rst index 91edbcd..f4a4b8f 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -250,7 +250,7 @@ This is our OCaml program (file ``tree.ml``): let () = (* write sample value to file *) let fname = "tree.dat" in - Atdgen_runtime.Util.Biniou.to_file Tree_b.write_tree fname tree; + Atdgen_www_runtime.Util.Biniou.to_file Tree_b.write_tree fname tree; (* write sample value to string *) let s = Tree_b.string_of_tree tree in @@ -823,7 +823,7 @@ files. The example below is self-explanatory. } let () = - Atdgen_runtime.Util.Json.to_channel Part3_j.write_t3 stdout v; + Atdgen_www_runtime.Util.Json.to_channel Part3_j.write_t3 stdout v; print_newline () Output: @@ -1022,7 +1022,7 @@ program called `config`: let x = try (* Read config data structure from JSON file *) - let x = Atdgen_runtime.Util.Json.from_file Config_j.read_config fname in + let x = Atdgen_www_runtime.Util.Json.from_file Config_j.read_config fname in (* Call the validators specified by *) if not (Config_v.validate_config x) then failwith "Some fields are invalid" @@ -1344,7 +1344,7 @@ Test the example with your favorite OCaml toplevel (``ocaml`` or ``utop``): # #use "topfind";; # #require "atdgen";; # #load "untypable.cma";; - # Atdgen_runtime.Util.Json.from_channel Untypable_j.read_obj_list stdin;; + # Atdgen_www_runtime.Util.Json.from_channel Untypable_j.read_obj_list stdin;; [ { "label": "flower", diff --git a/dune-project b/dune-project index 0191a34..3553d14 100644 --- a/dune-project +++ b/dune-project @@ -30,7 +30,7 @@ (package (name atd) (depends - (ocaml (>= 4.02)) + (ocaml (>= 4.03)) (dune (>= 1.11)) menhir easy-format @@ -43,12 +43,12 @@ property of supporting annotations that allow a good fit with a variety of data formats. ")) (package - (name atdgen) + (name atdgen-www) (depends - (ocaml (>= 4.02)) + (ocaml (>= 4.03)) (dune (>= 1.11)) (atd (>= 2.0.0)) - (atdgen-runtime (>= 2.0.0)) + (atdgen-www-runtime (>= 2.0.0)) (atdgen-codec-runtime :with-test) (biniou (>= 1.0.6)) (yojson (>= 1.7.0)) @@ -67,15 +67,14 @@ encouraged to use Atdgen directly and to write tools that may reuse part of Atdgen’s source code.")) (package - (name atdgen-runtime) - (synopsis "Runtime library for code generated by atdgen") + (name atdgen-www-runtime) + (synopsis "Runtime library for code generated by atdgen-www") (description "\ -This package should be used only in conjunction with the stdgen code +This package should be used only in conjunction with the atdgen-www code generator") (depends - (ocaml (>= 4.02)) - (dune (>= 1.11)) - (yojson (>= 1.7.0)) + (ocaml (>= 4.08)) + (yojson (>= 2.0.1)) (biniou (>= 1.0.6)) (odoc :with-doc))) @@ -98,7 +97,7 @@ specification. - Details such as optional fields and their associated default values are automatically handled") (depends - (ocaml (>= 4.02)) + (ocaml (>= 4.03)) (dune (>= 1.11)) (atd (>= 2.0.0)) re @@ -109,7 +108,7 @@ automatically handled") (synopsis "ATD Code generator for Scala") (description "ATD Code generator for Scala") (depends - (ocaml (>= 4.02)) + (ocaml (>= 4.03)) (dune (>= 1.11)) (atd (>= 2.0.0)) (odoc :with-doc))) @@ -121,5 +120,5 @@ automatically handled") This library contains the types that are used by atdgen's bucklescript backend") (depends - (ocaml (>= 4.02)) + (ocaml (>= 4.03)) (odoc :with-doc)))