diff --git a/ChangeLog b/ChangeLog index d8774cf6..683a4f23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-03-28 Markus Gans + * Improved graphic charset pairs (vt100) + for FreeBSD console + 2017-03-26 Markus Gans * The Final Cut compiles now under FreeBSD * A new test program to show the termcap variables diff --git a/src/fkey_map.h b/src/fkey_map.h index 1745935b..ff50eadb 100644 --- a/src/fkey_map.h +++ b/src/fkey_map.h @@ -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 diff --git a/src/fterm.cpp b/src/fterm.cpp index 95d43563..db9faf1c 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -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 +#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(CSI "29m"); } +#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) + #include +#if defined(BSD) + if ( isBSDConsole() ) + { + tcap[fc::t_acs_chars].string = \ + const_cast("-\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; diff --git a/src/fterm.h b/src/fterm.h index 3a4f8de9..ead25017 100644 --- a/src/fterm.h +++ b/src/fterm.h @@ -40,9 +40,17 @@ #include #endif +#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) + #include +#if defined(BSD) + #include +#endif +#endif + #include #include + #include #include #include // 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*&); diff --git a/test/termcap.cpp b/test/termcap.cpp index e43ddee6..7aabc303 100644 --- a/test/termcap.cpp +++ b/test/termcap.cpp @@ -93,10 +93,15 @@ int main (int argc, char* argv[]) << terminal->termtype_Answerback << "\r\n"; std::cout << "| after parseSecDA(): " << terminal->termtype_SecDA << "\r\n"; - tcapString ( "| The answerback String" - , terminal->getAnswerbackString().c_str() ); - tcapString ( "| The SecDA String" - , terminal->getSecDAString().c_str() ); + + 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