equal
deleted
inserted
replaced
66 val output: string -> string |
66 val output: string -> string |
67 val indent: string * int -> string |
67 val indent: string * int -> string |
68 val raw: string -> string |
68 val raw: string -> string |
69 val add_mode: string -> |
69 val add_mode: string -> |
70 (string -> string * real) * (string * int -> string) * (string -> string) -> unit |
70 (string -> string * real) * (string * int -> string) * (string -> string) -> unit |
|
71 val transform_exceptions: bool ref |
71 end; |
72 end; |
72 |
73 |
73 structure Output: OUTPUT = |
74 structure Output: OUTPUT = |
74 struct |
75 struct |
75 |
76 |
194 end; |
195 end; |
195 |
196 |
196 |
197 |
197 (* transform ERROR into ERROR_MESSAGE *) |
198 (* transform ERROR into ERROR_MESSAGE *) |
198 |
199 |
|
200 val transform_exceptions = ref true; |
|
201 |
199 exception ERROR_MESSAGE of string; |
202 exception ERROR_MESSAGE of string; |
200 |
203 |
201 fun transform_error f x = |
204 fun transform_error f x = |
202 (case handle_error f x of |
205 if ! transform_exceptions then |
203 OK y => y |
206 (case handle_error f x of |
204 | Error msg => raise ERROR_MESSAGE msg); |
207 OK y => y |
|
208 | Error msg => raise ERROR_MESSAGE msg) |
|
209 else f x; |
205 |
210 |
206 |
211 |
207 (* transform any exception, including ERROR *) |
212 (* transform any exception, including ERROR *) |
208 |
213 |
209 fun transform_failure exn f x = |
214 fun transform_failure exn f x = |
210 transform_error f x handle Interrupt => raise Interrupt | e => raise exn e; |
215 if ! transform_exceptions then |
|
216 transform_error f x handle Interrupt => raise Interrupt | e => raise exn e |
|
217 else f x; |
211 |
218 |
212 |
219 |
213 |
220 |
214 (** timing **) |
221 (** timing **) |
215 |
222 |