From b36077420ee871fdb485ae072d21463af5641ce7 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 13 Dec 2009 13:49:14 +0000 Subject: [PATCH] 2009-12-13 14:46 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbwin/mapi.c + Added support for unlimited number of recipients and attached files. Please test and review. * utils/hbmk2/hbmk2.prg + Added support for linux/open64. (Please test) * INSTALL + Added open64. --- harbour/ChangeLog | 17 +++++- harbour/INSTALL | 2 + harbour/contrib/hbwin/mapi.c | 102 +++++++++++++++------------------- harbour/utils/hbmk2/hbmk2.prg | 29 +++++----- 4 files changed, 76 insertions(+), 74 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1e5a8364e6..8da6bbbea6 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,17 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-12-13 14:46 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbwin/mapi.c + + Added support for unlimited number of recipients and + attached files. Please test and review. + + * utils/hbmk2/hbmk2.prg + + Added support for linux/open64. (Please test) + + * INSTALL + + Added open64. + 2009-12-12 20:48 UTC-0300 Antonio Carlos Pantaglione * harbour/contrib/hbwin/tests/testmapi.prg ! Very small fix @@ -80,7 +91,7 @@ ! Added missing SVN ID. * Formatting. ; TOFIX: This example expects arrays and logical value from command line, - so it won't work. + so it won't work. [DONE] 2009-12-12 15:46 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * include/hbwinuni.h @@ -100,7 +111,7 @@ ! Fixed to use simple quote to include Harbour headers. ! Fixed Windows header inclusion. ! Disabled for UNICODE. - ! Fixed to not use return value on stack as temporary variable. + ! Fixed to not use return value on stack as temporary HB_ITEM. ! Fixed to not use static variable. ! Fixed UNICODE literals (also for WinCE). ! Fixed to not create NULL "holes" in passed to Windows lists @@ -117,7 +128,7 @@ + Added some provisions for UNICODE support. Otherwise whole code is disabled until this gets fully implemented. ; TODO: It'd be probably beneficial to remove artificial limit of - 100 recipients and file attachments. + 100 recipients and file attachments. [DONE] ; NOTE: I didn't make any functional tests, so please make some. An example/test code would be nice in tests subdir. diff --git a/harbour/INSTALL b/harbour/INSTALL index 0b0e5d8ba3..76945d5fe1 100644 --- a/harbour/INSTALL +++ b/harbour/INSTALL @@ -445,6 +445,7 @@ HARBOUR watcom - Open Watcom C/C++ icc - Intel(R) C/C++ sunpro - Sun Studio C/C++ + open64 - Open64 C/C++ darwin ------ @@ -1138,6 +1139,7 @@ HARBOUR linux -> linux/clang (CPU cross-builds possible) linux -> linux/icc (CPU cross-builds possible: x86, x86-64, ia64) linux -> linux/sunpro (CPU cross-builds possible: x86, x86-64) + linux -> linux/open64 x86-64 (CPU cross-builds possible: ia64, ...) x linux -> wce/mingwarm arm x linux -> wce/mingw x86 x linux -> win/mingw x86 diff --git a/harbour/contrib/hbwin/mapi.c b/harbour/contrib/hbwin/mapi.c index d46aa7ea1d..cecb079f1e 100644 --- a/harbour/contrib/hbwin/mapi.c +++ b/harbour/contrib/hbwin/mapi.c @@ -75,30 +75,40 @@ HB_FUNC( WIN_MAPISENDMAIL ) if( MAPISendMail ) { - HB_SIZE nLen, i; - PHB_ITEM pFrom = hb_param( 8, HB_IT_ARRAY ); - PHB_ITEM pToList = hb_param( 9, HB_IT_ARRAY ); + PHB_ITEM pRecpList = hb_param( 9, HB_IT_ARRAY ); PHB_ITEM pFileList = hb_param( 10, HB_IT_ARRAY ); - void * hString[ 4 + 2 + 2 * 100 + 2 * 100 ]; + HB_SIZE nRecpCount = pRecpList ? hb_arrayLen( pRecpList ) : 0; + HB_SIZE nFileCount = pFileList ? hb_arrayLen( pFileList ) : 0; + HB_SIZE i; + + void ** hString; int iString = 0; MapiMessage note; MapiRecipDesc origin; - FLAGS flags = MAPI_LOGON_UI; + FLAGS flags; ZeroMemory( ¬e, sizeof( MapiMessage ) ); ZeroMemory( &origin, sizeof( MapiRecipDesc ) ); + hString = ( void ** ) hb_xgrab( ( 4 + 2 + ( 2 * nRecpCount ) + ( 2 * nFileCount ) ) * sizeof( void * ) ); + note.lpszSubject = ( LPSTR ) HB_PARSTR( 1, &hString[ iString++ ], NULL ); note.lpszNoteText = ( LPSTR ) HB_PARSTR( 2, &hString[ iString++ ], NULL ); note.lpszMessageType = ( LPSTR ) HB_PARSTR( 3, &hString[ iString++ ], NULL ); note.lpszDateReceived = ( LPSTR ) HB_PARSTRDEF( 4, &hString[ iString++ ], NULL ); + note.lpRecips = nRecpCount > 0 ? ( MapiRecipDesc * ) hb_xgrab( nRecpCount * sizeof( MapiRecipDesc ) ) : NULL; + note.lpFiles = nFileCount > 0 ? ( MapiFileDesc * ) hb_xgrab( nFileCount * sizeof( MapiFileDesc ) ) : NULL; + note.nFileCount = 0; + note.nRecipCount = 0; if( hb_parl( 6 ) ) note.flFlags |= MAPI_RECEIPT_REQUESTED; + flags = MAPI_LOGON_UI; + if( hb_parl( 7 ) ) flags |= MAPI_DIALOG; @@ -113,78 +123,54 @@ HB_FUNC( WIN_MAPISENDMAIL ) note.lpOriginator = &origin; } - if( pToList && ( nLen = hb_arrayLen( pToList ) ) > 0 ) + for( i = 0; i < nRecpCount; ++i ) { - MapiRecipDesc recipList[ 100 ]; - ULONG ulCount = 0; + PHB_ITEM pItem = hb_arrayGetItemPtr( pRecpList, i + 1 ); - ZeroMemory( recipList, sizeof( recipList ) ); - - if( nLen >= HB_SIZEOFARRAY( recipList ) ) - nLen = HB_SIZEOFARRAY( recipList ); - - for( i = 0; i < nLen; ++i ) + if( HB_IS_ARRAY( pItem ) && hb_arrayLen( pItem ) >= 3 ) { - PHB_ITEM pItem = hb_arrayGetItemPtr( pToList, i + 1 ); - - if( HB_IS_ARRAY( pItem ) && hb_arrayLen( pItem ) >= 3 ) + if( hb_arrayGetCLen( pItem, 1 ) > 0 ) { - if( hb_arrayGetCLen( pItem, 1 ) > 0 ) - { - recipList[ ulCount ].lpszName = ( LPSTR ) HB_ARRAYGETSTR( pItem, 1, &hString[ iString++ ], NULL ); + note.lpRecips[ note.nRecipCount ].lpszName = ( LPSTR ) HB_ARRAYGETSTR( pItem, 1, &hString[ iString++ ], NULL ); - if( hb_arrayGetCLen( pItem, 2 ) > 0 ) - recipList[ ulCount ].lpszAddress = ( LPSTR ) HB_ARRAYGETSTR( pItem, 2, &hString[ iString++ ], NULL ); - } - else - recipList[ ulCount ].lpszName = ( LPSTR ) HB_ARRAYGETSTR( pItem, 2, &hString[ iString++ ], NULL ); - - recipList[ ulCount ].ulRecipClass = ( ULONG ) hb_arrayGetNL( pItem, 3 ); - - ++ulCount; + if( hb_arrayGetCLen( pItem, 2 ) > 0 ) + note.lpRecips[ note.nRecipCount ].lpszAddress = ( LPSTR ) HB_ARRAYGETSTR( pItem, 2, &hString[ iString++ ], NULL ); } + else + note.lpRecips[ note.nRecipCount ].lpszName = ( LPSTR ) HB_ARRAYGETSTR( pItem, 2, &hString[ iString++ ], NULL ); + + note.lpRecips[ note.nRecipCount ].ulRecipClass = ( ULONG ) hb_arrayGetNL( pItem, 3 ); + + ++note.nRecipCount; } - - note.lpRecips = recipList; - note.nRecipCount = ulCount; } - else - note.nRecipCount = 0; - if( pFileList && ( nLen = hb_arrayLen( pFileList ) ) > 0 ) + for( i = 0; i < nFileCount; ++i ) { - MapiFileDesc filedescList[ 100 ]; - ULONG ulCount = 0; + PHB_ITEM pItem = hb_arrayGetItemPtr( pFileList, i + 1 ); - ZeroMemory( filedescList, sizeof( filedescList ) ); - - if( nLen >= HB_SIZEOFARRAY( filedescList ) ) - nLen = HB_SIZEOFARRAY( filedescList ); - - for( i = 0; i < nLen; ++i ) + if( HB_IS_ARRAY( pItem ) && hb_arrayLen( pItem ) >= 1 ) { - PHB_ITEM pItem = hb_arrayGetItemPtr( pFileList, i + 1 ); - - if( HB_IS_ARRAY( pItem ) && hb_arrayLen( pItem ) >= 1 ) - { - filedescList[ ulCount ].ulReserved = 0; - filedescList[ ulCount ].lpszFileName = ( LPSTR ) HB_ARRAYGETSTR( pItem, 1, &hString[ iString++ ], NULL ); - filedescList[ ulCount ].lpszPathName = ( LPSTR ) HB_ARRAYGETSTR( pItem, 2, &hString[ iString++ ], NULL ); - filedescList[ ulCount ].nPosition = ( ULONG ) -1; - ++ulCount; - } + note.lpFiles[ note.nFileCount ].ulReserved = 0; + note.lpFiles[ note.nFileCount ].lpszFileName = ( LPSTR ) HB_ARRAYGETSTR( pItem, 1, &hString[ iString++ ], NULL ); + note.lpFiles[ note.nFileCount ].lpszPathName = ( LPSTR ) HB_ARRAYGETSTR( pItem, 2, &hString[ iString++ ], NULL ); + note.lpFiles[ note.nFileCount ].nPosition = ( ULONG ) -1; + ++note.nFileCount; } - - note.lpFiles = filedescList; - note.nFileCount = ulCount; } - else - note.nFileCount = 0; hb_retnint( ( *MAPISendMail )( 0, ( ULONG_PTR ) GetActiveWindow(), ¬e, flags, 0 ) ); + if( nRecpCount > 0 ) + hb_xfree( note.lpRecips ); + + if( nFileCount > 0 ) + hb_xfree( note.lpFiles ); + while( --iString >= 0 ) hb_strfree( hString[ iString ] ); + + hb_xfree( hString ); } FreeLibrary( hMapiDll ); diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 6e75164d33..307be537f6 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -973,7 +973,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) CASE hbmk[ _HBMK_cPLAT ] $ "bsd|hpux|sunos|beos|linux" .OR. hbmk[ _HBMK_cPLAT ] == "darwin" /* Separated to avoid match with 'win' */ DO CASE CASE hbmk[ _HBMK_cPLAT ] == "linux" - aCOMPSUP := { "gcc", "clang", "icc", "watcom", "sunpro" } + aCOMPSUP := { "gcc", "clang", "icc", "watcom", "sunpro", "open64" } CASE hbmk[ _HBMK_cPLAT ] == "darwin" aCOMPSUP := { "gcc", "clang", "icc" } CASE hbmk[ _HBMK_cPLAT ] == "sunos" @@ -2111,10 +2111,10 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) DEFAULT hbmk[ _HBMK_lSHAREDDIST ] TO lSysLoc - IF hbmk[ _HBMK_lSHAREDDIST ] .OR. !( hbmk[ _HBMK_cCOMP ] $ "gcc|clang" ) + IF hbmk[ _HBMK_lSHAREDDIST ] .OR. !( hbmk[ _HBMK_cCOMP ] $ "gcc|clang|open64" ) cPrefix := "" ELSE - /* Only supported by gcc, clang compilers. */ + /* Only supported by gcc, clang, open64 compilers. */ cPrefix := DirAddPathSep( l_cHB_DYN_INSTALL ) ENDIF #if 1 @@ -2211,7 +2211,8 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) ( hbmk[ _HBMK_cPLAT ] == "darwin" .AND. hbmk[ _HBMK_cCOMP ] == "icc" ) .OR. ; ( hbmk[ _HBMK_cPLAT ] == "linux" .AND. hbmk[ _HBMK_cCOMP ] == "clang" ) .OR. ; ( hbmk[ _HBMK_cPLAT ] == "darwin" .AND. hbmk[ _HBMK_cCOMP ] == "clang" ) .OR. ; - ( hbmk[ _HBMK_cPLAT ] == "beos" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) + ( hbmk[ _HBMK_cPLAT ] == "beos" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ; + ( hbmk[ _HBMK_cPLAT ] == "linux" .AND. hbmk[ _HBMK_cCOMP ] == "open64" ) nCmd_Esc := _ESC_NIX IF hbmk[ _HBMK_lDEBUG ] @@ -2242,6 +2243,8 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) AAdd( hbmk[ _HBMK_aOPTC ], "-D_GNU_SOURCE" ) CASE hbmk[ _HBMK_cCOMP ] == "clang" cBin_CompC := hbmk[ _HBMK_cCCPREFIX ] + "clang" + hbmk[ _HBMK_cCCPOSTFIX ] + CASE hbmk[ _HBMK_cCOMP ] == "open64" + cBin_CompC := iif( hbmk[ _HBMK_lCPP ] != NIL .AND. hbmk[ _HBMK_lCPP ], "openCC", "opencc" ) OTHERWISE cBin_CompC := hbmk[ _HBMK_cCCPREFIX ] + iif( hbmk[ _HBMK_lCPP ] != NIL .AND. hbmk[ _HBMK_lCPP ], "g++", "gcc" ) + hbmk[ _HBMK_cCCPOSTFIX ] ENDCASE @@ -4883,7 +4886,7 @@ STATIC FUNCTION FindNewerHeaders( hbmk, cFileName, cParentDir, tTimeParent, lInc ENDIF NEXT - ELSEIF lCMode .AND. hbmk[ _HBMK_nHEAD ] == _HEAD_NATIVE .AND. hbmk[ _HBMK_cCOMP ] $ "gcc|mingw|mingw64|mingwarm|cygwin|djgpp|gccomf|clang" + ELSEIF lCMode .AND. hbmk[ _HBMK_nHEAD ] == _HEAD_NATIVE .AND. hbmk[ _HBMK_cCOMP ] $ "gcc|mingw|mingw64|mingwarm|cygwin|djgpp|gccomf|clang|open64" IF hbmk[ _HBMK_lDEBUGINC ] hbmk_OutStd( hb_StrFormat( "debuginc: Calling C compiler to detect dependencies of %1$s", cFileName ) ) @@ -5337,7 +5340,7 @@ STATIC FUNCTION ListCookLib( hbmk, aLIB, aLIBA, array, cPrefix, cExtNew ) LOCAL cLibName LOCAL cLibNameCooked - IF hbmk[ _HBMK_cCOMP ] $ "gcc|mingw|mingw64|mingwarm|djgpp|cygwin|gccomf|clang" + IF hbmk[ _HBMK_cCOMP ] $ "gcc|mingw|mingw64|mingwarm|djgpp|cygwin|gccomf|clang|open64" FOR EACH cLibName IN array hb_FNameSplit( cLibName, @cDir ) IF Empty( cDir ) @@ -7296,12 +7299,12 @@ FUNCTION hbmk_KEYW( hbmk, cKeyword ) ENDIF IF ( cKeyword == "unix" .AND. ( hbmk[ _HBMK_cPLAT ] $ "bsd|hpux|sunos|beos|linux" .OR. hbmk[ _HBMK_cPLAT ] == "darwin" ) ) .OR. ; - ( cKeyword == "allwin" .AND. hbmk[ _HBMK_cPLAT ] $ "win|wce" ) .OR. ; - ( cKeyword == "allgcc" .AND. hbmk[ _HBMK_cCOMP ] $ "gcc|mingw|mingw64|mingwarm|cygwin|djgpp|gccomf|clang" ) .OR. ; - ( cKeyword == "allmingw" .AND. hbmk[ _HBMK_cCOMP ] $ "mingw|mingw64|mingwarm" ) .OR. ; - ( cKeyword == "allmsvc" .AND. hbmk[ _HBMK_cCOMP ] $ "msvc|msvc64|msvcia64|msvcarm" ) .OR. ; - ( cKeyword == "allpocc" .AND. hbmk[ _HBMK_cCOMP ] $ "pocc|pocc64|poccarm" ) .OR. ; - ( cKeyword == "allicc" .AND. hbmk[ _HBMK_cCOMP ] $ "icc|iccia64" ) + ( cKeyword == "allwin" .AND. hbmk[ _HBMK_cPLAT ] $ "win|wce" ) .OR. ; + ( cKeyword == "allgcc" .AND. hbmk[ _HBMK_cCOMP ] $ "gcc|mingw|mingw64|mingwarm|cygwin|djgpp|gccomf|clang|open64" ) .OR. ; + ( cKeyword == "allmingw" .AND. hbmk[ _HBMK_cCOMP ] $ "mingw|mingw64|mingwarm" ) .OR. ; + ( cKeyword == "allmsvc" .AND. hbmk[ _HBMK_cCOMP ] $ "msvc|msvc64|msvcia64|msvcarm" ) .OR. ; + ( cKeyword == "allpocc" .AND. hbmk[ _HBMK_cCOMP ] $ "pocc|pocc64|poccarm" ) .OR. ; + ( cKeyword == "allicc" .AND. hbmk[ _HBMK_cCOMP ] $ "icc|iccia64" ) RETURN .T. ENDIF @@ -7801,7 +7804,7 @@ STATIC PROCEDURE ShowHelp( lLong ) LOCAL aText_Supp := {; "",; I_( "Supported values for each supported value:" ),; - " - linux : gcc, clang, icc, watcom, sunpro",; + " - linux : gcc, clang, icc, watcom, sunpro, open64",; " - darwin : gcc, clang, icc",; " - win : mingw, msvc, bcc, watcom, icc, pocc, cygwin, xcc,",; " - mingw64, msvc64, msvcia64, iccia64, pocc64",;