Improved alternate character set for FreeBSD console

This commit is contained in:
Markus Gans 2017-03-28 08:50:37 +02:00
parent d7aa8f3a70
commit d5b2c9dc99
5 changed files with 78 additions and 17 deletions

View File

@ -1,3 +1,7 @@
2017-03-28 Markus Gans <guru.mail@muenster.de>
* Improved graphic charset pairs (vt100)
for FreeBSD console
2017-03-26 Markus Gans <guru.mail@muenster.de>
* The Final Cut compiles now under FreeBSD
* A new test program to show the termcap variables

View File

@ -13,11 +13,11 @@ typedef struct
char* string;
char tname[4];
}
keymap;
fkeymap;
#pragma pack(pop)
static keymap Fkey[] =
static fkeymap Fkey[] =
{
{ fc::Fkey_backspace, 0, "kb" }, // backspace key
{ fc::Fkey_catab , 0, "ka" }, // clear-all-tabs key
@ -191,9 +191,9 @@ typedef struct
int num;
char string[8];
}
metakeymap;
fmetakeymap;
static metakeymap Fmetakey[] =
static fmetakeymap Fmetakey[] =
{
{ fc::Fmkey_ic , "\033[2;3~" }, // M-insert
{ fc::Fmkey_ic , "\033\033[2~" }, // M-insert

View File

@ -553,7 +553,7 @@ bool FTerm::setVGAFont()
{
if ( openConsole() == 0 )
{
if ( isConsole() )
if ( isLinuxConsole() )
{
// standard vga font 8x16
int ret = setScreenFont(__8x16std, 256, 8, 16);
@ -626,7 +626,7 @@ bool FTerm::setNewFont()
if ( openConsole() == 0 )
{
if ( isConsole() )
if ( isLinuxConsole() )
{
struct unimapdesc unimap;
int ret;
@ -697,7 +697,7 @@ bool FTerm::setOldFont()
{
if ( openConsole() == 0 )
{
if ( isConsole() )
if ( isLinuxConsole() )
{
if ( screen_font.data )
{
@ -1693,7 +1693,7 @@ bool FTerm::gpmMouse (bool on)
if ( openConsole() == 0 )
{
if ( ! isConsole() )
if ( ! isLinuxConsole() )
return false;
closeConsole();
@ -1734,7 +1734,7 @@ bool FTerm::gpmMouse (bool on)
// private methods of FTerm
//----------------------------------------------------------------------
#if defined(__linux__)
int FTerm::isConsole()
int FTerm::isLinuxConsole()
{
char arg = 0;
// get keyboard type an compare
@ -1742,7 +1742,27 @@ int FTerm::isConsole()
&& ioctl(fd_tty, KDGKBTYPE, &arg) == 0
&& ((arg == KB_101) || (arg == KB_84)) );
}
#endif
//----------------------------------------------------------------------
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <sys/param.h>
#if defined(BSD)
bool FTerm::isBSDConsole()
{
keymap_t keymap;
if ( ioctl(0, GIO_KEYMAP, &keymap) == 0 )
return true;
else
return false;
}
#endif
#endif
#if defined(__linux__)
//----------------------------------------------------------------------
inline uInt16 FTerm::getInputStatusRegisterOne()
{
@ -2186,7 +2206,7 @@ void FTerm::init_console()
if ( openConsole() == 0 )
{
if ( isConsole() )
if ( isLinuxConsole() )
{
getUnicodeMap();
getScreenFont();
@ -3024,6 +3044,24 @@ void FTerm::init_termcaps()
const_cast<char*>(CSI "29m");
}
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <sys/param.h>
#if defined(BSD)
if ( isBSDConsole() )
{
tcap[fc::t_acs_chars].string = \
const_cast<char*>("-\036.\0370\333"
"a\260f\370g\361"
"h\261j\331k\277"
"l\332m\300n\305"
"q\304t\303u\264"
"v\301w\302x\263"
"y\363z\362~\371");
FTermcap::attr_without_color = 18;
}
#endif
#endif
// read termcap key strings
for (int i=0; Fkey[i].tname[0] != 0; i++)
{
@ -3391,7 +3429,7 @@ void FTerm::init()
#if defined(__linux__)
if ( linux_terminal && openConsole() == 0 )
{
if ( isConsole() )
if ( isLinuxConsole() )
{
if ( setBlinkAsIntensity(true) == 0 )
FTermcap::max_color = 16;

View File

@ -40,9 +40,17 @@
#include <sys/kd.h>
#endif
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <sys/param.h>
#if defined(BSD)
#include <sys/kbio.h>
#endif
#endif
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <langinfo.h>
#include <term.h> // termcap
@ -306,11 +314,14 @@ class FTerm
// Disable assignment operator (=)
FTerm& operator = (const FTerm&);
#if defined(__linux__)
// Inquiries
static int isConsole();
#if defined(__linux__)
static int isLinuxConsole();
#endif
static bool isBSDConsole();
// Methods
#if defined(__linux__)
static uInt16 getInputStatusRegisterOne();
static uChar readAttributeController (uChar);
static void writeAttributeController (uChar, uChar);
@ -319,11 +330,13 @@ class FTerm
static int setBlinkAsIntensity (bool);
static int getFramebuffer_bpp();
#endif
static int openConsole();
static int closeConsole();
static void identifyTermType();
static void storeTTYsettings();
static void restoreTTYsettings();
#if defined(__linux__)
static int getScreenFont();
static int setScreenFont (uChar*, uInt, uInt, uInt, bool = false);
@ -331,6 +344,7 @@ class FTerm
static int getUnicodeMap ();
static void init_console();
#endif
static uInt getBaudRate (const struct termios*);
static char* init_256colorTerminal();
static char* parseAnswerbackMsg (char*&);

View File

@ -93,10 +93,15 @@ int main (int argc, char* argv[])
<< terminal->termtype_Answerback << "\r\n";
std::cout << "| after parseSecDA(): "
<< terminal->termtype_SecDA << "\r\n";
if ( &terminal->getAnswerbackString() )
tcapString ( "| The answerback String"
, terminal->getAnswerbackString().c_str() );
if ( &terminal->getSecDAString() )
tcapString ( "| The SecDA String"
, terminal->getSecDAString().c_str() );
std::cout << "'------------------- debug -------------------\r\n";
#endif