src/Pure/Thy/thy_info.ML
changeset 72705 0471eb6a4b99
parent 72692 22aeec526ffd
child 72710 6bc199a70bf9
equal deleted inserted replaced
72704:e700e830562e 72705:0471eb6a4b99
   291       fold_map element_result elements (Toplevel.init_toplevel (), Position.none);
   291       fold_map element_result elements (Toplevel.init_toplevel (), Position.none);
   292 
   292 
   293     val thy = Toplevel.end_theory end_pos end_state;
   293     val thy = Toplevel.end_theory end_pos end_state;
   294   in (results, thy) end;
   294   in (results, thy) end;
   295 
   295 
   296 fun eval_thy options update_time master_dir header text_pos text parents =
   296 fun eval_thy options master_dir header text_pos text parents =
   297   let
   297   let
   298     val (name, _) = #name header;
   298     val (name, _) = #name header;
   299     val keywords =
   299     val keywords =
   300       fold (curry Keyword.merge_keywords o Thy_Header.get_keywords) parents
   300       fold (curry Keyword.merge_keywords o Thy_Header.get_keywords) parents
   301         (Keyword.add_keywords (#keywords header) Keyword.empty_keywords);
   301         (Keyword.add_keywords (#keywords header) Keyword.empty_keywords);
   323 local
   323 local
   324 
   324 
   325 fun required_by _ [] = ""
   325 fun required_by _ [] = ""
   326   | required_by s initiators = s ^ "(required by " ^ show_path (rev initiators) ^ ")";
   326   | required_by s initiators = s ^ "(required by " ^ show_path (rev initiators) ^ ")";
   327 
   327 
   328 fun load_thy options initiators update_time deps text (name, pos) keywords parents =
   328 fun load_thy options initiators deps text (name, pos) keywords parents =
   329   let
   329   let
   330     val exec_id = Document_ID.make ();
   330     val exec_id = Document_ID.make ();
   331     val id = Document_ID.print exec_id;
   331     val id = Document_ID.print exec_id;
   332     val _ =
   332     val _ =
   333       Execution.running Document_ID.none exec_id [] orelse
   333       Execution.running Document_ID.none exec_id [] orelse
   348     val _ = Output.try_protocol_message (Markup.loading_theory name @ text_props) (XML.blob [text]);
   348     val _ = Output.try_protocol_message (Markup.loading_theory name @ text_props) (XML.blob [text]);
   349 
   349 
   350     val timing_start = Timing.start ();
   350     val timing_start = Timing.start ();
   351 
   351 
   352     val (theory, present, weight) =
   352     val (theory, present, weight) =
   353       eval_thy options update_time dir header text_pos text
   353       eval_thy options dir header text_pos text
   354         (if name = Context.PureN then [Context.the_global_context ()] else parents);
   354         (if name = Context.PureN then [Context.the_global_context ()] else parents);
   355 
   355 
   356     val timing_result = Timing.result timing_start;
   356     val timing_result = Timing.result timing_start;
   357     val timing_props = [Markup.theory_timing, (Markup.nameN, name)];
   357     val timing_props = [Markup.theory_timing, (Markup.nameN, name)];
   358     val _  = Output.try_protocol_message (timing_props @ Markup.timing_properties timing_result) []
   358     val _  = Output.try_protocol_message (timing_props @ Markup.timing_properties timing_result) []
   412             if all_current then Finished (get_theory theory_name)
   412             if all_current then Finished (get_theory theory_name)
   413             else
   413             else
   414               (case deps of
   414               (case deps of
   415                 NONE => raise Fail "Malformed deps"
   415                 NONE => raise Fail "Malformed deps"
   416               | SOME (dep, text) =>
   416               | SOME (dep, text) =>
   417                   let
   417                   Task (parents,
   418                     val update_time = serial ();
   418                     load_thy options initiators dep text (theory_name, theory_pos) keywords));
   419                     val load =
       
   420                       load_thy options initiators update_time
       
   421                         dep text (theory_name, theory_pos) keywords;
       
   422                   in Task (parents, load) end);
       
   423 
   419 
   424           val tasks'' = new_entry theory_name parents task tasks';
   420           val tasks'' = new_entry theory_name parents task tasks';
   425         in (all_current, tasks'') end)
   421         in (all_current, tasks'') end)
   426   end;
   422   end;
   427 
   423