1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
[@@@ocaml.warning "-27-32-33-35-39"]
type int64 = Int64_t.int64
let write_int64 = (
fun ob x ->
Buffer.add_char ob '[';
(let x, _ = x in
(
Atdgen_runtime.Oj_run.write_int32
) ob x
);
Buffer.add_char ob ',';
(let _, x = x in
(
Atdgen_runtime.Oj_run.write_int32
) ob x
);
Buffer.add_char ob ']';
)
let string_of_int64 ?(len = 1024) x =
let ob = Buffer.create len in
write_int64 ob x;
Buffer.contents ob
let read_int64 = (
fun p lb ->
Yojson.Safe.read_space p lb;
Atdgen_runtime.Yojson_extra.start_any_tuple p lb;
let len = ref 0 in
let end_of_tuple = ref false in
(try
let x0 =
let x =
(
Atdgen_runtime.Oj_run.read_int32
) p lb
in
incr len;
Yojson.Safe.read_space p lb;
Atdgen_runtime.Yojson_extra.read_tuple_sep2 p lb;
x
in
let x1 =
let x =
(
Atdgen_runtime.Oj_run.read_int32
) p lb
in
incr len;
(try
Yojson.Safe.read_space p lb;
Atdgen_runtime.Yojson_extra.read_tuple_sep2 p lb;
with Atdgen_runtime.Yojson_extra.End_of_tuple -> end_of_tuple := true);
x
in
if not !end_of_tuple then (
try
while true do
Yojson.Safe.skip_json p lb;
Yojson.Safe.read_space p lb;
Atdgen_runtime.Yojson_extra.read_tuple_sep2 p lb;
done
with Atdgen_runtime.Yojson_extra.End_of_tuple -> ()
);
(x0, x1)
with Atdgen_runtime.Yojson_extra.End_of_tuple ->
Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]);
)
let int64_of_string s =
read_int64 (Yojson.Safe.init_lexer ()) (Lexing.from_string s)