src/Pure/Thy/present.ML
changeset 16426 8c3118c9c054
parent 16263 0609fb8df4a7
child 16503 24491bde68df
equal deleted inserted replaced
16425:2427be27cc60 16426:8c3118c9c054
    70 
    70 
    71 
    71 
    72 
    72 
    73 (** additional theory data **)
    73 (** additional theory data **)
    74 
    74 
    75 structure BrowserInfoArgs =
    75 val empty_browser_info = {name = "Pure", session = []: string list, is_local = false};
    76 struct
    76 
       
    77 structure BrowserInfoData = TheoryDataFun
       
    78 (struct
    77   val name = "Pure/browser_info";
    79   val name = "Pure/browser_info";
    78   type T = {name: string, session: string list, is_local: bool};
    80   type T = {name: string, session: string list, is_local: bool};
    79 
    81   val empty = empty_browser_info;
    80   val empty = {name = "Pure", session = [], is_local = false};
       
    81   val copy = I;
    82   val copy = I;
    82   fun prep_ext _ = {name = "", session = [], is_local = false};
    83   fun extend _ = {name = "", session = [], is_local = false};
    83   fun merge _ = empty;
    84   fun merge _ _ = empty;
    84   fun print _ _ = ();
    85   fun print _ _ = ();
    85 end;
    86 end);
    86 
    87 
    87 structure BrowserInfoData = TheoryDataFun(BrowserInfoArgs);
       
    88 val _ = Context.add_setup [BrowserInfoData.init];
    88 val _ = Context.add_setup [BrowserInfoData.init];
    89 
    89 
    90 fun get_info thy =
    90 fun get_info thy =
    91   if Theory.eq_thy (thy, ProtoPure.thy) then BrowserInfoArgs.empty
    91   if Context.theory_name thy mem_string [Context.ProtoPureN, Context.PureN, Context.CPureN]
       
    92   then empty_browser_info
    92   else BrowserInfoData.get thy;
    93   else BrowserInfoData.get thy;
    93 
    94 
    94 
    95 
    95 
    96 
    96 (** graphs **)
    97 (** graphs **)
   232 (* state *)
   233 (* state *)
   233 
   234 
   234 val session_info = ref (NONE: session_info option);
   235 val session_info = ref (NONE: session_info option);
   235 
   236 
   236 fun with_session x f = (case ! session_info of NONE => x | SOME info => f info);
   237 fun with_session x f = (case ! session_info of NONE => x | SOME info => f info);
   237 fun with_context f = f (PureThy.get_name (Context.the_context ()));
   238 fun with_context f = f (Context.theory_name (Context.the_context ()));
   238 
   239 
   239 
   240 
   240 
   241 
   241 (** document preparation **)
   242 (** document preparation **)
   242 
   243