Moved FTerm debug access methods to FTermDebugData

This commit is contained in:
Markus Gans 2018-11-01 21:29:54 +01:00
parent 4afa988232
commit c2df8ac7d9
19 changed files with 133 additions and 53 deletions

View File

@ -1,3 +1,6 @@
2018-11-01 Markus Gans <guru.mail@muenster.de>
* Moved FTerm debug access methods to FTermDebugData
2018-10-29 Markus Gans <guru.mail@muenster.de> 2018-10-29 Markus Gans <guru.mail@muenster.de>
* FTerm is now a data member of FVTerm * FTerm is now a data member of FVTerm
* Fix FListBox prevListItem() * Fix FListBox prevListItem()

View File

@ -248,6 +248,12 @@ License
------- -------
GNU Lesser General Public License Version 3 GNU Lesser General Public License Version 3
Frequently Asked Questions
--------------------------
If you have any problems, please read the
[FAQ](doc/faq.md#frequently-asked-questions)
before you give up.
Please send bug reports to Please send bug reports to
-------------------------- --------------------------
https://github.com/gansm/finalcut/issues https://github.com/gansm/finalcut/issues

View File

@ -3,7 +3,7 @@
if test "$1" = "update" if test "$1" = "update"
then then
# Update generated configuration files # Update generated configuration files
if which autoreconf >/dev/null if command -v autoreconf >/dev/null
then then
autoreconf --force --install --verbose --warnings=all autoreconf --force --install --verbose --warnings=all
else else

View File

@ -30,7 +30,7 @@ if [ -n "$1" ]
then then
if [ ! -f ./configure ] if [ ! -f ./configure ]
then then
if which autoreconf >/dev/null if command -v autoreconf >/dev/null
then then
autoreconf --install --force autoreconf --install --force
else else

View File

@ -2,6 +2,6 @@
# set the xterm window title # set the xterm window title
TERMTITLE="man 4 console_codes" TERMTITLE="man 4 console_codes"
echo -ne "\033]0;${TERMTITLE}\007" echo -ne "\\033]0;${TERMTITLE}\\007"
man 4 console_codes man 4 console_codes

View File

@ -2,6 +2,6 @@
# set the xterm window title # set the xterm window title
TERMTITLE="man 4 console_ioctl" TERMTITLE="man 4 console_ioctl"
echo -ne "\033]0;${TERMTITLE}\007" echo -ne "\\033]0;${TERMTITLE}\\007"
man 4 console_ioctl man 4 console_ioctl

View File

@ -2,6 +2,6 @@
# set the xterm window title # set the xterm window title
TERMTITLE="infocmp: $TERM" TERMTITLE="infocmp: $TERM"
echo -ne "\033]0;${TERMTITLE}\007" echo -ne "\\033]0;${TERMTITLE}\\007"
infocmp -x | less infocmp -x | less

View File

@ -2,7 +2,7 @@
# set the xterm window title # set the xterm window title
TERMTITLE="man 5 terminfo" TERMTITLE="man 5 terminfo"
echo -ne "\033]0;${TERMTITLE}\007" echo -ne "\\033]0;${TERMTITLE}\\007"
man 5 terminfo man 5 terminfo

View File

@ -225,21 +225,22 @@ void tcapString (const std::string& name, const char cap_str[])
#if DEBUG #if DEBUG
void debug (finalcut::FApplication& TermApp) void debug (finalcut::FApplication& TermApp)
{ {
finalcut::FTerm& fterm = TermApp.getFTerm(); finalcut::FTermDebugData& debug_data = TermApp.getFTermDebugData();
const finalcut::FString& ab_s = fterm.getAnswerbackString(); const finalcut::FString& ab_s = debug_data.getAnswerbackString();
const finalcut::FString& sec_da = fterm.getSecDAString(); const finalcut::FString& sec_da = debug_data.getSecDAString();
std::cout << "\n.------------------- debug -------------------\r\n"; std::cout << "\n.------------------- debug -------------------\r\n";
#if defined(__linux__) #if defined(__linux__)
std::cout << "| Framebuffer bpp: " std::cout << "| Framebuffer bpp: "
<< fterm.getFramebufferBpp() << "\r\n"; << debug_data.getFramebufferBpp() << "\r\n";
#endif #endif
std::cout << "| after init_256colorTerminal(): " std::cout << "| after init_256colorTerminal(): "
<< fterm.getTermType_256color() << "\r\n"; << debug_data.getTermType_256color() << "\r\n";
std::cout << "| after parseAnswerbackMsg(): " std::cout << "| after parseAnswerbackMsg(): "
<< fterm.getTermType_Answerback() << "\r\n"; << debug_data.getTermType_Answerback() << "\r\n";
std::cout << "| after parseSecDA(): " std::cout << "| after parseSecDA(): "
<< fterm.getTermType_SecDA() << "\r\n"; << debug_data.getTermType_SecDA() << "\r\n";
if ( ! ab_s.isEmpty() ) if ( ! ab_s.isEmpty() )
tcapString ("| The answerback String", ab_s); tcapString ("| The answerback String", ab_s);
@ -248,7 +249,6 @@ void debug (finalcut::FApplication& TermApp)
tcapString ("| The SecDA String", sec_da); tcapString ("| The SecDA String", sec_da);
std::cout << "`------------------- debug -------------------\r\n"; std::cout << "`------------------- debug -------------------\r\n";
} }
#else #else
void debug (finalcut::FApplication&) void debug (finalcut::FApplication&)

View File

@ -59,6 +59,10 @@ FMouseControl* FTerm::mouse = 0;
FTermOpenBSD* FTerm::openbsd = 0; FTermOpenBSD* FTerm::openbsd = 0;
#endif #endif
#if DEBUG
FTermDebugData* FTerm::debug_data = 0;
#endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FTerm // class FTerm
@ -888,6 +892,11 @@ void FTerm::init_global_values (bool disable_alt_screen)
if ( ! init_values.terminal_detection ) if ( ! init_values.terminal_detection )
term_detection->setTerminalDetection (false); term_detection->setTerminalDetection (false);
#if DEBUG
debug_data->setFTermDetection(term_detection);
debug_data->setFTermData(data);
#endif
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1090,7 +1099,7 @@ void FTerm::init_termcap()
// Initialize the terminal capabilities // Initialize the terminal capabilities
FTermcap termcap; FTermcap termcap;
termcap.setTermData(data); termcap.setFTermData(data);
termcap.setFTermDetection(term_detection); termcap.setFTermDetection(term_detection);
termcap.init(); termcap.init();
@ -1104,7 +1113,7 @@ void FTerm::init_quirks()
// Initialize terminal quirks // Initialize terminal quirks
FTermcapQuirks quirks; FTermcapQuirks quirks;
quirks.setTermData (data); quirks.setFTermData (data);
quirks.setFTermDetection (term_detection); quirks.setFTermDetection (term_detection);
quirks.terminalFixup(); // Fix terminal quirks quirks.terminalFixup(); // Fix terminal quirks
} }
@ -1681,6 +1690,10 @@ inline void FTerm::allocationValues()
#elif defined(__NetBSD__) || defined(__OpenBSD__) #elif defined(__NetBSD__) || defined(__OpenBSD__)
openbsd = new FTermOpenBSD(); openbsd = new FTermOpenBSD();
#endif #endif
#if DEBUG
debug_data = new FTermDebugData();
#endif
} }
catch (const std::bad_alloc& ex) catch (const std::bad_alloc& ex)
{ {
@ -1692,6 +1705,11 @@ inline void FTerm::allocationValues()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FTerm::deallocationValues() inline void FTerm::deallocationValues()
{ {
#if DEBUG
if ( debug_data )
delete debug_data;
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__) #if defined(__NetBSD__) || defined(__OpenBSD__)
if ( openbsd ) if ( openbsd )
delete openbsd; delete openbsd;
@ -1750,7 +1768,7 @@ void FTerm::init (bool disable_alt_screen)
initBaudRate(); initBaudRate();
// Terminal detection // Terminal detection
term_detection->setTermData(data); term_detection->setFTermData(data);
term_detection->detect(); term_detection->detect();
setTermType (term_detection->getTermType()); setTermType (term_detection->getTermType());

View File

@ -65,7 +65,7 @@ FTermcap::~FTermcap() // destructor
// public methods of FTermcap // public methods of FTermcap
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcap::setTermData (FTermData* data) void FTermcap::setFTermData (FTermData* data)
{ {
fterm_data = data; fterm_data = data;
} }

View File

@ -49,7 +49,7 @@ FTermcapQuirks::~FTermcapQuirks() // destructor
// public methods of FTermcapQuirks // public methods of FTermcapQuirks
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirks::setTermData (FTermData* data) void FTermcapQuirks::setFTermData (FTermData* data)
{ {
fterm_data = data; fterm_data = data;
} }

View File

@ -89,7 +89,7 @@ FTermDetection::~FTermDetection() // destructor
// public methods of FTermDetection // public methods of FTermDetection
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermDetection::setTermData (FTermData* data) void FTermDetection::setFTermData (FTermData* data)
{ {
fterm_data = data; fterm_data = data;
} }

View File

@ -143,6 +143,9 @@
namespace finalcut namespace finalcut
{ {
// class forward declaration
class FTermDebugData;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FTerm // class FTerm
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -181,13 +184,8 @@ class FTerm
initializationValues& getInitValues(); initializationValues& getInitValues();
#if DEBUG #if DEBUG
static const FString& getAnswerbackString(); FTermDebugData& getFTermDebugData();
static const FString& getSecDAString(); #endif
static const char* getTermType_256color();
static const char* getTermType_Answerback();
static const char* getTermType_SecDA();
static int getFramebufferBpp();
#endif // DEBUG
// Inquiries // Inquiries
static bool isNormal (charData*&); static bool isNormal (charData*&);
@ -410,6 +408,10 @@ class FTerm
#elif defined(__NetBSD__) || defined(__OpenBSD__) #elif defined(__NetBSD__) || defined(__OpenBSD__)
static FTermOpenBSD* openbsd; static FTermOpenBSD* openbsd;
#endif #endif
#if DEBUG
static FTermDebugData* debug_data;
#endif
}; };
#pragma pack(pop) #pragma pack(pop)
@ -453,28 +455,8 @@ inline FTerm::initializationValues& FTerm::getInitValues()
#if DEBUG #if DEBUG
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const FString& FTerm::getAnswerbackString() inline FTermDebugData& FTerm::getFTermDebugData()
{ return term_detection->getAnswerbackString(); } { return *debug_data; }
//----------------------------------------------------------------------
inline const FString& FTerm::getSecDAString()
{ return term_detection->getSecDAString(); }
//----------------------------------------------------------------------
inline const char* FTerm::getTermType_256color()
{ return term_detection->getTermType_256color(); }
//----------------------------------------------------------------------
inline const char* FTerm::getTermType_Answerback()
{ return term_detection->getTermType_Answerback(); }
//----------------------------------------------------------------------
inline const char* FTerm::getTermType_SecDA()
{ return term_detection->getTermType_SecDA(); }
//----------------------------------------------------------------------
inline int FTerm::getFramebufferBpp()
{ return data->getFramebufferBpp(); }
#endif // DEBUG #endif // DEBUG
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -598,6 +580,68 @@ inline void FTerm::changeTermSizeFinished()
{ data->setTermResized(false); } { data->setTermResized(false); }
#if DEBUG
//----------------------------------------------------------------------
// class FTermDebugData
//----------------------------------------------------------------------
class FTermDebugData
{
public:
// Accessors
const FString& getAnswerbackString();
const FString& getSecDAString();
const char* getTermType_256color();
const char* getTermType_Answerback();
const char* getTermType_SecDA();
#if defined(__linux__)
int getFramebufferBpp();
#endif
// Mutators
void setFTermDetection (FTermDetection*);
void setFTermData (FTermData*);
private:
FTermDetection* term_detection;
FTermData* data;
};
//----------------------------------------------------------------------
inline void FTermDebugData::setFTermDetection (FTermDetection* obj)
{ term_detection = obj; }
//----------------------------------------------------------------------
inline void FTermDebugData::setFTermData (FTermData* obj)
{ data = obj; }
//----------------------------------------------------------------------
inline const FString& FTermDebugData::getAnswerbackString()
{ return term_detection->getAnswerbackString(); }
//----------------------------------------------------------------------
inline const FString& FTermDebugData::getSecDAString()
{ return term_detection->getSecDAString(); }
//----------------------------------------------------------------------
inline const char* FTermDebugData::getTermType_256color()
{ return term_detection->getTermType_256color(); }
//----------------------------------------------------------------------
inline const char* FTermDebugData::getTermType_Answerback()
{ return term_detection->getTermType_Answerback(); }
//----------------------------------------------------------------------
inline const char* FTermDebugData::getTermType_SecDA()
{ return term_detection->getTermType_SecDA(); }
//----------------------------------------------------------------------
#if defined(__linux__)
inline int FTermDebugData::getFramebufferBpp()
{ return data->getFramebufferBpp(); }
#endif // defined(__linux__)
#endif // DEBUG
} // namespace finalcut } // namespace finalcut
#endif // FTERM_H #endif // FTERM_H

View File

@ -101,7 +101,7 @@ class FTermcap
} }
// Mutator // Mutator
static void setTermData (FTermData*); static void setFTermData (FTermData*);
static void setFTermDetection (FTermDetection*); static void setFTermDetection (FTermDetection*);
// Methods // Methods

