diff --git a/ChangeLog b/ChangeLog index 94d8bc38..8d9b16e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2020-05-02 Markus Gans + * Transfer of all termcap functions into the FTermcap class + 2020-04-28 Markus Gans * Adding the missing method getClientSize() * Static code for the special built-in key sequences diff --git a/examples/ui.cpp b/examples/ui.cpp index 1abf5cf4..4565e4f0 100644 --- a/examples/ui.cpp +++ b/examples/ui.cpp @@ -932,7 +932,7 @@ void MyDialog::cb_showProgressBar (const finalcut::FWidget*, const FDataPtr) //---------------------------------------------------------------------- void MyDialog::cb_updateNumber (finalcut::FWidget* widget, FDataPtr data) { - auto& list = *(static_cast(widget)); + const auto& list = *(static_cast(widget)); auto& num = *(static_cast(data)); const auto count = list.getCount(); int select_num = 0; @@ -949,7 +949,7 @@ void MyDialog::cb_updateNumber (finalcut::FWidget* widget, FDataPtr data) //---------------------------------------------------------------------- void MyDialog::cb_activateButton (finalcut::FWidget* widget, FDataPtr data) { - auto& rb = *(static_cast(widget)); + const auto& rb = *(static_cast(widget)); auto& button = *(static_cast(data)); if ( rb.isChecked() ) diff --git a/src/foptiattr.cpp b/src/foptiattr.cpp index dbf89d17..8278f49d 100644 --- a/src/foptiattr.cpp +++ b/src/foptiattr.cpp @@ -25,6 +25,7 @@ #include "final/fc.h" #include "final/foptiattr.h" #include "final/fstartoptions.h" +#include "final/ftermcap.h" namespace finalcut { @@ -956,16 +957,16 @@ bool FOptiAttr::setTermAttributes ( FChar*& term { if ( term && F_set_attributes.cap ) { - const char* sgr = tparm ( C_STR(F_set_attributes.cap) - , p1 && ! fake_reverse - , p2 - , p3 && ! fake_reverse - , p4 - , p5 - , p6 - , p7 - , p8 - , p9 ); + const char* sgr = FTermcap::encodeParameter ( F_set_attributes.cap + , p1 && ! fake_reverse + , p2 + , p3 && ! fake_reverse + , p4 + , p5 + , p6 + , p7 + , p8 + , p9 ); append_sequence (sgr); resetColor(term); term->attr.bit.standout = p1; @@ -1500,13 +1501,13 @@ inline void FOptiAttr::change_current_color ( const FChar* const& term if ( term->fg_color != fg || frev ) { - color_str = tparm(C_STR(AF), ansi_fg, 0, 0, 0, 0, 0, 0, 0, 0); + color_str = FTermcap::encodeParameter(AF, ansi_fg); append_sequence (color_str); } if ( term->bg_color != bg || frev ) { - color_str = tparm(C_STR(AB), ansi_bg, 0, 0, 0, 0, 0, 0, 0, 0); + color_str = FTermcap::encodeParameter(AB, ansi_bg); append_sequence (color_str); } } @@ -1514,13 +1515,13 @@ inline void FOptiAttr::change_current_color ( const FChar* const& term { if ( term->fg_color != fg || frev ) { - color_str = tparm(C_STR(Sf), fg, 0, 0, 0, 0, 0, 0, 0, 0); + color_str = FTermcap::encodeParameter(Sf, fg); append_sequence (color_str); } if ( term->bg_color != bg || frev ) { - color_str = tparm(C_STR(Sb), bg, 0, 0, 0, 0, 0, 0, 0, 0); + color_str = FTermcap::encodeParameter(Sb, bg); append_sequence (color_str); } } @@ -1528,7 +1529,7 @@ inline void FOptiAttr::change_current_color ( const FChar* const& term { fg = vga2ansi(fg); bg = vga2ansi(bg); - color_str = tparm(C_STR(sp), fg, bg, 0, 0, 0, 0, 0, 0, 0); + color_str = FTermcap::encodeParameter(sp, fg, bg); append_sequence (color_str); } } diff --git a/src/foptimove.cpp b/src/foptimove.cpp index abfaa5ad..f3ee03be 100644 --- a/src/foptimove.cpp +++ b/src/foptimove.cpp @@ -24,6 +24,7 @@ #include "final/fc.h" #include "final/foptimove.h" +#include "final/ftermcap.h" namespace finalcut { @@ -267,7 +268,7 @@ void FOptiMove::set_cursor_address (const char cap[]) { if ( cap ) { - const char* temp = tgoto(C_STR(cap), 23, 23); + const char* temp = FTermcap::encodeMotionParameter(cap, 23, 23); F_cursor_address.cap = cap; F_cursor_address.duration = capDuration (temp, 1); F_cursor_address.length = capDurationToLength (F_cursor_address.duration); @@ -285,7 +286,7 @@ void FOptiMove::set_column_address (const char cap[]) { if ( cap ) { - const char* temp = tparm(C_STR(cap), 23, 0, 0, 0, 0, 0, 0, 0, 0); + const char* temp = FTermcap::encodeParameter(cap, 23); F_column_address.cap = cap; F_column_address.duration = capDuration (temp, 1); F_column_address.length = capDurationToLength (F_column_address.duration); @@ -303,7 +304,7 @@ void FOptiMove::set_row_address (const char cap[]) { if ( cap ) { - const char* temp = tparm(C_STR(cap), 23, 0, 0, 0, 0, 0, 0, 0, 0); + const char* temp = FTermcap::encodeParameter(cap, 23); F_row_address.cap = cap; F_row_address.duration = capDuration (temp, 1); F_row_address.length = capDurationToLength (F_row_address.duration); @@ -321,7 +322,7 @@ void FOptiMove::set_parm_up_cursor (const char cap[]) { if ( cap ) { - const char* temp = tparm(C_STR(cap), 23, 0, 0, 0, 0, 0, 0, 0, 0); + const char* temp = FTermcap::encodeParameter(cap, 23); F_parm_up_cursor.cap = cap; F_parm_up_cursor.duration = capDuration (temp, 1); F_parm_up_cursor.length = capDurationToLength (F_parm_up_cursor.duration); @@ -339,7 +340,7 @@ void FOptiMove::set_parm_down_cursor (const char cap[]) { if ( cap ) { - const char* temp = tparm(C_STR(cap), 23, 0, 0, 0, 0, 0, 0, 0, 0); + const char* temp = FTermcap::encodeParameter(cap, 23); F_parm_down_cursor.cap = cap; F_parm_down_cursor.duration = capDuration (temp, 1); F_parm_down_cursor.length = capDurationToLength (F_parm_down_cursor.duration); @@ -357,7 +358,7 @@ void FOptiMove::set_parm_left_cursor (const char cap[]) { if ( cap ) { - const char* temp = tparm(C_STR(cap), 23, 0, 0, 0, 0, 0, 0, 0, 0); + const char* temp = FTermcap::encodeParameter(cap, 23); F_parm_left_cursor.cap = cap; F_parm_left_cursor.duration = capDuration (temp, 1); F_parm_left_cursor.length = capDurationToLength (F_parm_left_cursor.duration); @@ -375,7 +376,7 @@ void FOptiMove::set_parm_right_cursor (const char cap[]) { if ( cap ) { - const char* temp = tparm(C_STR(cap), 23, 0, 0, 0, 0, 0, 0, 0, 0); + const char* temp = FTermcap::encodeParameter(cap, 23); F_parm_right_cursor.cap = cap; F_parm_right_cursor.duration = capDuration (temp, 1); F_parm_right_cursor.length = capDurationToLength (F_parm_right_cursor.duration); @@ -393,7 +394,7 @@ void FOptiMove::set_erase_chars (const char cap[]) { if ( cap ) { - const char* temp = tparm(C_STR(cap), 23, 0, 0, 0, 0, 0, 0, 0, 0); + const char* temp = FTermcap::encodeParameter(cap, 23); F_erase_chars.cap = cap; F_erase_chars.duration = capDuration (temp, 1); F_erase_chars.length = capDurationToLength (F_erase_chars.duration); @@ -411,7 +412,7 @@ void FOptiMove::set_repeat_char (const char cap[]) { if ( cap ) { - const char* temp = tparm(C_STR(cap), ' ', 23, 0, 0, 0, 0, 0, 0, 0); + const char* temp = FTermcap::encodeParameter(cap, ' ', 23); F_repeat_char.cap = cap; F_repeat_char.duration = capDuration (temp, 1); F_repeat_char.length = capDurationToLength (F_repeat_char.duration); @@ -686,7 +687,7 @@ inline int FOptiMove::verticalMove (char move[], int from_y, int to_y) if ( move ) { std::strncpy ( move - , tparm(C_STR(F_row_address.cap), to_y, 0, 0, 0, 0, 0, 0, 0, 0) + , FTermcap::encodeParameter(F_row_address.cap, to_y) , BUF_SIZE ); move[BUF_SIZE - 1] = '\0'; } @@ -713,7 +714,7 @@ inline void FOptiMove::downMove ( char move[], int& vtime if ( move ) { std::strncpy ( move - , tparm(C_STR(F_parm_down_cursor.cap), num, 0, 0, 0, 0, 0, 0, 0, 0) + , FTermcap::encodeParameter(F_parm_down_cursor.cap, num) , BUF_SIZE ); move[BUF_SIZE - 1] = '\0'; } @@ -741,7 +742,7 @@ inline void FOptiMove::upMove ( char move[], int& vtime if ( move ) { std::strncpy ( move - , tparm(C_STR(F_parm_up_cursor.cap), num, 0, 0, 0, 0, 0, 0, 0, 0) + , FTermcap::encodeParameter(F_parm_up_cursor.cap, num) , BUF_SIZE ); move[BUF_SIZE - 1] = '\0'; } @@ -767,7 +768,7 @@ inline int FOptiMove::horizontalMove (char hmove[], int from_x, int to_x) { // Move to fixed column position1 std::strncat ( hmove - , tparm(C_STR(F_column_address.cap), to_x, 0, 0, 0, 0, 0, 0, 0, 0) + , FTermcap::encodeParameter(F_column_address.cap, to_x) , BUF_SIZE - std::strlen(hmove) - 1 ); hmove[BUF_SIZE - 1] = '\0'; htime = F_column_address.duration; @@ -790,7 +791,7 @@ inline void FOptiMove::rightMove ( char hmove[], int& htime if ( F_parm_right_cursor.cap && F_parm_right_cursor.duration < htime ) { std::strncpy ( hmove - , tparm(C_STR(F_parm_right_cursor.cap), num, 0, 0, 0, 0, 0, 0, 0, 0) + , FTermcap::encodeParameter(F_parm_right_cursor.cap, num) , BUF_SIZE - 1); hmove[BUF_SIZE - 1] = '\0'; htime = F_parm_right_cursor.duration; @@ -845,7 +846,7 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime if ( F_parm_left_cursor.cap && F_parm_left_cursor.duration < htime ) { std::strncpy ( hmove - , tparm(C_STR(F_parm_left_cursor.cap), num, 0, 0, 0, 0, 0, 0, 0, 0) + , FTermcap::encodeParameter(F_parm_left_cursor.cap, num) , BUF_SIZE - 1); hmove[BUF_SIZE - 1] = '\0'; htime = F_parm_left_cursor.duration; @@ -906,13 +907,14 @@ inline bool FOptiMove::isMethod0Faster ( int& move_time , int xnew, int ynew ) { // Test method 0: direct cursor addressing - const char* move_xy = tgoto(C_STR(F_cursor_address.cap), xnew, ynew); + const char* move_xy = \ + FTermcap::encodeMotionParameter(F_cursor_address.cap, xnew, ynew); if ( move_xy ) { - char* move_ptr = move_buf; - std::strncpy (move_ptr, move_xy, BUF_SIZE - 1); - move_ptr[BUF_SIZE - 1] = '\0'; + std::strncpy ( reinterpret_cast(move_buf) + , move_xy, BUF_SIZE - 1 ); + move_buf[BUF_SIZE - 1] = '\0'; move_time = F_cursor_address.duration; return true; } diff --git a/src/fterm.cpp b/src/fterm.cpp index 63bfc663..04ab4292 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -836,7 +836,7 @@ const char* FTerm::moveCursorString (int xold, int yold, int xnew, int ynew) if ( data->hasCursorOptimisation() ) return opti_move->moveCursor (xold, yold, xnew, ynew); else - return tgoto(C_STR(TCAP(fc::t_cursor_address)), xnew, ynew); + return FTermcap::encodeMotionParameter(TCAP(fc::t_cursor_address), xnew, ynew); } //---------------------------------------------------------------------- @@ -987,9 +987,9 @@ void FTerm::setPalette (FColor index, int r, int g, int b) const int bb = (b * 1001) / 256; if ( Ic ) - color_str = tparm(C_STR(Ic), index, rr, gg, bb, 0, 0, 0, 0, 0); + color_str = FTermcap::encodeParameter(Ic, index, rr, gg, bb); else if ( Ip ) - color_str = tparm(C_STR(Ip), index, 0, 0, 0, rr, gg, bb, 0, 0); + color_str = FTermcap::encodeParameter(Ip, index, 0, 0, 0, rr, gg, bb); if ( color_str ) { @@ -1199,7 +1199,7 @@ void FTerm::putstring (const char str[], int affcnt) if ( ! fsys ) getFSystem(); - fsys->tputs (str, affcnt, FTerm::putchar_ASCII); + FTermcap::paddingPrint (str, affcnt, FTerm::putchar_ASCII); } //---------------------------------------------------------------------- diff --git a/src/ftermcap.cpp b/src/ftermcap.cpp index e241e184..8b84c58d 100644 --- a/src/ftermcap.cpp +++ b/src/ftermcap.cpp @@ -27,6 +27,7 @@ #include "final/emptyfstring.h" #include "final/fc.h" #include "final/fkey_map.h" +#include "final/fsystem.h" #include "final/fterm.h" #include "final/ftermdata.h" #include "final/ftermcap.h" @@ -47,9 +48,10 @@ bool FTermcap::no_utf8_acs_chars {false}; int FTermcap::max_color {1}; int FTermcap::tabstop {8}; int FTermcap::attr_without_color {0}; +FSystem* FTermcap::fsystem {nullptr}; FTermData* FTermcap::fterm_data {nullptr}; FTermDetection* FTermcap::term_detection {nullptr}; - +char FTermcap::string_buf[2048] {}; //---------------------------------------------------------------------- // class FTermcap @@ -65,9 +67,43 @@ FTermDetection* FTermcap::term_detection {nullptr}; */ // public methods of FTermcap +//---------------------------------------------------------------------- +bool FTermcap::getFlag (const std::string& cap) +{ + return tgetflag(C_STR(cap.c_str())); +} + +//---------------------------------------------------------------------- +int FTermcap::getNumber (const std::string& cap) +{ + return tgetnum(C_STR(cap.c_str())); +} + +//---------------------------------------------------------------------- +char* FTermcap::getString (const std::string& cap) +{ + return tgetstr( C_STR(cap.c_str()) + , reinterpret_cast(&string_buf) ); +} + +//---------------------------------------------------------------------- +int FTermcap::paddingPrint ( const std::string& str + , int affcnt, fn_putc putc ) +{ + return fsystem->tputs (str.c_str(), affcnt, putc); +} + +//---------------------------------------------------------------------- +char* FTermcap::encodeMotionParameter ( const std::string& str + , int col, int row ) +{ + return tgoto(str.c_str(), col, row); +} + //---------------------------------------------------------------------- void FTermcap::init() { + fsystem = FTerm::getFSystem(); fterm_data = FTerm::getFTermData(); term_detection = FTerm::getFTermDetection(); termcap(); @@ -81,8 +117,6 @@ void FTermcap::termcap() static constexpr int success = 1; static constexpr int uninitialized = -2; static char term_buffer[2048]{}; - static char string_buf[2048]{}; - char* buffer = string_buf; int status = uninitialized; const bool color256 = term_detection->canDisplay256Colors(); @@ -119,7 +153,7 @@ void FTermcap::termcap() term_detection->setAnsiTerminal (true); termcapError (status); - termcapVariables (buffer); + termcapVariables(); } //---------------------------------------------------------------------- @@ -146,7 +180,7 @@ void FTermcap::termcapError (int status) } //---------------------------------------------------------------------- -void FTermcap::termcapVariables (char*& buffer) +void FTermcap::termcapVariables() { // Get termcap booleans termcapBoleans(); @@ -155,10 +189,10 @@ void FTermcap::termcapVariables (char*& buffer) termcapNumerics(); // Get termcap strings - termcapStrings (buffer); + termcapStrings(); // Get termcap keys - termcapKeys (buffer); + termcapKeys(); } //---------------------------------------------------------------------- @@ -167,29 +201,29 @@ void FTermcap::termcapBoleans() // Get termcap flags/booleans // Screen erased with the background color - background_color_erase = tgetflag(C_STR("ut")); + background_color_erase = getFlag("ut"); // Terminal is able to redefine existing colors - can_change_color_palette = tgetflag(C_STR("cc")); + can_change_color_palette = getFlag("cc"); // t_cursor_left wraps from column 0 to last column - automatic_left_margin = tgetflag(C_STR("bw")); + automatic_left_margin = getFlag("bw"); // Terminal has auto-matic margins - automatic_right_margin = tgetflag(C_STR("am")); + automatic_right_margin = getFlag("am"); // NewLine ignored after 80 cols - eat_nl_glitch = tgetflag(C_STR("xn")); + eat_nl_glitch = getFlag("xn"); // Terminal supports ANSI set default fg and bg color - ansi_default_color = tgetflag(C_STR("AX")); + ansi_default_color = getFlag("AX"); // Terminal supports operating system commands (OSC) // OSC = Esc + ']' - osc_support = tgetflag(C_STR("XT")); + osc_support = getFlag("XT"); // U8 is nonzero for terminals with no VT100 line-drawing in UTF-8 mode - no_utf8_acs_chars = bool(tgetnum(C_STR("U8")) != 0); + no_utf8_acs_chars = bool(getNumber("U8") != 0); } //---------------------------------------------------------------------- @@ -198,7 +232,7 @@ void FTermcap::termcapNumerics() // Get termcap numerics // Maximum number of colors on screen - max_color = std::max(max_color, tgetnum(C_STR("Co"))); + max_color = std::max(max_color, getNumber("Co")); if ( max_color < 0 ) max_color = 1; @@ -209,24 +243,24 @@ void FTermcap::termcapNumerics() fterm_data->setMonochron(false); // Get initial spacing for hardware tab stop - tabstop = tgetnum(C_STR("it")); + tabstop = getNumber("it"); // Get video attributes that cannot be used with colors - attr_without_color = tgetnum(C_STR("NC")); + attr_without_color = getNumber("NC"); } //---------------------------------------------------------------------- -void FTermcap::termcapStrings (char*& buffer) +void FTermcap::termcapStrings() { // Get termcap strings // Read termcap output strings for (std::size_t i{0}; strings[i].tname[0] != 0; i++) - strings[i].string = tgetstr(C_STR(strings[i].tname), &buffer); + strings[i].string = getString(strings[i].tname); } //---------------------------------------------------------------------- -void FTermcap::termcapKeys (char*& buffer) +void FTermcap::termcapKeys() { // Get termcap keys @@ -234,7 +268,7 @@ void FTermcap::termcapKeys (char*& buffer) for ( std::size_t i{0}; fc::fkey[i].string == nullptr && fc::fkey[i].tname[0] != 0; i++ ) - fc::fkey[i].string = tgetstr(C_STR(fc::fkey[i].tname), &buffer); + fc::fkey[i].string = getString(fc::fkey[i].tname); } diff --git a/src/fvterm.cpp b/src/fvterm.cpp index 7af39da3..71ba9303 100644 --- a/src/fvterm.cpp +++ b/src/fvterm.cpp @@ -2478,7 +2478,7 @@ void FVTerm::printFullWidthPaddingCharacter ( uInt& x, uInt y if ( le ) appendOutputBuffer (le); else if ( RI ) - appendOutputBuffer (tparm(C_STR(RI), 1, 0, 0, 0, 0, 0, 0, 0, 0)); + appendOutputBuffer (FTermcap::encodeParameter(RI, 1)); else { skipPaddingCharacter (x, y, prev_char); @@ -2518,7 +2518,7 @@ void FVTerm::printHalfCovertFullWidthCharacter ( uInt& x, uInt y if ( le ) appendOutputBuffer (le); else if ( RI ) - appendOutputBuffer (tparm(C_STR(RI), 1, 0, 0, 0, 0, 0, 0, 0, 0)); + appendOutputBuffer (FTermcap::encodeParameter(RI, 1)); if ( le || RI ) { @@ -2590,7 +2590,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y && (ut || normal) ) { appendAttributes (print_char); - appendOutputBuffer (tparm(C_STR(ec), whitespace, 0, 0, 0, 0, 0, 0, 0, 0)); + appendOutputBuffer (FTermcap::encodeParameter(ec, whitespace)); if ( x + whitespace - 1 < xmax || draw_trailing_ws ) setTermXY (int(x + whitespace), int(y)); @@ -2655,7 +2655,7 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y) newFontChanges (print_char); charsetChanges (print_char); appendAttributes (print_char); - appendOutputBuffer (tparm(C_STR(rp), print_char->ch, repetitions, 0, 0, 0, 0, 0, 0, 0)); + appendOutputBuffer (FTermcap::encodeParameter(rp, print_char->ch, repetitions)); term_pos->x_ref() += int(repetitions); x = x + repetitions - 1; } @@ -3038,7 +3038,7 @@ int FVTerm::appendLowerRight (FChar*& screen_char) if ( IC ) { - appendOutputBuffer (tparm(C_STR(IC), 1, 0, 0, 0, 0, 0, 0, 0, 0)); + appendOutputBuffer (FTermcap::encodeParameter(IC, 1)); appendChar (screen_char); } else if ( im && ei ) @@ -3077,13 +3077,13 @@ inline void FVTerm::characterFilter (FChar*& next_char) inline void FVTerm::appendOutputBuffer (const std::string& s) { const char* const& c_string = s.c_str(); - fsystem->tputs (c_string, 1, appendOutputBuffer); + FTermcap::paddingPrint (c_string, 1, appendOutputBuffer); } //---------------------------------------------------------------------- inline void FVTerm::appendOutputBuffer (const char s[]) { - fsystem->tputs (s, 1, appendOutputBuffer); + FTermcap::paddingPrint (s, 1, appendOutputBuffer); } //---------------------------------------------------------------------- diff --git a/src/include/final/foptiattr.h b/src/include/final/foptiattr.h index 349a24ce..a6b49698 100644 --- a/src/include/final/foptiattr.h +++ b/src/include/final/foptiattr.h @@ -36,23 +36,6 @@ #endif #include - -#if defined(__sun) && defined(__SVR4) - #include - typedef struct termio SGTTY; - typedef struct termios SGTTYS; - - #ifdef _LP64 - typedef unsigned int chtype; - #else - typedef unsigned long chtype; - #endif - - #include // need for tparm -#else - #include // need for tparm -#endif - #include // need for std::swap #include "final/fstring.h" diff --git a/src/include/final/foptimove.h b/src/include/final/foptimove.h index 0b516b37..a9661755 100644 --- a/src/include/final/foptimove.h +++ b/src/include/final/foptimove.h @@ -39,23 +39,6 @@ #endif #include - -#if defined(__sun) && defined(__SVR4) - #include - typedef struct termio SGTTY; - typedef struct termios SGTTYS; - - #ifdef _LP64 - typedef unsigned int chtype; - #else - typedef unsigned long chtype; - #endif // _LP64 - - #include // need for tparm -#else - #include // need for tparm -#endif // defined(__sun) && defined(__SVR4) - #include #include #include diff --git a/src/include/final/ftermcap.h b/src/include/final/ftermcap.h index bfec5ac9..864b9a3e 100644 --- a/src/include/final/ftermcap.h +++ b/src/include/final/ftermcap.h @@ -65,6 +65,7 @@ namespace finalcut { // class forward declaration +class FSystem; class FTermData; class FTermDetection; @@ -75,6 +76,9 @@ class FTermDetection; class FTermcap final { public: + // Using-declaration + using fn_putc = int (*)(int); + // Typedef typedef struct { @@ -90,38 +94,47 @@ class FTermcap final ~FTermcap() = default; // Accessors - const FString getClassName() const; + const FString getClassName() const; + static bool getFlag (const std::string&); + static int getNumber (const std::string&); + static char* getString (const std::string&); + static int paddingPrint (const std::string&, int, fn_putc); + static char* encodeMotionParameter (const std::string&, int, int); + template + static char* encodeParameter (const FString&, Args&&...); // Methods static void init(); // Data members - static bool background_color_erase; - static bool can_change_color_palette; - static bool automatic_left_margin; - static bool automatic_right_margin; - static bool eat_nl_glitch; - static bool ansi_default_color; - static bool osc_support; - static bool no_utf8_acs_chars; - static int max_color; - static int tabstop; - static int attr_without_color; - static tcap_map strings[]; + static bool background_color_erase; + static bool can_change_color_palette; + static bool automatic_left_margin; + static bool automatic_right_margin; + static bool eat_nl_glitch; + static bool ansi_default_color; + static bool osc_support; + static bool no_utf8_acs_chars; + static int max_color; + static int tabstop; + static int attr_without_color; + static tcap_map strings[]; private: // Methods - static void termcap(); - static void termcapError (int); - static void termcapVariables (char*&); - static void termcapBoleans(); - static void termcapNumerics(); - static void termcapStrings (char*&); - static void termcapKeys (char*&); + static void termcap(); + static void termcapError (int); + static void termcapVariables(); + static void termcapBoleans(); + static void termcapNumerics(); + static void termcapStrings(); + static void termcapKeys(); // Data member + static FSystem* fsystem; static FTermData* fterm_data; static FTermDetection* term_detection; + static char string_buf[2048]; }; @@ -130,6 +143,13 @@ class FTermcap final inline const FString FTermcap::getClassName() const { return "FTermcap"; } +//---------------------------------------------------------------------- +template +inline char* FTermcap::encodeParameter (const FString& str, Args&&... args) +{ + return tparm (str, std::forward(args)...); +} + } // namespace finalcut