2009-07-14 11:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/rtl/gtcrs/gtcrs.c
  * harbour/source/rtl/gtcrs/gtcrs.h
  * harbour/source/rtl/gtcrs/Makefile
    * updated to compile with DJGPP and PDCURSES

  * harbour/source/rtl/gttrm/Makefile
  * harbour/source/rtl/gttrm/gttrm.c
    * updated to compile with DJGPP - warning it needs remote terminal or
      at least ANSI driver for local execution

  * harbour/source/rtl/gtchrmap.c
    * enabed for DOS builds
This commit is contained in:
Przemyslaw Czerpak
2009-07-14 09:30:34 +00:00
parent 0b0c2ff677
commit 4499e22e7d
7 changed files with 77 additions and 37 deletions

View File

@@ -17,6 +17,20 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-07-14 11:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/rtl/gtcrs/gtcrs.c
* harbour/source/rtl/gtcrs/gtcrs.h
* harbour/source/rtl/gtcrs/Makefile
* updated to compile with DJGPP and PDCURSES
* harbour/source/rtl/gttrm/Makefile
* harbour/source/rtl/gttrm/gttrm.c
* updated to compile with DJGPP - warning it needs remote terminal or
at least ANSI driver for local execution
* harbour/source/rtl/gtchrmap.c
* enabed for DOS builds
2009-07-14 11:18 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* source/pp/Makefile
! Ugly hack added to make dos/watcom creation under NT hosts.

View File

@@ -57,7 +57,7 @@
#include "hbgtcore.h"
#include "hbapifs.h"
#ifdef HB_OS_UNIX
#if defined( HB_OS_UNIX ) || defined( HB_OS_DOS )
#define MAX_CHAR_VAL 0xff
#define HB_CHRMAP(a,c) ( ( (a) << 16 ) | (c) )
@@ -474,4 +474,4 @@ int main(int argc, char **argv)
}
*/
#endif /* HB_OS_UNIX */
#endif /* HB_OS_UNIX || HB_OS_DOS */

View File

@@ -24,8 +24,16 @@ HB_INC_CURSES =
endif
HB_INC_CURSES_OK += $(foreach d, $(HB_INC_CURSES), $(if $(wildcard $(d)/curses.h),$(d),))
HB_INC_CURSES_OK:=$(strip $(HB_INC_CURSES_OK))
ifneq ($(strip $(HB_INC_CURSES_OK)),)
ifeq ($(HB_INC_CURSES_OK),)
ifeq ($(HB_ARCHITECTURE),dos)
HB_INC_CURSES_OK += $(foreach d, $(subst ;, ,$(PATH)), $(if $(wildcard $(d)/../include/curses.h),$(d)/../include,))
HB_INC_CURSES_OK:=$(strip $(HB_INC_CURSES_OK))
endif
endif
ifneq ($(HB_INC_CURSES_OK),)
HB_INC_GPM_OK =
ifneq ($(HB_GPM_MOUSE),no)

View File

