From 72451ae329ad69c22f1e8b1eefe7d326c7b92ead Mon Sep 17 00:00:00 2001 From: "David G. Holm" Date: Mon, 25 Oct 1999 22:31:29 +0000 Subject: [PATCH] See ChangeLog entry 19991025-18:15 EDT David G. Holm --- harbour/ChangeLog | 21 +++++++++++++++++++++ harbour/include/hbwinapi.h | 1 - harbour/source/pp/hbpp.c | 23 ++++++++++++----------- harbour/source/pp/hbppint.c | 13 +++++++++---- harbour/source/rtl/inkey.c | 7 +++---- harbour/source/rtl/oemansi.c | 4 +++- 6 files changed, 48 insertions(+), 21 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1dade53645..c8d253a313 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,24 @@ +19991025-18:15 EDT David G. Holm + + * include/hbwinapi.h + - Removed '#define HARBOUR_USE_WIN', because includinging windows.h + causes _Windows to be defined, so HARBOUR_USE_WIN is redundant. + + * harbour/source/pp/hbpp.c + % Changed "non directive" warning to level 3. + + * harbour/source/pp/hbppint.c + + Added include file and include file line number to warning messages. + + * harbour/source/rtl/inkey.c + ! Moved HB_TRACE() call in hb_releaseCPU() to bottom of function, + because variables are declared in #if blocks. + - Changed '#ifdef HARBOUR_USE_WIN' to '#if defined(_Windows) || + defined(WINNT)' (see include/hbwinapi.h for reason why). + + * harbour/source/rtl/oemansi.c + ! Only include winuser.h when compiling for Windows. + 19991025-23:12 GMT+1 Victor Szel * source/rtl/achoice.prg ! Fixed bound error on empty array. diff --git a/harbour/include/hbwinapi.h b/harbour/include/hbwinapi.h index 55b41f352c..429f3c6c57 100644 --- a/harbour/include/hbwinapi.h +++ b/harbour/include/hbwinapi.h @@ -40,7 +40,6 @@ #define HB_WINAPI_H_ #if defined(HARBOUR_USE_WIN_GTAPI) || defined(WINNT) - #define HARBOUR_USE_WIN #define WIN32_LEAN_AND_MEAN #include #if defined(__GNUC__) diff --git a/harbour/source/pp/hbpp.c b/harbour/source/pp/hbpp.c index 8292355744..896b3b1e1e 100644 --- a/harbour/source/pp/hbpp.c +++ b/harbour/source/pp/hbpp.c @@ -57,7 +57,7 @@ #include "hbpp.h" #include "hberrors.h" -int Hp_Parse( FILE*, FILE* ); +int Hp_Parse( FILE*, FILE*, char * ); int ParseDirective( char* ); /* Parsing preprocessor directives ( #... ) */ int ParseDefine( char* ); /* Process #define directive */ DEFINES* AddDefine ( char*, char* ); /* Add new #define to a linked list */ @@ -106,7 +106,7 @@ int NextWord ( char**, char*, int); int NextName ( char**, char* ); int NextParm ( char**, char* ); int Include( char *, PATHNAMES *, FILE** ); -BOOL OpenInclude( char *, PATHNAMES *, FILE**, BOOL bStandardOnly ); +BOOL OpenInclude( char *, PATHNAMES *, FILE**, BOOL bStandardOnly, char * ); #define ISNAME(c) (isalnum(c) || (c)=='_' || (c) > 0x7e) #define MAX_NAME 255 @@ -161,12 +161,13 @@ char * _szPErrors[] = */ char * _szPWarnings[] = { - "1Non directive in include file" + "3Non directive in include file %s(%s)" }; int ParseDirective( char* sLine ) { char sDirective[MAX_NAME]; + char szInclude[_POSIX_PATH_MAX]; int i; FILE* handl_i; @@ -218,10 +219,10 @@ int ParseDirective( char* sLine ) *(sLine+i) = '\0'; /* if ((handl_i = fopen(sLine, "r")) == NULL) */ - if ( !OpenInclude( sLine, _pIncludePath, &handl_i, (cDelimChar == '>') ) ) + if ( !OpenInclude( sLine, _pIncludePath, &handl_i, (cDelimChar == '>'), szInclude ) ) GenError( _szPErrors, 'P', ERR_CANNOT_OPEN, sLine, NULL ); lInclude++; - Hp_Parse(handl_i, 0 ); + Hp_Parse(handl_i, 0, szInclude ); lInclude--; fclose(handl_i); } @@ -2217,23 +2218,23 @@ int NextParm ( char** sSource, char* sDest ) return lenName; } -BOOL OpenInclude( char * szFileName, PATHNAMES *pSearch, FILE** fptr, BOOL bStandardOnly ) +BOOL OpenInclude( char * szFileName, PATHNAMES *pSearch, FILE** fptr, BOOL bStandardOnly, char * szInclude ) { PHB_FNAME pFileName; - char szFName[ _POSIX_PATH_MAX ]; /* filename to parse */ HB_TRACE(("OpenInclude(%s, %p, %p, %d)", szFileName, pSearch, fptr, (int) bStandardOnly)); if ( bStandardOnly ) { *fptr = 0; + szInclude[ 0 ] = '\0'; } else { pFileName = hb_fsFNameSplit( szFileName ); pFileName->szPath = _pFileName->szPath; - hb_fsFNameMerge( szFName, pFileName ); - *fptr = fopen( szFName, "r" ); + hb_fsFNameMerge( szInclude, pFileName ); + *fptr = fopen( szInclude, "r" ); hb_xfree( pFileName ); } @@ -2245,8 +2246,8 @@ BOOL OpenInclude( char * szFileName, PATHNAMES *pSearch, FILE** fptr, BOOL bStan while ( pSearch && !*fptr ) { pFileName->szPath = pSearch->szPath; - hb_fsFNameMerge( szFName, pFileName ); - *fptr = fopen( szFName, "r" ); + hb_fsFNameMerge( szInclude, pFileName ); + *fptr = fopen( szInclude, "r" ); pSearch = pSearch->pNext; } hb_xfree( pFileName ); diff --git a/harbour/source/pp/hbppint.c b/harbour/source/pp/hbppint.c index 59fff7938a..4c1420d1d7 100644 --- a/harbour/source/pp/hbppint.c +++ b/harbour/source/pp/hbppint.c @@ -58,7 +58,7 @@ void Hbpp_init ( void ); int PreProcess( FILE *, FILE *, char * ); -int Hp_Parse( FILE *, FILE * ); +int Hp_Parse( FILE *, FILE *, char * ); int iBuffer, lenBuffer; BOOL _bPPO = 0; @@ -149,13 +149,14 @@ int PreProcess( FILE * handl_i, FILE * handl_o, char * sOut ) return lens; } -int Hp_Parse( FILE * handl_i, FILE * handl_o ) +int Hp_Parse( FILE * handl_i, FILE * handl_o, char * szSource ) { char * sBuffer = ( char * ) hb_xgrab( BUFF_SIZE ); /* File read buffer */ char * ptr; + char szLine[ 16 ]; int lContinue = 0; int iBuffer = 10, lenBuffer = 10; - int lens = 0, rdlen; + int lens = 0, rdlen, iLine = 0; HB_TRACE(("Hp_Parse(%p, %p)", handl_i, handl_o)); @@ -163,6 +164,7 @@ int Hp_Parse( FILE * handl_i, FILE * handl_o ) sBuffer, &lenBuffer, &iBuffer ) ) >= 0 ) { lens += rdlen; + iLine++; if( sLine[ lens - 1 ] == ';' ) { @@ -191,7 +193,10 @@ int Hp_Parse( FILE * handl_i, FILE * handl_o ) *sLine = '\0'; } else - GenWarning( _szPWarnings, 'I', WARN_NONDIRECTIVE, NULL, NULL ); + { + sprintf( szLine, "%d", iLine ); + GenWarning( _szPWarnings, 'I', WARN_NONDIRECTIVE, szSource, szLine ); + } } } } diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index 7293c36702..ac8a2849b5 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -86,7 +86,7 @@ be ahead of any other #include statements! */ #include "hbwinapi.h" -#ifdef HARBOUR_USE_WIN +#if defined(_Windows) || defined(WINNT) #define INPUT_BUFFER_LEN 128 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... */ @@ -180,8 +180,6 @@ static HB_inkey_enum s_eventmask; void hb_releaseCPU( void ) { - HB_TRACE(("releaseCPU()")); - /* TODO: Add code to release time slices on all platforms */ #if defined(_Windows) || defined(__MINGW32__) /* according to ms docs, you should not do this in a Win app. dos only */ @@ -203,7 +201,7 @@ void hb_releaseCPU( void ) geninterrupt( 0x2f ); _AH = 0; _AL ^= 0x80; - #else + #elif ! defined(__DJGPP__) union REGS regs; regs.h.ah = 0x16; regs.h.al = 0x80; @@ -218,6 +216,7 @@ void hb_releaseCPU( void ) #elif defined(OS_UNIX_COMPATIBLE) #else #endif + HB_TRACE(("releaseCPU()")); } int hb_inkey( double seconds, HB_inkey_enum event_mask, BOOL wait, BOOL forever ) diff --git a/harbour/source/rtl/oemansi.c b/harbour/source/rtl/oemansi.c index 67f7bc85f5..93e18509ef 100644 --- a/harbour/source/rtl/oemansi.c +++ b/harbour/source/rtl/oemansi.c @@ -39,7 +39,9 @@ /* NOTE: The following #include "hbwinapi.h" must be ahead of any other #include statements! */ #include "hbwinapi.h" -#include +#if defined(_Windows) || defined(WINNT) + #include +#endif #include "extend.h" #include "itemapi.h"