camlspotter avatar camlspotter committed e1f7404

cleanup

Comments (0)

Files changed (5)

     | (_, ".cmx") -> true 
     | _ -> false) (Array.to_list cmt.cmt_args)
 
+(* CR jfuruse: This module should be removed once OCaml compilier-libs has the env restoration function *)
 module Envaux = struct (* copied from debugger/envaux.ml *)
   open Misc
   open Types
 open Cmt_format
 
 val source_path : cmt_infos -> string option
-  (** returns the full path of the source file *)
+(** returns the full path of the source file *)
 
 val of_path : string -> string
-  (** get the corresponding cmt/cmti path name of the given file name:
-      of_path "dir/x.cmi" = "dir/x.cmti"
-      of_path "dir/x.ml"  = "dir/x.cmt"
-  *)
+(** get the corresponding cmt/cmti path name of the given file name:
+    of_path "dir/x.cmi" = "dir/x.cmti"
+    of_path "dir/x.ml"  = "dir/x.cmt"
+*)
 
 val is_opt : cmt_infos -> bool
-  (** Guess the cmt is created by opt(native code) compilation *)
+(** Guess the cmt is created by opt(native code) compilation *)
 
 val recover_env : Env.t -> Env.t
-  (** Type environments in cmt are simplified and just have env summaries.
-      If we want the real environment, we need to recover it from the summary. *)
+(** Type environments in cmt are simplified and just have env summaries.
+    If we want the real environment, we need to recover it from the summary. *)
 val reset_env_cache : unit -> unit
+(** Reset the environment restoration cache *)
 *)
 
 (* general escape *)
-let escaped pred s =
+let escape pred s =
   let b = Buffer.create (String.length s) in
   String.iter (fun c ->
     if pred c then Buffer.add_char b '\\';
   Buffer.contents b
 ;;
 
-let escaped_for_shell =
-  escaped (function
+let escape_for_shell =
+  escape (function
     | '|' | '&' | ';' | '(' | ')' | '<' | '>' | ' ' | '\t'
     | '!'
     | '\\' | '\'' | '"' -> true
 ;;
 
 let shell args = 
-  Sys.command (String.concat " " (List.map escaped_for_shell args))
+  Sys.command (String.concat " " (List.map escape_for_shell args))
 ;;
 
    
 (*                                                                     *)
 (***********************************************************************)
 
-val escaped : (char -> bool) -> string -> string
-val escaped_for_shell : string -> string
+val escape : (char -> bool) -> string -> string
+(** escapes each char in the string which matches the predicate by a backslash *)
+
+val escape_for_shell : string -> string
+(** escapes shell special chars *)
+
 val shell : string list -> int
+(** execute shell command by [Sys.command] *)
     let file = load (Cmt.of_path path) in
     printf "Compile: %s@."
       (String.concat " " 
-         (List.map Command.escaped_for_shell 
+         (List.map Command.escape_for_shell 
             (Array.to_list file.Unit.args)));
     printf "@[<v2>Included_dirs:@ %a@]@."
       (Format.list "" pp_print_string)
     
       printf "Compile: %s@."
         (String.concat " " 
-          (List.map Command.escaped_for_shell 
+          (List.map Command.escape_for_shell 
             (Array.to_list file.Unit.argv)));
       let command = 
 	Sys.argv.(0) :: List.tl (Array.to_list file.Unit.argv) 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.