Move all termcap code into FTermcap

This commit is contained in:
Markus Gans 2018-10-08 04:14:20 +02:00
parent 19239df5d1
commit 0b51df32b5
26 changed files with 496 additions and 470 deletions

View File

@ -1,3 +1,6 @@
2018-10-08 Markus Gans <guru.mail@muenster.de>
* Move all termcap code into FTermcap
2018-10-05 Markus Gans <guru.mail@muenster.de>
* Remove redundant program code from FString

View File

@ -346,9 +346,7 @@ void FApplication::showParameterUsage()
<< " Do not send a ESC prefix for the alt/meta key" << std::endl
<< " --no-cursorstyle-change"
<< " Do not change the current cursor style" << std::endl
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__)
#elif defined(__NetBSD__) || defined(__OpenBSD__)
<< std::endl
<< "NetBSD/OpenBSD console options:" << std::endl
<< " --no-esc-for-alt-meta "
@ -436,9 +434,7 @@ void FApplication::cmd_options (const int& argc, char* argv[])
#if defined(__FreeBSD__) || defined(__DragonFly__)
{C_STR("no-esc-for-alt-meta"), no_argument, 0, 0 },
{C_STR("no-cursorstyle-change"), no_argument, 0, 0 },
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__)
#elif defined(__NetBSD__) || defined(__OpenBSD__)
{C_STR("no-esc-for-alt-meta"), no_argument, 0, 0 },
#endif
@ -497,9 +493,7 @@ void FApplication::cmd_options (const int& argc, char* argv[])
if ( std::strcmp(long_options[idx].name, "no-cursorstyle-change") == 0 )
init_values.change_cursorstyle = false;
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__)
#elif defined(__NetBSD__) || defined(__OpenBSD__)
if ( std::strcmp(long_options[idx].name, "no-esc-for-alt-meta") == 0 )
init_values.meta_sends_escape = false;
#endif

View File

@ -290,7 +290,7 @@ void FButton::hide()
try
{
blank = new char[uInt(size) + 1];
blank = new char[std::size_t(size) + 1];
}
catch (const std::bad_alloc& ex)
{
@ -298,7 +298,7 @@ void FButton::hide()
return;
}
std::memset(blank, ' ', uLong(size));
std::memset(blank, ' ', std::size_t(size));
blank[size] = '\0';
for (int y = 0; y < getHeight() + s + (f << 1); y++)
@ -489,19 +489,19 @@ void FButton::getButtonState()
//----------------------------------------------------------------------
uChar FButton::getHotkey()
{
int length;
uInt length;
if ( text.isEmpty() )
return 0;
length = int(text.getLength());
length = text.getLength();
for (int i = 0; i < length; i++)
for (uInt i = 0; i < length; i++)
{
try
{
if ( i + 1 < length && text[uInt(i)] == '&' )
return uChar(text[uInt(++i)]);
if ( i + 1 < length && text[i] == '&' )
return uChar(text[++i]);
}
catch (const std::out_of_range&)
{
@ -754,7 +754,7 @@ void FButton::draw()
try
{
button_text = new wchar_t[uInt(txtlength) + 1]();
button_text = new wchar_t[std::size_t(txtlength) + 1]();
}
catch (const std::bad_alloc& ex)
{

View File

@ -228,7 +228,7 @@ void FButtonGroup::hide()
try
{
blank = new char[uInt(size) + 1];
blank = new char[std::size_t(size) + 1];
}
catch (const std::bad_alloc& ex)
{
@ -236,7 +236,7 @@ void FButtonGroup::hide()
return;
}
std::memset(blank, ' ', uLong(size));
std::memset(blank, ' ', std::size_t(size));
blank[size] = '\0';
for (int y = 0; y < getHeight(); y++)

View File

@ -267,7 +267,7 @@ void FLabel::hide()
try
{
blank = new char[uInt(size) + 1];
blank = new char[std::size_t(size) + 1];
}
catch (const std::bad_alloc& ex)
{
@ -275,7 +275,7 @@ void FLabel::hide()
return;
}
std::memset(blank, ' ', uLong(size));
std::memset(blank, ' ', std::size_t(size));
blank[getWidth()] = '\0';
setPrintPos (1,1);
print (blank);

View File

@ -308,7 +308,7 @@ void FLineEdit::hide()
try
{
blank = new char[uInt(size) + 1];
blank = new char[std::size_t(size) + 1];
}
catch (const std::bad_alloc& ex)
{
@ -316,7 +316,7 @@ void FLineEdit::hide()
return;
}
std::memset(blank, ' ', uLong(size));
std::memset(blank, ' ', std::size_t(size));
blank[size] = '\0';
for (int y = 0; y < getHeight() + s; y++)

View File

@ -267,7 +267,7 @@ void FListBox::hide()
try
{
blank = new char[uInt(size) + 1];
blank = new char[std::size_t(size) + 1];
}
catch (const std::bad_alloc& ex)
{
@ -275,7 +275,7 @@ void FListBox::hide()
return;
}
std::memset (blank, ' ', uLong(size));
std::memset (blank, ' ', std::size_t(size));
blank[size] = '\0';
for (int y = 0; y < getHeight(); y++)
@ -402,7 +402,7 @@ void FListBox::clear()
try
{
blank = new char[uInt(size) + 1];
blank = new char[std::size_t(size) + 1];
}
catch (const std::bad_alloc& ex)
{
@ -410,7 +410,7 @@ void FListBox::clear()
return;
}
std::memset (blank, ' ', uLong(size));
std::memset (blank, ' ', std::size_t(size));
blank[size] = '\0';
for (int y = 0; y < getHeight() - 2; y++)

View File

@ -237,8 +237,9 @@ FString FListViewItem::getText (int column) const
|| column > int(column_list.size()) )
return fc::emptyFString::get();
column--; // Convert column position to address offset (index)
return column_list[uInt(column)];
// Convert column position to address offset (index)
std::size_t index = uInt(column - 1);
return column_list[index];
}
//----------------------------------------------------------------------
@ -263,23 +264,24 @@ void FListViewItem::setText (int column, const FString& text)
|| column > int(column_list.size()) )
return;
// Convert column position to address offset (index)
std::size_t index = uInt(column - 1);
FObject* parent = getParent();
column--; // Convert column position to address offset (index)
if ( parent && parent->isInstanceOf("FListView") )
{
FListView* listview = static_cast<FListView*>(parent);
if ( ! listview->header[uInt(column)].fixed_width )
if ( ! listview->header[index].fixed_width )
{
int length = int(text.getLength());
if ( length > listview->header[uInt(column)].width )
listview->header[uInt(column)].width = length;
if ( length > listview->header[index].width )
listview->header[index].width = length;
}
}
column_list[uInt(column)] = text;
column_list[index] = text;
}
//----------------------------------------------------------------------
@ -346,15 +348,15 @@ void FListViewItem::sort (Compare cmp)
return;
// Sort the top level
FObject::FObjectList& children_list = getChildren();
FObject::FObjectList& children = getChildren();
if ( ! children_list.empty() )
children_list.sort(cmp);
if ( ! children.empty() )
children.sort(cmp);
// Sort the sublevels
FListViewIterator iter = children_list.begin();
FListViewIterator iter = begin();
while ( iter != children_list.end() )
while ( iter != end() )
{
if ( *iter )
{
@ -652,8 +654,9 @@ fc::text_alignment FListView::getColumnAlignment (int column) const
if ( column < 1 || header.empty() || column > int(header.size()) )
return fc::alignLeft;
column--; // Convert column position to address offset (index)
return header[uInt(column)].alignment;
// Convert column position to address offset (index)
std::size_t index = uInt(column - 1);
return header[index].alignment;
}
//----------------------------------------------------------------------
@ -664,19 +667,20 @@ FString FListView::getColumnText (int column) const
if ( column < 1 || header.empty() || column > int(header.size()) )
return fc::emptyFString::get();
column--; // Convert column position to address offset (index)
return header[uInt(column)].name;
// Convert column position to address offset (index)
std::size_t index = uInt(column - 1);
return header[index].name;
}
//----------------------------------------------------------------------
fc::sorting_type FListView::getColumnSortType (int column) const
{
fc::sorting_type type;
std::size_t size = uInt(column);
std::size_t col = uInt(column);
try
{
type = sort_type.at(size);
type = sort_type.at(col);
}
catch (const std::out_of_range&)
{
@ -713,8 +717,9 @@ void FListView::setColumnAlignment (int column, fc::text_alignment align)
if ( column < 1 || header.empty() || column > int(header.size()) )
return;
column--; // Convert column position to address offset (index)
header[uInt(column)].alignment = align;
// Convert column position to address offset (index)
std::size_t index = uInt(column - 1);
header[index].alignment = align;
}
//----------------------------------------------------------------------
@ -725,17 +730,18 @@ void FListView::setColumnText (int column, const FString& label)
if ( column < 1 || header.empty() || column > int(header.size()) )
return;
column--; // Convert column position to address offset (index)
// Convert column position to address offset (index)
std::size_t index = uInt(column - 1);
if ( ! header[uInt(column)].fixed_width )
if ( ! header[index].fixed_width )
{
int length = int(label.getLength());
if ( length > header[uInt(column)].width )
header[uInt(column)].width = length;
if ( length > header[index].width )
header[index].width = length;
}
header[uInt(column)].name = label;
header[index].name = label;
}
//----------------------------------------------------------------------

