camlspotter avatar camlspotter committed 9ec1143

boobar

Comments (0)

Files changed (7)

ocamlspot/.depend

 command.cmi:
+dotfile.cmi:
 pathreparse.cmi: spotapi.cmi ../typing/path.cmi
 spotapi.cmi: ../typing/types.cmi ../typing/typedtree.cmi ../typing/spot.cmi \
     ../typing/path.cmi ../typing/ident.cmi
 xset.cmi:
 command.cmo: command.cmi
 command.cmx: command.cmi
-dotfile.cmo:
-dotfile.cmx:
+dotfile.cmo: dotfile.cmi
+dotfile.cmx: dotfile.cmi
 ocamlspot.cmo: xmain.cmi utils.cmi spotfile.cmi spoteval.cmi spotconfig.cmi \
     spotapi.cmi ../typing/printtyp.cmi pathreparse.cmi ../typing/path.cmi \
     ../typing/ident.cmi ../typing/env.cmi command.cmi ../typing/annot.cmi
     ../typing/path.cmx ../typing/ident.cmx spoteval.cmi
 spotfile.cmo: utils.cmi spoteval.cmi spotconfig_intf.cmo spotapi.cmi \
     ../typing/spot.cmi ../typing/path.cmi ../typing/ident.cmi \
-    ../typing/env.cmi dotfile.cmo ../typing/annot.cmi spotfile.cmi
+    ../typing/env.cmi dotfile.cmi ../typing/annot.cmi spotfile.cmi
 spotfile.cmx: utils.cmx spoteval.cmx spotconfig_intf.cmx spotapi.cmx \
     ../typing/spot.cmx ../typing/path.cmx ../typing/ident.cmx \
     ../typing/env.cmx dotfile.cmx ../typing/annot.cmi spotfile.cmi

ocamlspot/ocamlspot.ml

     (* CR jfuruse: dup *)
     Debug.format "ocamlspot %s%s@." path (C.SearchSpec.to_string spec);
     Debug.format "cwd: %s@." (Sys.getcwd ());
-    let path = File.spot_of_file path in
+    let path = File.spot_of_path path in
     let file = load path in
 
     begin match spec with
     (* CR jfuruse: dup *)
     Debug.format "ocamlspot %s%s@." path (C.SearchSpec.to_string spec);
     Debug.format "cwd: %s@." (Sys.getcwd ());
-    let path = File.spot_of_file path in
+    let path = File.spot_of_path path in
     let file = load path in
 
     let find_by_kind_path k path found =
   let recheck files =
     let recheck mlpath =
       Debug.format "cwd: %s@." (Sys.getcwd ());
-      let path = File.spot_of_file mlpath in
+      let path = File.spot_of_path mlpath in
       let file = File.load ~load_paths: ["."] path in
     
       Format.printf "Compile: %s@."

ocamlspot/spotapi.ml

 	  format_parent parent
 	  RAnnot.format rrspot) t
 end
+
+module Saved = struct
+  open Spot.Saved
+
+  let scan = function
+    | Structure str -> scan_structure str
+    | Structure_item sitem -> scan_structure_item sitem
+    | Signature sg -> scan_signature sg
+    | Signature_item sgitem -> scan_signature_item sgitem
+    | Expression expr -> scan_expr expr
+    | Module_type mtype -> scan_module_type mtype
+    | Pattern pat -> scan_pattern pat
+  
+(*
+  type 'a t = { region: Region.t; value: 'a }  
+*)
+    
+end

ocamlspot/spotfile.ml

   (* xxx.{ml,cmo,cmx,spot} => xxx.spot 
      xxx.{mli,cmi,spit} => xxx.spit
    *)        
-  let spot_of_file file =
+  let spot_of_path file =
     let dirname, filename =
       try
         let slash = String.rindex file '/' in
     let check_time_stamp ~spot source =
       let stat_spot = Unix.stat spot in
       let stat_source = Unix.stat source in
-        (* Needs = : for packed modules, .spot and the source .cmo are written 
-           almost at the same moment. *)
+      (* Needs = : for packed modules, .spot and the source .cmo are written 
+         almost at the same moment. *)
       stat_spot.Unix.st_mtime >= stat_source.Unix.st_mtime
 
     let find_alternative_source ~spot source =
-        (* if [source] is not found, we try finding files with the same basename
-           in
-           - the directory of [spot]
-           - the directory of [spot] points to (if [spot] is symlink)
-         *)
-        let source_base = Filename.basename source in
+      (* if [source] is not found, we try finding files with the same basename in
+         - the directory of [spot]
+         - the directory of [spot] points to (if [spot] is symlink)
+      *)
+      let source_base = Filename.basename source in
       let source_dirs =
           Filename.dirname spot ::
           begin 
           (* CR jfuruse: loading twice... *)
           Debug.format "Finding %a@." PIdent.format pid;
           let file = 
-            Load.load ~load_paths:[] (spot_of_file pid.PIdent.path) 
+            Load.load ~load_paths:[] (spot_of_path pid.PIdent.path) 
           in
           match pid.PIdent.ident with
           | None -> File_itself (* the whole file *)
   let _ = Eval.str_of_global_ident := str_of_global_ident
 
   let eval_packed env file =
-    let f = Load.load ~load_paths:[""] (spot_of_file (env.Env.cwd ^/ file)) in
+    let f = Load.load ~load_paths:[""] (spot_of_path (env.Env.cwd ^/ file)) in
     Value.Structure ({ PIdent.path = f.path; ident = None },
                     Eval.structure (empty_env f) f.top,
                     None (* packed has no .mli *))
         Format.eprintf "@[<2>Top@ %a@]@."
           format_structure str
     | Annots _ -> Format.eprintf "Annots [...]@."
+    | Saved (_,b) -> Format.eprintf "Saved ([...], %b)@." b
 
   let dump_elems elems = List.iter dump_elem elems
 end

ocamlspot/spotfile.mli

     | Load_paths of string list
     | Top of Abstraction.structure option
     | Annots of (Location.t * Annot.t) list
+    | Saved of Spot.Saved.t list * bool
 
   val dump : source: string option -> string -> unit
   val dump_package : prefix: string -> source: string -> string list -> unit
 	
   val dump_file : file -> unit
 
-  val spot_of_file : string -> string
+  val spot_of_path : string -> string
+  (** Path rename for spot files: 
+      xxx.{ml,cmo,cmx,spot} => xxx.spot 
+      xxx.{mli,cmi,spit} => xxx.spit
+  *)        
 
   exception Old_spot of string * string
+  (** Exception raised when the spot file is older than its source *)
+      
   val load : load_paths:string list -> string -> file
   val load_module : ?spit:bool -> load_paths:string list -> string -> file
     
     | Expression of expression
     | Module_type of module_type
     | Pattern of pattern
-    | Class_expr of class_expr
 
   val add : t -> unit
   val set : t -> unit
     | Expression of expression
     | Module_type of module_type
     | Pattern of pattern
-    | Class_expr of class_expr
 
   let saved = ref ([] : t list)
   let successful = ref false
     | Expression of expression
     | Module_type of module_type
     | Pattern of pattern
-    | Class_expr of class_expr
 
   val add : t -> unit
   val set : t -> unit
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.