src/Pure/Isar/runtime.ML
changeset 58894 447972249785
parent 58843 521cea5fa777
child 59055 5a7157b8e870
equal deleted inserted replaced
58893:9e0ecb66d6a7 58894:447972249785
    20   val exn_trace: (unit -> 'a) -> 'a
    20   val exn_trace: (unit -> 'a) -> 'a
    21   val debugging: Context.generic option -> ('a -> 'b) -> 'a -> 'b
    21   val debugging: Context.generic option -> ('a -> 'b) -> 'a -> 'b
    22   val controlled_execution: Context.generic option -> ('a -> 'b) -> 'a -> 'b
    22   val controlled_execution: Context.generic option -> ('a -> 'b) -> 'a -> 'b
    23   val toplevel_error: (exn -> unit) -> ('a -> 'b) -> 'a -> 'b
    23   val toplevel_error: (exn -> unit) -> ('a -> 'b) -> 'a -> 'b
    24   val toplevel_program: (unit -> 'a) -> 'a
    24   val toplevel_program: (unit -> 'a) -> 'a
    25   val thread: bool -> (unit -> unit) -> Thread.thread
       
    26 end;
    25 end;
    27 
    26 
    28 structure Runtime: RUNTIME =
    27 structure Runtime: RUNTIME =
    29 struct
    28 struct
    30 
    29 
   164       in raise TOPLEVEL_ERROR end;
   163       in raise TOPLEVEL_ERROR end;
   165 
   164 
   166 fun toplevel_program body =
   165 fun toplevel_program body =
   167   (body |> controlled_execution NONE |> toplevel_error exn_error_message) ();
   166   (body |> controlled_execution NONE |> toplevel_error exn_error_message) ();
   168 
   167 
   169 (*Proof General legacy*)
       
   170 fun thread interrupts body =
       
   171   Thread.fork
       
   172     (fn () =>
       
   173       debugging NONE body () handle exn =>
       
   174         if Exn.is_interrupt exn then ()
       
   175         else writeln ("## INTERNAL ERROR ##\n" ^ exn_message exn),
       
   176       Simple_Thread.attributes interrupts);
       
   177 
       
   178 end;
   168 end;
   179 
   169