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>
* FTerm is now a data member of FVTerm
* Fix FListBox prevListItem()

View File

@ -248,6 +248,12 @@ License
-------
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
--------------------------
https://github.com/gansm/finalcut/issues

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -153,7 +153,7 @@ class FTermDetection
static void setScreenTerm (bool);
static void setTmuxTerm (bool);
static void setTerminalDetection (bool);
static void setTermData (FTermData*);
static void setFTermData (FTermData*);
static void setTtyTypeFileName (char[]);
// Methods

View File

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