libsir 2.2.5
Standard Incident Reporter
Loading...
Searching...
No Matches
ansimacros.h
Go to the documentation of this file.
1
42#ifndef _SIR_ANSI_MACROS_H_INCLUDED
43# define _SIR_ANSI_MACROS_H_INCLUDED
44
45# if !defined(SIR_NO_TEXT_STYLING)
46# define SIR_ESC "\x1b["
47# define SIR_ESC_M "m"
48# else
49# define SIR_ESC ""
50# define SIR_ESC_M ""
51# endif
52
53# if !defined(SIR_NO_TEXT_STYLING)
54# define SIR_ESC_SEQ(codes, s) SIR_ESC codes SIR_ESC_M s
55# else
56# define SIR_ESC_SEQ(codes, s) s
57# endif
58
59# define SIR_ESC_SEQE(codes) SIR_ESC_SEQ(codes, "")
60
62# if !defined(SIR_NO_TEXT_STYLING)
63# define SIR_ESC_RST SIR_ESC_SEQE("0")
64# else
65# define SIR_ESC_RST ""
66# endif
67
69# if !defined(__WIN__)
70# define SIR_R_ARROW "\xe2\x86\x92"
71# define SIR_L_ARROW "\xe2\x86\x90"
72# define SIR_BULLET "\xe2\x80\xa2"
73# else /* __WIN__ */
74# define SIR_R_ARROW "->"
75# define SIR_L_ARROW "<-"
76# define SIR_BULLET "-"
77# endif
78
85# if !defined(SIR_NO_TEXT_STYLING)
86# define SIR_COLOR(attr, fg, bg, s) \
87 SIR_ESC_SEQ(#attr ";" #fg ";" #bg, s) SIR_ESC_SEQE("0;39;49")
88
89# define SIR_STRIKE(s) SIR_ESC_SEQ("9", s) SIR_ESC_SEQE("29")
90# define SIR_INVERT(s) SIR_ESC_SEQ("7", s) SIR_ESC_SEQE("27")
91# define SIR_ULINE(s) SIR_ESC_SEQ("4", s) SIR_ESC_SEQE("24")
92# define SIR_EMPH(s) SIR_ESC_SEQ("3", s) SIR_ESC_SEQE("23")
93# define SIR_BOLD(s) SIR_ESC_SEQ("1", s) SIR_ESC_SEQE("22")
94# define SIR_BLINK(s) SIR_ESC_SEQ("5", s) SIR_ESC_SEQE("25")
96# define SIR_BLACK(s) SIR_COLOR(0, 30, 49, s)
97# define SIR_BLACKB(s) SIR_COLOR(1, 30, 49, s)
99# define SIR_RED(s) SIR_COLOR(0, 31, 49, s)
100# define SIR_REDB(s) SIR_COLOR(1, 31, 49, s)
101# define SIR_BRED(s) SIR_COLOR(0, 91, 49, s)
102# define SIR_BREDB(s) SIR_COLOR(1, 91, 49, s)
104# define SIR_GREEN(s) SIR_COLOR(0, 32, 49, s)
105# define SIR_GREENB(s) SIR_COLOR(1, 32, 49, s)
106# define SIR_BGREEN(s) SIR_COLOR(0, 92, 49, s)
107# define SIR_BGREENB(s) SIR_COLOR(1, 92, 49, s)
109# define SIR_YELLOW(s) SIR_COLOR(0, 33, 49, s)
110# define SIR_YELLOWB(s) SIR_COLOR(1, 33, 49, s)
111# define SIR_BYELLOW(s) SIR_COLOR(0, 93, 49, s)
112# define SIR_BYELLOWB(s) SIR_COLOR(1, 93, 49, s)
114# define SIR_BLUE(s) SIR_COLOR(0, 34, 49, s)
115# define SIR_BLUEB(s) SIR_COLOR(1, 34, 49, s)
116# define SIR_BBLUE(s) SIR_COLOR(0, 94, 49, s)
117# define SIR_BBLUEB(s) SIR_COLOR(1, 94, 49, s)
119# define SIR_MAGENTA(s) SIR_COLOR(0, 35, 49, s)
120# define SIR_MAGENTAB(s) SIR_COLOR(1, 35, 49, s)
121# define SIR_BMAGENTA(s) SIR_COLOR(0, 95, 49, s)
122# define SIR_BMAGENTAB(s) SIR_COLOR(1, 95, 49, s)
124# define SIR_CYAN(s) SIR_COLOR(0, 36, 49, s)
125# define SIR_CYANB(s) SIR_COLOR(1, 36, 49, s)
126# define SIR_BCYAN(s) SIR_COLOR(0, 96, 49, s)
127# define SIR_BCYANB(s) SIR_COLOR(1, 96, 49, s)
129# define SIR_BGRAY(s) SIR_COLOR(0, 37, 49, s)
130# define SIR_BGRAYB(s) SIR_COLOR(1, 37, 49, s)
131# define SIR_DGRAY(s) SIR_COLOR(0, 90, 49, s)
132# define SIR_DGRAYB(s) SIR_COLOR(1, 90, 49, s)
134# define SIR_WHITE(s) SIR_COLOR(0, 97, 49, s)
135# define SIR_WHITEB(s) SIR_COLOR(1, 97, 49, s)
136# else /* SIR_NO_TEXT_STYLING */
137# define SIR_COLOR(attr, fg, bg, s) s
138
139# define SIR_STRIKE(s) s
140# define SIR_INVERT(s) s
141# define SIR_ULINE(s) s
142# define SIR_EMPH(s) s
143# define SIR_BOLD(s) s
144# define SIR_BLINK(s) s
145
146# define SIR_BLACK(s) s
147# define SIR_BLACKB(s) s
148
149# define SIR_RED(s) s
150# define SIR_REDB(s) s
151# define SIR_BRED(s) s
152# define SIR_BREDB(s) s
153
154# define SIR_GREEN(s) s
155# define SIR_GREENB(s) s
156# define SIR_BGREEN(s) s
157# define SIR_BGREENB(s) s
158
159# define SIR_YELLOW(s) s
160# define SIR_YELLOWB(s) s
161# define SIR_BYELLOW(s) s
162# define SIR_BYELLOWB(s) s
163
164# define SIR_BLUE(s) s
165# define SIR_BLUEB(s) s
166# define SIR_BBLUE(s) s
167# define SIR_BBLUEB(s) s
168
169# define SIR_MAGENTA(s) s
170# define SIR_MAGENTAB(s) s
171# define SIR_BMAGENTA(s) s
172# define SIR_BMAGENTAB(s) s
173
174# define SIR_CYAN(s) s
175# define SIR_CYANB(s) s
176# define SIR_BCYAN(s) s
177# define SIR_BCYANB(s) s
178
179# define SIR_BGRAY(s) s
180# define SIR_BGRAYB(s) s
181# define SIR_DGRAY(s) s
182# define SIR_DGRAYB(s) s
183
184# define SIR_WHITE(s) s
185# define SIR_WHITEB(s) s
186# endif
187#endif /* ! _SIR_ANSI_MACROS_H_INCLUDED */