From 22b9510a0b2325e9950ddbe0bf065a4deffc9e20 Mon Sep 17 00:00:00 2001 From: "David G. Holm" Date: Tue, 19 Oct 1999 23:13:15 +0000 Subject: [PATCH] See ChangeLog entry 19991019-19:00 EDT David G. Holm --- harbour/ChangeLog | 20 ++++++++++++++++ harbour/config/w32/bcc32.cf | 2 +- harbour/include/wincheck.h | 13 +++++++++++ harbour/source/rtl/dates.c | 10 +++----- harbour/source/rtl/dir.c | 10 +++----- harbour/source/rtl/environ.c | 42 ++++++++++++++------------------- harbour/source/rtl/inkey.c | 45 ++++++++++++++++++++++++------------ 7 files changed, 87 insertions(+), 55 deletions(-) create mode 100644 harbour/include/wincheck.h diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5c5698abb6..c94003415c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,23 @@ +19991019-19:00 EDT David G. Holm + + * config/w32/bcc32.cf + ! I finally found out what I did wrong with regards to using BCC32 + with the GNU Make System. I had accidentally set it up for the + DOS GT API instead of for the Windows GT API! + + + include/wincheck.h + * source/rtl/dates.c + * source/rtl/dir.c + * source/rtl/environ.c + * source/rtl/inkey.c + ! All source files that need to conditinally include the Windows API + now use the new include file "wincheck.h" in order to eliminate + inconsistent inclusion of "windows.h". If "windows.h" ends up being + included, then the new manifest constant HARBOUR_USE_WIN is defined. + + * source/rtl/inkey.c + ! Added Windows Console Mode translations for Alt+Tab and Shift+Tab. + 19991019-11:55 GMT+1 Victor Szel * source/rtl/tbrowse.prg ! Fixed the header/footer separator to be drawn until the border. diff --git a/harbour/config/w32/bcc32.cf b/harbour/config/w32/bcc32.cf index ffe21cb499..bf9e74e3cd 100644 --- a/harbour/config/w32/bcc32.cf +++ b/harbour/config/w32/bcc32.cf @@ -23,7 +23,7 @@ endif CC = bcc32 CC_IN = -c CC_OUT = -o -CPPFLAGS = -I$(GRANDP) -I$(_HB_INC_COMPILE) -DHARBOUR_USE_DOS_GTAPI +CPPFLAGS = -I$(GRANDP) -I$(_HB_INC_COMPILE) -DHARBOUR_USE_WIN_GTAPI CFLAGS = -O2 LD = bcc32 diff --git a/harbour/include/wincheck.h b/harbour/include/wincheck.h new file mode 100644 index 0000000000..fa2a3fdea8 --- /dev/null +++ b/harbour/include/wincheck.h @@ -0,0 +1,13 @@ +/* The purpose for this Harbour include file is to determine if + windows.h should be included and to set set additional manifest + constants should this be the case. When used, this include file + must be the very first include file that is included! */ + +#if defined(_Windows) || defined(WINNT) + #define HARBOUR_USE_WIN + #define WIN32_LEAN_AND_MEAN + #include + #if defined(__GNUC__) + #define HB_DONT_DEFINE_BASIC_TYPES + #endif +#endif diff --git a/harbour/source/rtl/dates.c b/harbour/source/rtl/dates.c index be68b46aa9..ec056b96d3 100644 --- a/harbour/source/rtl/dates.c +++ b/harbour/source/rtl/dates.c @@ -65,13 +65,9 @@ * */ -#if defined(_Windows) || defined(WINNT) - #define WIN32_LEAN_AND_MEAN - #include - #if defined(__GNUC__) || defined(__MINGW32__) - #define HB_DONT_DEFINE_BASIC_TYPES - #endif -#endif +/* NOTE: The following #include "wincheck.h" must + be ahead of any other #include statements! */ +#include "wincheck.h" #include "extend.h" #include "errorapi.h" diff --git a/harbour/source/rtl/dir.c b/harbour/source/rtl/dir.c index eeebf0e059..bf8025d561 100644 --- a/harbour/source/rtl/dir.c +++ b/harbour/source/rtl/dir.c @@ -107,13 +107,9 @@ #define INCL_DOSERRORS #endif -#if defined(_MSC_VER) || defined(__MINGW32__) - #define WIN32_LEAN_AND_MEAN - #include - #if defined(__MINGW32__) - #define HB_DONT_DEFINE_BASIC_TYPES - #endif -#endif +/* NOTE: The following #include "wincheck.h" must + be ahead of any other #include statements! */ +#include "wincheck.h" #include #include "extend.h" diff --git a/harbour/source/rtl/environ.c b/harbour/source/rtl/environ.c index 98b8530582..2a59c08546 100644 --- a/harbour/source/rtl/environ.c +++ b/harbour/source/rtl/environ.c @@ -55,18 +55,9 @@ #define INCL_DOSMISC #endif -/* NOTE: The following #ifdef block #including must - be ahead of any and all #include statements! */ - -#if defined(_Windows) || defined(_WIN32) || defined(__MINGW32__) - #if !defined(__CYGWIN__) - #define WIN32_LEAN_AND_MEAN - #include - #if defined(__MINGW32__) - #define HB_DONT_DEFINE_BASIC_TYPES - #endif - #endif -#endif +/* NOTE: The following #include "wincheck.h" must + be ahead of any other #include statements! */ +#include "wincheck.h" #if defined(__BORLANDC__) && defined(_Windows) && ! defined(VER_PLATFORM_WIN32_WINDOWS) #define VER_PLATFORM_WIN32_WINDOWS 1 @@ -145,7 +136,7 @@ HARBOUR HB_OS( void ) /* TODO: add MSVC support but MSVC cannot detect any OS except Windows! */ #if defined(__TURBOC__) || defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__) -#if defined(_Windows) || defined(_WIN32) || defined(__MINGW32__) +#if defined(_Windows) || defined(WINNT) /* NOTE: Support for determining the window version by Luiz Rafael Culik Culik@sl.conex.net @@ -299,9 +290,9 @@ char * hb_version( USHORT uiMode ) if( uiMode != 0 ) { /* Optionally include the Compiler name and version, if available. */ - char * compiler = ( char * ) NULL; - int version = 0; - int revision = 0; + char * compiler; + int version; + int revision; #if defined(__IBMC__) || defined(__IBMCPP__) @@ -322,24 +313,19 @@ char * hb_version( USHORT uiMode ) #elif defined(__BORLANDC__) compiler = "Borland C++"; - if( __BORLANDC__ == 1040 ) - { + #if (__BORLANDC__ == 1040) /* Version 3.1 */ version = 3; revision = 1; - } - else if( __BORLANDC__ >= 1280 ) - { + #elif (__BORLANDC__ >= 1280) /* Version 5.x */ version = __BORLANDC__ >> 8; revision = ( __BORLANDC__ & 0xff ) >> 4; - } - else - { + #else /* Version 4.x */ version = __BORLANDC__ >> 8; revision = ( __BORLANDC__ - 1 & 0xff) >> 4; - } + #endif #elif defined(__TURBOC__) @@ -396,6 +382,12 @@ char * hb_version( USHORT uiMode ) version = __GNUC__; revision = __GNUC_MINOR__; + #else + + compiler = ( char * ) NULL; + version = 0; + revision = 0; + #endif if( compiler ) diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index 042ef0fa25..62433207fe 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -82,17 +82,16 @@ #define INCL_NOPMAPI #endif -#if defined(_Windows) || defined(WINNT) - #define WIN32_LEAN_AND_MEAN - #include +/* NOTE: The following #include "wincheck.h" must + be ahead of any other #include statements! */ +#include "wincheck.h" + +#ifdef HARBOUR_USE_WIN #define INPUT_BUFFER_LEN 128 extern HANDLE hb_gtHInput; /* This variable is located in source/rtl/gt/gtwin.c */ DWORD cNumRead = 0; /* Ok to use DWORD here, because this is specific... */ DWORD cNumIndex = 0; /* ...to the Windows API, which defines DWORD, etc. */ INPUT_RECORD irInBuf[INPUT_BUFFER_LEN]; - #if defined(__GNUC__) - #define HB_DONT_DEFINE_BASIC_TYPES - #endif #endif #include "extend.h" @@ -272,7 +271,7 @@ int hb_inkeyLast( void ) /* Return the value of the last key that was extra int hb_inkeyNext( void ) /* Return the next key without extracting it */ { - int key = 0; + int key; hb_inkeyPoll(); if( hb_set.HB_SET_TYPEAHEAD ) { @@ -321,7 +320,7 @@ void hb_inkeyPoll( void ) /* Poll the console keyboard to stuff the Harbour /* Save the keyboard state and ASCII key code */ DWORD dwState = irInBuf[cNumIndex].Event.KeyEvent.dwControlKeyState; ch = irInBuf[cNumIndex].Event.KeyEvent.uChar.AsciiChar; - if( ch == 0 || ( dwState & ( ENHANCED_KEY | LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED | RIGHT_ALT_PRESSED | RIGHT_CTRL_PRESSED ) ) ) + if( ch == 0 || ( dwState & ( ENHANCED_KEY | LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED | RIGHT_ALT_PRESSED | RIGHT_CTRL_PRESSED | SHIFT_PRESSED ) ) ) { /* Process non-ASCII key codes */ WORD wKey; @@ -373,6 +372,7 @@ printf("\nhb_inkeyPoll: wKey is %d, dwState is %d, ch is %d", wKey, dwState, ch) { /* Alt key held */ if( wKey == 1 ) ch = K_ALT_ESC; /* Esc */ + else if( wKey == 15 ) ch = K_ALT_TAB; /* Tab */ else if( wKey <= 12 ) ch = wKey + 374; /* Numeric row */ else if( wKey == 28 ) ch = KP_ALT_ENTER; /* Num Pad Enter */ else if( wKey <= 52 ) ch = wKey + 256; /* Alpha rows */ @@ -480,14 +480,26 @@ printf("\nhb_inkeyPoll: wKey is %d, dwState is %d, ch is %d", wKey, dwState, ch) else if( bShift ) { /* Shift key held */ - if( wKey == 1 ) ch = K_ESC; /* Esc */ - else if( wKey == 28 ) ch = K_ENTER; /* Num Pad Enter */ - else if( wKey == 53 && bEnhanced ) ch = '/'; /* Num Pad / */ + if( wKey == 53 && bEnhanced ) ch = '/'; /* Num Pad / */ else if( wKey >= 59 && wKey <= 68 ) ch = 49 - wKey; /* F1 - F10 */ - else if( wKey == 76 ) ch = '5'; /* Num Pad 5 */ - else if( wKey == 87 || wKey == 88 ) ch = 45 - wKey; /* F11, F12 */ else switch( wKey ) { + case 1: /* Esc */ + ch = K_ESC; + break; + case 15: /* Tab */ + ch = K_SH_TAB; + break; + case 28: /* Num Pad Enter */ + ch = K_ENTER; + break; + case 76: /* Num Pad 5 */ + ch = '5'; + break; + case 87: /* F11 */ + case 88: /* F12 */ + ch = 45 - wKey; + break; case 82: /* Ins */ ch = K_INS; break; @@ -518,8 +530,11 @@ printf("\nhb_inkeyPoll: wKey is %d, dwState is %d, ch is %d", wKey, dwState, ch) case 75: /* Left */ ch = K_LEFT; break; - default: - ch = wKey + 128; + default: /* Any thing not explicitly translated */ + if( ch == 0 ) + /* Only provide a translation for those key + codes that don't have a default one. */ + ch = wKey + 128; } } else