diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d58aa64fa6..3ba6d3dbeb 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,68 @@ past entries belonging to these authors: Viktor Szakats. */ +2009-05-20 20:02 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * utils/hbmk2/hbmk2.prg + ! Added workaround for DIRECTORY() problem under Windows. + '*.ext' input files weren't working if the actual filenames + had different casing (on Windows). Also changed the hack + to only kick in on Windows platforms, *nixes seems to work + as expected. + ; NOTE: This workaround should probably be moved to Harbour + FileFind API. + + * INSTALL + + Added HB_INC_ODBC. + + * contrib/hbwin/tests/testole.prg + * contrib/hbwin/legacyc.c + * Updated to reflect OLE function name changes. + + * contrib/hbwin/legacyc.c + + Added GETACTIVEOBJECT(), CREATEOBJECT(), OLEERROR() + compatibility calls. All of them are simple aliases to + new OLE function, which means there may be differences + in behviour. Users will need to adjust them for full + compatibility. + However, I'd recommend changing all code to use our + new OLE functions and classes. + + * contrib/hbwin/Makefile + + contrib/hbwin/legacy.prg + * Moved TOLEAUTO() compatibility class to .prg level. + It's a stub, inheriting from WIN_OLEAUTO. I hope TOLEAUTO + users will fill it with required compitibility methods. + + ; NOTE: Getting these warnings with bcc: + Warning W8075 ../../axcore.c 93: Suspicious pointer conversion in function hb_ax_init + Warning W8075 ../../axcore.c 322: Suspicious pointer conversion in function HB_FUN___AXREGISTERHANDLER + + ; NOTE: Getting these errors with msvc (default C++ mode): + ../../axcore.c(93) : error C2440: '=' : cannot convert from 'FARPROC' to 'HRESULT (__stdcall *)(HWND,IUnknown **)' + This conversion requires a reinterpret_cast, a C-style cast or function-style cast + ../../axcore.c(146) : error C2143: syntax error : missing ';' before '*' + ../../axcore.c(146) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int + ../../axcore.c(146) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int + ../../axcore.c(175) : error C2039: 'lpVtbl' : is not a member of 'ISink' + ../../axcore.c(145) : see declaration of 'ISink' + ../../axcore.c(175) : error C2227: left of '->Release' must point to class/struct/union/generic type + ../../axcore.c(179) : error C2143: syntax error : missing ')' before 'this' + ../../axcore.c(179) : error C2143: syntax error : missing ';' before 'this' + ../../axcore.c(179) : error C2059: syntax error : ')' + ../../axcore.c(180) : error C2143: syntax error : missing ';' before '{' + ../../axcore.c(180) : error C2447: '{' : missing function header (old-style formal list?) + [ ...snip... ] + ../../axcore.c(198) : error C2365: 'Release' : redefinition; previous definition was 'formerly unknown identifier' + [ ...snip... ] + ../../axcore.c(282) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int + ../../axcore.c(282) : error C2146: syntax error : missing ';' before identifier 'ISink_Vtbl' + ../../axcore.c(282) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int + ../../axcore.c(283) : error C2440: 'initializing' : cannot convert from 'HRESULT (__stdcall *)(IDispatch *)' to 'int' + There is no context in which this conversion is possible + ../../axcore.c(284) : error C2078: too many initializers + ../../axcore.c(322) : error C2039: 'lpVtbl' : is not a member of 'ISink' + ../../axcore.c(145) : see declaration of 'ISink' + 2009-05-20 18:15 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) * harbour/contrib/hbwin/hbwinole.h * harbour/contrib/hbwin/olecore.c @@ -28,8 +90,8 @@ + added ActiveX support. Public functions are: WIN_AxInit() --> lSuccess WIN_AxGetControl( hWnd, [ bEventHandler ] ) --> oActiveX - - ; TODO: a few warnings left. I do not know howto recast function + + ; TODO: a few warnings left. I do not know howto recast function type pointer * harbour/contrib/hbwin/oleauto.c @@ -38,10 +100,10 @@ * harbour/contrib/hbwin/olecore.c * function renames - + support item to variant conversion for classes inherited from + + support item to variant conversion for classes inherited from WIN_OLEAUTO - removed internal OLERELEASE() - + added optional parameter for WIN_OleErrorText( [ nOleError ] ) + + added optional parameter for WIN_OleErrorText( [ nOleError ] ) * harbour/source/vm/classes.c * minor optimisation diff --git a/harbour/INSTALL b/harbour/INSTALL index 7d6246d862..ae8a0613d0 100644 --- a/harbour/INSTALL +++ b/harbour/INSTALL @@ -148,6 +148,7 @@ HOW TO ENABLE OPTIONAL COMPONENTS BEFORE BUILD HB_INC_LIBHARU=C:\libharu\include (defaults to locally hosted version) HB_INC_LIBPNG=C:\libpng (defaults to locally hosted version on win/os2/dos) HB_INC_MYSQL=C:\mysql\include + HB_INC_ODBC= (may only be needed on non-Windows systems) HB_INC_OPENSSL=C:\openssl\inc32 HB_INC_PGSQL=C:\pgsql\include HB_INC_QT=C:\Qt\4.5.1\include diff --git a/harbour/contrib/hbwin/Makefile b/harbour/contrib/hbwin/Makefile index 03de471696..9416fd8fcc 100644 --- a/harbour/contrib/hbwin/Makefile +++ b/harbour/contrib/hbwin/Makefile @@ -34,6 +34,7 @@ C_SOURCES = \ wapi_winuser.c \ PRG_SOURCES = \ + legacy.prg \ oleauto.prg \ axfunc.prg \ win_os.prg \ diff --git a/harbour/contrib/hbwin/legacy.prg b/harbour/contrib/hbwin/legacy.prg new file mode 100644 index 0000000000..15ca7f4fd9 --- /dev/null +++ b/harbour/contrib/hbwin/legacy.prg @@ -0,0 +1,59 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Compatibility calls. + * + * Copyright 2009 {list of individual authors and e-mail addresses} + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#define HB_CLS_NOTOBJECT /* avoid definition of method: INIT */ + +#include "hbclass.ch" + +CREATE CLASS TOLEAUTO FROM WIN_OLEAUTO + /* TODO: Implement compatibility to the required extent */ +ENDCLASS diff --git a/harbour/contrib/hbwin/legacyc.c b/harbour/contrib/hbwin/legacyc.c index 7ef92deeee..870e129474 100644 --- a/harbour/contrib/hbwin/legacyc.c +++ b/harbour/contrib/hbwin/legacyc.c @@ -50,34 +50,48 @@ * */ +/* This functions are deprecated, kept for compatibility with old + OLE implementation. Please update your code to use this new API, + the old one will be removed in a future revision. [vszakats] */ + #define HB_OS_WIN_USED #include "hbapi.h" -HB_FUNC_EXTERN( OLEERRORTEXT ); +HB_FUNC_EXTERN( WIN_OLECREATEOBJECT ); + +HB_FUNC( CREATEOBJECT ) +{ + HB_FUNC_EXEC( WIN_OLECREATEOBJECT ); +} + +HB_FUNC_EXTERN( WIN_OLEGETACTIVEOBJECT ); + +HB_FUNC( GETACTIVEOBJECT ) +{ + HB_FUNC_EXEC( WIN_OLEGETACTIVEOBJECT ); +} + +HB_FUNC_EXTERN( WIN_OLEERROR ); + +HB_FUNC( OLEERROR ) +{ + HB_FUNC_EXEC( WIN_OLEERROR ); +} + +HB_FUNC_EXTERN( WIN_OLEERRORTEXT ); -/* Deprecated. Compatibility with old OLE implementation. */ HB_FUNC( OLE2TXTERROR ) { - HB_FUNC_EXEC( OLEERRORTEXT ); + HB_FUNC_EXEC( WIN_OLEERRORTEXT ); } -HB_FUNC_EXTERN( HB_OLEAUTO ); - -/* Deprecated. Compatibility with old OLE implementation. */ -HB_FUNC( TOLEAUTO ) -{ - HB_FUNC_EXEC( HB_OLEAUTO ); -} - -/* Deprecated. Compatibility with old OLE implementation. */ /* Original version returned NULL for empty strings. */ LPWSTR hb_oleAnsiToWide( LPSTR cString ) { return hb_mbtowc( cString ); } -/* Deprecated. Compatibility with old OLE implementation. */ /* Original version returned NULL for empty strings. */ LPSTR hb_oleWideToAnsi( BSTR wString ) { @@ -86,7 +100,6 @@ LPSTR hb_oleWideToAnsi( BSTR wString ) HB_FUNC_EXTERN( WIN_ANSITOWIDE ); -/* Deprecated. Compatibility with old OLE implementation. */ /* Original version may have returned NIL in some error situations. */ HB_FUNC( ANSITOWIDE ) { @@ -95,27 +108,25 @@ HB_FUNC( ANSITOWIDE ) HB_FUNC_EXTERN( WIN_WIDETOANSI ); -/* Deprecated. Compatibility with old OLE implementation. */ /* Original version may have returned NIL in some error situations. */ HB_FUNC( WIDETOANSI ) { HB_FUNC_EXEC( WIN_WIDETOANSI ); } -/* Deprecated. Please use WAPI_GETLASTERROR(). */ +/* Please use WAPI_GETLASTERROR(). */ HB_FUNC( GETLASTERROR ) { hb_retnl( GetLastError() ); } -/* Deprecated. Please use WAPI_SETLASTERROR(). */ +/* Please use WAPI_SETLASTERROR(). */ HB_FUNC( SETLASTERROR ) { hb_retnl( GetLastError() ); SetLastError( hb_parnl( 1 ) ); } -/* Deprecated. Compatibility with old OLE implementation. */ HB_FUNC( MESSAGEBOX ) { LPTSTR lpStr1 = HB_TCHAR_CONVTO( hb_parcx( 2 ) ); diff --git a/harbour/contrib/hbwin/tests/testole.prg b/harbour/contrib/hbwin/tests/testole.prg index 66b0536391..0c801c18d0 100644 --- a/harbour/contrib/hbwin/tests/testole.prg +++ b/harbour/contrib/hbwin/tests/testole.prg @@ -70,7 +70,7 @@ STATIC PROCEDURE Exm_MSExcel() LOCAL oExcel, oWorkBook, oWorkSheet, oAS LOCAL nI, nCount - IF ( oExcel := CreateObject( "Excel.Application" ) ) != NIL + IF ( oExcel := win_oleCreateObject( "Excel.Application" ) ) != NIL oWorkBook := oExcel:WorkBooks:Add() @@ -142,7 +142,7 @@ STATIC PROCEDURE Exm_MSExcel() oExcel:Quit() ELSE - Alert( "Error: MS Excel not available. [" + OLEErrorText()+ "]" ) + Alert( "Error: MS Excel not available. [" + win_oleErrorText()+ "]" ) ENDIF RETURN @@ -151,7 +151,7 @@ STATIC PROCEDURE Exm_MSExcel() STATIC PROCEDURE Exm_MSWord() LOCAL oWord, oText - IF ( oWord := CreateObject( "Word.Application" ) ) != NIL + IF ( oWord := win_oleCreateObject( "Word.Application" ) ) != NIL oWord:Documents:Add() @@ -165,7 +165,7 @@ STATIC PROCEDURE Exm_MSWord() oWord:Visible := .T. oWord:WindowState := 1 /* Maximize */ ELSE - ? "Error. MS Word not available.", OLEErrorText() + ? "Error. MS Word not available.", win_oleErrorText() ENDIF RETURN @@ -174,12 +174,12 @@ STATIC PROCEDURE Exm_MSWord() STATIC PROCEDURE Exm_MSOutlook() LOCAL oOL, oList - IF ( oOL := CreateObject( "Outlook.Application" ) ) != NIL + IF ( oOL := win_oleCreateObject( "Outlook.Application" ) ) != NIL oList := oOL:CreateItem( 7 /* olDistributionListItem */ ) oList:DLName := "Distribution List" oList:Display( .F. ) ELSE - ? "Error. MS Outlook not available.", OLEErrorText() + ? "Error. MS Outlook not available.", win_oleErrorText() ENDIF RETURN @@ -189,7 +189,7 @@ STATIC PROCEDURE Exm_MSOutlook2() LOCAL oOL, oLista, oMail LOCAL i - IF ( oOL := CreateObject( "Outlook.Application" ) ) != NIL + IF ( oOL := win_oleCreateObject( "Outlook.Application" ) ) != NIL oMail := oOL:CreateItem( 0 /* olMailItem */ ) @@ -205,7 +205,7 @@ STATIC PROCEDURE Exm_MSOutlook2() oLista:Save() oLista:Close( 0 ) ELSE - ? "Error. MS Outlook not available.", OLEErrorText() + ? "Error. MS Outlook not available.", win_oleErrorText() ENDIF RETURN @@ -214,11 +214,11 @@ STATIC PROCEDURE Exm_MSOutlook2() STATIC PROCEDURE Exm_IExplorer() LOCAL oIE - IF ( oIE := CreateObject( "InternetExplorer.Application" ) ) != NIL + IF ( oIE := win_oleCreateObject( "InternetExplorer.Application" ) ) != NIL oIE:Visible := .T. oIE:Navigate( "http://www.harbour-project.org" ) ELSE - ? "Error. IExplorer not available.", OLEErrorText() + ? "Error. IExplorer not available.", win_oleErrorText() ENDIF RETURN @@ -227,7 +227,7 @@ STATIC PROCEDURE Exm_IExplorer() STATIC PROCEDURE Exm_OOCalc() LOCAL oServiceManager, oDesktop, oDoc, oSheet - IF ( oServiceManager := CreateObject( "com.sun.star.ServiceManager" ) ) != NIL + IF ( oServiceManager := win_oleCreateObject( "com.sun.star.ServiceManager" ) ) != NIL oDesktop := oServiceManager:createInstance( "com.sun.star.frame.Desktop" ) oDoc := oDesktop:loadComponentFromURL( "private:factory/scalc", "_blank", 0, {} ) @@ -257,7 +257,7 @@ STATIC PROCEDURE Exm_OOCalc() oSheet:getCellRangeByName( "A3" ):setPropertyValue( "CellBackColor", 255 ) // blue oSheet:getCellRangeByName( "B3" ):setPropertyValue( "CharColor", 255 * 256 * 256 ) // red ELSE - ? "Error. OpenOffice not available.", OLEErrorText() + ? "Error. OpenOffice not available.", win_oleErrorText() ENDIF RETURN @@ -266,7 +266,7 @@ STATIC PROCEDURE Exm_OOCalc() STATIC PROCEDURE Exm_OOWriter() LOCAL oServiceManager, oDesktop, oDoc, oText, oCursor, oTable, oRow, oCell, oCellCursor, oRows - IF ( oServiceManager := CreateObject( "com.sun.star.ServiceManager" ) ) != NIL + IF ( oServiceManager := win_oleCreateObject( "com.sun.star.ServiceManager" ) ) != NIL oDesktop := oServiceManager:createInstance( "com.sun.star.frame.Desktop" ) oDoc := oDesktop:loadComponentFromURL( "private:factory/swriter", "_blank", 0, {} ) @@ -310,7 +310,7 @@ STATIC PROCEDURE Exm_OOWriter() oCursor:setPropertyValue( "CharColor", 255 ) oText:insertString( oCursor, "Good bye!", .F. ) ELSE - ? "Error. OpenOffice not available.", OLEErrorText() + ? "Error. OpenOffice not available.", win_oleErrorText() ENDIF RETURN @@ -324,7 +324,7 @@ STATIC PROCEDURE Exm_OOOpen() LOCAL cDir - IF ( oOO_ServiceManager := CreateObject( "com.sun.star.ServiceManager" ) ) != NIL + IF ( oOO_ServiceManager := win_oleCreateObject( "com.sun.star.ServiceManager" ) ) != NIL hb_FNameSplit( hb_ArgV( 0 ), @cDir ) @@ -342,7 +342,7 @@ STATIC PROCEDURE Exm_OOOpen() oOO_Desktop := NIL oOO_PropVal01 := NIL ELSE - ? "Error: OpenOffice not available.", OLEErrorText() + ? "Error: OpenOffice not available.", win_oleErrorText() ENDIF RETURN @@ -365,9 +365,9 @@ STATIC PROCEDURE Exm_CDO() LOCAL oCDOMsg LOCAL oCDOConf - IF ( oCDOMsg := CreateObject( "CDO.Message" ) ) != NIL + IF ( oCDOMsg := win_oleCreateObject( "CDO.Message" ) ) != NIL - oCDOConf := CreateObject( "CDO.Configuration" ) + oCDOConf := win_oleCreateObject( "CDO.Configuration" ) oCDOConf:Fields("http://schemas.microsoft.com/cdo/configuration/sendusing"):Value := 2 // ; cdoSendUsingPort oCDOConf:Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver"):Value := "localhost" @@ -385,10 +385,10 @@ STATIC PROCEDURE Exm_CDO() BEGIN SEQUENCE WITH {|oErr| Break( oErr )} oCDOMsg:Send() RECOVER - ? "Error: CDO send error.", OLEErrorText() + ? "Error: CDO send error.", win_oleErrorText() END SEQUENCE ELSE - ? "Error: CDO subsystem not available (needs Windows XP or upper).", OLEErrorText() + ? "Error: CDO subsystem not available (needs Windows XP or upper).", win_oleErrorText() ENDIF RETURN @@ -411,7 +411,7 @@ STATIC PROCEDURE Exm_ADODB() LOCAL oRs - IF ( oRs := CreateObject( "ADODB.Recordset" ) ) != NIL + IF ( oRs := win_oleCreateObject( "ADODB.Recordset" ) ) != NIL oRs:Open( "SELECT * FROM test ORDER BY First", ; "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + hb_DirBase() + "\..\..\hbodbc\tests\test.mdb",; diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 8efa16f7d3..6b79083caf 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -4371,9 +4371,14 @@ STATIC FUNCTION FN_Expand( cFileName, lCommandLine ) cExt := FN_ExtGet( cFileName ) aDir := Directory( cFileName ) FOR EACH aFile IN aDir - IF FN_ExtGet( aFile[ F_NAME ] ) == cExt /* Workaround to not find 'hello.prga' when looking for '*.prg' */ +#if defined( __PLATFORM__WINDOWS ) + /* Workaround to not find 'hello.prga' when looking for '*.prg' */ + IF Lower( FN_ExtGet( aFile[ F_NAME ] ) ) == Lower( cExt ) +#endif AAdd( aFilelist, hb_FNameMerge( FN_DirGet( cFileName ), aFile[ F_NAME ] ) ) +#if defined( __PLATFORM__WINDOWS ) ENDIF +#endif NEXT RETURN aFileList