1. camlspotter
  2. mutated_ocaml

Commits

camlspotter  committed d3b64c4

version

  • Participants
  • Parent commits f334a2d
  • Branches ocamlspot-3120rc1

Comments (0)

Files changed (2)

File ocamlspot/ocamlspot.ml

View file
  • Ignore whitespace
 
 module Config = struct
 
+  let version =
+    Printf.sprintf "%s.%s for ocaml %s"
+      Spot.version app_version Spot.ocaml_version
+
   let print_version () =
-    Format.eprintf "ocamlspot version: %s.%s for ocaml %s@."
-      Spot.version app_version Spot.ocaml_version
+    Format.eprintf "ocamlspot %s@." version
       
   let spec = ref None
   let (* dump_file_ref => *) dump_file (* <= dump_file_ref *) = ref false
         | Some _ -> failwith "you can specify only one search"
         | None -> spec := Some s)
       (Printf.sprintf 
-          "ocamlspot search\nversion %s.%s\n\
+          "ocamlspot search\nversion %s\n\
 \tsearch ::= file | file:pos | file:kind:path\n\
 \tpos ::= l<line>c<column> | b<bytes>\n\
 \tkind ::= v|t|e|m|mt|c|ct"
-          Spot.version app_version)
+          version)
 
   let (* dump_file => *) dump_file (* <= dump_file *) = !dump_file (* ? dump_file_ref *)
   let dump_rannots = !dump_rannots
     path : string; (* "" means no source *)
     cwd : string;
     load_paths : string list;
-    version : string;
+    version : string * string;
     argv : string array;
     top : Abstraction.structure;
     flat : Abstraction.structure;
   }
 
   let dump file =
-    Format.eprintf "@[<2>{ path= %S;@ cwd= %S;@ load_paths= [ @[%a@] ];@ version= %S;@ argv= [| @[%a@] |]; ... }@]@."
+    Format.eprintf "@[<2>{ path= %S;@ cwd= %S;@ load_paths= [ @[%a@] ];@ version= %S,%S;@ argv= [| @[%a@] |]; ... }@]@."
       (match file.path with 
       | "" -> "NONE"
       | s -> s)
         file.cwd
         (Format.list "; " (fun ppf s -> Format.fprintf ppf "%S" s)) file.load_paths
-        file.version
+      (fst file.version) (snd file.version)
         (Format.list "; " (fun ppf s -> Format.fprintf ppf "%S" s)) (Array.to_list file.argv)
 
   (* xxx.{ml,cmo,cmx,spot} => xxx.spot 
       in
       if magic_number_in_file <> magic_number then 
         failwith (Printf.sprintf "Not a spot file: %s" file);
-      let file_version : string = input_value ic in
-      if Spot.version <> file_version then begin
-          failwith (Printf.sprintf "Incompatible spot file version %s (must be %s)" 
-                       file_version Spot.version);
-        end;
+      let file_version : string * string = input_value ic in
+      if (Spot.ocaml_version, Spot.version) <> file_version then begin
+        failwith 
+	  (Printf.sprintf "Incompatible spot file version %s for ocaml %s (must be %s for ocaml %s)" 
+              (fst file_version) (snd file_version)
+	      Spot.version Spot.ocaml_version);
+      end;
       let v : File.t = input_value ic in
       close_in ic;
       file_version, v
+    ;;
 
     let load_directly path : file =
       Debug.format "spot loading from %s@." path;

File typing/spot.ml

View file
  • Ignore whitespace
         | Some p -> Some (Filename.concat (Sys.getcwd ()) p)
       in
       output_string oc magic_number;
-      output_value oc version;
+      output_value oc (ocaml_version, version);
       Marshal.to_channel oc 
         [ Argv Sys.argv;
 	  Source_path source;