Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
af85d405
Commit
af85d405
authored
3 years ago
by
Andre Maroneze
Browse files
Options
Downloads
Patches
Plain Diff
[Kernel] use Filepath for option -ocode
parent
8ca1cf3c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/kernel_services/plugin_entry_points/kernel.ml
+10
-7
10 additions, 7 deletions
src/kernel_services/plugin_entry_points/kernel.ml
src/kernel_services/plugin_entry_points/kernel.mli
+1
-1
1 addition, 1 deletion
src/kernel_services/plugin_entry_points/kernel.mli
with
11 additions
and
8 deletions
src/kernel_services/plugin_entry_points/kernel.ml
+
10
−
7
View file @
af85d405
...
@@ -719,10 +719,12 @@ module PrintReturn =
...
@@ -719,10 +719,12 @@ module PrintReturn =
module
CodeOutput
=
struct
module
CodeOutput
=
struct
let
()
=
Parameter_customize
.
set_group
inout_source
let
()
=
Parameter_customize
.
set_group
inout_source
include
P
.
Empty_string
include
P
.
Filepath
(
struct
(
struct
let
option_name
=
"-ocode"
let
option_name
=
"-ocode"
let
arg_name
=
"filename"
let
arg_name
=
"filename"
let
existence
=
Filepath
.
Indifferent
let
file_kind
=
"source"
let
help
=
let
help
=
"when printing code, redirects the output to file <filename>"
"when printing code, redirects the output to file <filename>"
end
)
end
)
...
@@ -731,22 +733,23 @@ module CodeOutput = struct
...
@@ -731,22 +733,23 @@ module CodeOutput = struct
let
output
job
=
let
output
job
=
let
file
=
get
()
in
let
file
=
get
()
in
if
file
=
""
if
Filepath
.
Normalized
.(
is_special_stdout
file
||
is_empty
file
)
then
Log
.
print_delayed
job
then
Log
.
print_delayed
job
else
else
try
try
let
fmt
=
let
fmt
=
try
fst
(
Hashtbl
.
find
streams
file
)
try
fst
(
Hashtbl
.
find
streams
file
)
with
Not_found
->
with
Not_found
->
let
out
=
open_out
file
in
let
out
=
open_out
(
file
:>
string
)
in
let
fmt
=
Format
.
formatter_of_out_channel
out
in
let
fmt
=
Format
.
formatter_of_out_channel
out
in
Hashtbl
.
add
streams
file
(
fmt
,
out
)
;
fmt
Hashtbl
.
add
streams
file
(
fmt
,
out
)
;
fmt
in
in
job
fmt
job
fmt
with
Sys_error
s
->
with
Sys_error
s
->
warning
warning
"Fail to open file
\"
%s
\"
for code output@
\n
System error: %s.@
\n
\
"Fail to open file
\"
%a
\"
for code output@
\n
System error: %s.@
\n
\
Code is output on stdout instead."
file
s
;
Code is output on stdout instead."
Filepath
.
Normalized
.
pretty
file
s
;
Log
.
print_delayed
job
Log
.
print_delayed
job
let
close_all
()
=
let
close_all
()
=
...
@@ -757,8 +760,8 @@ module CodeOutput = struct
...
@@ -757,8 +760,8 @@ module CodeOutput = struct
close_out
cout
;
close_out
cout
;
with
Sys_error
s
->
with
Sys_error
s
->
failure
failure
"Fail to close output file
\"
%
s
\"
@
\n
System error: %s."
"Fail to close output file
\"
%
a
\"
@
\n
System error: %s."
file
s
)
Filepath
.
Normalized
.
pretty
file
s
)
streams
streams
let
()
=
Extlib
.
safe_at_exit
close_all
let
()
=
Extlib
.
safe_at_exit
close_all
...
...
This diff is collapsed.
Click to expand it.
src/kernel_services/plugin_entry_points/kernel.mli
+
1
−
1
View file @
af85d405
...
@@ -328,7 +328,7 @@ module PrintReturn : Parameter_sig.Bool
...
@@ -328,7 +328,7 @@ module PrintReturn : Parameter_sig.Bool
(** Behavior of option "-ocode".
(** Behavior of option "-ocode".
@plugin development guide *)
@plugin development guide *)
module
CodeOutput
:
sig
module
CodeOutput
:
sig
include
Parameter_sig
.
String
include
Parameter_sig
.
Filepath
val
output
:
(
Format
.
formatter
->
unit
)
->
unit
val
output
:
(
Format
.
formatter
->
unit
)
->
unit
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment