Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / mlton / control / control.sig
1 (* Copyright (C) 2009 Matthew Fluet.
2 * Copyright (C) 1999-2008 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
4 * Copyright (C) 1997-2000 NEC Research Institute.
5 *
6 * MLton is released under a BSD-style license.
7 * See the file MLton-LICENSE for details.
8 *)
9
10 signature CONTROL =
11 sig
12 include CONTROL_FLAGS
13
14 (* Tracing and other informative messages.
15 * Some take a verbosity argument that specifies the verbosity level at
16 * which messages should be printed.
17 *)
18 val message: verbosity * (unit -> Layout.t) -> unit
19 val messageStr: verbosity * string -> unit
20 val sizeMessage: string * 'a -> Layout.t
21 val trace: verbosity * string -> ('a -> 'b) -> 'a -> 'b
22 type traceAccum
23 val traceAccum: verbosity * string -> (traceAccum * (unit -> unit))
24 val traceAdd: traceAccum * string -> ('a -> 'b) -> 'a -> 'b
25 val traceBatch: verbosity * string -> ('a -> 'b) ->
26 (('a -> 'b) * (unit -> unit))
27 val indent: unit -> unit
28 val unindent: unit -> unit
29 val getDepth: unit -> int
30
31 (*------------------------------------*)
32 (* Error Reporting *)
33 (*------------------------------------*)
34 val checkFile: File.t * {fail: string -> 'a,
35 name: string,
36 ok: unit -> 'a} -> 'a
37 val checkForErrors: string -> unit
38 val error: Region.t * Layout.t * Layout.t -> unit
39 val errorStr: Region.t * string -> unit
40 (* abort compilation once this many errors reached *)
41 val errorThreshhold: int ref
42 val numErrors: int ref
43 val warning: Region.t * Layout.t * Layout.t -> unit
44
45 (*------------------------------------*)
46 (* Compiler Passes *)
47 (*------------------------------------*)
48 datatype style = No | Assembly | C | Dot | LLVM | ML
49
50 datatype 'a display =
51 NoDisplay
52 | Layout of 'a -> Layout.t
53 | Layouts of 'a * (Layout.t -> unit) -> unit
54
55 val diagnostic: (unit -> Layout.t) -> unit
56 val diagnostics: ((Layout.t -> unit) -> unit) -> unit
57 val maybeSaveToFile:
58 {name: string, suffix: string} * style * 'a * 'a display -> unit
59 val saveToFile:
60 {suffix: string} * style * 'a * 'a display -> unit
61 val outputHeader: style * (Layout.t -> unit) -> unit
62 val outputHeader': style * Out.t -> unit
63
64 val pass: {display: 'a display,
65 name: string,
66 stats: 'a -> Layout.t,
67 style: style,
68 suffix: string,
69 thunk: unit -> 'a} -> 'a
70
71 val passTypeCheck: {display: 'a display,
72 name: string,
73 stats: 'a -> Layout.t,
74 style: style,
75 suffix: string,
76 thunk: unit -> 'a,
77 typeCheck: 'a -> unit} -> 'a
78 end