Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
e774556b
Commit
e774556b
authored
Mar 23, 2018
by
Sylvain Dailler
Browse files
JSON communication: Adding a way to print %f float numbers
parent
c61edffe
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/util/json_base.ml
View file @
e774556b
...
@@ -33,8 +33,8 @@ let string fmt s =
...
@@ -33,8 +33,8 @@ let string fmt s =
let int fmt d = fprintf fmt "
%
d
" d
let int fmt d = fprintf fmt "
%
d
" d
let bool fmt b = fprintf fmt "
%
b
" b
let bool fmt b = fprintf fmt "
%
b
" b
let standard_float fmt f = fprintf fmt "
%
f
" f
let float fmt f = fprintf fmt "
%
g
" f
let float fmt f = fprintf fmt "
%
g
" f
(* TODO check that you can print a floating point number like this in JSON *)
let print_json_field key value_pr fmt value =
let print_json_field key value_pr fmt value =
fprintf fmt "
%
a
:
%
a
" string key value_pr value
fprintf fmt "
%
a
:
%
a
" string key value_pr value
...
...
src/util/json_base.mli
View file @
e774556b
...
@@ -19,7 +19,11 @@ val int : Format.formatter -> int -> unit
...
@@ -19,7 +19,11 @@ val int : Format.formatter -> int -> unit
val
bool
:
Format
.
formatter
->
bool
->
unit
val
bool
:
Format
.
formatter
->
bool
->
unit
(* print an boolean *)
(* print an boolean *)
val
float
:
Format
.
formatter
->
float
->
unit
val
float
:
Format
.
formatter
->
float
->
unit
(* print an floating point number *)
(* print a floating point number *)
val
standard_float
:
Format
.
formatter
->
float
->
unit
(* print a float in a format that cannot be mistaken for an integer (this makes
communication with other tools easier).
*)
val
list
:
val
list
:
(
Format
.
formatter
->
'
a
->
unit
)
->
Format
.
formatter
->
'
a
list
->
unit
(
Format
.
formatter
->
'
a
->
unit
)
->
Format
.
formatter
->
'
a
list
->
unit
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment