2010-10-14 08:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/src/rtl/gtstd/gtstd.c
    * updated to compile with WinCE

  * harbour/package/harbour.spec
    * modified to work with new HBMK2 translations

  * harbour/contrib/hbmzip/hbmzip.c
    ! fixed function order

  * harbour/contrib/hbwin/axcore.c
    * include <olectl.h>
    ! fixed buffer sizes in debug function
    * removed trailing spaces and tabs

  * harbour/contrib/hbwin/hbolesrv.c
    * include <tchar.h> - for some compilers which do not make it
      with OLE header files
This commit is contained in:
Przemyslaw Czerpak
2010-10-14 06:45:51 +00:00
parent df744bd6ff
commit 36124d47a6
6 changed files with 89 additions and 57 deletions

View File

@@ -16,6 +16,25 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-10-14 08:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/rtl/gtstd/gtstd.c
* updated to compile with WinCE
* harbour/package/harbour.spec
* modified to work with new HBMK2 translations
* harbour/contrib/hbmzip/hbmzip.c
! fixed function order
* harbour/contrib/hbwin/axcore.c
* include <olectl.h>
! fixed buffer sizes in debug function
* removed trailing spaces and tabs
* harbour/contrib/hbwin/hbolesrv.c
* include <tchar.h> - for some compilers which do not make it
with OLE header files
2010-10-14 05:45 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* harbour/contrib/hbwin/axcore.c
+ added support for obtaining default callback event interface.

View File

