37 val index_path = Path.basic "index.html"; |
38 val index_path = Path.basic "index.html"; |
38 |
39 |
39 val session_path = Path.basic ".session"; |
40 val session_path = Path.basic ".session"; |
40 val session_entries_path = Path.unpack ".session/entries"; |
41 val session_entries_path = Path.unpack ".session/entries"; |
41 val pre_index_path = Path.unpack ".session/pre-index"; |
42 val pre_index_path = Path.unpack ".session/pre-index"; |
|
43 |
42 |
44 |
43 |
45 |
44 (** additional theory data **) |
46 (** additional theory data **) |
45 |
47 |
46 structure BrowserInfoArgs = |
48 structure BrowserInfoArgs = |
54 fun merge _ = empty; |
56 fun merge _ = empty; |
55 fun print _ _ = (); |
57 fun print _ _ = (); |
56 end; |
58 end; |
57 |
59 |
58 structure BrowserInfoData = TheoryDataFun(BrowserInfoArgs); |
60 structure BrowserInfoData = TheoryDataFun(BrowserInfoArgs); |
59 val setup = [BrowserInfoData.init]; |
61 |
60 fun get_info thy = if PureThy.get_name thy = "ProtoPure" then BrowserInfoArgs.empty |
62 fun get_info thy = |
61 else BrowserInfoData.get thy; (** FIXME!? **) |
63 if Theory.eq_thy (thy, ProtoPure.thy) then BrowserInfoArgs.empty |
|
64 else BrowserInfoData.get thy; |
|
65 |
|
66 |
62 |
67 |
63 (** graphs **) |
68 (** graphs **) |
64 |
69 |
65 type graph_node = |
70 type graph_node = |
66 {name: string, ID: string, dir: string, unfold: bool, |
71 {name: string, ID: string, dir: string, unfold: bool, |
101 |
106 |
102 fun add_graph_entry' (entry as {ID, ...}) (gr : graph_node list) = |
107 fun add_graph_entry' (entry as {ID, ...}) (gr : graph_node list) = |
103 filter_out (fn entry' => #ID entry' = ID) gr @ [entry]; |
108 filter_out (fn entry' => #ID entry' = ID) gr @ [entry]; |
104 |
109 |
105 |
110 |
|
111 |
106 (** global browser info state **) |
112 (** global browser info state **) |
107 |
113 |
108 (* type theory_info *) |
114 (* type theory_info *) |
109 |
115 |
110 type theory_info = {source: Buffer.T, html: Buffer.T}; |
116 type theory_info = {source: Buffer.T, html: Buffer.T}; |
151 |
157 |
152 |
158 |
153 fun add_index txt = change_browser_info (fn (theories, index, graph, all_graph) => |
159 fun add_index txt = change_browser_info (fn (theories, index, graph, all_graph) => |
154 (theories, Buffer.add txt index, graph, all_graph)); |
160 (theories, Buffer.add txt index, graph, all_graph)); |
155 |
161 |
156 (** add entry to graph for current session **) |
162 (*add entry to graph for current session*) |
157 fun add_graph_entry e = change_browser_info (fn (theories, index, graph, all_graph) => |
163 fun add_graph_entry e = change_browser_info (fn (theories, index, graph, all_graph) => |
158 (theories, index, add_graph_entry' e graph, all_graph)); |
164 (theories, index, add_graph_entry' e graph, all_graph)); |
159 |
165 |
160 (** add entry to graph for all sessions **) |
166 (*add entry to graph for all sessions*) |
161 fun add_all_graph_entry e = change_browser_info (fn (theories, index, graph, all_graph) => |
167 fun add_all_graph_entry e = change_browser_info (fn (theories, index, graph, all_graph) => |
162 (theories, index, graph, add_graph_entry' e all_graph)); |
168 (theories, index, graph, add_graph_entry' e all_graph)); |
163 |
169 |
164 fun add_source name txt = change_theory_info name (fn (source, html) => |
170 fun add_source name txt = change_theory_info name (fn (source, html) => |
165 (Buffer.add txt source, html)); |
171 (Buffer.add txt source, html)); |
166 |
172 |
167 fun add_html name txt = change_theory_info name (fn (source, html) => |
173 fun add_html name txt = change_theory_info name (fn (source, html) => |
168 (source, Buffer.add txt html)); |
174 (source, Buffer.add txt html)); |
|
175 |
169 |
176 |
170 |
177 |
171 (** global session state **) |
178 (** global session state **) |
172 |
179 |
173 (* session_info *) |
180 (* session_info *) |