Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

Commit

Permalink
* code_map/view2.ml: remove redundant parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
pad committed Mar 6, 2014
1 parent af8c637 commit b90e1de
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 23 deletions.
4 changes: 2 additions & 2 deletions code_map/view2.ml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ let expose_legend da w _ev =
(*****************************************************************************)

(*s: mk_gui() *)
let mk_gui ~screen_size ~legend test_mode (root, model, w) =
let mk_gui ~screen_size ~legend test_mode (root, w) =
(* ugly, todo use model.root instead? *)
let root_orig () =
raise Todo
Expand Down Expand Up @@ -367,7 +367,7 @@ let mk_gui ~screen_size ~legend test_mode (root, model, w) =
*)
let idx = (fun () ->
let model = Async.async_get model in
let model = Async.async_get w.model in
model.Model2.big_grep_idx
)
in
Expand Down
2 changes: 1 addition & 1 deletion code_map/view2.mli
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ val mk_gui :
screen_size:int ->
legend:bool ->
'b option ->
(string (* root *) * Model2.model Async.t * Model2.world) ->
(string (* root *) * Model2.world) ->
unit
(*e: mk_gui sig *)
(*e: view2.mli *)
31 changes: 11 additions & 20 deletions main_codemap.ml
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,14 @@ let build_model2 root dbfile_opt graphfile_opt =

let db_opt = dbfile_opt +> Common.map_opt Database_code.load_database in
(* todo: and skip_list?
* todo: opti by factorizing the 'find' with treemap_generator?
* less: opti by factorizing the 'find' with treemap_generator?
*)
let files =
Common.files_of_dir_or_files_no_vcs_nofilter [root] +> List.filter !filter
in

let hentities, all_entities =
Model_database_code.hentities root db_opt,
Model_database_code.all_entities ~root files db_opt
in

let hentities = Model_database_code.hentities root db_opt in
let all_entities = Model_database_code.all_entities ~root files db_opt in
let big_grep_idx = Completion2.build_completion_defs_index all_entities in

let g_opt = graphfile_opt +> Common.map_opt Graph_code.load in
Expand All @@ -255,8 +252,7 @@ let build_model2 root dbfile_opt graphfile_opt =
db = db_opt;
hentities; big_grep_idx;
g = g_opt;
huses_of_file; husers_of_file;
hentities_of_file;
huses_of_file; husers_of_file; hentities_of_file;
}
in
model
Expand All @@ -266,8 +262,7 @@ let build_model a b =
build_model2 a b)
(*e: build_model *)

(* could also try to parse all json files and filter the one which do
* not parse *)
(* could also to parse all json files and filter the one which do not parse *)
let layers_in_dir dir =
Common2.readdir_to_file_list dir +> Common.map_filter (fun file ->
if file =~ "layer.*json"
Expand All @@ -284,7 +279,7 @@ let main_action xs =
set_gc ();
Logger.log Config_pfff.logger "codemap" None;

(* thi used to be done by linking with gtkInit.cmo, but better like this *)
(* this used to be done by linking with gtkInit.cmo, but better like this *)
let _locale = GtkMain.Main.init () in
pr2 (spf "Using Cairo version: %s" Cairo.compile_time_version_string);

Expand All @@ -297,16 +292,14 @@ let main_action xs =
match !layer_file, !layer_dir, xs with
| Some file, _, _ ->
[Layer_code.load_layer file]
| None, Some dir, _
| None, None, [dir] ->
| None, Some dir, _ | None, None, [dir] ->
layers_in_dir dir +> List.map Layer_code.load_layer
| _ -> []
in
let layers_with_index =
Layer_code.build_index_of_layers ~root
(match layers with
(* not active by default ? it causes some problems *)
| [layer] -> [layer, false]
(match !layer_file, layers with
| Some _, [layer] -> [layer, true]
| _ -> layers +> List.map (fun x -> x, false)
)
in
Expand Down Expand Up @@ -360,9 +353,7 @@ let main_action xs =
in

let treemap_func = treemap_generator ~filter_file in
let dw =
Model.init_drawing treemap_func layers_with_index xs root
in
let dw = Model.init_drawing treemap_func layers_with_index xs root in

(* This can require lots of stack. Make sure to have ulimit -s 40000.
* This thread also cause some Bus error on MacOS :(
Expand Down Expand Up @@ -401,7 +392,7 @@ let main_action xs =
~screen_size:!screen_size
~legend:!legend
!test_mode
(root, async_model, w)
(root, w)
(*e: main_action() *)

(*****************************************************************************)
Expand Down

0 comments on commit b90e1de

Please sign in to comment.