signature ISABELLE_PROCESS = sig val reset_tracing: Document_ID.exec -> unit val crashes: exn list Synchronized.var val init_options: unit -> unit val init_options_interactive: unit -> unit val init: unit -> unit val init_build: unit -> unit end;
val protocol_modes1 = [Syntax_Trans.no_bracketsN, Syntax_Trans.no_type_bracketsN]; val protocol_modes2 = [Print_Mode.PIDE];
(* restricted tracing messages *)
val tracing_messages =
Synchronized.var "tracing_messages" (Inttab.empty: int Inttab.table);
fun reset_tracing exec_id =
Synchronized.change tracing_messages (Inttab.delete_safe exec_id);
fun update_tracing () =
(case Position.parse_id (Position.thread_data ()) of
NONE => ()
| SOME exec_id => let val ok =
Synchronized.change_result tracing_messages (fn tab => let val n = the_default 0 (Inttab.lookup tab exec_id) + 1; val limit = Options.default_int "editor_tracing_messages"; val ok = limit <= 0 orelse n <= limit; in (ok, Inttab.update (exec_id, n) tab) end); in if ok then () else let val (text, promise) = Active.dialog_text (); val _ =
writeln ("Tracing paused. " ^ text "Stop" ^ ", or continue with next " ^
text "100" ^ ", " ^ text "1000" ^ ", " ^ text "10000" ^ " messages?") val m = Value.parse_int (Future.join promise) handle Fail _ => error "Stopped"; in
Synchronized.change tracing_messages
(Inttab.map_default (exec_id, 0) (fn k => k - m)) end end);
(* init protocol -- uninterruptible *)
val crashes = Synchronized.var "Isabelle_Process.crashes" ([]: exn list);
local
fun recover crash =
(Synchronized.change crashes (cons crash);
Output.physical_stderr "Recovered from Isabelle process crash -- see also Isabelle_Process.crashes\n");
fun init_protocol modes = Thread_Attributes.uninterruptible (fn _ => fn (address, password) => let val _ = SHA1.test_samples () handle exn as Fail msg => (Output.physical_stderr (msg ^ "\n"); Exn.reraise exn);
val _ = Output.physical_stderr Symbol.STX;
(* streams *)
val (in_stream, out_stream) = Socket_IO.open_streams address; val _ = Byte_Message.write_line out_stream (Bytes.string password);
val _ = TextIO.StreamIO.setBufferMode (TextIO.getOutstream TextIO.stdOut, IO.LINE_BUF); val _ = TextIO.StreamIO.setBufferMode (TextIO.getOutstream TextIO.stdErr, IO.LINE_BUF); val _ = BinIO.StreamIO.setBufferMode (BinIO.getOutstream out_stream, IO.BLOCK_BUF);
(* messages *)
val message_channel = Message_Channel.make out_stream; val message = Message_Channel.message message_channel;
fun standard_message props name ss = if forall (fn s => s = "") ss then () else let val pos_props = ifexists Markup.position_property props then props else props @ Position.properties_of (Position.thread_data ()); in message name pos_props [XML.blob ss] end;
fun report_message ss = if Context_Position.reports_enabled0 () then standard_message [] Markup.reportN ss else ();
val serial_props = Markup.serial_properties o serial;
val result = Exn.capture_body (message_context protocol);
(* shutdown *)
val _ = Future.shutdown (); val _ = Execution.reset (); val _ = Message_Channel.shutdown message_channel; val _ = BinIO.closeIn in_stream; val _ = BinIO.closeOut out_stream;
val _ = Options.reset_default (); in
(case result of
Exn.Exn (Protocol_Command.STOP rc) => if rc = 0 then () else exit rc
| _ => Exn.release result) end);
fun init_modes modes = let val address = Options.default_string \<^system_option>\<open>system_channel_address\<close>; val password = Options.default_string \<^system_option>\<open>system_channel_password\<close>; in if address <> "" andalso password <> "" then init_protocol modes (address, password) else init_options () end;
fun init () = init_modes (protocol_modes1, protocol_modes2); fun init_build () = init_modes ([], protocol_modes2);
end;
¤ Dauer der Verarbeitung: 0.8 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.