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
46427f64
Commit
46427f64
authored
8 months ago
by
Kilyan Le Gallic
Committed by
Allan Blanchard
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
[wp] Conversion of Why3.Loc to Cil_types.Location
parent
a9a3244f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/wp/Why3Import.ml
+46
-3
46 additions, 3 deletions
src/plugins/wp/Why3Import.ml
with
46 additions
and
3 deletions
src/plugins/wp/Why3Import.ml
+
46
−
3
View file @
46427f64
...
@@ -84,6 +84,8 @@ let pp_id_loc fmt (id : W.Ident.ident) =
...
@@ -84,6 +84,8 @@ let pp_id_loc fmt (id : W.Ident.ident) =
|
Some
loc
->
W
.
Loc
.
pp_position
fmt
loc
|
Some
loc
->
W
.
Loc
.
pp_position
fmt
loc
|
None
->
L
.
error
"No location found"
|
None
->
L
.
error
"No location found"
(* For debug only*)
(* For debug only*)
let
pp_lti
fmt
(
lti
:
C
.
logic_type_info
)
=
let
pp_lti
fmt
(
lti
:
C
.
logic_type_info
)
=
Cpp
.
pp_logic_type_info
fmt
lti
Cpp
.
pp_logic_type_info
fmt
lti
...
@@ -92,6 +94,7 @@ let pp_lti fmt (lti : C.logic_type_info) =
...
@@ -92,6 +94,7 @@ let pp_lti fmt (lti : C.logic_type_info) =
let
pp_li
fmt
(
li
:
C
.
logic_info
)
=
let
pp_li
fmt
(
li
:
C
.
logic_info
)
=
Cpp
.
pp_logic_info
fmt
li
Cpp
.
pp_logic_info
fmt
li
(* For debug only*)
(* For debug only*)
let
pp_lvs
fmt
(
lvs
:
C
.
logic_var
list
)
=
let
pp_lvs
fmt
(
lvs
:
C
.
logic_var
list
)
=
List
.
iter
(
fun
(
lv
:
C
.
logic_var
)
->
List
.
iter
(
fun
(
lv
:
C
.
logic_var
)
->
...
@@ -134,6 +137,7 @@ let create_empty_env wenv =
...
@@ -134,6 +137,7 @@ let create_empty_env wenv =
let
menv
=
Datatype
.
String
.
Hashtbl
.
create
0
in
let
menv
=
Datatype
.
String
.
Hashtbl
.
create
0
in
{
wenv
;
tenv
;
lenv
;
lils
;
ltits
;
menv
}
{
wenv
;
tenv
;
lenv
;
lils
;
ltits
;
menv
}
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
(* --- Built-in --- *)
(* --- Built-in --- *)
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
...
@@ -158,6 +162,38 @@ let add_builtins env =
...
@@ -158,6 +162,38 @@ let add_builtins env =
add_builtin
env
.
tenv
ts_set
"set"
[
"A"
];
add_builtin
env
.
tenv
ts_set
"set"
[
"A"
];
end
end
(* -------------------------------------------------------------------------- *)
(* --- Location handling --- *)
(* -------------------------------------------------------------------------- *)
let
convert_location
(
wloc
:
Why3
.
Loc
.
position
)
:
C
.
location
=
let
(
file
,
lstart
,
cstart
,
lend
,
cend
)
=
Why3
.
Loc
.
get
wloc
in
let
pstart
=
{
Filepath
.
pos_path
=
F
.
of_string
file
;
pos_lnum
=
lstart
;
pos_bol
=
0
;
pos_cnum
=
cstart
;
}
in
let
pend
=
{
Filepath
.
pos_path
=
F
.
of_string
file
;
pos_lnum
=
lend
;
pos_bol
=
0
;
pos_cnum
=
cend
;
}
in
(
pstart
,
pend
)
(* For debug use only *)
let
pp_cil_loc
fmt
(
id
:
W
.
Ident
.
ident
)
=
match
id
.
id_loc
with
|
Some
loc
->
Cpp
.
pp_location
fmt
(
convert_location
loc
)
|
None
->
L
.
error
"No location found"
let
pp_cil_loc_pos
fmt
(
id
:
W
.
Ident
.
ident
)
=
match
id
.
id_loc
with
|
Some
loc
->
let
(
ps
,
pe
)
=
convert_location
loc
in
Filepath
.
pp_pos
fmt
ps
;
Filepath
.
pp_pos
fmt
pe
;
|
None
->
L
.
error
"No location found"
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
(* --- Type conversion --- *)
(* --- Type conversion --- *)
...
@@ -309,7 +345,8 @@ let () =
...
@@ -309,7 +345,8 @@ let () =
Datatype
.
String
.
Hashtbl
.
iter
(
fun
(
s
)
(
why3mod
)
->
Datatype
.
String
.
Hashtbl
.
iter
(
fun
(
s
)
(
why3mod
)
->
L
.
result
"@[Module %s at %s@]"
s
(
String
.
concat
"::"
why3mod
.
paths
);
L
.
result
"@[Module %s at %s@]"
s
(
String
.
concat
"::"
why3mod
.
paths
);
List
.
iter
(
fun
(
li
)
->
List
.
iter
(
fun
(
li
)
->
L
.
result
"Logic : @[<hov1>%a@]"
pp_li
li
)
L
.
result
"Logic : @[<hov1>%a@]"
pp_li
li
;
)
why3mod
.
logics
;
why3mod
.
logics
;
List
.
iter
(
fun
(
lti
)
->
List
.
iter
(
fun
(
lti
)
->
L
.
result
"Type : @[<hov1>%a@]"
pp_lti
lti
)
L
.
result
"Type : @[<hov1>%a@]"
pp_lti
lti
)
...
@@ -317,11 +354,17 @@ let () =
...
@@ -317,11 +354,17 @@ let () =
)
env
.
menv
;
)
env
.
menv
;
Logic_type_info
.
Hashtbl
.
iter
(
fun
(
lti
)
(
ts
)
->
Logic_type_info
.
Hashtbl
.
iter
(
fun
(
lti
)
(
ts
)
->
L
.
result
"Logic type info : %a is associated to ts : %a "
L
.
result
"Logic type info : %a is associated to ts : %a "
pp_lti
lti
pp_tys
ts
)
pp_lti
lti
pp_tys
ts
;
L
.
result
"Logic type info located at : %a"
pp_id_loc
ts
.
ts_name
;
L
.
result
"CIL Location will be %a"
pp_cil_loc
ts
.
ts_name
;
L
.
result
"with positions %a"
pp_cil_loc_pos
ts
.
ts_name
)
env
.
ltits
;
env
.
ltits
;
Logic_info
.
Hashtbl
.
iter
(
fun
(
li
)
(
ls
)
->
Logic_info
.
Hashtbl
.
iter
(
fun
(
li
)
(
ls
)
->
L
.
result
"Logic info %a is associated to ls : %a "
L
.
result
"Logic info %a is associated to ls : %a "
pp_li
li
pp_ls
ls
)
pp_li
li
pp_ls
ls
;
L
.
result
"Logic info located at : %a"
pp_id_loc
ls
.
ls_name
;
L
.
result
"CIL Location will be %a"
pp_cil_loc
ls
.
ls_name
;
L
.
result
"with positions %a"
pp_cil_loc_pos
ls
.
ls_name
)
env
.
lils
;
env
.
lils
;
end
end
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