2000-06-18 18:38 UTC+0100 Victor Szakats <info@szelvesz.hu>
This commit is contained in:
@@ -1,3 +1,18 @@
|
||||
2000-06-18 18:38 UTC+0100 Victor Szakats <info@szelvesz.hu>
|
||||
|
||||
* source/lang/msgde.c
|
||||
* Updated, Thanks to Torsten.
|
||||
|
||||
* source/rtl/gtcrs/*
|
||||
* Some formatting
|
||||
|
||||
* source/rtl/gtsln/*
|
||||
* Some formatting, variables renamed.
|
||||
! Added CVS IDs
|
||||
|
||||
WARNING! Please try to compile the SLANG and NCURSES GTs and report any
|
||||
errors, since I could not test them.
|
||||
|
||||
2000-06-18 20:16 GMT+3 Alexander Kresin <alex@belacy.belgorod.su>
|
||||
* source/pp/ppcore.c
|
||||
*fixed some problems with [ ... ] in pp, reported by Brian Hays
|
||||
|
||||
@@ -2,91 +2,189 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/* Language Support Module */
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Language Support Module (DE)
|
||||
*
|
||||
* Copyright 1999 {list of individual authors and e-mail addresses}
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
/* Language name: German */
|
||||
/* ISO language code (2 chars): DE */
|
||||
/* Codepage: ???? */
|
||||
/* Codepage: 850 */
|
||||
|
||||
#include "hbdefs.h"
|
||||
#include "hbapilng.h"
|
||||
|
||||
char *hb_dateMonthsName[ 12 ] =
|
||||
static HB_LANG s_lang =
|
||||
{
|
||||
"Januar",
|
||||
"Februar",
|
||||
"März",
|
||||
"April",
|
||||
"Mai",
|
||||
"Juni",
|
||||
"Juli",
|
||||
"August",
|
||||
"September",
|
||||
"Oktober",
|
||||
"November",
|
||||
"Dezember"
|
||||
{
|
||||
/* Identification */
|
||||
|
||||
"DE", /* ID */
|
||||
"German", /* Name (in English) */
|
||||
"deutsch", /* Name (in native language) */
|
||||
"DE", /* RFC ID */
|
||||
"850", /* Codepage */
|
||||
"$Revision$ $Date$", /* Version */
|
||||
|
||||
/* Month names */
|
||||
|
||||
"Januar",
|
||||
"Februar",
|
||||
"M„rz",
|
||||
"April",
|
||||
"Mai",
|
||||
"Juni",
|
||||
"Juli",
|
||||
"August",
|
||||
"September",
|
||||
"Oktober",
|
||||
"November",
|
||||
"Dezember",
|
||||
|
||||
/* Day names */
|
||||
|
||||
"Sonntag",
|
||||
"Montag",
|
||||
"Dienstag",
|
||||
"Mittwoch",
|
||||
"Donnerstag",
|
||||
"Freitag",
|
||||
"Samstag",
|
||||
|
||||
/* CA-Cl*pper compatible natmsg items */
|
||||
|
||||
"Datenbank Dateien Anz. S„tze Letzte Žnderung Gr”áe",
|
||||
"M”chten Sie mehr Beispiele?",
|
||||
"Anz. Seiten",
|
||||
"** Zwischensumme **",
|
||||
"* Teilsumme *",
|
||||
"*** Summe ***",
|
||||
"Einfg",
|
||||
" ",
|
||||
"Ung<EFBFBD>ltiges Datum",
|
||||
"Bereich: ",
|
||||
" - ",
|
||||
"J/N",
|
||||
"UNGšLTIGER AUSDRUCK",
|
||||
|
||||
/* Error description names */
|
||||
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
"Bound error",
|
||||
"String overflow",
|
||||
"Numeric overflow",
|
||||
"Zero divisor",
|
||||
"Numeric error",
|
||||
"Syntax error",
|
||||
"Operation too complex",
|
||||
"",
|
||||
"",
|
||||
"Memory low",
|
||||
"Undefined function",
|
||||
"No exported method",
|
||||
"Variable does not exist",
|
||||
"Alias does not exist",
|
||||
"No exported variable",
|
||||
"Illegal characters in alias",
|
||||
"Alias already in use",
|
||||
"",
|
||||
"Create error",
|
||||
"Open error",
|
||||
"Close error",
|
||||
"Read error",
|
||||
"Write error",
|
||||
"Print error",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Operation not supported",
|
||||
"Limit exceeded",
|
||||
"Corruption detected",
|
||||
"Data type error",
|
||||
"Data width error",
|
||||
"Workarea not in use",
|
||||
"Workarea not indexed",
|
||||
"Exclusive required",
|
||||
"Lock required",
|
||||
"Write not allowed",
|
||||
"Append lock failed",
|
||||
"Lock Failure",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"array access",
|
||||
"array assign",
|
||||
"array dimension",
|
||||
"not an array",
|
||||
"conditional",
|
||||
|
||||
/* Internal error names */
|
||||
|
||||
"Unrecoverable error %lu: ",
|
||||
"Error recovery failure",
|
||||
"No ERRORBLOCK() for error",
|
||||
"Too many recursive error handler calls",
|
||||
"RDD invalid or failed to load",
|
||||
"Invalid method type from %s",
|
||||
"hb_xgrab can't allocate memory",
|
||||
"hb_xrealloc called with a NULL pointer",
|
||||
"hb_xrealloc called with an invalid pointer",
|
||||
"hb_xrealloc can't reallocate memory",
|
||||
"hb_xfree called with an invalid pointer",
|
||||
"hb_xfree called with a NULL pointer",
|
||||
"Can\'t locate the starting procedure: \'%s\'",
|
||||
"No starting procedure",
|
||||
"Unsupported VM opcode",
|
||||
"Symbol item expected from %s",
|
||||
"Invalid symbol type for self from %s",
|
||||
"Codeblock expected from %s",
|
||||
"Incorrect item type on the stack trying to pop from %s",
|
||||
"Stack underflow",
|
||||
"An item was going to be copied to itself from %s",
|
||||
"Invalid symbol item passed as memvar %s",
|
||||
|
||||
/* Texts */
|
||||
|
||||
"DD.MM.YYYY",
|
||||
"J",
|
||||
"N"
|
||||
}
|
||||
};
|
||||
|
||||
char *hb_dateDaysName[ 7 ] =
|
||||
{
|
||||
"Sonntag",
|
||||
"Montag",
|
||||
"Dienstag",
|
||||
"Mittwoch",
|
||||
"Donnerstag",
|
||||
"Freitag",
|
||||
"Samstag"
|
||||
};
|
||||
HB_LANG_ANNOUNCE( DE );
|
||||
|
||||
HB_CALL_ON_STARTUP_BEGIN( hb_lang_Init_DE )
|
||||
hb_langRegister( &s_lang );
|
||||
HB_CALL_ON_STARTUP_END( hb_lang_Init_DE )
|
||||
#if ! defined(__GNUC__) && ! defined(_MSC_VER)
|
||||
#pragma startup hb_lang_Init_DE
|
||||
#endif
|
||||
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
"Bound error",
|
||||
"String overflow",
|
||||
"Numeric overflow",
|
||||
"Zero divisor",
|
||||
"Numeric error",
|
||||
"Syntax error",
|
||||
"Operation too complex",
|
||||
"",
|
||||
"",
|
||||
"Memory low",
|
||||
"Undefined function",
|
||||
"No exported method",
|
||||
"Variable does not exist",
|
||||
"Alias does not exist",
|
||||
"No exported variable",
|
||||
"Illegal characters in alias",
|
||||
"Alias already in use",
|
||||
"",
|
||||
"Create error",
|
||||
"Open error",
|
||||
"Close error",
|
||||
"Read error",
|
||||
"Write error",
|
||||
"Print error",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Operation not supported",
|
||||
"Limit exceeded",
|
||||
"Corruption detected",
|
||||
"Data type error",
|
||||
"Data width error",
|
||||
"Workarea not in use",
|
||||
"Workarea not indexed",
|
||||
"Exclusive required",
|
||||
"Lock required",
|
||||
"Write not allowed",
|
||||
"Append lock failed",
|
||||
"Lock Failure",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Incorrect number of arguments",
|
||||
"array access",
|
||||
"array assign",
|
||||
"not an array",
|
||||
"conditional"
|
||||
};
|
||||
|
||||
@@ -43,14 +43,14 @@
|
||||
*/
|
||||
static USHORT s_uiDispCount;
|
||||
|
||||
static void gt_GetMaxRC(int* r, int* c);
|
||||
static void gt_GetRC(int* r, int* c);
|
||||
static void gt_SetRC(int r, int c);
|
||||
static void gt_GetMaxRC( int * r, int * c );
|
||||
static void gt_GetRC( int * r, int * c );
|
||||
static void gt_SetRC( int r, int c );
|
||||
|
||||
static unsigned s_attribmap_table[ 256 ]; /* mapping from DOS style attributes */
|
||||
static BOOL s_under_xterm;
|
||||
static int s_alternate_char_set;
|
||||
static char s_xTermBox[ 10 ] = "lqkxjqmx ";
|
||||
static char s_xTermBox[ 10 ] = "lqkxjqmx ";
|
||||
|
||||
extern void hb_gt_Initialize_Mouse( void );
|
||||
extern void hb_gt_Initialize_Keyboard( void );
|
||||
@@ -87,19 +87,21 @@ static void hb_gt_Initialize_Terminal( void )
|
||||
static char color_map[] = { 0, 4, 2, 6, 1, 5, 3, 7 };
|
||||
|
||||
start_color();
|
||||
for( backg=0; backg<COLORS; backg++ )
|
||||
for( foreg=0; foreg<COLORS; foreg++ )
|
||||
init_pair( backg*COLORS+foreg, color_map[foreg], color_map[backg] );
|
||||
for( backg = 0; backg < COLORS; backg++ )
|
||||
{
|
||||
for( foreg = 0; foreg < COLORS; foreg++ )
|
||||
init_pair( backg * COLORS + foreg, color_map[ foreg ], color_map[ backg ] );
|
||||
}
|
||||
|
||||
for( i=0; i<256; i++ )
|
||||
for( i = 0; i < 256; i++ )
|
||||
{
|
||||
backg = ( i >> 4 ) & 0x07; /* bits 4-6, bit 7 is blinking attribute */
|
||||
foreg = ( i & 0x07 );
|
||||
s_attribmap_table[ i ] = COLOR_PAIR( backg*COLORS + foreg );
|
||||
if( i & 0x08 )
|
||||
s_attribmap_table[ i ] |= A_BOLD; /* 4-th bit is an intensity bit */
|
||||
if( i & 0x80 )
|
||||
s_attribmap_table[ i ] |= A_BLINK; /* 7-th bit is blinking bit */
|
||||
foreg = ( i & 0x07 );
|
||||
s_attribmap_table[ i ] = COLOR_PAIR( backg * COLORS + foreg );
|
||||
if( i & 0x08 )
|
||||
s_attribmap_table[ i ] |= A_BOLD; /* 4-th bit is an intensity bit */
|
||||
if( i & 0x80 )
|
||||
s_attribmap_table[ i ] |= A_BLINK; /* 7-th bit is blinking bit */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,24 +111,23 @@ static void hb_gt_Initialize_Terminal( void )
|
||||
nodelay( stdscr, TRUE );
|
||||
keypad( stdscr, FALSE );
|
||||
|
||||
s_under_xterm = !strncmp( getenv("TERM"), "xterm", 5 );
|
||||
if( s_under_xterm )
|
||||
{
|
||||
/* Alternate characters set will be enabled only by request because
|
||||
* it changes character mapping under xterm
|
||||
*/
|
||||
s_alternate_char_set = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If running under Linux console enable alternate character set
|
||||
* by default
|
||||
*/
|
||||
s_alternate_char_set = A_ALTCHARSET;
|
||||
}
|
||||
s_under_xterm = ( strncmp( getenv( "TERM" ), "xterm", 5 ) == 0 );
|
||||
if( s_under_xterm )
|
||||
{
|
||||
/* Alternate characters set will be enabled only by request because
|
||||
* it changes character mapping under xterm
|
||||
*/
|
||||
s_alternate_char_set = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If running under Linux console enable alternate character set
|
||||
* by default
|
||||
*/
|
||||
s_alternate_char_set = A_ALTCHARSET;
|
||||
}
|
||||
bkgdset( ' ' );
|
||||
ripoffline( 0, NULL );
|
||||
|
||||
}
|
||||
|
||||
static void hb_gt_Exit_Terminal( void )
|
||||
@@ -146,7 +147,6 @@ void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr )
|
||||
/* Mouse sub-sytem have to be initialized after ncurses initialization */
|
||||
hb_gt_Initialize_Mouse();
|
||||
hb_gt_Initialize_Keyboard();
|
||||
|
||||
}
|
||||
|
||||
void hb_gt_Exit( void )
|
||||
@@ -223,7 +223,7 @@ USHORT hb_gt_GetScreenWidth( void )
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetScreenWidth()"));
|
||||
|
||||
gt_GetMaxRC(&r, &c);
|
||||
gt_GetMaxRC( &r, &c );
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ USHORT hb_gt_GetScreenHeight( void )
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetScreenHeight()"));
|
||||
|
||||
gt_GetMaxRC(&r, &c);
|
||||
gt_GetMaxRC( &r, &c );
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ void hb_gt_SetPos( SHORT iRow, SHORT iCol )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetPos(%hd, %hd)", iRow, iCol));
|
||||
|
||||
gt_SetRC(iRow, iCol);
|
||||
gt_SetRC( iRow, iCol );
|
||||
}
|
||||
|
||||
SHORT hb_gt_Col( void )
|
||||
@@ -250,7 +250,7 @@ SHORT hb_gt_Col( void )
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Col()"));
|
||||
|
||||
gt_GetRC(&r, &c);
|
||||
gt_GetRC( &r, &c );
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ SHORT hb_gt_Row( void )
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Row()"));
|
||||
|
||||
gt_GetRC(&r, &c);
|
||||
gt_GetRC( &r, &c );
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -291,7 +291,9 @@ static void hb_gt_xPutch( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE byChar )
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_xPutch(%hu, %hu, %d, %i)", uiRow, uiCol, (int) byAttr, byChar));
|
||||
|
||||
move( uiRow, uiCol );
|
||||
|
||||
addch( byChar | s_alternate_char_set | s_attribmap_table[ byAttr ] );
|
||||
|
||||
if( s_uiDispCount == 0 )
|
||||
refresh();
|
||||
}
|
||||
@@ -309,8 +311,10 @@ void hb_gt_Puts( USHORT uiRow,
|
||||
|
||||
attr = s_alternate_char_set | s_attribmap_table[ byAttr ];
|
||||
move( uiRow, uiCol );
|
||||
|
||||
for( i = 0; i < ulLen; ++i )
|
||||
addch( pbyStr[ i ] | attr );
|
||||
|
||||
if( s_uiDispCount == 0 )
|
||||
refresh();
|
||||
}
|
||||
@@ -327,7 +331,7 @@ void hb_gt_GetText( USHORT uiTop,
|
||||
BYTE * pbyDst )
|
||||
{
|
||||
int i;
|
||||
chtype *pBuffer = (chtype *)pbyDst;
|
||||
chtype * pBuffer = ( chtype * ) pbyDst;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetText(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbyDst));
|
||||
|
||||
@@ -336,7 +340,7 @@ void hb_gt_GetText( USHORT uiTop,
|
||||
|
||||
while( uiTop <= uiBottom )
|
||||
{
|
||||
for( i=uiLeft; i<=uiRight; i++, pBuffer++ )
|
||||
for( i = uiLeft; i <= uiRight; i++, pBuffer++ )
|
||||
*pBuffer = mvinch( uiTop, i );
|
||||
++uiTop;
|
||||
}
|
||||
@@ -349,7 +353,7 @@ void hb_gt_PutText( USHORT uiTop,
|
||||
BYTE * pbySrc )
|
||||
{
|
||||
int Cols;
|
||||
chtype *pBuffer = (chtype *)pbySrc;
|
||||
chtype * pBuffer = ( chtype * ) pbySrc;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_PutText(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbySrc));
|
||||
|
||||
@@ -357,9 +361,10 @@ void hb_gt_PutText( USHORT uiTop,
|
||||
while( uiTop <= uiBottom )
|
||||
{
|
||||
mvaddchnstr( uiTop, uiLeft, pBuffer, Cols );
|
||||
pBuffer +=Cols;
|
||||
pBuffer += Cols;
|
||||
++uiTop;
|
||||
}
|
||||
|
||||
if( s_uiDispCount == 0 )
|
||||
refresh();
|
||||
}
|
||||
@@ -380,15 +385,15 @@ void hb_gt_SetAttribute( USHORT uiTop,
|
||||
|
||||
while( uiTop <= uiBottom )
|
||||
{
|
||||
for ( dx=uiLeft; dx<=uiRight; dx++ )
|
||||
for( dx = uiLeft; dx <= uiRight; dx++ )
|
||||
{
|
||||
c = mvinch( uiTop, dx );
|
||||
/* extract character only (remember about alternate chars) */
|
||||
c &= (A_CHARTEXT | A_ALTCHARSET);
|
||||
/* set new attribute */
|
||||
c |= newAttr;
|
||||
if (addch(c) == ERR) /* Stop on error */
|
||||
return;
|
||||
c = mvinch( uiTop, dx );
|
||||
/* extract character only (remember about alternate chars) */
|
||||
c &= ( A_CHARTEXT | A_ALTCHARSET );
|
||||
/* set new attribute */
|
||||
c |= newAttr;
|
||||
if( addch( c ) == ERR ) /* Stop on error */
|
||||
return;
|
||||
}
|
||||
uiTop++;
|
||||
}
|
||||
@@ -410,9 +415,9 @@ void hb_gt_Scroll( USHORT uiTop,
|
||||
if( iRows == 0 && iCols == 0 )
|
||||
{
|
||||
/* Clear the specified rectangle */
|
||||
WINDOW *subw;
|
||||
WINDOW * subw;
|
||||
|
||||
subw = subwin( stdscr, uiBottom-uiTop+1, uiRight-uiLeft+1, uiTop, uiLeft );
|
||||
subw = subwin( stdscr, uiBottom - uiTop + 1, uiRight - uiLeft + 1, uiTop, uiLeft );
|
||||
wbkgdset( subw, ' ' | s_attribmap_table[ byAttr ] );
|
||||
wclear( subw );
|
||||
touchwin( stdscr );
|
||||
@@ -423,9 +428,9 @@ void hb_gt_Scroll( USHORT uiTop,
|
||||
{
|
||||
if( iRows != 0 )
|
||||
{
|
||||
WINDOW *subw;
|
||||
WINDOW * subw;
|
||||
|
||||
subw = subwin( stdscr, uiBottom-uiTop+1, uiRight-uiLeft+1, uiTop, uiLeft );
|
||||
subw = subwin( stdscr, uiBottom - uiTop + 1, uiRight - uiLeft + 1, uiTop, uiLeft );
|
||||
wbkgdset( subw, ' ' | s_attribmap_table[ byAttr ] );
|
||||
scrollok( subw, TRUE );
|
||||
wscrl( subw, iRows );
|
||||
@@ -434,7 +439,7 @@ void hb_gt_Scroll( USHORT uiTop,
|
||||
|
||||
if( iCols != 0 )
|
||||
{
|
||||
chtype *pScreen, *pTmp;
|
||||
chtype * pScreen, * pTmp;
|
||||
int memsize;
|
||||
int RowCount, ColCount;
|
||||
int i, j;
|
||||
@@ -447,37 +452,37 @@ void hb_gt_Scroll( USHORT uiTop,
|
||||
newAttr = ' ' | s_attribmap_table[ byAttr ];
|
||||
|
||||
memsize = hb_gt_RectSize( RowCount, ColCount );
|
||||
pScreen = (chtype *) hb_xgrab( memsize );
|
||||
hb_gt_GetText( uiTop, uiLeft, uiBottom, uiRight, (BYTE *)pScreen );
|
||||
pScreen = ( chtype * ) hb_xgrab( memsize );
|
||||
hb_gt_GetText( uiTop, uiLeft, uiBottom, uiRight, ( BYTE * ) pScreen );
|
||||
|
||||
if( iCols > 0 )
|
||||
{
|
||||
pTmp = pScreen;
|
||||
for( i=0; i<RowCount; i++ )
|
||||
for( i = 0; i < RowCount; i++ )
|
||||
{
|
||||
for( j=ColCount - 1; j>=iCols; j-- )
|
||||
pTmp[ j ] = pTmp[ j-1 ];
|
||||
for( j=0; j<iCols; j++ )
|
||||
for( j = ColCount - 1; j >= iCols; j-- )
|
||||
pTmp[ j ] = pTmp[ j - 1 ];
|
||||
for( j = 0; j < iCols; j++ )
|
||||
pTmp[ j ] = newAttr;
|
||||
pTmp += ColCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int ColMove = ColCount + iCols;
|
||||
int ColMove = ColCount + iCols;
|
||||
|
||||
pTmp = pScreen;
|
||||
for( i=0; i<RowCount; i++ )
|
||||
for( i = 0; i < RowCount; i++ )
|
||||
{
|
||||
for( j=0; j<ColMove; j++ )
|
||||
pTmp[ j ] = pTmp[ j-iCols ];
|
||||
for( j=ColMove; j<ColCount; j++ )
|
||||
for( j = 0; j < ColMove; j++ )
|
||||
pTmp[ j ] = pTmp[ j - iCols ];
|
||||
for( j = ColMove; j < ColCount; j++ )
|
||||
pTmp[ j ] = newAttr;
|
||||
pTmp += ColCount;
|
||||
}
|
||||
}
|
||||
hb_gt_PutText( uiTop, uiLeft, uiBottom, uiRight, (BYTE *)pScreen );
|
||||
hb_xfree( (BYTE *)pScreen );
|
||||
hb_gt_PutText( uiTop, uiLeft, uiBottom, uiRight, ( BYTE * ) pScreen );
|
||||
hb_xfree( ( BYTE * ) pScreen );
|
||||
}
|
||||
}
|
||||
if( s_uiDispCount == 0 )
|
||||
@@ -510,7 +515,7 @@ BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols )
|
||||
{
|
||||
BOOL success;
|
||||
hb_gt_Exit_Terminal();
|
||||
success = ( ( resizeterm( uiRows, uiCols) == OK) ? TRUE : FALSE );
|
||||
success = ( resizeterm( uiRows, uiCols ) == OK );
|
||||
hb_gt_Initialize_Terminal();
|
||||
return success;
|
||||
}
|
||||
@@ -554,7 +559,7 @@ void hb_gt_Tone( double dFrequency, double dDuration )
|
||||
static void gt_GetMaxRC(int* r, int* c)
|
||||
{
|
||||
int y, x;
|
||||
getmaxyx(stdscr, y, x);
|
||||
getmaxyx( stdscr, y, x );
|
||||
*r = y;
|
||||
*c = x;
|
||||
}
|
||||
@@ -562,14 +567,14 @@ static void gt_GetMaxRC(int* r, int* c)
|
||||
static void gt_GetRC(int* r, int* c)
|
||||
{
|
||||
int y, x;
|
||||
getyx(stdscr, y, x);
|
||||
getyx( stdscr, y, x );
|
||||
*r = y;
|
||||
*c = x;
|
||||
}
|
||||
|
||||
static void gt_SetRC(int r, int c)
|
||||
{
|
||||
move(r, c);
|
||||
move( r, c );
|
||||
if( s_uiDispCount == 0 )
|
||||
refresh();
|
||||
}
|
||||
@@ -588,10 +593,8 @@ void hb_gt_Replicate( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE byChar, ULON
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Replicate(%hu, %hu, %i, %i, %lu)", uiRow, uiCol, byAttr, byChar, nLength));
|
||||
|
||||
{
|
||||
while( nLength-- )
|
||||
hb_gt_xPutch( uiRow, uiCol++, byAttr, byChar );
|
||||
}
|
||||
while( nLength-- )
|
||||
hb_gt_xPutch( uiRow, uiCol++, byAttr, byChar );
|
||||
}
|
||||
|
||||
USHORT hb_gt_Box( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
|
||||
@@ -680,9 +683,8 @@ USHORT hb_gt_Box( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
|
||||
hb_gt_DispEnd();
|
||||
|
||||
if( s_under_xterm )
|
||||
{
|
||||
s_alternate_char_set = 0; /* restore default setting */
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -694,11 +696,12 @@ USHORT hb_gt_BoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
|
||||
pbyFrame = s_xTermBox;
|
||||
s_alternate_char_set = A_ALTCHARSET;
|
||||
}
|
||||
|
||||
hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
|
||||
|
||||
if( s_under_xterm )
|
||||
{
|
||||
s_alternate_char_set = 0; /* restore default setting */
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -710,11 +713,12 @@ USHORT hb_gt_BoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
|
||||
pbyFrame = s_xTermBox;
|
||||
s_alternate_char_set = A_ALTCHARSET;
|
||||
}
|
||||
|
||||
hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
|
||||
|
||||
if( s_under_xterm )
|
||||
{
|
||||
s_alternate_char_set = 0; /* restore default setting */
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -729,6 +733,7 @@ USHORT hb_gt_HorizLine( USHORT uiRow, USHORT uiLeft, USHORT uiRight, BYTE byChar
|
||||
else
|
||||
mvhline( uiRow, uiRight, byChar | A_ALTCHARSET | s_attribmap_table[ byAttr ],
|
||||
uiLeft - uiRight + 1 );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -746,6 +751,7 @@ USHORT hb_gt_VertLine( USHORT uiCol, USHORT uiTop, USHORT uiBottom, BYTE byChar,
|
||||
|
||||
if( s_under_xterm )
|
||||
byChar = ACS_VLINE;
|
||||
|
||||
mvvline( uRow, uiCol, byChar | A_ALTCHARSET | s_attribmap_table[ byAttr ],
|
||||
uiBottom - uRow + 1 );
|
||||
|
||||
|
||||
@@ -54,10 +54,10 @@ static void hb_gt_Add_keymap( int, char * );
|
||||
|
||||
struct key_map_struc
|
||||
{
|
||||
int inkey_code;
|
||||
int length;
|
||||
char *key_string;
|
||||
struct key_map_struc *Next;
|
||||
int inkey_code;
|
||||
int length;
|
||||
char * key_string;
|
||||
struct key_map_struc * Next;
|
||||
};
|
||||
|
||||
#define HB_HASH_KEY 128
|
||||
@@ -76,7 +76,7 @@ void hb_gt_Initialize_Keyboard( void )
|
||||
for( i = 0; i < HB_HASH_KEY; i++ )
|
||||
s_keymap_table[ i ] = NULL;
|
||||
|
||||
s_under_xterm = !strncmp( getenv("TERM"), "xterm", 5 );
|
||||
s_under_xterm = ( strncmp( getenv("TERM"), "xterm", 5 ) == 0 );
|
||||
if( s_under_xterm )
|
||||
{
|
||||
/* NOTE: under xterm \E[M is used as a leading code for a mouse event
|
||||
@@ -87,8 +87,8 @@ void hb_gt_Initialize_Keyboard( void )
|
||||
b2 - row position of a mouse pointer
|
||||
*/
|
||||
s_mouse_event_seq = tigetstr( "kmous" );
|
||||
if( s_mouse_event_seq == NULL || s_mouse_event_seq == (char *)-1 )
|
||||
s_mouse_event_len =0;
|
||||
if( s_mouse_event_seq == NULL || s_mouse_event_seq == ( char * ) -1 )
|
||||
s_mouse_event_len = 0;
|
||||
else
|
||||
s_mouse_event_len = strlen( s_mouse_event_seq );
|
||||
hb_gt_Add_terminfo_keymap( K_HOME, "kfnd" );
|
||||
@@ -106,115 +106,114 @@ void hb_gt_Initialize_Keyboard( void )
|
||||
s_mouse_event_len = 0;
|
||||
}
|
||||
|
||||
hb_gt_Add_terminfo_keymap( K_ENTER, "kent" );
|
||||
hb_gt_Add_terminfo_keymap( K_ENTER, "ind" );
|
||||
hb_gt_Add_terminfo_keymap( K_TAB, "ht" );
|
||||
hb_gt_Add_terminfo_keymap( K_DOWN, "kcud1" );
|
||||
hb_gt_Add_terminfo_keymap( K_UP, "kcuu1" );
|
||||
hb_gt_Add_terminfo_keymap( K_LEFT, "kcub1" );
|
||||
hb_gt_Add_terminfo_keymap( K_RIGHT, "kcuf1" );
|
||||
hb_gt_Add_terminfo_keymap( K_HOME, "khome" );
|
||||
hb_gt_Add_terminfo_keymap( K_END, "kend" );
|
||||
hb_gt_Add_terminfo_keymap( K_BS, "kbs" );
|
||||
hb_gt_Add_terminfo_keymap( K_BS, "kcbt" );
|
||||
hb_gt_Add_terminfo_keymap( K_INS, "kich1" );
|
||||
hb_gt_Add_terminfo_keymap( K_DEL, "kdch1" );
|
||||
hb_gt_Add_terminfo_keymap( K_PGDN, "knp" );
|
||||
hb_gt_Add_terminfo_keymap( K_PGUP, "kpp" );
|
||||
hb_gt_Add_terminfo_keymap( K_F1, "kf1" );
|
||||
hb_gt_Add_terminfo_keymap( K_F2, "kf2" );
|
||||
hb_gt_Add_terminfo_keymap( K_F3, "kf3" );
|
||||
hb_gt_Add_terminfo_keymap( K_F4, "kf4" );
|
||||
hb_gt_Add_terminfo_keymap( K_F5, "kf5" );
|
||||
hb_gt_Add_terminfo_keymap( K_F6, "kf6" );
|
||||
hb_gt_Add_terminfo_keymap( K_F7, "kf7" );
|
||||
hb_gt_Add_terminfo_keymap( K_F8, "kf8" );
|
||||
hb_gt_Add_terminfo_keymap( K_F9, "kf9" );
|
||||
hb_gt_Add_terminfo_keymap( K_F10, "kf10" );
|
||||
hb_gt_Add_terminfo_keymap( K_F11, "kf11" );
|
||||
hb_gt_Add_terminfo_keymap( K_F12, "kf12" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F1, "kf13" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F2, "kf14" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F3, "kf15" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F4, "kf16" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F5, "kf17" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F6, "kf18" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F7, "kf19" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F8, "kf20" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F9, "kf21" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F10, "kf22" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F11, "kf23" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F12, "kf24" );
|
||||
hb_gt_Add_terminfo_keymap( K_ALT_TAB, "kcbt" );
|
||||
hb_gt_Add_terminfo_keymap( K_HOME, "ka1" );
|
||||
hb_gt_Add_terminfo_keymap( K_PGUP, "ka3" );
|
||||
hb_gt_Add_terminfo_keymap( K_END, "kc1" );
|
||||
hb_gt_Add_terminfo_keymap( K_PGDN, "kc3" );
|
||||
hb_gt_Add_keymap( K_ALT_A, "\033a" );
|
||||
hb_gt_Add_keymap( K_ALT_A, "\033A" );
|
||||
hb_gt_Add_keymap( K_ALT_B, "\033b" );
|
||||
hb_gt_Add_keymap( K_ALT_B, "\033B" );
|
||||
hb_gt_Add_keymap( K_ALT_C, "\033c" );
|
||||
hb_gt_Add_keymap( K_ALT_C, "\033C" );
|
||||
hb_gt_Add_keymap( K_ALT_D, "\033d" );
|
||||
hb_gt_Add_keymap( K_ALT_D, "\033D" );
|
||||
hb_gt_Add_keymap( K_ALT_E, "\033e" );
|
||||
hb_gt_Add_keymap( K_ALT_E, "\033E" );
|
||||
hb_gt_Add_keymap( K_ALT_F, "\033f" );
|
||||
hb_gt_Add_keymap( K_ALT_F, "\033F" );
|
||||
hb_gt_Add_keymap( K_ALT_G, "\033g" );
|
||||
hb_gt_Add_keymap( K_ALT_G, "\033G" );
|
||||
hb_gt_Add_keymap( K_ALT_H, "\033h" );
|
||||
hb_gt_Add_keymap( K_ALT_H, "\033H" );
|
||||
hb_gt_Add_keymap( K_ALT_I, "\033i" );
|
||||
hb_gt_Add_keymap( K_ALT_I, "\033I" );
|
||||
hb_gt_Add_keymap( K_ALT_J, "\033j" );
|
||||
hb_gt_Add_keymap( K_ALT_J, "\033J" );
|
||||
hb_gt_Add_keymap( K_ALT_K, "\033k" );
|
||||
hb_gt_Add_keymap( K_ALT_K, "\033K" );
|
||||
hb_gt_Add_keymap( K_ALT_L, "\033l" );
|
||||
hb_gt_Add_keymap( K_ALT_L, "\033L" );
|
||||
hb_gt_Add_keymap( K_ALT_M, "\033m" );
|
||||
hb_gt_Add_keymap( K_ALT_M, "\033M" );
|
||||
hb_gt_Add_keymap( K_ALT_N, "\033n" );
|
||||
hb_gt_Add_keymap( K_ALT_N, "\033N" );
|
||||
hb_gt_Add_keymap( K_ALT_O, "\033o" );
|
||||
hb_gt_Add_keymap( K_ALT_O, "\033O" );
|
||||
hb_gt_Add_keymap( K_ALT_P, "\033p" );
|
||||
hb_gt_Add_keymap( K_ALT_P, "\033P" );
|
||||
hb_gt_Add_keymap( K_ALT_Q, "\033q" );
|
||||
hb_gt_Add_keymap( K_ALT_Q, "\033Q" );
|
||||
hb_gt_Add_keymap( K_ALT_R, "\033r" );
|
||||
hb_gt_Add_keymap( K_ALT_R, "\033R" );
|
||||
hb_gt_Add_keymap( K_ALT_S, "\033s" );
|
||||
hb_gt_Add_keymap( K_ALT_S, "\033S" );
|
||||
hb_gt_Add_keymap( K_ALT_T, "\033t" );
|
||||
hb_gt_Add_keymap( K_ALT_T, "\033T" );
|
||||
hb_gt_Add_keymap( K_ALT_U, "\033u" );
|
||||
hb_gt_Add_keymap( K_ALT_U, "\033U" );
|
||||
hb_gt_Add_keymap( K_ALT_V, "\033v" );
|
||||
hb_gt_Add_keymap( K_ALT_V, "\033V" );
|
||||
hb_gt_Add_keymap( K_ALT_W, "\033w" );
|
||||
hb_gt_Add_keymap( K_ALT_W, "\033W" );
|
||||
hb_gt_Add_keymap( K_ALT_X, "\033x" );
|
||||
hb_gt_Add_keymap( K_ALT_X, "\033X" );
|
||||
hb_gt_Add_keymap( K_ALT_Y, "\033y" );
|
||||
hb_gt_Add_keymap( K_ALT_Y, "\033Y" );
|
||||
hb_gt_Add_keymap( K_ALT_Z, "\033z" );
|
||||
hb_gt_Add_keymap( K_ALT_Z, "\033Z" );
|
||||
hb_gt_Add_keymap( K_ALT_1, "\0331" );
|
||||
hb_gt_Add_keymap( K_ALT_2, "\0332" );
|
||||
hb_gt_Add_keymap( K_ALT_3, "\0333" );
|
||||
hb_gt_Add_keymap( K_ALT_4, "\0334" );
|
||||
hb_gt_Add_keymap( K_ALT_5, "\0335" );
|
||||
hb_gt_Add_keymap( K_ALT_6, "\0336" );
|
||||
hb_gt_Add_keymap( K_ALT_7, "\0337" );
|
||||
hb_gt_Add_keymap( K_ALT_8, "\0338" );
|
||||
hb_gt_Add_keymap( K_ALT_9, "\0339" );
|
||||
hb_gt_Add_keymap( K_ALT_0, "\0330" );
|
||||
hb_gt_Add_keymap( K_ALT_ENTER, "\033\n" );
|
||||
hb_gt_Add_keymap( K_ALT_EQUALS, "\033=" );
|
||||
|
||||
hb_gt_Add_terminfo_keymap( K_ENTER, "kent" );
|
||||
hb_gt_Add_terminfo_keymap( K_ENTER, "ind" );
|
||||
hb_gt_Add_terminfo_keymap( K_TAB, "ht" );
|
||||
hb_gt_Add_terminfo_keymap( K_DOWN, "kcud1" );
|
||||
hb_gt_Add_terminfo_keymap( K_UP, "kcuu1" );
|
||||
hb_gt_Add_terminfo_keymap( K_LEFT, "kcub1" );
|
||||
hb_gt_Add_terminfo_keymap( K_RIGHT, "kcuf1" );
|
||||
hb_gt_Add_terminfo_keymap( K_HOME, "khome" );
|
||||
hb_gt_Add_terminfo_keymap( K_END, "kend" );
|
||||
hb_gt_Add_terminfo_keymap( K_BS, "kbs" );
|
||||
hb_gt_Add_terminfo_keymap( K_BS, "kcbt" );
|
||||
hb_gt_Add_terminfo_keymap( K_INS, "kich1" );
|
||||
hb_gt_Add_terminfo_keymap( K_DEL, "kdch1" );
|
||||
hb_gt_Add_terminfo_keymap( K_PGDN, "knp" );
|
||||
hb_gt_Add_terminfo_keymap( K_PGUP, "kpp" );
|
||||
hb_gt_Add_terminfo_keymap( K_F1, "kf1" );
|
||||
hb_gt_Add_terminfo_keymap( K_F2, "kf2" );
|
||||
hb_gt_Add_terminfo_keymap( K_F3, "kf3" );
|
||||
hb_gt_Add_terminfo_keymap( K_F4, "kf4" );
|
||||
hb_gt_Add_terminfo_keymap( K_F5, "kf5" );
|
||||
hb_gt_Add_terminfo_keymap( K_F6, "kf6" );
|
||||
hb_gt_Add_terminfo_keymap( K_F7, "kf7" );
|
||||
hb_gt_Add_terminfo_keymap( K_F8, "kf8" );
|
||||
hb_gt_Add_terminfo_keymap( K_F9, "kf9" );
|
||||
hb_gt_Add_terminfo_keymap( K_F10, "kf10" );
|
||||
hb_gt_Add_terminfo_keymap( K_F11, "kf11" );
|
||||
hb_gt_Add_terminfo_keymap( K_F12, "kf12" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F1, "kf13" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F2, "kf14" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F3, "kf15" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F4, "kf16" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F5, "kf17" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F6, "kf18" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F7, "kf19" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F8, "kf20" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F9, "kf21" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F10, "kf22" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F11, "kf23" );
|
||||
hb_gt_Add_terminfo_keymap( K_SH_F12, "kf24" );
|
||||
hb_gt_Add_terminfo_keymap( K_ALT_TAB, "kcbt" );
|
||||
hb_gt_Add_terminfo_keymap( K_HOME, "ka1" );
|
||||
hb_gt_Add_terminfo_keymap( K_PGUP, "ka3" );
|
||||
hb_gt_Add_terminfo_keymap( K_END, "kc1" );
|
||||
hb_gt_Add_terminfo_keymap( K_PGDN, "kc3" );
|
||||
hb_gt_Add_keymap( K_ALT_A, "\033a" );
|
||||
hb_gt_Add_keymap( K_ALT_A, "\033A" );
|
||||
hb_gt_Add_keymap( K_ALT_B, "\033b" );
|
||||
hb_gt_Add_keymap( K_ALT_B, "\033B" );
|
||||
hb_gt_Add_keymap( K_ALT_C, "\033c" );
|
||||
hb_gt_Add_keymap( K_ALT_C, "\033C" );
|
||||
hb_gt_Add_keymap( K_ALT_D, "\033d" );
|
||||
hb_gt_Add_keymap( K_ALT_D, "\033D" );
|
||||
hb_gt_Add_keymap( K_ALT_E, "\033e" );
|
||||
hb_gt_Add_keymap( K_ALT_E, "\033E" );
|
||||
hb_gt_Add_keymap( K_ALT_F, "\033f" );
|
||||
hb_gt_Add_keymap( K_ALT_F, "\033F" );
|
||||
hb_gt_Add_keymap( K_ALT_G, "\033g" );
|
||||
hb_gt_Add_keymap( K_ALT_G, "\033G" );
|
||||
hb_gt_Add_keymap( K_ALT_H, "\033h" );
|
||||
hb_gt_Add_keymap( K_ALT_H, "\033H" );
|
||||
hb_gt_Add_keymap( K_ALT_I, "\033i" );
|
||||
hb_gt_Add_keymap( K_ALT_I, "\033I" );
|
||||
hb_gt_Add_keymap( K_ALT_J, "\033j" );
|
||||
hb_gt_Add_keymap( K_ALT_J, "\033J" );
|
||||
hb_gt_Add_keymap( K_ALT_K, "\033k" );
|
||||
hb_gt_Add_keymap( K_ALT_K, "\033K" );
|
||||
hb_gt_Add_keymap( K_ALT_L, "\033l" );
|
||||
hb_gt_Add_keymap( K_ALT_L, "\033L" );
|
||||
hb_gt_Add_keymap( K_ALT_M, "\033m" );
|
||||
hb_gt_Add_keymap( K_ALT_M, "\033M" );
|
||||
hb_gt_Add_keymap( K_ALT_N, "\033n" );
|
||||
hb_gt_Add_keymap( K_ALT_N, "\033N" );
|
||||
hb_gt_Add_keymap( K_ALT_O, "\033o" );
|
||||
hb_gt_Add_keymap( K_ALT_O, "\033O" );
|
||||
hb_gt_Add_keymap( K_ALT_P, "\033p" );
|
||||
hb_gt_Add_keymap( K_ALT_P, "\033P" );
|
||||
hb_gt_Add_keymap( K_ALT_Q, "\033q" );
|
||||
hb_gt_Add_keymap( K_ALT_Q, "\033Q" );
|
||||
hb_gt_Add_keymap( K_ALT_R, "\033r" );
|
||||
hb_gt_Add_keymap( K_ALT_R, "\033R" );
|
||||
hb_gt_Add_keymap( K_ALT_S, "\033s" );
|
||||
hb_gt_Add_keymap( K_ALT_S, "\033S" );
|
||||
hb_gt_Add_keymap( K_ALT_T, "\033t" );
|
||||
hb_gt_Add_keymap( K_ALT_T, "\033T" );
|
||||
hb_gt_Add_keymap( K_ALT_U, "\033u" );
|
||||
hb_gt_Add_keymap( K_ALT_U, "\033U" );
|
||||
hb_gt_Add_keymap( K_ALT_V, "\033v" );
|
||||
hb_gt_Add_keymap( K_ALT_V, "\033V" );
|
||||
hb_gt_Add_keymap( K_ALT_W, "\033w" );
|
||||
hb_gt_Add_keymap( K_ALT_W, "\033W" );
|
||||
hb_gt_Add_keymap( K_ALT_X, "\033x" );
|
||||
hb_gt_Add_keymap( K_ALT_X, "\033X" );
|
||||
hb_gt_Add_keymap( K_ALT_Y, "\033y" );
|
||||
hb_gt_Add_keymap( K_ALT_Y, "\033Y" );
|
||||
hb_gt_Add_keymap( K_ALT_Z, "\033z" );
|
||||
hb_gt_Add_keymap( K_ALT_Z, "\033Z" );
|
||||
hb_gt_Add_keymap( K_ALT_1, "\0331" );
|
||||
hb_gt_Add_keymap( K_ALT_2, "\0332" );
|
||||
hb_gt_Add_keymap( K_ALT_3, "\0333" );
|
||||
hb_gt_Add_keymap( K_ALT_4, "\0334" );
|
||||
hb_gt_Add_keymap( K_ALT_5, "\0335" );
|
||||
hb_gt_Add_keymap( K_ALT_6, "\0336" );
|
||||
hb_gt_Add_keymap( K_ALT_7, "\0337" );
|
||||
hb_gt_Add_keymap( K_ALT_8, "\0338" );
|
||||
hb_gt_Add_keymap( K_ALT_9, "\0339" );
|
||||
hb_gt_Add_keymap( K_ALT_0, "\0330" );
|
||||
hb_gt_Add_keymap( K_ALT_ENTER, "\033\n" );
|
||||
hb_gt_Add_keymap( K_ALT_EQUALS, "\033=" );
|
||||
}
|
||||
|
||||
void hb_gt_Exit_Keyboard( void )
|
||||
@@ -232,7 +231,7 @@ void hb_gt_Exit_Keyboard( void )
|
||||
{
|
||||
s_keymap_table[ i ] = tmp->Next;
|
||||
hb_xfree( tmp );
|
||||
tmp = s_keymap_table[ i ];
|
||||
tmp = s_keymap_table[ i ];
|
||||
k++;
|
||||
}
|
||||
}
|
||||
@@ -240,7 +239,7 @@ void hb_gt_Exit_Keyboard( void )
|
||||
|
||||
int hb_gt_ReadKey( HB_inkey_enum eventmask )
|
||||
{
|
||||
static char key_codes[ HB_MAX_KEYMAP_CHARS+1 ]; /* buffer for multi-characters keycodes */
|
||||
static char key_codes[ HB_MAX_KEYMAP_CHARS + 1 ]; /* buffer for multi-characters keycodes */
|
||||
static int key_waiting = -1; /* position of next character from buffer if > 0 */
|
||||
int ch;
|
||||
|
||||
@@ -248,11 +247,11 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask )
|
||||
|
||||
if( key_waiting >= 0 )
|
||||
{
|
||||
/* return next character from the buffer */
|
||||
ch = key_codes[ key_waiting++ ];
|
||||
if( key_codes[ key_waiting ] == 0 )
|
||||
key_waiting = -1; /* the last character was retrieved */
|
||||
return ch;
|
||||
/* return next character from the buffer */
|
||||
ch = key_codes[ key_waiting++ ];
|
||||
if( key_codes[ key_waiting ] == 0 )
|
||||
key_waiting = -1; /* the last character was retrieved */
|
||||
return ch;
|
||||
}
|
||||
|
||||
ch = getch();
|
||||
@@ -263,15 +262,15 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask )
|
||||
if( ch == 3 )
|
||||
{
|
||||
/* Ctrl-C was pressed */
|
||||
ch = HB_BREAK_FLAG;
|
||||
ch = HB_BREAK_FLAG;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = 0;
|
||||
int i = 0;
|
||||
BYTE sum;
|
||||
|
||||
key_codes[ 0 ] = sum = ch;
|
||||
while( ( ch = getch() ) != ERR && i <= HB_MAX_KEYMAP_CHARS )
|
||||
key_codes[ 0 ] = sum = ch;
|
||||
while( ( ch = getch() ) != ERR && i <= HB_MAX_KEYMAP_CHARS )
|
||||
{
|
||||
key_codes[ ++i ] = ch;
|
||||
/*fprintf( stderr, "key%i=%i(%c)\n", i, ch, ch );
|
||||
@@ -279,21 +278,21 @@ fflush( stderr );
|
||||
*/
|
||||
sum += ch;
|
||||
}
|
||||
key_codes[ ++i ] = 0;
|
||||
key_codes[ ++i ] = 0;
|
||||
sum &= HB_HASH_KEY - 1;
|
||||
|
||||
ch = 0;
|
||||
if( s_keymap_table[ sum ] )
|
||||
{
|
||||
/* there is an entry in the hash table */
|
||||
struct key_map_struc *tmp = s_keymap_table[ sum ];
|
||||
struct key_map_struc * tmp = s_keymap_table[ sum ];
|
||||
|
||||
while( (ch == 0) && tmp )
|
||||
while( ( ch == 0 ) && tmp )
|
||||
{
|
||||
/* now look for exact match */
|
||||
if( (i == tmp->length) && (memcmp( tmp->key_string, key_codes, i ) == 0 ) )
|
||||
if( ( i == tmp->length ) && ( memcmp( tmp->key_string, key_codes, i ) == 0 ) )
|
||||
{
|
||||
ch = tmp->inkey_code; /* keycode found */
|
||||
ch = tmp->inkey_code; /* keycode found */
|
||||
tmp = NULL; /* NOTE: tmp->inkey_code can be set to 0 */
|
||||
}
|
||||
else
|
||||
@@ -303,7 +302,7 @@ fflush( stderr );
|
||||
}
|
||||
|
||||
if( ch == 0 )
|
||||
{
|
||||
{
|
||||
if( s_mouse_event_len )
|
||||
{
|
||||
/* check for mouse event */
|
||||
@@ -321,7 +320,7 @@ fflush( stderr );
|
||||
key_waiting = 0; /* return raw key sequence */
|
||||
ch = K_HB_KEYCODES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ch;
|
||||
@@ -330,44 +329,41 @@ fflush( stderr );
|
||||
|
||||
static void hb_gt_Add_keymap( int InkeyCode, char *key_string )
|
||||
{
|
||||
struct key_map_struc *keymap;
|
||||
struct key_map_struc * keymap;
|
||||
int iLength = strlen( key_string );
|
||||
int i = 0;
|
||||
BYTE sum = 0;
|
||||
|
||||
if( iLength && iLength <= HB_MAX_KEYMAP_CHARS )
|
||||
{
|
||||
while( i < iLength )
|
||||
sum += key_string[ i++ ];
|
||||
sum &= HB_HASH_KEY - 1;
|
||||
|
||||
if( iLength && iLength <= HB_MAX_KEYMAP_CHARS )
|
||||
keymap = hb_xgrab( sizeof( struct key_map_struc ) );
|
||||
keymap->inkey_code = InkeyCode;
|
||||
keymap->key_string = key_string;
|
||||
keymap->length = iLength;
|
||||
keymap->Next = NULL;
|
||||
|
||||
if( s_keymap_table[ sum ] )
|
||||
{
|
||||
while( i < iLength )
|
||||
sum += key_string[ i++ ];
|
||||
sum &= HB_HASH_KEY-1;
|
||||
|
||||
keymap = hb_xgrab( sizeof( struct key_map_struc ) );
|
||||
keymap->inkey_code = InkeyCode;
|
||||
keymap->key_string = key_string;
|
||||
keymap->length = iLength;
|
||||
keymap->Next = NULL;
|
||||
|
||||
if( s_keymap_table[ sum ] )
|
||||
{
|
||||
struct key_map_struc *tmp = s_keymap_table[ sum ];
|
||||
while( tmp->Next )
|
||||
tmp =tmp->Next;
|
||||
tmp->Next = keymap;
|
||||
}
|
||||
else
|
||||
s_keymap_table[ sum ] = keymap;
|
||||
}
|
||||
struct key_map_struc * tmp = s_keymap_table[ sum ];
|
||||
while( tmp->Next )
|
||||
tmp = tmp->Next;
|
||||
tmp->Next = keymap;
|
||||
}
|
||||
else
|
||||
s_keymap_table[ sum ] = keymap;
|
||||
}
|
||||
}
|
||||
|
||||
static void hb_gt_Add_terminfo_keymap( int InkeyCode, char *capname )
|
||||
static void hb_gt_Add_terminfo_keymap( int InkeyCode, char * capname )
|
||||
{
|
||||
char * code;
|
||||
|
||||
code = tigetstr( capname );
|
||||
if( (code != NULL) && (code != (char *)-1) )
|
||||
{
|
||||
hb_gt_Add_keymap( InkeyCode, code );
|
||||
}
|
||||
if( ( code != NULL ) && ( code != ( char * ) -1 ) )
|
||||
hb_gt_Add_keymap( InkeyCode, code );
|
||||
}
|
||||
|
||||
|
||||
@@ -219,11 +219,13 @@ BOOL hb_mouse_IsButtonPressed( int iButton )
|
||||
USHORT uKey;
|
||||
USHORT i;
|
||||
|
||||
uKey = (iButton == 1) ? INKEY_LDOWN : INKEY_RDOWN;
|
||||
uKey = ( iButton == 1 ) ? INKEY_LDOWN : INKEY_RDOWN;
|
||||
i = 0;
|
||||
while( i <= s_last_event )
|
||||
{
|
||||
if( s_event_queue[ i++ ].key & uKey )
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -245,10 +247,10 @@ void hb_mouse_GetBounds( int * piTop, int * piLeft, int * piBottom, int * piRigh
|
||||
{
|
||||
int r, c;
|
||||
|
||||
getmaxyx(stdscr, r, c);
|
||||
getmaxyx( stdscr, r, c );
|
||||
|
||||
*piTop = *piLeft = 0;
|
||||
*piBottom = r;
|
||||
*piRight = c;
|
||||
*piRight = c;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Video subsystem based on Slang screen library.
|
||||
@@ -32,18 +36,18 @@
|
||||
/* NOTE: User programs should never call this layer directly! */
|
||||
|
||||
#ifdef __linux__
|
||||
#include <slang/slang.h>
|
||||
#include <slang/slang.h>
|
||||
#else
|
||||
#include <slang.h>
|
||||
#include <slang.h>
|
||||
#endif
|
||||
/* missing defines in previous versions of Slang - this was not TESTED !! */
|
||||
#if SLANG_VERSION < 10401
|
||||
typedef unsigned short SLsmg_Char_Type;
|
||||
#define SLSMG_EXTRACT_CHAR(x) ((x) & 0xFF)
|
||||
#define SLSMG_EXTRACT_COLOR(x) (((x)>>8)&0xFF)
|
||||
#define SLSMG_BUILD_CHAR(ch,color) (((SLsmg_Char_Type)(unsigned char)(ch))|((color)<<8))
|
||||
#define SLSMG_BOARD_CHAR 'h'
|
||||
#define SLSMG_BLOCK_CHAR '0'
|
||||
typedef unsigned short SLsmg_Char_Type;
|
||||
#define SLSMG_EXTRACT_CHAR( x ) ( ( x ) & 0xFF )
|
||||
#define SLSMG_EXTRACT_COLOR( x ) ( ( ( x ) >> 8 ) & 0xFF )
|
||||
#define SLSMG_BUILD_CHAR( ch, color ) ( ( ( SLsmg_Char_Type ) ( unsigned char )( ch ) ) | ( ( color ) << 8 ) )
|
||||
#define SLSMG_BOARD_CHAR 'h'
|
||||
#define SLSMG_BLOCK_CHAR '0'
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
@@ -52,25 +56,25 @@
|
||||
#include "inkey.ch"
|
||||
|
||||
#ifdef IBMPC_SYSTEM
|
||||
int SLtt_Has_Alt_Charset = 1;
|
||||
char *SLtt_Graphics_Char_Pairs = "";
|
||||
int SLtt_Has_Alt_Charset = 1;
|
||||
char * SLtt_Graphics_Char_Pairs = "";
|
||||
#endif
|
||||
|
||||
extern int hb_gt_Init_Terminal( int phase );
|
||||
static void hb_gt_build_conv_tabs();
|
||||
|
||||
static USHORT uiDispCount;
|
||||
static USHORT s_uiDispCount;
|
||||
/* on Unix systems always assume cursor is visible on startup - look later */
|
||||
static int cursorVisible = 1;
|
||||
static int linuxConsole = 0;
|
||||
static int underXTerm = 0;
|
||||
static int s_cursorVisible = 1;
|
||||
static BOOL s_linuxConsole = FALSE;
|
||||
static BOOL s_underXTerm = FALSE;
|
||||
/* indicate if we are currently running a command from system */
|
||||
static BOOL s_bSuspended = FALSE;
|
||||
|
||||
/* to convert high characters (mostly graphics and control chars) */
|
||||
static unsigned char convHighChars[ 256 ];
|
||||
static unsigned char s_convHighChars[ 256 ];
|
||||
/* to convert colors to Clipper mode */
|
||||
static char *colorNames[] =
|
||||
static char * s_colorNames[] =
|
||||
{
|
||||
"black" ,
|
||||
"blue" ,
|
||||
@@ -90,48 +94,48 @@ static char *colorNames[] =
|
||||
"white"
|
||||
};
|
||||
|
||||
volatile int Screen_Size_Changed = 0;
|
||||
volatile BOOL hb_gt_sln_bScreen_Size_Changed = FALSE;
|
||||
#ifndef IBMPC_SYSTEM
|
||||
/* window resize handler */
|
||||
static void sigwinch_handler (int sig)
|
||||
static void sigwinch_handler( int sig )
|
||||
{
|
||||
Screen_Size_Changed = 1;
|
||||
SLsignal (SIGWINCH, sigwinch_handler);
|
||||
hb_gt_sln_bScreen_Size_Changed = TRUE;
|
||||
SLsignal( SIGWINCH, sigwinch_handler );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* I think this function should not be void. It should be BOOL */
|
||||
void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr )
|
||||
{
|
||||
int gt_Inited = 0;
|
||||
BOOL gt_Inited = FALSE;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Init()"));
|
||||
|
||||
uiDispCount = 0;
|
||||
s_uiDispCount = 0;
|
||||
|
||||
/* read a terminal descripion from a terminfo database */
|
||||
SLtt_get_terminfo ();
|
||||
SLtt_get_terminfo();
|
||||
/* initialize higher-level Slang routines */
|
||||
if ( SLkp_init() != (-1) )
|
||||
if( SLkp_init() != -1 )
|
||||
{
|
||||
/* initialize a terminal stuff and a Slang
|
||||
keyboard subsystem for the first time
|
||||
*/
|
||||
if ( hb_gt_Init_Terminal( 0 ) )
|
||||
if( hb_gt_Init_Terminal( 0 ) )
|
||||
{
|
||||
/* initialize a screen handling subsytem */
|
||||
if ( SLsmg_init_smg () != (-1) )
|
||||
if( SLsmg_init_smg() != -1 )
|
||||
{
|
||||
#ifndef IBMPC_SYSTEM
|
||||
/* install window resize handler */
|
||||
SLsignal (SIGWINCH, sigwinch_handler);
|
||||
SLsignal( SIGWINCH, sigwinch_handler );
|
||||
#endif
|
||||
|
||||
/* do not indicate USER_BREAK in SLang_Error - ??? */
|
||||
SLang_Ignore_User_Abort = 1;
|
||||
|
||||
/* default abort procesing */
|
||||
SLang_set_abort_signal(NULL);
|
||||
SLang_set_abort_signal( NULL );
|
||||
|
||||
/* NOTE: this is incompatible with CLIPPER
|
||||
but under Unix we should assume cursor is
|
||||
@@ -139,18 +143,18 @@ void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr )
|
||||
out a current cursor state
|
||||
*/
|
||||
/* turn on a cursor visibility */
|
||||
if ( SLtt_set_cursor_visibility(1) != (-1) )
|
||||
if( SLtt_set_cursor_visibility( 1 ) != -1 )
|
||||
{
|
||||
hb_gt_SetCursorStyle( 1 );
|
||||
cursorVisible = 1;
|
||||
s_cursorVisible = 1;
|
||||
}
|
||||
else
|
||||
cursorVisible = -1;
|
||||
s_cursorVisible = -1;
|
||||
|
||||
/* an uncertain way to check if we run under linux console */
|
||||
linuxConsole = ( !strncmp ( getenv("TERM"), "linux", 5 ) );
|
||||
s_linuxConsole = ( strncmp( getenv("TERM"), "linux", 5 ) == 0 );
|
||||
/* an uncertain way to check if we run under xterm */
|
||||
underXTerm = ( strstr( getenv("TERM"), "xterm" ) != NULL );
|
||||
s_underXTerm = ( strstr( getenv("TERM"), "xterm" ) != NULL );
|
||||
|
||||
/* NOTE: this driver is implemented in a way that it is
|
||||
imposible to get intensity/blinking background mode
|
||||
@@ -176,12 +180,12 @@ void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr )
|
||||
#endif
|
||||
SLtt_cls();
|
||||
SLsmg_set_color( 7 );
|
||||
gt_Inited = 1;
|
||||
gt_Inited = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !gt_Inited )
|
||||
if( ! gt_Inited )
|
||||
{
|
||||
/* something went wrong - restore default settings */
|
||||
SLang_reset_tty();
|
||||
@@ -198,11 +202,11 @@ void hb_gt_Exit( void )
|
||||
NOTE: This is incompatible with Clipper
|
||||
- on exit leave a cursor visible
|
||||
|
||||
if ( cursorVisible != (-1) )
|
||||
hb_gt_SetCursorStyle( 1 );
|
||||
if( s_cursorVisible != -1 )
|
||||
hb_gt_SetCursorStyle( 1 );
|
||||
*/
|
||||
SLsmg_refresh();
|
||||
SLsmg_reset_smg ();
|
||||
SLsmg_reset_smg();
|
||||
SLang_reset_tty();
|
||||
}
|
||||
|
||||
@@ -306,19 +310,19 @@ USHORT hb_gt_GetCursorStyle( void )
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetCursorStyle()"));
|
||||
|
||||
if( cursorVisible == 0 )
|
||||
if( s_cursorVisible == 0 )
|
||||
uiStyle = SC_NONE;
|
||||
|
||||
else if( cursorVisible == 1 )
|
||||
else if( s_cursorVisible == 1 )
|
||||
uiStyle = SC_NORMAL;
|
||||
|
||||
else if( cursorVisible == 2 )
|
||||
else if( s_cursorVisible == 2 )
|
||||
uiStyle = SC_INSERT;
|
||||
|
||||
else if( cursorVisible == 3 )
|
||||
else if( s_cursorVisible == 3 )
|
||||
uiStyle = SC_SPECIAL1;
|
||||
|
||||
else if( cursorVisible == 4 )
|
||||
else if( s_cursorVisible == 4 )
|
||||
uiStyle = SC_SPECIAL2;
|
||||
|
||||
else
|
||||
@@ -340,52 +344,52 @@ void hb_gt_SetCursorStyle( USHORT uiStyle )
|
||||
switch( uiStyle )
|
||||
{
|
||||
case SC_NONE:
|
||||
if ( cursorVisible != (-1) )
|
||||
if( s_cursorVisible != -1 )
|
||||
{
|
||||
SLtt_set_cursor_visibility(0);
|
||||
cursorVisible = 0;
|
||||
if ( linuxConsole )
|
||||
SLtt_set_cursor_visibility( 0 );
|
||||
s_cursorVisible = 0;
|
||||
if( s_linuxConsole )
|
||||
{
|
||||
cursDefseq[3] = '1';
|
||||
cursDefseq[ 3 ] = '1';
|
||||
SLtt_write_string( cursDefseq );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SC_NORMAL:
|
||||
if ( cursorVisible != (-1) )
|
||||
if( s_cursorVisible != -1 )
|
||||
{
|
||||
SLtt_set_cursor_visibility(1);
|
||||
cursorVisible = 1;
|
||||
if ( linuxConsole )
|
||||
SLtt_set_cursor_visibility( 1 );
|
||||
s_cursorVisible = 1;
|
||||
if( s_linuxConsole )
|
||||
{
|
||||
cursDefseq[3] = '2';
|
||||
cursDefseq[ 3 ] = '2';
|
||||
SLtt_write_string( cursDefseq );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SC_INSERT:
|
||||
if ( cursorVisible != (-1) )
|
||||
if( s_cursorVisible != -1 )
|
||||
{
|
||||
SLtt_set_cursor_visibility(1);
|
||||
cursorVisible = 2;
|
||||
if ( linuxConsole )
|
||||
SLtt_set_cursor_visibility( 1 );
|
||||
s_cursorVisible = 2;
|
||||
if( s_linuxConsole )
|
||||
{
|
||||
cursDefseq[3] = '4';
|
||||
cursDefseq[ 3 ] = '4';
|
||||
SLtt_write_string( cursDefseq );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SC_SPECIAL1:
|
||||
if ( cursorVisible != (-1) )
|
||||
if( s_cursorVisible != -1 )
|
||||
{
|
||||
SLtt_set_cursor_visibility(1);
|
||||
cursorVisible = 3;
|
||||
if ( linuxConsole )
|
||||
SLtt_set_cursor_visibility( 1 );
|
||||
s_cursorVisible = 3;
|
||||
if( s_linuxConsole )
|
||||
{
|
||||
cursDefseq[3] = '8';
|
||||
cursDefseq[ 3 ] = '8';
|
||||
SLtt_write_string( cursDefseq );
|
||||
}
|
||||
}
|
||||
@@ -406,13 +410,13 @@ static void hb_gt_xPutch( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE byChar )
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_xPutch(%hu, %hu, %d, %i)", uiRow, uiCol, (int) byAttr, byChar));
|
||||
|
||||
/* build Slang converted char - note we are clearing a high bit of color */
|
||||
SLchar = SLSMG_BUILD_CHAR( convHighChars[ byChar ], byAttr & 0x7F );
|
||||
SLchar = SLSMG_BUILD_CHAR( s_convHighChars[ byChar ], byAttr & 0x7F );
|
||||
|
||||
/* alternate char set */
|
||||
if ( byChar > 127 )
|
||||
if( byChar > 127 )
|
||||
SLchar |= 0x8000;
|
||||
|
||||
SLsmg_gotorc(uiRow, uiCol);
|
||||
SLsmg_gotorc( uiRow, uiCol );
|
||||
SLsmg_write_raw( &SLchar, 1 );
|
||||
}
|
||||
|
||||
@@ -420,35 +424,35 @@ void hb_gt_Puts( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE * pbyStr, ULONG u
|
||||
{
|
||||
ULONG i;
|
||||
BYTE byChar;
|
||||
SLsmg_Char_Type SLchar, *pScr;
|
||||
SLsmg_Char_Type SLchar, * pScr;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Puts(%hu, %hu, %d, %p, %lu)", uiRow, uiCol, (int) byAttr, pbyStr, ulLen));
|
||||
|
||||
pScr = (SLsmg_Char_Type *)hb_xgrab( (ulLen+1) * sizeof( SLsmg_Char_Type ) );
|
||||
pScr = ( SLsmg_Char_Type * ) hb_xgrab( ( ulLen + 1 ) * sizeof( SLsmg_Char_Type ) );
|
||||
|
||||
for ( i=0; i<ulLen; i++ )
|
||||
for( i = 0; i < ulLen; i++ )
|
||||
{
|
||||
/* next char to process */
|
||||
byChar = *pbyStr++;
|
||||
|
||||
/* build Slang converted char - note we are clearing a high bit of color */
|
||||
SLchar = SLSMG_BUILD_CHAR( convHighChars[ byChar ], byAttr & 0x7F );
|
||||
SLchar = SLSMG_BUILD_CHAR( s_convHighChars[ byChar ], byAttr & 0x7F );
|
||||
|
||||
/* alternate char set */
|
||||
if ( byChar > 127 )
|
||||
if( byChar > 127 )
|
||||
SLchar |= 0x8000;
|
||||
|
||||
*(pScr+i) = SLchar;
|
||||
*( pScr + i ) = SLchar;
|
||||
}
|
||||
|
||||
SLsmg_gotorc(uiRow, uiCol);
|
||||
|
||||
if ( ulLen > 0 )
|
||||
if( ulLen > 0 )
|
||||
SLsmg_write_raw( pScr, ulLen );
|
||||
|
||||
hb_xfree( ( BYTE * )pScr );
|
||||
|
||||
if( uiDispCount == 0 )
|
||||
if( s_uiDispCount == 0 )
|
||||
SLsmg_refresh();
|
||||
}
|
||||
|
||||
@@ -460,7 +464,7 @@ int hb_gt_RectSize( USHORT rows, USHORT cols )
|
||||
void hb_gt_GetText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyDst )
|
||||
{
|
||||
int Cols;
|
||||
SLsmg_Char_Type *pBuf = (SLsmg_Char_Type *)pbyDst;
|
||||
SLsmg_Char_Type * pBuf = ( SLsmg_Char_Type * ) pbyDst;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetText(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbyDst));
|
||||
|
||||
@@ -477,7 +481,7 @@ void hb_gt_GetText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight
|
||||
void hb_gt_PutText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbySrc )
|
||||
{
|
||||
int Cols;
|
||||
SLsmg_Char_Type *pBuf = (SLsmg_Char_Type *)pbySrc;
|
||||
SLsmg_Char_Type * pBuf = ( SLsmg_Char_Type * ) pbySrc;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_PutText(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbySrc));
|
||||
|
||||
@@ -486,11 +490,11 @@ void hb_gt_PutText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight
|
||||
{
|
||||
SLsmg_gotorc( uiTop, uiLeft );
|
||||
SLsmg_write_raw( pBuf, Cols );
|
||||
pBuf +=Cols;
|
||||
pBuf += Cols;
|
||||
++uiTop;
|
||||
}
|
||||
|
||||
if( uiDispCount == 0 )
|
||||
if( s_uiDispCount == 0 )
|
||||
SLsmg_refresh();
|
||||
}
|
||||
|
||||
@@ -506,7 +510,7 @@ void hb_gt_SetAttribute( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT ui
|
||||
/* note we are clearing a high bit of color */
|
||||
SLsmg_set_color_in_region( byAttr & 0x7F, uiTop, uiLeft, Rows, Cols );
|
||||
|
||||
if( uiDispCount == 0 )
|
||||
if( s_uiDispCount == 0 )
|
||||
SLsmg_refresh();
|
||||
}
|
||||
|
||||
@@ -570,7 +574,7 @@ void hb_gt_Scroll( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight,
|
||||
|
||||
hb_gtSetPos( usSaveRow, usSaveCol );
|
||||
|
||||
if( uiDispCount == 0 )
|
||||
if( s_uiDispCount == 0 )
|
||||
SLsmg_refresh();
|
||||
}
|
||||
}
|
||||
@@ -579,14 +583,14 @@ void hb_gt_DispBegin( void )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_DispBegin()"));
|
||||
|
||||
++uiDispCount;
|
||||
++s_uiDispCount;
|
||||
}
|
||||
|
||||
void hb_gt_DispEnd()
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_DispEnd()"));
|
||||
|
||||
if ( --uiDispCount == 0)
|
||||
if( --s_uiDispCount == 0 )
|
||||
SLsmg_refresh();
|
||||
}
|
||||
|
||||
@@ -636,38 +640,38 @@ char * hb_gt_Version( void )
|
||||
|
||||
USHORT hb_gt_DispCount()
|
||||
{
|
||||
return uiDispCount;
|
||||
return s_uiDispCount;
|
||||
}
|
||||
|
||||
void hb_gt_Replicate( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE byChar, ULONG ulLen )
|
||||
{
|
||||
ULONG i;
|
||||
SLsmg_Char_Type SLchar, *pScr;
|
||||
SLsmg_Char_Type SLchar, * pScr;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Replicate(%hu, %hu, %i, %i, %lu)", uiRow, uiCol, byAttr, byChar, nLength));
|
||||
|
||||
pScr = (SLsmg_Char_Type *)hb_xgrab( (ulLen+1) * sizeof( SLsmg_Char_Type ) );
|
||||
pScr = ( SLsmg_Char_Type * ) hb_xgrab( ( ulLen + 1 ) * sizeof( SLsmg_Char_Type ) );
|
||||
|
||||
for ( i=0; i<ulLen; i++ )
|
||||
for( i=0; i<ulLen; i++ )
|
||||
{
|
||||
/* build Slang converted char - note we are clearing a high bit of color */
|
||||
SLchar = SLSMG_BUILD_CHAR( convHighChars[ byChar ], byAttr & 0x7F );
|
||||
SLchar = SLSMG_BUILD_CHAR( s_convHighChars[ byChar ], byAttr & 0x7F );
|
||||
|
||||
/* alternate char set */
|
||||
if ( byChar > 127 )
|
||||
if( byChar > 127 )
|
||||
SLchar |= 0x8000;
|
||||
|
||||
*(pScr+i) = SLchar;
|
||||
*( pScr + i ) = SLchar;
|
||||
}
|
||||
|
||||
SLsmg_gotorc(uiRow, uiCol);
|
||||
SLsmg_gotorc( uiRow, uiCol );
|
||||
|
||||
if ( ulLen > 0 )
|
||||
if( ulLen > 0 )
|
||||
SLsmg_write_raw( pScr, ulLen );
|
||||
|
||||
hb_xfree( (BYTE *)pScr );
|
||||
hb_xfree( ( BYTE * ) pScr );
|
||||
|
||||
if( uiDispCount == 0 )
|
||||
if( s_uiDispCount == 0 )
|
||||
SLsmg_refresh();
|
||||
}
|
||||
|
||||
@@ -837,61 +841,60 @@ static void hb_gt_build_conv_tabs()
|
||||
some problems.
|
||||
*/
|
||||
/* init colors */
|
||||
for( i=0; i<256; i++ )
|
||||
for( i = 0; i < 256; i++ )
|
||||
{
|
||||
fg = ( i & 0x0F );
|
||||
bg = ( i >> 4 ) & 0x07; /* bit 7 is a blinking attribute - not used here */
|
||||
fg = ( i & 0x0F );
|
||||
bg = ( i >> 4 ) & 0x07; /* bit 7 is a blinking attribute - not used here */
|
||||
|
||||
SLtt_set_color ( i, (char *)NULL, colorNames[fg], colorNames[bg] );
|
||||
SLtt_set_color( i, ( char * ) NULL, s_colorNames[ fg ], s_colorNames[ bg ] );
|
||||
}
|
||||
|
||||
|
||||
/* build alternate chars table */
|
||||
for ( i=0; i<32; i++ )
|
||||
for( i = 0; i < 32; i++ )
|
||||
/* under Unix control-chars are not visible in a general meaning */
|
||||
convHighChars[ i ] = '.';
|
||||
for ( i=32; i<256; i++ )
|
||||
convHighChars[ i ] = i;
|
||||
|
||||
s_convHighChars[ i ] = '.';
|
||||
for( i = 32; i < 256; i++ )
|
||||
s_convHighChars[ i ] = i;
|
||||
|
||||
#ifndef IBMPC_SYSTEM
|
||||
/* init an alternate chars table */
|
||||
if ( ( p = SLtt_Graphics_Char_Pairs ) )
|
||||
if( ( p = SLtt_Graphics_Char_Pairs ) )
|
||||
{
|
||||
len = strlen( p );
|
||||
for ( i=0; i<len; i++ )
|
||||
for( i = 0; i < len; i++ )
|
||||
{
|
||||
ch = *p++;
|
||||
ch &= 0x7F;
|
||||
|
||||
switch ( ch )
|
||||
switch( ch )
|
||||
{
|
||||
case SLSMG_HLINE_CHAR : convHighChars[ 196 ] = *p; break;
|
||||
case SLSMG_VLINE_CHAR : convHighChars[ 179 ] = *p; break;
|
||||
case SLSMG_ULCORN_CHAR : convHighChars[ 218 ] = *p; break;
|
||||
case SLSMG_URCORN_CHAR : convHighChars[ 191 ] = *p; break;
|
||||
case SLSMG_LLCORN_CHAR : convHighChars[ 192 ] = *p; break;
|
||||
case SLSMG_LRCORN_CHAR : convHighChars[ 217 ] = *p; break;
|
||||
case SLSMG_CKBRD_CHAR : convHighChars[ 176 ] = *p; break;
|
||||
case SLSMG_RTEE_CHAR : convHighChars[ 180 ] = *p; break;
|
||||
case SLSMG_LTEE_CHAR : convHighChars[ 195 ] = *p; break;
|
||||
case SLSMG_UTEE_CHAR : convHighChars[ 194 ] = *p; break;
|
||||
case SLSMG_DTEE_CHAR : convHighChars[ 193 ] = *p; break;
|
||||
case SLSMG_PLUS_CHAR : convHighChars[ 197 ] = *p; break;
|
||||
case SLSMG_HLINE_CHAR : s_convHighChars[ 196 ] = *p; break;
|
||||
case SLSMG_VLINE_CHAR : s_convHighChars[ 179 ] = *p; break;
|
||||
case SLSMG_ULCORN_CHAR : s_convHighChars[ 218 ] = *p; break;
|
||||
case SLSMG_URCORN_CHAR : s_convHighChars[ 191 ] = *p; break;
|
||||
case SLSMG_LLCORN_CHAR : s_convHighChars[ 192 ] = *p; break;
|
||||
case SLSMG_LRCORN_CHAR : s_convHighChars[ 217 ] = *p; break;
|
||||
case SLSMG_CKBRD_CHAR : s_convHighChars[ 176 ] = *p; break;
|
||||
case SLSMG_RTEE_CHAR : s_convHighChars[ 180 ] = *p; break;
|
||||
case SLSMG_LTEE_CHAR : s_convHighChars[ 195 ] = *p; break;
|
||||
case SLSMG_UTEE_CHAR : s_convHighChars[ 194 ] = *p; break;
|
||||
case SLSMG_DTEE_CHAR : s_convHighChars[ 193 ] = *p; break;
|
||||
case SLSMG_PLUS_CHAR : s_convHighChars[ 197 ] = *p; break;
|
||||
|
||||
/* TODO: need some smart here */
|
||||
/*
|
||||
case SLSMG_DIAMOND_CHAR : convHighChars[ ] = *p; break;
|
||||
case SLSMG_DEGREE_CHAR; : convHighChars[ ] = *p; break;
|
||||
case SLSMG_PLMINUS_CHAR : convHighChars[ ] = *p; break;
|
||||
case SLSMG_BULLET_CHAR : convHighChars[ ] = *p; break;
|
||||
case SLSMG_LARROW_CHAR : convHighChars[ ] = *p; break;
|
||||
case SLSMG_RARROW_CHAR : convHighChars[ ] = *p; break;
|
||||
case SLSMG_DARROW_CHAR : convHighChars[ ] = *p; break;
|
||||
case SLSMG_UARROW_CHAR : convHighChars[ ] = *p; break;
|
||||
case SLSMG_DIAMOND_CHAR : s_convHighChars[ ] = *p; break;
|
||||
case SLSMG_DEGREE_CHAR; : s_convHighChars[ ] = *p; break;
|
||||
case SLSMG_PLMINUS_CHAR : s_convHighChars[ ] = *p; break;
|
||||
case SLSMG_BULLET_CHAR : s_convHighChars[ ] = *p; break;
|
||||
case SLSMG_LARROW_CHAR : s_convHighChars[ ] = *p; break;
|
||||
case SLSMG_RARROW_CHAR : s_convHighChars[ ] = *p; break;
|
||||
case SLSMG_DARROW_CHAR : s_convHighChars[ ] = *p; break;
|
||||
case SLSMG_UARROW_CHAR : s_convHighChars[ ] = *p; break;
|
||||
*/
|
||||
case SLSMG_BOARD_CHAR : convHighChars[ 178 ] = *p; break;
|
||||
case SLSMG_BLOCK_CHAR : convHighChars[ 219 ] = *p; break;
|
||||
case SLSMG_BOARD_CHAR : s_convHighChars[ 178 ] = *p; break;
|
||||
case SLSMG_BLOCK_CHAR : s_convHighChars[ 219 ] = *p; break;
|
||||
}
|
||||
|
||||
p++;
|
||||
@@ -899,30 +902,28 @@ static void hb_gt_build_conv_tabs()
|
||||
}
|
||||
|
||||
/* QUESTION: do we have dobule, single-double, ... frames under xterm ? */
|
||||
if ( underXTerm )
|
||||
if( s_underXTerm )
|
||||
{
|
||||
/* frames of all Clipper type are _B_SINBLE under xterm */
|
||||
convHighChars[ 205 ] = convHighChars[ 196 ];
|
||||
convHighChars[ 186 ] = convHighChars[ 179 ];
|
||||
convHighChars[ 201 ] = convHighChars[ 218 ];
|
||||
convHighChars[ 214 ] = convHighChars[ 218 ];
|
||||
convHighChars[ 213 ] = convHighChars[ 218 ];
|
||||
convHighChars[ 187 ] = convHighChars[ 191 ];
|
||||
convHighChars[ 183 ] = convHighChars[ 191 ];
|
||||
convHighChars[ 184 ] = convHighChars[ 191 ];
|
||||
convHighChars[ 200 ] = convHighChars[ 192 ];
|
||||
convHighChars[ 211 ] = convHighChars[ 192 ];
|
||||
convHighChars[ 212 ] = convHighChars[ 192 ];
|
||||
convHighChars[ 188 ] = convHighChars[ 217 ];
|
||||
convHighChars[ 189 ] = convHighChars[ 217 ];
|
||||
convHighChars[ 190 ] = convHighChars[ 217 ];
|
||||
convHighChars[ 185 ] = convHighChars[ 118 ];
|
||||
convHighChars[ 204 ] = convHighChars[ 195 ];
|
||||
convHighChars[ 203 ] = convHighChars[ 194 ];
|
||||
convHighChars[ 202 ] = convHighChars[ 193 ];
|
||||
convHighChars[ 206 ] = convHighChars[ 197 ];
|
||||
s_convHighChars[ 205 ] = s_convHighChars[ 196 ];
|
||||
s_convHighChars[ 186 ] = s_convHighChars[ 179 ];
|
||||
s_convHighChars[ 201 ] = s_convHighChars[ 218 ];
|
||||
s_convHighChars[ 214 ] = s_convHighChars[ 218 ];
|
||||
s_convHighChars[ 213 ] = s_convHighChars[ 218 ];
|
||||
s_convHighChars[ 187 ] = s_convHighChars[ 191 ];
|
||||
s_convHighChars[ 183 ] = s_convHighChars[ 191 ];
|
||||
s_convHighChars[ 184 ] = s_convHighChars[ 191 ];
|
||||
s_convHighChars[ 200 ] = s_convHighChars[ 192 ];
|
||||
s_convHighChars[ 211 ] = s_convHighChars[ 192 ];
|
||||
s_convHighChars[ 212 ] = s_convHighChars[ 192 ];
|
||||
s_convHighChars[ 188 ] = s_convHighChars[ 217 ];
|
||||
s_convHighChars[ 189 ] = s_convHighChars[ 217 ];
|
||||
s_convHighChars[ 190 ] = s_convHighChars[ 217 ];
|
||||
s_convHighChars[ 185 ] = s_convHighChars[ 118 ];
|
||||
s_convHighChars[ 204 ] = s_convHighChars[ 195 ];
|
||||
s_convHighChars[ 203 ] = s_convHighChars[ 194 ];
|
||||
s_convHighChars[ 202 ] = s_convHighChars[ 193 ];
|
||||
s_convHighChars[ 206 ] = s_convHighChars[ 197 ];
|
||||
}
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Video subsystem based on Slang screen library.
|
||||
@@ -33,20 +37,20 @@
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
# include <slang/slang.h>
|
||||
#include <slang/slang.h>
|
||||
#else
|
||||
# include <slang.h>
|
||||
#include <slang.h>
|
||||
#endif
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifdef M_UNIX
|
||||
# include <sys/termio.h>
|
||||
# include <sys/vtkd.h>
|
||||
#include <sys/termio.h>
|
||||
#include <sys/vtkd.h>
|
||||
#endif
|
||||
|
||||
#ifndef IBMPC_SYSTEM
|
||||
# include <termios.h> /* we're assuming target has termios - should be better done */
|
||||
#include <termios.h> /* we're assuming target has termios - should be better done */
|
||||
#endif
|
||||
|
||||
#include "hbapigt.h"
|
||||
@@ -56,9 +60,9 @@
|
||||
|
||||
/* abort key is Ctrl+C on Unix (arbitrary chosen), on Dos it works as Alt+C (strange !) */
|
||||
#ifdef OS_UNIX_COMPATIBLE
|
||||
# define CTRL_C 3
|
||||
#define CTRL_C 3
|
||||
#else
|
||||
# define CTRL_C 46
|
||||
#define CTRL_C 46
|
||||
#endif
|
||||
#define HB_GT_ABORT_KEY CTRL_C
|
||||
|
||||
@@ -68,24 +72,24 @@
|
||||
/* keyboard states - these should be taken
|
||||
from system includes, not be hard coded
|
||||
*/
|
||||
#if defined(__linux__)
|
||||
# define SHIFT_PRESSED 1
|
||||
# define ALTR_PRESSED 2
|
||||
# define CONTROL_PRESSED 4
|
||||
# define ALTL_PRESSED 8
|
||||
# define ALT_PRESSED (ALTL_PRESSED || ALTR_PRESSED)
|
||||
#ifdefined(__linux__)
|
||||
#define SHIFT_PRESSED 1
|
||||
#define ALTR_PRESSED 2
|
||||
#define CONTROL_PRESSED 4
|
||||
#define ALTL_PRESSED 8
|
||||
#define ALT_PRESSED (ALTL_PRESSED || ALTR_PRESSED)
|
||||
#elif defined(M_UNIX) /* SCO */
|
||||
# define SHIFT_PRESSED 1
|
||||
# define ALTR_PRESSED 8
|
||||
# define CONTROL_PRESSED 2
|
||||
# define ALTL_PRESSED 4
|
||||
# define ALT_PRESSED (ALTL_PRESSED || ALTR_PRESSED)
|
||||
#define SHIFT_PRESSED 1
|
||||
#define ALTR_PRESSED 8
|
||||
#define CONTROL_PRESSED 2
|
||||
#define ALTL_PRESSED 4
|
||||
#define ALT_PRESSED (ALTL_PRESSED || ALTR_PRESSED)
|
||||
#else /* we don't know how to do this */
|
||||
# define SHIFT_PRESSED 0
|
||||
# define ALTR_PRESSED 0
|
||||
# define CONTROL_PRESSED 0
|
||||
# define ALTL_PRESSED 0
|
||||
# define ALT_PRESSED (ALTL_PRESSED || ALTR_PRESSED)
|
||||
#define SHIFT_PRESSED 0
|
||||
#define ALTR_PRESSED 0
|
||||
#define CONTROL_PRESSED 0
|
||||
#define ALTL_PRESSED 0
|
||||
#define ALT_PRESSED (ALTL_PRESSED || ALTR_PRESSED)
|
||||
#endif
|
||||
|
||||
/* extra keysyms definitions */
|
||||
@@ -94,10 +98,10 @@
|
||||
#define SL_KEY_ALT_L( ch ) ( SL_KEY_MAX + ( ( unsigned int )ch ) )
|
||||
|
||||
/* indicates that screen size has changed */
|
||||
extern int Screen_Size_Changed;
|
||||
extern BOOL hb_gt_sln_bScreen_Size_Changed;
|
||||
|
||||
static int linuxConsole = 0;
|
||||
static int underXTerm = 0;
|
||||
static BOOL s_linuxConsole = FALSE;
|
||||
static BOOL s_underXTerm = FALSE;
|
||||
|
||||
int hb_gt_Kbd_State();
|
||||
|
||||
@@ -116,38 +120,38 @@ static void hb_gt_Init_KeyTranslat()
|
||||
keyname[ 3 ] = 0;
|
||||
|
||||
/* define Shft/Ctrl/Alt+Fn on DOS - these are hard coded in Slang */
|
||||
for ( ch = 0x54; ch <= 0x71; ch++ )
|
||||
for( ch = 0x54; ch <= 0x71; ch++ )
|
||||
{
|
||||
keyname[ 2 ] = ch;
|
||||
SLkp_define_keysym( keyname, SL_KEY_F(keynum) );
|
||||
keynum++;
|
||||
keyname[ 2 ] = ch;
|
||||
SLkp_define_keysym( keyname, SL_KEY_F(keynum) );
|
||||
keynum++;
|
||||
}
|
||||
|
||||
/* define Alt+Key on DOS - these are hard coded in Slang */
|
||||
i = 0;
|
||||
while ( i < sizeof( transDosScanCodeTab ) )
|
||||
while( i < sizeof( transDosScanCodeTab ) )
|
||||
{
|
||||
i++;
|
||||
if ( transDosScanCodeTab[i] < 32 )
|
||||
{
|
||||
keyname[ 2 ] = '^';
|
||||
keyname[ 3 ] = transDosScanCodeTab[i]+'A'-1;
|
||||
keyname[ 4 ] = 0;
|
||||
}
|
||||
i++;
|
||||
if( transDosScanCodeTab[i] < 32 )
|
||||
{
|
||||
keyname[ 2 ] = '^';
|
||||
keyname[ 3 ] = transDosScanCodeTab[i]+'A'-1;
|
||||
keyname[ 4 ] = 0;
|
||||
}
|
||||
/*
|
||||
else if ( transDosScanCodeTab[i] >= 127 )
|
||||
{
|
||||
sprintf( &keyname[ 2 ], "\\x%02X", transDosScanCodeTab[i] );
|
||||
keyname[ 6 ] = 0;
|
||||
}
|
||||
else if( transDosScanCodeTab[i] >= 127 )
|
||||
{
|
||||
sprintf( &keyname[ 2 ], "\\x%02X", transDosScanCodeTab[i] );
|
||||
keyname[ 6 ] = 0;
|
||||
}
|
||||
*/
|
||||
else
|
||||
{
|
||||
keyname[ 2 ] = transDosScanCodeTab[i];
|
||||
keyname[ 3 ] = 0;
|
||||
}
|
||||
SLkp_define_keysym( keyname, SL_KEY_ALT_L( transDosScanCodeTab[i-1] ) );
|
||||
i++;
|
||||
else
|
||||
{
|
||||
keyname[ 2 ] = transDosScanCodeTab[i];
|
||||
keyname[ 3 ] = 0;
|
||||
}
|
||||
SLkp_define_keysym( keyname, SL_KEY_ALT_L( transDosScanCodeTab[i-1] ) );
|
||||
i++;
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -171,21 +175,23 @@ static void hb_gt_Init_KeyTranslat()
|
||||
/* Shft & Ctrl FKeys definition takes place in two
|
||||
phases : from '1' to '9' and from 'A' to 'K'
|
||||
*/
|
||||
for ( i=1; i<=2; i++ )
|
||||
for ( ch = ( i==1 ? '1' : 'A' ); ch <= ( i==1 ? '9' : 'K' ); ch++ )
|
||||
for( i=1; i<=2; i++ )
|
||||
{
|
||||
for( ch = ( i==1 ? '1' : 'A' ); ch <= ( i==1 ? '9' : 'K' ); ch++ )
|
||||
{
|
||||
keyname[ 1 ] = ch;
|
||||
keyseq = SLtt_tgetstr( keyname );
|
||||
if ( (keyseq != NULL) && (keyseq[0] != 0) )
|
||||
if( (keyseq != NULL) && (keyseq[0] != 0) )
|
||||
{
|
||||
if ( (keyseq != NULL) && (keyseq[0] != 0) )
|
||||
if( (keyseq != NULL) && (keyseq[0] != 0) )
|
||||
SLkp_define_keysym( keyseq, SL_KEY_F(keynum) );
|
||||
}
|
||||
keynum++;
|
||||
}
|
||||
}
|
||||
|
||||
/* if we are on linux console pressing Alt generates ^[ before sequence */
|
||||
if ( linuxConsole || underXTerm )
|
||||
if( s_linuxConsole || s_underXTerm )
|
||||
{
|
||||
keyname[ 0 ] = 033;
|
||||
keyname[ 2 ] = 0;
|
||||
@@ -193,19 +199,21 @@ static void hb_gt_Init_KeyTranslat()
|
||||
/* Alt+Letter & Alt+digit definition takes place in
|
||||
two phases : from '0' to '9' and from 'A' to 'Z'
|
||||
*/
|
||||
for ( i=1; i<=2; i++ )
|
||||
for ( ch = ( i==1 ? '0' : 'A' ); ch <= ( i==1 ? '9' : 'Z' ); ch++ )
|
||||
for( i=1; i<=2; i++ )
|
||||
{
|
||||
for( ch = ( i==1 ? '0' : 'A' ); ch <= ( i==1 ? '9' : 'Z' ); ch++ )
|
||||
{
|
||||
keyname[ 1 ] = ch;
|
||||
/* QUESTION: why Slang reports error for defining Alt+O ???.
|
||||
Have I any error in key definitiions ???
|
||||
*/
|
||||
if ( ch != 'O' )
|
||||
if( ch != 'O' )
|
||||
SLkp_define_keysym( keyname, SL_KEY_ALT_L( ch ) );
|
||||
|
||||
keyname[ 1 ] = (ch+' ');
|
||||
SLkp_define_keysym( keyname, SL_KEY_ALT_L( ch+' ' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -218,17 +226,17 @@ int hb_gt_Init_Terminal(int phase)
|
||||
int ret = 0;
|
||||
|
||||
/* Ctrl-C to abort, no flow-control, no output processing */
|
||||
if ( SLang_init_tty(HB_GT_ABORT_KEY, 0, 0) != (-1) )
|
||||
if( SLang_init_tty(HB_GT_ABORT_KEY, 0, 0) != (-1) )
|
||||
{
|
||||
#ifndef IBMPC_SYSTEM
|
||||
/* do missing disable of start/stop processing */
|
||||
if ( tcgetattr( SLang_TT_Read_FD, &newTTY ) == 0 )
|
||||
if( tcgetattr( SLang_TT_Read_FD, &newTTY ) == 0 )
|
||||
{
|
||||
newTTY.c_cc[VSTOP] = 255; /* disable ^S start/stop processing */
|
||||
newTTY.c_cc[VSTART] = 255; /* disable ^Q start/stop processing */
|
||||
newTTY.c_cc[VSUSP] = 255; /* disable ^Z suspend processing */
|
||||
|
||||
if ( tcsetattr( SLang_TT_Read_FD, TCSADRAIN, &newTTY ) == 0 )
|
||||
if( tcsetattr( SLang_TT_Read_FD, TCSADRAIN, &newTTY ) == 0 )
|
||||
/* everything looks ok so far */
|
||||
#endif
|
||||
ret = 1;
|
||||
@@ -240,18 +248,18 @@ int hb_gt_Init_Terminal(int phase)
|
||||
/* first time init phase - we don't want this
|
||||
after return from system command ( see run.c )
|
||||
*/
|
||||
if ( ret && (phase == 0) )
|
||||
if( ret && (phase == 0) )
|
||||
{
|
||||
/* an uncertain way to check if we run under linux console */
|
||||
linuxConsole = ( !strncmp ( getenv("TERM"), "linux", 5 ) );
|
||||
s_linuxConsole = ( !strncmp ( getenv("TERM"), "linux", 5 ) );
|
||||
/* an uncertain way to check if we run under xterm */
|
||||
underXTerm = ( strstr( getenv("TERM"), "xterm" ) != NULL );
|
||||
s_underXTerm = ( strstr( getenv("TERM"), "xterm" ) != NULL );
|
||||
|
||||
/* define keyboard translations */
|
||||
hb_gt_Init_KeyTranslat();
|
||||
}
|
||||
|
||||
return ( ret );
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef DO_LOCAL_DEBUG
|
||||
@@ -268,22 +276,22 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask )
|
||||
HB_SYMBOL_UNUSED( eventmask );
|
||||
|
||||
/* user AbortKey break */
|
||||
if ( SLKeyBoard_Quit == 1 )
|
||||
if( SLKeyBoard_Quit == 1 )
|
||||
return HB_BREAK_FLAG;
|
||||
|
||||
/* has screen size changed ? */
|
||||
if (Screen_Size_Changed)
|
||||
if( hb_gt_sln_bScreen_Size_Changed )
|
||||
{
|
||||
Screen_Size_Changed = 0;
|
||||
hb_gt_sln_bScreen_Size_Changed = FALSE;
|
||||
SLtt_get_screen_size();
|
||||
#if SLANG_VERSION > 10202
|
||||
SLsmg_reinit_smg();
|
||||
#endif
|
||||
/* TODO: we need here some kind of screen redrawing */
|
||||
//SLsmg_refresh ();
|
||||
/*SLsmg_refresh ();*/
|
||||
}
|
||||
|
||||
if ( SLang_input_pending( 0 ) > 0 )
|
||||
if( SLang_input_pending( 0 ) > 0 )
|
||||
{
|
||||
kbdflags = hb_gt_Kbd_State();
|
||||
|
||||
@@ -294,10 +302,10 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask )
|
||||
*/
|
||||
ch = SLang_getkey ();
|
||||
|
||||
if (ch == 033) /* escape */
|
||||
if( ch == 033 ) /* escape */
|
||||
{
|
||||
if (0 == SLang_input_pending (ESC_TIMEOUT))
|
||||
return 033;
|
||||
if( 0 == SLang_input_pending (ESC_TIMEOUT) )
|
||||
return 033;
|
||||
}
|
||||
|
||||
SLang_ungetkey (ch);
|
||||
@@ -306,7 +314,7 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask )
|
||||
|
||||
ch = SLkp_getkey();
|
||||
|
||||
if ( ch != SL_KEY_ERR )
|
||||
if( ch != SL_KEY_ERR )
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -318,124 +326,125 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask )
|
||||
#endif
|
||||
|
||||
/* user AbortKey break */
|
||||
if ( ch == HB_GT_ABORT_KEY )
|
||||
return ( HB_BREAK_FLAG );
|
||||
if( ch == HB_GT_ABORT_KEY )
|
||||
return HB_BREAK_FLAG;
|
||||
|
||||
if ( ch < 32 ) /* control characters - simply return */
|
||||
return ( ch );
|
||||
if( ch < 32 ) /* control characters - simply return */
|
||||
return ch;
|
||||
|
||||
else if ( ( ch >= 32 ) && ( ch < 256 ) )/* normal characters ? */
|
||||
else if( ( ch >= 32 ) && ( ch < 256 ) )/* normal characters ? */
|
||||
{
|
||||
if ( kbdflags & ALT_PRESSED )
|
||||
if( kbdflags & ALT_PRESSED )
|
||||
{
|
||||
/* lower to upper case */
|
||||
if ( (ch >= 'a') && (ch <= 'z') )
|
||||
if( (ch >= 'a') && (ch <= 'z') )
|
||||
ch -= ' ';
|
||||
|
||||
/* alt + letter */
|
||||
if ( (ch >= 'A') && (ch <= 'Z') )
|
||||
if( (ch >= 'A') && (ch <= 'Z') )
|
||||
/* returned value is next in a table */
|
||||
return ( transAltKeyLetterTab[ (ch-'A')*2+1 ] );
|
||||
return transAltKeyLetterTab[ (ch-'A')*2+1 ];
|
||||
|
||||
/* alt + digit */
|
||||
if ( (ch >= '0') && (ch <= '9') )
|
||||
/* returned value is next in a table */
|
||||
return ( transAltKeyDigitTab[ (ch-'0')*2+1 ] );
|
||||
return transAltKeyDigitTab[ (ch-'0')*2+1 ];
|
||||
}
|
||||
|
||||
return ( ch );
|
||||
return ch;
|
||||
}
|
||||
|
||||
/* standard Slang keys */
|
||||
else if ( ( ch >= 256 ) && ( ch <= SL_KEY_ESC ) )
|
||||
else if( ( ch >= 256 ) && ( ch <= SL_KEY_ESC ) )
|
||||
{
|
||||
for( i = 0; i < ( sizeof( transKeyFunTab ) / sizeof( int ) ); i++ )
|
||||
{
|
||||
if( transKeyFunTab[ i++ ] == ch )
|
||||
return ( transKeyFunTab[ i ] );
|
||||
return transKeyFunTab[ i ];
|
||||
}
|
||||
}
|
||||
|
||||
/* Linux/Dos Alt+A-Z keys */
|
||||
else if ( ( ch >= SL_KEY_ALT_L( 'A' ) ) && ( ch <= SL_KEY_ALT_L( 'Z' ) ) )
|
||||
else if( ( ch >= SL_KEY_ALT_L( 'A' ) ) && ( ch <= SL_KEY_ALT_L( 'Z' ) ) )
|
||||
/* returned value is next in a table */
|
||||
return ( transAltKeyLetterTab[ (ch-SL_KEY_MAX-'A')*2+1 ] );
|
||||
return transAltKeyLetterTab[ (ch-SL_KEY_MAX-'A')*2+1 ];
|
||||
|
||||
/* Linux Alt+a-z keys - lower to upper conersion */
|
||||
else if ( ( ch >= SL_KEY_ALT_L( 'a' ) ) && ( ch <= SL_KEY_ALT_L( 'z' ) ) )
|
||||
else if( ( ch >= SL_KEY_ALT_L( 'a' ) ) && ( ch <= SL_KEY_ALT_L( 'z' ) ) )
|
||||
/* returned value is next in a table */
|
||||
return ( transAltKeyLetterTab[ (ch-SL_KEY_MAX-(' ')-('A'))*2+1 ] );
|
||||
return transAltKeyLetterTab[ (ch-SL_KEY_MAX-(' ')-('A'))*2+1 ];
|
||||
|
||||
/* Linux/Dos Alt+0-9 keys */
|
||||
else if ( ( ch >= SL_KEY_ALT_L( '0' ) ) && ( ch <= SL_KEY_ALT_L( '9' ) ) )
|
||||
else if( ( ch >= SL_KEY_ALT_L( '0' ) ) && ( ch <= SL_KEY_ALT_L( '9' ) ) )
|
||||
/* returned value is next in a table */
|
||||
return ( transAltKeyDigitTab[ (ch-SL_KEY_MAX-'0')*2+1 ] );
|
||||
return transAltKeyDigitTab[ (ch-SL_KEY_MAX-'0')*2+1 ];
|
||||
|
||||
return (ch);
|
||||
return ch;
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hb_gt_try_get_Kbd_State()
|
||||
{
|
||||
#if defined(__linux__)
|
||||
|
||||
unsigned char modifiers = 6;
|
||||
unsigned char modifiers = 6;
|
||||
|
||||
if (ioctl (0, TIOCLINUX, &modifiers) < 0)
|
||||
return 0;
|
||||
if( ioctl (0, TIOCLINUX, &modifiers) < 0 )
|
||||
return 0;
|
||||
|
||||
return (int) modifiers;
|
||||
return ( int ) modifiers;
|
||||
|
||||
#elif defined(M_UNIX)
|
||||
|
||||
int modifiers = 0;
|
||||
int IOcommand = 0;
|
||||
|
||||
if (ioctl(0, TCGETSC, &modifiers) >= 0)
|
||||
if( ioctl(0, TCGETSC, &modifiers) >= 0 )
|
||||
{
|
||||
if (modifiers == KB_XSCANCODE)
|
||||
if( modifiers == KB_XSCANCODE )
|
||||
{
|
||||
IOcommand = KB_ISSCANCODE;
|
||||
if (ioctl(0, TCSETSC, &IOcommand) >= 0)
|
||||
if( ioctl(0, TCSETSC, &IOcommand) >= 0 )
|
||||
{
|
||||
if (ioctl(0, KDGKBSTATE, &modifiers) < 0)
|
||||
if( ioctl(0, KDGKBSTATE, &modifiers) < 0 )
|
||||
modifiers = 0;
|
||||
}
|
||||
else modifiers = 0;
|
||||
|
||||
IOcommand = KB_XSCANCODE;
|
||||
if (ioctl(0, TCSETSC, &IOcommand) < 0)
|
||||
if( ioctl(0, TCSETSC, &IOcommand) < 0 )
|
||||
modifiers = 0;
|
||||
}
|
||||
else
|
||||
if (ioctl(0, KDGKBSTATE, &modifiers) < 0)
|
||||
modifiers = 0;
|
||||
else if( ioctl(0, KDGKBSTATE, &modifiers) < 0 )
|
||||
modifiers = 0;
|
||||
|
||||
return modifiers;
|
||||
}
|
||||
#endif
|
||||
|
||||
return (int)0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hb_gt_Shft_Pressed()
|
||||
{
|
||||
return( (hb_gt_try_get_Kbd_State() & SHIFT_PRESSED) != 0 );
|
||||
return (hb_gt_try_get_Kbd_State() & SHIFT_PRESSED) != 0;
|
||||
}
|
||||
|
||||
int hb_gt_Ctrl_Pressed()
|
||||
{
|
||||
return( (hb_gt_try_get_Kbd_State() & CONTROL_PRESSED) != 0 );
|
||||
return (hb_gt_try_get_Kbd_State() & CONTROL_PRESSED) != 0;
|
||||
}
|
||||
|
||||
int hb_gt_Alt_Pressed()
|
||||
{
|
||||
return( (hb_gt_try_get_Kbd_State() & ALT_PRESSED) != 0 );
|
||||
return (hb_gt_try_get_Kbd_State() & ALT_PRESSED) != 0;
|
||||
}
|
||||
|
||||
int hb_gt_Kbd_State()
|
||||
{
|
||||
return ( hb_gt_try_get_Kbd_State() );
|
||||
return hb_gt_try_get_Kbd_State();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Video subsystem based on Slang screen library.
|
||||
|
||||
Reference in New Issue
Block a user