Use the Singleton design pattern to get a single object instance via FTerm

This commit is contained in:
Markus Gans 2019-05-27 00:50:11 +02:00
parent 75ec596323
commit 22e47adbcb
31 changed files with 463 additions and 320 deletions

View File

@ -1,3 +1,7 @@
2019-05-27 Markus Gans <guru.mail@muenster.de>
* Use the Singleton design pattern to get a single object instance
via FTerm
2019-05-17 Markus Gans <guru.mail@muenster.de> 2019-05-17 Markus Gans <guru.mail@muenster.de>
* Move system calls to the new class FSystem * Move system calls to the new class FSystem

View File

@ -38,7 +38,7 @@ void tcapString (const std::string&, const char[]);
void debug (finalcut::FApplication&); void debug (finalcut::FApplication&);
void booleans(); void booleans();
void numeric(); void numeric();
void string(finalcut::FTermcap::tcap_map*&); void string();
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -291,15 +291,17 @@ void numeric()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void string(finalcut::FTermcap::tcap_map*& tcap) void string()
{ {
std::cout << "\r\n[String]\r\n"; std::cout << "\r\n[String]\r\n";
finalcut::FTermcap::tcap_map (&tcap_strings)[] \
= finalcut::FTermcap::strings;
for (int n = 0; n <= data::getNumberOfItems(); n++ ) for (int n = 0; n <= data::getNumberOfItems(); n++ )
{ {
const std::string name = data::strings[n].name; const std::string name = data::strings[n].name;
const fc::termcaps cap = data::strings[n].cap; const fc::termcaps cap = data::strings[n].cap;
tcapString (name, tcap[cap].string); tcapString (name, tcap_strings[cap].string);
} }
} }
@ -314,9 +316,6 @@ int main (int argc, char* argv[])
// Pointer to the global virtual terminal object // Pointer to the global virtual terminal object
terminal = static_cast<finalcut::FVTerm*>(&TermApp); terminal = static_cast<finalcut::FVTerm*>(&TermApp);
finalcut::FTermcap::tcap_map* tcap;
tcap = finalcut::FTermcap::getTermcapMap();
std::cout << "--------\r\nFTermcap\r\n--------\r\n\n"; std::cout << "--------\r\nFTermcap\r\n--------\r\n\n";
std::cout << "Terminal: " << TermApp.getTermType() << "\r\n"; std::cout << "Terminal: " << TermApp.getTermType() << "\r\n";
@ -324,5 +323,5 @@ int main (int argc, char* argv[])
booleans(); booleans();
numeric(); numeric();
string(tcap); string();
} }

View File

@ -51,6 +51,7 @@ libfinal_la_SOURCES = \
ftermfreebsd.cpp \ ftermfreebsd.cpp \
ftermopenbsd.cpp \ ftermopenbsd.cpp \
ftermlinux.cpp \ ftermlinux.cpp \
ftermdebugdata.cpp \
ftermdetection.cpp \ ftermdetection.cpp \
ftermios.cpp \ ftermios.cpp \
fterm.cpp \ fterm.cpp \

View File

@ -50,6 +50,7 @@ INCLUDE_HEADERS = \
ftermcap.h \ ftermcap.h \
fterm.h \ fterm.h \
ftermdata.h \ ftermdata.h \
ftermdebugdata.h \
ftermios.h \ ftermios.h \
ftermdetection.h \ ftermdetection.h \
ftermcapquirks.h \ ftermcapquirks.h \
@ -114,6 +115,7 @@ OBJS = \
fkeyboard.o \ fkeyboard.o \
ftermcap.o \ ftermcap.o \
fterm.o \ fterm.o \
ftermdebugdata.o \
ftermios.o \ ftermios.o \
ftermdetection.o \ ftermdetection.o \
ftermcapquirks.o \ ftermcapquirks.o \

View File

