ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
CaDiCaL::Terminal Class Reference

#include <terminal.hpp>

Public Member Functions

 Terminal (FILE *file)
 
 ~Terminal ()
 
void disable ()
 
void force_colors ()
 
void force_no_colors ()
 
void force_reset_on_exit ()
 
bool colors ()
 
 operator bool () const
 
void red (bool bright=false)
 
void green (bool bright=false)
 
void yellow (bool bright=false)
 
void blue (bool bright=false)
 
void magenta (bool bright=false)
 
void black (bool bright=false)
 
void cyan (bool bright=false)
 
void bold ()
 
void normal ()
 
void inverse ()
 
void underline ()
 
const char * bright_magenta_code ()
 
const char * magenta_code ()
 
const char * blue_code ()
 
const char * bright_blue_code ()
 
const char * yellow_code ()
 
const char * bright_yellow_code ()
 
const char * green_code ()
 
const char * red_code ()
 
const char * cyan_code ()
 
const char * bright_red_code ()
 
const char * normal_code ()
 
const char * bold_code ()
 
void cursor (bool on)
 
void erase_until_end_of_line ()
 
void erase_line_if_connected_otherwise_new_line ()
 
void reset ()
 

Detailed Description

Definition at line 10 of file terminal.hpp.

Constructor & Destructor Documentation

◆ Terminal()

CaDiCaL::Terminal::Terminal ( FILE * file)

Definition at line 14 of file cadical_terminal.cpp.

14 : file (f), reset_on_exit (false) {
15 CADICAL_assert (file);
16 int fd = fileno (f);
17 CADICAL_assert (fd == 1 || fd == 2);
18 use_colors = connected = isatty (fd);
19}
#define CADICAL_assert(ignore)
Definition global.h:14

◆ ~Terminal()

CaDiCaL::Terminal::~Terminal ( )

Definition at line 39 of file cadical_terminal.cpp.

39 {
40 if (reset_on_exit)
41 reset ();
42}
Here is the call graph for this function:

Member Function Documentation

◆ black()

void CaDiCaL::Terminal::black ( bool bright = false)
inline

Definition at line 60 of file terminal.hpp.

60{ color (90, bright); }

◆ blue()

void CaDiCaL::Terminal::blue ( bool bright = false)
inline

Definition at line 58 of file terminal.hpp.

58{ color (34, bright); }

◆ blue_code()

const char * CaDiCaL::Terminal::blue_code ( )
inline

Definition at line 72 of file terminal.hpp.

72{ return MODIFY ("0;34"); }
#define MODIFY(CODE)
Definition terminal.hpp:68

◆ bold()

void CaDiCaL::Terminal::bold ( )
inline

Definition at line 63 of file terminal.hpp.

63{ code ("1m"); }

◆ bold_code()

const char * CaDiCaL::Terminal::bold_code ( )
inline

Definition at line 81 of file terminal.hpp.

81{ return MODIFY ("1"); }

◆ bright_blue_code()

const char * CaDiCaL::Terminal::bright_blue_code ( )
inline

Definition at line 73 of file terminal.hpp.

73{ return MODIFY ("1;34"); }

◆ bright_magenta_code()

const char * CaDiCaL::Terminal::bright_magenta_code ( )
inline

Definition at line 70 of file terminal.hpp.

70{ return MODIFY ("1;35"); }

◆ bright_red_code()

const char * CaDiCaL::Terminal::bright_red_code ( )
inline

Definition at line 79 of file terminal.hpp.

79{ return MODIFY ("1;31"); }

◆ bright_yellow_code()

const char * CaDiCaL::Terminal::bright_yellow_code ( )
inline

Definition at line 75 of file terminal.hpp.

75{ return MODIFY ("1;33"); }

◆ colors()

bool CaDiCaL::Terminal::colors ( )
inline

Definition at line 51 of file terminal.hpp.

51{ return use_colors; }

◆ cursor()

void CaDiCaL::Terminal::cursor ( bool on)
inline

Definition at line 83 of file terminal.hpp.

83{ code (on ? "?25h" : "?25l"); }
Here is the caller graph for this function:

◆ cyan()

void CaDiCaL::Terminal::cyan ( bool bright = false)
inline

Definition at line 61 of file terminal.hpp.

61{ color (96, bright); }