View File

@ -77,7 +77,7 @@ void FMenuBar::hide()
try
{
blank = new char[uInt(screenWidth) + 1];
blank = new char[std::size_t(screenWidth) + 1];
}
catch (const std::bad_alloc& ex)
{
@ -85,7 +85,7 @@ void FMenuBar::hide()
return;
}
std::memset(blank, ' ', uLong(screenWidth));
std::memset(blank, ' ', std::size_t(screenWidth));
blank[screenWidth] = '\0';
setPrintPos (1,1);
print (blank);

View File

@ -1487,13 +1487,11 @@ bool FMouseControl::isGpmMouseEnabled()
return false;
#ifdef F_HAVE_LIBGPM
FMouse* mouse = mouse_protocol[FMouse::gpm];
FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse);
if ( gpm_mouse )
return gpm_mouse->isGpmMouseEnabled();
#endif // F_HAVE_LIBGPM
return false;

View File

@ -126,7 +126,7 @@ void FProgressbar::hide()
try
{
blank = new char[uInt(size) + 1];
blank = new char[std::size_t(size) + 1];
}
catch (const std::bad_alloc& ex)
{
@ -134,7 +134,7 @@ void FProgressbar::hide()
return;
}
std::memset(blank, ' ', uLong(size));
std::memset(blank, ' ', std::size_t(size));
blank[size] = '\0';
for (int y = 0; y < getHeight() + s; y++)

View File

@ -210,7 +210,7 @@ void FStatusBar::hide()
try
{
blank = new char[uInt(screenWidth) + 1];
blank = new char[std::size_t(screenWidth) + 1];
}
catch (const std::bad_alloc& ex)
{
@ -218,7 +218,7 @@ void FStatusBar::hide()
return;
}
std::memset(blank, ' ', uLong(screenWidth));
std::memset(blank, ' ', std::size_t(screenWidth));
blank[screenWidth] = '\0';
setPrintPos (1, 1);
print (blank);

View File

