src/Pure/Thy/thy_info.ML
changeset 27495 d2bb5d61b392
parent 27345 21719887bd23
child 27579 97ce525f664c
equal deleted inserted replaced
27494:0600316f3a3a 27495:d2bb5d61b392
     4 
     4 
     5 Main part of theory loader database, including handling of theory and
     5 Main part of theory loader database, including handling of theory and
     6 file dependencies.
     6 file dependencies.
     7 *)
     7 *)
     8 
     8 
     9 signature BASIC_THY_INFO =
       
    10 sig
       
    11   val touch_thy: string -> unit
       
    12   val remove_thy: string -> unit
       
    13 end;
       
    14 
       
    15 signature THY_INFO =
     9 signature THY_INFO =
    16 sig
    10 sig
    17   include BASIC_THY_INFO
       
    18   datatype action = Update | Outdate | Remove
    11   datatype action = Update | Outdate | Remove
    19   val str_of_action: action -> string
    12   val str_of_action: action -> string
    20   val add_hook: (action -> string -> unit) -> unit
    13   val add_hook: (action -> string -> unit) -> unit
    21   val get_names: unit -> string list
    14   val get_names: unit -> string list
    22   val known_thy: string -> bool
    15   val known_thy: string -> bool
    27   val the_theory: string -> theory -> theory
    20   val the_theory: string -> theory -> theory
    28   val is_finished: string -> bool
    21   val is_finished: string -> bool
    29   val master_directory: string -> Path.T
    22   val master_directory: string -> Path.T
    30   val loaded_files: string -> Path.T list
    23   val loaded_files: string -> Path.T list
    31   val get_parents: string -> string list
    24   val get_parents: string -> string list
       
    25   val touch_thy: string -> unit
    32   val touch_child_thys: string -> unit
    26   val touch_child_thys: string -> unit
    33   val provide_file: Path.T -> string -> unit
    27   val provide_file: Path.T -> string -> unit
    34   val load_file: bool -> Path.T -> unit
    28   val load_file: bool -> Path.T -> unit
    35   val exec_file: bool -> Path.T -> Context.generic -> Context.generic
    29   val exec_file: bool -> Path.T -> Context.generic -> Context.generic
    36   val use: string -> unit
    30   val use: string -> unit
    37   val time_use: string -> unit
    31   val time_use: string -> unit
    38   val use_thys: string list -> unit
    32   val use_thys: string list -> unit
    39   val use_thy: string -> unit
    33   val use_thy: string -> unit
    40   val time_use_thy: string -> unit
    34   val time_use_thy: string -> unit
       
    35   val remove_thy: string -> unit
       
    36   val kill_thy: string -> unit
    41   val thy_ord: theory * theory -> order
    37   val thy_ord: theory * theory -> order
    42   val begin_theory: string -> string list -> (Path.T * bool) list -> bool -> theory
    38   val begin_theory: string -> string list -> (Path.T * bool) list -> bool -> theory
    43   val end_theory: theory -> theory
    39   val end_theory: theory -> theory
    44   val register_thy: string -> unit
    40   val register_thy: string -> unit
    45   val register_theory: theory -> unit
    41   val register_theory: theory -> unit
   469 val time_use_thy = gen_use_thy (require_thy true);
   465 val time_use_thy = gen_use_thy (require_thy true);
   470 
   466 
   471 end;
   467 end;
   472 
   468 
   473 
   469 
   474 (* remove_thy *)
   470 (* remove theory *)
   475 
   471 
   476 fun remove_thy name =
   472 fun remove_thy name =
   477   if is_finished name then error (loader_msg "cannot remove finished theory" [name])
   473   if is_finished name then error (loader_msg "cannot remove finished theory" [name])
   478   else
   474   else
   479     let val succs = thy_graph Graph.all_succs [name] in
   475     let val succs = thy_graph Graph.all_succs [name] in
   480       priority (loader_msg "removing" succs);
   476       priority (loader_msg "removing" succs);
   481       CRITICAL (fn () => (List.app (perform Remove) succs; change_thys (Graph.del_nodes succs)))
   477       CRITICAL (fn () => (List.app (perform Remove) succs; change_thys (Graph.del_nodes succs)))
   482     end;
   478     end;
       
   479 
       
   480 val kill_thy = if_known_thy remove_thy;
   483 
   481 
   484 
   482 
   485 (* update_time *)
   483 (* update_time *)
   486 
   484 
   487 structure UpdateTime = TheoryDataFun
   485 structure UpdateTime = TheoryDataFun
   579 
   577 
   580 fun finish () = change_thys (Graph.map_nodes (fn (_, entry) => (NONE, entry)));
   578 fun finish () = change_thys (Graph.map_nodes (fn (_, entry) => (NONE, entry)));
   581 
   579 
   582 end;
   580 end;
   583 
   581 
   584 structure BasicThyInfo: BASIC_THY_INFO = ThyInfo;
       
   585 open BasicThyInfo;