@ -50,6 +50,7 @@ INCLUDE_HEADERS = \
ftermcap.h \ ftermcap.h \
fterm.h \ fterm.h \
ftermdata.h \ ftermdata.h \
ftermdebugdata.h \
ftermios.h \ ftermios.h \
ftermdetection.h \ ftermdetection.h \
ftermcapquirks.h \ ftermcapquirks.h \
@ -114,6 +115,7 @@ OBJS = \
fkeyboard.o \ fkeyboard.o \
ftermcap.o \ ftermcap.o \
fterm.o \ fterm.o \
ftermdebugdata.o \
ftermios.o \ ftermios.o \
ftermdetection.o \ ftermdetection.o \
ftermcapquirks.o \ ftermcapquirks.o \

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2013-2018 Markus Gans * * Copyright 2013-2019 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -362,7 +362,7 @@ void FApplication::closeConfirmationDialog (FWidget* w, FCloseEvent* ev)
void FApplication::init (uInt64 key_time, uInt64 dblclick_time) void FApplication::init (uInt64 key_time, uInt64 dblclick_time)
{ {
// Initialize keyboard // Initialize keyboard
keyboard = FVTerm::getKeyboard(); keyboard = FVTerm::getFKeyboard();
// Set the keyboard keypress timeout // Set the keyboard keypress timeout
if ( keyboard ) if ( keyboard )
@ -377,7 +377,7 @@ void FApplication::init (uInt64 key_time, uInt64 dblclick_time)
} }
// Initialize mouse control // Initialize mouse control
mouse = FVTerm::getMouseControl(); mouse = FVTerm::getFMouseControl();
// Set stdin number for a gpm-mouse // Set stdin number for a gpm-mouse
if ( mouse ) if ( mouse )

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2018 Markus Gans * * Copyright 2018-2019 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -30,6 +30,7 @@
#include "final/fkeyboard.h" #include "final/fkeyboard.h"
#include "final/fkey_map.h" #include "final/fkey_map.h"
#include "final/fterm.h"
#include "final/ftermios.h" #include "final/ftermios.h"
namespace finalcut namespace finalcut
@ -112,6 +113,14 @@ void FKeyboard::setTermcapMap (fc::fkeymap* keymap)
key_map = keymap; key_map = keymap;
} }
//----------------------------------------------------------------------
void FKeyboard::init()
{
#if defined(__linux__)
linux = FTerm::getFTermLinux();
#endif
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool& FKeyboard::unprocessedInput() bool& FKeyboard::unprocessedInput()
{ {

View File

@ -558,7 +558,7 @@ int FMenu::adjustX (int x_pos)
// Is menu outside on the right of the screen? // Is menu outside on the right of the screen?
if ( x_pos + int(max_item_width) >= int(getDesktopWidth() - 1) ) if ( x_pos + int(max_item_width) >= int(getDesktopWidth() - 1) )
{ {
x_pos = int(getDesktopWidth() - max_item_width + 1); x_pos = int(getDesktopWidth() - max_item_width - 1);
// Menu to large for the screen // Menu to large for the screen
if ( x_pos < 1 ) if ( x_pos < 1 )
x_pos = 1; x_pos = 1;

View File

@ -44,7 +44,6 @@ int (*FTerm::Fputchar)(int);
FTerm::initializationValues FTerm::init_values; FTerm::initializationValues FTerm::init_values;
FTermData* FTerm::data = nullptr; FTermData* FTerm::data = nullptr;
FSystem* FTerm::fsys = nullptr; FSystem* FTerm::fsys = nullptr;
FTermcap::tcap_map* FTerm::tcap = nullptr;
FOptiMove* FTerm::opti_move = nullptr; FOptiMove* FTerm::opti_move = nullptr;
FOptiAttr* FTerm::opti_attr = nullptr; FOptiAttr* FTerm::opti_attr = nullptr;
FTermDetection* FTerm::term_detection = nullptr; FTermDetection* FTerm::term_detection = nullptr;
@ -338,6 +337,9 @@ bool FTerm::setOldFont()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTerm::openConsole() int FTerm::openConsole()
{ {
if ( ! data )
data = FTerm::getFTermData();
int fd = data->getTTYFileDescriptor(); int fd = data->getTTYFileDescriptor();
const char* termfilename = data->getTermFileName(); const char* termfilename = data->getTermFileName();
@ -373,6 +375,9 @@ int FTerm::openConsole()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTerm::closeConsole() int FTerm::closeConsole()
{ {
if ( ! data )
data = FTerm::getFTermData();
int fd = data->getTTYFileDescriptor(); int fd = data->getTTYFileDescriptor();
int ret = -1; int ret = -1;
@ -490,6 +495,9 @@ void FTerm::detectTermSize()
{ {
// Detect the terminal width and height // Detect the terminal width and height
if ( ! data )
data = FTerm::getFTermData();
struct winsize win_size; struct winsize win_size;
bool close_after_detect = false; bool close_after_detect = false;
int fd = data->getTTYFileDescriptor(); int fd = data->getTTYFileDescriptor();
@ -958,14 +966,13 @@ void FTerm::init_global_values (bool disable_alt_screen)
data->useAlternateScreen(! disable_alt_screen); data->useAlternateScreen(! disable_alt_screen);
// Initialize xterm object // Initialize xterm object
xterm->setFTermDetection(term_detection); xterm->init();
if ( ! init_values.terminal_detection ) if ( ! init_values.terminal_detection )
term_detection->setTerminalDetection (false); term_detection->setTerminalDetection (false);
#if DEBUG #if DEBUG
debug_data->setFTermDetection(term_detection); debug_data->init();
debug_data->setFTermData(data);
#endif #endif
} }
@ -1182,9 +1189,7 @@ void FTerm::init_teraterm_charmap()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::init_keyboard() void FTerm::init_keyboard()
{ {
#if defined(__linux__) keyboard->init();
keyboard->setFTermLinux (linux);
#endif
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1192,13 +1197,7 @@ void FTerm::init_termcap()
{ {
// Initialize the terminal capabilities // Initialize the terminal capabilities
FTermcap termcap; FTermcap::init();
termcap.setFTermData(data);
termcap.setFTermDetection(term_detection);
termcap.init();
// Share the terminal capabilities
tcap = termcap.getTermcapMap();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1207,8 +1206,6 @@ void FTerm::init_quirks()
// Initialize terminal quirks // Initialize terminal quirks
FTermcapQuirks quirks; FTermcapQuirks quirks;
quirks.setFTermData (data);
quirks.setFTermDetection (term_detection);
quirks.terminalFixup(); // Fix terminal quirks quirks.terminalFixup(); // Fix terminal quirks
} }
@ -1837,8 +1834,6 @@ void FTerm::init (bool disable_alt_screen)
initBaudRate(); initBaudRate();
// Terminal detection // Terminal detection
term_detection->setFTermData(data);
term_detection->setFSystem(fsys);
term_detection->detect(); term_detection->detect();
setTermType (term_detection->getTermType()); setTermType (term_detection->getTermType());
@ -1927,9 +1922,6 @@ void FTerm::init (bool disable_alt_screen)
void FTerm::initOSspecifics() void FTerm::initOSspecifics()
{ {
#if defined(__linux__) #if defined(__linux__)
linux->setFTermData(data);
linux->setFSystem(fsys);
linux->setFTermDetection(term_detection);
linux->init(); // Initialize Linux console linux->init(); // Initialize Linux console
#if DEBUG #if DEBUG
@ -1939,8 +1931,6 @@ void FTerm::initOSspecifics()
#endif // defined(__linux__) #endif // defined(__linux__)
#if defined(__FreeBSD__) || defined(__DragonFly__) #if defined(__FreeBSD__) || defined(__DragonFly__)
freebsd->setFSystem(fsys);
if ( init_values.meta_sends_escape ) if ( init_values.meta_sends_escape )
freebsd->enableMetaSendsEscape(); freebsd->enableMetaSendsEscape();
else else
@ -1953,8 +1943,6 @@ void FTerm::initOSspecifics()
freebsd->init(); // Initialize BSD console freebsd->init(); // Initialize BSD console
#elif defined(__NetBSD__) || defined(__OpenBSD__) #elif defined(__NetBSD__) || defined(__OpenBSD__)
openbsd->setFSystem(fsys);
if ( init_values.meta_sends_escape ) if ( init_values.meta_sends_escape )
openbsd->enableMetaSendsEscape(); openbsd->enableMetaSendsEscape();
else else

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2015-2018 Markus Gans * * Copyright 2015-2019 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -24,6 +24,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "final/fterm.h"
#include "final/ftermcap.h" #include "final/ftermcap.h"
namespace finalcut namespace finalcut
@ -59,21 +60,11 @@ FTermDetection* FTermcap::term_detection = nullptr;
*/ */
// public methods of FTermcap // public methods of FTermcap
//----------------------------------------------------------------------
void FTermcap::setFTermData (FTermData* data)
{
fterm_data = data;
}
//----------------------------------------------------------------------
void FTermcap::setFTermDetection (FTermDetection* td)
{
term_detection = td;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcap::init() void FTermcap::init()
{ {
fterm_data = FTerm::getFTermData();
term_detection = FTerm::getFTermDetection();
termcap(); termcap();
} }
@ -225,8 +216,8 @@ void FTermcap::termcapStrings (char*& buffer)
// Get termcap strings // Get termcap strings
// Read termcap output strings // Read termcap output strings
for (std::size_t i = 0; tcap[i].tname[0] != 0; i++) for (std::size_t i = 0; strings[i].tname[0] != 0; i++)
tcap[i].string = tgetstr(tcap[i].tname, &buffer); strings[i].string = tgetstr(strings[i].tname, &buffer);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -326,7 +317,7 @@ void FTermcap::termcapKeysVt100 (char*& buffer)
// private Data Member of FTermcap - termcap capabilities // private Data Member of FTermcap - termcap capabilities
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTermcap::tcap_map FTermcap::tcap[] = FTermcap::tcap_map FTermcap::strings[] =
{ {
// .------------- term string // .------------- term string
// | .-------- Tcap-code // | .-------- Tcap-code

View File

@ -28,7 +28,6 @@ namespace finalcut
{ {
// static class attributes // static class attributes
FTermcap::tcap_map* FTermcapQuirks::tcap = nullptr;
FTermData* FTermcapQuirks::fterm_data = nullptr; FTermData* FTermcapQuirks::fterm_data = nullptr;
FTermDetection* FTermcapQuirks::term_detection = nullptr; FTermDetection* FTermcapQuirks::term_detection = nullptr;
@ -40,9 +39,7 @@ FTermDetection* FTermcapQuirks::term_detection = nullptr;
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTermcapQuirks::FTermcapQuirks() FTermcapQuirks::FTermcapQuirks()
{ { }
tcap = FTermcap::getTermcapMap();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTermcapQuirks::~FTermcapQuirks() // destructor FTermcapQuirks::~FTermcapQuirks() // destructor
@ -51,22 +48,10 @@ FTermcapQuirks::~FTermcapQuirks() // destructor
// public methods of FTermcapQuirks // public methods of FTermcapQuirks
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirks::setFTermData (FTermData* data)
{
fterm_data = data;
}
//----------------------------------------------------------------------
void FTermcapQuirks::setFTermDetection (FTermDetection* td)
{
term_detection = td;
}
// private methods of FTermcapQuirks
//----------------------------------------------------------------------
void FTermcapQuirks::terminalFixup() void FTermcapQuirks::terminalFixup()
{ {
fterm_data = FTerm::getFTermData();
term_detection = FTerm::getFTermDetection();
auto& td = term_detection; auto& td = term_detection;
if ( td->isCygwinTerminal() ) if ( td->isCygwinTerminal() )
@ -118,8 +103,10 @@ void FTermcapQuirks::terminalFixup()
ecma48(); ecma48();
} }
#if defined(__FreeBSD__) || defined(__DragonFly__)
// private methods of FTermcapQuirks
//---------------------------------------------------------------------- //----------------------------------------------------------------------
#if defined(__FreeBSD__) || defined(__DragonFly__)
void FTermcapQuirks::freebsd() void FTermcapQuirks::freebsd()
{ {
// FreeBSD console fixes // FreeBSD console fixes

48
src/ftermdebugdata.cpp Normal file
View File

@ -0,0 +1,48 @@
/***********************************************************************
* ftermdebugdata.cpp - Debug data class for FTerm *
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2019 Markus Gans *
* *
* The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
* as published by the Free Software Foundation; either version 3 of *
* the License, or (at your option) any later version. *
* *
* The Final Cut is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this program. If not, see *
* <http://www.gnu.org/licenses/>. *
***********************************************************************/
#include "final/fterm.h"
#include "final/ftermdata.h"
#include "final/ftermdetection.h"
#include "final/ftermdebugdata.h"
namespace finalcut
{
// static class attributes
FTermData* FTermDebugData::data = nullptr;
FTermDetection* FTermDebugData::term_detection = nullptr;
//----------------------------------------------------------------------
// class FClassName
//----------------------------------------------------------------------
// public methods of FClassName
//----------------------------------------------------------------------
void FTermDebugData::init()
{
data = FTerm::getFTermData();
term_detection = FTerm::getFTermDetection();
}
} // namespace finalcut

View File

@ -85,18 +85,6 @@ FTermDetection::~FTermDetection() // destructor
// public methods of FTermDetection // public methods of FTermDetection
//----------------------------------------------------------------------
void FTermDetection::setFTermData (FTermData* data)
{
fterm_data = data;
}
//----------------------------------------------------------------------
void FTermDetection::setFSystem (FSystem* fsys)
{
fsystem = fsys;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetection::setTtyTypeFileName (char ttytype_filename[]) void FTermDetection::setTtyTypeFileName (char ttytype_filename[])
{ {
@ -110,6 +98,8 @@ void FTermDetection::setTtyTypeFileName (char ttytype_filename[])
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetection::detect() void FTermDetection::detect()
{ {
fterm_data = FTerm::getFTermData();
fsystem = FTerm::getFSystem();
deallocation(); deallocation();
// Set the variable 'termtype' to the predefined type of the terminal // Set the variable 'termtype' to the predefined type of the terminal

View File

@ -85,6 +85,8 @@ void FTermFreeBSD::init()
if ( ! isFreeBSDConsole() ) if ( ! isFreeBSDConsole() )
return; return;
fsystem = FTerm::getFSystem();
if ( meta_sends_escape ) if ( meta_sends_escape )
{ {
// save current left alt key mapping // save current left alt key mapping

View File

@ -137,7 +137,7 @@ bool FTermLinux::isLinuxConsole()
// Check if it's a Linux console // Check if it's a Linux console
if ( ! fsystem ) if ( ! fsystem )
return false; fsystem = FTerm::getFSystem();
char arg = 0; char arg = 0;
int fd_tty = FTerm::getTTYFileDescriptor(); int fd_tty = FTerm::getTTYFileDescriptor();
@ -153,6 +153,9 @@ void FTermLinux::init()
{ {
// initialize Linux console // initialize Linux console
fterm_data = FTerm::getFTermData();
fsystem = FTerm::getFSystem();
term_detection = FTerm::getFTermDetection();
screen_unicode_map.entries = nullptr; screen_unicode_map.entries = nullptr;
screen_font.data = nullptr; screen_font.data = nullptr;
@ -480,7 +483,7 @@ int FTermLinux::getFramebuffer_bpp()
struct fb_fix_screeninfo fb_fix; struct fb_fix_screeninfo fb_fix;
if ( ! fsystem ) if ( ! fsystem )
return -1; fsystem = FTerm::getFSystem();
if ( (fd = fsystem->open(fb, O_RDWR)) < 0 ) if ( (fd = fsystem->open(fb, O_RDWR)) < 0 )
{ {
@ -737,7 +740,7 @@ inline uInt16 FTermLinux::getInputStatusRegisterOne()
// Gets the VGA input-status-register-1 // Gets the VGA input-status-register-1
if ( ! fsystem ) if ( ! fsystem )
return 0x3da; fsystem = FTerm::getFSystem();
// Miscellaneous output (read port) // Miscellaneous output (read port)
static constexpr uInt16 misc_read = 0x3cc; static constexpr uInt16 misc_read = 0x3cc;
@ -754,7 +757,7 @@ uChar FTermLinux::readAttributeController (uChar index)
// Reads a byte from the attribute controller from a given index // Reads a byte from the attribute controller from a given index
if ( ! fsystem ) if ( ! fsystem )
return 0; fsystem = FTerm::getFSystem();
uChar res; uChar res;
// Attribute controller (write port) // Attribute controller (write port)
@ -782,7 +785,7 @@ void FTermLinux::writeAttributeController (uChar index, uChar data)
// Writes a byte from the attribute controller from a given index // Writes a byte from the attribute controller from a given index
if ( ! fsystem ) if ( ! fsystem )
return; fsystem = FTerm::getFSystem();
// Attribute controller (write port) // Attribute controller (write port)
static constexpr uInt16 attrib_cntlr_write = 0x3c0; static constexpr uInt16 attrib_cntlr_write = 0x3c0;
@ -822,7 +825,7 @@ int FTermLinux::setBlinkAsIntensity (bool enable)
// That permits 16 colors for background // That permits 16 colors for background
if ( ! fsystem ) if ( ! fsystem )
return -1; fsystem = FTerm::getFSystem();
int fd_tty = FTerm::getTTYFileDescriptor(); int fd_tty = FTerm::getTTYFileDescriptor();
@ -891,7 +894,7 @@ bool FTermLinux::resetVGAPalette()
// Reset the vga color map // Reset the vga color map
if ( ! fsystem ) if ( ! fsystem )
return false; fsystem = FTerm::getFSystem();
if ( has_saved_palette ) if ( has_saved_palette )
{ {

View File

@ -61,6 +61,8 @@ void FTermOpenBSD::init()
if ( ! isBSDConsole() ) if ( ! isBSDConsole() )
return; return;
fsystem = FTerm::getFSystem();
if ( meta_sends_escape ) if ( meta_sends_escape )
{ {
// save current left alt key mapping // save current left alt key mapping

View File

@ -41,7 +41,6 @@ const FString* FTermXTerminal::cursor_color = nullptr;
const FString* FTermXTerminal::mouse_foreground_color = nullptr; const FString* FTermXTerminal::mouse_foreground_color = nullptr;
const FString* FTermXTerminal::mouse_background_color = nullptr; const FString* FTermXTerminal::mouse_background_color = nullptr;
const FString* FTermXTerminal::highlight_background_color = nullptr; const FString* FTermXTerminal::highlight_background_color = nullptr;
FTermcap::tcap_map* FTermXTerminal::tcap = nullptr;
FTermDetection* FTermXTerminal::term_detection = nullptr; FTermDetection* FTermXTerminal::term_detection = nullptr;
fc::xtermCursorStyle FTermXTerminal::cursor_style = fc::unknown_cursor_style; fc::xtermCursorStyle FTermXTerminal::cursor_style = fc::unknown_cursor_style;
@ -58,8 +57,6 @@ FTermXTerminal::FTermXTerminal()
mouse_support = \ mouse_support = \
meta_sends_esc = \ meta_sends_esc = \
xterm_default_colors = false; xterm_default_colors = false;
tcap = FTermcap::getTermcapMap();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -229,6 +226,12 @@ void FTermXTerminal::metaSendsESC (bool enable)
disableXTermMetaSendsESC(); disableXTermMetaSendsESC();
} }
//----------------------------------------------------------------------
void FTermXTerminal::init()
{
term_detection = FTerm::getFTermDetection();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermXTerminal::setDefaults() void FTermXTerminal::setDefaults()
{ {

View File

@ -54,7 +54,6 @@ FTerm* FVTerm::fterm = nullptr;
FVTerm::term_area* FVTerm::vterm = nullptr; FVTerm::term_area* FVTerm::vterm = nullptr;
FVTerm::term_area* FVTerm::vdesktop = nullptr; FVTerm::term_area* FVTerm::vdesktop = nullptr;
FVTerm::term_area* FVTerm::active_area = nullptr; FVTerm::term_area* FVTerm::active_area = nullptr;
FTermcap::tcap_map* FVTerm::tcap = nullptr;
FKeyboard* FVTerm::keyboard = nullptr; FKeyboard* FVTerm::keyboard = nullptr;
FVTerm::charData FVTerm::term_attribute; FVTerm::charData FVTerm::term_attribute;
FVTerm::charData FVTerm::next_attribute; FVTerm::charData FVTerm::next_attribute;
@ -1873,9 +1872,6 @@ void FVTerm::init (bool disable_alt_screen)
// next_attribute contains the state of the next printed character // next_attribute contains the state of the next printed character
std::memcpy (&next_attribute, &term_attribute, sizeof(next_attribute)); std::memcpy (&next_attribute, &term_attribute, sizeof(next_attribute));
// Receive the terminal capabilities
tcap = FTermcap::getTermcapMap();
// Create virtual terminal // Create virtual terminal
FRect term_geometry (0, 0, getColumnNumber(), getLineNumber()); FRect term_geometry (0, 0, getColumnNumber(), getLineNumber());
createVTerm (term_geometry.getSize()); createVTerm (term_geometry.getSize());
@ -1886,8 +1882,8 @@ void FVTerm::init (bool disable_alt_screen)
vdesktop->visible = true; vdesktop->visible = true;
active_area = vdesktop; active_area = vdesktop;
// Initialize keyboard // Get FKeyboard object
keyboard = FTerm::getKeyboard(); keyboard = FTerm::getFKeyboard();
// Hide the input cursor // Hide the input cursor
hideCursor(); hideCursor();

View File

@ -116,11 +116,6 @@ class FKeyboard final
void disableUTF8(); void disableUTF8();
void enableMouseSequences(); void enableMouseSequences();
void disableMouseSequences(); void disableMouseSequences();
#if defined(__linux__)
void setFTermLinux (FTermLinux*);
#endif
void setPressCommand (FKeyboardCommand); void setPressCommand (FKeyboardCommand);
void setReleaseCommand (FKeyboardCommand); void setReleaseCommand (FKeyboardCommand);
void setEscPressedCommand (FKeyboardCommand); void setEscPressedCommand (FKeyboardCommand);
@ -129,6 +124,7 @@ class FKeyboard final
bool isInputDataPending(); bool isInputDataPending();
// Methods // Methods
static void init();
bool& unprocessedInput(); bool& unprocessedInput();
bool isKeyPressed(); bool isKeyPressed();
void clearKeyBuffer(); void clearKeyBuffer();
@ -229,12 +225,6 @@ inline void FKeyboard::enableMouseSequences()
inline void FKeyboard::disableMouseSequences() inline void FKeyboard::disableMouseSequences()
{ mouse_support = false; } { mouse_support = false; }
#if defined(__linux__)
//----------------------------------------------------------------------
inline void FKeyboard::setFTermLinux (FTermLinux* linux_obj)
{ linux = linux_obj; }
#endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FKeyboard::setPressCommand (FKeyboardCommand cmd) inline void FKeyboard::setPressCommand (FKeyboardCommand cmd)
{ keypressed_cmd = cmd; } { keypressed_cmd = cmd; }

View File

@ -176,12 +176,9 @@ class FTerm final
// Accessors // Accessors
virtual const char* getClassName() const; virtual const char* getClassName() const;
static FKeyboard* getKeyboard();
static FMouseControl* getMouseControl();
static std::size_t getLineNumber(); static std::size_t getLineNumber();
static std::size_t getColumnNumber(); static std::size_t getColumnNumber();
static const FString getKeyName (FKey); static const FString getKeyName (FKey);
static FOptiMove* getFOptiMove();
static int getTTYFileDescriptor(); static int getTTYFileDescriptor();
static char* getTermType(); static char* getTermType();
static char* getTermFileName(); static char* getTermFileName();
@ -190,9 +187,24 @@ class FTerm final
initializationValues& getInitValues(); initializationValues& getInitValues();
characterSub& getCharSubstitutionMap(); characterSub& getCharSubstitutionMap();
#if DEBUG
static FTermData* getFTermData(); static FTermData* getFTermData();
static FSystem* getFSystem();
static FOptiMove* getFOptiMove();
static FOptiAttr* getFOptiAttr();
static FTermDetection* getFTermDetection(); static FTermDetection* getFTermDetection();
static FTermXTerminal* getFTermXTerminal();
static FKeyboard* getFKeyboard();
static FMouseControl* getFMouseControl();
#if defined(__linux__)
static FTermLinux* getFTermLinux();
#elif defined(__FreeBSD__) || defined(__DragonFly__)
static FTermFreeBSD* getFTermFreeBSD();
#elif defined(__NetBSD__) || defined(__OpenBSD__)
static FTermOpenBSD* getFTermOpenBSD();
#endif
#if DEBUG
FTermDebugData& getFTermDebugData(); FTermDebugData& getFTermDebugData();
#endif #endif
@ -231,6 +243,7 @@ class FTerm final
static bool canChangeColorPalette(); static bool canChangeColorPalette();
// Mutators // Mutators
static void setFSystem (FSystem*);
static void setTermType (const char[]); static void setTermType (const char[]);
static void setInsertCursor (bool); static void setInsertCursor (bool);
static void redefineDefaultColors (bool); static void redefineDefaultColors (bool);
@ -398,7 +411,6 @@ class FTerm final
// Data Members // Data Members
static FTermData* data; static FTermData* data;
static FSystem* fsys; static FSystem* fsys;
static FTermcap::tcap_map* tcap;
static FOptiMove* opti_move; static FOptiMove* opti_move;
static FOptiAttr* opti_attr; static FOptiAttr* opti_attr;
static FTermDetection* term_detection; static FTermDetection* term_detection;
@ -427,17 +439,9 @@ class FTerm final
inline const char* FTerm::getClassName() const inline const char* FTerm::getClassName() const
{ return "FTerm"; } { return "FTerm"; }
//----------------------------------------------------------------------
inline FKeyboard* FTerm::getKeyboard()
{ return ( keyboard ) ? keyboard : 0; }
//----------------------------------------------------------------------
inline FMouseControl* FTerm::getMouseControl()
{ return ( mouse ) ? mouse : 0; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline int FTerm::getTTYFileDescriptor() inline int FTerm::getTTYFileDescriptor()
{ return data->getTTYFileDescriptor(); } { return ( data ) ? data->getTTYFileDescriptor() : 0; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline char* FTerm::getTermType() inline char* FTerm::getTermType()
@ -463,18 +467,235 @@ inline FTerm::initializationValues& FTerm::getInitValues()
inline FTerm::characterSub& FTerm::getCharSubstitutionMap() inline FTerm::characterSub& FTerm::getCharSubstitutionMap()
{ return data->getCharSubstitutionMap(); } { return data->getCharSubstitutionMap(); }
#if DEBUG
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FTermData* FTerm::getFTermData() inline FTermData* FTerm::getFTermData()
{ return data; } {
if ( data == 0 )
{
try
{
data = new FTermData;
}
catch (const std::bad_alloc& ex)
{
std::cerr << bad_alloc_str << ex.what() << std::endl;
std::abort();
}
}
return data;
}
//----------------------------------------------------------------------
inline FSystem* FTerm::getFSystem()
{
if ( fsys == 0 )
{
try
{
fsys = new FSystemImpl;
}
catch (const std::bad_alloc& ex)
{
std::cerr << bad_alloc_str << ex.what() << std::endl;
std::abort();
}
}
return fsys;
}
//----------------------------------------------------------------------
inline FOptiMove* FTerm::getFOptiMove()
{
if ( opti_move == 0 )
{
try
{
opti_move = new FOptiMove;
}
catch (const std::bad_alloc& ex)
{
std::cerr << bad_alloc_str << ex.what() << std::endl;
std::abort();
}
}
return opti_move;
}
//----------------------------------------------------------------------
inline FOptiAttr* FTerm::getFOptiAttr()
{
if ( opti_attr == 0 )
{
try
{
opti_attr = new FOptiAttr;
}
catch (const std::bad_alloc& ex)
{
std::cerr << bad_alloc_str << ex.what() << std::endl;
std::abort();
}
}
return opti_attr;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FTermDetection* FTerm::getFTermDetection() inline FTermDetection* FTerm::getFTermDetection()
{ return term_detection; } {
if ( term_detection == 0 )
{
try
{
term_detection = new FTermDetection;
}
catch (const std::bad_alloc& ex)
{
std::cerr << bad_alloc_str << ex.what() << std::endl;
std::abort();
}
}
return term_detection;
}
//----------------------------------------------------------------------
inline FTermXTerminal* FTerm::getFTermXTerminal()
{
if ( xterm == 0 )
{
try
{
xterm = new FTermXTerminal;
}
catch (const std::bad_alloc& ex)
{
std::cerr << bad_alloc_str << ex.what() << std::endl;
std::abort();
}
}
return xterm;
}
//----------------------------------------------------------------------
inline FKeyboard* FTerm::getFKeyboard()
{
if ( keyboard == 0 )
{
try
{
keyboard = new FKeyboard;
}
catch (const std::bad_alloc& ex)
{
std::cerr << bad_alloc_str << ex.what() << std::endl;
std::abort();
}
}
return keyboard;
}
//----------------------------------------------------------------------
inline FMouseControl* FTerm::getFMouseControl()
{
if ( mouse == 0 )
{
try
{
mouse = new FMouseControl;
}
catch (const std::bad_alloc& ex)
{
std::cerr << bad_alloc_str << ex.what() << std::endl;
std::abort();
}
}
return mouse;
}
#if defined(__linux__)
//----------------------------------------------------------------------
inline FTermLinux* FTerm::getFTermLinux()
{
if ( linux == 0 )
{
try
{
linux = new FTermLinux;
}
catch (const std::bad_alloc& ex)
{
std::cerr << bad_alloc_str << ex.what() << std::endl;
std::abort();
}
}
return linux;
}
#elif defined(__FreeBSD__) || defined(__DragonFly__)
//----------------------------------------------------------------------
inline FTermFreeBSD* FTerm::getFTermFreeBSD()
{
if ( freebsd == 0 )
{
try
{
freebsd = new FTermFreeBSD;
}
catch (const std::bad_alloc& ex)
{
std::cerr << bad_alloc_str << ex.what() << std::endl;
std::abort();
}
}
return freebsd;
}
#elif defined(__NetBSD__) || defined(__OpenBSD__)
//----------------------------------------------------------------------
inline FTermOpenBSD* FTerm::getFTermOpenBSD()
{
if ( openbsd == 0 )
{
try
{
openbsd = new FTermOpenBSD;
}
catch (const std::bad_alloc& ex)
{
std::cerr << bad_alloc_str << ex.what() << std::endl;
std::abort();
}
}
return openbsd;
}
#endif
#if DEBUG
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FTermDebugData& FTerm::getFTermDebugData() inline FTermDebugData& FTerm::getFTermDebugData()
{ return *debug_data; } {
if ( debug_data == 0 )
{
try
{
debug_data = new FTermDebugData;
}
catch (const std::bad_alloc& ex)
{
std::cerr << bad_alloc_str << ex.what() << std::endl;
std::abort();
}
}
return *debug_data;
}
#endif // DEBUG #endif // DEBUG
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -581,6 +802,10 @@ inline bool FTerm::hasHalfBlockCharacter()
inline bool FTerm::hasAlternateScreen() inline bool FTerm::hasAlternateScreen()
{ return data->hasAlternateScreen(); } { return data->hasAlternateScreen(); }
//----------------------------------------------------------------------
inline void FTerm::setFSystem (FSystem* fsystem)
{ fsys = fsystem; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FTerm::setUTF8() inline bool FTerm::setUTF8()
{ return setUTF8(true); } { return setUTF8(true); }
@ -589,10 +814,6 @@ inline bool FTerm::setUTF8()
inline bool FTerm::unsetUTF8() inline bool FTerm::unsetUTF8()
{ return setUTF8(false); } { return setUTF8(false); }
//----------------------------------------------------------------------
inline FOptiMove* FTerm::getFOptiMove()
{ return opti_move; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FTerm::changeTermSizeFinished() inline void FTerm::changeTermSizeFinished()
{ data->setTermResized(false); } { data->setTermResized(false); }

View File

@ -64,7 +64,8 @@
// FTermcap string macro // FTermcap string macro
#define TCAP(...) tcap[__VA_ARGS__].string //#define TCAP(...) tcap_strings[__VA_ARGS__].string
#define TCAP(...) FTermcap::strings[__VA_ARGS__].string
namespace finalcut namespace finalcut
{ {
@ -93,46 +94,37 @@ class FTermcap final
~FTermcap() = default; ~FTermcap() = default;
// Accessors // Accessors
const char* getClassName() const; const char* getClassName() const;
static tcap_map* getTermcapMap()
{
return tcap;
}
// Mutator
static void setFTermData (FTermData*);
static void setFTermDetection (FTermDetection*);
// Methods // Methods
static void init(); static void init();
// Data Members // Data Members
static bool background_color_erase; static bool background_color_erase;
static bool can_change_color_palette; static bool can_change_color_palette;
static bool automatic_left_margin; static bool automatic_left_margin;
static bool automatic_right_margin; static bool automatic_right_margin;
static bool eat_nl_glitch; static bool eat_nl_glitch;
static bool ansi_default_color; static bool ansi_default_color;
static bool osc_support; static bool osc_support;
static bool no_utf8_acs_chars; static bool no_utf8_acs_chars;
static int max_color; static int max_color;
static int tabstop; static int tabstop;
static int attr_without_color; static int attr_without_color;
static tcap_map strings[];
private: private:
// Methods // Methods
static void termcap(); static void termcap();
static void termcapError (int); static void termcapError (int);
static void termcapVariables (char*&); static void termcapVariables (char*&);
static void termcapBoleans(); static void termcapBoleans();
static void termcapNumerics(); static void termcapNumerics();
static void termcapStrings (char*&); static void termcapStrings (char*&);
static void termcapKeys (char*&); static void termcapKeys (char*&);
static void termcapKeysVt100 (char*&); static void termcapKeysVt100 (char*&);
// Data Member // Data Member
static tcap_map tcap[];
static FTermData* fterm_data; static FTermData* fterm_data;
static FTermDetection* term_detection; static FTermDetection* term_detection;
}; };

View File

@ -63,10 +63,6 @@ class FTermcapQuirks final
// Accessor // Accessor
virtual const char* getClassName() const; virtual const char* getClassName() const;
// Mutator
static void setFTermData (FTermData*);
static void setFTermDetection (FTermDetection*);
// Methods // Methods
static void terminalFixup(); static void terminalFixup();
@ -88,7 +84,6 @@ class FTermcapQuirks final
static void ecma48(); static void ecma48();
// Data Members // Data Members
static FTermcap::tcap_map* tcap;
static FTermData* fterm_data; static FTermData* fterm_data;
static FTermDetection* term_detection; static FTermDetection* term_detection;
}; };

View File

@ -38,6 +38,9 @@
namespace finalcut namespace finalcut
{ {
// class forward declaration
class FTerm;
#if DEBUG #if DEBUG
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FTermDebugData // class FTermDebugData
@ -67,25 +70,16 @@ class FTermDebugData final
#if defined(__linux__) #if defined(__linux__)
int getFramebufferBpp(); int getFramebufferBpp();
#endif #endif
// Mutators
void setFTermDetection (FTermDetection*); // Methods
void setFTermData (FTermData*); static void init();
private: private:
// Data Members // Data Members
FTermDetection* term_detection{nullptr}; static FTermData* data;
FTermData* data{nullptr}; static FTermDetection* term_detection;
}; };
// FTermDebugData inline functions
//----------------------------------------------------------------------
inline void FTermDebugData::setFTermDetection (FTermDetection* obj)
{ term_detection = obj; }
//----------------------------------------------------------------------
inline void FTermDebugData::setFTermData (FTermData* obj)
{ data = obj; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const FString& FTermDebugData::getAnswerbackString() inline const FString& FTermDebugData::getAnswerbackString()
{ return term_detection->getAnswerbackString(); } { return term_detection->getAnswerbackString(); }

View File

@ -154,8 +154,6 @@ class FTermDetection final
static void setScreenTerm (bool); static void setScreenTerm (bool);
static void setTmuxTerm (bool); static void setTmuxTerm (bool);
static void setTerminalDetection (bool); static void setTerminalDetection (bool);
static void setFTermData (FTermData*);
static void setFSystem (FSystem*);
static void setTtyTypeFileName (char[]); static void setTtyTypeFileName (char[]);
// Methods // Methods

View File

@ -83,7 +83,6 @@ class FTermFreeBSD final
static bool isFreeBSDConsole(); static bool isFreeBSDConsole();
// Mutators // Mutators
static void setFSystem (FSystem*);
static void setCursorStyle (CursorStyle, bool); static void setCursorStyle (CursorStyle, bool);
static void enableChangeCursorStyle(); static void enableChangeCursorStyle();
static void disableChangeCursorStyle(); static void disableChangeCursorStyle();
@ -119,10 +118,6 @@ inline const char* FTermFreeBSD::getClassName() const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
#if defined(__FreeBSD__) || defined(__DragonFly__) #if defined(__FreeBSD__) || defined(__DragonFly__)
inline void FTermFreeBSD::setFSystem (FSystem* fsys)
{ fsystem = fsys; }
//----------------------------------------------------------------------
inline void FTermFreeBSD::enableChangeCursorStyle() inline void FTermFreeBSD::enableChangeCursorStyle()
{ change_cursorstyle = true; } { change_cursorstyle = true; }

View File

@ -88,9 +88,6 @@ class FTermLinux final
static int getFramebufferBpp(); static int getFramebufferBpp();
// Mutators // Mutators
static void setFTermData (FTermData*);
static void setFSystem (FSystem*);
static void setFTermDetection (FTermDetection*);
static char* setCursorStyle (fc::linuxConsoleCursorStyle, bool); static char* setCursorStyle (fc::linuxConsoleCursorStyle, bool);
static bool setPalette (FColor, int, int, int); static bool setPalette (FColor, int, int, int);
static void setUTF8 (bool); static void setUTF8 (bool);
@ -206,18 +203,6 @@ inline const char* FTermLinux::getClassName() const
inline int FTermLinux::getFramebufferBpp() inline int FTermLinux::getFramebufferBpp()
{ return framebuffer_bpp; } { return framebuffer_bpp; }
//----------------------------------------------------------------------
inline void FTermLinux::setFTermData (FTermData* data)
{ fterm_data = data; }
//----------------------------------------------------------------------
inline void FTermLinux::setFSystem (FSystem* fsys)
{ fsystem = fsys; }
//----------------------------------------------------------------------
inline void FTermLinux::setFTermDetection (FTermDetection* td)
{ term_detection = td; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FTermLinux::hasShadowCharacter() inline bool FTermLinux::hasShadowCharacter()
{ return shadow_character; } { return shadow_character; }

View File

@ -75,7 +75,6 @@ class FTermOpenBSD final
static bool isBSDConsole(); static bool isBSDConsole();
// Mutators // Mutators
static void setFSystem (FSystem*);
static void disableMetaSendsEscape(); static void disableMetaSendsEscape();
static void enableMetaSendsEscape(); static void enableMetaSendsEscape();
@ -106,10 +105,6 @@ inline const char* FTermOpenBSD::getClassName() const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
#if defined(__NetBSD__) || defined(__OpenBSD__) #if defined(__NetBSD__) || defined(__OpenBSD__)
inline void FTermOpenBSD::setFSystem (FSystem* fsys)
{ fsystem = fsys; }
//----------------------------------------------------------------------
inline void FTermOpenBSD::enableMetaSendsEscape() inline void FTermOpenBSD::enableMetaSendsEscape()
{ meta_sends_escape = true; } { meta_sends_escape = true; }

View File

@ -60,7 +60,6 @@ class FTermXTerminal final
virtual ~FTermXTerminal(); virtual ~FTermXTerminal();
// Mutators // Mutators
static void setFTermDetection (FTermDetection*);
static void redefineDefaultColors (bool); static void redefineDefaultColors (bool);
static void setCursorStyle (fc::xtermCursorStyle); static void setCursorStyle (fc::xtermCursorStyle);
static void setFont (const FString&); static void setFont (const FString&);
@ -94,6 +93,7 @@ class FTermXTerminal final
static bool hasTitle(); static bool hasTitle();
// Methods // Methods
static void init();
static void setDefaults(); static void setDefaults();
static void resetColorMap(); static void resetColorMap();
static void resetForeground(); static void resetForeground();
@ -150,7 +150,6 @@ class FTermXTerminal final
static const FString* mouse_foreground_color; static const FString* mouse_foreground_color;
static const FString* mouse_background_color; static const FString* mouse_background_color;
static const FString* highlight_background_color; static const FString* highlight_background_color;
static FTermcap::tcap_map* tcap;
static FTermDetection* term_detection; static FTermDetection* term_detection;
static fc::xtermCursorStyle cursor_style; static fc::xtermCursorStyle cursor_style;
}; };
@ -161,10 +160,6 @@ class FTermXTerminal final
inline const char* FTermXTerminal::getClassName() const inline const char* FTermXTerminal::getClassName() const
{ return "FTermXTerminal"; } { return "FTermXTerminal"; }
//----------------------------------------------------------------------
inline void FTermXTerminal::setFTermDetection (FTermDetection* td)
{ term_detection = td; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FTermXTerminal::redefineDefaultColors (bool enable) inline void FTermXTerminal::redefineDefaultColors (bool enable)
{ xterm_default_colors = enable; } { xterm_default_colors = enable; }

View File

@ -324,8 +324,8 @@ class FVTerm
std::size_t getLineNumber(); std::size_t getLineNumber();
std::size_t getColumnNumber(); std::size_t getColumnNumber();
static bool charEncodable (wchar_t); static bool charEncodable (wchar_t);
static FKeyboard* getKeyboard(); static FKeyboard* getFKeyboard();
static FMouseControl* getMouseControl(); static FMouseControl* getFMouseControl();
FTerm::initializationValues& getInitValues(); FTerm::initializationValues& getInitValues();
// Mutators // Mutators
@ -482,7 +482,6 @@ class FVTerm
static charData s_ch; // shadow character static charData s_ch; // shadow character
static charData i_ch; // inherit background character static charData i_ch; // inherit background character
static FPoint* term_pos; // terminal cursor position static FPoint* term_pos; // terminal cursor position
static FTermcap::tcap_map* tcap;
static FKeyboard* keyboard; static FKeyboard* keyboard;
static bool terminal_update_complete; static bool terminal_update_complete;
static bool terminal_update_pending; static bool terminal_update_pending;
@ -1076,12 +1075,12 @@ inline bool FVTerm::charEncodable (wchar_t c)
{ return FTerm::charEncodable(c); } { return FTerm::charEncodable(c); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FKeyboard* FVTerm::getKeyboard() inline FKeyboard* FVTerm::getFKeyboard()
{ return FTerm::getKeyboard(); } { return FTerm::getFKeyboard(); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FMouseControl* FVTerm::getMouseControl() inline FMouseControl* FVTerm::getFMouseControl()
{ return FTerm::getMouseControl(); } { return FTerm::getFMouseControl(); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FTerm::initializationValues& FVTerm::getInitValues() inline FTerm::initializationValues& FVTerm::getInitValues()

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2018 Markus Gans * * Copyright 2018-2019 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -227,20 +227,16 @@ void FTermcapQuirksTest::classNameTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::generalTest() void FTermcapQuirksTest::generalTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings();
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData data;
finalcut::FTermcap::tabstop = -1; finalcut::FTermcap::tabstop = -1;
finalcut::FTermcap::attr_without_color = -1; finalcut::FTermcap::attr_without_color = -1;
finalcut::FTermcap::can_change_color_palette = false; finalcut::FTermcap::can_change_color_palette = false;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermDetection detect;
quirks.setFTermData(&data);
quirks.setFTermDetection (&detect);
quirks.terminalFixup(); quirks.terminalFixup();
CPPUNIT_ASSERT ( finalcut::FTermcap::tabstop == 8 ); CPPUNIT_ASSERT ( finalcut::FTermcap::tabstop == 8 );
@ -294,20 +290,18 @@ void FTermcapQuirksTest::generalTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::xtermTest() void FTermcapQuirksTest::xtermTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings();
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermDetection detect;
finalcut::FTermcap::can_change_color_palette = false; finalcut::FTermcap::can_change_color_palette = false;
detect.setXTerminal (true); detect.setXTerminal (true);
data.setTermType ("xterm"); data.setTermType ("xterm");
quirks.setFTermData(&data);
quirks.setFTermDetection (&detect);
quirks.terminalFixup(); quirks.terminalFixup();
CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette ); CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette );
@ -327,16 +321,16 @@ void FTermcapQuirksTest::xtermTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::freebsdTest() void FTermcapQuirksTest::freebsdTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings();
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::attr_without_color = -1; finalcut::FTermcap::attr_without_color = -1;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermDetection detect;
detect.setFreeBSDTerm (true); detect.setFreeBSDTerm (true);
data.setTermType ("xterm-16color"); data.setTermType ("xterm-16color");
quirks.setFTermData(&data); quirks.setFTermData(&data);
@ -366,20 +360,18 @@ void FTermcapQuirksTest::freebsdTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::cygwinTest() void FTermcapQuirksTest::cygwinTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings();
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::background_color_erase = false; finalcut::FTermcap::background_color_erase = false;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermDetection detect;
detect.setCygwinTerminal (true); detect.setCygwinTerminal (true);
data.setTermType ("cygwin"); data.setTermType ("cygwin");
quirks.setFTermData(&data);
quirks.setFTermDetection (&detect);
quirks.terminalFixup(); quirks.terminalFixup();
CPPUNIT_ASSERT ( finalcut::FTermcap::background_color_erase == true ); CPPUNIT_ASSERT ( finalcut::FTermcap::background_color_erase == true );
@ -393,21 +385,19 @@ void FTermcapQuirksTest::cygwinTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::linuxTest() void FTermcapQuirksTest::linuxTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings();
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::max_color = 8; finalcut::FTermcap::max_color = 8;
finalcut::FTermcap::attr_without_color = -1; finalcut::FTermcap::attr_without_color = -1;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermDetection detect;
detect.setLinuxTerm (true); detect.setLinuxTerm (true);
data.setTermType ("linux"); data.setTermType ("linux");
quirks.setFTermData(&data);
quirks.setFTermDetection (&detect);
quirks.terminalFixup(); quirks.terminalFixup();
// 8 colors // 8 colors
@ -467,19 +457,17 @@ void FTermcapQuirksTest::linuxTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::rxvtTest() void FTermcapQuirksTest::rxvtTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings();
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermDetection detect;
detect.setRxvtTerminal (true); detect.setRxvtTerminal (true);
data.setTermType ("rxvt"); data.setTermType ("rxvt");
quirks.setFTermData(&data);
quirks.setFTermDetection (&detect);
quirks.terminalFixup(); quirks.terminalFixup();
// rxvt // rxvt
@ -510,20 +498,18 @@ void FTermcapQuirksTest::rxvtTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::vteTest() void FTermcapQuirksTest::vteTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings();
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::attr_without_color = -1; finalcut::FTermcap::attr_without_color = -1;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermDetection detect;
detect.setGnomeTerminal (true); detect.setGnomeTerminal (true);
data.setTermType ("gnome-256color"); data.setTermType ("gnome-256color");
quirks.setFTermData(&data);
quirks.setFTermDetection (&detect);
quirks.terminalFixup(); quirks.terminalFixup();
CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 0 ); CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 0 );
@ -536,23 +522,21 @@ void FTermcapQuirksTest::vteTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::puttyTest() void FTermcapQuirksTest::puttyTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings();
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::background_color_erase = false; finalcut::FTermcap::background_color_erase = false;
finalcut::FTermcap::can_change_color_palette = false; finalcut::FTermcap::can_change_color_palette = false;
finalcut::FTermcap::osc_support = false; finalcut::FTermcap::osc_support = false;
finalcut::FTermcap::attr_without_color = -1; finalcut::FTermcap::attr_without_color = -1;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermDetection detect;
detect.setPuttyTerminal (true); detect.setPuttyTerminal (true);
data.setTermType ("putty"); data.setTermType ("putty");
quirks.setFTermData(&data);
quirks.setFTermDetection (&detect);
quirks.terminalFixup(); quirks.terminalFixup();
CPPUNIT_ASSERT ( finalcut::FTermcap::background_color_erase == true ); CPPUNIT_ASSERT ( finalcut::FTermcap::background_color_erase == true );
@ -628,20 +612,18 @@ void FTermcapQuirksTest::puttyTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::teratermTest() void FTermcapQuirksTest::teratermTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings();
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::eat_nl_glitch = false; finalcut::FTermcap::eat_nl_glitch = false;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermDetection detect;
detect.setTeraTerm (true); detect.setTeraTerm (true);
data.setTermType ("teraterm"); data.setTermType ("teraterm");
quirks.setFTermData(&data);
quirks.setFTermDetection (&detect);
quirks.terminalFixup(); quirks.terminalFixup();
CPPUNIT_ASSERT ( finalcut::FTermcap::eat_nl_glitch == true ); CPPUNIT_ASSERT ( finalcut::FTermcap::eat_nl_glitch == true );
@ -660,20 +642,18 @@ void FTermcapQuirksTest::teratermTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::sunTest() void FTermcapQuirksTest::sunTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings();
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
finalcut::FTermcap::eat_nl_glitch = false; finalcut::FTermcap::eat_nl_glitch = false;
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermDetection detect;
detect.setSunTerminal (true); detect.setSunTerminal (true);
data.setTermType ("sun-color"); data.setTermType ("sun-color");
quirks.setFTermData(&data);
quirks.setFTermDetection (&detect);
quirks.terminalFixup(); quirks.terminalFixup();
CPPUNIT_ASSERT ( finalcut::FTermcap::eat_nl_glitch == true ); CPPUNIT_ASSERT ( finalcut::FTermcap::eat_nl_glitch == true );
@ -780,20 +760,18 @@ void FTermcapQuirksTest::sunTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::screenTest() void FTermcapQuirksTest::screenTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings();
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0])); memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
finalcut::FTermcapQuirks quirks; finalcut::FTermcapQuirks quirks;
finalcut::FTermDetection detect;
finalcut::FTermcap::can_change_color_palette = false; finalcut::FTermcap::can_change_color_palette = false;
detect.setScreenTerm (true); detect.setScreenTerm (true);
data.setTermType ("screen-256color"); data.setTermType ("screen-256color");
quirks.setFTermData(&data);
quirks.setFTermDetection (&detect);
quirks.terminalFixup(); quirks.terminalFixup();
CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette ); CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette );

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2018 Markus Gans * * Copyright 2018-2019 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -471,11 +471,10 @@ void FTermDetectionTest::classNameTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::ansiTest() void FTermDetectionTest::ansiTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
setenv ("TERM", "ansi", 1); setenv ("TERM", "ansi", 1);
data.setTermFileName(C_STR("ansi")); data.setTermFileName(C_STR("ansi"));
detect.setFTermData(&data);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -541,10 +540,9 @@ void FTermDetectionTest::ansiTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::xtermTest() void FTermDetectionTest::xtermTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("xterm")); data.setTermFileName(C_STR("xterm"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -603,10 +601,9 @@ void FTermDetectionTest::xtermTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::rxvtTest() void FTermDetectionTest::rxvtTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("rxvt-cygwin-native")); data.setTermFileName(C_STR("rxvt-cygwin-native"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -666,10 +663,9 @@ void FTermDetectionTest::rxvtTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::urxvtTest() void FTermDetectionTest::urxvtTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("rxvt-unicode-256color")); data.setTermFileName(C_STR("rxvt-unicode-256color"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -728,10 +724,9 @@ void FTermDetectionTest::urxvtTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::mltermTest() void FTermDetectionTest::mltermTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("mlterm")); data.setTermFileName(C_STR("mlterm"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -798,10 +793,9 @@ void FTermDetectionTest::mltermTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::puttyTest() void FTermDetectionTest::puttyTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("xterm")); data.setTermFileName(C_STR("xterm"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -861,10 +855,9 @@ void FTermDetectionTest::puttyTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::kdeKonsoleTest() void FTermDetectionTest::kdeKonsoleTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("xterm-256color")); data.setTermFileName(C_STR("xterm-256color"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -923,10 +916,9 @@ void FTermDetectionTest::kdeKonsoleTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::gnomeTerminalTest() void FTermDetectionTest::gnomeTerminalTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("xterm-256color")); data.setTermFileName(C_STR("xterm-256color"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -986,10 +978,9 @@ void FTermDetectionTest::gnomeTerminalTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::newerVteTerminalTest() void FTermDetectionTest::newerVteTerminalTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("xterm-256color")); data.setTermFileName(C_STR("xterm-256color"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -1049,10 +1040,9 @@ void FTermDetectionTest::newerVteTerminalTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::ktermTest() void FTermDetectionTest::ktermTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("kterm")); data.setTermFileName(C_STR("kterm"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -1119,10 +1109,9 @@ void FTermDetectionTest::ktermTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::teraTermTest() void FTermDetectionTest::teraTermTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("xterm")); data.setTermFileName(C_STR("xterm"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -1182,10 +1171,9 @@ void FTermDetectionTest::teraTermTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::cygwinTest() void FTermDetectionTest::cygwinTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("cygwin")); data.setTermFileName(C_STR("cygwin"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -1245,10 +1233,9 @@ void FTermDetectionTest::cygwinTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::minttyTest() void FTermDetectionTest::minttyTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("xterm-256color")); data.setTermFileName(C_STR("xterm-256color"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -1308,10 +1295,9 @@ void FTermDetectionTest::minttyTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::linuxTest() void FTermDetectionTest::linuxTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("linux")); data.setTermFileName(C_STR("linux"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -1378,10 +1364,9 @@ void FTermDetectionTest::linuxTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::freebsdTest() void FTermDetectionTest::freebsdTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("xterm")); data.setTermFileName(C_STR("xterm"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -1451,10 +1436,9 @@ void FTermDetectionTest::freebsdTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::netbsdTest() void FTermDetectionTest::netbsdTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("wsvt25")); data.setTermFileName(C_STR("wsvt25"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -1522,10 +1506,9 @@ void FTermDetectionTest::netbsdTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::openbsdTest() void FTermDetectionTest::openbsdTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("vt220")); data.setTermFileName(C_STR("vt220"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -1593,10 +1576,9 @@ void FTermDetectionTest::openbsdTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::sunTest() void FTermDetectionTest::sunTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("sun-color")); data.setTermFileName(C_STR("sun-color"));
detect.setFTermData(&data);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -1662,10 +1644,9 @@ void FTermDetectionTest::sunTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::screenTest() void FTermDetectionTest::screenTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("screen")); data.setTermFileName(C_STR("screen"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -1731,10 +1712,9 @@ void FTermDetectionTest::screenTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetectionTest::tmuxTest() void FTermDetectionTest::tmuxTest()
{ {
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermFileName(C_STR("screen")); data.setTermFileName(C_STR("screen"));
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkProcess(); pid_t pid = forkProcess();
@ -1836,9 +1816,8 @@ void FTermDetectionTest::ttytypeTest()
ttytype << "vt100" << "\t" << "ttyp6" << std::endl; ttytype << "vt100" << "\t" << "ttyp6" << std::endl;
ttytype.close(); ttytype.close();
finalcut::FTermData data; finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
detect.setFTermData(&data);
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
detect.setTtyTypeFileName(C_STR("new-root-dir/etc/ttytype")); detect.setTtyTypeFileName(C_STR("new-root-dir/etc/ttytype"));