◆ cyan_code()

const char * CaDiCaL::Terminal::cyan_code ( )
inline

Definition at line 78 of file terminal.hpp.

78{ return MODIFY ("0;96"); }

◆ disable()

void CaDiCaL::Terminal::disable ( )

Definition at line 34 of file cadical_terminal.cpp.

34 {
35 reset ();
36 connected = use_colors = false;
37}
Here is the call graph for this function:

◆ erase_line_if_connected_otherwise_new_line()

void CaDiCaL::Terminal::erase_line_if_connected_otherwise_new_line ( )
inline

Definition at line 87 of file terminal.hpp.

87 {
88 if (connected)
89 code ("1G");
90 else
91 fputc ('\n', file), fflush (file);
92 }

◆ erase_until_end_of_line()

void CaDiCaL::Terminal::erase_until_end_of_line ( )
inline

Definition at line 85 of file terminal.hpp.

85{ code ("K"); }
Here is the caller graph for this function:

◆ force_colors()

void CaDiCaL::Terminal::force_colors ( )

Definition at line 21 of file cadical_terminal.cpp.

21{ use_colors = connected = true; }

◆ force_no_colors()

void CaDiCaL::Terminal::force_no_colors ( )

Definition at line 22 of file cadical_terminal.cpp.

22{ use_colors = false; }

◆ force_reset_on_exit()

void CaDiCaL::Terminal::force_reset_on_exit ( )

Definition at line 23 of file cadical_terminal.cpp.

23{ reset_on_exit = true; }

◆ green()

void CaDiCaL::Terminal::green ( bool bright = false)
inline

Definition at line 56 of file terminal.hpp.

56{ color (32, bright); }

◆ green_code()

const char * CaDiCaL::Terminal::green_code ( )
inline

Definition at line 76 of file terminal.hpp.

76{ return MODIFY ("0;32"); }

◆ inverse()

void CaDiCaL::Terminal::inverse ( )
inline

Definition at line 65 of file terminal.hpp.

65{ code ("7m"); }

◆ magenta()

void CaDiCaL::Terminal::magenta ( bool bright = false)
inline

Definition at line 59 of file terminal.hpp.

59{ color (35, bright); }
Here is the caller graph for this function:

◆ magenta_code()

const char * CaDiCaL::Terminal::magenta_code ( )
inline

Definition at line 71 of file terminal.hpp.

71{ return MODIFY ("0;35"); }

◆ normal()

void CaDiCaL::Terminal::normal ( )
inline

Definition at line 64 of file terminal.hpp.

64{ code ("0m"); }
Here is the caller graph for this function:

◆ normal_code()

const char * CaDiCaL::Terminal::normal_code ( )
inline

Definition at line 80 of file terminal.hpp.

80{ return MODIFY ("0"); }

◆ operator bool()

CaDiCaL::Terminal::operator bool ( ) const
inline

Definition at line 53 of file terminal.hpp.

53{ return connected; }

◆ red()

void CaDiCaL::Terminal::red ( bool bright = false)
inline

Definition at line 55 of file terminal.hpp.

55{ color (31, bright); }

◆ red_code()

const char * CaDiCaL::Terminal::red_code ( )
inline

Definition at line 77 of file terminal.hpp.

77{ return MODIFY ("0;31"); }

◆ reset()

void CaDiCaL::Terminal::reset ( )

Definition at line 25 of file cadical_terminal.cpp.

25 {
26 if (!connected)
27 return;
29 cursor (true);
30 normal ();
31 fflush (file);
32}
void erase_until_end_of_line()
Definition terminal.hpp:85
void cursor(bool on)
Definition terminal.hpp:83
Here is the call graph for this function:
Here is the caller graph for this function:

◆ underline()

void CaDiCaL::Terminal::underline ( )
inline

Definition at line 66 of file terminal.hpp.

66{ code ("4m"); }

◆ yellow()

void CaDiCaL::Terminal::yellow ( bool bright = false)
inline

Definition at line 57 of file terminal.hpp.

57{ color (33, bright); }

◆ yellow_code()

const char * CaDiCaL::Terminal::yellow_code ( )
inline

Definition at line 74 of file terminal.hpp.

74{ return MODIFY ("0;33"); }

The documentation for this class was generated from the following files: