src/Pure/Thy/thy_read.ML
changeset 1580 e3fd931e6095
parent 1554 4ee99a973be4
child 1589 fd6a571cb2b0
equal deleted inserted replaced
1579:688e18023915 1580:e3fd931e6095
   297        let val ThyInfo {path = abs_path, ...} = the tinfo;
   297        let val ThyInfo {path = abs_path, ...} = the tinfo;
   298            val (thy_file, ml_file) = if abs_path = "" then new_filename ()
   298            val (thy_file, ml_file) = if abs_path = "" then new_filename ()
   299                                      else (find_file abs_path (name ^ ".thy"),
   299                                      else (find_file abs_path (name ^ ".thy"),
   300                                            find_file abs_path (name ^ ".ML"))
   300                                            find_file abs_path (name ^ ".ML"))
   301        in if thy_file = "" andalso ml_file = "" then
   301        in if thy_file = "" andalso ml_file = "" then
   302             (writeln ("Warning: File \"" ^ (tack_on path name)
   302             (warning ("File \"" ^ (tack_on path name)
   303                       ^ ".thy\"\ncontaining theory \"" ^ name
   303                       ^ ".thy\"\ncontaining theory \"" ^ name
   304                       ^ "\" no longer exists.");
   304                       ^ "\" no longer exists.");
   305              new_filename ()
   305              new_filename ()
   306             )
   306             )
   307           else (thy_file, ml_file)
   307           else (thy_file, ml_file)
   541         val relatives =
   541         val relatives =
   542           filter (fn s => s mem wanted_theories) (parents_of_name tname);
   542           filter (fn s => s mem wanted_theories) (parents_of_name tname);
   543       in mk_entry relatives end;
   543       in mk_entry relatives end;
   544   in if is_some (!cur_htmlfile) then
   544   in if is_some (!cur_htmlfile) then
   545        (close_out (the (!cur_htmlfile));
   545        (close_out (the (!cur_htmlfile));
   546         writeln "Warning: Last theory's HTML file has not been closed.")
   546         warning "Last theory's HTML file has not been closed.")
   547      else ();
   547      else ();
   548      cur_htmlfile := Some (open_out (tack_on tpath ("." ^ tname ^ ".html")));
   548      cur_htmlfile := Some (open_out (tack_on tpath ("." ^ tname ^ ".html")));
   549      cur_has_title := false;
   549      cur_has_title := false;
   550      output (the (!cur_htmlfile), gettext (tack_on tpath tname ^ ".thy"));
   550      output (the (!cur_htmlfile), gettext (tack_on tpath tname ^ ".thy"));
   551 
   551 
   666                 val tpath = tack_on rel_path ("." ^ tname);
   666                 val tpath = tack_on rel_path ("." ^ tname);
   667 
   667 
   668                 val fname = tack_on path ("." ^ t ^ "_sub.html");
   668                 val fname = tack_on path ("." ^ t ^ "_sub.html");
   669                 val out = if file_exists fname then
   669                 val out = if file_exists fname then
   670                             open_append fname  handle Io s =>
   670                             open_append fname  handle Io s =>
   671                               (writeln ("Warning: Unable to write to file ." ^
   671                               (warning ("Unable to write to file ." ^
   672                                         fname); raise Io s)
   672                                         fname); raise Io s)
   673                           else raise MK_HTML;
   673                           else raise MK_HTML;
   674             in output (out,
   674             in output (out,
   675                  " |\n \\__<A HREF=\"" ^
   675                  " |\n \\__<A HREF=\"" ^
   676                  tack_on rel_path ("." ^ tname) ^ ".html\">" ^ tname ^
   676                  tack_on rel_path ("." ^ tname) ^ ".html\">" ^ tname ^
  1037       thyinfo_of_sign (#sign (rep_thm thm))
  1037       thyinfo_of_sign (#sign (rep_thm thm))
  1038 
  1038 
  1039     val (thms', duplicate) = (Symtab.update_new ((name, thm), thms), false)
  1039     val (thms', duplicate) = (Symtab.update_new ((name, thm), thms), false)
  1040       handle Symtab.DUPLICATE s => 
  1040       handle Symtab.DUPLICATE s => 
  1041         (if eq_thm (the (Symtab.lookup (thms, name)), thm) then 
  1041         (if eq_thm (the (Symtab.lookup (thms, name)), thm) then 
  1042            (writeln ("Warning: Theory database already contains copy of\
  1042            (warning ("Theory database already contains copy of\
  1043                      \ theorem " ^ quote name);
  1043                      \ theorem " ^ quote name);
  1044             (thms, true))
  1044             (thms, true))
  1045          else error ("Duplicate theorem name " ^ quote s
  1045          else error ("Duplicate theorem name " ^ quote s
  1046                      ^ " used in theory database"));
  1046                      ^ " used in theory database"));
  1047 
  1047 
  1164      cd (!base_path);
  1164      cd (!base_path);
  1165      base_path := pwd();
  1165      base_path := pwd();
  1166      cd cwd;
  1166      cd cwd;
  1167 
  1167 
  1168      if cwd subdir_of (!base_path) then ()
  1168      if cwd subdir_of (!base_path) then ()
  1169      else writeln "Warning: The current working directory seems to be no \
  1169      else warning "The current working directory seems to be no \
  1170                   \subdirectory of\nIsabelle's main directory. \
  1170                   \subdirectory of\nIsabelle's main directory. \
  1171                   \Please ensure that base_path's value is correct.\n";
  1171                   \Please ensure that base_path's value is correct.\n";
  1172 
  1172 
  1173      writeln ("Setting path for index.html to " ^ quote cwd ^
  1173      writeln ("Setting path for index.html to " ^ quote cwd ^
  1174               "\nGIF path has been set to " ^ quote (!gif_path));
  1174               "\nGIF path has been set to " ^ quote (!gif_path));