camlspotter avatar camlspotter committed 678dc6f

checksum and cmt

Comments (0)

Files changed (2)

+let char16 = "0123456789abcdef"
+
+open Utils
+open Cmt_format
+
+let source_path file = match file.cmt_sourcefile with 
+    | Some f -> Some (file.cmt_builddir ^/ f)
+    | None -> None
+
+(* xxx.{ml,cmo,cmx,spot} => xxx.spot 
+   xxx.{mli,cmi,spit} => xxx.spit *)
+let of_path path =
+  let dirname, filename =
+    try
+      let slash = String.rindex path '/' in
+      Some (String.sub path 0 slash),
+      String.sub path (slash + 1) (String.length path - slash - 1)
+    with
+    | Not_found -> None, path
+  in
+  let filename =
+    match Filename.split_extension filename with
+    | body, (".cmi" | ".mli" | ".cmti") -> body ^ ".cmti"
+    | body, _ -> body ^ ".cmt"
+  in
+  match dirname with
+  | None -> filename
+  | Some d -> d ^/ filename
+
+(* CR jfuruse: this is a dirty workaround. It should be nice if we could know cmt is created by opt or byte *)          
+let is_opt cmt = 
+  List.exists (fun x -> match Filename.split_extension x with (_, ".cmx") -> true | _ -> false) (Array.to_list cmt.cmt_args)
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.