diff --git a/CHANGES.md b/CHANGES.md index 625c1238..1fb43b82 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,5 @@ +* atdgen: use Yojson 2.0 API (#299) + 2.9.1 (2022-06-10) ------------------ diff --git a/atdgen-runtime.opam b/atdgen-runtime.opam index c53626d2..4c79e0e9 100644 --- a/atdgen-runtime.opam +++ b/atdgen-runtime.opam @@ -65,9 +65,8 @@ bug-reports: "https://github.com/ahrefs/atd/issues" depends: [ "dune" {>= "2.8"} "ocaml" {>= "4.08"} - "yojson" {>= "1.7.0" & < "2.0.0"} + "yojson" {>= "2.0.1"} "biniou" {>= "1.0.6"} - "camlp-streams" "odoc" {with-doc} ] dev-repo: "git+https://github.com/ahrefs/atd.git" diff --git a/atdgen-runtime/src/dune b/atdgen-runtime/src/dune index 32863419..d6d09f24 100644 --- a/atdgen-runtime/src/dune +++ b/atdgen-runtime/src/dune @@ -1,4 +1,4 @@ (library (name atdgen_runtime) (public_name atdgen-runtime) - (libraries biniou yojson camlp-streams)) + (libraries biniou yojson)) diff --git a/atdgen-runtime/src/oj_run.ml b/atdgen-runtime/src/oj_run.ml index 9eb95da8..daa76172 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,67 +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_char ob '"'; - Bi_outbuf.add_string ob (Int64.to_string x); - Bi_outbuf.add_char ob '"' + 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 @@ -120,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" @@ -235,12 +235,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' (* Checking at runtime that our assumptions on unspecified compiler behavior diff --git a/atdgen-runtime/src/oj_run.mli b/atdgen-runtime/src/oj_run.mli index dac1a635..950b793d 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/util.ml b/atdgen-runtime/src/util.ml index 6d762df8..43bd320c 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 0d529e4a..30c6ab3a 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"]. diff --git a/atdgen/src/oj_emit.ml b/atdgen/src/oj_emit.ml index 294e19b6..f481ec42 100644 --- a/atdgen/src/oj_emit.ml +++ b/atdgen/src/oj_emit.ml @@ -43,7 +43,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 @@ -58,7 +58,7 @@ let make_ocaml_json_intf ~with_create buf deref defs = in bprintf buf "\ val write_%s :%s - Bi_outbuf.t -> %s -> unit + Buffer.t -> %s -> unit (** Output a JSON value of type {!type:%s}. *) " @@ -322,7 +322,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 '[', ']' @@ -331,9 +331,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); ] ] @@ -415,7 +415,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))) ] @@ -436,12 +436,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); ] ] @@ -456,7 +456,7 @@ and make_record_writer p a record_kind = ]; Line "else"; Block [ - Line "Bi_outbuf.add_char ob ',';"; + Line "Buffer.add_char ob ',';"; ]; ] in @@ -467,7 +467,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 = @@ -507,10 +507,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 = @@ -1200,9 +1200,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/test/bucklescript/bucklespec_j.expected.ml b/atdgen/test/bucklescript/bucklespec_j.expected.ml index 989e229e..34053f14 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; @@ -262,28 +262,28 @@ let rec write__5 ob x = ( ) ) 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 ( read_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; @@ -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; @@ -481,9 +481,9 @@ 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 ) @@ -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; @@ -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; @@ -661,9 +661,9 @@ let write__6 = ( ) ) 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 @@ -675,23 +675,23 @@ 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; @@ -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; @@ -901,9 +901,9 @@ 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 = ( @@ -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; @@ -1141,9 +1141,9 @@ let write__4 = ( ) ) 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 ( 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; @@ -1375,24 +1375,24 @@ 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; @@ -1441,23 +1441,23 @@ 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; @@ -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; @@ -1639,13 +1639,13 @@ 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; @@ -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; @@ -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; @@ -2102,9 +2102,9 @@ let write__1 write__a write__b = ( ) ) 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 ( 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,9 +2128,9 @@ 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 ) @@ -2138,13 +2138,13 @@ 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; @@ -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; @@ -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; @@ -2600,23 +2600,23 @@ let write_adapted = ( 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 ( fun p lb -> diff --git a/atdgen/test/test2j.expected.ml b/atdgen/test/test2j.expected.ml index 18f4ddae..950ab49b 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,9 +20,9 @@ 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 ) @@ -32,9 +32,9 @@ 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 ) @@ -46,9 +46,9 @@ let write__3 = ( ) ) 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; @@ -101,9 +101,9 @@ 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 ) @@ -111,13 +111,13 @@ 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; @@ -256,9 +256,9 @@ 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 ) @@ -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 edeedb92..1ce68407 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 + (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 {!type:poly} into a JSON string. @@ -34,7 +34,7 @@ val poly_of_string : val write_poly_int2 : - Bi_outbuf.t -> poly_int2 -> unit + Buffer.t -> poly_int2 -> unit (** Output a JSON value of type {!type:poly_int2}. *) val string_of_poly_int2 : @@ -55,7 +55,7 @@ val poly_int2_of_string : val write_test2 : - Bi_outbuf.t -> test2 -> unit + Buffer.t -> test2 -> unit (** Output a JSON value of type {!type:test2}. *) val string_of_test2 : @@ -82,7 +82,7 @@ val create_test2 : val write_poly_int_string : - Bi_outbuf.t -> poly_int_string -> unit + Buffer.t -> poly_int_string -> unit (** Output a JSON value of type {!type:poly_int_string}. *) val string_of_poly_int_string : diff --git a/atdgen/test/test3j_j.expected.ml b/atdgen/test/test3j_j.expected.ml index f5ced692..7333449a 100644 --- a/atdgen/test/test3j_j.expected.ml +++ b/atdgen/test/test3j_j.expected.ml @@ -48,30 +48,30 @@ let rec write__4 ob x = ( ) ) 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 ( 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 ( read_rec_type @@ -166,9 +166,9 @@ let write__1 = ( ) ) 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 @@ -180,9 +180,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 ) @@ -192,9 +192,9 @@ 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 ) @@ -206,9 +206,9 @@ let write__5 = ( ) ) 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; @@ -223,41 +223,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; @@ -426,22 +426,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; @@ -507,13 +507,13 @@ let tf_variant_of_string s = let write_tf_record2 : _ -> tf_record2 -> _ = ( Atdgen_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 ) @@ -521,19 +521,19 @@ 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 ( fun p lb -> @@ -664,13 +664,13 @@ let tf_record2_of_string s = let write_tf_record : _ -> tf_record -> _ = ( Atdgen_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 ) @@ -678,19 +678,19 @@ 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 ( fun p lb -> @@ -822,9 +822,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 ) @@ -832,13 +832,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 ) @@ -846,8 +846,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 ) @@ -855,18 +855,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; @@ -1043,23 +1043,23 @@ let write_sf_adapted = ( 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 ( fun p lb -> @@ -1127,16 +1127,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; @@ -1177,9 +1177,9 @@ let write__6 = ( ) ) 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 ( read_sample_open_enum @@ -1191,9 +1191,9 @@ 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 ) @@ -1205,9 +1205,9 @@ let write__2 = ( ) ) 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; @@ -1224,9 +1224,9 @@ let write__3 = ( ) ) 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; @@ -1277,14 +1277,14 @@ 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 ) @@ -1294,8 +1294,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 ) @@ -1305,19 +1305,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; @@ -1459,23 +1459,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; @@ -1557,13 +1557,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 ) @@ -1571,18 +1571,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; @@ -1713,23 +1713,23 @@ let write_adapted_f = ( fun ob x -> match x with | `FA x -> - Bi_outbuf.add_string ob "[\"fa\","; + Buffer.add_string ob "[\"fa\","; ( write_a ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' | `FB x -> - Bi_outbuf.add_string ob "[\"fb\","; + Buffer.add_string ob "[\"fb\","; ( write_b ) ob x; - Bi_outbuf.add_char ob ']' + Buffer.add_char ob ']' ) ) let string_of_adapted_f ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_adapted_f ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_adapted_f = ( Atdgen_runtime.Oj_run.read_with_adapter (Atdgen_runtime.Json_adapter.normalize_type_field "type") ( fun p lb -> @@ -1799,23 +1799,23 @@ let write_adapted = ( 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 ( fun p lb -> diff --git a/atdgen/test/test3j_j.expected.mli b/atdgen/test/test3j_j.expected.mli index 28e3d481..be667b5b 100644 --- a/atdgen/test/test3j_j.expected.mli +++ b/atdgen/test/test3j_j.expected.mli @@ -43,7 +43,7 @@ type adapted_f = Test3j_t.adapted_f type adapted = Test3j_t.adapted val write_rec_type : - Bi_outbuf.t -> rec_type -> unit + Buffer.t -> rec_type -> unit (** Output a JSON value of type {!type:rec_type}. *) val string_of_rec_type : @@ -63,7 +63,7 @@ val rec_type_of_string : (** Deserialize JSON data of type {!type:rec_type}. *) val write_unixtime_list : - Bi_outbuf.t -> unixtime_list -> unit + Buffer.t -> unixtime_list -> unit (** Output a JSON value of type {!type:unixtime_list}. *) val string_of_unixtime_list : @@ -83,7 +83,7 @@ val unixtime_list_of_string : (** Deserialize JSON data of type {!type:unixtime_list}. *) val write_json : - Bi_outbuf.t -> json -> unit + Buffer.t -> json -> unit (** Output a JSON value of type {!type:json}. *) val string_of_json : @@ -103,7 +103,7 @@ val json_of_string : (** Deserialize JSON data of type {!type:json}. *) val write_tf_variant2 : - Bi_outbuf.t -> tf_variant2 -> unit + Buffer.t -> tf_variant2 -> unit (** Output a JSON value of type {!type:tf_variant2}. *) val string_of_tf_variant2 : @@ -123,7 +123,7 @@ val tf_variant2_of_string : (** Deserialize JSON data of type {!type:tf_variant2}. *) val write_tf_variant : - Bi_outbuf.t -> tf_variant -> unit + Buffer.t -> tf_variant -> unit (** Output a JSON value of type {!type:tf_variant}. *) val string_of_tf_variant : @@ -143,7 +143,7 @@ val tf_variant_of_string : (** Deserialize JSON data of type {!type:tf_variant}. *) val write_tf_record2 : - Bi_outbuf.t -> tf_record2 -> unit + Buffer.t -> tf_record2 -> unit (** Output a JSON value of type {!type:tf_record2}. *) val string_of_tf_record2 : @@ -163,7 +163,7 @@ val tf_record2_of_string : (** Deserialize JSON data of type {!type:tf_record2}. *) val write_tf_record : - Bi_outbuf.t -> tf_record -> unit + Buffer.t -> tf_record -> unit (** Output a JSON value of type {!type:tf_record}. *) val string_of_tf_record : @@ -183,7 +183,7 @@ val tf_record_of_string : (** Deserialize JSON data of type {!type:tf_record}. *) val write_dyn : - Bi_outbuf.t -> dyn -> unit + Buffer.t -> dyn -> unit (** Output a JSON value of type {!type:dyn}. *) val string_of_dyn : @@ -203,7 +203,7 @@ val dyn_of_string : (** Deserialize JSON data of type {!type:dyn}. *) val write_t : - Bi_outbuf.t -> t -> unit + Buffer.t -> t -> unit (** Output a JSON value of type {!type:t}. *) val string_of_t : @@ -223,7 +223,7 @@ val t_of_string : (** Deserialize JSON data of type {!type:t}. *) val write_sf_adapted : - Bi_outbuf.t -> sf_adapted -> unit + Buffer.t -> sf_adapted -> unit (** Output a JSON value of type {!type:sf_adapted}. *) val string_of_sf_adapted : @@ -243,7 +243,7 @@ val sf_adapted_of_string : (** Deserialize JSON data of type {!type:sf_adapted}. *) val write_sample_open_enum : - Bi_outbuf.t -> sample_open_enum -> unit + Buffer.t -> sample_open_enum -> unit (** Output a JSON value of type {!type:sample_open_enum}. *) val string_of_sample_open_enum : @@ -263,7 +263,7 @@ val sample_open_enum_of_string : (** Deserialize JSON data of type {!type:sample_open_enum}. *) val write_sample_open_enums : - Bi_outbuf.t -> sample_open_enums -> unit + Buffer.t -> sample_open_enums -> unit (** Output a JSON value of type {!type:sample_open_enums}. *) val string_of_sample_open_enums : @@ -283,7 +283,7 @@ val sample_open_enums_of_string : (** Deserialize JSON data of type {!type:sample_open_enums}. *) val write_patch : - Bi_outbuf.t -> patch -> unit + Buffer.t -> patch -> unit (** Output a JSON value of type {!type:patch}. *) val string_of_patch : @@ -303,7 +303,7 @@ val patch_of_string : (** Deserialize JSON data of type {!type:patch}. *) val write_b : - Bi_outbuf.t -> b -> unit + Buffer.t -> b -> unit (** Output a JSON value of type {!type:b}. *) val string_of_b : @@ -323,7 +323,7 @@ val b_of_string : (** Deserialize JSON data of type {!type:b}. *) val write_a : - Bi_outbuf.t -> a -> unit + Buffer.t -> a -> unit (** Output a JSON value of type {!type:a}. *) val string_of_a : @@ -343,7 +343,7 @@ val a_of_string : (** Deserialize JSON data of type {!type:a}. *) val write_adapted_f : - Bi_outbuf.t -> adapted_f -> unit + Buffer.t -> adapted_f -> unit (** Output a JSON value of type {!type:adapted_f}. *) val string_of_adapted_f : @@ -363,7 +363,7 @@ val adapted_f_of_string : (** Deserialize JSON data of type {!type:adapted_f}. *) val write_adapted : - Bi_outbuf.t -> adapted -> unit + Buffer.t -> adapted -> unit (** Output a JSON value of type {!type:adapted}. *) val string_of_adapted : diff --git a/atdgen/test/test_abstract_j.expected.ml b/atdgen/test/test_abstract_j.expected.ml index aa0798e0..e1bfd54d 100644 --- a/atdgen/test/test_abstract_j.expected.ml +++ b/atdgen/test/test_abstract_j.expected.ml @@ -15,9 +15,9 @@ let write_int_assoc_list = ( Testj.write_int_assoc_list ) 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 = ( Testj.read_int_assoc_list ) @@ -29,9 +29,9 @@ let write__1 = ( ) ) 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_json @@ -43,9 +43,9 @@ let write_any_items = ( write__1 ) let string_of_any_items ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_any_items ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_any_items = ( read__1 ) @@ -55,9 +55,9 @@ let write_abs2 write__x = ( Testj.write_abs2 write__x ) let string_of_abs2 write__x ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_abs2 write__x ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_abs2 read__x = ( Testj.read_abs2 read__x ) @@ -67,9 +67,9 @@ let write_abs1 write__x = ( Testj.write_abs1 write__x ) let string_of_abs1 write__x ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_abs1 write__x ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_abs1 read__x = ( Testj.read_abs1 read__x ) diff --git a/atdgen/test/test_abstract_j.expected.mli b/atdgen/test/test_abstract_j.expected.mli index 989db035..30a36cfc 100644 --- a/atdgen/test/test_abstract_j.expected.mli +++ b/atdgen/test/test_abstract_j.expected.mli @@ -12,7 +12,7 @@ type 'x abs2 = 'x Testj.abs2 type 'x abs1 = 'x Testj.abs1 val write_int_assoc_list : - Bi_outbuf.t -> int_assoc_list -> unit + Buffer.t -> int_assoc_list -> unit (** Output a JSON value of type {!type:int_assoc_list}. *) val string_of_int_assoc_list : @@ -32,7 +32,7 @@ val int_assoc_list_of_string : (** Deserialize JSON data of type {!type:int_assoc_list}. *) val write_any_items : - Bi_outbuf.t -> any_items -> unit + Buffer.t -> any_items -> unit (** Output a JSON value of type {!type:any_items}. *) val string_of_any_items : @@ -52,12 +52,12 @@ val any_items_of_string : (** Deserialize JSON data of type {!type:any_items}. *) val write_abs2 : - (Bi_outbuf.t -> 'x -> unit) -> - Bi_outbuf.t -> 'x abs2 -> unit + (Buffer.t -> 'x -> unit) -> + Buffer.t -> 'x abs2 -> unit (** Output a JSON value of type {!type:abs2}. *) val string_of_abs2 : - (Bi_outbuf.t -> 'x -> unit) -> + (Buffer.t -> 'x -> unit) -> ?len:int -> 'x abs2 -> string (** Serialize a value of type {!type:abs2} into a JSON string. @@ -76,12 +76,12 @@ val abs2_of_string : (** Deserialize JSON data of type {!type:abs2}. *) val write_abs1 : - (Bi_outbuf.t -> 'x -> unit) -> - Bi_outbuf.t -> 'x abs1 -> unit + (Buffer.t -> 'x -> unit) -> + Buffer.t -> 'x abs1 -> unit (** Output a JSON value of type {!type:abs1}. *) val string_of_abs1 : - (Bi_outbuf.t -> 'x -> unit) -> + (Buffer.t -> 'x -> unit) -> ?len:int -> 'x abs1 -> string (** Serialize a value of type {!type:abs1} into a JSON string. diff --git a/atdgen/test/test_ambiguous_record_j.expected.ml b/atdgen/test/test_ambiguous_record_j.expected.ml index 7c61e1a7..e4a4df87 100644 --- a/atdgen/test/test_ambiguous_record_j.expected.ml +++ b/atdgen/test/test_ambiguous_record_j.expected.ml @@ -5,13 +5,13 @@ open Test_ambiguous_record_t let write_ambiguous' : _ -> ambiguous' -> _ = ( Atdgen_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,19 +19,19 @@ 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 ( fun p lb -> @@ -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; diff --git a/atdgen/test/test_annot_j.expected.ml b/atdgen/test/test_annot_j.expected.ml index 57320d8c..a42a30f8 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; @@ -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; @@ -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; diff --git a/atdgen/test/test_annot_j.expected.mli b/atdgen/test/test_annot_j.expected.mli index 02f22604..26da427d 100644 --- a/atdgen/test/test_annot_j.expected.mli +++ b/atdgen/test/test_annot_j.expected.mli @@ -8,7 +8,7 @@ type pointB = ProtoD_t.pointB = { f: float } type pointA = ProtoA_t.pointA = { f: float } val write_pointC : - Bi_outbuf.t -> pointC -> unit + Buffer.t -> pointC -> unit (** Output a JSON value of type {!type:pointC}. *) val string_of_pointC : @@ -28,7 +28,7 @@ val pointC_of_string : (** Deserialize JSON data of type {!type:pointC}. *) val write_pointB : - Bi_outbuf.t -> pointB -> unit + Buffer.t -> pointB -> unit (** Output a JSON value of type {!type:pointB}. *) val string_of_pointB : @@ -48,7 +48,7 @@ val pointB_of_string : (** Deserialize JSON data of type {!type:pointB}. *) val write_pointA : - Bi_outbuf.t -> pointA -> unit + Buffer.t -> pointA -> unit (** Output a JSON value of type {!type:pointA}. *) val string_of_pointA : diff --git a/atdgen/test/test_polymorphic_wrap_j.expected.ml b/atdgen/test/test_polymorphic_wrap_j.expected.ml index a15c48c9..a9ef7604 100644 --- a/atdgen/test/test_polymorphic_wrap_j.expected.ml +++ b/atdgen/test/test_polymorphic_wrap_j.expected.ml @@ -9,9 +9,9 @@ let write__1 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 ( 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 4f5dcc9b..bbe9770d 100644 --- a/atdgen/test/testj.expected.ml +++ b/atdgen/test/testj.expected.ml @@ -163,9 +163,9 @@ let write__19 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 ( read__a @@ -176,24 +176,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; @@ -265,28 +265,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 ) @@ -294,8 +294,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 ) @@ -303,18 +303,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; @@ -518,18 +518,18 @@ let rec write__20 write__a write__b ob x = ( ) ) 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 ) @@ -537,18 +537,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; @@ -746,36 +746,36 @@ let rec write__2 ob x = ( ) ) 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 ( read_test_variant @@ -874,24 +874,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; @@ -964,9 +964,9 @@ 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 ) @@ -978,9 +978,9 @@ let write__31 = ( ) ) 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 @@ -992,9 +992,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 ) @@ -1002,23 +1002,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; @@ -1106,9 +1106,9 @@ let write__16 = ( ) ) 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; @@ -1159,13 +1159,13 @@ 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 ) @@ -1174,19 +1174,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; @@ -1316,9 +1316,9 @@ let write__29 = ( ) ) 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 @@ -1330,9 +1330,9 @@ 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 ) @@ -1344,9 +1344,9 @@ let write__3 = ( ) ) 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; @@ -1359,30 +1359,30 @@ 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; @@ -1446,9 +1446,9 @@ let write__9 = ( ) ) 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 @@ -1462,9 +1462,9 @@ let write__8 = ( ) ) 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; @@ -1519,9 +1519,9 @@ let write__7 = ( ) ) 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 @@ -1535,9 +1535,9 @@ let write__6 = ( ) ) 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; @@ -1592,9 +1592,9 @@ let write__5 = ( ) ) 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; @@ -1649,9 +1649,9 @@ let write__4 = ( ) ) 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; @@ -1706,9 +1706,9 @@ let write__11 = ( ) ) 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 ( read__6 @@ -1722,9 +1722,9 @@ let write__10 = ( ) ) 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 @@ -1734,14 +1734,14 @@ 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 ) @@ -1751,8 +1751,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 ) @@ -1761,8 +1761,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 ) @@ -1770,8 +1770,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 "\"field3\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field3\":"; ( Atdgen_runtime.Oj_run.write_int64 ) @@ -1779,8 +1779,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 "\"field4\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field4\":"; ( write__7 ) @@ -1789,8 +1789,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 ) @@ -1800,8 +1800,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 ) @@ -1810,8 +1810,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 ) @@ -1819,8 +1819,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 ) @@ -1828,54 +1828,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 ) 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 ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, _, _, _, x = x in ( Atdgen_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 ) @@ -1884,8 +1884,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 ) @@ -1894,8 +1894,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 ) @@ -1903,8 +1903,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 ) @@ -1912,18 +1912,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; @@ -2587,9 +2587,9 @@ let write__13 = ( ) ) 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 ( read_mixed_record @@ -2603,9 +2603,9 @@ let write__12 = ( ) ) 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 ( read_mixed_record @@ -2616,25 +2616,25 @@ let _12_of_string s = let write__14 = ( Atdgen_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 ( fun p lb -> @@ -2687,9 +2687,9 @@ 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 ) @@ -2701,9 +2701,9 @@ let write__15 = ( ) ) 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 ( read_mixed_record @@ -2713,14 +2713,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 ) @@ -2730,8 +2730,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 ) @@ -2740,8 +2740,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 ) @@ -2749,8 +2749,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 ) @@ -2758,18 +2758,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 ) 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; @@ -2971,24 +2971,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; @@ -3037,13 +3037,13 @@ let tup_of_string s = read_tup (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_test_field_prefix : _ -> test_field_prefix -> _ = ( fun ob (x : test_field_prefix) -> - 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 "\"hello\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"hello\":"; ( Yojson.Safe.write_bool ) @@ -3051,18 +3051,18 @@ let write_test_field_prefix : _ -> test_field_prefix -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"world\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"world\":"; ( Yojson.Safe.write_int ) ob x.theprefix_world; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_test_field_prefix ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_test_field_prefix ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_test_field_prefix = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -3210,9 +3210,9 @@ 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 ) @@ -3220,23 +3220,23 @@ 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; @@ -3322,9 +3322,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 ) @@ -3332,23 +3332,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; @@ -3432,13 +3432,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 ) @@ -3446,8 +3446,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 ) @@ -3455,18 +3455,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; @@ -3664,9 +3664,9 @@ 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 ) @@ -3678,9 +3678,9 @@ let write__18 = ( ) ) 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; @@ -3733,9 +3733,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 ) @@ -3745,9 +3745,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 ) @@ -3757,9 +3757,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 ) @@ -3772,9 +3772,9 @@ 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 = ( @@ -3788,9 +3788,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 ) @@ -3803,9 +3803,9 @@ 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 = ( @@ -3819,9 +3819,9 @@ 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 ) @@ -3835,9 +3835,9 @@ let write__25 = ( ) ) 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 ( read_id @@ -3851,9 +3851,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 ) @@ -3863,9 +3863,9 @@ 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 ) @@ -3879,9 +3879,9 @@ let write__21 = ( ) ) 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 @@ -3895,9 +3895,9 @@ 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 ) @@ -3911,9 +3911,9 @@ let write__22 = ( ) ) 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 @@ -3927,9 +3927,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 ) @@ -3939,9 +3939,9 @@ 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 ) @@ -3951,9 +3951,9 @@ let write_int64 = ( Atdgen_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 ) @@ -3963,9 +3963,9 @@ let write_int32 = ( Atdgen_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 ) @@ -3975,17 +3975,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; @@ -4036,23 +4036,23 @@ 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; @@ -4136,13 +4136,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 ) @@ -4150,18 +4150,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; @@ -4311,9 +4311,9 @@ let write__17 = ( ) ) 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 @@ -4323,48 +4323,48 @@ 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; @@ -4463,13 +4463,13 @@ 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 ) @@ -4477,8 +4477,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 ) @@ -4486,8 +4486,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 ) @@ -4496,8 +4496,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 ) @@ -4506,8 +4506,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 ) @@ -4516,19 +4516,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; @@ -4755,9 +4755,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 = ( @@ -4771,9 +4771,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 ) @@ -4783,9 +4783,9 @@ 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 ) @@ -4795,9 +4795,9 @@ let write_char = ( Atdgen_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 ) @@ -4805,24 +4805,24 @@ 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; @@ -4871,13 +4871,13 @@ 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 ) @@ -4885,18 +4885,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; @@ -5022,9 +5022,9 @@ let write__23 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 ( read__a @@ -5036,9 +5036,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 ) @@ -5048,9 +5048,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 ) @@ -5060,9 +5060,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 ) @@ -5072,9 +5072,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 71ca86e1..f31f8fc1 100644 --- a/atdgen/test/testj.expected.mli +++ b/atdgen/test/testj.expected.mli @@ -158,7 +158,7 @@ type 'a abs2 = 'a Test.abs2 type 'a abs1 = 'a Test.abs1 val write_test_variant : - Bi_outbuf.t -> test_variant -> unit + Buffer.t -> test_variant -> unit (** Output a JSON value of type {!type:test_variant}. *) val string_of_test_variant : @@ -179,14 +179,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 + (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 {!type:poly} into a JSON string. @@ -214,12 +214,12 @@ val create_poly : val write_p' : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a p' -> unit + (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 {!type:p'} into a JSON string. @@ -239,7 +239,7 @@ val p'_of_string : val write_p : - Bi_outbuf.t -> p -> unit + Buffer.t -> p -> unit (** Output a JSON value of type {!type:p}. *) val string_of_p : @@ -260,7 +260,7 @@ val p_of_string : val write_r : - Bi_outbuf.t -> r -> unit + Buffer.t -> r -> unit (** Output a JSON value of type {!type:r}. *) val string_of_r : @@ -288,7 +288,7 @@ val create_r : val write_validated_string_check : - Bi_outbuf.t -> validated_string_check -> unit + Buffer.t -> validated_string_check -> unit (** Output a JSON value of type {!type:validated_string_check}. *) val string_of_validated_string_check : @@ -309,7 +309,7 @@ val validated_string_check_of_string : val write_validate_me : - Bi_outbuf.t -> validate_me -> unit + Buffer.t -> validate_me -> unit (** Output a JSON value of type {!type:validate_me}. *) val string_of_validate_me : @@ -330,7 +330,7 @@ val validate_me_of_string : val write_val1 : - Bi_outbuf.t -> val1 -> unit + Buffer.t -> val1 -> unit (** Output a JSON value of type {!type:val1}. *) val string_of_val1 : @@ -356,7 +356,7 @@ val create_val1 : val write_val2 : - Bi_outbuf.t -> val2 -> unit + Buffer.t -> val2 -> unit (** Output a JSON value of type {!type:val2}. *) val string_of_val2 : @@ -383,7 +383,7 @@ val create_val2 : val write_unixtime_list : - Bi_outbuf.t -> unixtime_list -> unit + Buffer.t -> unixtime_list -> unit (** Output a JSON value of type {!type:unixtime_list}. *) val string_of_unixtime_list : @@ -404,7 +404,7 @@ val unixtime_list_of_string : val write_date : - Bi_outbuf.t -> date -> unit + Buffer.t -> date -> unit (** Output a JSON value of type {!type:date}. *) val string_of_date : @@ -425,7 +425,7 @@ val date_of_string : val write_mixed_record : - Bi_outbuf.t -> mixed_record -> unit + Buffer.t -> mixed_record -> unit (** Output a JSON value of type {!type:mixed_record}. *) val string_of_mixed_record : @@ -465,7 +465,7 @@ val create_mixed_record : val write_mixed : - Bi_outbuf.t -> mixed -> unit + Buffer.t -> mixed -> unit (** Output a JSON value of type {!type:mixed}. *) val string_of_mixed : @@ -486,7 +486,7 @@ val mixed_of_string : val write_test : - Bi_outbuf.t -> test -> unit + Buffer.t -> test -> unit (** Output a JSON value of type {!type:test}. *) val string_of_test : @@ -516,7 +516,7 @@ val create_test : val write_tup : - Bi_outbuf.t -> tup -> unit + Buffer.t -> tup -> unit (** Output a JSON value of type {!type:tup}. *) val string_of_tup : @@ -537,7 +537,7 @@ val tup_of_string : val write_test_field_prefix : - Bi_outbuf.t -> test_field_prefix -> unit + Buffer.t -> test_field_prefix -> unit (** Output a JSON value of type {!type:test_field_prefix}. *) val string_of_test_field_prefix : @@ -564,7 +564,7 @@ val create_test_field_prefix : val write_star_rating : - Bi_outbuf.t -> star_rating -> unit + Buffer.t -> star_rating -> unit (** Output a JSON value of type {!type:star_rating}. *) val string_of_star_rating : @@ -585,12 +585,12 @@ val star_rating_of_string : val write_generic : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a generic -> unit + (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 {!type:generic} into a JSON string. @@ -615,7 +615,7 @@ val create_generic : val write_specialized : - Bi_outbuf.t -> specialized -> unit + Buffer.t -> specialized -> unit (** Output a JSON value of type {!type:specialized}. *) val string_of_specialized : @@ -636,7 +636,7 @@ val specialized_of_string : val write_some_record : - Bi_outbuf.t -> some_record -> unit + Buffer.t -> some_record -> unit (** Output a JSON value of type {!type:some_record}. *) val string_of_some_record : @@ -662,7 +662,7 @@ val create_some_record : val write_precision : - Bi_outbuf.t -> precision -> unit + Buffer.t -> precision -> unit (** Output a JSON value of type {!type:precision}. *) val string_of_precision : @@ -690,7 +690,7 @@ val create_precision : val write_p'' : - Bi_outbuf.t -> p'' -> unit + Buffer.t -> p'' -> unit (** Output a JSON value of type {!type:p''}. *) val string_of_p'' : @@ -711,7 +711,7 @@ val p''_of_string : val write_option_validation : - Bi_outbuf.t -> option_validation -> unit + Buffer.t -> option_validation -> unit (** Output a JSON value of type {!type:option_validation}. *) val string_of_option_validation : @@ -732,7 +732,7 @@ val option_validation_of_string : val write_no_real_wrap : - Bi_outbuf.t -> no_real_wrap -> unit + Buffer.t -> no_real_wrap -> unit (** Output a JSON value of type {!type:no_real_wrap}. *) val string_of_no_real_wrap : @@ -753,7 +753,7 @@ val no_real_wrap_of_string : val write_natural : - Bi_outbuf.t -> natural -> unit + Buffer.t -> natural -> unit (** Output a JSON value of type {!type:natural}. *) val string_of_natural : @@ -774,7 +774,7 @@ val natural_of_string : val write_id : - Bi_outbuf.t -> id -> unit + Buffer.t -> id -> unit (** Output a JSON value of type {!type:id}. *) val string_of_id : @@ -795,7 +795,7 @@ val id_of_string : val write_json_map : - Bi_outbuf.t -> json_map -> unit + Buffer.t -> json_map -> unit (** Output a JSON value of type {!type:json_map}. *) val string_of_json_map : @@ -816,7 +816,7 @@ val json_map_of_string : val write_intopt : - Bi_outbuf.t -> intopt -> unit + Buffer.t -> intopt -> unit (** Output a JSON value of type {!type:intopt}. *) val string_of_intopt : @@ -837,7 +837,7 @@ val intopt_of_string : val write_int_assoc_list : - Bi_outbuf.t -> int_assoc_list -> unit + Buffer.t -> int_assoc_list -> unit (** Output a JSON value of type {!type:int_assoc_list}. *) val string_of_int_assoc_list : @@ -858,7 +858,7 @@ val int_assoc_list_of_string : val write_int_assoc_array : - Bi_outbuf.t -> int_assoc_array -> unit + Buffer.t -> int_assoc_array -> unit (** Output a JSON value of type {!type:int_assoc_array}. *) val string_of_int_assoc_array : @@ -879,7 +879,7 @@ val int_assoc_array_of_string : val write_int8 : - Bi_outbuf.t -> int8 -> unit + Buffer.t -> int8 -> unit (** Output a JSON value of type {!type:int8}. *) val string_of_int8 : @@ -900,7 +900,7 @@ val int8_of_string : val write_int64 : - Bi_outbuf.t -> int64 -> unit + Buffer.t -> int64 -> unit (** Output a JSON value of type {!type:int64}. *) val string_of_int64 : @@ -921,7 +921,7 @@ val int64_of_string : val write_int32 : - Bi_outbuf.t -> int32 -> unit + Buffer.t -> int32 -> unit (** Output a JSON value of type {!type:int32}. *) val string_of_int32 : @@ -942,7 +942,7 @@ val int32_of_string : val write_hello : - Bi_outbuf.t -> hello -> unit + Buffer.t -> hello -> unit (** Output a JSON value of type {!type:hello}. *) val string_of_hello : @@ -963,7 +963,7 @@ val hello_of_string : val write_floats : - Bi_outbuf.t -> floats -> unit + Buffer.t -> floats -> unit (** Output a JSON value of type {!type:floats}. *) val string_of_floats : @@ -990,7 +990,7 @@ val create_floats : val write_extended_tuple : - Bi_outbuf.t -> extended_tuple -> unit + Buffer.t -> extended_tuple -> unit (** Output a JSON value of type {!type:extended_tuple}. *) val string_of_extended_tuple : @@ -1011,7 +1011,7 @@ val extended_tuple_of_string : val write_extended : - Bi_outbuf.t -> extended -> unit + Buffer.t -> extended -> unit (** Output a JSON value of type {!type:extended}. *) val string_of_extended : @@ -1042,7 +1042,7 @@ val create_extended : val write_even_natural : - Bi_outbuf.t -> even_natural -> unit + Buffer.t -> even_natural -> unit (** Output a JSON value of type {!type:even_natural}. *) val string_of_even_natural : @@ -1063,7 +1063,7 @@ val even_natural_of_string : val write_def : - Bi_outbuf.t -> def -> unit + Buffer.t -> def -> unit (** Output a JSON value of type {!type:def}. *) val string_of_def : @@ -1084,7 +1084,7 @@ val def_of_string : val write_char : - Bi_outbuf.t -> char -> unit + Buffer.t -> char -> unit (** Output a JSON value of type {!type:char}. *) val string_of_char : @@ -1105,7 +1105,7 @@ val char_of_string : val write_base_tuple : - Bi_outbuf.t -> base_tuple -> unit + Buffer.t -> base_tuple -> unit (** Output a JSON value of type {!type:base_tuple}. *) val string_of_base_tuple : @@ -1126,7 +1126,7 @@ val base_tuple_of_string : val write_base : - Bi_outbuf.t -> base -> unit + Buffer.t -> base -> unit (** Output a JSON value of type {!type:base}. *) val string_of_base : @@ -1153,12 +1153,12 @@ val create_base : val write_array : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a array -> unit + (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 {!type:array} into a JSON string. @@ -1178,12 +1178,12 @@ val array_of_string : val write_abs3 : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a abs3 -> unit + (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 {!type:abs3} into a JSON string. @@ -1203,12 +1203,12 @@ val abs3_of_string : val write_abs2 : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a abs2 -> unit + (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 {!type:abs2} into a JSON string. @@ -1228,12 +1228,12 @@ val abs2_of_string : val write_abs1 : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a abs1 -> unit + (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 {!type:abs1} into a JSON string. diff --git a/atdgen/test/testjstd.expected.ml b/atdgen/test/testjstd.expected.ml index e1326885..4f097d3d 100644 --- a/atdgen/test/testjstd.expected.ml +++ b/atdgen/test/testjstd.expected.ml @@ -163,9 +163,9 @@ let write__19 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 ( read__a @@ -176,24 +176,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; @@ -265,28 +265,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 ) @@ -294,8 +294,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 ) @@ -303,18 +303,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; @@ -514,18 +514,18 @@ let rec write__20 write__a write__b ob x = ( ) ) 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 ) @@ -533,18 +533,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; @@ -734,36 +734,36 @@ let rec write__2 ob x = ( ) ) 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 ( read_test_variant @@ -862,24 +862,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; @@ -952,9 +952,9 @@ 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 ) @@ -966,9 +966,9 @@ let write__31 = ( ) ) 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 @@ -980,9 +980,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 ) @@ -990,23 +990,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; @@ -1092,9 +1092,9 @@ let write__16 = ( ) ) 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; @@ -1145,13 +1145,13 @@ 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 ) @@ -1160,19 +1160,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; @@ -1298,9 +1298,9 @@ let write__29 = ( ) ) 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 @@ -1312,9 +1312,9 @@ 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 ) @@ -1326,9 +1326,9 @@ let write__3 = ( ) ) 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; @@ -1341,30 +1341,30 @@ 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; @@ -1428,9 +1428,9 @@ let write__9 = ( ) ) 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 @@ -1444,9 +1444,9 @@ let write__8 = ( ) ) 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; @@ -1501,9 +1501,9 @@ let write__7 = ( ) ) 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 @@ -1517,9 +1517,9 @@ let write__6 = ( ) ) 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; @@ -1574,9 +1574,9 @@ let write__5 = ( ) ) 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; @@ -1631,9 +1631,9 @@ let write__4 = ( ) ) 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; @@ -1688,9 +1688,9 @@ let write__11 = ( ) ) 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 ( read__6 @@ -1704,9 +1704,9 @@ let write__10 = ( ) ) 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 @@ -1716,14 +1716,14 @@ 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 ) @@ -1733,8 +1733,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 ) @@ -1743,8 +1743,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 ) @@ -1752,8 +1752,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 "\"field3\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field3\":"; ( Atdgen_runtime.Oj_run.write_int64 ) @@ -1761,8 +1761,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 "\"field4\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"field4\":"; ( write__7 ) @@ -1771,8 +1771,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 ) @@ -1782,8 +1782,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 ) @@ -1792,8 +1792,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 ) @@ -1801,8 +1801,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 ) @@ -1810,54 +1810,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 ) 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 ) ob x ); - Bi_outbuf.add_char ob ','; + Buffer.add_char ob ','; (let _, _, _, _, _, x = x in ( Atdgen_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 ) @@ -1866,8 +1866,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 ) @@ -1876,8 +1876,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 ) @@ -1885,8 +1885,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 ) @@ -1894,18 +1894,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; @@ -2559,9 +2559,9 @@ let write__13 = ( ) ) 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 ( read_mixed_record @@ -2575,9 +2575,9 @@ let write__12 = ( ) ) 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 ( read_mixed_record @@ -2588,25 +2588,25 @@ let _12_of_string s = let write__14 = ( Atdgen_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 ( fun p lb -> @@ -2659,9 +2659,9 @@ 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 ) @@ -2673,9 +2673,9 @@ let write__15 = ( ) ) 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 ( read_mixed_record @@ -2685,14 +2685,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 ) @@ -2702,8 +2702,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 ) @@ -2712,8 +2712,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 ) @@ -2721,8 +2721,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 ) @@ -2730,18 +2730,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 ) 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; @@ -2939,24 +2939,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; @@ -3005,13 +3005,13 @@ let tup_of_string s = read_tup (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_test_field_prefix : _ -> test_field_prefix -> _ = ( fun ob (x : test_field_prefix) -> - 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 "\"hello\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"hello\":"; ( Yojson.Safe.write_bool ) @@ -3019,18 +3019,18 @@ let write_test_field_prefix : _ -> test_field_prefix -> _ = ( if !is_first then is_first := false else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"world\":"; + Buffer.add_char ob ','; + Buffer.add_string ob "\"world\":"; ( Yojson.Safe.write_int ) ob x.theprefix_world; - Bi_outbuf.add_char ob '}'; + Buffer.add_char ob '}'; ) let string_of_test_field_prefix ?(len = 1024) x = - let ob = Bi_outbuf.create len in + let ob = Buffer.create len in write_test_field_prefix ob x; - Bi_outbuf.contents ob + Buffer.contents ob let read_test_field_prefix = ( fun p lb -> Yojson.Safe.read_space p lb; @@ -3170,9 +3170,9 @@ 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 ) @@ -3180,23 +3180,23 @@ 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; @@ -3280,9 +3280,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 ) @@ -3290,23 +3290,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; @@ -3388,13 +3388,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 ) @@ -3402,8 +3402,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 ) @@ -3411,18 +3411,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; @@ -3608,9 +3608,9 @@ 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 ) @@ -3622,9 +3622,9 @@ let write__18 = ( ) ) 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; @@ -3677,9 +3677,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 ) @@ -3689,9 +3689,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 ) @@ -3701,9 +3701,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 ) @@ -3716,9 +3716,9 @@ 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 = ( @@ -3732,9 +3732,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 ) @@ -3747,9 +3747,9 @@ 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 = ( @@ -3763,9 +3763,9 @@ 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 ) @@ -3779,9 +3779,9 @@ let write__25 = ( ) ) 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 ( read_id @@ -3795,9 +3795,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 ) @@ -3807,9 +3807,9 @@ 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 ) @@ -3823,9 +3823,9 @@ let write__21 = ( ) ) 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 @@ -3839,9 +3839,9 @@ 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 ) @@ -3855,9 +3855,9 @@ let write__22 = ( ) ) 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 @@ -3871,9 +3871,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 ) @@ -3883,9 +3883,9 @@ 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 ) @@ -3895,9 +3895,9 @@ let write_int64 = ( Atdgen_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 ) @@ -3907,9 +3907,9 @@ let write_int32 = ( Atdgen_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 ) @@ -3919,17 +3919,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; @@ -3980,23 +3980,23 @@ 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; @@ -4078,13 +4078,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 ) @@ -4092,18 +4092,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; @@ -4245,9 +4245,9 @@ let write__17 = ( ) ) 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 @@ -4257,48 +4257,48 @@ 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; @@ -4397,13 +4397,13 @@ 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 ) @@ -4411,8 +4411,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 ) @@ -4420,8 +4420,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 ) @@ -4430,8 +4430,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 ) @@ -4440,8 +4440,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 ) @@ -4450,19 +4450,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; @@ -4685,9 +4685,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 = ( @@ -4701,9 +4701,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 ) @@ -4713,9 +4713,9 @@ 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 ) @@ -4725,9 +4725,9 @@ let write_char = ( Atdgen_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 ) @@ -4735,24 +4735,24 @@ 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; @@ -4801,13 +4801,13 @@ 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 ) @@ -4815,18 +4815,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; @@ -4948,9 +4948,9 @@ let write__23 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 ( read__a @@ -4962,9 +4962,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 ) @@ -4974,9 +4974,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 ) @@ -4986,9 +4986,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 ) @@ -4998,9 +4998,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 71ca86e1..f31f8fc1 100644 --- a/atdgen/test/testjstd.expected.mli +++ b/atdgen/test/testjstd.expected.mli @@ -158,7 +158,7 @@ type 'a abs2 = 'a Test.abs2 type 'a abs1 = 'a Test.abs1 val write_test_variant : - Bi_outbuf.t -> test_variant -> unit + Buffer.t -> test_variant -> unit (** Output a JSON value of type {!type:test_variant}. *) val string_of_test_variant : @@ -179,14 +179,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 + (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 {!type:poly} into a JSON string. @@ -214,12 +214,12 @@ val create_poly : val write_p' : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a p' -> unit + (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 {!type:p'} into a JSON string. @@ -239,7 +239,7 @@ val p'_of_string : val write_p : - Bi_outbuf.t -> p -> unit + Buffer.t -> p -> unit (** Output a JSON value of type {!type:p}. *) val string_of_p : @@ -260,7 +260,7 @@ val p_of_string : val write_r : - Bi_outbuf.t -> r -> unit + Buffer.t -> r -> unit (** Output a JSON value of type {!type:r}. *) val string_of_r : @@ -288,7 +288,7 @@ val create_r : val write_validated_string_check : - Bi_outbuf.t -> validated_string_check -> unit + Buffer.t -> validated_string_check -> unit (** Output a JSON value of type {!type:validated_string_check}. *) val string_of_validated_string_check : @@ -309,7 +309,7 @@ val validated_string_check_of_string : val write_validate_me : - Bi_outbuf.t -> validate_me -> unit + Buffer.t -> validate_me -> unit (** Output a JSON value of type {!type:validate_me}. *) val string_of_validate_me : @@ -330,7 +330,7 @@ val validate_me_of_string : val write_val1 : - Bi_outbuf.t -> val1 -> unit + Buffer.t -> val1 -> unit (** Output a JSON value of type {!type:val1}. *) val string_of_val1 : @@ -356,7 +356,7 @@ val create_val1 : val write_val2 : - Bi_outbuf.t -> val2 -> unit + Buffer.t -> val2 -> unit (** Output a JSON value of type {!type:val2}. *) val string_of_val2 : @@ -383,7 +383,7 @@ val create_val2 : val write_unixtime_list : - Bi_outbuf.t -> unixtime_list -> unit + Buffer.t -> unixtime_list -> unit (** Output a JSON value of type {!type:unixtime_list}. *) val string_of_unixtime_list : @@ -404,7 +404,7 @@ val unixtime_list_of_string : val write_date : - Bi_outbuf.t -> date -> unit + Buffer.t -> date -> unit (** Output a JSON value of type {!type:date}. *) val string_of_date : @@ -425,7 +425,7 @@ val date_of_string : val write_mixed_record : - Bi_outbuf.t -> mixed_record -> unit + Buffer.t -> mixed_record -> unit (** Output a JSON value of type {!type:mixed_record}. *) val string_of_mixed_record : @@ -465,7 +465,7 @@ val create_mixed_record : val write_mixed : - Bi_outbuf.t -> mixed -> unit + Buffer.t -> mixed -> unit (** Output a JSON value of type {!type:mixed}. *) val string_of_mixed : @@ -486,7 +486,7 @@ val mixed_of_string : val write_test : - Bi_outbuf.t -> test -> unit + Buffer.t -> test -> unit (** Output a JSON value of type {!type:test}. *) val string_of_test : @@ -516,7 +516,7 @@ val create_test : val write_tup : - Bi_outbuf.t -> tup -> unit + Buffer.t -> tup -> unit (** Output a JSON value of type {!type:tup}. *) val string_of_tup : @@ -537,7 +537,7 @@ val tup_of_string : val write_test_field_prefix : - Bi_outbuf.t -> test_field_prefix -> unit + Buffer.t -> test_field_prefix -> unit (** Output a JSON value of type {!type:test_field_prefix}. *) val string_of_test_field_prefix : @@ -564,7 +564,7 @@ val create_test_field_prefix : val write_star_rating : - Bi_outbuf.t -> star_rating -> unit + Buffer.t -> star_rating -> unit (** Output a JSON value of type {!type:star_rating}. *) val string_of_star_rating : @@ -585,12 +585,12 @@ val star_rating_of_string : val write_generic : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a generic -> unit + (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 {!type:generic} into a JSON string. @@ -615,7 +615,7 @@ val create_generic : val write_specialized : - Bi_outbuf.t -> specialized -> unit + Buffer.t -> specialized -> unit (** Output a JSON value of type {!type:specialized}. *) val string_of_specialized : @@ -636,7 +636,7 @@ val specialized_of_string : val write_some_record : - Bi_outbuf.t -> some_record -> unit + Buffer.t -> some_record -> unit (** Output a JSON value of type {!type:some_record}. *) val string_of_some_record : @@ -662,7 +662,7 @@ val create_some_record : val write_precision : - Bi_outbuf.t -> precision -> unit + Buffer.t -> precision -> unit (** Output a JSON value of type {!type:precision}. *) val string_of_precision : @@ -690,7 +690,7 @@ val create_precision : val write_p'' : - Bi_outbuf.t -> p'' -> unit + Buffer.t -> p'' -> unit (** Output a JSON value of type {!type:p''}. *) val string_of_p'' : @@ -711,7 +711,7 @@ val p''_of_string : val write_option_validation : - Bi_outbuf.t -> option_validation -> unit + Buffer.t -> option_validation -> unit (** Output a JSON value of type {!type:option_validation}. *) val string_of_option_validation : @@ -732,7 +732,7 @@ val option_validation_of_string : val write_no_real_wrap : - Bi_outbuf.t -> no_real_wrap -> unit + Buffer.t -> no_real_wrap -> unit (** Output a JSON value of type {!type:no_real_wrap}. *) val string_of_no_real_wrap : @@ -753,7 +753,7 @@ val no_real_wrap_of_string : val write_natural : - Bi_outbuf.t -> natural -> unit + Buffer.t -> natural -> unit (** Output a JSON value of type {!type:natural}. *) val string_of_natural : @@ -774,7 +774,7 @@ val natural_of_string : val write_id : - Bi_outbuf.t -> id -> unit + Buffer.t -> id -> unit (** Output a JSON value of type {!type:id}. *) val string_of_id : @@ -795,7 +795,7 @@ val id_of_string : val write_json_map : - Bi_outbuf.t -> json_map -> unit + Buffer.t -> json_map -> unit (** Output a JSON value of type {!type:json_map}. *) val string_of_json_map : @@ -816,7 +816,7 @@ val json_map_of_string : val write_intopt : - Bi_outbuf.t -> intopt -> unit + Buffer.t -> intopt -> unit (** Output a JSON value of type {!type:intopt}. *) val string_of_intopt : @@ -837,7 +837,7 @@ val intopt_of_string : val write_int_assoc_list : - Bi_outbuf.t -> int_assoc_list -> unit + Buffer.t -> int_assoc_list -> unit (** Output a JSON value of type {!type:int_assoc_list}. *) val string_of_int_assoc_list : @@ -858,7 +858,7 @@ val int_assoc_list_of_string : val write_int_assoc_array : - Bi_outbuf.t -> int_assoc_array -> unit + Buffer.t -> int_assoc_array -> unit (** Output a JSON value of type {!type:int_assoc_array}. *) val string_of_int_assoc_array : @@ -879,7 +879,7 @@ val int_assoc_array_of_string : val write_int8 : - Bi_outbuf.t -> int8 -> unit + Buffer.t -> int8 -> unit (** Output a JSON value of type {!type:int8}. *) val string_of_int8 : @@ -900,7 +900,7 @@ val int8_of_string : val write_int64 : - Bi_outbuf.t -> int64 -> unit + Buffer.t -> int64 -> unit (** Output a JSON value of type {!type:int64}. *) val string_of_int64 : @@ -921,7 +921,7 @@ val int64_of_string : val write_int32 : - Bi_outbuf.t -> int32 -> unit + Buffer.t -> int32 -> unit (** Output a JSON value of type {!type:int32}. *) val string_of_int32 : @@ -942,7 +942,7 @@ val int32_of_string : val write_hello : - Bi_outbuf.t -> hello -> unit + Buffer.t -> hello -> unit (** Output a JSON value of type {!type:hello}. *) val string_of_hello : @@ -963,7 +963,7 @@ val hello_of_string : val write_floats : - Bi_outbuf.t -> floats -> unit + Buffer.t -> floats -> unit (** Output a JSON value of type {!type:floats}. *) val string_of_floats : @@ -990,7 +990,7 @@ val create_floats : val write_extended_tuple : - Bi_outbuf.t -> extended_tuple -> unit + Buffer.t -> extended_tuple -> unit (** Output a JSON value of type {!type:extended_tuple}. *) val string_of_extended_tuple : @@ -1011,7 +1011,7 @@ val extended_tuple_of_string : val write_extended : - Bi_outbuf.t -> extended -> unit + Buffer.t -> extended -> unit (** Output a JSON value of type {!type:extended}. *) val string_of_extended : @@ -1042,7 +1042,7 @@ val create_extended : val write_even_natural : - Bi_outbuf.t -> even_natural -> unit + Buffer.t -> even_natural -> unit (** Output a JSON value of type {!type:even_natural}. *) val string_of_even_natural : @@ -1063,7 +1063,7 @@ val even_natural_of_string : val write_def : - Bi_outbuf.t -> def -> unit + Buffer.t -> def -> unit (** Output a JSON value of type {!type:def}. *) val string_of_def : @@ -1084,7 +1084,7 @@ val def_of_string : val write_char : - Bi_outbuf.t -> char -> unit + Buffer.t -> char -> unit (** Output a JSON value of type {!type:char}. *) val string_of_char : @@ -1105,7 +1105,7 @@ val char_of_string : val write_base_tuple : - Bi_outbuf.t -> base_tuple -> unit + Buffer.t -> base_tuple -> unit (** Output a JSON value of type {!type:base_tuple}. *) val string_of_base_tuple : @@ -1126,7 +1126,7 @@ val base_tuple_of_string : val write_base : - Bi_outbuf.t -> base -> unit + Buffer.t -> base -> unit (** Output a JSON value of type {!type:base}. *) val string_of_base : @@ -1153,12 +1153,12 @@ val create_base : val write_array : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a array -> unit + (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 {!type:array} into a JSON string. @@ -1178,12 +1178,12 @@ val array_of_string : val write_abs3 : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a abs3 -> unit + (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 {!type:abs3} into a JSON string. @@ -1203,12 +1203,12 @@ val abs3_of_string : val write_abs2 : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a abs2 -> unit + (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 {!type:abs2} into a JSON string. @@ -1228,12 +1228,12 @@ val abs2_of_string : val write_abs1 : - (Bi_outbuf.t -> 'a -> unit) -> - Bi_outbuf.t -> 'a abs1 -> unit + (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 {!type:abs1} into a JSON string. diff --git a/dune-project b/dune-project index b522fd32..1ccbf132 100644 --- a/dune-project +++ b/dune-project @@ -123,9 +123,8 @@ This package should be used only in conjunction with the atdgen code generator") (depends (ocaml (>= 4.08)) - (yojson (and (>= 1.7.0) (< 2.0.0))) + (yojson (>= 2.0.1)) (biniou (>= 1.0.6)) - camlp-streams (odoc :with-doc))) (package