Project

General

Profile

Download (3 KB) Statistics
| Branch: | Tag: | Revision:
1
(* This file is part of the Kind 2 model checker.
2

    
3
   Copyright (c) 2015 by the Board of Trustees of the University of Iowa
4

    
5
   Licensed under the Apache License, Version 2.0 (the "License"); you
6
   may not use this file except in compliance with the License.  You
7
   may obtain a copy of the License at
8

    
9
   http://www.apache.org/licenses/LICENSE-2.0 
10

    
11
   Unless required by applicable law or agreed to in writing, software
12
   distributed under the License is distributed on an "AS IS" BASIS,
13
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14
   implied. See the License for the specific language governing
15
   permissions and limitations under the License. 
16

    
17
   This module is adapted from the model checker Cubicle
18
   http://cubicle.lri.fr
19

    
20
*)
21

    
22
(** Functions for pretty ascii output (colors, etc.)
23

    
24
    By default a set of tags are added to stdout and stderr. To activate them
25
    call [Format.pp_set_tags fmt true]. Colors can be added to another formatter with the function {!add_colors}.
26

    
27
Tags must be added to the format string with [@{<tag> what you want@}]. They can be arbitrarily nested. For instance to print a string in red with part of it bold do
28
{[
29
Format.printf "@{<red>I'm red. @{<b> I'm bold red.@}@}"
30
]}
31

    
32
The font tags available are:
33
- [n] : normal
34
- [b] : bold
35
- [/b] : cancel bold
36
- [dim] : dimmer color
37
- [u] : underline
38
- [/u] : cancel underline
39
- [i] : italicize
40
- [/i] : cancel italicize
41
- [/bl] : cancel blinking
42

    
43
The color (foreground) tags are: 
44
- [black]
45
- [red]
46
- [green]
47
- [yellow]
48
- [blue]
49
- [magenta]
50
- [cyan]
51
- [gray]
52
- [default]
53
- [c:0-255] give directly the color number on 256 colors terminals
54

    
55
And their bright version
56
- [black_b]
57
- [red_b]
58
- [green_b]
59
- [yellow_b]
60
- [blue_b]
61
- [magenta_b]
62
- [cyan_b]
63
- [gray_b]
64
- [default_b]
65

    
66

    
67
The background color tags are: 
68
- [bg_black]
69
- [bg_red]
70
- [bg_green]
71
- [bg_yellow]
72
- [bg_blue]
73
- [bg_magenta]
74
- [bg_cyan]
75
- [bg_gray]
76
- [bg_default]
77

    
78
And their bright version
79
- [bg_black_b]
80
- [bg_red_b]
81
- [bg_green_b]
82
- [bg_yellow_b]
83
- [bg_blue_b]
84
- [bg_magenta_b]
85
- [bg_cyan_b]
86
- [bg_gray_b]
87
- [bg_default_b]
88

    
89

    
90
    @author Alain Mebsout
91
*)
92

    
93

    
94
open Format
95

    
96

    
97
(** {1 Pretty colors} *)
98

    
99
(** Width of the virtual terminal (80 if cannot be detected) *)
100
val vt_width : int
101

    
102
(** prints separating line *)
103
val print_line : formatter -> unit -> unit
104

    
105
(** prints separating double line *)
106
val print_double_line : formatter -> unit -> unit
107

    
108
(** add color tags to a formatter *)
109
val add_colors : formatter -> unit
110

    
111

    
112
(** {1 Event tags} *)
113

    
114
(** Timeout tag. *)
115
val timeout_tag : Format.formatter -> unit
116

    
117
(** Success tag. *)
118
val success_tag : Format.formatter -> unit
119

    
120
(** Failure tag. *)
121
val failure_tag : Format.formatter -> unit
122

    
123
(** Error tag. *)
124
val error_tag : Format.formatter -> unit
125

    
126
(** Warning tag. *)
127
val warning_tag : Format.formatter -> unit
128

    
129
(** Note tag. *)
130
val note_tag : Format.formatter -> unit
131

    
132
(** Interruption tag. *)
133
val interruption_tag : Format.formatter -> unit
134

    
135
(** Done tag. *)
136
val done_tag : Format.formatter -> unit
137

    
138
val tag_of_level : formatter -> KindLib.log_level -> unit
(12-12/12)