256 |
256 |
257 (other_name, |
257 (other_name, |
258 List( |
258 List( |
259 Info.make( |
259 Info.make( |
260 Chapter_Defs.empty, |
260 Chapter_Defs.empty, |
|
261 Options.init0(), |
261 info.options, |
262 info.options, |
262 augment_options = _ => Nil, |
263 augment_options = _ => Nil, |
263 dir_selected = false, |
264 dir_selected = false, |
264 dir = Path.explode("$ISABELLE_TMP_PREFIX"), |
265 dir = Path.explode("$ISABELLE_TMP_PREFIX"), |
265 chapter = info.chapter, |
266 chapter = info.chapter, |
625 val session_path = dir + Path.explode(entry.path) |
627 val session_path = dir + Path.explode(entry.path) |
626 val directories = entry.directories.map(dir => session_path + Path.explode(dir)) |
628 val directories = entry.directories.map(dir => session_path + Path.explode(dir)) |
627 |
629 |
628 val entry_options = entry.options ::: augment_options(name) |
630 val entry_options = entry.options ::: augment_options(name) |
629 val session_options = options ++ entry_options |
631 val session_options = options ++ entry_options |
|
632 val session_prefs = options.session_prefs(defaults = options0) |
630 |
633 |
631 val theories = |
634 val theories = |
632 entry.theories.map({ case (opts, thys) => |
635 entry.theories.map({ case (opts, thys) => |
633 (session_options ++ opts, |
636 (session_options ++ opts, |
634 thys.map({ case ((thy, pos), _) => |
637 thys.map({ case ((thy, pos), _) => |
661 |
664 |
662 val meta_digest = |
665 val meta_digest = |
663 SHA1.digest( |
666 SHA1.digest( |
664 (name, chapter, entry.parent, entry.directories, entry_options, entry.imports, |
667 (name, chapter, entry.parent, entry.directories, entry_options, entry.imports, |
665 entry.theories_no_position, conditions, entry.document_theories_no_position, |
668 entry.theories_no_position, conditions, entry.document_theories_no_position, |
666 entry.document_files) |
669 entry.document_files, session_prefs) |
667 .toString) |
670 .toString) |
668 |
671 |
669 val chapter_groups = chapter_defs(chapter).groups |
672 val chapter_groups = chapter_defs(chapter).groups |
670 val groups = chapter_groups ::: entry.groups.filterNot(chapter_groups.contains) |
673 val groups = chapter_groups ::: entry.groups.filterNot(chapter_groups.contains) |
671 |
674 |
672 Info(name, chapter, dir_selected, entry.pos, groups, session_path, |
675 Info(name, chapter, dir_selected, entry.pos, groups, session_path, |
673 entry.parent, entry.description, directories, session_options, |
676 entry.parent, entry.description, directories, session_options, session_prefs, |
674 entry.imports, theories, global_theories, entry.document_theories, document_files, |
677 entry.imports, theories, global_theories, entry.document_theories, document_files, |
675 export_files, entry.export_classpath, meta_digest) |
678 export_files, entry.export_classpath, meta_digest) |
676 } |
679 } |
677 catch { |
680 catch { |
678 case ERROR(msg) => |
681 case ERROR(msg) => |
691 dir: Path, |
694 dir: Path, |
692 parent: Option[String], |
695 parent: Option[String], |
693 description: String, |
696 description: String, |
694 directories: List[Path], |
697 directories: List[Path], |
695 options: Options, |
698 options: Options, |
|
699 session_prefs: String, |
696 imports: List[String], |
700 imports: List[String], |
697 theories: List[(Options, List[(String, Position.T)])], |
701 theories: List[(Options, List[(String, Position.T)])], |
698 global_theories: List[String], |
702 global_theories: List[String], |
699 document_theories: List[(String, Position.T)], |
703 document_theories: List[(String, Position.T)], |
700 document_files: List[(Path, Path)], |
704 document_files: List[(Path, Path)], |
818 case (defs2, entry: Chapter_Def) => defs2 + entry |
822 case (defs2, entry: Chapter_Def) => defs2 + entry |
819 case (defs2, _) => defs2 |
823 case (defs2, _) => defs2 |
820 } |
824 } |
821 } |
825 } |
822 |
826 |
|
827 val options0 = Options.init0() |
|
828 val session_prefs = options.session_prefs(defaults = options0) |
|
829 |
823 val root_infos = { |
830 val root_infos = { |
824 var chapter = UNSORTED |
831 var chapter = UNSORTED |
825 val root_infos = new mutable.ListBuffer[Info] |
832 val root_infos = new mutable.ListBuffer[Info] |
826 for (root <- roots) { |
833 for (root <- roots) { |
827 root.entries.foreach { |
834 root.entries.foreach { |
828 case entry: Chapter_Entry => chapter = entry.name |
835 case entry: Chapter_Entry => chapter = entry.name |
829 case entry: Session_Entry => |
836 case entry: Session_Entry => |
830 root_infos += |
837 root_infos += |
831 Info.make(chapter_defs, options, augment_options, |
838 Info.make(chapter_defs, options0, options, augment_options, |
832 root.select, root.dir, chapter, entry) |
839 root.select, root.dir, chapter, entry) |
833 case _ => |
840 case _ => |
834 } |
841 } |
835 chapter = UNSORTED |
842 chapter = UNSORTED |
836 } |
843 } |
911 error("Duplicate global theory " + quote(thy) + Position.here(info.pos)) |
918 error("Duplicate global theory " + quote(thy) + Position.here(info.pos)) |
912 case _ => global + (thy -> qualifier) |
919 case _ => global + (thy -> qualifier) |
913 } |
920 } |
914 } |
921 } |
915 |
922 |
916 new Structure(chapter_defs, session_positions, session_directories, |
923 new Structure(chapter_defs, session_prefs, session_positions, session_directories, |
917 global_theories, build_graph, imports_graph) |
924 global_theories, build_graph, imports_graph) |
918 } |
925 } |
919 } |
926 } |
920 |
927 |
921 final class Structure private[Sessions]( |
928 final class Structure private[Sessions]( |
922 chapter_defs: Chapter_Defs, |
929 chapter_defs: Chapter_Defs, |
|
930 val session_prefs: String, |
923 val session_positions: List[(String, Position.T)], |
931 val session_positions: List[(String, Position.T)], |
924 val session_directories: Map[JFile, String], |
932 val session_directories: Map[JFile, String], |
925 val global_theories: Map[String, String], |
933 val global_theories: Map[String, String], |
926 val build_graph: Graph[String, Info], |
934 val build_graph: Graph[String, Info], |
927 val imports_graph: Graph[String, Info] |
935 val imports_graph: Graph[String, Info] |
1008 def restrict(graph: Graph[String, Info]): Graph[String, Info] = { |
1016 def restrict(graph: Graph[String, Info]): Graph[String, Info] = { |
1009 val sessions = graph.all_preds(selected(graph, sel)).filterNot(excluded) |
1017 val sessions = graph.all_preds(selected(graph, sel)).filterNot(excluded) |
1010 graph.restrict(graph.all_preds(sessions).toSet) |
1018 graph.restrict(graph.all_preds(sessions).toSet) |
1011 } |
1019 } |
1012 |
1020 |
1013 new Structure(chapter_defs, session_positions, session_directories, global_theories, |
1021 new Structure(chapter_defs, session_prefs, session_positions, session_directories, |
1014 restrict(build_graph), restrict(imports_graph)) |
1022 global_theories, restrict(build_graph), restrict(imports_graph)) |
1015 } |
1023 } |
1016 |
1024 |
1017 def selection(session: String): Structure = selection(Selection.session(session)) |
1025 def selection(session: String): Structure = selection(Selection.session(session)) |
1018 |
1026 |
1019 def selection_deps( |
1027 def selection_deps( |