From ecebc826a1675018cbef7653d3f81980bfacd4a9 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 13 Mar 2000 11:42:13 +0000 Subject: [PATCH] 20000313-12:40 GMT+1 Victor Szakats --- harbour/ChangeLog | 24 ++++++++++++-- harbour/bin/bld_tpl.bat | 2 +- harbour/bin/bld_tpl.cmd | 2 +- harbour/makefile.bc | 3 ++ harbour/source/rtl/achoice.prg | 17 +++++----- harbour/source/rtl/console.c | 19 ++++------- harbour/source/rtl/inkey.c | 58 ++++++++++++++++++--------------- harbour/source/rtl/oldbox.c | 21 +++--------- harbour/source/rtl/text.prg | 2 -- harbour/source/rtl/tgetlist.prg | 1 - 10 files changed, 77 insertions(+), 72 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 3af7667eb6..ca1ee5ad32 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,21 @@ +20000313-12:40 GMT+1 Victor Szakats + * source/rtl/inkey.c + ! Fixed to work with STD_GTAPI on Win32. + * bin/bld_tpl.* + + user32.lib added for MSVC + * source/rtl/oldbox.c + - Removed non-GT branches. + ! __BOX() fixed handling of the fifth parameter. + * source/rtl/console.c + * OS_DOS_COMPATIBLE -> OS_UNIX_COMPATIBLE + * source/rtl/achoice.prg + source/rtl/text.prg + source/rtl/tgetlist.prg + % Removed #include "set.ch", since it's included anyway with the + built-in (default) PP rules. + * makefile.bc + + NOTE added about "echo." + 20000313-12:42 GMT+3 Alexander Kresin * contrib/rdd_ads/ads1.c * Little bug fixed in adsAppend() @@ -43,12 +61,12 @@ So it's possible to link for the Win32 platform a non-GT mode Harbour. !!WARNING!! Since this change involves many platform/compiler combinations, please test it on yours and report any possible errors. - WIN32/MINGW32, WIN32/GCC, WIN32/BCC32/55, DOS/BCC16/31, WIN32/MSVC has + WIN32/MINGW32, WIN32/GCC, WIN32/BCC32/55, DOS/BCC16/31, WIN32/MSVC have been tested. * source/rtl/inkey.c source/rtl/environ.c ! Fixed to use WINNT macro after the #include section. - ! Code dependent of the GT API fixed. + ! Code dependent on the GT API fixed. * include/hbcomp.h source/compiler/cmdcheck.c source/compiler/hbusage.c @@ -62,7 +80,7 @@ source/macro/macro.c source/macro/macro.l * bName10 structure member replaced with uiNameLen in HB_MACRO. Now - the HB_SYMBOL_NAME_LEN is the one and only setting which control the + the HB_SYMBOL_NAME_LEN is the one and only setting which controls the maximum symbol name length in Harbour. * include/hbsetup.h - Removed some duplicated platform detection code. diff --git a/harbour/bin/bld_tpl.bat b/harbour/bin/bld_tpl.bat index cb26063346..462c8cd78b 100644 --- a/harbour/bin/bld_tpl.bat +++ b/harbour/bin/bld_tpl.bat @@ -90,7 +90,7 @@ rem set HB_COMPILER= if "%HB_COMPILER%" == "bcc32" bcc32 -O2 -I..\include -L..\lib %1.c tools.lib debug.lib vm.lib rtl.lib rdd.lib macro.lib pp.lib dbfntx.lib dbfcdx.lib common.lib if "%HB_COMPILER%" == "gcc" gcc %1.c -o%1.exe -I..\include -L..\lib -ltools -ldebug -lvm -lrtl -lrdd -lrtl -lvm -lmacro -lpp -ldbfntx -ldbfcdx -lcommon if "%HB_COMPILER%" == "mingw32" gcc %1.c -o%1.exe -mno-cygwin -I..\include -L..\lib -ltools -ldebug -lvm -lrtl -lrdd -lrtl -lvm -lmacro -lpp -ldbfntx -ldbfcdx -lcommon - if "%HB_COMPILER%" == "msvc" cl -Fd..\bin\harbour -w -Zi -TP -GZ -GA -I..\include %1.c /link /subsystem:CONSOLE ..\lib\tools.lib ..\lib\debug.lib ..\lib\vm.lib ..\lib\rtl.lib ..\lib\rdd.lib ..\lib\macro.lib ..\lib\pp.lib ..\lib\dbfntx.lib ..\lib\dbfcdx.lib ..\lib\common.lib + if "%HB_COMPILER%" == "msvc" cl -Fd..\bin\harbour -w -Zi -TP -GZ -GA -I..\include %1.c /link /subsystem:CONSOLE ..\lib\tools.lib ..\lib\debug.lib ..\lib\vm.lib ..\lib\rtl.lib ..\lib\rdd.lib ..\lib\macro.lib ..\lib\pp.lib ..\lib\dbfntx.lib ..\lib\dbfcdx.lib ..\lib\common.lib user32.lib if "%HB_COMPILER%" == "msvc" echo Ignore LNK4033 warning goto END diff --git a/harbour/bin/bld_tpl.cmd b/harbour/bin/bld_tpl.cmd index bb69e51783..07a4530f2e 100644 --- a/harbour/bin/bld_tpl.cmd +++ b/harbour/bin/bld_tpl.cmd @@ -90,7 +90,7 @@ rem set HB_COMPILER= if "%HB_COMPILER%" == "bcc32" bcc32 -O2 -I..\include -L..\lib %1.c tools.lib debug.lib vm.lib rtl.lib rdd.lib macro.lib pp.lib dbfntx.lib dbfcdx.lib common.lib if "%HB_COMPILER%" == "gcc" gcc %1.c -o%1.exe -I..\include -L..\lib -ltools -ldebug -lvm -lrtl -lrdd -lrtl -lvm -lmacro -lpp -ldbfntx -ldbfcdx -lcommon if "%HB_COMPILER%" == "mingw32" gcc %1.c -o%1.exe -mno-cygwin -I..\include -L..\lib -ltools -ldebug -lvm -lrtl -lrdd -lrtl -lvm -lmacro -lpp -ldbfntx -ldbfcdx -lcommon - if "%HB_COMPILER%" == "msvc" cl -Fd..\bin\harbour -w -Zi -TP -GZ -GA -I..\include %1.c /link /subsystem:CONSOLE ..\lib\tools.lib ..\lib\debug.lib ..\lib\vm.lib ..\lib\rtl.lib ..\lib\rdd.lib ..\lib\macro.lib ..\lib\pp.lib ..\lib\dbfntx.lib ..\lib\dbfcdx.lib ..\lib\common.lib + if "%HB_COMPILER%" == "msvc" cl -Fd..\bin\harbour -w -Zi -TP -GZ -GA -I..\include %1.c /link /subsystem:CONSOLE ..\lib\tools.lib ..\lib\debug.lib ..\lib\vm.lib ..\lib\rtl.lib ..\lib\rdd.lib ..\lib\macro.lib ..\lib\pp.lib ..\lib\dbfntx.lib ..\lib\dbfcdx.lib ..\lib\common.lib user32.lib if "%HB_COMPILER%" == "msvc" echo Ignore LNK4033 warning goto END diff --git a/harbour/makefile.bc b/harbour/makefile.bc index 74f550cb3c..e27e1c3c72 100644 --- a/harbour/makefile.bc +++ b/harbour/makefile.bc @@ -4,6 +4,9 @@ # makefile for Borland C/C++ compilers +# NOTE: "echo." intentionally used instead of "echo", to avoid conflicts +# with external commands named echo. + # Merge duplicate strings BCC_OPT = $(BCC_OPT) -d diff --git a/harbour/source/rtl/achoice.prg b/harbour/source/rtl/achoice.prg index 90dbfe57e7..85dbe00dd7 100644 --- a/harbour/source/rtl/achoice.prg +++ b/harbour/source/rtl/achoice.prg @@ -15,7 +15,6 @@ #include "color.ch" #include "common.ch" #include "inkey.ch" -#include "set.ch" #include "setcurs.ch" #define INRANGE( xLo, xVal, xHi ) ( xVal >= xLo .AND. xVal <= xHi ) @@ -49,14 +48,14 @@ FUNCTION AChoice( nTop, nLeft, nBottom, nRight, acItems, xSelect, xUserFunc, nPo lUserFunc := !Empty( xUserFunc ) .AND. ValType( xUserFunc ) $ "CB" - DEFAULT nTop TO 0 // The topmost row of the window - DEFAULT nLeft TO 0 // The leftmost column of the window - DEFAULT nBottom TO MaxRow() + 1 // The bottommost row of the window - DEFAULT nRight TO MaxCol() + 1 // The rightmost column of the window - - DEFAULT acItems TO {} // The items from which to choose - DEFAULT xSelect TO .T. // Array or logical, what is selectable - DEFAULT nPos TO 1 // The number of the selected item + DEFAULT nTop TO 0 // The topmost row of the window + DEFAULT nLeft TO 0 // The leftmost column of the window + DEFAULT nBottom TO MaxRow() + 1 // The bottommost row of the window + DEFAULT nRight TO MaxCol() + 1 // The rightmost column of the window + + DEFAULT acItems TO {} // The items from which to choose + DEFAULT xSelect TO .T. // Array or logical, what is selectable + DEFAULT nPos TO 1 // The number of the selected item DEFAULT nHiLiteRow TO 0 // The row to be highlighted nNumCols := nRight - nLeft + 1 diff --git a/harbour/source/rtl/console.c b/harbour/source/rtl/console.c index 24dd04d022..c2f0851a47 100644 --- a/harbour/source/rtl/console.c +++ b/harbour/source/rtl/console.c @@ -109,13 +109,13 @@ void hb_consoleInitialize( void ) HB_TRACE(HB_TR_DEBUG, ("hb_consoleInitialize()")); -#if defined(OS_DOS_COMPATIBLE) +#if defined(OS_UNIX_COMPATIBLE) + s_szCrLf[ 0 ] = HB_CHAR_LF; + s_szCrLf[ 1 ] = '\0'; +#else s_szCrLf[ 0 ] = HB_CHAR_CR; s_szCrLf[ 1 ] = HB_CHAR_LF; s_szCrLf[ 2 ] = '\0'; -#else - s_szCrLf[ 0 ] = HB_CHAR_LF; - s_szCrLf[ 1 ] = '\0'; #endif s_szAcceptResult[ 0 ] = '\0'; @@ -685,9 +685,9 @@ HARBOUR HB_COL( void ) /* Return the current screen column position (zero origin HARBOUR HB_DISPBOX( void ) { -#ifdef HARBOUR_USE_GTAPI if( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) && ISNUM( 4 ) ) { +#ifdef HARBOUR_USE_GTAPI char szOldColor[ CLR_STRLEN ]; if( ISCHAR( 6 ) ) @@ -705,10 +705,7 @@ HARBOUR HB_DISPBOX( void ) if( ISCHAR( 6 ) ) hb_gtSetColorStr( szOldColor ); - } #else - if( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) && ISNUM( 4 ) ) - { char * szBorderStyle = _B_SINGLE; int i_top = hb_parni( 1 ); int i_left = hb_parni( 2 ); @@ -819,8 +816,8 @@ HARBOUR HB_DISPBOX( void ) } fflush( stdout ); hb_gtSetPos( bottom + 1, right + 1 ); - } #endif + } } HARBOUR HB_DISPBEGIN( void ) @@ -852,13 +849,11 @@ HARBOUR HB_NOSNOW( void ) HARBOUR HB_HB_SHADOW( void ) { if( hb_pcount() >= 4 ) - { hb_gtDrawShadow( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), ISNUM( 5 ) ? hb_parni( 5 ) : 7 ); - } } HARBOUR HB_DBGSHADOW( void ) @@ -887,13 +882,11 @@ HARBOUR HB_SAVESCREEN( void ) HARBOUR HB_RESTSCREEN( void ) { if( ISCHAR( 5 ) ) - { hb_gtRest( ISNUM( 1 ) ? hb_parni( 1 ) : 0, ISNUM( 2 ) ? hb_parni( 2 ) : 0, ISNUM( 3 ) ? hb_parni( 3 ) : hb_gtMaxRow(), ISNUM( 4 ) ? hb_parni( 4 ) : hb_gtMaxCol(), ( void * ) hb_parc( 5 ) ); - } } USHORT hb_setCursor( BOOL bSetCursor, USHORT usNewCursor ) diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index 56660ea16d..454609b0c0 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -98,17 +98,17 @@ #include "inkey.ch" #include "hbinit.h" -#if defined(_WINDOWS_) || defined(WINNT) - #if ! defined(HARBOUR_USE_CRS_GTAPI) && ! defined(HARBOUR_USE_SLN_GTAPI) - #define INPUT_BUFFER_LEN 128 - extern BOOL hb_gtBreak; /* This variable is located in source/rtl/gt/gtwin.c */ - extern HANDLE hb_gtHInput; /* This variable is located in source/rtl/gt/gtwin.c */ - static DWORD s_cNumRead = 0; /* Ok to use DWORD here, because this is specific... */ - static DWORD s_cNumIndex = 0; /* ...to the Windows API, which defines DWORD, etc. */ - static INPUT_RECORD s_irInBuf[ INPUT_BUFFER_LEN ]; - extern int hb_mouse_iCol; - extern int hb_mouse_iRow; - #endif +#if (defined(_WINDOWS_) || defined(WINNT)) && defined(HARBOUR_USE_WIN_GTAPI) + extern int hb_mouse_iCol; + extern int hb_mouse_iRow; + extern BOOL hb_gtBreak; /* This variable is located in source/rtl/gt/gtwin.c */ + extern HANDLE hb_gtHInput; /* This variable is located in source/rtl/gt/gtwin.c */ + + #define INPUT_BUFFER_LEN 128 + + static DWORD s_cNumRead = 0; /* Ok to use DWORD here, because this is specific... */ + static DWORD s_cNumIndex = 0; /* ...to the Windows API, which defines DWORD, etc. */ + static INPUT_RECORD s_irInBuf[ INPUT_BUFFER_LEN ]; #endif #define HB_BREAK_FLAG 256 /* 256, because that's what DJGPP returns Ctrl+Break as. @@ -169,17 +169,17 @@ static void restore_input_mode( void ) } HB_CALL_ON_STARTUP_BEGIN( init_input_mode ) - struct termios ta; - - tcgetattr( STDIN_FILENO, &startup_attributes ); - atexit( restore_input_mode ); - - tcgetattr( STDIN_FILENO, &ta ); - ta.c_lflag &= ~( ICANON | ECHO ); - ta.c_iflag &= ~ICRNL; - ta.c_cc[ VMIN ] = 0; - ta.c_cc[ VTIME ] = 0; - tcsetattr( STDIN_FILENO, TCSAFLUSH, &ta ); + struct termios ta; + + tcgetattr( STDIN_FILENO, &startup_attributes ); + atexit( restore_input_mode ); + + tcgetattr( STDIN_FILENO, &ta ); + ta.c_lflag &= ~( ICANON | ECHO ); + ta.c_iflag &= ~ICRNL; + ta.c_cc[ VMIN ] = 0; + ta.c_cc[ VTIME ] = 0; + tcsetattr( STDIN_FILENO, TCSAFLUSH, &ta ); HB_CALL_ON_STARTUP_END( init_input_mode ) #elif defined(HARBOUR_USE_DOS_GTAPI) && ! defined(__DJGPP__) @@ -294,6 +294,7 @@ int hb_inkeyLast( void ) /* Return the value of the last key that was extra HB_TRACE(HB_TR_DEBUG, ("hb_inkeyLast()")); hb_inkeyPoll(); + return s_inkeyLast; } @@ -304,13 +305,18 @@ int hb_inkeyNext( void ) /* Return the next key without extracting it */ HB_TRACE(HB_TR_DEBUG, ("hb_inkeyNext()")); hb_inkeyPoll(); + if( hb_set.HB_SET_TYPEAHEAD ) { /* Proper typeahead support is enabled */ - if( s_inkeyHead == s_inkeyTail ) key = 0; /* No key */ - else key = s_inkeyBuffer[ s_inkeyTail ]; /* Next key */ + if( s_inkeyHead == s_inkeyTail ) + key = 0; /* No key */ + else + key = s_inkeyBuffer[ s_inkeyTail ]; /* Next key */ } - else key = s_inkeyForce; /* Typeahead support is disabled */ + else + key = s_inkeyForce; /* Typeahead support is disabled */ + return key; } @@ -327,7 +333,7 @@ void hb_inkeyPoll( void ) /* Poll the console keyboard to stuff the Harbour #elif defined(OS_UNIX_COMPATIBLE) if( ! read( STDIN_FILENO, &ch, 1 ) ) ch = 0; -#elif defined(_WINDOWS_) || defined(WINNT) +#elif (defined(_WINDOWS_) || defined(WINNT)) && defined(HARBOUR_USE_WIN_GTAPI) /* First check for Ctrl+Break, which is handled by gt/gtwin.c */ if( hb_gtBreak ) { diff --git a/harbour/source/rtl/oldbox.c b/harbour/source/rtl/oldbox.c index afa0759d83..49c9e46988 100644 --- a/harbour/source/rtl/oldbox.c +++ b/harbour/source/rtl/oldbox.c @@ -37,30 +37,19 @@ HARBOUR HB___BOX( void ) { -#ifdef HARBOUR_USE_GTAPI - char * frame = hb_parc( 5 ); - - if( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) && ISNUM( 4 ) && ISCHAR( 5 ) ) - hb_gtBox( hb_parni( 1 ), hb_parni( 2 ), - hb_parni( 3 ), hb_parni( 4 ), - ( BYTE * ) ( frame ? frame : " " ) ); -#endif + if( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) && ISNUM( 4 ) ) + hb_gtBox( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), + ( BYTE * ) ( ISCHAR( 5 ) ? hb_parc( 5 ) : " " ) ); } HARBOUR HB___BOXD( void ) { -#ifdef HARBOUR_USE_GTAPI if( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) && ISNUM( 4 ) ) - hb_gtBoxD( hb_parni( 1 ), hb_parni( 2 ), - hb_parni( 3 ), hb_parni( 4 ) ); -#endif + hb_gtBoxD( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ) ); } HARBOUR HB___BOXS( void ) { -#ifdef HARBOUR_USE_GTAPI if( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) && ISNUM( 4 ) ) - hb_gtBoxS( hb_parni( 1 ), hb_parni( 2 ), - hb_parni( 3 ), hb_parni( 4 ) ); -#endif + hb_gtBoxS( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ) ); } diff --git a/harbour/source/rtl/text.prg b/harbour/source/rtl/text.prg index 114cf933f2..252d5364b4 100644 --- a/harbour/source/rtl/text.prg +++ b/harbour/source/rtl/text.prg @@ -33,8 +33,6 @@ * */ -#include "set.ch" - STATIC s_cFile STATIC s_lOldPrinter STATIC s_lOldExtra diff --git a/harbour/source/rtl/tgetlist.prg b/harbour/source/rtl/tgetlist.prg index efe1b717a0..9d1d12aacd 100644 --- a/harbour/source/rtl/tgetlist.prg +++ b/harbour/source/rtl/tgetlist.prg @@ -37,7 +37,6 @@ #include "common.ch" #include "getexit.ch" #include "inkey.ch" -#include "set.ch" #include "setcurs.ch" #define SCORE_ROW 0