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
ec218a3a
Commit
ec218a3a
authored
Jun 28, 2018
by
Dhruv Paranjape
Committed by
Victor Zverovich
Jul 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix redefinition warning for RESET_COLOR
parent
c04fb91b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
include/fmt/format-inl.h
include/fmt/format-inl.h
+7
-9
include/fmt/format.h
include/fmt/format.h
+2
-0
No files found.
include/fmt/format-inl.h
View file @
ec218a3a
...
@@ -86,9 +86,6 @@ inline int fmt_snprintf(char *buffer, size_t size, const char *format, ...) {
...
@@ -86,9 +86,6 @@ inline int fmt_snprintf(char *buffer, size_t size, const char *format, ...) {
# define FMT_SWPRINTF swprintf
# define FMT_SWPRINTF swprintf
#endif // defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT)
#endif // defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT)
const
char
RESET_COLOR
[]
=
"
\x1b
[0m"
;
const
wchar_t
WRESET_COLOR
[]
=
L"
\x1b
[0m"
;
typedef
void
(
*
FormatFunc
)(
internal
::
buffer
&
,
int
,
string_view
);
typedef
void
(
*
FormatFunc
)(
internal
::
buffer
&
,
int
,
string_view
);
// Portable thread-safe version of strerror.
// Portable thread-safe version of strerror.
...
@@ -312,6 +309,9 @@ const int16_t basic_data<T>::POW10_EXPONENTS[] = {
...
@@ -312,6 +309,9 @@ const int16_t basic_data<T>::POW10_EXPONENTS[] = {
827
,
853
,
880
,
907
,
933
,
960
,
986
,
1013
,
1039
,
1066
827
,
853
,
880
,
907
,
933
,
960
,
986
,
1013
,
1039
,
1066
};
};
template
<
typename
T
>
const
char
basic_data
<
T
>::
RESET_COLOR
[]
=
"
\x1b
[0m"
;
template
<
typename
T
>
const
wchar_t
basic_data
<
T
>::
WRESET_COLOR
[]
=
L"
\x1b
[0m"
;
FMT_FUNC
fp
operator
*
(
fp
x
,
fp
y
)
{
FMT_FUNC
fp
operator
*
(
fp
x
,
fp
y
)
{
// Multiply 32-bit parts of significands.
// Multiply 32-bit parts of significands.
uint64_t
mask
=
(
1ULL
<<
32
)
-
1
;
uint64_t
mask
=
(
1ULL
<<
32
)
-
1
;
...
@@ -505,7 +505,7 @@ FMT_FUNC void vprint_colored(color c, string_view format, format_args args) {
...
@@ -505,7 +505,7 @@ FMT_FUNC void vprint_colored(color c, string_view format, format_args args) {
escape
[
3
]
=
static_cast
<
char
>
(
'0'
+
c
);
escape
[
3
]
=
static_cast
<
char
>
(
'0'
+
c
);
std
::
fputs
(
escape
,
stdout
);
std
::
fputs
(
escape
,
stdout
);
vprint
(
format
,
args
);
vprint
(
format
,
args
);
std
::
fputs
(
RESET_COLOR
,
stdout
);
std
::
fputs
(
internal
::
data
::
RESET_COLOR
,
stdout
);
}
}
FMT_FUNC
void
vprint_colored
(
color
c
,
wstring_view
format
,
wformat_args
args
)
{
FMT_FUNC
void
vprint_colored
(
color
c
,
wstring_view
format
,
wformat_args
args
)
{
...
@@ -513,7 +513,7 @@ FMT_FUNC void vprint_colored(color c, wstring_view format, wformat_args args) {
...
@@ -513,7 +513,7 @@ FMT_FUNC void vprint_colored(color c, wstring_view format, wformat_args args) {
escape
[
3
]
=
static_cast
<
wchar_t
>
(
'0'
+
c
);
escape
[
3
]
=
static_cast
<
wchar_t
>
(
'0'
+
c
);
std
::
fputws
(
escape
,
stdout
);
std
::
fputws
(
escape
,
stdout
);
vprint
(
format
,
args
);
vprint
(
format
,
args
);
std
::
fputws
(
WRESET_COLOR
,
stdout
);
std
::
fputws
(
internal
::
data
::
WRESET_COLOR
,
stdout
);
}
}
#else
#else
namespace
internal
{
namespace
internal
{
...
@@ -526,20 +526,18 @@ FMT_CONSTEXPR void to_esc(uint8_t c, char out[], int offset) {
...
@@ -526,20 +526,18 @@ FMT_CONSTEXPR void to_esc(uint8_t c, char out[], int offset) {
FMT_FUNC
void
vprint_rgb
(
rgb
fd
,
string_view
format
,
format_args
args
)
{
FMT_FUNC
void
vprint_rgb
(
rgb
fd
,
string_view
format
,
format_args
args
)
{
char
escape_fd
[]
=
"
\x1b
[38;2;000;000;000m"
;
char
escape_fd
[]
=
"
\x1b
[38;2;000;000;000m"
;
static
FMT_CONSTEXPR_DECL
const
char
RESET_COLOR
[]
=
"
\x1b
[0m"
;
internal
::
to_esc
(
fd
.
r
,
escape_fd
,
7
);
internal
::
to_esc
(
fd
.
r
,
escape_fd
,
7
);
internal
::
to_esc
(
fd
.
g
,
escape_fd
,
11
);
internal
::
to_esc
(
fd
.
g
,
escape_fd
,
11
);
internal
::
to_esc
(
fd
.
b
,
escape_fd
,
15
);
internal
::
to_esc
(
fd
.
b
,
escape_fd
,
15
);
std
::
fputs
(
escape_fd
,
stdout
);
std
::
fputs
(
escape_fd
,
stdout
);
vprint
(
format
,
args
);
vprint
(
format
,
args
);
std
::
fputs
(
RESET_COLOR
,
stdout
);
std
::
fputs
(
internal
::
data
::
RESET_COLOR
,
stdout
);
}
}
FMT_FUNC
void
vprint_rgb
(
rgb
fd
,
rgb
bg
,
string_view
format
,
format_args
args
)
{
FMT_FUNC
void
vprint_rgb
(
rgb
fd
,
rgb
bg
,
string_view
format
,
format_args
args
)
{
char
escape_fd
[]
=
"
\x1b
[38;2;000;000;000m"
;
// foreground color
char
escape_fd
[]
=
"
\x1b
[38;2;000;000;000m"
;
// foreground color
char
escape_bg
[]
=
"
\x1b
[48;2;000;000;000m"
;
// background color
char
escape_bg
[]
=
"
\x1b
[48;2;000;000;000m"
;
// background color
static
FMT_CONSTEXPR_DECL
const
char
RESET_COLOR
[]
=
"
\x1b
[0m"
;
internal
::
to_esc
(
fd
.
r
,
escape_fd
,
7
);
internal
::
to_esc
(
fd
.
r
,
escape_fd
,
7
);
internal
::
to_esc
(
fd
.
g
,
escape_fd
,
11
);
internal
::
to_esc
(
fd
.
g
,
escape_fd
,
11
);
internal
::
to_esc
(
fd
.
b
,
escape_fd
,
15
);
internal
::
to_esc
(
fd
.
b
,
escape_fd
,
15
);
...
@@ -551,7 +549,7 @@ FMT_FUNC void vprint_rgb(rgb fd, rgb bg, string_view format, format_args args) {
...
@@ -551,7 +549,7 @@ FMT_FUNC void vprint_rgb(rgb fd, rgb bg, string_view format, format_args args) {
std
::
fputs
(
escape_fd
,
stdout
);
std
::
fputs
(
escape_fd
,
stdout
);
std
::
fputs
(
escape_bg
,
stdout
);
std
::
fputs
(
escape_bg
,
stdout
);
vprint
(
format
,
args
);
vprint
(
format
,
args
);
std
::
fputs
(
RESET_COLOR
,
stdout
);
std
::
fputs
(
internal
::
data
::
RESET_COLOR
,
stdout
);
}
}
#endif
#endif
...
...
include/fmt/format.h
View file @
ec218a3a
...
@@ -912,6 +912,8 @@ struct FMT_API basic_data {
...
@@ -912,6 +912,8 @@ struct FMT_API basic_data {
static
const
uint64_t
POW10_SIGNIFICANDS
[];
static
const
uint64_t
POW10_SIGNIFICANDS
[];
static
const
int16_t
POW10_EXPONENTS
[];
static
const
int16_t
POW10_EXPONENTS
[];
static
const
char
DIGITS
[];
static
const
char
DIGITS
[];
static
const
char
RESET_COLOR
[];
static
const
wchar_t
WRESET_COLOR
[];
};
};
#if FMT_USE_EXTERN_TEMPLATES
#if FMT_USE_EXTERN_TEMPLATES
...
...
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