Skip to content

Commit

Permalink
purge of unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
ZXGuesser committed Jan 15, 2020
1 parent 9e67a0d commit d6e8759
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 673 deletions.
11 changes: 0 additions & 11 deletions packetsubtitle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,6 @@ void PacketSubtitle::SendSubtitle(TTXPage* page)
_swap=(_swap+1)%2; // swap the double buffering
_page[_swap].Copy(page); // deep copy page

/*
#ifdef WIN32
_page[_swap].SavePage("j:\\dev\\vbit2\\subtitleTemp.tti"); // Debug. Send the page representation to a local file
#else
_page[_swap].SavePage("/dev/stderr"); // Debug. Send the page representation to the error console
_page[_swap].SavePage("tempSubtitles.tti"); // Debug. Send the page representation to a file
_page[_swap].DebugDump();
#endif // WIN32
*/

std::cerr << "[PacketSubtitle::SendSubtitle] End of page: " << std::endl;
SetEvent(EVENT_SUBTITLE);

Expand Down
60 changes: 0 additions & 60 deletions ttxcodes.h

This file was deleted.

95 changes: 1 addition & 94 deletions ttxline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,59 +91,6 @@ std::string TTXLine::validate(std::string const& val)
return str;
}

/** GetMappedLine - returns a string with text file-safe mappings applied.
* It is more or less the reverse of validate.
* It escapes characters as detailed in the MRG tti format spec.
*/
std::string TTXLine::GetMappedline()
{
char ch;
int j=0;
std::string str;
str.resize(40);

for (unsigned int i=0;i<40;i++)
{
ch=m_textline[i] & 0x7f; // Strip bit 7 just in case
if (ch<' ') ch |= 0x80;
str[j++]=ch;
}
return str;
}

/** GetMappedLine7bit - returns a string with text file-safe mappings applied.
* Escape to 7 bit (required by Javascript Droidfax)
*/
std::string TTXLine::GetMappedline7bit()
{
char ch;
int j=0;
std::string str;
str.resize(80);

for (unsigned int i=0;i<40;i++)
{
ch=m_textline[i] & 0x7f; // Strip bit 7
if (ch<' ')
{
str[j++]=0x1b; // <ESC>
ch |= 0x40; // Move control code up
}
str[j++]=ch;
}
str.resize(j);
return str;
}


bool TTXLine::IsDoubleHeight()
{
for (unsigned int i=0;i<m_textline.length();i++)
if (m_textline[i]=='\r' || m_textline[i]==0x10)
return true;
return false;
}

bool TTXLine::IsBlank()
{
if (m_textline.length()==0)
Expand Down Expand Up @@ -180,49 +127,11 @@ char TTXLine::GetCharAt(int xLoc)
if (m_textline.length()<(uint16_t)xLoc)
{
// @todo extend the line to 40 characters
std::cerr << "[TTXLine::SetCharAt] oops, need to extend this line" << std::endl;
std::cerr << "[TTXLine::GetCharAt] oops, need to extend this line" << std::endl;
}
return m_textline[xLoc];
}


bool TTXLine::IsAlphaMode(int loc)
{
// TODO: Not sure what cursor we should use for graphics mode capital letters
bool result=true;
if (loc>39) return true;
for (int i=0;i<loc;i++)
{
switch (m_textline[i])
{
case ttxCodeAlphaBlack:;
case ttxCodeAlphaRed:;
case ttxCodeAlphaGreen:;
case ttxCodeAlphaYellow:;
case ttxCodeAlphaBlue:;
case ttxCodeAlphaMagenta:;
case ttxCodeAlphaCyan:;
case ttxCodeAlphaWhite:;
result=true;
break;
case ttxCodeGraphicsRed:;
case ttxCodeGraphicsGreen:;
case ttxCodeGraphicsYellow:;
case ttxCodeGraphicsBlue:;
case ttxCodeGraphicsMagenta:;
case ttxCodeGraphicsCyan:;
case ttxCodeGraphicsWhite:;
result=false;
break;
default:; // Do nothing
}
// This is probably a mistake or it needs a third state: "Alpha in a graphics region".
//if (m_textLine[i]>='A' && m_textLine[i]<'Z')
// result=false;
}
return result;
}

std::string TTXLine::GetLine()
{
// If the string is less than 40 characters we need to pad it or get weird render errors
Expand All @@ -239,8 +148,6 @@ std::string TTXLine::GetLine()
return m_textline;
}



void TTXLine::AppendLine(std::string const& line)
{
// Seek the end of the list
Expand Down
25 changes: 1 addition & 24 deletions ttxline.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include <iomanip>
#include <string>

#include "ttxcodes.h"

/** TTXLine - a single line of teletext
* The line is always stored in 40 bytes in transmission ready format
* (but with the parity bit set to 0).
Expand All @@ -32,11 +30,6 @@ class TTXLine
*/
std::string GetLine();

/** True if the line is double height
* @todo This is not good enough. Need to know the state at a particular point on a line. Add a character position parameter.
*/
bool IsDoubleHeight();

/**
* @brief Check if the line is blank so that we don't bother to write it to the file.
* @return true is the line is blank
Expand All @@ -56,22 +49,6 @@ class TTXLine
*/
char GetCharAt(int xLoc);


/** Return the line with control codes mapped for writing to a file
* \return The mapped line
*/
std::string GetMappedline();
/** GetMappedLine7bit - returns a string with text file-safe mappings applied.
* Escape to 7 bit (required by Javascript Droidfax)
*/
std::string GetMappedline7bit();

/** Determine if a location on the line is in alpha or graphics mode
* \param loc The column address to look at
* \return true if the character position at loc is in an alpha context
*/
bool IsAlphaMode(int loc);

/** Adds line to a linked list
* This is used for enhanced packets which might require multiples of the same row
*/
Expand All @@ -88,7 +65,7 @@ class TTXLine
std::string validate(std::string const& test);

std::string m_textline;
TTXLine* _nextLine; // @todo probably not used. We can dump this
TTXLine* _nextLine;
// If SetLine or SetChar can set the changed flag.
// The changed flag is used to set the C8 flag and then is reset.
bool _changed; /// If the line contents has changed. Set by SetLine or SetChar
Expand Down
Loading

0 comments on commit d6e8759

Please sign in to comment.