@@ -169,7 +169,7 @@ static int s_iActive_ioBase = -1;
static void set_tmevt(unsigned char *cMBuf, mouseEvent *);
static int getMouseKey(mouseEvent *);
static void destroy_ioBase(InOutBase *ioBase);
static void sig_handler(int signo);
static void set_sig_handler( int iSig );
static void curs_wrkaround( void );
@@ -376,24 +376,11 @@ static int getClipKey( int nKey )
return nRet;
}
static void set_sig_handler( int iSig )
{
/* SA_NOCLDSTOP in #if is a hack to detect POSIX compatible environment */
#if defined( SA_NOCLDSTOP )
struct sigaction act;
sigaction( iSig, 0, &act );
act.sa_handler = sig_handler;
act.sa_flags = SA_RESTART | ( iSig == SIGCHLD ? SA_NOCLDSTOP : 0 );
sigaction( iSig, &act, 0 );
#endif
}
#if defined( SA_NOCLDSTOP ) && defined( SA_RESTART ) && defined( SIGCHLD )
#if 1
static void sig_handler( int signo )
{
int e = errno, stat;
pid_t pid;
int e = errno;
if ( signo < MAX_SIGNO )
{
@@ -404,8 +391,12 @@ static void sig_handler( int signo )
switch ( signo )
{
case SIGCHLD:
{
int stat;
pid_t pid;
while ( ( pid = waitpid( -1, &stat, WNOHANG ) ) > 0 ) ;
break;
}
case SIGWINCH:
s_WinSizeChangeFlag = TRUE;
break;
@@ -447,16 +438,19 @@ static void set_signals( void )
#else
static void sig_handler( int signo )
{
int e = errno, stat;
int e = errno;
char *pszSig;
pid_t pid;
switch ( signo )
{
case SIGCHLD:
{
int stat;
pid_t pid;
pszSig = "SIGCHLD";
while ( ( pid = waitpid( -1, &stat, WNOHANG ) ) > 0 ) ;
break;
}
case SIGWINCH:
pszSig = "SIGWINCH";
break;
@@ -505,6 +499,27 @@ static void set_signals( void )
}
}
#endif
#else
static void set_signals( void )
{
}
#endif
static void set_sig_handler( int iSig )
{
/* SA_NOCLDSTOP in #if is a hack to detect POSIX compatible environment */
#if defined( SA_NOCLDSTOP ) && defined( SA_RESTART ) && defined( SIGCHLD )
struct sigaction act;
sigaction( iSig, 0, &act );
act.sa_handler = sig_handler;
act.sa_flags = SA_RESTART | ( iSig == SIGCHLD ? SA_NOCLDSTOP : 0 );
sigaction( iSig, &act, 0 );
#else
HB_SYMBOL_UNUSED( iSig );
#endif
}
static int add_efds( InOutBase * ioBase, int fd, int mode,
int ( *eventFunc ) ( int, int, void * ), void *data )

View File

@@ -75,7 +75,7 @@
# define _XOPEN_SOURCE_EXTENDED
# endif
# include <curses.h>
# if defined( HB_OS_SUNOS )
# if defined( HB_OS_SUNOS ) || defined( __PDCURSES__ )
# include <term.h>
# endif
#endif

View File

@@ -25,6 +25,9 @@ endif
ifeq ($(HB_COMPILER),cygwin)
HB_WITH_GTTRM=yes
endif
ifeq ($(HB_COMPILER),djgpp)
HB_WITH_GTTRM=yes
endif
ifeq ($(HB_WITH_GTTRM),yes)

View File

@@ -79,7 +79,7 @@
#include <string.h>
#include <fcntl.h>
#if defined( HB_OS_UNIX_COMPATIBLE )
#if defined( HB_OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
# include <errno.h>
# include <time.h>
# include <unistd.h>
@@ -151,7 +151,7 @@ static HB_GT_FUNCS SuperTable;
#define MOUSE_GPM 1
#define MOUSE_XTERM 2
#if defined( HB_OS_UNIX_COMPATIBLE )
#if defined( HB_OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
#define TIMEVAL_GET(tv) gettimeofday(&(tv), NULL)
#define TIMEVAL_LESS(tv1, tv2) (((tv1).tv_sec == (tv2).tv_sec ) ? \
@@ -264,7 +264,7 @@ typedef struct {
int mbup_row, mbup_col;
int mbdn_row, mbdn_col;
/* to analize DBLCLK on xterm */
#if defined( HB_OS_UNIX_COMPATIBLE )
#if defined( HB_OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
struct timeval BL_time;
struct timeval BR_time;
struct timeval BM_time;
@@ -342,7 +342,7 @@ typedef struct _HB_GTTRM
int terminal_type;
int terminal_ext;
#if defined( HB_OS_UNIX_COMPATIBLE )
#if defined( HB_OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
struct termios saved_TIO, curr_TIO;
BOOL fRestTTY;
#endif
@@ -391,7 +391,7 @@ typedef struct _HB_GTTRM
} HB_TERM_STATE, HB_GTTRM, * PHB_GTTRM;
/* static variables use by signal handler */
#if defined( HB_OS_UNIX_COMPATIBLE )
#if defined( HB_OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
static volatile BOOL s_WinSizeChangeFlag = FALSE;
static volatile BOOL s_fRestTTY = FALSE;
#endif
@@ -661,7 +661,7 @@ static int hb_gt_trm_getSize( PHB_GTTRM pTerm, int * piRows, int * piCols )
{
*piRows = *piCols = 0;
#if defined( HB_OS_UNIX_COMPATIBLE )
#if defined( HB_OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
if( pTerm->fOutTTY )
{
struct winsize win;
@@ -778,7 +778,7 @@ static int add_efds( PHB_GTTRM pTerm, int fd, int mode,
if( eventFunc == NULL && mode != O_RDONLY )
return -1;
#if defined( HB_OS_UNIX_COMPATIBLE )
#if defined( HB_OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
{
int fl;
if( ( fl = fcntl( fd, F_GETFL, 0 ) ) == -1 )
@@ -955,7 +955,7 @@ static void chk_mevtdblck( PHB_GTTRM pTerm )
if( newbuttons != 0 )
{
#if defined( HB_OS_UNIX_COMPATIBLE )
#if defined( HB_OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
struct timeval tv;
#else
double tv;
@@ -1227,7 +1227,7 @@ static int get_inch( PHB_GTTRM pTerm, int milisec )
{
unsigned char buf[STDIN_BUFLEN];
#if defined( HB_OS_UNIX_COMPATIBLE )
#if defined( HB_OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
n = read( pTerm->event_fds[i]->fd, buf,
STDIN_BUFLEN - pTerm->stdin_inbuf );
#else
@@ -1331,7 +1331,7 @@ static int wait_key( PHB_GTTRM pTerm, int milisec )
int nKey, esc, n, i, ch, counter;
keyTab *ptr;
#if defined( HB_OS_UNIX_COMPATIBLE )
#if defined( HB_OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
if( s_WinSizeChangeFlag )
{
s_WinSizeChangeFlag = FALSE;
@@ -1602,7 +1602,7 @@ static BOOL hb_gt_trm_XtermSetMode( PHB_GTTRM pTerm, int * piRows, int * piCols
hb_gt_trm_termOut( pTerm, escseq, strlen( escseq ) );
hb_gt_trm_termFlush( pTerm );
#if defined( HB_OS_UNIX_COMPATIBLE )
#if defined( HB_OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
/* dirty hack - wait for SIGWINCH */
if( *piRows != iHeight || *piCols != iWidth )
sleep( 3 );
@@ -1820,7 +1820,7 @@ static BOOL hb_gt_trm_AnsiGetCursorPos( PHB_GTTRM pTerm, int * iRow, int * iCol,
break;
else
{
#ifdef HB_OS_UNIX_COMPATIBLE
#if defined( HB_OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
struct timeval tv;
fd_set rdfds;
int iMilliSec;
@@ -3026,7 +3026,7 @@ static void hb_gt_trm_Exit( PHB_GT pGT )
if( pTerm )
{
#if defined( HB_OS_UNIX_COMPATIBLE )
#if defined( HB_OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
if( pTerm->fRestTTY )
tcsetattr( pTerm->hFilenoStdin, TCSANOW, &pTerm->saved_TIO );
#endif
@@ -3192,7 +3192,7 @@ static BOOL hb_gt_trm_Suspend( PHB_GT pGT )
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Suspend(%p)", pGT ) );
pTerm = HB_GTTRM_GET( pGT );
#if defined( HB_OS_UNIX_COMPATIBLE )
#if defined( HB_OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
if( pTerm->fRestTTY )
tcsetattr( pTerm->hFilenoStdin, TCSANOW, &pTerm->saved_TIO );
#endif
@@ -3209,7 +3209,7 @@ static BOOL hb_gt_trm_Resume( PHB_GT pGT )
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_trm_Resume(%p)", pGT ) );
pTerm = HB_GTTRM_GET( pGT );
#if defined( HB_OS_UNIX_COMPATIBLE )
#if defined( HB_OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
if( pTerm->fRestTTY )
tcsetattr( pTerm->hFilenoStdin, TCSANOW, &pTerm->curr_TIO );
#endif