Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
bc78ca42
Commit
bc78ca42
authored
Feb 08, 2015
by
Ryuuke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove global variables
parent
4806f754
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
+11
-16
format.cc
format.cc
+11
-16
No files found.
format.cc
View file @
bc78ca42
...
@@ -131,8 +131,6 @@ struct IntChecker<true> {
...
@@ -131,8 +131,6 @@ struct IntChecker<true> {
FOREGROUND_INTENSITY
|
FOREGROUND_GREEN
|
FOREGROUND_BLUE
,
FOREGROUND_INTENSITY
|
FOREGROUND_GREEN
|
FOREGROUND_BLUE
,
FOREGROUND_GREEN
|
FOREGROUND_RED
|
FOREGROUND_BLUE
|
FOREGROUND_INTENSITY
FOREGROUND_GREEN
|
FOREGROUND_RED
|
FOREGROUND_BLUE
|
FOREGROUND_INTENSITY
};
};
WORD
RESET_COLOR
=
0
;
bool
reset_color_flag
=
false
;
#else
#else
const
char
RESET_COLOR
[]
=
"
\x1b
[0m"
;
const
char
RESET_COLOR
[]
=
"
\x1b
[0m"
;
#endif
#endif
...
@@ -1116,17 +1114,14 @@ FMT_FUNC void fmt::print(std::ostream &os, StringRef format_str, ArgList args) {
...
@@ -1116,17 +1114,14 @@ FMT_FUNC void fmt::print(std::ostream &os, StringRef format_str, ArgList args) {
FMT_FUNC
void
fmt
::
print_colored
(
Color
c
,
StringRef
format
,
ArgList
args
)
{
FMT_FUNC
void
fmt
::
print_colored
(
Color
c
,
StringRef
format
,
ArgList
args
)
{
#ifdef _WIN32
#ifdef _WIN32
HANDLE
handle
=
GetStdHandle
(
STD_OUTPUT_HANDLE
);
HANDLE
handle
=
GetStdHandle
(
STD_OUTPUT_HANDLE
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
if
(
handle
==
INVALID_HANDLE_VALUE
)
FMT_THROW
(
GetLastError
(),
"cannot get output handle"
);
FMT_THROW
(
GetLastError
(),
"cannot get output handle"
);
if
(
!
reset_color_flag
)
{
CONSOLE_SCREEN_BUFFER_INFO
infoCon
;
CONSOLE_SCREEN_BUFFER_INFO
infoCon
;
if
(
!
GetConsoleScreenBufferInfo
(
handle
,
&
infoCon
))
if
(
!
GetConsoleScreenBufferInfo
(
handle
,
&
infoCon
))
FMT_THROW
(
GetLastError
(),
"cannot get console informations"
);
FMT_THROW
(
GetLastError
(),
"cannot get console informations"
);
RESET_COLOR
=
infoCon
.
wAttributes
;
WORD
reset_color
=
infoCon
.
wAttributes
;
reset_color_flag
=
true
;
WORD
color
=
static_cast
<
int
>
(
c
)
>=
ARRAYSIZE
(
win32_colors
)
?
reset_color
:
win32_colors
[
c
];
}
if
(
!
SetConsoleTextAttribute
(
handle
,
color
))
WORD
color
=
static_cast
<
int
>
(
c
)
>=
ARRAYSIZE
(
win32_colors
)
?
RESET_COLOR
:
win32_colors
[
c
];
if
(
!
SetConsoleTextAttribute
(
handle
,
color
))
FMT_THROW
(
GetLastError
(),
"cannot set console color"
);
FMT_THROW
(
GetLastError
(),
"cannot set console color"
);
#else
#else
char
escape
[]
=
"
\x1b
[30m"
;
char
escape
[]
=
"
\x1b
[30m"
;
...
@@ -1135,7 +1130,7 @@ FMT_FUNC void fmt::print_colored(Color c, StringRef format, ArgList args) {
...
@@ -1135,7 +1130,7 @@ FMT_FUNC void fmt::print_colored(Color c, StringRef format, ArgList args) {
#endif
#endif
print
(
format
,
args
);
print
(
format
,
args
);
#ifdef _WIN32
#ifdef _WIN32
if
(
!
SetConsoleTextAttribute
(
handle
,
RESET_COLOR
))
if
(
!
SetConsoleTextAttribute
(
handle
,
reset_color
))
FMT_THROW
(
GetLastError
(),
"cannot set console color"
);
FMT_THROW
(
GetLastError
(),
"cannot set console color"
);
#else
#else
std
::
fputs
(
RESET_COLOR
,
stdout
);
std
::
fputs
(
RESET_COLOR
,
stdout
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment