Commit bd42472e authored by Pietro Abate's avatar Pietro Abate
Browse files

- now it is possible to run an object file specifying the full path

parent d8355078
...@@ -140,7 +140,7 @@ let rec print_exn ppf = function ...@@ -140,7 +140,7 @@ let rec print_exn ppf = function
Format.fprintf ppf "Source filename must have extension .cd@."; Format.fprintf ppf "Source filename must have extension .cd@.";
| InvalidObjectFilename f -> | InvalidObjectFilename f ->
Format.fprintf ppf "Compilation error:@."; Format.fprintf ppf "Compilation error:@.";
Format.fprintf ppf "Object filename must have extension .cdo and no path@."; Format.fprintf ppf "Object filename must have extension .cdo@.";
| Librarian.InvalidObject f -> | Librarian.InvalidObject f ->
Format.fprintf ppf "Invalid object file %s@." f Format.fprintf ppf "Invalid object file %s@." f
| Librarian.CannotOpen f -> | Librarian.CannotOpen f ->
...@@ -341,15 +341,15 @@ let compile_run src = ...@@ -341,15 +341,15 @@ let compile_run src =
with exn -> catch_exn Format.err_formatter exn; exit 1 with exn -> catch_exn Format.err_formatter exn; exit 1
let run obj = let run obj =
Cduce_loc.obj_path := (Filename.dirname obj)::!Cduce_loc.obj_path ;
let obj = Filename.basename obj in
try try
if not (Filename.check_suffix obj ".cdo") || (Filename.basename obj <> obj) if not (Filename.check_suffix obj ".cdo") then raise (InvalidObjectFilename obj);
then raise (InvalidObjectFilename obj);
let name = Filename.chop_suffix (Filename.basename obj) ".cdo" in let name = Filename.chop_suffix (Filename.basename obj) ".cdo" in
let name = U.mk_latin1 name in let name = U.mk_latin1 name in
Librarian.load_run name Librarian.load_run name
with exn -> catch_exn Format.err_formatter exn; exit 1 with exn -> catch_exn Format.err_formatter exn; exit 1
let dump_env ppf = dump_env ppf !typing_env !compile_env let dump_env ppf = dump_env ppf !typing_env !compile_env
let eval s = let eval s =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment