From ad8fcef5ae327a4726fe424ea28adc18bccf2b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Wed, 15 May 2013 19:54:49 +0200 Subject: [PATCH] 2013-05-15 19:54 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/pp/hbpp.c ! fixed ChangeLog file name detection broken after adding .txt extension. * src/rtl/hbproces.c + added support merged stdout and stderr output in hb_fsProcessRun() * src/rtl/hbprocfn.c + added support merged stdout and stderr output in hb_processRun() PRG function. To extract merged stdin and stdout application output it's enough to pass by reference in 3-rd and 4-th parameters the same variable, i.e.: nResult := hb_processRun( cCommand,, @cOutErr, @cOutErr ) * utils/hbmk2/hbmk2.prg ! use hb_processRun() intead of hb_processOpen() to extract merged stdout and stderr output. It fixes all builds in which hb_processOpen() does not exists due to some system limitations like missing pipes, i.e. DOS builds. * src/vm/fm.c ! fixed typo in DOS builds * src/rtl/gtwin/gtwin.c ! ignore mouse position reported in mouse wheel events which use screen based coordinates instead of console window ones. --- ChangeLog.txt | 28 ++++++++++++++++++++++++++++ src/pp/hbpp.c | 1 + src/rtl/gtwin/gtwin.c | 9 ++++++--- src/rtl/hbproces.c | 17 ++++++++++++----- src/rtl/hbprocfn.c | 4 ++-- src/vm/fm.c | 2 +- utils/hbmk2/hbmk2.prg | 26 ++++---------------------- 7 files changed, 54 insertions(+), 33 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 5d49e2e9f6..f4934025d1 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,34 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-05-15 19:54 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * src/pp/hbpp.c + ! fixed ChangeLog file name detection broken after adding .txt + extension. + + * src/rtl/hbproces.c + + added support merged stdout and stderr output in hb_fsProcessRun() + + * src/rtl/hbprocfn.c + + added support merged stdout and stderr output in hb_processRun() + PRG function. To extract merged stdin and stdout application output + it's enough to pass by reference in 3-rd and 4-th parameters the same + variable, i.e.: + nResult := hb_processRun( cCommand,, @cOutErr, @cOutErr ) + + * utils/hbmk2/hbmk2.prg + ! use hb_processRun() intead of hb_processOpen() to extract merged + stdout and stderr output. It fixes all builds in which hb_processOpen() + does not exists due to some system limitations like missing pipes, + i.e. DOS builds. + + * src/vm/fm.c + ! fixed typo in DOS builds + + * src/rtl/gtwin/gtwin.c + ! ignore mouse position reported in mouse wheel events which use + screen based coordinates instead of console window ones. + 2013-05-13 13:24 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/hbct/ctwin.c ! fixed typo in recent commit diff --git a/src/pp/hbpp.c b/src/pp/hbpp.c index 21100bca1f..4b43f3af08 100644 --- a/src/pp/hbpp.c +++ b/src/pp/hbpp.c @@ -427,6 +427,7 @@ static char * hb_fsFileFind( const char * pszFileMask ) char pszFileName[ HB_PATH_MAX ]; PHB_FNAME pFileName = hb_fsFNameSplit( pszFileMask ); pFileName->szName = ffind->szName; + pFileName->szExtension = NULL; hb_fsFNameMerge( pszFileName, pFileName ); hb_fsFindClose( ffind ); hb_xfree( pFileName ); diff --git a/src/rtl/gtwin/gtwin.c b/src/rtl/gtwin/gtwin.c index 7c2a4bcc66..35396d0582 100644 --- a/src/rtl/gtwin/gtwin.c +++ b/src/rtl/gtwin/gtwin.c @@ -1671,9 +1671,12 @@ static int hb_gt_win_ReadKey( PHB_GT pGT, int iEventMask ) s_irInBuf[ s_cNumIndex ].EventType == MOUSE_EVENT && iEventMask & ~( INKEY_KEYBOARD | HB_INKEY_RAW ) ) { - - s_mouse_iCol = s_irInBuf[ s_cNumIndex ].Event.MouseEvent.dwMousePosition.X; - s_mouse_iRow = s_irInBuf[ s_cNumIndex ].Event.MouseEvent.dwMousePosition.Y; + /* mouse wheel events use screen based mouse possition */ + if( s_irInBuf[ s_cNumIndex ].Event.MouseEvent.dwEventFlags != MOUSE_WHEELED ) + { + s_mouse_iCol = s_irInBuf[ s_cNumIndex ].Event.MouseEvent.dwMousePosition.X; + s_mouse_iRow = s_irInBuf[ s_cNumIndex ].Event.MouseEvent.dwMousePosition.Y; + } if( iEventMask & INKEY_MOVE && s_irInBuf[ s_cNumIndex ].Event.MouseEvent.dwEventFlags == MOUSE_MOVED ) diff --git a/src/rtl/hbproces.c b/src/rtl/hbproces.c index 351ebde300..10d2e199c5 100644 --- a/src/rtl/hbproces.c +++ b/src/rtl/hbproces.c @@ -877,7 +877,8 @@ int hb_fsProcessRun( const char * pszFilename, hStdin = hStdout = hStderr = FS_ERROR; phStdin = pStdInBuf ? &hStdin : NULL; phStdout = pStdOutPtr && pulStdOut ? &hStdout : NULL; - phStderr = pStdErrPtr && pulStdErr ? &hStderr : NULL; + phStderr = pStdErrPtr && pulStdErr ? + ( pStdOutPtr == pStdErrPtr ? phStdout : &hStderr ) : NULL; #if defined( HB_OS_DOS ) || defined( HB_OS_OS2 ) || defined( HB_OS_WIN_CE ) { @@ -916,7 +917,12 @@ int hb_fsProcessRun( const char * pszFilename, hStdout = _HB_NULLHANDLE(); if( pStdErrPtr && pulStdErr ) - hStderr = hb_fsCreateTempEx( sTmpErr, NULL, NULL, NULL, FC_NORMAL ); + { + if( phStdout == phStderr ) + hStderr = hStdout; + else + hStderr = hb_fsCreateTempEx( sTmpErr, NULL, NULL, NULL, FC_NORMAL ); + } else if( fDetach ) hStderr = _HB_NULLHANDLE(); @@ -944,7 +950,7 @@ int hb_fsProcessRun( const char * pszFilename, if( sTmpOut[ 0 ] ) hb_fsDelete( sTmpOut ); } - if( hStderr != FS_ERROR ) + if( hStderr != FS_ERROR && hStderr != hStdout ) { if( pStdErrPtr && pulStdErr ) { @@ -1030,7 +1036,8 @@ int hb_fsProcessRun( const char * pszFilename, else nOutBuf += ul; } - else if( hStderr != FS_ERROR && lpHandles[ dwResult ] == ( HANDLE ) hb_fsGetOsHandle( hStderr ) ) + else if( hStderr != FS_ERROR && + lpHandles[ dwResult ] == ( HANDLE ) hb_fsGetOsHandle( hStderr ) ) { if( nErrBuf == nErrSize ) { @@ -1205,7 +1212,7 @@ int hb_fsProcessRun( const char * pszFilename, *pStdOutPtr = pOutBuf; *pulStdOut = nOutBuf; } - if( phStderr ) + if( phStderr && phStdout != phStderr ) { *pStdErrPtr = pErrBuf; *pulStdErr = nErrBuf; diff --git a/src/rtl/hbprocfn.c b/src/rtl/hbprocfn.c index c673523e1a..39ef6fd851 100644 --- a/src/rtl/hbprocfn.c +++ b/src/rtl/hbprocfn.c @@ -138,7 +138,7 @@ HB_FUNC( HB_PROCESSRUN ) nStdOut = nStdErr = 0; pStdOutBuf = pStdErrBuf = NULL; pStdOutPtr = pStdOut ? &pStdOutBuf : NULL; - pStdErrPtr = pStdErr ? &pStdErrBuf : NULL; + pStdErrPtr = pStdErr ? ( pStdOut == pStdErr ? pStdOutPtr : &pStdErrBuf ) : NULL; iResult = hb_fsProcessRun( szName, szStdIn, hb_parclen( 2 ), pStdOutPtr, &nStdOut, pStdErrPtr, &nStdErr, @@ -157,7 +157,7 @@ HB_FUNC( HB_PROCESSRUN ) if( ! hb_storclen_buffer( pStdErrBuf, nStdErr, 4 ) ) hb_xfree( pStdErrBuf ); } - else if( pStdErr ) + else if( pStdErr && pStdOut != pStdErr ) hb_storc( NULL, 4 ); hb_retni( iResult ); diff --git a/src/vm/fm.c b/src/vm/fm.c index 0eaf31c08a..3eea9cef53 100644 --- a/src/vm/fm.c +++ b/src/vm/fm.c @@ -1353,7 +1353,7 @@ HB_SIZE hb_xquery( int iMode ) union REGS regs; regs.HB_XREGS.ax = 0; HB_DOS_INT86( 0x12, ®s, ®s ); - iMode = regs.h.al; + nResult = regs.w.ax; } #else nResult = 9999; diff --git a/utils/hbmk2/hbmk2.prg b/utils/hbmk2/hbmk2.prg index d9c315cf57..09a3eb37fc 100644 --- a/utils/hbmk2/hbmk2.prg +++ b/utils/hbmk2/hbmk2.prg @@ -13158,34 +13158,16 @@ STATIC FUNCTION Apple_App_Template_Info_plist() STATIC FUNCTION hbmk_hb_processRunCatch( cCommand, /* @ */ cStdOutErr ) - LOCAL hProc - LOCAL hOutErr - - LOCAL cData - LOCAL nLen - LOCAL nExitCode cStdOutErr := "" - IF ( hProc := hb_processOpen( cCommand,, @hOutErr, @hOutErr ) ) != F_ERROR + nExitCode := hb_processRun( cCommand,, @cStdOutErr, @cStdOutErr ) - cData := Space( 1024 ) - DO WHILE ( nLen := FRead( hOutErr, @cData, hb_BLen( cData ) ) ) > 0 - cStdOutErr += hb_BLeft( cData, nLen ) - ENDDO - - nExitCode := hb_processValue( hProc ) - - FClose( hOutErr ) - - IF nExitCode != 0 - OutErr( cStdOutErr ) - ELSE - OutStd( cStdOutErr ) - ENDIF + IF nExitCode != 0 + OutErr( cStdOutErr ) ELSE - nExitCode := -999 + OutStd( cStdOutErr ) ENDIF RETURN nExitCode