View File

@ -64,7 +64,7 @@ class FTermcapQuirks
const char* getClassName() const; const char* getClassName() const;
// Mutator // Mutator
static void setTermData (FTermData*); static void setFTermData (FTermData*);
static void setFTermDetection (FTermDetection*); static void setFTermDetection (FTermDetection*);
// Methods // Methods

View File

@ -386,7 +386,7 @@ inline void FTermData::setXtermTitle (const FString& title)
{ xterm_title = title; } { xterm_title = title; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
#if DEBUG #if DEBUG && defined(__linux__)
inline void FTermData::setFramebufferBpp (int bpp) inline void FTermData::setFramebufferBpp (int bpp)
{ framebuffer_bpp = bpp; } { framebuffer_bpp = bpp; }
#endif #endif

View File

@ -153,7 +153,7 @@ class FTermDetection
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 setTermData (FTermData*); static void setFTermData (FTermData*);
static void setTtyTypeFileName (char[]); static void setTtyTypeFileName (char[]);
// Methods // Methods

View File

@ -142,6 +142,9 @@ class FVTerm
static char* getTermType(); static char* getTermType();
static char* getTermFileName(); static char* getTermFileName();
FTerm& getFTerm(); FTerm& getFTerm();
#if DEBUG
FTermDebugData& getFTermDebugData();
#endif
// Mutators // Mutators
void setTermXY (int, int); void setTermXY (int, int);
@ -644,6 +647,12 @@ inline char* FVTerm::getTermFileName()
inline FTerm& FVTerm::getFTerm() inline FTerm& FVTerm::getFTerm()
{ return *fterm; } { return *fterm; }
//----------------------------------------------------------------------
#if DEBUG
inline FTermDebugData& FVTerm::getFTermDebugData()
{ return getFTerm().getFTermDebugData(); }
#endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::hideCursor() inline void FVTerm::hideCursor()
{ return hideCursor(true); } { return hideCursor(true); }