Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Why3
why3
Commits
6117b03c
Commit
6117b03c
authored
Aug 13, 2019
by
Sylvain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
why3execute: add an explicit option --real for real precision argument
parent
ae5ddf91
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
5 deletions
+27
-5
src/tools/why3execute.ml
src/tools/why3execute.ml
+27
-5
No files found.
src/tools/why3execute.ml
View file @
6117b03c
...
...
@@ -28,13 +28,29 @@ let add_opt x =
Format
.
eprintf
"extra arguments must be of the form 'module.ident'@."
;
exit
1
(* Used for real numbers approximation *)
let
real_prec
=
ref
0
let
real_emin
=
ref
0
let
real_emax
=
ref
0
let
precision
()
=
(
!
real_emin
,
!
real_emax
,
!
real_prec
)
let
opt_parser
=
ref
None
let
option_list
=
[
let
option_list
=
let
real_spec
=
[
Arg
.
Set_int
real_emin
;
Arg
.
Set_int
real_emax
;
Arg
.
Set_int
real_prec
]
in
[
"-F"
,
Arg
.
String
(
fun
s
->
opt_parser
:=
Some
s
)
,
"<format> select input format (default:
\"
why
\"
)"
;
"--format"
,
Arg
.
String
(
fun
s
->
opt_parser
:=
Some
s
)
,
" same as -F"
]
" same as -F"
;
"--real"
,
Arg
.
Tuple
real_spec
,
" Takes 3 integers for the precision used in real computations \
[emin emax prec]. Example value for the precision of float32:\
-148 128 24"
;
]
let
config
,
_
,
env
=
Whyconf
.
Args
.
initialize
option_list
add_opt
usage_msg
...
...
@@ -67,8 +83,14 @@ let do_input f =
| Some d ->
*)
try
let
real_param
=
precision
()
in
let
res
=
if
real_param
<>
(
0
,
0
,
0
)
then
Pinterp
.
eval_global_symbol
~
real_param
env
m
else
Pinterp
.
eval_global_symbol
env
m
in
printf
"@[<hov 2>Execution of %s.%s ():@
\n
%a"
mid
name
(
Pinterp
.
eval_global_symbol
env
m
)
rs
res
rs
with
e
when
Debug
.
test_noflag
Debug
.
stack_trace
->
printf
"@
\n
@]@."
;
raise
e
in
...
...
@@ -78,8 +100,8 @@ let () =
try
Opt
.
iter
do_input
!
opt_file
with
e
when
not
(
Debug
.
test_flag
Debug
.
stack_trace
)
->
eprintf
"%a@."
Exn_printer
.
exn_printer
e
;
exit
1
eprintf
"%a@."
Exn_printer
.
exn_printer
e
;
exit
1
(*
Local Variables:
...
...
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