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
df417ca3
Commit
df417ca3
authored
May 07, 2012
by
Andrei Paskevich
Browse files
store loadpath as a set of paths, not as a list
Thanks to Johannes Kanig for the suggestion.
parent
2726d45a
Changes
1
Show whitespace changes
Inline
Side-by-side
src/core/env.ml
View file @
df417ca3
...
...
@@ -39,7 +39,7 @@ exception TheoryNotFound of pathname * string
exception
AmbiguousPath
of
filename
*
filename
type
env
=
{
env_path
:
filename
lis
t
;
env_path
:
Sstr
.
t
;
env_tag
:
Hashweak
.
tag
;
}
...
...
@@ -50,11 +50,11 @@ module Wenv = Hashweak.Make(struct type t = env let tag = env_tag end)
(** Environment construction and utilisation *)
let
create_env
=
let
c
=
ref
(
-
1
)
in
fun
lp
->
{
env_path
=
lp
;
env_path
=
List
.
fold_right
Sstr
.
add
lp
Sstr
.
empty
;
env_tag
=
(
incr
c
;
Hashweak
.
create_tag
!
c
)
}
let
get_loadpath
env
=
env
.
env_path
let
get_loadpath
env
=
Sstr
.
elements
env
.
env_path
let
read_format_table
=
Hashtbl
.
create
17
(* format name -> read_format *)
let
extensions_table
=
Hashtbl
.
create
17
(* suffix -> format name *)
...
...
@@ -115,7 +115,7 @@ let locate_lib_file env path exts =
let
add_ext
ext
=
file
^
"."
^
ext
in
let
fl
=
if
exts
=
[]
then
[
file
]
else
List
.
map
add_ext
exts
in
let
add_dir
dir
=
List
.
map
(
Filename
.
concat
dir
)
fl
in
let
fl
=
List
.
concat
(
List
.
map
add_dir
env
.
env_path
)
in
let
fl
=
List
.
concat
(
List
.
map
add_dir
(
get_loadpath
env
)
)
in
match
List
.
filter
Sys
.
file_exists
fl
with
|
[]
->
raise
(
LibFileNotFound
path
)
|
[
file
]
->
file
...
...
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