@@ -144,6 +144,36 @@ static unzFile hb_unzipfileParam( int iParam )
}
static HB_FATTR hb_translateExtAttr( const char* szFileName, HB_FATTR ulExtAttr )
{
int iLen;
iLen = ( int ) strlen( szFileName );
if( iLen > 4 )
{
if( hb_stricmp( szFileName + iLen - 4, ".exe" ) == 0 ||
hb_stricmp( szFileName + iLen - 4, ".com" ) == 0 ||
hb_stricmp( szFileName + iLen - 4, ".bat" ) == 0 ||
hb_stricmp( szFileName + iLen - 4, ".cmd" ) == 0 ||
hb_stricmp( szFileName + iLen - 3, ".sh" ) == 0 )
{
ulExtAttr |= 0x00490000; /* --x--x--x */
}
}
if( ulExtAttr | HB_FA_READONLY )
ulExtAttr |= 0x01240000; /* r--r--r-- */
else
ulExtAttr |= 0x01B60000; /* rw-rw-rw- */
if( ulExtAttr & HB_FA_DIRECTORY )
ulExtAttr |= 0x40000000;
else
ulExtAttr |= 0x80000000;
return ulExtAttr;
}
/* HB_ZipOpen( cFileName, [ iMode = HB_ZIP_CREATE ], [ @cGlobalComment ] ) --> hZip */
HB_FUNC( HB_ZIPOPEN )
@@ -624,36 +654,6 @@ HB_FUNC( HB_ZIPFILECRC32 )
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
static HB_FATTR hb_translateExtAttr( const char* szFileName, HB_FATTR ulExtAttr )
{
int iLen;
iLen = ( int ) strlen( szFileName );
if( iLen > 4 )
{
if( hb_stricmp( szFileName + iLen - 4, ".exe" ) == 0 ||
hb_stricmp( szFileName + iLen - 4, ".com" ) == 0 ||
hb_stricmp( szFileName + iLen - 4, ".bat" ) == 0 ||
hb_stricmp( szFileName + iLen - 4, ".cmd" ) == 0 ||
hb_stricmp( szFileName + iLen - 3, ".sh" ) == 0 )
{
ulExtAttr |= 0x00490000; /* --x--x--x */
}
}
if( ulExtAttr | HB_FA_READONLY )
ulExtAttr |= 0x01240000; /* r--r--r-- */
else
ulExtAttr |= 0x01B60000; /* rw-rw-rw- */
if( ulExtAttr & HB_FA_DIRECTORY )
ulExtAttr |= 0x40000000;
else
ulExtAttr |= 0x80000000;
return ulExtAttr;
}
static int hb_zipStoreFile( zipFile hZip, const char* szFileName, const char* szName, const char* szPassword, const char* szComment )
{
char * szZipName, * pString;

View File

@@ -51,6 +51,8 @@
*/
#include "hbwinole.h"
#include <olectl.h>
#include "hbapistr.h"
#if defined( HB_OS_WIN_CE )
#include "hbwince.h"
@@ -381,9 +383,10 @@ static char * GUID2String( GUID * pID )
wchar_t olestr[ 128 ];
int iLen;
StringFromGUID2( pID, olestr, 256 );
iLen = WideCharToMultiByte( CP_ACP, 0, olestr, -1, strguid, 256, NULL, NULL );
strguid[ iLen - 1 ] = 0;
StringFromGUID2( pID, olestr, HB_SIZEOFARRAY( olestr ) );
iLen = WideCharToMultiByte( CP_ACP, 0, olestr, -1, strguid, sizeof( strguid ), NULL, NULL );
if( iLen )
strguid[ iLen - 1 ] = 0;
return strguid;
}
#endif
@@ -401,7 +404,7 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID *
{
IProvideClassInfo2 * iPCI2;
IProvideClassInfo * iPCI;
/* Method 1: using IProvideClassInfo2 */
hr = iDisp->lpVtbl->QueryInterface( iDisp, &IID_IProvideClassInfo2, ( void** ) ( void* ) &iPCI2 );
@@ -415,34 +418,36 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID *
return 0;
}
else
{
HB_TRACE( HB_TR_DEBUG, ("_get_default_sink IProvideClassInfo2 obtain error %08X", hr) );
}
/* Method 2: using IProvideClassInfo and searching for default source in ITypeInfo */
hr = iDisp->lpVtbl->QueryInterface( iDisp, &IID_IProvideClassInfo, ( void** ) ( void* ) &iPCI );
if( hr == 0 )
{
HB_TRACE( HB_TR_DEBUG, ("_get_default_sink IProvideClassInfo OK") );
hr = iPCI->lpVtbl->GetClassInfo( iPCI, &iTI );
if( hr == 0 )
{
hr = iTI->lpVtbl->GetTypeAttr( iTI, &pTypeAttr );
if( hr == 0 )
if( hr == 0 )
{
for( i = 0; i < pTypeAttr->cImplTypes; i++ )
{
hr = iTI->lpVtbl->GetImplTypeFlags( iTI, i, &iFlags );
if( hr == 0 && ( iFlags & IMPLTYPEFLAG_FDEFAULT ) && ( iFlags & IMPLTYPEFLAG_FSOURCE ) )
{
if( iTI->lpVtbl->GetRefTypeOfImplType( iTI, i, &hRefType ) == S_OK &&
if( iTI->lpVtbl->GetRefTypeOfImplType( iTI, i, &hRefType ) == S_OK &&
iTI->lpVtbl->GetRefTypeInfo( iTI, hRefType, &iTISink ) == S_OK )
{
HB_TRACE( HB_TR_DEBUG, ("_get_default_sink Method 2: default source is found") );
hr = iTISink->lpVtbl->GetTypeAttr( iTISink, &pTypeAttr );
if( hr == 0 )
if( hr == 0 )
{
* piid = pTypeAttr->guid;
iTISink->lpVtbl->ReleaseTypeAttr( iTISink, pTypeAttr );
@@ -460,7 +465,9 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID *
iPCI->lpVtbl->Release( iPCI );
}
else
{
HB_TRACE( HB_TR_DEBUG, ("_get_default_sink IProvideClassInfo obtain error %08X", hr) );
}
}
@@ -471,7 +478,7 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID *
{
ITypeLib * iTL;
TYPEATTR * pTypeAttr2;
hr = iTI->lpVtbl->GetContainingTypeLib( iTI, &iTL, NULL );
iTI->lpVtbl->Release( iTI );
@@ -484,7 +491,7 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID *
if( hr == S_OK )
{
hr = iTI->lpVtbl->GetTypeAttr( iTI, &pTypeAttr );
if( hr == S_OK )
if( hr == S_OK )
{
if( pTypeAttr->typekind == TKIND_COCLASS )
{
@@ -492,17 +499,17 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID *
{
if( szEvent )
{
if( iTI->lpVtbl->GetRefTypeOfImplType( iTI, j, &hRefType ) == S_OK &&
if( iTI->lpVtbl->GetRefTypeOfImplType( iTI, j, &hRefType ) == S_OK &&
iTI->lpVtbl->GetRefTypeInfo( iTI, hRefType, &iTISink ) == S_OK )
{
BSTR bstr;
hr = iTISink->lpVtbl->GetDocumentation( iTISink, -1, &bstr, NULL, NULL, NULL );
if( hr == S_OK )
{
char str[ 256 ];
int iLen;
iLen = WideCharToMultiByte( CP_ACP, 0, bstr, -1, str, sizeof( str ), NULL, NULL );
str[ iLen - 1 ] = '\0';
if( ! strcmp( szEvent, str ) )
@@ -512,7 +519,7 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID *
{
* piid = pTypeAttr2->guid;
iTISink->lpVtbl->ReleaseTypeAttr( iTISink, pTypeAttr2 );
iTISink->lpVtbl->Release( iTISink );
iTI->lpVtbl->ReleaseTypeAttr( iTI, pTypeAttr );
iTI->lpVtbl->Release( iTI );
@@ -520,28 +527,28 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID *
return 0;
}
}
}
iTISink->lpVtbl->Release( iTISink );
}
}
else /* szEvent == NULL */
{
hr = iTI->lpVtbl->GetImplTypeFlags( iTI, j, &iFlags );
if( hr == S_OK && ( iFlags & IMPLTYPEFLAG_FDEFAULT ) && ( iFlags & IMPLTYPEFLAG_FSOURCE ) )
{
if( iTI->lpVtbl->GetRefTypeOfImplType( iTI, j, &hRefType ) == S_OK &&
hr = iTI->lpVtbl->GetImplTypeFlags( iTI, j, &iFlags );
if( hr == S_OK && ( iFlags & IMPLTYPEFLAG_FDEFAULT ) && ( iFlags & IMPLTYPEFLAG_FSOURCE ) )
{
if( iTI->lpVtbl->GetRefTypeOfImplType( iTI, j, &hRefType ) == S_OK &&
iTI->lpVtbl->GetRefTypeInfo( iTI, hRefType, &iTISink ) == S_OK )
{
hr = iTISink->lpVtbl->GetTypeAttr( iTISink, &pTypeAttr2 );
if( hr == S_OK )
{
#if 0
#if 0
/* Debug code. You can also comment out iFlags condition, to list more interfaces [Mindaugas] */
BSTR bstr;
char str[ 256 ];
int iLen;
iTISink->lpVtbl->GetDocumentation( iTISink, -1, &bstr, NULL, NULL, NULL );
iLen = WideCharToMultiByte( CP_ACP, 0, bstr, -1, str, sizeof( str ), NULL, NULL );
str[ iLen - 1 ] = '\0';
@@ -556,7 +563,7 @@ static HRESULT _get_default_sink( IDispatch * iDisp, const char * szEvent, IID *
return 0;
}
}
}
}
}
}
}

View File

@@ -54,6 +54,7 @@
#include "hbwinole.h"
#include <olectl.h>
#include <tchar.h>
#define MAX_CLSID_SIZE 64
#define MAX_CLSNAME_SIZE 256

View File

@@ -457,8 +457,7 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/hbi18n
%{_bindir}/hbformat
%{_bindir}/hbmk2
%{_bindir}/hbmk2.hu_HU.hbl
%{_bindir}/hbmk2.pt_BR.hbl
%{_bindir}/hbmk2.*.hbl
%{_bindir}/hbxpatch.hbs
%{_bindir}/hbmk2l2d.hbs
%{_mandir}/man1/*.1*

View File

@@ -391,6 +391,11 @@ static int hb_gt_std_ReadKey( PHB_GT pGT, int iEventMask )
}
else if( WaitForSingleObject( ( HANDLE ) hb_fsGetOsHandle( pGTSTD->hStdin ), 0 ) == WAIT_OBJECT_0 )
{
#if defined( HB_OS_WIN_CE )
HB_BYTE bChar;
if( hb_fsRead( pGTSTD->hStdin, &bChar, 1 ) == 1 )
ch = pGTSTD->keyTransTbl[ bChar ];
#else
INPUT_RECORD ir;
DWORD dwEvents;
while( PeekConsoleInput( ( HANDLE ) hb_fsGetOsHandle( pGTSTD->hStdin ), &ir, 1, &dwEvents ) && dwEvents == 1 )
@@ -404,6 +409,7 @@ static int hb_gt_std_ReadKey( PHB_GT pGT, int iEventMask )
else /* Remove from the input queue */
ReadConsoleInput( ( HANDLE ) hb_fsGetOsHandle( pGTSTD->hStdin ), &ir, 1, &dwEvents );
}
#endif
}
#elif defined( __WATCOMC__ )
if( pGTSTD->fStdinConsole )