# HG changeset patch # User wenzelm # Date 1384196453 -3600 # Node ID 890e983cb07bd3b8980cdc99e741b8652999b63e # Parent 27246f8b2dac6bd513c14d1007646eb6f8cdaa99 tuned signature; diff -r 27246f8b2dac -r 890e983cb07b src/Doc/IsarImplementation/ML.thy --- a/src/Doc/IsarImplementation/ML.thy Mon Nov 11 18:37:56 2013 +0100 +++ b/src/Doc/IsarImplementation/ML.thy Mon Nov 11 20:00:53 2013 +0100 @@ -1033,7 +1033,7 @@ without any message output. \begin{warn} - The actual error channel is accessed via @{ML Output.error_msg}, but + The actual error channel is accessed via @{ML Output.error_message}, but the old interaction protocol of Proof~General \emph{crashes} if that function is used in regular ML code: error output and toplevel command failure always need to coincide in classic TTY interaction. diff -r 27246f8b2dac -r 890e983cb07b src/Pure/Concurrent/future.ML --- a/src/Pure/Concurrent/future.ML Mon Nov 11 18:37:56 2013 +0100 +++ b/src/Pure/Concurrent/future.ML Mon Nov 11 20:00:53 2013 +0100 @@ -447,7 +447,7 @@ Position.setmp_thread_data pos (fn () => let val id = Position.get_id pos in if is_none id orelse is_none exec_id orelse id = exec_id - then Output.error_msg' (serial, msg) else () + then Output.error_message' (serial, msg) else () end) (); fun identify_result pos res = diff -r 27246f8b2dac -r 890e983cb07b src/Pure/General/output.ML --- a/src/Pure/General/output.ML Mon Nov 11 18:37:56 2013 +0100 +++ b/src/Pure/General/output.ML Mon Nov 11 20:00:53 2013 +0100 @@ -31,7 +31,7 @@ val urgent_message_fn: (output -> unit) Unsynchronized.ref val tracing_fn: (output -> unit) Unsynchronized.ref val warning_fn: (output -> unit) Unsynchronized.ref - val error_fn: (serial * output -> unit) Unsynchronized.ref + val error_message_fn: (serial * output -> unit) Unsynchronized.ref val prompt_fn: (output -> unit) Unsynchronized.ref val status_fn: (output -> unit) Unsynchronized.ref val report_fn: (output -> unit) Unsynchronized.ref @@ -39,8 +39,8 @@ val protocol_message_fn: (Properties.T -> output -> unit) Unsynchronized.ref end val urgent_message: string -> unit - val error_msg': serial * string -> unit - val error_msg: string -> unit + val error_message': serial * string -> unit + val error_message: string -> unit val prompt: string -> unit val status: string -> unit val report: string -> unit @@ -98,7 +98,8 @@ val urgent_message_fn = Unsynchronized.ref (fn s => ! writeln_fn s); (*Proof General legacy*) val tracing_fn = Unsynchronized.ref (fn s => ! writeln_fn s); val warning_fn = Unsynchronized.ref (physical_writeln o prefix_lines "### "); - val error_fn = Unsynchronized.ref (fn (_: serial, s) => physical_writeln (prefix_lines "*** " s)); + val error_message_fn = + Unsynchronized.ref (fn (_: serial, s) => physical_writeln (prefix_lines "*** " s)); val prompt_fn = Unsynchronized.ref physical_stdout; val status_fn = Unsynchronized.ref (fn _: output => ()); val report_fn = Unsynchronized.ref (fn _: output => ()); @@ -111,8 +112,8 @@ fun urgent_message s = ! Internal.urgent_message_fn (output s); (*Proof General legacy*) fun tracing s = ! Internal.tracing_fn (output s); fun warning s = ! Internal.warning_fn (output s); -fun error_msg' (i, s) = ! Internal.error_fn (i, output s); -fun error_msg s = error_msg' (serial (), s); +fun error_message' (i, s) = ! Internal.error_message_fn (i, output s); +fun error_message s = error_message' (serial (), s); fun prompt s = ! Internal.prompt_fn (output s); fun status s = ! Internal.status_fn (output s); fun report s = ! Internal.report_fn (output s); diff -r 27246f8b2dac -r 890e983cb07b src/Pure/General/source.ML --- a/src/Pure/General/source.ML Mon Nov 11 18:37:56 2013 +0100 +++ b/src/Pure/General/source.ML Mon Nov 11 20:00:53 2013 +0100 @@ -156,8 +156,9 @@ NONE => drain (Scan.error scan) inp | SOME (interactive, recover) => (drain (Scan.catch scan) inp handle Fail msg => - (if interactive then Output.error_msg msg else (); - drain (Scan.unless (Scan.lift (Scan.one (Scan.is_stopper stopper))) (recover msg)) inp))); + (if interactive then Output.error_message msg else (); + drain (Scan.unless (Scan.lift (Scan.one (Scan.is_stopper stopper))) (recover msg)) + inp))); in (ys, (state', unget (xs', src'))) end; fun source' init_state stopper scan recover src = diff -r 27246f8b2dac -r 890e983cb07b src/Pure/Isar/toplevel.ML --- a/src/Pure/Isar/toplevel.ML Mon Nov 11 18:37:56 2013 +0100 +++ b/src/Pure/Isar/toplevel.ML Mon Nov 11 20:00:53 2013 +0100 @@ -242,7 +242,7 @@ fun program body = (body |> controlled_execution - |> Runtime.toplevel_error (Output.error_msg o ML_Compiler.exn_message)) (); + |> Runtime.toplevel_error ML_Compiler.exn_error_message) (); fun thread interrupts body = Thread.fork diff -r 27246f8b2dac -r 890e983cb07b src/Pure/ML/ml_compiler.ML --- a/src/Pure/ML/ml_compiler.ML Mon Nov 11 18:37:56 2013 +0100 +++ b/src/Pure/ML/ml_compiler.ML Mon Nov 11 20:00:53 2013 +0100 @@ -9,6 +9,7 @@ val exn_messages_ids: exn -> Runtime.error list val exn_messages: exn -> (serial * string) list val exn_message: exn -> string + val exn_error_message: exn -> unit val exn_trace: (unit -> 'a) -> 'a val eval: bool -> Position.T -> ML_Lex.token list -> unit end @@ -23,6 +24,8 @@ val exn_messages_ids = Runtime.exn_messages_ids exn_info; val exn_messages = Runtime.exn_messages exn_info; val exn_message = Runtime.exn_message exn_info; + +val exn_error_message = Output.error_message o exn_message; fun exn_trace e = print_exception_trace exn_message e; fun eval verbose pos toks = diff -r 27246f8b2dac -r 890e983cb07b src/Pure/ML/ml_compiler_polyml.ML --- a/src/Pure/ML/ml_compiler_polyml.ML Mon Nov 11 18:37:56 2013 +0100 +++ b/src/Pure/ML/ml_compiler_polyml.ML Mon Nov 11 20:00:53 2013 +0100 @@ -36,6 +36,8 @@ val exn_messages_ids = Runtime.exn_messages_ids exn_info; val exn_messages = Runtime.exn_messages exn_info; val exn_message = Runtime.exn_message exn_info; + +val exn_error_message = Output.error_message o exn_message; fun exn_trace e = print_exception_trace exn_message e; diff -r 27246f8b2dac -r 890e983cb07b src/Pure/System/command_line.ML --- a/src/Pure/System/command_line.ML Mon Nov 11 18:37:56 2013 +0100 +++ b/src/Pure/System/command_line.ML Mon Nov 11 20:00:53 2013 +0100 @@ -19,8 +19,8 @@ restore_attributes body () handle exn => let val _ = - Output.error_msg (ML_Compiler.exn_message exn) - handle _ => Output.error_msg "Exception raised, but failed to print details!"; + ML_Compiler.exn_error_message exn + handle _ => Output.error_message "Exception raised, but failed to print details!"; in if Exn.is_interrupt exn then 130 else 1 end; in if rc = 0 then () else exit rc end) (); diff -r 27246f8b2dac -r 890e983cb07b src/Pure/System/isabelle_process.ML --- a/src/Pure/System/isabelle_process.ML Mon Nov 11 18:37:56 2013 +0100 +++ b/src/Pure/System/isabelle_process.ML Mon Nov 11 20:00:53 2013 +0100 @@ -119,7 +119,7 @@ Output.Internal.tracing_fn := (fn s => (update_tracing (); standard_message (serial_props ()) Markup.tracingN s)); Output.Internal.warning_fn := (fn s => standard_message (serial_props ()) Markup.warningN s); - Output.Internal.error_fn := + Output.Internal.error_message_fn := (fn (i, s) => standard_message (Markup.serial_properties i) Markup.errorN s); Output.Internal.protocol_message_fn := message Markup.protocolN; Output.Internal.urgent_message_fn := ! Output.Internal.writeln_fn; @@ -167,10 +167,10 @@ fun loop channel = let val continue = (case read_command channel of - [] => (Output.error_msg "Isabelle process: no input"; true) + [] => (Output.error_message "Isabelle process: no input"; true) | name :: args => (worker_guest (fn () => run_command name args); true)) handle Runtime.TERMINATE => false - | exn => (Output.error_msg (ML_Compiler.exn_message exn) handle crash => recover crash; true); + | exn => (ML_Compiler.exn_error_message exn handle crash => recover crash; true); in if continue then loop channel else (Future.shutdown (); Execution.reset (); ()) diff -r 27246f8b2dac -r 890e983cb07b src/Pure/System/isar.ML --- a/src/Pure/System/isar.ML Mon Nov 11 18:37:56 2013 +0100 +++ b/src/Pure/System/isar.ML Mon Nov 11 20:00:53 2013 +0100 @@ -97,7 +97,7 @@ | SOME (_, SOME exn_info) => (set_exn (SOME exn_info); Toplevel.setmp_thread_position tr - Output.error_msg' (serial (), ML_Compiler.exn_message (Runtime.EXCURSION_FAIL exn_info)); + ML_Compiler.exn_error_message (Runtime.EXCURSION_FAIL exn_info); true) | SOME (st', NONE) => let @@ -144,7 +144,7 @@ NONE => if secure then quit () else () | SOME (tr, src') => if op >> tr orelse check_secure () then raw_loop secure src' else ()) handle exn => - (Output.error_msg (ML_Compiler.exn_message exn) + (ML_Compiler.exn_error_message exn handle crash => (Synchronized.change crashes (cons crash); warning "Recovering from Isar toplevel crash -- see also Isar.crashes"); diff -r 27246f8b2dac -r 890e983cb07b src/Pure/Tools/proof_general.ML --- a/src/Pure/Tools/proof_general.ML Mon Nov 11 18:37:56 2013 +0100 +++ b/src/Pure/Tools/proof_general.ML Mon Nov 11 20:00:53 2013 +0100 @@ -269,7 +269,7 @@ Output.Internal.urgent_message_fn := message (special "I") (special "J") ""; Output.Internal.tracing_fn := message (special "I" ^ special "V") (special "J") ""; Output.Internal.warning_fn := message (special "K") (special "L") "### "; - Output.Internal.error_fn := (fn (_, s) => message (special "M") (special "N") "*** " s); + Output.Internal.error_message_fn := (fn (_, s) => message (special "M") (special "N") "*** " s); Output.Internal.prompt_fn := (fn s => Output.physical_stdout (render s ^ special "S")));