| author | Fabian Huch <huch@in.tum.de> | 
| Tue, 28 May 2024 19:51:49 +0200 | |
| changeset 80203 | ca9a402735b4 | 
| parent 73559 | 22b5ecb53dd9 | 
| child 80801 | 090adcdceaae | 
| permissions | -rw-r--r-- | 
| 62930 | 1  | 
(* Title: Pure/General/output_primitives.ML  | 
2  | 
Author: Makarius  | 
|
3  | 
||
4  | 
Primitives for Isabelle output channels.  | 
|
5  | 
*)  | 
|
6  | 
||
7  | 
signature OUTPUT_PRIMITIVES =  | 
|
8  | 
sig  | 
|
| 
70991
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
9  | 
structure XML:  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
10  | 
sig  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
11  | 
type attributes = (string * string) list  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
12  | 
datatype tree =  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
13  | 
Elem of (string * attributes) * tree list  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
14  | 
| Text of string  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
15  | 
type body = tree list  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
16  | 
end  | 
| 62930 | 17  | 
type output = string  | 
18  | 
type serial = int  | 
|
19  | 
type properties = (string * string) list  | 
|
| 
65301
 
fca593a62785
restore output channels after shutdown, e.g. relevant for saved heap;
 
wenzelm 
parents: 
62933 
diff
changeset
 | 
20  | 
val ignore_outputs: output list -> unit  | 
| 62930 | 21  | 
val writeln_fn: output list -> unit  | 
22  | 
val state_fn: output list -> unit  | 
|
23  | 
val information_fn: output list -> unit  | 
|
24  | 
val tracing_fn: output list -> unit  | 
|
25  | 
val warning_fn: output list -> unit  | 
|
26  | 
val legacy_fn: output list -> unit  | 
|
27  | 
val error_message_fn: serial * output list -> unit  | 
|
28  | 
val system_message_fn: output list -> unit  | 
|
29  | 
val status_fn: output list -> unit  | 
|
30  | 
val report_fn: output list -> unit  | 
|
31  | 
val result_fn: properties -> output list -> unit  | 
|
| 73559 | 32  | 
type protocol_message_fn = properties -> XML.body list -> unit  | 
| 
70991
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
33  | 
val protocol_message_fn: protocol_message_fn  | 
| 
62933
 
f14569a9ab93
proper output of markup, e.g. relevant for nested ML as used in Pure/System/bash.ML;
 
wenzelm 
parents: 
62930 
diff
changeset
 | 
34  | 
val markup_fn: string * properties -> output * output  | 
| 62930 | 35  | 
end;  | 
36  | 
||
37  | 
structure Output_Primitives: OUTPUT_PRIMITIVES =  | 
|
38  | 
struct  | 
|
39  | 
||
| 
70991
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
40  | 
(** XML trees **)  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
41  | 
|
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
42  | 
structure XML =  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
43  | 
struct  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
44  | 
|
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
45  | 
type attributes = (string * string) list;  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
46  | 
|
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
47  | 
datatype tree =  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
48  | 
Elem of (string * attributes) * tree list  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
49  | 
| Text of string;  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
50  | 
|
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
51  | 
type body = tree list;  | 
| 71617 | 52  | 
|
| 
70991
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
53  | 
end;  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
54  | 
|
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
55  | 
|
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
56  | 
(* output *)  | 
| 
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
57  | 
|
| 62930 | 58  | 
type output = string;  | 
59  | 
type serial = int;  | 
|
60  | 
type properties = (string * string) list;  | 
|
61  | 
||
62  | 
fun ignore_outputs (_: output list) = ();  | 
|
63  | 
||
64  | 
val writeln_fn = ignore_outputs;  | 
|
65  | 
val state_fn = ignore_outputs;  | 
|
66  | 
val information_fn = ignore_outputs;  | 
|
67  | 
val tracing_fn = ignore_outputs;  | 
|
68  | 
val warning_fn = ignore_outputs;  | 
|
69  | 
val legacy_fn = ignore_outputs;  | 
|
70  | 
fun error_message_fn (_: serial, _: output list) = ();  | 
|
71  | 
val system_message_fn = ignore_outputs;  | 
|
72  | 
val status_fn = ignore_outputs;  | 
|
73  | 
val report_fn = ignore_outputs;  | 
|
74  | 
fun result_fn (_: properties) = ignore_outputs;  | 
|
| 
70991
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
75  | 
|
| 73559 | 76  | 
type protocol_message_fn = properties -> XML.body list -> unit;  | 
| 
70991
 
f9f7c34b7dd4
more scalable protocol_message: use XML.body directly (Output.output hook is not required);
 
wenzelm 
parents: 
65301 
diff
changeset
 | 
77  | 
val protocol_message_fn: protocol_message_fn = fn _ => fn _ => ();  | 
| 62930 | 78  | 
|
| 
62933
 
f14569a9ab93
proper output of markup, e.g. relevant for nested ML as used in Pure/System/bash.ML;
 
wenzelm 
parents: 
62930 
diff
changeset
 | 
79  | 
fun markup_fn (_: string * properties) = ("", "");
 | 
| 
 
f14569a9ab93
proper output of markup, e.g. relevant for nested ML as used in Pure/System/bash.ML;
 
wenzelm 
parents: 
62930 
diff
changeset
 | 
80  | 
|
| 62930 | 81  | 
end;  |