diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c0ae617b29..d89e05dd16 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,113 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-01-05 13:33 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbgtcore.h + * harbour/source/rtl/hbgtcore.c + * changed BYTE bClearColor to USHORT uiClearColor + + + The following modifications were made by Viktor Szakats, + (2008-11-22 16:15 UTC+0100 - 2008-12-19 12:56 UTC+0100) + Many thanks. It's the first part without CP conversions in OS calls which + I will want to check yet. Please tests MS-Windows only modifications. + + * harbour/make_vc.mak + * harbour/contrib/mtpl_vc.mak + + Added support for A_USR. + + * harbour/include/set.ch + * harbour/include/hbextern.ch + * harbour/source/vm/cmdarg.c + * harbour/source/vm/set.c + * harbour/source/rtl/tgetlist.prg + * harbour/source/rtl/gete.c + * harbour/contrib/hbhpdf/harupdf.c + * formatting + + * harbour/source/rtl/hbffind.c + * Changed few places to use sizeof() instead of + explicit size macro. + + * harbour/source/vm/extrap.c + + Added module listing. (also supports Win64) + + * harbour/source/common/hbver.c + + Added Intel C compiler detection. (from xhb) + + Added Wine detection (unofficial but stable looking + detection method. There intentionally doesn't exist + an official method to do this detection, yet there + are cases when this is necessary. It's also essential + for error reports.) + See also: + http://www.mail-archive.com/wine-devel@winehq.org/msg48659.html + + * harbour/source/common/hbfopen.c + ! Reverted recent change to use fopen_s(). fopen_s() + will always open in exclusive mode, so it could create + incompatibilities. + + * harbour/source/codepage/cpbgmik.c + ! Fixed BGMIK collation encoding. Someone familiar with + BG CPs please confirm this, but previously it was + almost certainly broken, as the collation was identical + to BG866. + + * harbour/source/rtl/diskspac.c + * harbour/source/rtl/disksphb.c + ! GetModuleHandleA() -> GetModuleHandle() + ; NOTE: GetModuleHandleA() WinCE emulation in + source/common/wince.c might be unnecessary + after this change. + + * harbour/source/rtl/memoedit.prg + * harbour/source/rtl/teditor.prg + ! Cleaned insert handling. It now won't anymore mess up + the cursor on instantiation (in New() method). Internal + :lInsert state replaced by Set( _SET_INSERT ). Cursor + is only touched in the editing loop. + + * harbour/source/rtl/version.c + ! HB_VERSION( HB_VERSION_BUILD_DATE ): Fixed month + being off by one. + + * harbour/contrib/hbmzip/hbmzip.c + ! Fixed typo which caused timestamps stored in .zip files + to be wrong. + + * harbour/contrib/hbhpdf/tests/harupdf.prg + ! Minor typo in code. + + * harbour/contrib/rddads/rddads.h + + Added detection for ACE 9.10. + + * harbour/contrib/hbtip/sendmail.prg + ! Stricter parameter checking in hb_SendMail(). + + * harbour/contrib/examples/dbu/hb_dbu.dif + + Added SET DATE ANSI and SET CENTURY ON + + * harbour/source/rtl/gtxwc/gtxwc.c + + Generating HB_K_RESIZE keystrokes on screen resize. + This way it's working similarly to gtwvt. + ! Typos in comments. + + * harbour/source/rtl/gtwin/gtwin.c + ! Fixed HB_GTI_KBDSHIFTS not working in console mode. + Replaced GetKeyboardState() call with GetKeyState() calls. + + * harbour/source/rtl/gtwvt/gtwvt.c + + Added 'layered' window support. It's enabled on W2K + and above (and only when not in Terminal Services + environment, because it makes it perform worse). This + way the screen is also properly displayed regardless + of what the Harbour application does. It also fixes + numerous paint artifacts, when GTWVT window was in + the background and another window is moved in front + of it. + ! Fixed only generate HB_K_RESIZE keystrokes when + resize mode is HB_GTI_RESIZEMODE_ROWS. + 2008-12-31 14:12 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbexprb.c + added optimizations for var := var => var = diff --git a/harbour/contrib/examples/dbu/hb_dbu.dif b/harbour/contrib/examples/dbu/hb_dbu.dif index 85afe780e2..4c69b0dad9 100644 --- a/harbour/contrib/examples/dbu/hb_dbu.dif +++ b/harbour/contrib/examples/dbu/hb_dbu.dif @@ -1,7 +1,17 @@ diff -u -x make_dif.bat ..\ori_src\DBU.PRG .\DBU.PRG ---- ..\ori_src\DBU.PRG Thu Mar 04 05:20:00 1993 -+++ .\DBU.PRG Fri May 30 15:37:11 2008 -@@ -378,13 +378,13 @@ +--- ..\ori_src\DBU.PRG Thu Mar 04 04:20:00 1993 ++++ .\DBU.PRG Fri Dec 19 12:56:30 2008 +@@ -60,6 +60,9 @@ + SAVE SCREEN && the screen you save... + SET SCOREBOARD OFF && who's keeping score, anyhow + SET KEY 28 TO && some folks need help ++ ++ SET DATE ANSI ++ SET CENTURY ON + + IF (ISCOLOR() .OR. "/C" $ UPPER(param2)) .AND. .NOT. "/M" $ UPPER(param2) + * make it pretty +@@ -378,13 +381,13 @@ ENDIF @@ -19,7 +29,7 @@ diff -u -x make_dif.bat ..\ori_src\DBU.PRG .\DBU.PRG OTHERWISE * file not found..ignore command line -@@ -395,7 +395,7 @@ +@@ -395,7 +398,7 @@ IF .NOT. EMPTY(com_line) * command line file exists @@ -29,8 +39,8 @@ diff -u -x make_dif.bat ..\ori_src\DBU.PRG .\DBU.PRG view_file = com_line set_from(.F.) && restore view diff -u -x make_dif.bat ..\ori_src\DBUCOPY.PRG .\DBUCOPY.PRG ---- ..\ori_src\DBUCOPY.PRG Thu Mar 04 05:20:00 1993 -+++ .\DBUCOPY.PRG Fri May 30 15:41:33 2008 +--- ..\ori_src\DBUCOPY.PRG Thu Mar 04 04:20:00 1993 ++++ .\DBUCOPY.PRG Fri May 30 14:41:33 2008 @@ -104,7 +104,7 @@ * DBF for normal mode @@ -86,8 +96,8 @@ diff -u -x make_dif.bat ..\ori_src\DBUCOPY.PRG .\DBUCOPY.PRG ENDIF diff -u -x make_dif.bat ..\ori_src\DBUINDX.PRG .\DBUINDX.PRG ---- ..\ori_src\DBUINDX.PRG Thu Mar 04 05:20:00 1993 -+++ .\DBUINDX.PRG Fri May 30 15:40:42 2008 +--- ..\ori_src\DBUINDX.PRG Thu Mar 04 04:20:00 1993 ++++ .\DBUINDX.PRG Fri May 30 14:40:42 2008 @@ -240,7 +240,7 @@ INDEX ON &k_exp TO &filename CLOSE INDEX @@ -98,8 +108,8 @@ diff -u -x make_dif.bat ..\ori_src\DBUINDX.PRG .\DBUINDX.PRG * add only .ntx files in the current directory diff -u -x make_dif.bat ..\ori_src\DBUSTRU.PRG .\DBUSTRU.PRG ---- ..\ori_src\DBUSTRU.PRG Thu Mar 04 05:20:00 1993 -+++ .\DBUSTRU.PRG Fri May 30 15:34:49 2008 +--- ..\ori_src\DBUSTRU.PRG Thu Mar 04 04:20:00 1993 ++++ .\DBUSTRU.PRG Fri May 30 14:34:49 2008 @@ -811,7 +811,7 @@ is_insert = .F. filename = stru_name @@ -143,8 +153,8 @@ diff -u -x make_dif.bat ..\ori_src\DBUSTRU.PRG .\DBUSTRU.PRG i = afull(dbf_list) + 1 diff -u -x make_dif.bat ..\ori_src\DBUUTIL.PRG .\DBUUTIL.PRG ---- ..\ori_src\DBUUTIL.PRG Thu Mar 04 05:20:00 1993 -+++ .\DBUUTIL.PRG Fri May 30 15:36:26 2008 +--- ..\ori_src\DBUUTIL.PRG Thu Mar 04 04:20:00 1993 ++++ .\DBUUTIL.PRG Fri May 30 14:36:26 2008 @@ -2152,7 +2152,7 @@ IF FILE(M->filename) * only if the file exists @@ -155,8 +165,8 @@ diff -u -x make_dif.bat ..\ori_src\DBUUTIL.PRG .\DBUUTIL.PRG k_pos = 23 diff -u -x make_dif.bat ..\ori_src\DBUVIEW.PRG .\DBUVIEW.PRG ---- ..\ori_src\DBUVIEW.PRG Thu Mar 04 05:20:00 1993 -+++ .\DBUVIEW.PRG Fri May 30 15:36:04 2008 +--- ..\ori_src\DBUVIEW.PRG Thu Mar 04 04:20:00 1993 ++++ .\DBUVIEW.PRG Fri May 30 14:36:04 2008 @@ -1110,7 +1110,7 @@ IF .NOT. (RAT(".", M->filename) > RAT("\", M->filename)) diff --git a/harbour/contrib/hbhpdf/harupdf.c b/harbour/contrib/hbhpdf/harupdf.c index ffb806b51e..afb7238b8f 100644 --- a/harbour/contrib/hbhpdf/harupdf.c +++ b/harbour/contrib/hbhpdf/harupdf.c @@ -626,14 +626,14 @@ HB_FUNC( HPDF_PAGE_SETROTATE ) */ HB_FUNC( HPDF_PAGE_GETWIDTH ) { - hb_retnd( (double) HPDF_Page_GetWidth( ( HPDF_Page ) hb_parptr( 1 ) ) ); + hb_retnd( ( double ) HPDF_Page_GetWidth( ( HPDF_Page ) hb_parptr( 1 ) ) ); } /*----------------------------------------------------------------------*/ /* HPdf_Page_GetHeight( hPage ) -> nHeight */ HB_FUNC( HPDF_PAGE_GETHEIGHT ) { - hb_retnd( (double) HPDF_Page_GetHeight( ( HPDF_Page ) hb_parptr( 1 ) ) ); + hb_retnd( ( double ) HPDF_Page_GetHeight( ( HPDF_Page ) hb_parptr( 1 ) ) ); } /*----------------------------------------------------------------------*/ /* HPdf_Page_CreateDestination( hPage ) -> hDestn @@ -747,7 +747,7 @@ HB_FUNC( HPDF_PAGE_GETCURRENTFONT ) */ HB_FUNC( HPDF_PAGE_GETCURRENTFONTSIZE ) { - hb_retnd( (double) HPDF_Page_GetCurrentFontSize( ( HPDF_Page ) hb_parptr( 1 ) ) ); + hb_retnd( ( double ) HPDF_Page_GetCurrentFontSize( ( HPDF_Page ) hb_parptr( 1 ) ) ); } /*----------------------------------------------------------------------*/ /* HPdf_Page_GetTransMatrix( hPage ) -> aMatrix[ ] @@ -773,7 +773,7 @@ HB_FUNC( HPDF_PAGE_GETTRANSMATRIX ) */ HB_FUNC( HPDF_PAGE_GETLINEWIDTH ) { - hb_retnd( (double) HPDF_Page_GetLineWidth( ( HPDF_Page ) hb_parptr( 1 ) ) ); + hb_retnd( ( double ) HPDF_Page_GetLineWidth( ( HPDF_Page ) hb_parptr( 1 ) ) ); } /*----------------------------------------------------------------------*/ /* HPdf_Page_GetLineCap( hPage ) -> nLineCapStyle @@ -824,49 +824,49 @@ HB_FUNC( HPDF_PAGE_GETDASH ) */ HB_FUNC( HPDF_PAGE_GETFLAT ) { - hb_retnd( (double) HPDF_Page_GetFlat( ( HPDF_Page ) hb_parptr( 1 ) ) ); + hb_retnd( ( double ) HPDF_Page_GetFlat( ( HPDF_Page ) hb_parptr( 1 ) ) ); } /*----------------------------------------------------------------------*/ /* HPdf_Page_GetCharSpace( hPage ) -> nCurCharSpace */ HB_FUNC( HPDF_PAGE_GETCHARSPACE ) { - hb_retnd( (double) HPDF_Page_GetCharSpace( ( HPDF_Page ) hb_parptr( 1 ) ) ); + hb_retnd( ( double ) HPDF_Page_GetCharSpace( ( HPDF_Page ) hb_parptr( 1 ) ) ); } /*----------------------------------------------------------------------*/ /* HPdf_Page_GetWordSpace( hPage ) -> nCurWordSpace */ HB_FUNC( HPDF_PAGE_GETWORDSPACE ) { - hb_retnd( (double) HPDF_Page_GetWordSpace( ( HPDF_Page ) hb_parptr( 1 ) ) ); + hb_retnd( ( double ) HPDF_Page_GetWordSpace( ( HPDF_Page ) hb_parptr( 1 ) ) ); } /*----------------------------------------------------------------------*/ /* HPdf_Page_GetHorizontalScalling( hPage ) -> nHorzScaling */ HB_FUNC( HPDF_PAGE_GETHORIZONTALSCALLING ) { - hb_retnd( (double) HPDF_Page_GetHorizontalScalling( ( HPDF_Page ) hb_parptr( 1 ) ) ); + hb_retnd( ( double ) HPDF_Page_GetHorizontalScalling( ( HPDF_Page ) hb_parptr( 1 ) ) ); } /*----------------------------------------------------------------------*/ /* HPdf_Page_GetTextLeading( hPage ) -> nTextLeading */ HB_FUNC( HPDF_PAGE_GETTEXTLEADING ) { - hb_retnd( (double) HPDF_Page_GetTextLeading( ( HPDF_Page ) hb_parptr( 1 ) ) ); + hb_retnd( ( double ) HPDF_Page_GetTextLeading( ( HPDF_Page ) hb_parptr( 1 ) ) ); } /*----------------------------------------------------------------------*/ /* HPdf_Page_GetTextRenderingMode( hPage ) -> nTextRenderingMode */ HB_FUNC( HPDF_PAGE_GETTEXTRENDERINGMODE ) { - hb_retnd( (double) HPDF_Page_GetTextRenderingMode( ( HPDF_Page ) hb_parptr( 1 ) ) ); + hb_retnd( ( double ) HPDF_Page_GetTextRenderingMode( ( HPDF_Page ) hb_parptr( 1 ) ) ); } /*----------------------------------------------------------------------*/ /* HPdf_Page_GetTextRise( hPage ) -> nTextRise */ HB_FUNC( HPDF_PAGE_GETTEXTRISE ) { - hb_retnd( (double) HPDF_Page_GetTextRise( ( HPDF_Page ) hb_parptr( 1 ) ) ); + hb_retnd( ( double ) HPDF_Page_GetTextRise( ( HPDF_Page ) hb_parptr( 1 ) ) ); } /*----------------------------------------------------------------------*/ /* HPdf_Page_GetRGBFill( hPage ) -> aRGBFill[ nRed, nGreen, nBlue ] @@ -939,28 +939,28 @@ HB_FUNC( HPDF_PAGE_GETCMYKSTROKE ) */ HB_FUNC( HPDF_PAGE_GETGRAYFILL ) { - hb_retnd( (double) HPDF_Page_GetGrayFill( ( HPDF_Page ) hb_parptr( 1 ) ) ); + hb_retnd( ( double ) HPDF_Page_GetGrayFill( ( HPDF_Page ) hb_parptr( 1 ) ) ); } /*----------------------------------------------------------------------*/ /* HPdf_Page_GetGrayStroke( hPage ) -> nGrayStrokeValue */ HB_FUNC( HPDF_PAGE_GETGRAYSTROKE ) { - hb_retnd( (double) HPDF_Page_GetGrayStroke( ( HPDF_Page ) hb_parptr( 1 ) ) ); + hb_retnd( ( double ) HPDF_Page_GetGrayStroke( ( HPDF_Page ) hb_parptr( 1 ) ) ); } /*----------------------------------------------------------------------*/ /* HPdf_Page_GetStrokingColorSpace( hPage ) -> nStrokingSpace */ HB_FUNC( HPDF_PAGE_GETSTROKINGCOLORSPACE ) { - hb_retnd( (double) HPDF_Page_GetStrokingColorSpace( ( HPDF_Page ) hb_parptr( 1 ) ) ); + hb_retnd( ( double ) HPDF_Page_GetStrokingColorSpace( ( HPDF_Page ) hb_parptr( 1 ) ) ); } /*----------------------------------------------------------------------*/ /* HPdf_Page_GetFillingColorSpace( hPage ) -> nFillingColorSpace */ HB_FUNC( HPDF_PAGE_GETFILLINGCOLORSPACE ) { - hb_retnd( (double) HPDF_Page_GetFillingColorSpace( ( HPDF_Page ) hb_parptr( 1 ) ) ); + hb_retnd( ( double ) HPDF_Page_GetFillingColorSpace( ( HPDF_Page ) hb_parptr( 1 ) ) ); } /*----------------------------------------------------------------------*/ /* HPdf_Page_GetTextMatrix( hPage ) -> aMatrix[ ] diff --git a/harbour/contrib/hbhpdf/tests/harupdf.prg b/harbour/contrib/hbhpdf/tests/harupdf.prg index de699e10e4..56648c0a26 100644 --- a/harbour/contrib/hbhpdf/tests/harupdf.prg +++ b/harbour/contrib/hbhpdf/tests/harupdf.prg @@ -138,7 +138,7 @@ Function DesignHaruPDF( cFileToSave ) /* output subtitle. */ HPDF_Page_BeginText( page ) HPDF_Page_SetFontAndSize( page, def_font, 16 ) - HPDF_Page_TextOut( page, 60, height - 80, "") + HPDF_Page_TextOut( page, 60, height - 80, "") HPDF_Page_EndText( page ) HPDF_Page_BeginText( page ) @@ -643,7 +643,7 @@ Static Function Page_Text( pdf ) font := HPDF_GetFont(pdf, "Courier-Bold", NIL) HPDF_Page_SetFontAndSize(page, font, 30) - for i := 0 to len(SAMP_TXT) + for i := 1 to len(SAMP_TXT) rad1 :=(angle2 - 90) / 180 * 3.141592 rad2 := angle2 / 180 * 3.141592 diff --git a/harbour/contrib/hbmzip/hbmzip.c b/harbour/contrib/hbmzip/hbmzip.c index 52ba097ef3..9e2cfb7b1a 100644 --- a/harbour/contrib/hbmzip/hbmzip.c +++ b/harbour/contrib/hbmzip/hbmzip.c @@ -807,7 +807,7 @@ static int hb_zipStoreFile( zipFile hZip, const char* szFileName, const char* sz } else { - hFile = hb_fsOpen( (BYTE*) szFileName, FO_READ ); + hFile = hb_fsOpen( ( BYTE * ) szFileName, FO_READ ); if( hFile != FS_ERROR ) { @@ -817,7 +817,7 @@ static int hb_zipStoreFile( zipFile hZip, const char* szFileName, const char* sz SYSTEMTIME st; if( GetFileTime( ( HANDLE ) hb_fsGetOsHandle( hFile ), NULL, NULL, &ftutc ) && - FileTimeToLocalFileTime( &ftutc, &ft ) & + FileTimeToLocalFileTime( &ftutc, &ft ) && FileTimeToSystemTime( &ft, &st ) ) { zfi.tmz_date.tm_sec = st.wSecond; diff --git a/harbour/contrib/hbtip/sendmail.prg b/harbour/contrib/hbtip/sendmail.prg index 18840fd33d..3a55107f16 100644 --- a/harbour/contrib/hbtip/sendmail.prg +++ b/harbour/contrib/hbtip/sendmail.prg @@ -93,17 +93,42 @@ FUNCTION HB_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF LOCAL lConnect := .T. LOCAL oPop - DEFAULT cUser TO "" - DEFAULT cPass TO "" - DEFAULT nPort TO 25 - DEFAULT aFiles TO {} - DEFAULT nPriority TO 3 - DEFAULT lRead TO .F. - DEFAULT lTrace TO .F. - DEFAULT lPopAuth TO .T. - DEFAULT lNoAuth TO .F. - DEFAULT nTimeOut TO 100 - DEFAULT cReplyTo TO "" + IF ! ISCHARACTER( cServer ) .OR. Empty( cServer ) + cServer := "localhost" + ENDIF + IF ! ISCHARACTER( cUser ) + cUser := "" + ENDIF + IF ! ISCHARACTER( cPass ) + cPass := "" + ENDIF + IF ! ISNUMBER( nPort ) .OR. Empty( nPort ) + nPort := 25 + ENDIF + IF ! ISARRAY( aFiles ) + aFiles := {} + ENDIF + IF ! ISNUMBER( nPriority ) + nPriority := 3 + ENDIF + IF ! ISLOGICAL( lRead ) + lRead := .F. + ENDIF + IF ! ISLOGICAL( lTrace ) + lTrace := .F. + ENDIF + IF ! ISLOGICAL( lPopAuth ) + lPopAuth := .T. + ENDIF + IF ! ISLOGICAL( lNoAuth ) + lNoAuth := .F. + ENDIF + IF ! ISNUMBER( nTimeOut ) + nTimeOut := 100 + ENDIF + IF ! ISCHARACTER( cReplyTo ) + cReplyTo := "" + ENDIF cUser := StrTran( cUser, "@", "&at;" ) @@ -120,43 +145,49 @@ FUNCTION HB_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF IF Len( aTo ) > 1 FOR EACH cTo IN aTo IF cTo:__enumIndex() != 1 - cTmp += cTo + "," + IF !Empty( cTo ) + cTmp += cTo + "," + ENDIF ENDIF NEXT - cTmp := Substr( cTmp, 1, Len( cTmp ) - 1 ) + cTmp := SubStr( cTmp, 1, Len( cTmp ) - 1 ) ENDIF cTo := aTo[ 1 ] IF Len( cTmp ) > 0 cTo += "," + cTmp ENDIF - ELSE - cTo := Alltrim( aTo ) + ELSEIF ISCHARACTER( aTo ) + cTo := AllTrim( aTo ) ENDIF // CC (Carbon Copy) IF ISARRAY( aCC ) - IF Len(aCC) >0 + IF Len( aCC ) > 0 FOR EACH cTmp IN aCC - cCC += cTmp + "," + IF !Empty( cTmp ) + cCC += cTmp + "," + ENDIF NEXT - cCC := Substr( cCC, 1, Len( cCC ) - 1 ) + cCC := SubStr( cCC, 1, Len( cCC ) - 1 ) ENDIF ELSEIF ISCHARACTER(aCC) - cCC := Alltrim( aCC ) + cCC := AllTrim( aCC ) ENDIF // BCC (Blind Carbon Copy) IF ISARRAY(aBCC) - IF Len(aBCC)>0 + IF Len(aBCC) > 0 FOR EACH cTmp IN aBCC - cBCC += cTmp + "," + IF !Empty( cTmp ) + cBCC += cTmp + "," + ENDIF NEXT - cBCC := Substr( cBCC, 1, Len( cBCC ) - 1 ) + cBCC := SubStr( cBCC, 1, Len( cBCC ) - 1 ) ENDIF ELSEIF ISCHARACTER(aBCC) - cBCC := Alltrim( aBCC ) + cBCC := AllTrim( aBCC ) ENDIF IF cPopServer != NIL .AND. lPopAuth @@ -235,7 +266,7 @@ FUNCTION HB_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF IF !lNoAuth - IF oInMail:Opensecure() + IF oInMail:OpenSecure() WHILE .T. oInMail:GetOk() diff --git a/harbour/contrib/mtpl_vc.mak b/harbour/contrib/mtpl_vc.mak index 8593a4aa23..86d733dfa3 100644 --- a/harbour/contrib/mtpl_vc.mak +++ b/harbour/contrib/mtpl_vc.mak @@ -107,6 +107,8 @@ MKLIB = lib.exe HB_VISUALC_VER = 80 !endif +ARFLAGS = /nologo $(A_USR) + # C Compiler Flags !if "$(HB_BUILD_OPTIM)" != "no" !if $(HB_VISUALC_VER) >= 80 @@ -167,7 +169,7 @@ ALL_HEADERS = $(PRG_HEADERS) $(C_HEADERS) #********************************************************** $(LIB_PATH) : $(LIB_OBJS) @if exist "$@" $(DEL) "$@" > nul - $(MKLIB) /nologo /out:$@ @<< + $(MKLIB) $(ARFLAGS) /out:$@ @<< $** <<$(HB_KEEPSTATE) #********************************************************** diff --git a/harbour/contrib/rddads/rddads.h b/harbour/contrib/rddads/rddads.h index c6db2569f9..5dd3577233 100644 --- a/harbour/contrib/rddads/rddads.h +++ b/harbour/contrib/rddads/rddads.h @@ -66,20 +66,22 @@ #include "ace.h" /* Autodetect ACE version. */ -#if defined(ADS_NOTIFICATION_CONNECTION) - #define _ADS_LIB_VERSION 900 /* or upper */ +#if defined(ADS_KEEP_AOF_PLAN) + #define _ADS_LIB_VERSION 910 /* or upper */ +#elif defined(ADS_NOTIFICATION_CONNECTION) + #define _ADS_LIB_VERSION 900 #elif defined(ADS_UDP_IP_CONNECTION) - #define _ADS_LIB_VERSION 810 /* or upper */ + #define _ADS_LIB_VERSION 810 #elif defined(ADS_REPLICATION_CONNECTION) - #define _ADS_LIB_VERSION 800 /* or upper */ + #define _ADS_LIB_VERSION 800 #elif defined(ADS_NOT_AUTO_OPEN) - #define _ADS_LIB_VERSION 710 /* or upper */ + #define _ADS_LIB_VERSION 710 #elif defined(ADS_FTS_INDEX_ORDER) - #define _ADS_LIB_VERSION 700 /* or upper */ + #define _ADS_LIB_VERSION 700 #elif defined(ADS_COMPRESS_ALWAYS) - #define _ADS_LIB_VERSION 620 /* or upper */ + #define _ADS_LIB_VERSION 620 #elif defined(ADS_USER_DEFINED) - #define _ADS_LIB_VERSION 611 /* or upper */ + #define _ADS_LIB_VERSION 611 #else #define _ADS_LIB_VERSION 500 #endif diff --git a/harbour/include/hbextern.ch b/harbour/include/hbextern.ch index 5c9f285b7f..177236ebe9 100644 --- a/harbour/include/hbextern.ch +++ b/harbour/include/hbextern.ch @@ -328,7 +328,7 @@ EXTERNAL VERSION EXTERNAL WORD EXTERNAL YEAR -/* Harbour extensions violating extension namespace rules +/* Harbour extensions violating extension namespace rules (but not marked as HB_EXTENSION). */ EXTERNAL RDDINFO diff --git a/harbour/include/hbgtcore.h b/harbour/include/hbgtcore.h index b9a36efd82..366c8c3a17 100644 --- a/harbour/include/hbgtcore.h +++ b/harbour/include/hbgtcore.h @@ -319,7 +319,7 @@ typedef struct _HB_GT_BASE USHORT uiDispCount; USHORT uiExtCount; USHORT uiClearChar; - BYTE bClearColor; + USHORT uiClearColor; HB_FHANDLE hStdIn; HB_FHANDLE hStdOut; HB_FHANDLE hStdErr; diff --git a/harbour/include/set.ch b/harbour/include/set.ch index 17832a3d29..9aef27eab1 100644 --- a/harbour/include/set.ch +++ b/harbour/include/set.ch @@ -62,16 +62,16 @@ #define _SET_EPOCH 5 #define _SET_PATH 6 #define _SET_DEFAULT 7 - + #define _SET_EXCLUSIVE 8 #define _SET_SOFTSEEK 9 #define _SET_UNIQUE 10 #define _SET_DELETED 11 - + #define _SET_CANCEL 12 #define _SET_DEBUG 13 #define _SET_TYPEAHEAD 14 - + #define _SET_COLOR 15 #define _SET_CURSOR 16 #define _SET_CONSOLE 17 @@ -83,7 +83,7 @@ #define _SET_PRINTER 23 #define _SET_PRINTFILE 24 #define _SET_MARGIN 25 - + #define _SET_BELL 26 #define _SET_CONFIRM 27 #define _SET_ESCAPE 28 @@ -93,27 +93,27 @@ #define _SET_SCOREBOARD 32 #define _SET_DELIMITERS 33 #define _SET_DELIMCHARS 34 - + #define _SET_WRAP 35 #define _SET_MESSAGE 36 #define _SET_MCENTER 37 #define _SET_SCROLLBREAK 38 - + #define _SET_EVENTMASK 39 /* CA-Cl*pper 5.3 compatible */ - + #define _SET_VIDEOMODE 40 /* CA-Cl*pper 5.3 compatible */ - + #define _SET_MBLOCKSIZE 41 /* CA-Cl*pper 5.3 compatible */ #define _SET_MFILEEXT 42 /* CA-Cl*pper 5.3 compatible */ - + #define _SET_STRICTREAD 43 /* CA-Cl*pper 5.3 compatible */ #define _SET_OPTIMIZE 44 /* CA-Cl*pper 5.3 compatible */ #define _SET_AUTOPEN 45 /* CA-Cl*pper 5.3 compatible */ #define _SET_AUTORDER 46 /* CA-Cl*pper 5.3 compatible */ #define _SET_AUTOSHARE 47 /* CA-Cl*pper 5.3 compatible */ - + #define _SET_COUNT 47 - + #define _SET_LANGUAGE 100 /* Harbour extension */ #define _SET_IDLEREPEAT 101 /* Harbour extension */ #define _SET_FILECASE 102 /* Harbour extension */ diff --git a/harbour/make_vc.mak b/harbour/make_vc.mak index 47d8f6045c..a3bc91e22d 100644 --- a/harbour/make_vc.mak +++ b/harbour/make_vc.mak @@ -98,6 +98,8 @@ MTDLL_OBJS = $(TMP_DLL_OBJS:obj\vc=obj\vc\dll) $(VMMTDLL_LIB_OBJS) # C compiler, Harbour compiler and Linker flags. #********************************************************** +ARFLAGS = /nologo $(A_USR) + # C Compiler Flags !if "$(HB_BUILD_WINCE)" == "yes" @@ -148,7 +150,7 @@ DBGMARKER = d !endif CFLAGSMT = -MT$(DBGMARKER) -DHB_MT_VM -# NOTE: -GA flag should be disabled when building MT _.dlls_, +# NOTE: -GA flag should be disabled when building MT _.dlls_, # as it creates bad code according to MS docs [vszakats]. !if $(HB_VISUALC_VER) >= 70 CFLAGSMT = $(CFLAGSMT) -GA @@ -743,97 +745,97 @@ $(HB_DEST_DIRS) $(HB_BIN_INSTALL) $(HB_LIB_INSTALL) $(HB_INC_INSTALL): # LIBRARY Targets BUILD rules #********************************************************** $(HBMAINSTD_LIB): $(HBMAINSTD_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(HBMAINWIN_LIB): $(HBMAINWIN_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(COMMON_LIB) : $(COMMON_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(PP_LIB) : $(PP_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(COMPILER_LIB) : $(COMPILER_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(VM_LIB) : $(VM_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(VMMT_LIB) : $(VMMT_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(RTL_LIB) : $(RTL_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(MACRO_LIB) : $(MACRO_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(DEBUG_LIB) : $(DEBUG_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(LANG_LIB) : $(LANG_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(CODEPAGE_LIB) : $(CODEPAGE_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(PCRE_LIB) : $(PCRE_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(HBZLIB_LIB) : $(HBZLIB_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(HBEXTERN_LIB) : $(HBEXTERN_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(RDD_LIB) : $(RDD_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(NULSYS_LIB) : $(NULSYS_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(DBFNTX_LIB) : $(DBFNTX_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(DBFNSX_LIB) : $(DBFNSX_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(DBFCDX_LIB) : $(DBFCDX_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(DBFFPT_LIB) : $(DBFFPT_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(HBSIX_LIB) : $(HBSIX_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(HSX_LIB) : $(HSX_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(USRRDD_LIB) : $(USRRDD_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(GTCGI_LIB) : $(GTCGI_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(GTDOS_LIB) : $(GTDOS_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(GTPCA_LIB) : $(GTPCA_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(GTSTD_LIB) : $(GTSTD_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(GTWIN_LIB) : $(GTWIN_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(GTWVT_LIB) : $(GTWVT_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** $(GTGUI_LIB) : $(GTGUI_LIB_OBJS) - $(MKLIB) /nologo /out:$@ $** + $(MKLIB) $(ARFLAGS) /out:$@ $** #********************************************************** #********************************************************** diff --git a/harbour/source/codepage/cpbgmik.c b/harbour/source/codepage/cpbgmik.c index 1ad8e3c6f2..78f800582b 100644 --- a/harbour/source/codepage/cpbgmik.c +++ b/harbour/source/codepage/cpbgmik.c @@ -86,7 +86,7 @@ static HB_CODEPAGE s_codepage = { "BGMIK", HB_CPID_MIK, HB_UNITB_MIK, NUMBER_OF_CHARACTERS, "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ", - " ”¢£¤„¦§Ø©Ŗ«¬­®Æąįāćäåęēčéźėģķīļ", + " ”¢£¤„¦§Ø©Ŗ«¬­®Æ°±²³“µ¶·ø¹ŗ»¼½¾æ", IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; HB_CODEPAGE_INIT( BGMIK ) diff --git a/harbour/source/common/hbfopen.c b/harbour/source/common/hbfopen.c index 90989ecdb7..5a6a938a97 100644 --- a/harbour/source/common/hbfopen.c +++ b/harbour/source/common/hbfopen.c @@ -56,14 +56,8 @@ FILE * hb_fopen( const char *path, const char *mode ) { BOOL fFree; char * pszFile = ( char * ) hb_fsNameConv( ( BYTE * ) path, &fFree ); - FILE * file; -#if defined( _MSC_VER ) && _MSC_VER >= 1400 - file = NULL; - fopen_s( &file, pszFile, mode ); -#else - file = fopen( pszFile, mode ); -#endif + FILE * file = fopen( pszFile, mode ); if( fFree ) hb_xfree( pszFile ); diff --git a/harbour/source/common/hbver.c b/harbour/source/common/hbver.c index f86035227b..ca075c59e6 100644 --- a/harbour/source/common/hbver.c +++ b/harbour/source/common/hbver.c @@ -205,7 +205,21 @@ char * hb_verPlatform( void ) if( GetVersionExA( &osVer ) ) { - char * pszName = ""; + /* NOTE: Unofficial Wine detection. + http://www.mail-archive.com/wine-devel@winehq.org/msg48659.html */ + HMODULE hntdll = GetModuleHandle( TEXT( "ntdll.dll" ) ); + const char * pszWine = ""; + const char * pszName = ""; + + if( hntdll ) + { +#if defined(HB_WINCE) + if( GetProcAddress( hntdll, TEXT( "wine_get_version" ) ) ) +#else + if( GetProcAddress( hntdll, "wine_get_version" ) ) +#endif + pszWine = "Wine "; + } switch( osVer.dwPlatformId ) { @@ -260,7 +274,8 @@ char * hb_verPlatform( void ) break; } - hb_snprintf( pszPlatform, PLATFORM_BUF_SIZE + 1, "Windows%s %lu.%lu.%04d", + hb_snprintf( pszPlatform, PLATFORM_BUF_SIZE + 1, "%sWindows%s %lu.%lu.%04d", + pszWine, pszName, ( ULONG ) osVer.dwMajorVersion, ( ULONG ) osVer.dwMinorVersion, @@ -402,6 +417,18 @@ char * hb_verCompiler( void ) iVerMinor = 0; iVerPatch = 0; +#elif defined(__ICL) + + pszName = "Intel(R) C"; + + #if defined(__cplusplus) + hb_strncpy( szSub, "++", sizeof( szSub ) - 1 ); + #endif + + iVerMajor = __ICL / 100; + iVerMinor = __ICL % 100; + iVerPatch = 0; + #elif defined(_MSC_VER) #if (_MSC_VER >= 800) @@ -545,7 +572,7 @@ char * hb_verCompiler( void ) /* NOTE: The caller must free the returned buffer. [vszakats] */ -/* NOTE: +/* NOTE: CA-Cl*pper 5.2e returns: "Clipper (R) 5.2e Intl. (x216) (1995.02.07)" CA-Cl*pper 5.3b returns: "Clipper (R) 5.3b Intl. (Rev. 338) (1997.04.25)" */ diff --git a/harbour/source/rtl/diskspac.c b/harbour/source/rtl/diskspac.c index 80ab4d20ea..ea0934609d 100644 --- a/harbour/source/rtl/diskspac.c +++ b/harbour/source/rtl/diskspac.c @@ -136,7 +136,7 @@ HB_FUNC( DISKSPACE ) #else char szPath[ 4 ]; P_GDFSE pGetDiskFreeSpaceEx = ( P_GDFSE ) - GetProcAddress( GetModuleHandleA( "kernel32.dll" ), + GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ), "GetDiskFreeSpaceExA" ); szPath[ 0 ] = ( char ) uiDrive + 'A' - 1; szPath[ 1 ] = ':'; diff --git a/harbour/source/rtl/disksphb.c b/harbour/source/rtl/disksphb.c index 1ed9f475f3..e8d09c81be 100644 --- a/harbour/source/rtl/disksphb.c +++ b/harbour/source/rtl/disksphb.c @@ -207,7 +207,7 @@ HB_FUNC( HB_DISKSPACE ) } #else P_GDFSE pGetDiskFreeSpaceEx = ( P_GDFSE ) - GetProcAddress( GetModuleHandleA( "kernel32.dll" ), + GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ), "GetDiskFreeSpaceExA" ); if( pGetDiskFreeSpaceEx ) { diff --git a/harbour/source/rtl/gete.c b/harbour/source/rtl/gete.c index 45f9ebfa81..b24cd0babc 100644 --- a/harbour/source/rtl/gete.c +++ b/harbour/source/rtl/gete.c @@ -106,7 +106,9 @@ HB_FUNC( GETENV ) szValue = hb_getenv( pszName ); if( szValue && szValue[ 0 ] != '\0' ) + { hb_retc_buffer( szValue ); + } else { if( szValue ) @@ -134,8 +136,8 @@ HB_FUNC( GETE ) HB_FUNC_EXEC( GETENV ); } -/* NOTE: Harbour extended version of GETENV(). The 2nd parameter - can be used to specify a default value, returned if the +/* NOTE: Harbour extended version of GETENV(). The 2nd parameter + can be used to specify a default value, returned if the requested envvar doesn't exist. [vszakats] */ HB_FUNC( HB_GETENV ) @@ -172,7 +174,9 @@ HB_FUNC( HB_GETENV ) szValue = hb_getenv( pszName ); if( szValue && szValue[ 0 ] != '\0' ) + { hb_retc_buffer( szValue ); + } else { if( szValue ) diff --git a/harbour/source/rtl/gtwin/gtwin.c b/harbour/source/rtl/gtwin/gtwin.c index ef44c4c25c..8a90b90844 100644 --- a/harbour/source/rtl/gtwin/gtwin.c +++ b/harbour/source/rtl/gtwin/gtwin.c @@ -403,6 +403,24 @@ static const ClipKeyCode extKeyTab[CLIP_EXTKEY_COUNT] = { }; +static int hb_gt_win_getKbdState( void ) +{ + int iKbdState = 0; + + if( GetKeyState( VK_SHIFT ) & 0x80 ) iKbdState |= HB_GTI_KBD_SHIFT; + if( GetKeyState( VK_CONTROL ) & 0x80 ) iKbdState |= HB_GTI_KBD_CTRL; + if( GetKeyState( VK_MENU ) & 0x80 ) iKbdState |= HB_GTI_KBD_ALT; + if( GetKeyState( VK_LWIN ) & 0x80 ) iKbdState |= HB_GTI_KBD_LWIN; + if( GetKeyState( VK_RWIN ) & 0x80 ) iKbdState |= HB_GTI_KBD_RWIN; + if( GetKeyState( VK_APPS ) & 0x80 ) iKbdState |= HB_GTI_KBD_MENU; + if( GetKeyState( VK_SCROLL ) & 0x01 ) iKbdState |= HB_GTI_KBD_SCROLOCK; + if( GetKeyState( VK_NUMLOCK ) & 0x01 ) iKbdState |= HB_GTI_KBD_NUMLOCK; + if( GetKeyState( VK_CAPITAL ) & 0x01 ) iKbdState |= HB_GTI_KBD_CAPSLOCK; + if( GetKeyState( VK_INSERT ) & 0x01 ) iKbdState |= HB_GTI_KBD_INSERT; + + return iKbdState; +} + /* *********************************************************************** */ static void hb_gt_win_xSetCursorPos( void ) @@ -1622,7 +1640,7 @@ static BOOL hb_gt_win_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) break; case HB_GTI_KBDSHIFTS: - pInfo->pResult = hb_itemPutNI( pInfo->pResult, hb_gt_w32_getKbdState() ); + pInfo->pResult = hb_itemPutNI( pInfo->pResult, hb_gt_win_getKbdState() ); if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) hb_gt_w32_setKbdState( hb_itemGetNI( pInfo->pNewVal ) ); break; diff --git a/harbour/source/rtl/gtwvt/gtwvt.c b/harbour/source/rtl/gtwvt/gtwvt.c index c4e963c9d5..1a73d842e5 100644 --- a/harbour/source/rtl/gtwvt/gtwvt.c +++ b/harbour/source/rtl/gtwvt/gtwvt.c @@ -84,6 +84,8 @@ #define HB_OS_WIN_32_USED +#define _WIN32_WINNT 0x0500 /* Set to Windows 2000 for WS_EX_LAYERED */ + #include "gtwvt.h" static int s_GtId; @@ -1606,7 +1608,8 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara pWVT->bResizing = FALSE; hb_gt_wvt_FireEvent( pWVT, HB_GTE_RESIZED ); - hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_RESIZE ); + if( pWVT->ResizeMode == HB_GTI_RESIZEMODE_ROWS ) + hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_RESIZE ); return 0; case WM_SIZE: @@ -1616,7 +1619,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara { pWVT->bAlreadySizing = TRUE; - if ( pWVT->ResizeMode == HB_GTI_RESIZEMODE_FONT ) + if( pWVT->ResizeMode == HB_GTI_RESIZEMODE_FONT ) hb_gt_wvt_FitSize( pWVT ); else hb_gt_wvt_FitRows( pWVT ); @@ -1649,7 +1652,8 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara ShowWindow( pWVT->hWnd, SW_NORMAL ); hb_gt_wvt_FireEvent( pWVT, HB_GTE_RESIZED ); - hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_RESIZE ); + if( pWVT->ResizeMode == HB_GTI_RESIZEMODE_ROWS ) + hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_RESIZE ); return 0; } @@ -1739,6 +1743,35 @@ static BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT ) if( !pWVT->hWnd ) hb_errInternal( 10001, "Failed to create WVT window", NULL, NULL ); + if( ! GetSystemMetrics( SM_REMOTESESSION ) ) + { + typedef BOOL ( WINAPI * P_SLWA )( HWND, COLORREF, BYTE, DWORD ); + +#if defined(HB_WINCE) + P_SLWA pSetLayeredWindowAttributes = ( P_SLWA ) + GetProcAddress( GetModuleHandle( TEXT( "user32.dll" ) ), + TEXT( "SetLayeredWindowAttributes" ) ); +#else + P_SLWA pSetLayeredWindowAttributes = ( P_SLWA ) + GetProcAddress( GetModuleHandle( TEXT( "user32.dll" ) ), + "SetLayeredWindowAttributes" ); +#endif + + if( pSetLayeredWindowAttributes ) + { +#if (defined(_MSC_VER) && (_MSC_VER <= 1200 || defined(HB_WINCE)) || defined(__DMC__)) && !defined(HB_ARCH_64BIT) + SetWindowLong( pWVT->hWnd, GWL_EXSTYLE, GetWindowLong( pWVT->hWnd, GWL_EXSTYLE ) | WS_EX_LAYERED ); +#else + SetWindowLongPtr( pWVT->hWnd, GWL_EXSTYLE, GetWindowLongPtr( pWVT->hWnd, GWL_EXSTYLE ) | WS_EX_LAYERED ); +#endif + + pSetLayeredWindowAttributes( pWVT->hWnd, + ( COLORREF ) 0 /* COLORREF crKey */, + 255 /* BYTE bAlpha */, + LWA_ALPHA /* DWORD dwFlags */ ); + } + } + hb_gt_wvt_InitWindow( pWVT, pWVT->ROWS, pWVT->COLS ); /* Set icon */ diff --git a/harbour/source/rtl/gtxwc/gtxwc.c b/harbour/source/rtl/gtxwc/gtxwc.c index 7fc0b3be5b..63b1dba718 100644 --- a/harbour/source/rtl/gtxwc/gtxwc.c +++ b/harbour/source/rtl/gtxwc/gtxwc.c @@ -397,7 +397,7 @@ typedef struct tag_x_wnddef int col; int row; int cursorType; - + /* last cursor position and shape */ int lastCursorCol; int lastCursorRow; @@ -2565,7 +2565,7 @@ static void hb_gt_xwc_RepaintChar( PXWND_DEF wnd, int colStart, int rowStart, in break; case CH_PTS: - /* we use CoordModePrevious so only first point posiotion has to be updated */ + /* we use CoordModePrevious so only first point position has to be updated */ wnd->charTrans[ usCh16 ].u.pts[0].x = (wnd->charTrans[ usCh16 ].u.pts[0].x % wnd->fontWidth ) + icol * wnd->fontWidth; wnd->charTrans[ usCh16 ].u.pts[0].y = (wnd->charTrans[ usCh16 ].u.pts[0].y % wnd->fontHeight ) + irow * wnd->fontHeight; XSetForeground( wnd->dpy, wnd->gc, wnd->pixels[color >> 4] ); @@ -2579,7 +2579,7 @@ static void hb_gt_xwc_RepaintChar( PXWND_DEF wnd, int colStart, int rowStart, in break; case CH_LINE: - /* we use CoordModePrevious so only first point posiotion has to be updated */ + /* we use CoordModePrevious so only first point position has to be updated */ wnd->charTrans[ usCh16 ].u.pts[0].x = (wnd->charTrans[ usCh16 ].u.pts[0].x % wnd->fontWidth ) + icol * wnd->fontWidth; wnd->charTrans[ usCh16 ].u.pts[0].y = (wnd->charTrans[ usCh16 ].u.pts[0].y % wnd->fontHeight ) + irow * wnd->fontHeight; XSetForeground( wnd->dpy, wnd->gc, wnd->pixels[color >> 4] ); @@ -2593,7 +2593,7 @@ static void hb_gt_xwc_RepaintChar( PXWND_DEF wnd, int colStart, int rowStart, in break; case CH_POLY: - /* we use CoordModePrevious so only first point posiotion has to be updated */ + /* we use CoordModePrevious so only first point position has to be updated */ wnd->charTrans[ usCh16 ].u.pts[0].x = (wnd->charTrans[ usCh16 ].u.pts[0].x % wnd->fontWidth ) + icol * wnd->fontWidth; wnd->charTrans[ usCh16 ].u.pts[0].y = (wnd->charTrans[ usCh16 ].u.pts[0].y % wnd->fontHeight ) + irow * wnd->fontHeight; XSetForeground( wnd->dpy, wnd->gc, wnd->pixels[color >> 4] ); @@ -2850,6 +2850,7 @@ static void hb_gt_xwc_UpdateSize( PXWND_DEF wnd ) wnd->fWinResize = FALSE; HB_GTSELF_SETMODE( wnd->pGT, wnd->newHeight / wnd->fontHeight, wnd->newWidth / wnd->fontWidth ); + hb_gt_xwc_AddCharToInputQueue( wnd, HB_K_RESIZE ); } } diff --git a/harbour/source/rtl/hbffind.c b/harbour/source/rtl/hbffind.c index 3c061724b7..114be3efe8 100644 --- a/harbour/source/rtl/hbffind.c +++ b/harbour/source/rtl/hbffind.c @@ -89,14 +89,14 @@ { struct find_t entry; } HB_FFIND_INFO, * PHB_FFIND_INFO; - + #define FA_ARCH _A_ARCH #define FA_DIREC _A_SUBDIR #define FA_HIDDEN _A_HIDDEN #define FA_RDONLY _A_RDONLY #define FA_LABEL _A_VOLID #define FA_SYSTEM _A_SYSTEM - + #define ff_name name #define ff_fsize size #define ff_attrib attrib @@ -408,8 +408,8 @@ char * hb_fsAttrDecode( ULONG ulAttr, char * szAttr ) return szAttr; } -/* Finds the first then the next matching file on - each call. Does low-level (platform dependent +/* Finds the first then the next matching file on + each call. Does low-level (platform dependent filtering if needed. */ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) @@ -441,7 +441,7 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) { PHB_FFIND_INFO info = ( PHB_FFIND_INFO ) ffind->info; - /* Handling HB_FA_LABEL doesn't need any special tricks + /* Handling HB_FA_LABEL doesn't need any special tricks under the DOS platform. */ if( ffind->bFirst ) @@ -521,9 +521,9 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) FIL_STANDARD ) == NO_ERROR && info->findCount > 0; } else - bFound = DosFindNext( info->hFindFile, - &info->entry, - sizeof( info->entry ), + bFound = DosFindNext( info->hFindFile, + &info->entry, + sizeof( info->entry ), &info->findCount ) == NO_ERROR && info->findCount > 0; /* Fill Harbour found file info */ @@ -572,7 +572,7 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) ffind->bFirst = FALSE; ffind->szName[ 0 ] = '\0'; - bFound = GetVolumeInformationA( ffind->pszFileMask, ffind->szName, _POSIX_PATH_MAX, NULL, NULL, NULL, NULL, 0 ); + bFound = GetVolumeInformationA( ffind->pszFileMask, ffind->szName, sizeof( ffind->szName ) - 1, NULL, NULL, NULL, NULL, 0 ); } } else @@ -611,7 +611,7 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) else { #if defined(__XCC__) || __POCC__ >= 500 - /* NOTE: PellesC 5.00.1 will go into an infinite loop if we don't + /* NOTE: PellesC 5.00.1 will go into an infinite loop if we don't split this into two operations. [vszakats] */ ffind->size = ( HB_FOFFSET ) info->pFindFileData.nFileSizeLow; ffind->size += ( HB_FOFFSET ) info->pFindFileData.nFileSizeHigh << 32; @@ -669,7 +669,7 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) info->pattern[ 0 ] = '\0'; /* hb_strncpy( string, pszFileName, sizeof( string ) - 1 ); */ - hb_strncpy( string, ffind->pszFileMask, sizeof( string ) - 1 ); + hb_strncpy( string, ffind->pszFileMask, sizeof( string ) - 1 ); pos = strrchr( string, HB_OS_PATH_DELIM_CHR ); if( pos ) { @@ -774,7 +774,7 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) if( bFound ) { /* Do the conversions common for all platforms */ - ffind->szName[ _POSIX_PATH_MAX ] = '\0'; + ffind->szName[ sizeof( ffind->szName ) - 1 ] = '\0'; ffind->attr = hb_fsAttrFromRaw( raw_attr ); @@ -817,7 +817,7 @@ PHB_FFIND hb_fsFindFirst( const char * pszFileMask, ULONG attrmask ) return NULL; } -/* Finds next matching file, and applies a filter which makes +/* Finds next matching file, and applies a filter which makes searching CA-Cl*pper/MS-DOS compatible. */ BOOL hb_fsFindNext( PHB_FFIND ffind ) diff --git a/harbour/source/rtl/hbgtcore.c b/harbour/source/rtl/hbgtcore.c index ff7f7bd73a..5d80ae80ca 100644 --- a/harbour/source/rtl/hbgtcore.c +++ b/harbour/source/rtl/hbgtcore.c @@ -97,7 +97,7 @@ static void hb_gt_def_BaseInit( PHB_GT_BASE pGT ) pGT->uiDispCount = 0; pGT->uiExtCount = 0; pGT->uiClearChar = ' '; - pGT->bClearColor = 0x07; + pGT->uiClearColor = 0x07; pGT->iHeight = 24; pGT->iWidth = 80; pGT->hStdIn = HB_STDIN_HANDLE; @@ -304,12 +304,12 @@ static void hb_gt_def_GetColorData( PHB_GT pGT, int ** pColorsPtr, int * piColor static int hb_gt_def_GetClearColor( PHB_GT pGT ) { - return pGT->bClearColor; + return pGT->uiClearColor; } static void hb_gt_def_SetClearColor( PHB_GT pGT, int iColor ) { - pGT->bClearColor = iColor; + pGT->uiClearColor = ( USHORT ) ( iColor & 0xff ); } static int hb_gt_def_GetClearChar( PHB_GT pGT ) diff --git a/harbour/source/rtl/memoedit.prg b/harbour/source/rtl/memoedit.prg index 0e8b8459ed..7a3380156c 100644 --- a/harbour/source/rtl/memoedit.prg +++ b/harbour/source/rtl/memoedit.prg @@ -55,6 +55,7 @@ #include "common.ch" #include "inkey.ch" #include "memoedit.ch" +#include "setcurs.ch" // A specialized HBEditor which can simulate MemoEdit() behaviour CREATE CLASS HBMemoEditor INHERIT HBEditor @@ -280,6 +281,8 @@ FUNCTION MemoEdit( cString,; LOCAL oEd + LOCAL nOldCursor + DEFAULT nTop TO 0 DEFAULT nLeft TO 0 DEFAULT nBottom TO MaxRow() @@ -299,12 +302,14 @@ FUNCTION MemoEdit( cString,; oEd:display() IF ! ISLOGICAL( xUserFunction ) .OR. xUserFunction == .T. + nOldCursor := SetCursor( iif( Set( _SET_INSERT ), SC_INSERT, SC_NORMAL ) ) oEd:Edit() IF oEd:Changed() cString := oEd:GetText() // dbu tests for LastKey() == K_CTRL_END, so I try to make it happy HB_SetLastKey( K_CTRL_END ) ENDIF + SetCursor( nOldCursor ) ENDIF RETURN cString diff --git a/harbour/source/rtl/teditor.prg b/harbour/source/rtl/teditor.prg index 7f5b48ba03..eacd5f2839 100644 --- a/harbour/source/rtl/teditor.prg +++ b/harbour/source/rtl/teditor.prg @@ -85,7 +85,7 @@ CREATE CLASS HBEditor METHOD LineColor( nRow ) // Returns color string to use to draw nRow (current line if nRow is empty) METHOD MoveCursor( nKey ) // Move cursor inside text / window (needs a movement key) - METHOD InsertState( lInsState ) // Changes lInsert value and insertion / overstrike mode of editor + METHOD InsertState( lInsState ) // Changes insert state and insertion / overstrike mode of editor METHOD Edit( nPassedKey ) // Handles input (can receive a key in which case handles only this key and then exits) METHOD ExitState() // Returns ::lExitEdit @@ -117,28 +117,27 @@ CREATE CLASS HBEditor PROTECTED: VAR cFile AS STRING INIT "" // name of file being edited - + VAR aText AS ARRAY INIT {} // array with lines of text being edited VAR naTextLen AS NUMERIC INIT 0 // number of lines of text inside aText. - + VAR nTop AS NUMERIC // boundaries of editor window, without box around - VAR nLeft AS NUMERIC - VAR nBottom AS NUMERIC - VAR nRight AS NUMERIC - + VAR nLeft AS NUMERIC + VAR nBottom AS NUMERIC + VAR nRight AS NUMERIC + VAR nFirstCol AS NUMERIC INIT 1 // FirstCol/Row of current text visible inside editor window - VAR nFirstRow AS NUMERIC INIT 1 + VAR nFirstRow AS NUMERIC INIT 1 VAR nRow AS NUMERIC INIT 1 // Cursor position inside aText (nRow) and inside current line of text (nCol) - VAR nCol AS NUMERIC INIT 1 - + VAR nCol AS NUMERIC INIT 1 + VAR nPhysRow AS NUMERIC INIT 0 // Hardware cursor position, I cannot rely on Row()/Col() because I could be inside another VAR nPhysCol AS NUMERIC INIT 0 // application/object and this one could be moving real cursor. If I'm running full // screen nPhysRow will always have the same value as Row() and nPhysCol as Col() - + VAR nNumCols AS NUMERIC INIT 1 // How many columns / rows can be displayed inside editor window - VAR nNumRows AS NUMERIC INIT 1 - - VAR lInsert AS LOGICAL INIT .F. // Is editor in Insert mode or in Overstrike one? + VAR nNumRows AS NUMERIC INIT 1 + VAR nTabWidth AS NUMERIC INIT 8 // Size of Tab chars VAR lEditAllow AS LOGICAL INIT .T. // Are changes to text allowed? VAR lSaved AS LOGICAL INIT .F. // True if user exited editor with K_CTRL_W @@ -146,7 +145,7 @@ CREATE CLASS HBEditor VAR nWordWrapCol AS NUMERIC INIT 0 // At which column word wrapping occurs VAR lDirty AS LOGICAL INIT .F. // .T. if there are changes not saved VAR lExitEdit AS LOGICAL INIT .F. // .T. if user requested to end Edit() method - + VAR cColorSpec AS CHARACTER // Color string used for screen writes METHOD GetParagraph( nRow ) @@ -627,11 +626,10 @@ METHOD MoveCursor( nKey ) CLASS HBEditor RETURN lMoveKey -// Changes lInsert value and insertion / overstrike mode of editor +// Changes insert state and insertion / overstrike mode of editor METHOD InsertState( lInsState ) CLASS HBEditor IF ISLOGICAL( lInsState ) - ::lInsert := lInsState Set( _SET_INSERT, lInsState ) IF ::lEditAllow SetCursor( iif( lInsState, SC_INSERT, SC_NORMAL ) ) @@ -651,7 +649,6 @@ METHOD Edit( nPassedKey ) CLASS HBEditor IF ! ::lEditAllow ::BrowseText( nPassedKey ) - ELSE // If user pressed an exiting key (K_ESC or K_ALT_W) or I've received a key to handle and then exit @@ -664,7 +661,7 @@ METHOD Edit( nPassedKey ) CLASS HBEditor ::IdleHook() ENDIF - nKey := InKey( 0 ) + nKey := Inkey( 0 ) ELSE lSingleKeyProcess := .T. nKey := nPassedKey @@ -686,7 +683,7 @@ METHOD Edit( nPassedKey ) CLASS HBEditor ::aText[ ::nRow ]:cText += Space( ::nCol - ::LineLen( ::nRow ) ) ENDIF // insert char if in insert mode or at end of current line - IF ::lInsert .OR. ( ::nCol > ::LineLen( ::nRow ) ) + IF Set( _SET_INSERT ) .OR. ( ::nCol > ::LineLen( ::nRow ) ) ::aText[ ::nRow ]:cText := Stuff( ::aText[ ::nRow ]:cText, ::nCol, 0, Chr( nKey ) ) ELSE ::aText[ ::nRow ]:cText := Stuff( ::aText[ ::nRow ]:cText, ::nCol, 1, Chr( nKey ) ) @@ -697,7 +694,7 @@ METHOD Edit( nPassedKey ) CLASS HBEditor CASE nKey == K_RETURN ::lDirty := .T. - IF ::lInsert .OR. ::nRow == ::naTextLen + IF Set( _SET_INSERT ) .OR. ::nRow == ::naTextLen IF ::LineLen( ::nRow ) > 0 // Split current line at cursor position ::InsertLine( Right( ::aText[ ::nRow ]:cText, ::LineLen( ::nRow ) - ::nCol + 1 ), ::aText[ ::nRow ]:lSoftCR, ::nRow + 1 ) @@ -713,7 +710,8 @@ METHOD Edit( nPassedKey ) CLASS HBEditor ::MoveCursor( K_HOME ) CASE nKey == K_INS - ::InsertState( !::lInsert ) + Set( _SET_INSERT, ! Set( _SET_INSERT ) ) + SetCursor( iif( Set( _SET_INSERT ), SC_INSERT, SC_NORMAL ) ) CASE nKey == K_DEL // If there is a wordwrapping limit and I'm past it @@ -742,7 +740,7 @@ METHOD Edit( nPassedKey ) CLASS HBEditor CASE nKey == K_TAB // insert char if in insert mode or at end of current line - IF ::lInsert .OR. ( ::nCol == ::LineLen( ::nRow ) ) + IF Set( _SET_INSERT ) .OR. ( ::nCol == ::LineLen( ::nRow ) ) ::aText[ ::nRow ]:cText := Stuff( ::aText[ ::nRow ]:cText, ::nCol, 0, Space( ::nTabWidth ) ) ::lDirty := .T. ENDIF @@ -935,7 +933,7 @@ METHOD BrowseText( nPassedKey ) ::IdleHook() ENDIF - nKey := InKey( 0 ) + nKey := Inkey( 0 ) ELSE nKey := nPassedKey ENDIF @@ -974,9 +972,9 @@ METHOD New( cString, nTop, nLeft, nBottom, nRight, lEditMode, nLineLength, nTabS DEFAULT nLineLength TO NIL DEFAULT nTabSize TO NIL DEFAULT nTextRow TO 1 - DEFAULT nTextCol TO 0 - DEFAULT nWndRow TO 0 - DEFAULT nWndCol TO 0 + DEFAULT nTextCol TO 0 + DEFAULT nWndRow TO 0 + DEFAULT nWndCol TO 0 ::aText := Text2Array( cString, nLineLength ) ::naTextLen := Len( ::aText ) @@ -1002,11 +1000,6 @@ METHOD New( cString, nTop, nLeft, nBottom, nRight, lEditMode, nLineLength, nTabS ::lEditAllow := lEditMode ENDIF - // set correct insert state - IF ::lEditAllow - ::InsertState( ::lInsert ) - ENDIF - // is word wrap required? IF ISNUMBER( nLineLength ) ::lWordWrap := .T. diff --git a/harbour/source/rtl/tgetlist.prg b/harbour/source/rtl/tgetlist.prg index 3a5a6a238f..b0e07fbc74 100644 --- a/harbour/source/rtl/tgetlist.prg +++ b/harbour/source/rtl/tgetlist.prg @@ -364,16 +364,16 @@ METHOD GetApplyKey( nKey, oGet, oMenu, aMsg ) CLASS HBGetList DO CASE CASE nKey == K_UP oGet:exitState := GE_UP - + CASE nKey == K_SH_TAB oGet:exitState := GE_UP - + CASE nKey == K_DOWN oGet:exitState := GE_DOWN - + CASE nKey == K_TAB oGet:exitState := GE_DOWN - + CASE nKey == K_ENTER oGet:exitState := GE_ENTER @@ -600,7 +600,7 @@ METHOD GetPostValidate( oGet, aMsg ) CLASS HBGetList ::ShowScoreBoard() oGet:updateBuffer() - + #ifdef HB_COMPAT_C53 ::lUpdated := iif( oGet:changed, .T., lUpdated ) #else @@ -676,7 +676,7 @@ METHOD Settle( nPos, lInit ) CLASS HBGetList ELSE IF ::nLastExitState != 0 nExitState := ::nLastExitState - ELSEIF ::nNextGet < ::nLastPos + ELSEIF ::nNextGet < ::nLastPos nExitState := GE_UP ELSE nExitState := GE_DOWN @@ -704,7 +704,7 @@ METHOD Settle( nPos, lInit ) CLASS HBGetList CASE nExitState == GE_ENTER nPos++ - CASE nExitState == GE_SHORTCUT + CASE nExitState == GE_SHORTCUT RETURN ::nNextGet CASE nExitState == GE_MOUSEHIT @@ -904,7 +904,7 @@ METHOD GUIReader( oGet, oMenu, aMsg ) CLASS HBGetList IF oGUI:ClassName() == "LISTBOX" .AND. ; oGUI:dropDown .AND. ; - oGUI:isOpen + oGUI:isOpen oGUI:Close() ENDIF @@ -1186,7 +1186,7 @@ METHOD GUIPostValidate( oGet, oGUI, aMsg ) CLASS HBGetList ENDIF - RETURN lValid + RETURN lValid METHOD TBApplyKey( oGet, oTB, nKey, oMenu, aMsg ) CLASS HBGetList @@ -1215,7 +1215,7 @@ METHOD TBApplyKey( oGet, oTB, nKey, oMenu, aMsg ) CLASS HBGetList ENDIF DO CASE - CASE nKey == K_TAB + CASE nKey == K_TAB oGet:exitState := GE_DOWN CASE nKey == K_SH_TAB @@ -1229,7 +1229,7 @@ METHOD TBApplyKey( oGet, oTB, nKey, oMenu, aMsg ) CLASS HBGetList #endif oGet:exitState := GE_ENTER - CASE nKey == K_ESC + CASE nKey == K_ESC IF Set( _SET_ESCAPE ) oGet:exitState := GE_ESCAPE ENDIF @@ -1421,7 +1421,7 @@ METHOD Accelerator( nKey, aMsg ) CLASS HBGetList RETURN 0 ENDIF - + // Test the next GUI-GET or Get PreValidation: lGUI := ISOBJECT( oGet:control ) @@ -1480,7 +1480,7 @@ METHOD HitTest( nMRow, nMCol, aMsg ) CLASS HBGetList RETURN 0 // Changed. ENDIF - + // Test the next GUI-GET or Get PreValidation: lGUI := ISOBJECT( ::aGetList[ ::nNextGet ]:control ) @@ -1542,11 +1542,11 @@ METHOD ReadStats( nElement, xNewValue ) CLASS HBGetList CASE nElement == SXREADVAR ; xRetVal := ::cVarName CASE nElement == SCREADPROCNAME ; xRetVal := ::cReadProcName CASE nElement == SNREADPROCLINE ; xRetVal := ::nReadProcLine - CASE nElement == SNNEXTGET ; xRetVal := ::nNextGet - CASE nElement == SNHITCODE ; xRetVal := ::nHitCode + CASE nElement == SNNEXTGET ; xRetVal := ::nNextGet + CASE nElement == SNHITCODE ; xRetVal := ::nHitCode CASE nElement == SNPOS ; xRetVal := ::nPos - CASE nElement == SCSCRSVMSG ; xRetVal := ::cMsgSaveS - CASE nElement == SNMENUID ; xRetVal := ::nMenuID + CASE nElement == SCSCRSVMSG ; xRetVal := ::cMsgSaveS + CASE nElement == SNMENUID ; xRetVal := ::nMenuID CASE nElement == SNSVCURSOR ; xRetVal := ::nSaveCursor OTHERWISE ; xRetVal := NIL ENDCASE diff --git a/harbour/source/rtl/version.c b/harbour/source/rtl/version.c index b414c9e864..256428658f 100644 --- a/harbour/source/rtl/version.c +++ b/harbour/source/rtl/version.c @@ -101,7 +101,7 @@ HB_FUNC( HB_VERSION ) { if( memcmp( pszBuildDate, s_months[ iMonth ], 3 ) == 0 ) { - hb_snprintf( szDate + 4, 2, "%02d", iMonth ); + hb_snprintf( szDate + 4, 2, "%02d", iMonth + 1 ); break; } } diff --git a/harbour/source/vm/cmdarg.c b/harbour/source/vm/cmdarg.c index aef4535bbf..0195c72a9d 100644 --- a/harbour/source/vm/cmdarg.c +++ b/harbour/source/vm/cmdarg.c @@ -122,9 +122,9 @@ void hb_cmdargInit( int argc, char * argv[] ) #if defined( HB_OS_WIN_32 ) - /* NOTE: Manually setup the executable name in Windows, - because in console apps the name may be truncated - in some cases, and in GUI apps it's not filled + /* NOTE: Manually setup the executable name in Windows, + because in console apps the name may be truncated + in some cases, and in GUI apps it's not filled at all. [vszakats] */ if( GetModuleFileName( NULL, s_lpAppName, MAX_PATH ) != 0 ) { @@ -149,7 +149,7 @@ BOOL hb_cmdargIsInternal( const char * szArg, int * piLen ) { HB_TRACE(HB_TR_DEBUG, ("hb_cmdargIsInternal(%s, %p)", szArg, piLen)); - /* NOTE: Not checking for '--' here, as it would filter out + /* NOTE: Not checking for '--' here, as it would filter out valid command line options used by applications. [vszakats] */ if( hb_strnicmp( szArg, "--hb:", 5 ) == 0 || @@ -160,8 +160,8 @@ BOOL hb_cmdargIsInternal( const char * szArg, int * piLen ) return TRUE; } - else if( strlen( szArg ) >= 2 && - szArg[ 0 ] == '/' && + else if( strlen( szArg ) >= 2 && + szArg[ 0 ] == '/' && szArg[ 1 ] == '/' ) { if( piLen ) @@ -226,11 +226,11 @@ static char * hb_cmdargGet( const char * pszName, BOOL bRetValue ) i = strlen( pszName ); while( *pszNext ) { - static const char * szSeparator = " ;,\t"; + static const char * s_szSeparator = " ;,\t"; char * pszEnd; /* Skip the separators */ - while( *pszNext && strchr( szSeparator, *pszNext ) ) + while( *pszNext && strchr( s_szSeparator, *pszNext ) ) pszNext++; /* The // is optional in the envvar */ @@ -239,7 +239,7 @@ static char * hb_cmdargGet( const char * pszName, BOOL bRetValue ) pszEnd = pszNext; /* Search for the end of this switch */ - while( *pszEnd && strchr( szSeparator, *pszEnd ) == NULL ) + while( *pszEnd && strchr( s_szSeparator, *pszEnd ) == NULL ) pszEnd++; /* Check the switch */ @@ -322,8 +322,7 @@ HB_FUNC( HB_ARGSTRING ) if( pszValue ) { - hb_retc( pszValue ); - hb_xfree( pszValue ); + hb_retc_buffer( pszValue ); return; } } @@ -340,7 +339,7 @@ HB_FUNC( HB_ARGC ) } /* Returns a command line argument passed to the application. Calling it with - the parameter zero or no parameter, it will return the name of the executable, + the parameter zero or no parameter, it will return the name of the executable, as written in the command line. */ HB_FUNC( HB_ARGV ) @@ -413,7 +412,7 @@ ULONG hb_cmdargProcessVM( int *pCancelKey, int *pCancelKeyEx ) if( hb_cmdargCheck( "BUILD" ) ) hb_verBuildInfo(); - if( ( cFlags = hb_cmdargString( "FLAGS" ) ) != NULL ) + if( ( cFlags = hb_cmdargString( "FLAGS" ) ) != NULL ) { int i = 0; while( cFlags[ i ] ) @@ -446,7 +445,7 @@ ULONG hb_cmdargProcessVM( int *pCancelKey, int *pCancelKeyEx ) hb_xfree( cFlags ); } - if( ( cFlags = hb_cmdargString( "CANCEL" ) ) != NULL ) + if( ( cFlags = hb_cmdargString( "CANCEL" ) ) != NULL ) { int iVal = atoi( cFlags ); if( iVal ) @@ -454,7 +453,7 @@ ULONG hb_cmdargProcessVM( int *pCancelKey, int *pCancelKeyEx ) hb_xfree( cFlags ); } - if( ( cFlags = hb_cmdargString( "CANCELEX" ) ) != NULL ) + if( ( cFlags = hb_cmdargString( "CANCELEX" ) ) != NULL ) { int iVal = atoi( cFlags ); if( iVal ) diff --git a/harbour/source/vm/extrap.c b/harbour/source/vm/extrap.c index a416aa398c..3517706673 100644 --- a/harbour/source/vm/extrap.c +++ b/harbour/source/vm/extrap.c @@ -57,6 +57,9 @@ * Copyright 2008 Mindaugas Kavaliauskas (dbtopas at dbtopas.lt) * hb_win32ExceptionHandler() Windows exception info dump code. * + * Copyright 2008 Viktor Szakats (harbour.01 syenar hu) + * hb_win32ExceptionHandler() Module listing code. + * * See doc/license.txt for licensing terms. * */ @@ -80,6 +83,14 @@ # endif #endif +#if defined(HB_OS_WIN_32) && !defined(HB_WINCE) +# include + /* BCC and MinGW doesn't seem to #define this */ +# ifndef TH32CS_SNAPMODULE32 +# define TH32CS_SNAPMODULE32 0 +# endif +#endif + #if defined( HB_SIGNAL_EXCEPTION_HANDLER ) static BYTE * s_signal_stack[ SIGSTKSZ ]; #endif @@ -88,7 +99,7 @@ LONG WINAPI hb_win32ExceptionHandler( struct _EXCEPTION_POINTERS * pExceptionInfo ) { - char errmsg[ 4096 ]; + char errmsg[ 8192 ]; errmsg[ 0 ] = '\0'; @@ -104,7 +115,7 @@ LONG WINAPI hb_win32ExceptionHandler( struct _EXCEPTION_POINTERS * pExceptionInf { int errmsglen = sizeof( errmsg ) - 1; - char buf[ 32 ]; + char buf[ 64 + MAX_PATH ]; PEXCEPTION_RECORD pExceptionRecord = pExceptionInfo->ExceptionRecord; PCONTEXT pCtx = pExceptionInfo->ContextRecord; DWORD dwExceptCode = pExceptionInfo->ExceptionRecord->ExceptionCode; @@ -114,7 +125,7 @@ LONG WINAPI hb_win32ExceptionHandler( struct _EXCEPTION_POINTERS * pExceptionInf unsigned int eip; unsigned int j; int i; - + hb_snprintf( errmsg, errmsglen, "\n\n" " Exception Code:%08X\n" @@ -164,7 +175,7 @@ LONG WINAPI hb_win32ExceptionHandler( struct _EXCEPTION_POINTERS * pExceptionInf break; hb_snprintf( buf, sizeof( buf ), " %08X %08X ", ( int ) eip, ( int ) ebp ); hb_strncat( errmsg, buf, errmsglen ); - for( j = 0; j < 10 && ( unsigned int )( ebp + j ) < ebp[ 0 ]; j++ ) + for( j = 0; j < 10 && ( unsigned int ) ( ebp + j ) < ebp[ 0 ]; j++ ) { hb_snprintf( buf, sizeof( buf ), " %08X", ebp[ j ] ); hb_strncat( errmsg, buf, errmsglen ); @@ -175,6 +186,67 @@ LONG WINAPI hb_win32ExceptionHandler( struct _EXCEPTION_POINTERS * pExceptionInf } hb_strncat( errmsg, "\n", errmsglen ); } + + { + /* NOTE: Several non-MS sources say that Win9x has these functions + in tlhelp32.dll. Testing shows though, that in Win95, Win95b + and Win98 they are in kernel32.dll, and tlhelp32.dll doesn't + exist. [vszakats] */ + HMODULE hKernel32 = GetModuleHandle( TEXT( "kernel32.dll" ) ); + + if( hKernel32 ) + { + /* NOTE: Hack to force the ASCII versions of these types. [vszakats] */ + #if defined( UNICODE ) + #undef MODULEENTRY32 + #undef LPMODULEENTRY32 + #endif + + typedef HANDLE ( WINAPI * P_CTH32SSH )( DWORD, DWORD ); /* CreateToolhelp32Snapshot() */ + typedef BOOL ( WINAPI * P_M32F )( HANDLE, LPMODULEENTRY32 ); /* Module32First() */ + typedef BOOL ( WINAPI * P_M32N )( HANDLE, LPMODULEENTRY32 ); /* Module32Next() */ + + P_CTH32SSH pCreateToolhelp32Snapshot = ( P_CTH32SSH ) GetProcAddress( hKernel32, "CreateToolhelp32Snapshot" ); + P_M32F pModule32First = ( P_M32F ) GetProcAddress( hKernel32, "Module32First" ); + P_M32N pModule32Next = ( P_M32N ) GetProcAddress( hKernel32, "Module32Next" ); + + if( pCreateToolhelp32Snapshot && + pModule32First && + pModule32Next ) + { + /* Take a snapshot of all modules in the specified process. */ + HANDLE hModuleSnap = pCreateToolhelp32Snapshot( TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, GetCurrentProcessId() ); + + if( hModuleSnap != INVALID_HANDLE_VALUE ) + { + MODULEENTRY32 me32; + + /* Set the size of the structure before using it. */ + me32.dwSize = sizeof( MODULEENTRY32 ); + + /* Retrieve information about the first module, and exit if unsuccessful */ + if( pModule32First( hModuleSnap, &me32 ) ) + { + hb_strncat( errmsg, "\nModules:\n", errmsglen ); + + /* Now walk the module list of the process, and display information about each module */ + do + { +#if defined( HB_OS_WIN_64 ) + hb_snprintf( buf, sizeof( buf ), "0x%016" PFLL "X 0x%016" PFLL "X %s\n", ( UINT_PTR ) me32.modBaseAddr, ( UINT_PTR ) me32.modBaseSize, me32.szExePath ); +#else + hb_snprintf( buf, sizeof( buf ), "0x%08X 0x%08X %s\n", ( UINT ) me32.modBaseAddr, ( UINT ) me32.modBaseSize, me32.szExePath ); +#endif + hb_strncat( errmsg, buf, errmsglen ); + } while( pModule32Next( hModuleSnap, &me32 ) ); + } + + /* Do not forget to clean up the snapshot object. */ + CloseHandle( hModuleSnap ); + } + } + } + } } #endif diff --git a/harbour/source/vm/set.c b/harbour/source/vm/set.c index 68f68493a9..a4c927ea9d 100644 --- a/harbour/source/vm/set.c +++ b/harbour/source/vm/set.c @@ -883,8 +883,8 @@ HB_FUNC( SET ) else if( HB_IS_NUMERIC( pArg2 ) ) { int iValue = set_number( pArg2, pSet->HB_SET_FILECASE ); - if( iValue == HB_SET_CASE_LOWER || - iValue == HB_SET_CASE_UPPER || + if( iValue == HB_SET_CASE_LOWER || + iValue == HB_SET_CASE_UPPER || iValue == HB_SET_CASE_MIXED ) pSet->HB_SET_FILECASE = iValue; else @@ -912,8 +912,8 @@ HB_FUNC( SET ) else if( HB_IS_NUMERIC( pArg2 ) ) { int iValue = set_number( pArg2, pSet->HB_SET_DIRCASE ); - if( iValue == HB_SET_CASE_LOWER || - iValue == HB_SET_CASE_UPPER || + if( iValue == HB_SET_CASE_LOWER || + iValue == HB_SET_CASE_UPPER || iValue == HB_SET_CASE_MIXED ) pSet->HB_SET_DIRCASE = iValue; else @@ -1708,8 +1708,8 @@ BOOL hb_setSetItem( HB_set_enum set_specifier, PHB_ITEM pItem ) else if( HB_IS_NUMERIC( pItem ) ) iValue = hb_itemGetNI( pItem ); - if( iValue == HB_SET_CASE_LOWER || - iValue == HB_SET_CASE_UPPER || + if( iValue == HB_SET_CASE_LOWER || + iValue == HB_SET_CASE_UPPER || iValue == HB_SET_CASE_MIXED ) { if( set_specifier == HB_SET_FILECASE )