X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fcomponents%2Fbinaries%2Fmatitadep%2Fmatitadep.ml;h=0415a5111f1b02821ad8612d68dc1f43997e4fa8;hb=a8c3c72dc1776997c1ce6deae88c9aa9abbf7766;hp=de8f3d65db7a03d2f9f88b814890bb38ba00c599;hpb=774c5e125eb44693a5a760226713067c41baf09f;p=helm.git diff --git a/matita/components/binaries/matitadep/matitadep.ml b/matita/components/binaries/matitadep/matitadep.ml index de8f3d65d..0415a5111 100644 --- a/matita/components/binaries/matitadep/matitadep.ml +++ b/matita/components/binaries/matitadep/matitadep.ml @@ -46,9 +46,29 @@ let check () = let iter fname file = ignore (compute [] fname file) in Hashtbl.iter iter graph +let get_unions () = + let map1 ddeps dname = StringSet.add dname ddeps in + let map2 fname file (fnames, ddeps) = + StringSet.add fname fnames, List.fold_left map1 ddeps file.ddeps + in + Hashtbl.fold map2 graph (StringSet.empty, StringSet.empty) + +let top () = + let iter dname = Printf.printf "top: %s\n" dname in + let fnames, ddeps = get_unions () in + StringSet.iter iter (StringSet.diff fnames ddeps) + let rec read ich = let _ = Scanf.sscanf (input_line ich) "%s@:include \"%s@\"." init in read ich let _ = - try read stdin with End_of_file -> check () + let show_top = ref false in + let process_file name = () in + let help = "" in + let help_t = " Print the top nodes of the dependences graph" in + Arg.parse [ + "-t", Arg.Set show_top, help_t; + ] process_file help; + try read stdin with End_of_file -> + if !show_top then top () else check ()