Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
76181482
Commit
76181482
authored
Jul 10, 2007
by
Pietro Abate
Browse files
[r2005-06-13 12:30:03 by afrisch] Import nested OCaml modules
Original author: afrisch Date: 2005-06-13 12:30:03+00:00
parent
e5369987
Changes
3
Hide whitespace changes
Inline
Side-by-side
ocamliface/mlstub.ml
View file @
76181482
...
...
@@ -598,7 +598,7 @@ let gen_wrapper vals =
try
(
s
,
fst
(
Mltypes
.
find_value
s
))
::
accu
with
Not_found
->
let
vals
=
try
Mltypes
.
load_
cmi
s
try
Mltypes
.
load_
module
s
with
Not_found
->
failwith
(
"Cannot resolve "
^
s
)
in
...
...
ocamliface/mltypes.ml
View file @
76181482
...
...
@@ -196,13 +196,10 @@ let find_value v =
Config
.
load_path
:=
Config
.
standard_library
::
!
Librarian
.
obj_path
;
let
li
=
Longident
.
parse
v
in
ocaml_env
:=
Env
.
initial
;
let
(
p
,
vd
)
=
Env
.
lookup_value
li
Env
.
initial
in
let
(
_
,
vd
)
=
Env
.
lookup_value
li
Env
.
initial
in
unfold
vd
.
val_type
let
load_cmi
name
=
Config
.
load_path
:=
Config
.
standard_library
::
!
Librarian
.
obj_path
;
let
filename
=
Misc
.
find_in_path_uncap
!
Config
.
load_path
(
name
^
".cmi"
)
in
let
sg
=
Env
.
read_signature
name
filename
in
let
values_of_sig
name
sg
=
List
.
fold_left
(
fun
accu
v
->
match
v
with
|
Tsig_value
(
id
,_
)
->
...
...
@@ -216,8 +213,25 @@ let load_cmi name =
|
_
->
accu
)
[]
sg
let
load_cmi
name
=
try
load_cmi
name
let
load_module
name
=
Config
.
load_path
:=
Config
.
standard_library
::
!
Librarian
.
obj_path
;
let
li
=
Longident
.
parse
name
in
ocaml_env
:=
Env
.
initial
;
let
(
_
,
mty
)
=
Env
.
lookup_module
li
Env
.
initial
in
match
mty
with
|
Tmty_signature
sg
->
values_of_sig
name
sg
|
_
->
raise
(
Loc
.
Generic
(
Printf
.
sprintf
"Module %s is not a structure"
name
))
(*
let filename = Misc.find_in_path_uncap !Config.load_path (name ^ ".cmi") in
let sg = Env.read_signature name filename in
values_of_sig sg
*)
let
load_module
name
=
try
load_module
name
with
Env
.
Error
e
->
Env
.
report_error
Format
.
str_formatter
e
;
let
s
=
Format
.
flush_str_formatter
()
in
...
...
ocamliface/mltypes.mli
View file @
76181482
...
...
@@ -19,7 +19,7 @@ and def =
(* Load an external .cmi *)
val
has_cmi
:
string
->
bool
val
load_
cmi
:
string
->
(
string
*
t
)
list
val
load_
module
:
string
->
(
string
*
t
)
list
(* Load the .cmi corresponding to a CDuce compilation unit *)
val
read_cmi
:
string
->
string
*
(
string
*
Types
.
type_expr
*
t
)
list
...
...
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