src/Pure/Thy/thy_info.ML
changeset 24057 f42665561801
parent 23982 e3c4c0b9ae05
child 24068 245b7e68a3bc
equal deleted inserted replaced
24056:e134e757fc64 24057:f42665561801
     7 *)
     7 *)
     8 
     8 
     9 signature BASIC_THY_INFO =
     9 signature BASIC_THY_INFO =
    10 sig
    10 sig
    11   val theory: string -> theory
    11   val theory: string -> theory
    12 (*val use: string -> unit*)             (*exported later*)
       
    13   val time_use: string -> unit
       
    14   val touch_thy: string -> unit
    12   val touch_thy: string -> unit
    15   val use_thy: string -> unit
       
    16   val use_thys: string list -> unit
       
    17   val update_thy: string -> unit
       
    18   val remove_thy: string -> unit
    13   val remove_thy: string -> unit
    19   val time_use_thy: string -> unit
       
    20 end;
    14 end;
    21 
    15 
    22 signature THY_INFO =
    16 signature THY_INFO =
    23 sig
    17 sig
    24   include BASIC_THY_INFO
    18   include BASIC_THY_INFO
    36   val loaded_files: string -> Path.T list
    30   val loaded_files: string -> Path.T list
    37   val touch_child_thys: string -> unit
    31   val touch_child_thys: string -> unit
    38   val touch_all_thys: unit -> unit
    32   val touch_all_thys: unit -> unit
    39   val load_file: bool -> Path.T -> unit
    33   val load_file: bool -> Path.T -> unit
    40   val use: string -> unit
    34   val use: string -> unit
       
    35   val time_use: string -> unit
    41   val pretend_use_thy_only: string -> unit
    36   val pretend_use_thy_only: string -> unit
       
    37   val use_thys: string list -> unit
       
    38   val use_thy: string -> unit
       
    39   val time_use_thy: string -> unit
       
    40   val update_thy: string -> unit
    42   val begin_theory: string -> string list -> (Path.T * bool) list -> bool -> theory
    41   val begin_theory: string -> string list -> (Path.T * bool) list -> bool -> theory
    43   val end_theory: theory -> theory
    42   val end_theory: theory -> theory
    44   val finish: unit -> unit
    43   val finish: unit -> unit
    45   val register_theory: theory -> unit
    44   val register_theory: theory -> unit
    46   val pretty_theory: theory -> Pretty.T
    45   val pretty_theory: theory -> Pretty.T
   278           change_deps name (provide path name (ThyLoad.load_ml (master_dir' deps) path))
   277           change_deps name (provide path name (ThyLoad.load_ml (master_dir' deps) path))
   279       | NONE => (ThyLoad.load_ml Path.current path; ())));
   278       | NONE => (ThyLoad.load_ml Path.current path; ())));
   280 
   279 
   281 in
   280 in
   282 
   281 
   283 fun load_file time path = Output.toplevel_errors (fn () =>
   282 fun load_file time path =
   284   if time then
   283   if time then
   285     let val name = Path.implode path in
   284     let val name = Path.implode path in
   286       timeit (fn () =>
   285       timeit (fn () =>
   287        (priority ("\n**** Starting file " ^ quote name ^ " ****");
   286        (priority ("\n**** Starting file " ^ quote name ^ " ****");
   288         run_file path;
   287         run_file path;
   289         priority ("**** Finished file " ^ quote name ^ " ****\n")))
   288         priority ("**** Finished file " ^ quote name ^ " ****\n")))
   290     end
   289     end
   291   else run_file path) ();
   290   else run_file path;
   292 
   291 
   293 val use = load_file false o Path.explode;
   292 val use = load_file false o Path.explode;
   294 val time_use = load_file true o Path.explode;
   293 val time_use = load_file true o Path.explode;
   295 
   294 
   296 end;
   295 end;
   431       (case Multithreading.schedule (Int.min (m, n)) next_task tasks of
   430       (case Multithreading.schedule (Int.min (m, n)) next_task tasks of
   432         [] => ()
   431         [] => ()
   433       | exns => raise Exn.EXCEPTIONS (exns, ""))
   432       | exns => raise Exn.EXCEPTIONS (exns, ""))
   434   end;
   433   end;
   435 
   434 
   436 fun gen_use_thy' req dir arg = Output.toplevel_errors (fn () =>
   435 fun gen_use_thy' req dir arg =
   437   let val (_, tasks) = req [] dir arg (Graph.empty, 0)
   436   let val (_, tasks) = req [] dir arg (Graph.empty, 0)
   438   in schedule_tasks tasks end) ();
   437   in schedule_tasks tasks end;
   439 
   438 
   440 fun gen_use_thy req str =
   439 fun gen_use_thy req str =
   441   let val name = base_name str in
   440   let val name = base_name str in
   442     check_unfinished warning name;
   441     check_unfinished warning name;
   443     gen_use_thy' req Path.current str;
   442     gen_use_thy' req Path.current str;