Zycore 1.4.0.0
Loading...
Searching...
No Matches
Terminal.h
1/***************************************************************************************************
2
3 Zyan Core Library (Zycore-C)
4
5 Original Author : Florian Bernd
6
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24
25***************************************************************************************************/
26
32#ifndef ZYCORE_API_TERMINAL_H
33#define ZYCORE_API_TERMINAL_H
34
35#include <Zycore/LibC.h>
36#include <Zycore/Status.h>
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42#ifndef ZYAN_NO_LIBC
43
44/* ============================================================================================== */
45/* VT100 CSI SGR sequences */
46/* ============================================================================================== */
47
48/* ---------------------------------------------------------------------------------------------- */
49/* General */
50/* ---------------------------------------------------------------------------------------------- */
51
52#define ZYAN_VT100SGR_RESET "\033[0m"
53
54/* ---------------------------------------------------------------------------------------------- */
55/* Foreground colors */
56/* ---------------------------------------------------------------------------------------------- */
57
58#define ZYAN_VT100SGR_FG_DEFAULT "\033[39m"
59
60#define ZYAN_VT100SGR_FG_BLACK "\033[30m"
61#define ZYAN_VT100SGR_FG_RED "\033[31m"
62#define ZYAN_VT100SGR_FG_GREEN "\033[32m"
63#define ZYAN_VT100SGR_FG_YELLOW "\033[33m"
64#define ZYAN_VT100SGR_FG_BLUE "\033[34m"
65#define ZYAN_VT100SGR_FG_MAGENTA "\033[35m"
66#define ZYAN_VT100SGR_FG_CYAN "\033[36m"
67#define ZYAN_VT100SGR_FG_WHITE "\033[37m"
68#define ZYAN_VT100SGR_FG_BRIGHT_BLACK "\033[90m"
69#define ZYAN_VT100SGR_FG_BRIGHT_RED "\033[91m"
70#define ZYAN_VT100SGR_FG_BRIGHT_GREEN "\033[92m"
71#define ZYAN_VT100SGR_FG_BRIGHT_YELLOW "\033[93m"
72#define ZYAN_VT100SGR_FG_BRIGHT_BLUE "\033[94m"
73#define ZYAN_VT100SGR_FG_BRIGHT_MAGENTA "\033[95m"
74#define ZYAN_VT100SGR_FG_BRIGHT_CYAN "\033[96m"
75#define ZYAN_VT100SGR_FG_BRIGHT_WHITE "\033[97m"
76
77/* ---------------------------------------------------------------------------------------------- */
78/* Background color */
79/* ---------------------------------------------------------------------------------------------- */
80
81#define ZYAN_VT100SGR_BG_DEFAULT "\033[49m"
82
83#define ZYAN_VT100SGR_BG_BLACK "\033[40m"
84#define ZYAN_VT100SGR_BG_RED "\033[41m"
85#define ZYAN_VT100SGR_BG_GREEN "\033[42m"
86#define ZYAN_VT100SGR_BG_YELLOW "\033[43m"
87#define ZYAN_VT100SGR_BG_BLUE "\033[44m"
88#define ZYAN_VT100SGR_BG_MAGENTA "\033[45m"
89#define ZYAN_VT100SGR_BG_CYAN "\033[46m"
90#define ZYAN_VT100SGR_BG_WHITE "\033[47m"
91#define ZYAN_VT100SGR_BG_BRIGHT_BLACK "\033[100m"
92#define ZYAN_VT100SGR_BG_BRIGHT_RED "\033[101m"
93#define ZYAN_VT100SGR_BG_BRIGHT_GREEN "\033[102m"
94#define ZYAN_VT100SGR_BG_BRIGHT_YELLOW "\033[103m"
95#define ZYAN_VT100SGR_BG_BRIGHT_BLUE "\033[104m"
96#define ZYAN_VT100SGR_BG_BRIGHT_MAGENTA "\033[105m"
97#define ZYAN_VT100SGR_BG_BRIGHT_CYAN "\033[106m"
98#define ZYAN_VT100SGR_BG_BRIGHT_WHITE "\033[107m"
99
100/* ---------------------------------------------------------------------------------------------- */
101
102/* ============================================================================================== */
103/* Enums and types */
104/* ============================================================================================== */
105
109typedef enum ZyanStandardStream_
110{
114 ZYAN_STDSTREAM_IN,
118 ZYAN_STDSTREAM_OUT,
122 ZYAN_STDSTREAM_ERR
123} ZyanStandardStream;
124
125/* ============================================================================================== */
126/* Exported functions */
127/* ============================================================================================== */
128
142ZYCORE_EXPORT ZyanStatus ZyanTerminalEnableVT100(ZyanStandardStream stream);
143
152ZYCORE_EXPORT ZyanStatus ZyanTerminalIsTTY(ZyanStandardStream stream);
153
154/* ============================================================================================== */
155
156#endif // ZYAN_NO_LIBC
157
158#ifdef __cplusplus
159}
160#endif
161
162#endif /* ZYCORE_API_TERMINAL_H */
#define ZYCORE_EXPORT
Definition Defines.h:227
ZyanU32 ZyanStatus
Definition Status.h:48