mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
Process: Add sys::Process::FileDescriptorHasColors().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160557 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b1a4642796
commit
7d83658140
@ -97,6 +97,10 @@ namespace sys {
|
|||||||
/// the user rather than being put on a pipe or stored in a file.
|
/// the user rather than being put on a pipe or stored in a file.
|
||||||
static bool FileDescriptorIsDisplayed(int fd);
|
static bool FileDescriptorIsDisplayed(int fd);
|
||||||
|
|
||||||
|
/// This function determines if the given file descriptor is displayd and
|
||||||
|
/// supports colors.
|
||||||
|
static bool FileDescriptorHasColors(int fd);
|
||||||
|
|
||||||
/// This function determines the number of columns in the window
|
/// This function determines the number of columns in the window
|
||||||
/// if standard output is connected to a "tty" or "console"
|
/// if standard output is connected to a "tty" or "console"
|
||||||
/// window. If standard output is not connected to a tty or
|
/// window. If standard output is not connected to a tty or
|
||||||
|
@ -249,16 +249,18 @@ static bool terminalHasColors() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Process::FileDescriptorHasColors(int fd) {
|
||||||
|
// A file descriptor has colors if it is displayed and the terminal has
|
||||||
|
// colors.
|
||||||
|
return FileDescriptorIsDisplayed(fd) && terminalHasColors();
|
||||||
|
}
|
||||||
|
|
||||||
bool Process::StandardOutHasColors() {
|
bool Process::StandardOutHasColors() {
|
||||||
if (!StandardOutIsDisplayed())
|
return FileDescriptorHasColors(STDOUT_FILENO);
|
||||||
return false;
|
|
||||||
return terminalHasColors();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Process::StandardErrHasColors() {
|
bool Process::StandardErrHasColors() {
|
||||||
if (!StandardErrIsDisplayed())
|
return FileDescriptorHasColors(STDERR_FILENO);
|
||||||
return false;
|
|
||||||
return terminalHasColors();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Process::ColorNeedsFlush() {
|
bool Process::ColorNeedsFlush() {
|
||||||
|
@ -153,13 +153,17 @@ unsigned Process::StandardErrColumns() {
|
|||||||
return Columns;
|
return Columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
// It always has colors.
|
// The terminal always has colors.
|
||||||
bool Process::StandardErrHasColors() {
|
bool FileDescriptorHasColors(int fd) {
|
||||||
return StandardErrIsDisplayed();
|
return FileDescriptorIsDisplayed(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Process::StandardOutHasColors() {
|
bool Process::StandardOutHasColors() {
|
||||||
return StandardOutIsDisplayed();
|
return FileDescriptorHasColors(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Process::StandardErrHasColors() {
|
||||||
|
return FileDescriptorHasColors(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user