1*38fd1498Szrj /* Copyright (C) 2013-2018 Free Software Foundation, Inc.
2*38fd1498Szrj    Contributed by Manuel Lopez-Ibanez <manu@gcc.gnu.org>
3*38fd1498Szrj 
4*38fd1498Szrj This file is part of GCC.
5*38fd1498Szrj 
6*38fd1498Szrj GCC is free software; you can redistribute it and/or modify it under
7*38fd1498Szrj the terms of the GNU General Public License as published by the Free
8*38fd1498Szrj Software Foundation; either version 3, or (at your option) any later
9*38fd1498Szrj version.
10*38fd1498Szrj 
11*38fd1498Szrj GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12*38fd1498Szrj WARRANTY; without even the implied warranty of MERCHANTABILITY or
13*38fd1498Szrj FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14*38fd1498Szrj for more details.
15*38fd1498Szrj 
16*38fd1498Szrj You should have received a copy of the GNU General Public License
17*38fd1498Szrj along with GCC; see the file COPYING3.  If not see
18*38fd1498Szrj <http://www.gnu.org/licenses/>.  */
19*38fd1498Szrj 
20*38fd1498Szrj /* Based on code from: */
21*38fd1498Szrj /* grep.c - main driver file for grep.
22*38fd1498Szrj    Copyright (C) 1992-2018 Free Software Foundation, Inc.
23*38fd1498Szrj 
24*38fd1498Szrj    This program is free software; you can redistribute it and/or modify
25*38fd1498Szrj    it under the terms of the GNU General Public License as published by
26*38fd1498Szrj    the Free Software Foundation; either version 3, or (at your option)
27*38fd1498Szrj    any later version.
28*38fd1498Szrj 
29*38fd1498Szrj    This program is distributed in the hope that it will be useful,
30*38fd1498Szrj    but WITHOUT ANY WARRANTY; without even the implied warranty of
31*38fd1498Szrj    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32*38fd1498Szrj    GNU General Public License for more details.
33*38fd1498Szrj 
34*38fd1498Szrj    You should have received a copy of the GNU General Public License
35*38fd1498Szrj    along with this program; if not, write to the Free Software
36*38fd1498Szrj    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
37*38fd1498Szrj    02110-1301, USA.
38*38fd1498Szrj 
39*38fd1498Szrj    Written July 1992 by Mike Haertel.  */
40*38fd1498Szrj 
41*38fd1498Szrj #ifndef GCC_DIAGNOSTIC_COLOR_H
42*38fd1498Szrj #define GCC_DIAGNOSTIC_COLOR_H
43*38fd1498Szrj 
44*38fd1498Szrj /* Whether to add color to diagnostics:
45*38fd1498Szrj    o DIAGNOSTICS_COLOR_NO: never
46*38fd1498Szrj    o DIAGNOSTICS_COLOR_YES: always
47*38fd1498Szrj    o DIAGNOSTICS_COLOR_AUTO: depending on the output stream.  */
48*38fd1498Szrj typedef enum
49*38fd1498Szrj {
50*38fd1498Szrj   DIAGNOSTICS_COLOR_NO       = 0,
51*38fd1498Szrj   DIAGNOSTICS_COLOR_YES      = 1,
52*38fd1498Szrj   DIAGNOSTICS_COLOR_AUTO     = 2
53*38fd1498Szrj } diagnostic_color_rule_t;
54*38fd1498Szrj 
55*38fd1498Szrj const char *colorize_start (bool, const char *, size_t);
56*38fd1498Szrj const char *colorize_stop (bool);
57*38fd1498Szrj bool colorize_init (diagnostic_color_rule_t);
58*38fd1498Szrj 
59*38fd1498Szrj inline const char *
colorize_start(bool show_color,const char * name)60*38fd1498Szrj colorize_start (bool show_color, const char *name)
61*38fd1498Szrj {
62*38fd1498Szrj   return colorize_start (show_color, name, strlen (name));
63*38fd1498Szrj }
64*38fd1498Szrj 
65*38fd1498Szrj #endif /* ! GCC_DIAGNOSTIC_COLOR_H */
66