@ -1750,7 +1750,7 @@ inline char* FString::wc_to_c_str (const wchar_t s[]) const
try
{
c_string = new char[uInt(dest_size)]();
c_string = new char[std::size_t(dest_size)]();
// pre-initialiaze the whole string with '\0'
std::memset (c_string, '\0', std::size_t(dest_size));
@ -1761,7 +1761,7 @@ inline char* FString::wc_to_c_str (const wchar_t s[]) const
return 0;
}
mblength = int(std::wcsrtombs (c_string, &src, uLong(dest_size), &state));
mblength = int(std::wcsrtombs (c_string, &src, std::size_t(dest_size), &state));
if ( mblength == -1 && errno != EILSEQ )
{
@ -1807,7 +1807,7 @@ inline wchar_t* FString::c_to_wc_str (const char s[]) const
try
{
dest = new wchar_t[uInt(size)]();
dest = new wchar_t[std::size_t(size)]();
// pre-initialiaze the whole string with '\0'
std::wmemset (dest, L'\0', std::size_t(size));
}
@ -1817,7 +1817,7 @@ inline wchar_t* FString::c_to_wc_str (const char s[]) const
return 0;
}
wclength = int(std::mbsrtowcs (dest, &src, uLong(dest_size), &state));
wclength = int(std::mbsrtowcs (dest, &src, std::size_t(dest_size), &state));
if ( wclength == -1 )
{

View File

@ -53,13 +53,9 @@ FMouseControl* FTerm::mouse = 0;
#if defined(__linux__)
FTermLinux* FTerm::linux = 0;
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
#elif defined(__FreeBSD__) || defined(__DragonFly__)
FTermFreeBSD* FTerm::freebsd = 0;
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__)
#elif defined(__NetBSD__) || defined(__OpenBSD__)
FTermOpenBSD* FTerm::openbsd = 0;
#endif
@ -840,9 +836,7 @@ void FTerm::initScreenSettings()
linux->initCharMap (fc::character);
data->supportShadowCharacter (linux->hasShadowCharacter());
data->supportHalfBlockCharacter (linux->hasHalfBlockCharacter());
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
#elif defined(__FreeBSD__) || defined(__DragonFly__)
freebsd->initCharMap (fc::character);
#endif
@ -1091,269 +1085,32 @@ void FTerm::init_keyboard()
}
//----------------------------------------------------------------------
/* Terminal capability data base
* -----------------------------
* Info under: man 5 terminfo
*
* Importent shell commands:
* captoinfo - convert all termcap descriptions into terminfo descriptions
* infocmp - print out terminfo description from the current terminal
*/
void FTerm::init_termcap()
{
std::vector<std::string> terminals;
std::vector<std::string>::iterator iter;
static const int success = 1;
static const int uninitialized = -2;
static char term_buffer[2048];
static char string_buf[2048];
char* buffer = string_buf;
int status = uninitialized;
bool color256 = term_detection->canDisplay256Colors();
// Initialize the terminal capabilities
FTermcap termcap;
termcap.setTermData(data);
termcap.setFTermDetection(term_detection);
termcap.init();
// Share the terminal capabilities
tcap = FTermcap::getTermcapMap();
// Open termcap file
const char* termtype = data->getTermType();
terminals.push_back(termtype); // available terminal type
if ( color256 ) // 1st fallback if not found
terminals.push_back("xterm-256color");
terminals.push_back("xterm"); // 2nd fallback if not found
terminals.push_back("ansi"); // 3rd fallback if not found
terminals.push_back("vt100"); // 4th fallback if not found
iter = terminals.begin();
while ( iter != terminals.end() )
{
data->setTermType(iter->c_str());
// Open the termcap file + load entry for termtype
status = tgetent(term_buffer, termtype);
if ( status == success || ! term_detection->hasTerminalDetection() )
break;
++iter;
}
if ( std::strncmp(termtype, "ansi", 4) == 0 )
term_detection->setAnsiTerminal (true);
init_termcap_error (status);
init_termcap_variables (buffer);
tcap = termcap.getTermcapMap();
}
//----------------------------------------------------------------------
void FTerm::init_termcap_error (int status)
void FTerm::init_quirks()
{
static const int no_entry = 0;
static const int db_not_found = -1;
static const int uninitialized = -2;
// Initialize terminal quirks
if ( status == no_entry || status == uninitialized )
{
const char* termtype = data->getTermType();
std::cerr << "Unknown terminal: " << termtype << "\n"
<< "Check the TERM environment variable\n"
<< "Also make sure that the terminal\n"
<< "is defined in the termcap/terminfo database.\n";
std::abort();
}
else if ( status == db_not_found )
{
std::cerr << "The termcap/terminfo database could not be found.\n";
std::abort();
}
}
//----------------------------------------------------------------------
void FTerm::init_termcap_variables (char*& buffer)
{
// Get termcap booleans
init_termcap_booleans();
// Get termcap numerics
init_termcap_numerics();
// Get termcap strings
init_termcap_strings(buffer);
// Terminal quirks
FTermcapQuirks quirks;
quirks.setTermData (data);
quirks.setFTermDetection (term_detection);
quirks.terminalFixup(); // Fix terminal quirks
// Get termcap keys
init_termcap_keys(buffer);
// Initialize cursor movement optimization
init_OptiMove();
// Initialize video attributes optimization
init_OptiAttr();
quirks.terminalFixup(); // Fix terminal quirks
}
//----------------------------------------------------------------------
void FTerm::init_termcap_booleans()
{
// Get termcap booleans
// Screen erased with the background color
FTermcap::background_color_erase = tgetflag(C_STR("ut"));
// t_cursor_left wraps from column 0 to last column
FTermcap::automatic_left_margin = tgetflag(C_STR("bw"));
// Terminal has auto-matic margins
FTermcap::automatic_right_margin = tgetflag(C_STR("am"));
// NewLine ignored after 80 cols
FTermcap::eat_nl_glitch = tgetflag(C_STR("xn"));
// Terminal supports ANSI set default fg and bg color
FTermcap::ansi_default_color = tgetflag(C_STR("AX"));
// Terminal supports operating system commands (OSC)
// OSC = Esc + ']'
FTermcap::osc_support = tgetflag(C_STR("XT"));
// U8 is nonzero for terminals with no VT100 line-drawing in UTF-8 mode
FTermcap::no_utf8_acs_chars = bool(tgetnum(C_STR("U8")) != 0);
}
//----------------------------------------------------------------------
void FTerm::init_termcap_numerics()
{
// Get termcap numeric
// Maximum number of colors on screen
FTermcap::max_color = std::max( FTermcap::max_color
, tgetnum(C_STR("Co")) );
if ( getMaxColor() < 0 )
FTermcap::max_color = 1;
if ( getMaxColor() < 8 )
data->setMonochron(true);
else
data->setMonochron(false);
// Get initial spacing for hardware tab stop
FTermcap::tabstop = tgetnum(C_STR("it"));
// Get video attributes that cannot be used with colors
FTermcap::attr_without_color = tgetnum(C_STR("NC"));
}
//----------------------------------------------------------------------
void FTerm::init_termcap_strings (char*& buffer)
{
// Get termcap strings
// Read termcap output strings
for (int i = 0; tcap[i].tname[0] != 0; i++)
tcap[i].string = tgetstr(tcap[i].tname, &buffer);
}
//----------------------------------------------------------------------
void FTerm::init_termcap_keys_vt100 (char*& buffer)
{
// Some terminals (e.g. PuTTY) send vt100 key codes for
// the arrow and function keys.
char* key_up_string = tgetstr(C_STR("ku"), &buffer);
if ( (key_up_string && (std::strcmp(key_up_string, CSI "A") == 0))
|| ( TCAP(fc::t_cursor_up)
&& (std::strcmp(TCAP(fc::t_cursor_up), CSI "A") == 0) ) )
{
for (int i = 0; fc::Fkey[i].tname[0] != 0; i++)
{
if ( std::strncmp(fc::Fkey[i].tname, "kux", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "A"); // Key up
if ( std::strncmp(fc::Fkey[i].tname, "kdx", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "B"); // Key down
if ( std::strncmp(fc::Fkey[i].tname, "krx", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "C"); // Key right
if ( std::strncmp(fc::Fkey[i].tname, "klx", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "D"); // Key left
if ( std::strncmp(fc::Fkey[i].tname, "k1X", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OP"); // PF1
if ( std::strncmp(fc::Fkey[i].tname, "k2X", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OQ"); // PF2
if ( std::strncmp(fc::Fkey[i].tname, "k3X", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OR"); // PF3
if ( std::strncmp(fc::Fkey[i].tname, "k4X", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OS"); // PF4
}
}
}
//----------------------------------------------------------------------
void FTerm::init_termcap_keys (char*& buffer)
{
// Read termcap key strings
for (int i = 0; fc::Fkey[i].tname[0] != 0; i++)
{
fc::Fkey[i].string = tgetstr(fc::Fkey[i].tname, &buffer);
// Fallback for rxvt with TERM=xterm
if ( std::strncmp(fc::Fkey[i].tname, "khx", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "7~"); // Home key
if ( std::strncmp(fc::Fkey[i].tname, "@7x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "8~"); // End key
if ( std::strncmp(fc::Fkey[i].tname, "k1x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "11~"); // F1
if ( std::strncmp(fc::Fkey[i].tname, "k2x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "12~"); // F2
if ( std::strncmp(fc::Fkey[i].tname, "k3x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "13~"); // F3
if ( std::strncmp(fc::Fkey[i].tname, "k4x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "14~"); // F4
// Fallback for TERM=ansi
if ( std::strncmp(fc::Fkey[i].tname, "@7X", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "K"); // End key
// Keypad keys
if ( std::strncmp(fc::Fkey[i].tname, "@8x", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OM"); // Enter key
if ( std::strncmp(fc::Fkey[i].tname, "KP1", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Oo"); // Keypad slash
if ( std::strncmp(fc::Fkey[i].tname, "KP2", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Oj"); // Keypad asterisk
if ( std::strncmp(fc::Fkey[i].tname, "KP3", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Om"); // Keypad minus sign
if ( std::strncmp(fc::Fkey[i].tname, "KP4", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Ok"); // Keypad plus sign
}
// VT100 key codes for the arrow and function keys
init_termcap_keys_vt100(buffer);
}
//----------------------------------------------------------------------
void FTerm::init_OptiMove()
void FTerm::init_optiMove()
{
// Duration precalculation of the cursor movement strings
@ -1388,7 +1145,7 @@ void FTerm::init_OptiMove()
}
//----------------------------------------------------------------------
void FTerm::init_OptiAttr()
void FTerm::init_optiAttr()
{
// Setting video attribute optimization
@ -1719,9 +1476,7 @@ void FTerm::setInsertCursorStyle()
, data->isCursorHidden() );
putstring (cstyle);
std::fflush(stdout);
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
#elif defined(__FreeBSD__) || defined(__DragonFly__)
freebsd->setCursorStyle ( fc::destructive_cursor
, data->isCursorHidden() );
#endif
@ -1742,9 +1497,7 @@ void FTerm::setOverwriteCursorStyle()
, data->isCursorHidden() );
putstring (cstyle);
std::fflush(stdout);
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
#elif defined(__FreeBSD__) || defined(__DragonFly__)
freebsd->setCursorStyle ( fc::normal_cursor
, data->isCursorHidden() );
#endif
@ -1846,13 +1599,9 @@ inline void FTerm::allocationValues()
#if defined(__linux__)
linux = new FTermLinux();
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
#elif defined(__FreeBSD__) || defined(__DragonFly__)
freebsd = new FTermFreeBSD();
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__)
#elif defined(__NetBSD__) || defined(__OpenBSD__)
openbsd = new FTermOpenBSD();
#endif
}
@ -1870,14 +1619,10 @@ inline void FTerm::deallocationValues()
#if defined(__NetBSD__) || defined(__OpenBSD__)
if ( openbsd )
delete openbsd;
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
#elif defined(__FreeBSD__) || defined(__DragonFly__)
if ( freebsd )
delete freebsd;
#endif
#if defined(__linux__)
#elif defined(__linux__)
if ( linux )
delete linux;
#endif
@ -1943,6 +1688,17 @@ void FTerm::init (bool disable_alt_screen)
// Initializes variables for the current terminal
init_termcap();
// Initialize terminal quirks
init_quirks();
// Initialize cursor movement optimization
init_optiMove();
// Initialize video attributes optimization
init_optiAttr();
// Initialize vt100 alternate character set
init_alt_charset();
// Pass the terminal capabilities to the keyboard object
@ -2043,9 +1799,7 @@ void FTerm::initOSspecifics()
freebsd->disableChangeCursorStyle();
freebsd->init(); // Initialize BSD console
#endif // defined(__FreeBSD__) || defined(__DragonFly__)
#if defined(__NetBSD__) || defined(__OpenBSD__)
#elif defined(__NetBSD__) || defined(__OpenBSD__)
if ( init_values.meta_sends_escape )
openbsd->enableMetaSendsEscape();
else
@ -2150,13 +1904,9 @@ void FTerm::finishOSspecifics1()
{
#if defined(__linux__)
linux->finish();
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
#elif defined(__FreeBSD__) || defined(__DragonFly__)
freebsd->finish();
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__)
#elif defined(__NetBSD__) || defined(__OpenBSD__)
openbsd->finish();
#endif
}

View File

@ -26,16 +26,18 @@ namespace finalcut
{
// static class attributes
bool FTermcap::background_color_erase = false;
bool FTermcap::automatic_left_margin = false;
bool FTermcap::automatic_right_margin = false;
bool FTermcap::eat_nl_glitch = false;
bool FTermcap::ansi_default_color = false;
bool FTermcap::osc_support = false;
bool FTermcap::no_utf8_acs_chars = false;
int FTermcap::max_color = 1;
int FTermcap::tabstop = 8;
int FTermcap::attr_without_color = 0;
bool FTermcap::background_color_erase = false;
bool FTermcap::automatic_left_margin = false;
bool FTermcap::automatic_right_margin = false;
bool FTermcap::eat_nl_glitch = false;
bool FTermcap::ansi_default_color = false;
bool FTermcap::osc_support = false;
bool FTermcap::no_utf8_acs_chars = false;
int FTermcap::max_color = 1;
int FTermcap::tabstop = 8;
int FTermcap::attr_without_color = 0;
FTermData* FTermcap::fterm_data = 0;
FTermDetection* FTermcap::term_detection = 0;
//----------------------------------------------------------------------
@ -51,6 +53,276 @@ FTermcap::FTermcap()
FTermcap::~FTermcap() // destructor
{ }
/* Terminal capability data base
* -----------------------------
* Info under: man 5 terminfo
*
* Importent shell commands:
* captoinfo - convert all termcap descriptions into terminfo descriptions
* infocmp - print out terminfo description from the current terminal
*/
// public methods of FTermcap
//----------------------------------------------------------------------
void FTermcap::setTermData (FTermData* data)
{
fterm_data = data;
}
//----------------------------------------------------------------------
void FTermcap::setFTermDetection (FTermDetection* td)
{
term_detection = td;
}
//----------------------------------------------------------------------
void FTermcap::init()
{
termcap();
}
// private methods of FTermcap
//----------------------------------------------------------------------
void FTermcap::termcap()
{
std::vector<std::string> terminals;
std::vector<std::string>::iterator iter;
static const int success = 1;
static const int uninitialized = -2;
static char term_buffer[2048];
static char string_buf[2048];
char* buffer = string_buf;
int status = uninitialized;
bool color256 = term_detection->canDisplay256Colors();
// Open termcap file
const char* termtype = fterm_data->getTermType();
terminals.push_back(termtype); // available terminal type
if ( color256 ) // 1st fallback if not found
terminals.push_back("xterm-256color");
terminals.push_back("xterm"); // 2nd fallback if not found
terminals.push_back("ansi"); // 3rd fallback if not found
terminals.push_back("vt100"); // 4th fallback if not found
iter = terminals.begin();
while ( iter != terminals.end() )
{
fterm_data->setTermType(iter->c_str());
// Open the termcap file + load entry for termtype
status = tgetent(term_buffer, termtype);
if ( status == success || ! term_detection->hasTerminalDetection() )
break;
++iter;
}
if ( std::strncmp(termtype, "ansi", 4) == 0 )
term_detection->setAnsiTerminal (true);
termcapError (status);
termcapVariables (buffer);
}
//----------------------------------------------------------------------
void FTermcap::termcapError (int status)
{
static const int no_entry = 0;
static const int db_not_found = -1;
static const int uninitialized = -2;
if ( status == no_entry || status == uninitialized )
{
const char* termtype = fterm_data->getTermType();
std::cerr << "Unknown terminal: " << termtype << "\n"
<< "Check the TERM environment variable\n"
<< "Also make sure that the terminal\n"
<< "is defined in the termcap/terminfo database.\n";
std::abort();
}
else if ( status == db_not_found )
{
std::cerr << "The termcap/terminfo database could not be found.\n";
std::abort();
}
}
//----------------------------------------------------------------------
void FTermcap::termcapVariables (char*& buffer)
{
// Get termcap booleans
termcapBoleans();
// Get termcap numerics
termcapNumerics();
// Get termcap strings
termcapStrings (buffer);
// Get termcap keys
termcapKeys (buffer);
}
//----------------------------------------------------------------------
void FTermcap::termcapBoleans()
{
// Get termcap booleans
// Screen erased with the background color
background_color_erase = tgetflag(C_STR("ut"));
// t_cursor_left wraps from column 0 to last column
automatic_left_margin = tgetflag(C_STR("bw"));
// Terminal has auto-matic margins
automatic_right_margin = tgetflag(C_STR("am"));
// NewLine ignored after 80 cols
eat_nl_glitch = tgetflag(C_STR("xn"));
// Terminal supports ANSI set default fg and bg color
ansi_default_color = tgetflag(C_STR("AX"));
// Terminal supports operating system commands (OSC)
// OSC = Esc + ']'
osc_support = tgetflag(C_STR("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);
}
//----------------------------------------------------------------------
void FTermcap::termcapNumerics()
{
// Get termcap numeric
// Maximum number of colors on screen
max_color = std::max(max_color, tgetnum(C_STR("Co")));
if ( max_color < 0 )
max_color = 1;
if ( max_color < 8 )
fterm_data->setMonochron(true);
else
fterm_data->setMonochron(false);
// Get initial spacing for hardware tab stop
tabstop = tgetnum(C_STR("it"));
// Get video attributes that cannot be used with colors
attr_without_color = tgetnum(C_STR("NC"));
}
//----------------------------------------------------------------------
void FTermcap::termcapStrings (char*& buffer)
{
// Get termcap strings
// Read termcap output strings
for (int i = 0; tcap[i].tname[0] != 0; i++)
tcap[i].string = tgetstr(tcap[i].tname, &buffer);
}
//----------------------------------------------------------------------
void FTermcap::termcapKeys (char*& buffer)
{
// Read termcap key strings
for (int i = 0; fc::Fkey[i].tname[0] != 0; i++)
{
fc::Fkey[i].string = tgetstr(fc::Fkey[i].tname, &buffer);
// Fallback for rxvt with TERM=xterm
if ( std::strncmp(fc::Fkey[i].tname, "khx", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "7~"); // Home key
if ( std::strncmp(fc::Fkey[i].tname, "@7x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "8~"); // End key
if ( std::strncmp(fc::Fkey[i].tname, "k1x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "11~"); // F1
if ( std::strncmp(fc::Fkey[i].tname, "k2x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "12~"); // F2
if ( std::strncmp(fc::Fkey[i].tname, "k3x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "13~"); // F3
if ( std::strncmp(fc::Fkey[i].tname, "k4x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "14~"); // F4
// Fallback for TERM=ansi
if ( std::strncmp(fc::Fkey[i].tname, "@7X", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "K"); // End key
// Keypad keys
if ( std::strncmp(fc::Fkey[i].tname, "@8x", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OM"); // Enter key
if ( std::strncmp(fc::Fkey[i].tname, "KP1", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Oo"); // Keypad slash
if ( std::strncmp(fc::Fkey[i].tname, "KP2", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Oj"); // Keypad asterisk
if ( std::strncmp(fc::Fkey[i].tname, "KP3", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Om"); // Keypad minus sign
if ( std::strncmp(fc::Fkey[i].tname, "KP4", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Ok"); // Keypad plus sign
}
// VT100 key codes for the arrow and function keys
termcapKeysVt100 (buffer);
}
//----------------------------------------------------------------------
void FTermcap::termcapKeysVt100 (char*& buffer)
{
// Some terminals (e.g. PuTTY) send vt100 key codes for
// the arrow and function keys.
char* key_up_string = tgetstr(C_STR("ku"), &buffer);
if ( (key_up_string && (std::strcmp(key_up_string, CSI "A") == 0))
|| ( TCAP(fc::t_cursor_up)
&& (std::strcmp(TCAP(fc::t_cursor_up), CSI "A") == 0) ) )
{
for (int i = 0; fc::Fkey[i].tname[0] != 0; i++)
{
if ( std::strncmp(fc::Fkey[i].tname, "kux", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "A"); // Key up
if ( std::strncmp(fc::Fkey[i].tname, "kdx", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "B"); // Key down
if ( std::strncmp(fc::Fkey[i].tname, "krx", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "C"); // Key right
if ( std::strncmp(fc::Fkey[i].tname, "klx", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "D"); // Key left
if ( std::strncmp(fc::Fkey[i].tname, "k1X", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OP"); // PF1
if ( std::strncmp(fc::Fkey[i].tname, "k2X", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OQ"); // PF2
if ( std::strncmp(fc::Fkey[i].tname, "k3X", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OR"); // PF3
if ( std::strncmp(fc::Fkey[i].tname, "k4X", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OS"); // PF4
}
}
}
// private Data Member of FTermcap - termcap capabilities
//----------------------------------------------------------------------

View File

@ -69,54 +69,54 @@ void FTermcapQuirks::terminalFixup()
if ( td->isCygwinTerminal() )
{
init_termcap_cygwin_quirks();
cygwin();
}
else if ( td->isLinuxTerm() )
{
init_termcap_linux_quirks();
linux();
}
else if ( td->isRxvtTerminal() )
{
init_termcap_rxvt_quirks();
rxvt();
}
else if ( td->isGnomeTerminal() )
{
init_termcap_vte_quirks();
vte();
}
else if ( td->isTeraTerm() )
{
init_termcap_teraterm_quirks();
teraterm();
}
else if ( td->isSunTerminal() )
{
init_termcap_sun_quirks();
sun();
}
else if ( td->isPuttyTerminal() )
{
init_termcap_putty_quirks();
putty();
}
else if ( td->isScreenTerm() )
{
init_termcap_screen_quirks();
screen();
}
#if defined(__FreeBSD__) || defined(__DragonFly__)
else if ( td->isFreeBSDTerm() )
{
init_termcap_freebsd_quirks();
freebsd();
}
#endif // defined(__FreeBSD__) || defined(__DragonFly__)
// xterm and compatible terminals
if ( td->isXTerminal() && ! td->isPuttyTerminal() )
init_termcap_xterm_quirks();
xterm();
// Fixes general quirks
init_termcap_general_quirks();
general();
}
#if defined(__FreeBSD__) || defined(__DragonFly__)
//----------------------------------------------------------------------
void FTermcapQuirks::init_termcap_freebsd_quirks()
void FTermcapQuirks::freebsd()
{
// FreeBSD console fixes
@ -142,7 +142,7 @@ void FTermcapQuirks::init_termcap_freebsd_quirks()
#endif // defined(__FreeBSD__) || defined(__DragonFly__)
//----------------------------------------------------------------------
void FTermcapQuirks::init_termcap_cygwin_quirks()
void FTermcapQuirks::cygwin()
{
// Set invisible cursor for cygwin terminal
if ( ! TCAP(fc::t_cursor_invisible) )
@ -168,11 +168,11 @@ void FTermcapQuirks::init_termcap_cygwin_quirks()
FTermcap::background_color_erase = true;
// Include the Linux console quirks
init_termcap_linux_quirks();
linux();
}
//----------------------------------------------------------------------
void FTermcapQuirks::init_termcap_linux_quirks()
void FTermcapQuirks::linux()
{
/* Same settings are used by cygwin */
@ -223,7 +223,7 @@ void FTermcapQuirks::init_termcap_linux_quirks()
}
//----------------------------------------------------------------------
void FTermcapQuirks::init_termcap_xterm_quirks()
void FTermcapQuirks::xterm()
{
// Fallback if "Ic" is not found
if ( ! TCAP(fc::t_initialize_color) )
@ -247,7 +247,7 @@ void FTermcapQuirks::init_termcap_xterm_quirks()
}
//----------------------------------------------------------------------
void FTermcapQuirks::init_termcap_rxvt_quirks()
void FTermcapQuirks::rxvt()
{
// Set enter/exit alternative charset mode for rxvt terminal
const char* termtype = fterm_data->getTermType();
@ -271,7 +271,7 @@ void FTermcapQuirks::init_termcap_rxvt_quirks()
}
//----------------------------------------------------------------------
void FTermcapQuirks::init_termcap_vte_quirks()
void FTermcapQuirks::vte()
{
// gnome-terminal has NC=16 however, it can use the dim attribute
FTermcap::attr_without_color = 0;
@ -282,7 +282,7 @@ void FTermcapQuirks::init_termcap_vte_quirks()
}
//----------------------------------------------------------------------
void FTermcapQuirks::init_termcap_putty_quirks()
void FTermcapQuirks::putty()
{
FTermcap::background_color_erase = true;
FTermcap::osc_support = true;
@ -368,7 +368,7 @@ void FTermcapQuirks::init_termcap_putty_quirks()
}
//----------------------------------------------------------------------
void FTermcapQuirks::init_termcap_teraterm_quirks()
void FTermcapQuirks::teraterm()
{
// Tera Term eat_nl_glitch fix
FTermcap::eat_nl_glitch = true;
@ -385,14 +385,14 @@ void FTermcapQuirks::init_termcap_teraterm_quirks()
}
//----------------------------------------------------------------------
void FTermcapQuirks::init_termcap_sun_quirks()
void FTermcapQuirks::sun()
{
// Sun Microsystems workstation console eat_nl_glitch fix
FTermcap::eat_nl_glitch = true;
}
//----------------------------------------------------------------------
void FTermcapQuirks::init_termcap_screen_quirks()
void FTermcapQuirks::screen()
{
// Fallback if "Ic" is not found
if ( ! TCAP(fc::t_initialize_color) )
@ -417,7 +417,7 @@ void FTermcapQuirks::init_termcap_screen_quirks()
}
//----------------------------------------------------------------------
void FTermcapQuirks::init_termcap_general_quirks()
void FTermcapQuirks::general()
{
static const int not_available = -1;

View File

@ -589,7 +589,7 @@ bool FTermLinux::getUnicodeMap()
try
{
screen_unicode_map.entries = new struct unipair[uInt(count)]();
screen_unicode_map.entries = new struct unipair[std::size_t(count)]();
}
catch (const std::bad_alloc& ex)
{

View File

@ -220,7 +220,7 @@ void FTextView::hide()
try
{
blank = new char[uInt(size) + 1];
blank = new char[std::size_t(size) + 1];
}
catch (const std::bad_alloc& ex)
{
@ -228,7 +228,7 @@ void FTextView::hide()
return;
}
std::memset(blank, ' ', uLong(size));
std::memset(blank, ' ', std::size_t(size));
blank[size] = '\0';
for (int y = 0; y < getHeight(); y++)
@ -355,7 +355,7 @@ void FTextView::clear()
try
{
blank = new char[uInt(size) + 1];
blank = new char[std::size_t(size) + 1];
}
catch (const std::bad_alloc& ex)
{
@ -363,7 +363,7 @@ void FTextView::clear()
return;
}
std::memset(blank, ' ', uLong(size));
std::memset(blank, ' ', std::size_t(size));
blank[size] = '\0';
for (int y = 0; y < getTextHeight(); y++)

View File

@ -243,7 +243,7 @@ void FToggleButton::hide()
try
{
blank = new char[uInt(size) + 1];
blank = new char[std::size_t(size) + 1];
}
catch (const std::bad_alloc& ex)
{
@ -251,7 +251,7 @@ void FToggleButton::hide()
return;
}
std::memset(blank, ' ', uLong(size));
std::memset(blank, ' ', std::size_t(size));
blank[size] = '\0';
setPrintPos (1, 1);
print (blank);

View File

@ -653,7 +653,7 @@ void FVTerm::resizeArea ( int offset_left, int offset_top
assert ( height > 0 );
assert ( rsw >= 0 );
assert ( bsh >= 0 );
int area_size;
std::size_t area_size;
bool realloc_success = false;
if ( ! area )
@ -673,11 +673,13 @@ void FVTerm::resizeArea ( int offset_left, int offset_top
return;
}
area_size = (width + rsw) * (height + bsh);
area_size = std::size_t((width + rsw) * (height + bsh));
if ( area->height + area->bottom_shadow != height + bsh )
{
realloc_success = reallocateTextArea (area, height + bsh, area_size);
realloc_success = reallocateTextArea ( area
, std::size_t(height + bsh)
, area_size );
}
else if ( area->width + area->right_shadow != width + rsw )
{
@ -727,12 +729,9 @@ inline void FVTerm::setTextToDefault ( term_area* area
//----------------------------------------------------------------------
inline bool FVTerm::reallocateTextArea ( term_area* area
, int height
, int size )
, std::size_t height
, std::size_t size )
{
assert ( height > 0 );
assert ( size > 0 );
if ( area->changes != 0 )
delete[] area->changes;
@ -741,8 +740,8 @@ inline bool FVTerm::reallocateTextArea ( term_area* area
try
{
area->changes = new line_changes[uInt(height)];
area->text = new charData[uInt(size)];
area->changes = new line_changes[height];
area->text = new charData[size];
}
catch (const std::bad_alloc& ex)
{
@ -754,16 +753,14 @@ inline bool FVTerm::reallocateTextArea ( term_area* area
}
//----------------------------------------------------------------------
inline bool FVTerm::reallocateTextArea (term_area* area, int size)
inline bool FVTerm::reallocateTextArea (term_area* area, std::size_t size)
{
assert ( size > 0 );
if ( area->text != 0 )
delete[] area->text;
try
{
area->text = new charData[uInt(size)];
area->text = new charData[size];
}
catch (const std::bad_alloc& ex)
{

View File

@ -73,7 +73,6 @@
#ifdef F_HAVE_LIBGPM
#include <gpm.h>
#undef buttons // from term.h
#endif
namespace finalcut

View File

@ -103,26 +103,6 @@
#include <fcntl.h>
#include <langinfo.h>
#if defined(__sun) && defined(__SVR4)
#include <termio.h>
typedef struct termio SGTTY;
typedef struct termios SGTTYS;
#ifdef _LP64
typedef unsigned int chtype;
#else
typedef unsigned long chtype;
#endif // _LP64
#include <term.h> // termcap
#else
#include <term.h> // termcap
#endif // defined(__sun) && defined(__SVR4)
#ifdef F_HAVE_LIBGPM
#undef buttons // from term.h
#endif
#if F_HAVE_GETTTYNAM && F_HAVE_TTYENT_H
#include <ttyent.h>
#endif
@ -151,13 +131,9 @@
#if defined(__linux__)
#include "final/ftermlinux.h"
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
#elif defined(__FreeBSD__) || defined(__DragonFly__)
#include "final/ftermfreebsd.h"
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__)
#elif defined(__NetBSD__) || defined(__OpenBSD__)
#include "final/ftermopenbsd.h"
#endif
@ -336,9 +312,7 @@ class FTerm
#if defined(__FreeBSD__) || defined(__DragonFly__)
meta_sends_escape = true;
change_cursorstyle = true;
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__)
#elif defined(__NetBSD__) || defined(__OpenBSD__)
meta_sends_escape = true;
#endif
}
@ -356,9 +330,7 @@ class FTerm
uInt8 meta_sends_escape : 1;
uInt8 change_cursorstyle : 1;
uInt8 : 6; // padding bits
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__)
#elif defined(__NetBSD__) || defined(__OpenBSD__)
uInt8 meta_sends_escape : 1;
uInt8 : 7; // padding bits
#endif
@ -382,15 +354,9 @@ class FTerm
static void init_fixed_max_color();
static void init_keyboard();
static void init_termcap();
static void init_termcap_error (int);
static void init_termcap_variables(char*&);
static void init_termcap_booleans();
static void init_termcap_numerics();
static void init_termcap_strings (char*&);
static void init_termcap_keys_vt100 (char*&);
static void init_termcap_keys (char*&);
static void init_OptiMove();
static void init_OptiAttr();
static void init_quirks();
static void init_optiMove();
static void init_optiAttr();
static void init_font();
static void init_locale();
static void init_encoding();
@ -435,13 +401,9 @@ class FTerm
#if defined(__linux__)
#undef linux
static FTermLinux* linux;
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
#elif defined(__FreeBSD__) || defined(__DragonFly__)
static FTermFreeBSD* freebsd;
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__)
#elif defined(__NetBSD__) || defined(__OpenBSD__)
static FTermOpenBSD* openbsd;
#endif
};

View File

@ -35,10 +35,36 @@
#error "Only <final/final.h> can be included directly."
#endif
// FTermcap string macro
#define TCAP(s) tcap[(s)].string
#if defined(__sun) && defined(__SVR4)
#include <termio.h>
typedef struct termio SGTTY;
typedef struct termios SGTTYS;
#ifdef _LP64
typedef unsigned int chtype;
#else
typedef unsigned long chtype;
#endif // _LP64
#include <term.h> // termcap
#else
#include <term.h> // termcap
#endif // defined(__sun) && defined(__SVR4)
#ifdef F_HAVE_LIBGPM
#undef buttons // from term.h
#endif
#include <string>
#include <vector>
#include "final/emptyfstring.h"
#include "final/fkey_map.h"
#include "final/ftermdetection.h"
// FTermcap string macro
#define TCAP(s) tcap[(s)].string
namespace finalcut
{
@ -74,6 +100,13 @@ class FTermcap
return tcap;
}
// Mutator
static void setTermData (FTermData*);
static void setFTermDetection (FTermDetection*);
// Methods
static void init();
// Data Members
static bool background_color_erase;
static bool automatic_left_margin;
@ -87,8 +120,20 @@ class FTermcap
static int attr_without_color;
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 termcapKeysVt100 (char*&);
// Data Member
static tcap_map tcap[];
static tcap_map tcap[];
static FTermData* fterm_data;
static FTermDetection* term_detection;
};
#pragma pack(pop)

View File

@ -73,18 +73,18 @@ class FTermcapQuirks
private:
// Methods
#if defined(__FreeBSD__) || defined(__DragonFly__)
static void init_termcap_freebsd_quirks();
static void freebsd();
#endif
static void init_termcap_cygwin_quirks();
static void init_termcap_linux_quirks();
static void init_termcap_xterm_quirks();
static void init_termcap_rxvt_quirks();
static void init_termcap_vte_quirks();
static void init_termcap_putty_quirks();
static void init_termcap_teraterm_quirks();
static void init_termcap_sun_quirks();
static void init_termcap_screen_quirks();
static void init_termcap_general_quirks();
static void cygwin();
static void linux();
static void xterm();
static void rxvt();
static void vte();
static void putty();
static void teraterm();
static void sun();
static void screen();
static void general();
// Data Members
static FTermcap::tcap_map* tcap;

View File

@ -56,6 +56,7 @@
#include "final/fterm.h"
// Preprocessing handler macro
#define F_PREPROC_HANDLER(i,h) \
static_cast<FVTerm*>((i)) \
@ -283,8 +284,8 @@ class FVTerm : public FTerm
static void restoreVTerm (const FRect&);
static void restoreVTerm (int, int, int, int);
static void setTextToDefault (term_area*, int, int);
static bool reallocateTextArea (term_area*, int, int);
static bool reallocateTextArea (term_area*, int);
static bool reallocateTextArea (term_area*, std::size_t, std::size_t);
static bool reallocateTextArea (term_area*, std::size_t);
static covered_state isCovered ( const FPoint&
, term_area* );
@ -417,7 +418,6 @@ class FVTerm : public FTerm
#endif
static int appendOutputBuffer (int);
// Data Members
static std::queue<int>* output_buffer;
static charData term_attribute;

View File

@ -177,11 +177,11 @@ void FTermDataTest::dataTest()
CPPUNIT_ASSERT ( data.getXtermFont() == finalcut::FString() );
data.setXtermFont("terminus-20");
CPPUNIT_ASSERT ( data.getXtermFont() == finalcut::FString("terminus-20") );
CPPUNIT_ASSERT ( data.getXtermTitle() == finalcut::FString() );
data.setXtermTitle("Terminal");
CPPUNIT_ASSERT ( data.getXtermTitle() == finalcut::FString("Terminal") );
#if DEBUG
CPPUNIT_ASSERT ( data.getFramebufferBpp() == -1 );
data.setFramebufferBpp(32);