Debian Codegraph @

Utilities/KWSys/Terminal.h.in

raw
1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
3 #ifndef @KWSYS_NAMESPACE@_Terminal_h
4 #define @KWSYS_NAMESPACE@_Terminal_h
5
6 #include <@KWSYS_NAMESPACE@/Configure.h>
7
8 #include <stdio.h> /* For file stream type FILE. */
9
10 /* Redefine all public interface symbol names to be in the proper
11 namespace. These macros are used internally to kwsys only, and are
12 not visible to user code. Use kwsysHeaderDump.pl to reproduce
13 these macros after making changes to the interface. */
14 #if !defined(KWSYS_NAMESPACE)
15 # define kwsys_ns(x) @KWSYS_NAMESPACE@##x
16 # define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
17 #endif
18 #if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
19 # define kwsysTerminal_cfprintf kwsys_ns(Terminal_cfprintf)
20 # define kwsysTerminal_Color_e kwsys_ns(Terminal_Color_e)
21 # define kwsysTerminal_Color_Normal kwsys_ns(Terminal_Color_Normal)
22 # define kwsysTerminal_Color_ForegroundBlack \
23 kwsys_ns(Terminal_Color_ForegroundBlack)
24 # define kwsysTerminal_Color_ForegroundRed \
25 kwsys_ns(Terminal_Color_ForegroundRed)
26 # define kwsysTerminal_Color_ForegroundGreen \
27 kwsys_ns(Terminal_Color_ForegroundGreen)
28 # define kwsysTerminal_Color_ForegroundYellow \
29 kwsys_ns(Terminal_Color_ForegroundYellow)
30 # define kwsysTerminal_Color_ForegroundBlue \
31 kwsys_ns(Terminal_Color_ForegroundBlue)
32 # define kwsysTerminal_Color_ForegroundMagenta \
33 kwsys_ns(Terminal_Color_ForegroundMagenta)
34 # define kwsysTerminal_Color_ForegroundCyan \
35 kwsys_ns(Terminal_Color_ForegroundCyan)
36 # define kwsysTerminal_Color_ForegroundWhite \
37 kwsys_ns(Terminal_Color_ForegroundWhite)
38 # define kwsysTerminal_Color_ForegroundMask \
39 kwsys_ns(Terminal_Color_ForegroundMask)
40 # define kwsysTerminal_Color_BackgroundBlack \
41 kwsys_ns(Terminal_Color_BackgroundBlack)
42 # define kwsysTerminal_Color_BackgroundRed \
43 kwsys_ns(Terminal_Color_BackgroundRed)
44 # define kwsysTerminal_Color_BackgroundGreen \
45 kwsys_ns(Terminal_Color_BackgroundGreen)
46 # define kwsysTerminal_Color_BackgroundYellow \
47 kwsys_ns(Terminal_Color_BackgroundYellow)
48 # define kwsysTerminal_Color_BackgroundBlue \
49 kwsys_ns(Terminal_Color_BackgroundBlue)
50 # define kwsysTerminal_Color_BackgroundMagenta \
51 kwsys_ns(Terminal_Color_BackgroundMagenta)
52 # define kwsysTerminal_Color_BackgroundCyan \
53 kwsys_ns(Terminal_Color_BackgroundCyan)
54 # define kwsysTerminal_Color_BackgroundWhite \
55 kwsys_ns(Terminal_Color_BackgroundWhite)
56 # define kwsysTerminal_Color_BackgroundMask \
57 kwsys_ns(Terminal_Color_BackgroundMask)
58 # define kwsysTerminal_Color_ForegroundBold \
59 kwsys_ns(Terminal_Color_ForegroundBold)
60 # define kwsysTerminal_Color_BackgroundBold \
61 kwsys_ns(Terminal_Color_BackgroundBold)
62 # define kwsysTerminal_Color_AssumeTTY kwsys_ns(Terminal_Color_AssumeTTY)
63 # define kwsysTerminal_Color_AssumeVT100 kwsys_ns(Terminal_Color_AssumeVT100)
64 # define kwsysTerminal_Color_AttributeMask \
65 kwsys_ns(Terminal_Color_AttributeMask)
66 #endif
67
68 #if defined(__cplusplus)
69 extern "C" {
70 #endif
71
72 /**
73 * Write colored and formatted text to a stream. Color is used only
74 * for streams supporting it. The color specification is constructed
75 * by bitwise-OR-ing enumeration values. At most one foreground and
76 * one background value may be given.
77 *
78 * Whether the a stream supports color is usually automatically
79 * detected, but with two exceptions:
80 *
81 * - When the stream is displayed in a terminal supporting VT100
82 * color but using an intermediate pipe for communication the
83 * detection of a tty fails. (This typically occurs for a shell
84 * running in an rxvt terminal in MSYS.) If the caller knows this
85 * to be the case, the attribute Color_AssumeTTY may be included in
86 * the color specification.
87 *
88 * - When the stream is displayed in a terminal whose TERM
89 * environment variable is not set or is set to a value that is not
90 * known to support VT100 colors. If the caller knows this to be
91 * the case, the attribute Color_AssumeVT100 may be included in the
92 * color specification.
93 */
94 kwsysEXPORT void kwsysTerminal_cfprintf(int color, FILE* stream,
95 const char* format, ...);
96 enum kwsysTerminal_Color_e
97 {
98 /* Normal Text */
99 kwsysTerminal_Color_Normal = 0,
100
101 /* Foreground Color */
102 kwsysTerminal_Color_ForegroundBlack = 0x1,
103 kwsysTerminal_Color_ForegroundRed = 0x2,
104 kwsysTerminal_Color_ForegroundGreen = 0x3,
105 kwsysTerminal_Color_ForegroundYellow = 0x4,
106 kwsysTerminal_Color_ForegroundBlue = 0x5,
107 kwsysTerminal_Color_ForegroundMagenta = 0x6,
108 kwsysTerminal_Color_ForegroundCyan = 0x7,
109 kwsysTerminal_Color_ForegroundWhite = 0x8,
110 kwsysTerminal_Color_ForegroundMask = 0xF,
111
112 /* Background Color */
113 kwsysTerminal_Color_BackgroundBlack = 0x10,
114 kwsysTerminal_Color_BackgroundRed = 0x20,
115 kwsysTerminal_Color_BackgroundGreen = 0x30,
116 kwsysTerminal_Color_BackgroundYellow = 0x40,
117 kwsysTerminal_Color_BackgroundBlue = 0x50,
118 kwsysTerminal_Color_BackgroundMagenta = 0x60,
119 kwsysTerminal_Color_BackgroundCyan = 0x70,
120 kwsysTerminal_Color_BackgroundWhite = 0x80,
121 kwsysTerminal_Color_BackgroundMask = 0xF0,
122
123 /* Attributes */
124 kwsysTerminal_Color_ForegroundBold = 0x100,
125 kwsysTerminal_Color_BackgroundBold = 0x200,
126 kwsysTerminal_Color_AssumeTTY = 0x400,
127 kwsysTerminal_Color_AssumeVT100 = 0x800,
128 kwsysTerminal_Color_AttributeMask = 0xF00
129 };
130
131 #if defined(__cplusplus)
132 } /* extern "C" */
133 #endif
134
135 /* If we are building a kwsys .c or .cxx file, let it use these macros.
136 Otherwise, undefine them to keep the namespace clean. */
137 #if !defined(KWSYS_NAMESPACE)
138 # undef kwsys_ns
139 # undef kwsysEXPORT
140 # if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
141 # undef kwsysTerminal_cfprintf
142 # undef kwsysTerminal_Color_e
143 # undef kwsysTerminal_Color_Normal
144 # undef kwsysTerminal_Color_ForegroundBlack
145 # undef kwsysTerminal_Color_ForegroundRed
146 # undef kwsysTerminal_Color_ForegroundGreen
147 # undef kwsysTerminal_Color_ForegroundYellow
148 # undef kwsysTerminal_Color_ForegroundBlue
149 # undef kwsysTerminal_Color_ForegroundMagenta
150 # undef kwsysTerminal_Color_ForegroundCyan
151 # undef kwsysTerminal_Color_ForegroundWhite
152 # undef kwsysTerminal_Color_ForegroundMask
153 # undef kwsysTerminal_Color_BackgroundBlack
154 # undef kwsysTerminal_Color_BackgroundRed
155 # undef kwsysTerminal_Color_BackgroundGreen
156 # undef kwsysTerminal_Color_BackgroundYellow
157 # undef kwsysTerminal_Color_BackgroundBlue
158 # undef kwsysTerminal_Color_BackgroundMagenta
159 # undef kwsysTerminal_Color_BackgroundCyan
160 # undef kwsysTerminal_Color_BackgroundWhite
161 # undef kwsysTerminal_Color_BackgroundMask
162 # undef kwsysTerminal_Color_ForegroundBold
163 # undef kwsysTerminal_Color_BackgroundBold
164 # undef kwsysTerminal_Color_AssumeTTY
165 # undef kwsysTerminal_Color_AssumeVT100
166 # undef kwsysTerminal_Color_AttributeMask
167 # endif
168 #endif
169
170 #endif