Commits

camlspotter committed ef89534

cleanup

Comments (0)

Files changed (1)

ocamlspot/ocamlspot.ml

 module Kind = struct
   include Kind
 
-  (* debug purpose. 'k' is to make their type clearer *)
+  (* debug purpose. *)
   let to_string = function
-    | Value -> "kValue"
-    | Type -> "kType"
-    | Exception -> "kException" 
-    | Module -> "kModule"
-    | Module_type -> "kModule_type"
-    | Class -> "kClass"
-    | Class_type -> "kClass_type"
+    | Value -> "Value"
+    | Type -> "Type"
+    | Exception -> "Exception" 
+    | Module -> "Module"
+    | Module_type -> "Module_type"
+    | Class -> "Class"
+    | Class_type -> "Class_type"
 
   (* for messages *)
   let name = function
 
   (* used for query interface *)        
   let from_string = function
-    | "v" -> Value
-    | "t" -> Type
-    | "e" -> Exception
-    | "m" -> Module
-    | "mt" -> Module_type
-    | "c" -> Class
-    | "ct" -> Class_type
+    | "v" | "value" -> Value
+    | "t" | "type" -> Type
+    | "e" | "exception" -> Exception
+    | "m" | "module" -> Module
+    | "mt" | "module_type" -> Module_type
+    | "c" | "class" -> Class
+    | "ct" | "class_type" -> Class_type
     | _ -> raise Not_found
 end
 
   let eager_dump = ref false
   let no_definition_analysis = ref false
   let strict_time_stamp = ref false
+  let print_file_info = ref false
 
   let _ = 
     Arg.parse 
         "--eager-dump", Arg.Set eager_dump, " eager evaluation at dump";
         "-n", Arg.Set no_definition_analysis, " no definition analysis";
         "--strict-time-stamp", Arg.Set strict_time_stamp, " error at newer source files than their spots";
+        "-i", Arg.Set print_file_info, " print file information";
       ]
       (fun s -> 
 	match !spec with
   let eager_dump = !eager_dump
   let no_definition_analysis = !no_definition_analysis
   let strict_time_stamp = !strict_time_stamp
-
+  let print_file_info = !print_file_info
+      
   let dump_any = 
     dump_file (* ? dump_file *) || dump_lannots || dump_tree || dump_top || dump_flat
 
 
   let f () = 
 
-    Format.printf "ocamlspot %s:%s@." 
+    Debug.format "ocamlspot %s:%s@." 
       Config.mlpath (Config.Spec.to_string Config.spec);
-    Format.printf "cwd: %s@." (Sys.getcwd ());
+    Debug.format "cwd: %s@." (Sys.getcwd ());
 
     let path = File.spot_of_file Config.mlpath in
     let file = File.Load.load ~load_paths: ["."] path in
     if Config.dump_top then Dump.top file;
     if Config.dump_flat then Dump.flat file;
 
-    Format.printf "Compile: %s@."
-      (String.concat " " 
-          (List.map Command.escaped_for_shell 
-              (Array.to_list file.File.argv)));
+    if Config.print_file_info then
+      Format.printf "Compile: %s@."
+        (String.concat " " 
+            (List.map Command.escaped_for_shell 
+                (Array.to_list file.File.argv)));
 
-    Format.printf "@[<v2>Included_dirs:@ %a@]@."
-      (Format.list "" Format.pp_print_string)
-      file.File.load_paths;
+    if Config.print_file_info then
+      Format.printf "@[<v2>Included_dirs:@ %a@]@."
+        (Format.list "" Format.pp_print_string)
+        file.File.load_paths;
 
     if Config.dump_any then bye 0;
 
 end
 
 let _ = Main.f ()
-