Commit 55396757 authored by Andre Maroneze's avatar Andre Maroneze

WIP: fix symbolic path

parent cb1f0d26
......@@ -24,8 +24,6 @@
(** {2 Kernel as an almost standard plug-in} *)
(* ************************************************************************* *)
module CamlString = String
let () = Plugin.register_kernel ()
module P = Plugin.Register
......@@ -246,13 +244,6 @@ module String
include X
end)
module String_set(X: Input_with_arg) =
P.String_set
(struct
let () = Parameter_customize.set_module_name X.module_name
include X
end)
module String_list(X: Input_with_arg) =
P.String_list
(struct
......@@ -592,17 +583,48 @@ module Time =
end)
let () = Parameter_customize.set_group messages
let () = Parameter_customize.do_not_projectify ()
module SymbolicPath =
String_set (* TODO: to be replaced by an hashtbl *)
Filepath_map
(struct
let option_name = "-add-symbolic-path"
let module_name = "SymbolicPath"
let arg_name = "name_1:path_1,...,name_n:path_n"
let option_name = "-add-symbolic-path"
let arg_name = "path_1:name_1,...,path_n:name_n"
let existence = Filepath.Indifferent
let file_kind = "directory"
let help =
"When displaying file locations, replace (absolute) path by the \
"When displaying file locations, replace (absolute) path with the \
corresponding symbolic name"
end)
module SymbolicPathTable =
State_builder.Hashtbl
(Datatype.Filepath.Hashtbl)
(Datatype.String)
(struct
let name = "Kernel.SymbolicPathTable"
let dependencies = [SymbolicPath.self]
let size = 3
end)
let () =
SymbolicPath.add_update_hook
(fun _o _n ->
SymbolicPath.iter (fun (p, os) ->
match os with
| Some s ->
SymbolicPathTable.replace p s;
Filepath.add_symbolic_dir s (p :> string)
| None -> ()
);
)
let () = Cmdline.run_after_configuring_stage (fun () ->
SymbolicPathTable.iter (fun p s ->
Filepath.add_symbolic_dir s (p :> string)
);
)
(* ************************************************************************* *)
(** {2 Input / Output Source Code} *)
......@@ -699,22 +721,6 @@ module CodeOutput = struct
end
let add_path s =
try
let n = CamlString.index s ':' in
let name = CamlString.sub s 0 n in
let path = CamlString.sub s (n+1) (CamlString.length s - (n+1)) in
Filepath.add_symbolic_dir name path
with Not_found ->
warning "%s is not a valid option argument for -add-symbolic-path. \
It will be ignored" s
let () =
SymbolicPath.add_set_hook
(fun o n ->
let d = Datatype.String.Set.diff n o in
Datatype.String.Set.iter add_path d)
let () = Parameter_customize.set_group inout_source
let () = Parameter_customize.do_not_projectify ()
module FloatNormal =
......
......@@ -292,8 +292,9 @@ module CodeOutput : sig
end
(** Behavior of option "-add-symbolic-path"
@since Neon-20140301 *)
module SymbolicPath: Parameter_sig.String_set
@since Neon-20140301
@modify Frama-C+dev inversed argument order (now uses path:name) *)
module SymbolicPath: Parameter_sig.Filepath_map with type value = string
module FloatNormal: Parameter_sig.Bool
(** Behavior of option "-float-normal" *)
......
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