185 fun copy_node true (Theory thy) = Theory (Theory.copy thy) |
185 fun copy_node true (Theory thy) = Theory (Theory.copy thy) |
186 | copy_node _ node = node; |
186 | copy_node _ node = node; |
187 |
187 |
188 fun interruptible f x = |
188 fun interruptible f x = |
189 let val y = ref (None: node History.T option); |
189 let val y = ref (None: node History.T option); |
190 in exhibit_interrupt (fn () => y := Some (f x)) (); the (! y) end; |
190 in raise_interrupt (fn () => y := Some (f x)) (); the (! y) end; |
191 |
191 |
192 val rollback = ERROR_MESSAGE "Stale signature encountered after succesful execution!"; |
192 val rollback = ERROR_MESSAGE "Stale signature encountered after succesful execution!"; |
193 |
193 |
194 fun return (result, None) = result |
194 fun return (result, None) = result |
195 | return (result, Some exn) = raise FAILURE (result, exn); |
195 | return (result, Some exn) = raise FAILURE (result, exn); |
252 | apply_tr _ Exit (State (Some (node, (exit, _)))) = |
252 | apply_tr _ Exit (State (Some (node, (exit, _)))) = |
253 (exit (History.current node); State None) |
253 (exit (History.current node); State None) |
254 | apply_tr _ Kill (State None) = raise UNDEF |
254 | apply_tr _ Kill (State None) = raise UNDEF |
255 | apply_tr _ Kill (State (Some (node, (_, kill)))) = |
255 | apply_tr _ Kill (State (Some (node, (_, kill)))) = |
256 (kill (History.current node); State None) |
256 (kill (History.current node); State None) |
257 | apply_tr int (Keep f) state = (exhibit_interrupt (f int) state; state) |
257 | apply_tr int (Keep f) state = (raise_interrupt (f int) state; state) |
258 | apply_tr _ (History _) (State None) = raise UNDEF |
258 | apply_tr _ (History _) (State None) = raise UNDEF |
259 | apply_tr _ (History f) (State (Some (node, term))) = State (Some (f node, term)) |
259 | apply_tr _ (History f) (State (Some (node, term))) = State (Some (f node, term)) |
260 | apply_tr int (MapCurrent f) state = node_trans int false f state |
260 | apply_tr int (MapCurrent f) state = node_trans int false f state |
261 | apply_tr int (AppCurrent f) state = node_trans int true f state; |
261 | apply_tr int (AppCurrent f) state = node_trans int true f state; |
262 |
262 |