From 362f7f8c69aeb1433fda4e50008c6775100343b7 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 11 Jun 2008 17:49:14 +0000 Subject: [PATCH] 2008-06-11 19:39 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/xhb/Makefile * contrib/xhb/common.mak - Removed some xhb specific non-standard headers from the list of those getting installed to the Harbour central include dir. Only hbcompat.ch, hbcompat.h and xhb.ch goes now to the official include dir. After this change has been merged with RC1, xhb.lib may be included in the default build. [RC1] * include/hbgtinfo.ch + Added comment to compatibility #defines, to not use them, since they're deprecated. [RC1] * include/hbgfx.ch * include/hbgfxdef.ch * contrib/gtwvg/gtwvg.c * source/rtl/gtxwc/gtxwc.c * source/rtl/gtwvt/gtwvt.c * GFX_* constants renamed to HB_GFX_*. The old ones are still working but it's recommended to update to use HB_GFX_*. #define HB_GT_NO_XHB to disable the compatibility #defines, if it collides with your code or you want to test after transition. ; [RC1] * source/rtl/dirdrive.c ! Guarded C53 undoc functions with HB_C52_UNDOC, which is enabled so it won't make a difference in default builds. ; [RC1] * contrib/hbfbird/make_b32.bat * contrib/hbfbird/make_vc.bat * Fixed location where .libs are looked for. [RC1] * contrib/hbcurl/hbcurl.c % Minor cleanups. [RC1] * contrib/hbodbc/make_vc.bat ! Removed .dll -> .lib conversion for MSVC, since the .lib is provided by the MS SDK anyway. ; [RC1] * contrib/hbcurl/hbcurl.c * contrib/hbcurl/hbcurl.ch * contrib/hbcurl/tests/ftp_uldl.prg ! Cleanup the rare case when curl_easy_init() returns NULL. Functions now always return the same type, even in case libcurl failed to initialize. + Return values for above cases is now HB_CURLE_ERROR (== -1). ! CURL_*() passed pointers now are also checked for the pointer type, and RTE is thrown if they are not HBCURL ones. So for example in the very rare case when any hbcurl functions would get passed a GC pointer returned by another API, an argument error would be thrown now. ! CURL_ESCAPE()/CURL_UNESCAPE() fixed picked parameter ordinal. + CURL_ESCAPE()/CURL_UNESCAPE() added parameter checking. ; [RC1] --- harbour-RC1/ChangeLog | 63 ++ harbour-RC1/contrib/gtwvg/gtwvg.c | 24 +- harbour-RC1/contrib/hbcurl/hbcurl.c | 716 +++++++++--------- harbour-RC1/contrib/hbcurl/hbcurl.ch | 1 + harbour-RC1/contrib/hbcurl/tests/ftp_uldl.prg | 10 +- harbour-RC1/contrib/hbfbird/make_b32.bat | 2 +- harbour-RC1/contrib/hbfbird/make_vc.bat | 2 +- harbour-RC1/contrib/hbodbc/make_vc.bat | 18 - harbour-RC1/contrib/xhb/Makefile | 14 +- harbour-RC1/contrib/xhb/common.mak | 14 +- harbour-RC1/include/hbgfx.ch | 49 +- harbour-RC1/include/hbgfxdef.ch | 91 ++- harbour-RC1/include/hbgtinfo.ch | 4 +- harbour-RC1/source/rtl/dirdrive.c | 3 + harbour-RC1/source/rtl/gtwvt/gtwvt.c | 24 +- harbour-RC1/source/rtl/gtxwc/gtxwc.c | 40 +- 16 files changed, 563 insertions(+), 512 deletions(-) diff --git a/harbour-RC1/ChangeLog b/harbour-RC1/ChangeLog index 18b6e3ecbb..3463fb3fcc 100644 --- a/harbour-RC1/ChangeLog +++ b/harbour-RC1/ChangeLog @@ -8,6 +8,69 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-06-11 19:39 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * contrib/xhb/Makefile + * contrib/xhb/common.mak + - Removed some xhb specific non-standard headers from + the list of those getting installed to the Harbour central + include dir. Only hbcompat.ch, hbcompat.h and xhb.ch + goes now to the official include dir. After this change + has been merged with RC1, xhb.lib may be included in + the default build. + [RC1] + + * include/hbgtinfo.ch + + Added comment to compatibility #defines, to not use + them, since they're deprecated. + [RC1] + + * include/hbgfx.ch + * include/hbgfxdef.ch + * contrib/gtwvg/gtwvg.c + * source/rtl/gtxwc/gtxwc.c + * source/rtl/gtwvt/gtwvt.c + * GFX_* constants renamed to HB_GFX_*. The old ones are + still working but it's recommended to update to use HB_GFX_*. + #define HB_GT_NO_XHB to disable the compatibility #defines, + if it collides with your code or you want to test after + transition. + ; [RC1] + + * source/rtl/dirdrive.c + ! Guarded C53 undoc functions with HB_C52_UNDOC, which is enabled + so it won't make a difference in default builds. + ; [RC1] + + * contrib/hbfbird/make_b32.bat + * contrib/hbfbird/make_vc.bat + * Fixed location where .libs are looked for. + [RC1] + + * contrib/hbcurl/hbcurl.c + % Minor cleanups. + [RC1] + + * contrib/hbodbc/make_vc.bat + ! Removed .dll -> .lib conversion for MSVC, + since the .lib is provided by the MS SDK anyway. + ; [RC1] + + * contrib/hbcurl/hbcurl.c + * contrib/hbcurl/hbcurl.ch + * contrib/hbcurl/tests/ftp_uldl.prg + ! Cleanup the rare case when curl_easy_init() returns NULL. + Functions now always return the same type, even in case libcurl + failed to initialize. + + Return values for above cases is now HB_CURLE_ERROR (== -1). + ! CURL_*() passed pointers now are also checked for the pointer + type, and RTE is thrown if they are not HBCURL ones. So for + example in the very rare case when any hbcurl functions would + get passed a GC pointer returned by another API, an argument + error would be thrown now. + ! CURL_ESCAPE()/CURL_UNESCAPE() fixed picked parameter ordinal. + + CURL_ESCAPE()/CURL_UNESCAPE() added parameter checking. + ; [RC1] + 2008-06-07 09:40 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * contrib/hbcurl/hbcurl.c + Added RTEs when wrong parameter was passed diff --git a/harbour-RC1/contrib/gtwvg/gtwvg.c b/harbour-RC1/contrib/gtwvg/gtwvg.c index d87d0453b8..97f482f04b 100644 --- a/harbour-RC1/contrib/gtwvg/gtwvg.c +++ b/harbour-RC1/contrib/gtwvg/gtwvg.c @@ -2529,16 +2529,16 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, { switch( iType ) { - case GFX_ACQUIRESCREEN: - case GFX_RELEASESCREEN: + case HB_GFX_ACQUIRESCREEN: + case HB_GFX_RELEASESCREEN: iRet = 1; break; - case GFX_MAKECOLOR: + case HB_GFX_MAKECOLOR: iRet = (iTop << 16) | (iLeft << 8) | ( iBottom ); break; - case GFX_PUTPIXEL: + case HB_GFX_PUTPIXEL: SetGFXContext( iBottom ); MoveToEx( hdc, iLeft, iTop, NULL ); @@ -2548,7 +2548,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; - case GFX_LINE: + case HB_GFX_LINE: SetGFXContext( iColor ); MoveToEx( hdc, iLeft, iTop, NULL ); @@ -2558,7 +2558,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; - case GFX_RECT: + case HB_GFX_RECT: { RECT r; @@ -2575,7 +2575,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; } - case GFX_FILLEDRECT: + case HB_GFX_FILLEDRECT: SetGFXContext( iColor ); Rectangle( hdc, iLeft, iTop, iRight, iBottom ); @@ -2584,7 +2584,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; - case GFX_CIRCLE: + case HB_GFX_CIRCLE: SetGFXContext( iRight ); Arc( hdc, iLeft - iBottom / 2, iTop - iBottom / 2, iLeft + iBottom / 2, iTop + iBottom / 2, 0, 0, 0, 0 ); @@ -2593,7 +2593,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; - case GFX_FILLEDCIRCLE: + case HB_GFX_FILLEDCIRCLE: SetGFXContext( iRight ); Ellipse( hdc, iLeft - iBottom / 2, iTop - iBottom / 2, iLeft + iBottom / 2, iTop + iBottom / 2 ); @@ -2602,7 +2602,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; - case GFX_ELLIPSE: + case HB_GFX_ELLIPSE: SetGFXContext( iColor ); Arc( hdc, iLeft - iRight / 2, iTop - iBottom / 2, iLeft + iRight / 2, iTop + iBottom / 2, 0, 0, 0, 0 ); @@ -2611,7 +2611,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; - case GFX_FILLEDELLIPSE: + case HB_GFX_FILLEDELLIPSE: SetGFXContext( iColor ); Ellipse( hdc, iLeft - iRight / 2, iTop - iBottom / 2, iLeft + iRight / 2, iTop + iBottom / 2 ); @@ -2620,7 +2620,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; - case GFX_FLOODFILL: + case HB_GFX_FLOODFILL: SetGFXContext( iBottom ); FloodFill( hdc, iLeft, iTop, iColor ); diff --git a/harbour-RC1/contrib/hbcurl/hbcurl.c b/harbour-RC1/contrib/hbcurl/hbcurl.c index 3571b19cac..01206a2f36 100644 --- a/harbour-RC1/contrib/hbcurl/hbcurl.c +++ b/harbour-RC1/contrib/hbcurl/hbcurl.c @@ -52,9 +52,9 @@ * */ -/* NOTE: Harbour requires libcurl 7.17.0 or upper. - This was the version where curl_easy_setopt() started to - make copies of passed strings, which we currently require. +/* NOTE: Harbour requires libcurl 7.17.0 or upper. + This was the version where curl_easy_setopt() started to + make copies of passed strings, which we currently require. [vszakats] */ #include "curl/curl.h" @@ -379,56 +379,50 @@ static void hb_curl_buff_dl_free( PHB_CURL hb_curl ) static void PHB_CURL_free( PHB_CURL hb_curl, BOOL bFree ) { - if( hb_curl->curl ) + curl_easy_setopt( hb_curl->curl, CURLOPT_READFUNCTION, NULL ); + curl_easy_setopt( hb_curl->curl, CURLOPT_READDATA, NULL ); + curl_easy_setopt( hb_curl->curl, CURLOPT_WRITEFUNCTION, NULL ); + curl_easy_setopt( hb_curl->curl, CURLOPT_WRITEDATA, NULL ); + curl_easy_setopt( hb_curl->curl, CURLOPT_PROGRESSFUNCTION, NULL ); + curl_easy_setopt( hb_curl->curl, CURLOPT_PROGRESSDATA, NULL ); + + /* Some extra safety. Set these to NULL, before freeing their pointers. */ + curl_easy_setopt( hb_curl->curl, CURLOPT_HTTPPOST, NULL ); + curl_easy_setopt( hb_curl->curl, CURLOPT_HTTPHEADER, NULL ); + curl_easy_setopt( hb_curl->curl, CURLOPT_HTTP200ALIASES, NULL ); + curl_easy_setopt( hb_curl->curl, CURLOPT_QUOTE, NULL ); + curl_easy_setopt( hb_curl->curl, CURLOPT_POSTQUOTE, NULL ); + curl_easy_setopt( hb_curl->curl, CURLOPT_PREQUOTE, NULL ); + curl_easy_setopt( hb_curl->curl, CURLOPT_TELNETOPTIONS, NULL ); + + hb_curl_form_free( &hb_curl->pHTTPPOST_First ); + hb_curl_form_free( &hb_curl->pHTTPPOST_Last ); + hb_curl_slist_free( &hb_curl->pHTTPHEADER ); + hb_curl_slist_free( &hb_curl->pHTTP200ALIASES ); + hb_curl_slist_free( &hb_curl->pQUOTE ); + hb_curl_slist_free( &hb_curl->pPOSTQUOTE ); + hb_curl_slist_free( &hb_curl->pPREQUOTE ); + hb_curl_slist_free( &hb_curl->pTELNETOPTIONS ); + + hb_curl_file_ul_free( hb_curl ); + hb_curl_file_dl_free( hb_curl ); + + hb_curl_buff_ul_free( hb_curl ); + hb_curl_buff_dl_free( hb_curl ); + + if( hb_curl->pProgressBlock ) { - curl_easy_setopt( hb_curl->curl, CURLOPT_READFUNCTION, NULL ); - curl_easy_setopt( hb_curl->curl, CURLOPT_READDATA, NULL ); - curl_easy_setopt( hb_curl->curl, CURLOPT_WRITEFUNCTION, NULL ); - curl_easy_setopt( hb_curl->curl, CURLOPT_WRITEDATA, NULL ); - curl_easy_setopt( hb_curl->curl, CURLOPT_PROGRESSFUNCTION, NULL ); - curl_easy_setopt( hb_curl->curl, CURLOPT_PROGRESSDATA, NULL ); - - /* Some extra safety. Set these to NULL, before freeing their pointers. */ - curl_easy_setopt( hb_curl->curl, CURLOPT_HTTPPOST, NULL ); - curl_easy_setopt( hb_curl->curl, CURLOPT_HTTPHEADER, NULL ); - curl_easy_setopt( hb_curl->curl, CURLOPT_HTTP200ALIASES, NULL ); - curl_easy_setopt( hb_curl->curl, CURLOPT_QUOTE, NULL ); - curl_easy_setopt( hb_curl->curl, CURLOPT_POSTQUOTE, NULL ); - curl_easy_setopt( hb_curl->curl, CURLOPT_PREQUOTE, NULL ); - curl_easy_setopt( hb_curl->curl, CURLOPT_TELNETOPTIONS, NULL ); - - hb_curl_form_free( &hb_curl->pHTTPPOST_First ); - hb_curl_form_free( &hb_curl->pHTTPPOST_Last ); - hb_curl_slist_free( &hb_curl->pHTTPHEADER ); - hb_curl_slist_free( &hb_curl->pHTTP200ALIASES ); - hb_curl_slist_free( &hb_curl->pQUOTE ); - hb_curl_slist_free( &hb_curl->pPOSTQUOTE ); - hb_curl_slist_free( &hb_curl->pPREQUOTE ); - hb_curl_slist_free( &hb_curl->pTELNETOPTIONS ); - - hb_curl_file_ul_free( hb_curl ); - hb_curl_file_dl_free( hb_curl ); - - hb_curl_buff_ul_free( hb_curl ); - hb_curl_buff_dl_free( hb_curl ); - - if( hb_curl->pProgressBlock ) - { - hb_itemRelease( hb_curl->pProgressBlock ); - hb_curl->pProgressBlock = NULL; - } - - if( bFree ) - { - curl_easy_cleanup( hb_curl->curl ); - hb_curl->curl = NULL; - } - else - curl_easy_reset( hb_curl->curl ); + hb_itemRelease( hb_curl->pProgressBlock ); + hb_curl->pProgressBlock = NULL; } if( bFree ) + { + curl_easy_cleanup( hb_curl->curl ); hb_xfree( hb_curl ); + } + else + curl_easy_reset( hb_curl->curl ); } /* NOTE: Will create a new one. If 'from' is specified, the new one @@ -472,10 +466,12 @@ static void PHB_CURL_ret( PHB_CURL from ) * ph = ( void * ) PHB_CURL_create( from ); - if( * ph ) - hb_retptrGC( ph ); - else - hb_retptr( NULL ); + hb_retptrGC( ph ); +} + +static void ** PHB_CURL_is( int iParam ) +{ + return hb_parptrGC( PHB_CURL_release, iParam ); } static PHB_CURL PHB_CURL_par( int iParam ) @@ -495,7 +491,7 @@ HB_FUNC( CURL_EASY_INIT ) HB_FUNC( CURL_EASY_DUPLICATE ) { - if( ISPOINTER( 1 ) ) + if( PHB_CURL_is( 1 ) ) PHB_CURL_ret( PHB_CURL_par( 1 ) ); else hb_errRT_BASE( EG_ARG, 2010, NULL, "CURL_EASY_DUPLICATE", HB_ERR_ARGS_BASEPARAMS ); @@ -503,15 +499,15 @@ HB_FUNC( CURL_EASY_DUPLICATE ) HB_FUNC( CURL_EASY_CLEANUP ) { - if( ISPOINTER( 1 ) ) + if( PHB_CURL_is( 1 ) ) { void ** ph = ( void ** ) hb_parptrGC( PHB_CURL_release, 1 ); - + if( ph && * ph ) { /* Destroy the object */ PHB_CURL_free( ( PHB_CURL ) * ph, TRUE ); - + /* set pointer to NULL to avoid multiple freeing */ * ph = NULL; } @@ -524,10 +520,10 @@ HB_FUNC( CURL_EASY_CLEANUP ) HB_FUNC( CURL_EASY_RESET ) { - if( ISPOINTER( 1 ) ) + if( PHB_CURL_is( 1 ) ) { PHB_CURL hb_curl = PHB_CURL_par( 1 ); - + if( hb_curl ) PHB_CURL_free( hb_curl, FALSE ); } @@ -541,12 +537,11 @@ HB_FUNC( CURL_EASY_RESET ) HB_FUNC( CURL_EASY_PAUSE ) { - if( ISPOINTER( 1 ) ) + if( PHB_CURL_is( 1 ) ) { PHB_CURL hb_curl = PHB_CURL_par( 1 ); - - if( hb_curl ) - hb_retnl( ( long ) curl_easy_pause( hb_curl->curl, hb_parni( 2 ) ) ); + + hb_retnl( hb_curl ? ( long ) curl_easy_pause( hb_curl->curl, hb_parni( 2 ) ) : HB_CURLE_ERROR ); } else hb_errRT_BASE( EG_ARG, 2010, NULL, "CURL_EASY_PAUSE", HB_ERR_ARGS_BASEPARAMS ); @@ -556,12 +551,11 @@ HB_FUNC( CURL_EASY_PAUSE ) HB_FUNC( CURL_EASY_PERFORM ) { - if( ISPOINTER( 1 ) ) + if( PHB_CURL_is( 1 ) ) { PHB_CURL hb_curl = PHB_CURL_par( 1 ); - - if( hb_curl ) - hb_retnl( ( long ) curl_easy_perform( hb_curl->curl ) ); + + hb_retnl( hb_curl ? ( long ) curl_easy_perform( hb_curl->curl ) : HB_CURLE_ERROR ); } else hb_errRT_BASE( EG_ARG, 2010, NULL, "CURL_EASY_PERFORM", HB_ERR_ARGS_BASEPARAMS ); @@ -572,18 +566,21 @@ HB_FUNC( CURL_EASY_PERFORM ) /* NOTE: curl_easy_send( curl, cBuffer, @nSentBytes ) -> nResult */ HB_FUNC( CURL_EASY_SEND ) { - if( ISPOINTER( 1 ) ) + if( PHB_CURL_is( 1 ) ) { PHB_CURL hb_curl = PHB_CURL_par( 1 ); - + CURLcode res = ( CURLcode ) HB_CURLE_ERROR; + if( hb_curl ) { size_t size = 0; - - hb_retnl( ( long ) curl_easy_send( hb_curl->curl, ( void * ) hb_parcx( 2 ), ( size_t ) hb_parclen( 2 ), &size ) ); - + + res = curl_easy_send( hb_curl->curl, ( void * ) hb_parcx( 2 ), ( size_t ) hb_parclen( 2 ), &size ); + hb_stornl( size, 3 ); } + + hb_retnl( ( long ) res ); } else hb_errRT_BASE( EG_ARG, 2010, NULL, "CURL_EASY_SEND", HB_ERR_ARGS_BASEPARAMS ); @@ -592,25 +589,28 @@ HB_FUNC( CURL_EASY_SEND ) /* NOTE: curl_easy_recv( curl, @cBuffer ) -> nResult */ HB_FUNC( CURL_EASY_RECV ) { - if( ISPOINTER( 1 ) ) + if( PHB_CURL_is( 1 ) ) { PHB_CURL hb_curl = PHB_CURL_par( 1 ); - + CURLcode res = ( CURLcode ) HB_CURLE_ERROR; + if( hb_curl ) { size_t size = ( size_t ) hb_parclen( 2 ); void * buffer; - + if( size < 1024 ) size = 1024; - + buffer = hb_xgrab( size ); - - hb_retnl( ( long ) curl_easy_recv( hb_curl->curl, buffer, size, &size ) ); - + + res = curl_easy_recv( hb_curl->curl, buffer, size, &size ); + if( ! hb_storclen_buffer( ( char * ) buffer, size, 2 ) ) hb_free( buffer ); } + + hb_retnl( ( long ) res ); } else hb_errRT_BASE( EG_ARG, 2010, NULL, "CURL_EASY_RECV", HB_ERR_ARGS_BASEPARAMS ); @@ -620,17 +620,17 @@ HB_FUNC( CURL_EASY_RECV ) HB_FUNC( CURL_EASY_SETOPT ) { - if( ISPOINTER( 1 ) && ISNUM( 2 ) ) + if( PHB_CURL_is( 1 ) && ISNUM( 2 ) ) { PHB_CURL hb_curl = PHB_CURL_par( 1 ); - CURLcode res = ( CURLcode ) -1; - + CURLcode res = ( CURLcode ) HB_CURLE_ERROR; + if( hb_curl ) { switch( hb_parni( 2 ) ) { /* Behavior */ - + case HB_CURLOPT_VERBOSE: res = curl_easy_setopt( hb_curl->curl, CURLOPT_VERBOSE, HB_CURL_OPT_BOOL( 3 ) ); break; @@ -643,9 +643,9 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_NOSIGNAL: res = curl_easy_setopt( hb_curl->curl, CURLOPT_NOSIGNAL, HB_CURL_OPT_BOOL( 3 ) ); break; - + /* Callback */ - + /* These are hidden on the Harbour level: */ /* HB_CURLOPT_WRITEFUNCTION */ /* HB_CURLOPT_WRITEDATA */ @@ -672,18 +672,18 @@ HB_FUNC( CURL_EASY_SETOPT ) /* HB_CURLOPT_CONV_TO_NETWORK_FUNCTION */ /* HB_CURLOPT_CONV_FROM_NETWORK_FUNCTION */ /* HB_CURLOPT_CONV_FROM_UTF8_FUNCTION */ - + /* Error */ - + /* HB_CURLOPT_ERRORBUFFER */ /* HB_CURLOPT_STDERR */ - + case HB_CURLOPT_FAILONERROR: res = curl_easy_setopt( hb_curl->curl, CURLOPT_FAILONERROR, HB_CURL_OPT_BOOL( 3 ) ); break; - + /* Network */ - + /* This is the only option that must be set before curl_easy_perform() is called. */ case HB_CURLOPT_URL: res = curl_easy_setopt( hb_curl->curl, CURLOPT_URL, hb_parc( 3 ) ); @@ -700,11 +700,11 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_HTTPPROXYTUNNEL: res = curl_easy_setopt( hb_curl->curl, CURLOPT_HTTPPROXYTUNNEL, HB_CURL_OPT_BOOL( 3 ) ); break; -/* +/* case HB_CURLOPT_SOCKS5_RESOLVE_LOCAL: res = curl_easy_setopt( hb_curl->curl, CURLOPT_SOCKS5_RESOLVE_LOCAL, HB_CURL_OPT_BOOL( 3 ) ); break; -*/ +*/ case HB_CURLOPT_INTERFACE: res = curl_easy_setopt( hb_curl->curl, CURLOPT_INTERFACE, hb_parc( 3 ) ); break; @@ -729,9 +729,9 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_TCP_NODELAY: res = curl_easy_setopt( hb_curl->curl, CURLOPT_TCP_NODELAY, HB_CURL_OPT_BOOL( 3 ) ); break; - + /* Names and passwords options (Authentication) */ - + case HB_CURLOPT_NETRC: res = curl_easy_setopt( hb_curl->curl, CURLOPT_NETRC, hb_parnl( 3 ) ); break; @@ -750,9 +750,9 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_PROXYAUTH: res = curl_easy_setopt( hb_curl->curl, CURLOPT_PROXYAUTH, hb_parnl( 3 ) ); break; - + /* HTTP options */ - + case HB_CURLOPT_AUTOREFERER: res = curl_easy_setopt( hb_curl->curl, CURLOPT_AUTOREFERER, HB_CURL_OPT_BOOL( 3 ) ); break; @@ -790,23 +790,23 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_HTTPPOST: { PHB_ITEM pArray = hb_param( 3, HB_IT_ARRAY ); - + if( pArray ) { ULONG ulPos; ULONG ulArrayLen = hb_arrayLen( pArray ); - + for( ulPos = 0; ulPos < ulArrayLen; ulPos++ ) { PHB_ITEM pSubArray = hb_arrayGetItemPtr( pArray, ulPos + 1 ); - + curl_formadd( &hb_curl->pHTTPPOST_First, &hb_curl->pHTTPPOST_Last, CURLFORM_COPYNAME, hb_arrayGetCPtr( pSubArray, 1 ), CURLFORM_FILE, hb_arrayGetCPtr( pSubArray, 2 ), CURLFORM_END ); } - + res = curl_easy_setopt( hb_curl->curl, CURLOPT_HTTPPOST, hb_curl->pHTTPPOST_First ); } } @@ -820,18 +820,18 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_HTTPHEADER: { PHB_ITEM pArray = hb_param( 3, HB_IT_ARRAY ); - + curl_easy_setopt( hb_curl->curl, CURLOPT_HTTPHEADER, NULL ); hb_curl_slist_free( &hb_curl->pHTTPHEADER ); - + if( pArray ) { ULONG ulPos; ULONG ulArrayLen = hb_arrayLen( pArray ); - + for( ulPos = 0; ulPos < ulArrayLen; ulPos++ ) hb_curl->pHTTPHEADER = curl_slist_append( hb_curl->pHTTPHEADER, hb_arrayGetCPtr( pArray, ulPos + 1 ) ); - + res = curl_easy_setopt( hb_curl->curl, CURLOPT_HTTPHEADER, hb_curl->pHTTPHEADER ); } } @@ -839,18 +839,18 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_HTTP200ALIASES: { PHB_ITEM pArray = hb_param( 3, HB_IT_ARRAY ); - + curl_easy_setopt( hb_curl->curl, CURLOPT_HTTP200ALIASES, NULL ); hb_curl_slist_free( &hb_curl->pHTTP200ALIASES ); - + if( pArray ) { ULONG ulPos; ULONG ulArrayLen = hb_arrayLen( pArray ); - + for( ulPos = 0; ulPos < ulArrayLen; ulPos++ ) hb_curl->pHTTP200ALIASES = curl_slist_append( hb_curl->pHTTP200ALIASES, hb_arrayGetCPtr( pArray, ulPos + 1 ) ); - + res = curl_easy_setopt( hb_curl->curl, CURLOPT_HTTP200ALIASES, hb_curl->pHTTP200ALIASES ); } } @@ -885,27 +885,27 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_HTTP_TRANSFER_DECODING: res = curl_easy_setopt( hb_curl->curl, CURLOPT_HTTP_TRANSFER_DECODING, HB_CURL_OPT_BOOL( 3 ) ); break; - + /* FTP options */ - + case HB_CURLOPT_FTPPORT: res = curl_easy_setopt( hb_curl->curl, CURLOPT_FTPPORT, hb_parc( 3 ) ); break; case HB_CURLOPT_QUOTE: { PHB_ITEM pArray = hb_param( 3, HB_IT_ARRAY ); - + curl_easy_setopt( hb_curl->curl, CURLOPT_QUOTE, NULL ); hb_curl_slist_free( &hb_curl->pQUOTE ); - + if( pArray ) { ULONG ulPos; ULONG ulArrayLen = hb_arrayLen( pArray ); - + for( ulPos = 0; ulPos < ulArrayLen; ulPos++ ) hb_curl->pQUOTE = curl_slist_append( hb_curl->pQUOTE, hb_arrayGetCPtr( pArray, ulPos + 1 ) ); - + res = curl_easy_setopt( hb_curl->curl, CURLOPT_QUOTE, hb_curl->pQUOTE ); } } @@ -913,18 +913,18 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_POSTQUOTE: { PHB_ITEM pArray = hb_param( 3, HB_IT_ARRAY ); - + curl_easy_setopt( hb_curl->curl, CURLOPT_POSTQUOTE, NULL ); hb_curl_slist_free( &hb_curl->pPOSTQUOTE ); - + if( pArray ) { ULONG ulPos; ULONG ulArrayLen = hb_arrayLen( pArray ); - + for( ulPos = 0; ulPos < ulArrayLen; ulPos++ ) hb_curl->pPOSTQUOTE = curl_slist_append( hb_curl->pPOSTQUOTE, hb_arrayGetCPtr( pArray, ulPos + 1 ) ); - + res = curl_easy_setopt( hb_curl->curl, CURLOPT_POSTQUOTE, hb_curl->pPOSTQUOTE ); } } @@ -932,18 +932,18 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_PREQUOTE: { PHB_ITEM pArray = hb_param( 3, HB_IT_ARRAY ); - + curl_easy_setopt( hb_curl->curl, CURLOPT_PREQUOTE, NULL ); hb_curl_slist_free( &hb_curl->pPREQUOTE ); - + if( pArray ) { ULONG ulPos; ULONG ulArrayLen = hb_arrayLen( pArray ); - + for( ulPos = 0; ulPos < ulArrayLen; ulPos++ ) hb_curl->pQUOTE = curl_slist_append( hb_curl->pPREQUOTE, hb_arrayGetCPtr( pArray, ulPos + 1 ) ); - + res = curl_easy_setopt( hb_curl->curl, CURLOPT_PREQUOTE, hb_curl->pPREQUOTE ); } } @@ -989,9 +989,9 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_FTP_FILEMETHOD: res = curl_easy_setopt( hb_curl->curl, CURLOPT_FTP_FILEMETHOD, hb_parnl( 3 ) ); break; - + /* Protocol */ - + case HB_CURLOPT_TRANSFERTEXT: res = curl_easy_setopt( hb_curl->curl, CURLOPT_TRANSFERTEXT, HB_CURL_OPT_BOOL( 3 ) ); break; @@ -1043,9 +1043,9 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_TIMEVALUE: res = curl_easy_setopt( hb_curl->curl, CURLOPT_TIMEVALUE, hb_parnl( 3 ) ); break; - + /* Connection */ - + case HB_CURLOPT_TIMEOUT: res = curl_easy_setopt( hb_curl->curl, CURLOPT_TIMEOUT, hb_parnl( 3 ) ); break; @@ -1088,9 +1088,9 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_CONNECT_ONLY: res = curl_easy_setopt( hb_curl->curl, CURLOPT_CONNECT_ONLY, HB_CURL_OPT_BOOL( 3 ) ); break; - + /* SSL and Security */ - + case HB_CURLOPT_SSLCERT: res = curl_easy_setopt( hb_curl->curl, CURLOPT_SSLCERT, hb_parc( 3 ) ); break; @@ -1142,9 +1142,9 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_KRBLEVEL: /* HB_CURLOPT_KRB4LEVEL */ res = curl_easy_setopt( hb_curl->curl, CURLOPT_KRBLEVEL, hb_parc( 3 ) ); break; - + /* SSH options */ - + case HB_CURLOPT_SSH_AUTH_TYPES: res = curl_easy_setopt( hb_curl->curl, CURLOPT_SSH_AUTH_TYPES, hb_parnl( 3 ) ); break; @@ -1157,160 +1157,160 @@ HB_FUNC( CURL_EASY_SETOPT ) case HB_CURLOPT_SSH_PRIVATE_KEYFILE: res = curl_easy_setopt( hb_curl->curl, CURLOPT_SSH_PRIVATE_KEYFILE, hb_parc( 3 ) ); break; - + /* Other options */ - + case HB_CURLOPT_PRIVATE: res = curl_easy_setopt( hb_curl->curl, CURLOPT_PRIVATE, hb_parptr( 3 ) ); break; - + /* HB_CURLOPT_SHARE */ - + case HB_CURLOPT_NEW_FILE_PERMS: res = curl_easy_setopt( hb_curl->curl, CURLOPT_NEW_FILE_PERMS, hb_parnl( 3 ) ); break; case HB_CURLOPT_NEW_DIRECTORY_PERMS: res = curl_easy_setopt( hb_curl->curl, CURLOPT_NEW_DIRECTORY_PERMS, hb_parnl( 3 ) ); break; - + /* Telnet options */ - + case HB_CURLOPT_TELNETOPTIONS: { PHB_ITEM pArray = hb_param( 3, HB_IT_ARRAY ); - + curl_easy_setopt( hb_curl->curl, CURLOPT_TELNETOPTIONS, NULL ); hb_curl_slist_free( &hb_curl->pTELNETOPTIONS ); - + if( pArray ) { ULONG ulPos; ULONG ulArrayLen = hb_arrayLen( pArray ); - + for( ulPos = 0; ulPos < ulArrayLen; ulPos++ ) hb_curl->pTELNETOPTIONS = curl_slist_append( hb_curl->pTELNETOPTIONS, hb_arrayGetCPtr( pArray, ulPos + 1 ) ); - + res = curl_easy_setopt( hb_curl->curl, CURLOPT_TELNETOPTIONS, hb_curl->pTELNETOPTIONS ); } } break; - + /* Undocumented */ - + /* HB_CURLOPT_WRITEINFO */ - + /* Harbour specials */ - + case HB_CURLOPT_PROGRESSBLOCK: { PHB_ITEM pProgressBlock = hb_param( 3, HB_IT_BLOCK ); - + if( hb_curl->pProgressBlock ) { curl_easy_setopt( hb_curl->curl, CURLOPT_PROGRESSFUNCTION, NULL ); curl_easy_setopt( hb_curl->curl, CURLOPT_PROGRESSDATA, NULL ); - + hb_itemRelease( hb_curl->pProgressBlock ); hb_curl->pProgressBlock = NULL; } - + if( pProgressBlock ) { hb_curl->pProgressBlock = hb_itemNew( pProgressBlock ); - + curl_easy_setopt( hb_curl->curl, CURLOPT_PROGRESSFUNCTION, hb_curl_progress_callback ); res = curl_easy_setopt( hb_curl->curl, CURLOPT_PROGRESSDATA, ( void * ) hb_curl->pProgressBlock ); } } break; - + case HB_CURLOPT_UL_FILE_SETUP: { hb_curl_file_ul_free( hb_curl ); - + if( ISCHAR( 3 ) ) { hb_curl->ul_name = ( BYTE * ) hb_strdup( hb_parc( 3 ) ); hb_curl->ul_handle = FS_ERROR; - + curl_easy_setopt( hb_curl->curl, CURLOPT_READFUNCTION, hb_curl_read_file_callback ); res = curl_easy_setopt( hb_curl->curl, CURLOPT_READDATA, ( void * ) hb_curl ); } } break; - + case HB_CURLOPT_UL_FILE_CLOSE: hb_curl_file_ul_free( hb_curl ); res = CURLE_OK; break; - + case HB_CURLOPT_DL_FILE_SETUP: { hb_curl_file_dl_free( hb_curl ); - + if( ISCHAR( 3 ) ) { hb_curl->dl_name = ( BYTE * ) hb_strdup( hb_parc( 3 ) ); hb_curl->dl_handle = FS_ERROR; - + curl_easy_setopt( hb_curl->curl, CURLOPT_WRITEFUNCTION, hb_curl_write_file_callback ); res = curl_easy_setopt( hb_curl->curl, CURLOPT_WRITEDATA, ( void * ) hb_curl ); } } break; - + case HB_CURLOPT_DL_FILE_CLOSE: hb_curl_file_dl_free( hb_curl ); res = CURLE_OK; break; - + case HB_CURLOPT_UL_BUFF_SETUP: { hb_curl_buff_ul_free( hb_curl ); - + if( ISCHAR( 3 ) ) { hb_curl->ul_pos = 0; hb_curl->ul_len = hb_parclen( 3 ); hb_curl->ul_ptr = ( BYTE * ) hb_xgrab( hb_curl->ul_len ); - + hb_xmemcpy( hb_curl->ul_ptr, hb_parc( 3 ), hb_curl->ul_len ); - + curl_easy_setopt( hb_curl->curl, CURLOPT_READFUNCTION, hb_curl_read_buff_callback ); res = curl_easy_setopt( hb_curl->curl, CURLOPT_READDATA, ( void * ) hb_curl ); } } break; - + case HB_CURLOPT_DL_BUFF_SETUP: { hb_curl_buff_dl_free( hb_curl ); - + hb_curl->dl_pos = 0; hb_curl->dl_len = ISNUM( 3 ) ? hb_parnl( 3 ) : HB_CURL_DL_BUFF_SIZE_INIT; hb_curl->dl_ptr = ( BYTE * ) hb_xgrab( hb_curl->dl_len ); - + curl_easy_setopt( hb_curl->curl, CURLOPT_WRITEFUNCTION, hb_curl_write_buff_callback ); res = curl_easy_setopt( hb_curl->curl, CURLOPT_WRITEDATA, ( void * ) hb_curl ); } break; - + case HB_CURLOPT_DL_BUFF_GET: hb_storclen( ( char * ) hb_curl->dl_ptr, hb_curl->dl_pos, 3 ); if( hb_curl->dl_ptr ) res = CURLE_OK; break; - + case HB_CURLOPT_UL_NULL_SETUP: hb_curl_file_ul_free( hb_curl ); hb_curl_buff_ul_free( hb_curl ); - + curl_easy_setopt( hb_curl->curl, CURLOPT_READFUNCTION, hb_curl_read_dummy_callback ); res = curl_easy_setopt( hb_curl->curl, CURLOPT_READDATA, ( void * ) hb_curl ); break; } } - + hb_retnl( ( long ) res ); } else @@ -1320,7 +1320,7 @@ HB_FUNC( CURL_EASY_SETOPT ) /* Harbour extension. */ HB_FUNC( CURL_EASY_DL_BUFF_GET ) { - if( ISPOINTER( 1 ) ) + if( PHB_CURL_is( 1 ) ) { PHB_CURL hb_curl = PHB_CURL_par( 1 ); @@ -1340,214 +1340,214 @@ HB_FUNC( CURL_EASY_DL_BUFF_GET ) #define HB_CURL_INFO_TYPE_DOUBLE 4 #define HB_CURL_INFO_TYPE_SLIST 5 +#define HB_CURL_EASY_GETINFO( hb_curl, n, p ) \ + ( hb_curl ? curl_easy_getinfo( hb_curl->curl, n, p ) : ( CURLcode ) HB_CURLE_ERROR ) + /* NOTE: curl_easy_getinfo( curl, x, @nError ) -> xValue */ HB_FUNC( CURL_EASY_GETINFO ) { - if( ISPOINTER( 1 ) && ISNUM( 2 ) ) + if( PHB_CURL_is( 1 ) && ISNUM( 2 ) ) { PHB_CURL hb_curl = PHB_CURL_par( 1 ); - CURLcode res = ( CURLcode ) -1; - - if( hb_curl ) + CURLcode res = ( CURLcode ) HB_CURLE_ERROR; + + int type = HB_CURL_INFO_TYPE_INVALID; + + char * ret_string = NULL; + char * ret_ptr = NULL; + long ret_long = 0; + struct curl_slist * ret_slist = NULL; + double ret_double = 0.0; + + switch( hb_parni( 2 ) ) { - int type = HB_CURL_INFO_TYPE_INVALID; - - char * ret_string = NULL; - char * ret_ptr = NULL; - long ret_long = 0; - struct curl_slist * ret_slist = NULL; - double ret_double = 0.0; - - switch( hb_parni( 2 ) ) - { - case HB_CURLINFO_EFFECTIVE_URL: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_EFFECTIVE_URL, &ret_string ); - type = HB_CURL_INFO_TYPE_STR; - break; - case HB_CURLINFO_RESPONSE_CODE: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_RESPONSE_CODE, &ret_long ); - type = HB_CURL_INFO_TYPE_LONG; - break; - case HB_CURLINFO_HTTP_CONNECTCODE: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_HTTP_CONNECTCODE, &ret_long ); - type = HB_CURL_INFO_TYPE_LONG; - break; - case HB_CURLINFO_FILETIME: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_FILETIME, &ret_long ); - type = HB_CURL_INFO_TYPE_LONG; - break; - case HB_CURLINFO_TOTAL_TIME: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_TOTAL_TIME, &ret_double ); - type = HB_CURL_INFO_TYPE_DOUBLE; - break; - case HB_CURLINFO_NAMELOOKUP_TIME: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_NAMELOOKUP_TIME, &ret_double ); - type = HB_CURL_INFO_TYPE_DOUBLE; - break; - case HB_CURLINFO_CONNECT_TIME: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_CONNECT_TIME, &ret_double ); - type = HB_CURL_INFO_TYPE_DOUBLE; - break; - case HB_CURLINFO_PRETRANSFER_TIME: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_PRETRANSFER_TIME, &ret_double ); - type = HB_CURL_INFO_TYPE_DOUBLE; - break; - case HB_CURLINFO_STARTTRANSFER_TIME: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_STARTTRANSFER_TIME, &ret_double ); - type = HB_CURL_INFO_TYPE_DOUBLE; - break; + case HB_CURLINFO_EFFECTIVE_URL: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_EFFECTIVE_URL, &ret_string ); + type = HB_CURL_INFO_TYPE_STR; + break; + case HB_CURLINFO_RESPONSE_CODE: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_RESPONSE_CODE, &ret_long ); + type = HB_CURL_INFO_TYPE_LONG; + break; + case HB_CURLINFO_HTTP_CONNECTCODE: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_HTTP_CONNECTCODE, &ret_long ); + type = HB_CURL_INFO_TYPE_LONG; + break; + case HB_CURLINFO_FILETIME: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_FILETIME, &ret_long ); + type = HB_CURL_INFO_TYPE_LONG; + break; + case HB_CURLINFO_TOTAL_TIME: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_TOTAL_TIME, &ret_double ); + type = HB_CURL_INFO_TYPE_DOUBLE; + break; + case HB_CURLINFO_NAMELOOKUP_TIME: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_NAMELOOKUP_TIME, &ret_double ); + type = HB_CURL_INFO_TYPE_DOUBLE; + break; + case HB_CURLINFO_CONNECT_TIME: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_CONNECT_TIME, &ret_double ); + type = HB_CURL_INFO_TYPE_DOUBLE; + break; + case HB_CURLINFO_PRETRANSFER_TIME: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_PRETRANSFER_TIME, &ret_double ); + type = HB_CURL_INFO_TYPE_DOUBLE; + break; + case HB_CURLINFO_STARTTRANSFER_TIME: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_STARTTRANSFER_TIME, &ret_double ); + type = HB_CURL_INFO_TYPE_DOUBLE; + break; #if LIBCURL_VERSION_NUM >= 0x070907 - case HB_CURLINFO_REDIRECT_TIME: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_REDIRECT_TIME, &ret_double ); - type = HB_CURL_INFO_TYPE_DOUBLE; - break; - case HB_CURLINFO_REDIRECT_COUNT: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_REDIRECT_COUNT, &ret_long ); - type = HB_CURL_INFO_TYPE_LONG; - break; + case HB_CURLINFO_REDIRECT_TIME: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_REDIRECT_TIME, &ret_double ); + type = HB_CURL_INFO_TYPE_DOUBLE; + break; + case HB_CURLINFO_REDIRECT_COUNT: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_REDIRECT_COUNT, &ret_long ); + type = HB_CURL_INFO_TYPE_LONG; + break; #endif #if LIBCURL_VERSION_NUM >= 0x071802 - case HB_CURLINFO_REDIRECT_URL: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_REDIRECT_URL, &ret_string ); - type = HB_CURL_INFO_TYPE_STR; - break; + case HB_CURLINFO_REDIRECT_URL: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_REDIRECT_URL, &ret_string ); + type = HB_CURL_INFO_TYPE_STR; + break; #endif - case HB_CURLINFO_SIZE_UPLOAD: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_SIZE_UPLOAD, &ret_double ); - type = HB_CURL_INFO_TYPE_DOUBLE; - break; - case HB_CURLINFO_SIZE_DOWNLOAD: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_SIZE_DOWNLOAD, &ret_double ); - type = HB_CURL_INFO_TYPE_DOUBLE; - break; - case HB_CURLINFO_SPEED_DOWNLOAD: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_SPEED_DOWNLOAD, &ret_double ); - type = HB_CURL_INFO_TYPE_DOUBLE; - break; - case HB_CURLINFO_SPEED_UPLOAD: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_SPEED_UPLOAD, &ret_double ); - type = HB_CURL_INFO_TYPE_DOUBLE; - break; - case HB_CURLINFO_HEADER_SIZE: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_HEADER_SIZE, &ret_long ); - type = HB_CURL_INFO_TYPE_LONG; - break; - case HB_CURLINFO_REQUEST_SIZE: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_REQUEST_SIZE, &ret_long ); - type = HB_CURL_INFO_TYPE_LONG; - break; - case HB_CURLINFO_SSL_VERIFYRESULT: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_SSL_VERIFYRESULT, &ret_long ); - type = HB_CURL_INFO_TYPE_LONG; - break; + case HB_CURLINFO_SIZE_UPLOAD: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_SIZE_UPLOAD, &ret_double ); + type = HB_CURL_INFO_TYPE_DOUBLE; + break; + case HB_CURLINFO_SIZE_DOWNLOAD: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_SIZE_DOWNLOAD, &ret_double ); + type = HB_CURL_INFO_TYPE_DOUBLE; + break; + case HB_CURLINFO_SPEED_DOWNLOAD: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_SPEED_DOWNLOAD, &ret_double ); + type = HB_CURL_INFO_TYPE_DOUBLE; + break; + case HB_CURLINFO_SPEED_UPLOAD: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_SPEED_UPLOAD, &ret_double ); + type = HB_CURL_INFO_TYPE_DOUBLE; + break; + case HB_CURLINFO_HEADER_SIZE: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_HEADER_SIZE, &ret_long ); + type = HB_CURL_INFO_TYPE_LONG; + break; + case HB_CURLINFO_REQUEST_SIZE: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_REQUEST_SIZE, &ret_long ); + type = HB_CURL_INFO_TYPE_LONG; + break; + case HB_CURLINFO_SSL_VERIFYRESULT: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_SSL_VERIFYRESULT, &ret_long ); + type = HB_CURL_INFO_TYPE_LONG; + break; #if LIBCURL_VERSION_NUM >= 0x071203 - case HB_CURLINFO_SSL_ENGINES: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_SSL_ENGINES, &ret_slist ); - type = HB_CURL_INFO_TYPE_SLIST; - break; + case HB_CURLINFO_SSL_ENGINES: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_SSL_ENGINES, &ret_slist ); + type = HB_CURL_INFO_TYPE_SLIST; + break; #endif - case HB_CURLINFO_CONTENT_LENGTH_DOWNLOAD: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &ret_double ); - type = HB_CURL_INFO_TYPE_DOUBLE; - break; - case HB_CURLINFO_CONTENT_LENGTH_UPLOAD: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_CONTENT_LENGTH_UPLOAD, &ret_double ); - type = HB_CURL_INFO_TYPE_DOUBLE; - break; - case HB_CURLINFO_CONTENT_TYPE: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_CONTENT_TYPE, &ret_string ); - type = HB_CURL_INFO_TYPE_STR; - break; + case HB_CURLINFO_CONTENT_LENGTH_DOWNLOAD: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &ret_double ); + type = HB_CURL_INFO_TYPE_DOUBLE; + break; + case HB_CURLINFO_CONTENT_LENGTH_UPLOAD: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_CONTENT_LENGTH_UPLOAD, &ret_double ); + type = HB_CURL_INFO_TYPE_DOUBLE; + break; + case HB_CURLINFO_CONTENT_TYPE: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_CONTENT_TYPE, &ret_string ); + type = HB_CURL_INFO_TYPE_STR; + break; #if LIBCURL_VERSION_NUM >= 0x071003 - case HB_CURLINFO_PRIVATE: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_PRIVATE, &ret_ptr ); - type = HB_CURL_INFO_TYPE_PTR; - break; + case HB_CURLINFO_PRIVATE: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_PRIVATE, &ret_ptr ); + type = HB_CURL_INFO_TYPE_PTR; + break; #endif #if LIBCURL_VERSION_NUM >= 0x071008 - case HB_CURLINFO_HTTPAUTH_AVAIL: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_HTTPAUTH_AVAIL, &ret_long ); - type = HB_CURL_INFO_TYPE_LONG; - break; - case HB_CURLINFO_PROXYAUTH_AVAIL: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_PROXYAUTH_AVAIL, &ret_long ); - type = HB_CURL_INFO_TYPE_LONG; - break; + case HB_CURLINFO_HTTPAUTH_AVAIL: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_HTTPAUTH_AVAIL, &ret_long ); + type = HB_CURL_INFO_TYPE_LONG; + break; + case HB_CURLINFO_PROXYAUTH_AVAIL: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_PROXYAUTH_AVAIL, &ret_long ); + type = HB_CURL_INFO_TYPE_LONG; + break; #endif #if LIBCURL_VERSION_NUM >= 0x071202 - case HB_CURLINFO_OS_ERRNO: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_OS_ERRNO, &ret_long ); - type = HB_CURL_INFO_TYPE_LONG; - break; + case HB_CURLINFO_OS_ERRNO: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_OS_ERRNO, &ret_long ); + type = HB_CURL_INFO_TYPE_LONG; + break; #endif #if LIBCURL_VERSION_NUM >= 0x071203 - case HB_CURLINFO_NUM_CONNECTS: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_NUM_CONNECTS, &ret_long ); - type = HB_CURL_INFO_TYPE_LONG; - break; + case HB_CURLINFO_NUM_CONNECTS: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_NUM_CONNECTS, &ret_long ); + type = HB_CURL_INFO_TYPE_LONG; + break; #endif #if LIBCURL_VERSION_NUM >= 0x071401 - case HB_CURLINFO_COOKIELIST: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_COOKIELIST, &ret_slist ); - type = HB_CURL_INFO_TYPE_SLIST; - break; + case HB_CURLINFO_COOKIELIST: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_COOKIELIST, &ret_slist ); + type = HB_CURL_INFO_TYPE_SLIST; + break; #endif #if LIBCURL_VERSION_NUM >= 0x071502 - case HB_CURLINFO_LASTSOCKET: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_LASTSOCKET, &ret_long ); - type = HB_CURL_INFO_TYPE_LONG; - break; + case HB_CURLINFO_LASTSOCKET: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_LASTSOCKET, &ret_long ); + type = HB_CURL_INFO_TYPE_LONG; + break; #endif #if LIBCURL_VERSION_NUM >= 0x071504 - case HB_CURLINFO_FTP_ENTRY_PATH: - res = curl_easy_getinfo( hb_curl->curl, CURLINFO_FTP_ENTRY_PATH, &ret_string ); - type = HB_CURL_INFO_TYPE_STR; - break; + case HB_CURLINFO_FTP_ENTRY_PATH: + res = HB_CURL_EASY_GETINFO( hb_curl, CURLINFO_FTP_ENTRY_PATH, &ret_string ); + type = HB_CURL_INFO_TYPE_STR; + break; #endif - } - - switch( type ) + } + + switch( type ) + { + case HB_CURL_INFO_TYPE_STR: + hb_retc( ret_string ); + break; + case HB_CURL_INFO_TYPE_PTR: + hb_retptr( ( void * ) ret_ptr ); + break; + case HB_CURL_INFO_TYPE_LONG: + hb_retnl( ret_long ); + break; + case HB_CURL_INFO_TYPE_DOUBLE: + hb_retnd( ret_double ); + break; + case HB_CURL_INFO_TYPE_SLIST: { - case HB_CURL_INFO_TYPE_STR: - hb_retc( ret_string ); - break; - case HB_CURL_INFO_TYPE_PTR: - hb_retptr( ( void * ) ret_ptr ); - break; - case HB_CURL_INFO_TYPE_LONG: - hb_retnl( ret_long ); - break; - case HB_CURL_INFO_TYPE_DOUBLE: - hb_retnd( ret_double ); - break; - case HB_CURL_INFO_TYPE_SLIST: + if( ret_slist ) { - if( ret_slist ) + PHB_ITEM pArray; + int nCount; + struct curl_slist * walk_ret_slist; + + /* Count */ + for( walk_ret_slist = ret_slist, nCount = 0; walk_ret_slist->next; nCount++ ) + walk_ret_slist = walk_ret_slist->next; + + /* Fill */ + pArray = hb_itemArrayNew( nCount ); + for( walk_ret_slist = ret_slist, nCount = 1; walk_ret_slist->next; ) { - PHB_ITEM pArray; - int nCount; - struct curl_slist * walk_ret_slist; - - /* Count */ - for( walk_ret_slist = ret_slist, nCount = 0; walk_ret_slist->next; nCount++ ) - walk_ret_slist = walk_ret_slist->next; - - /* Fill */ - pArray = hb_itemArrayNew( nCount ); - for( walk_ret_slist = ret_slist, nCount = 1; walk_ret_slist->next; ) - { - hb_arraySetC( pArray, nCount++, walk_ret_slist->data ); - walk_ret_slist = walk_ret_slist->next; - } - hb_itemReturnRelease( pArray ); - - curl_slist_free_all( ret_slist ); + hb_arraySetC( pArray, nCount++, walk_ret_slist->data ); + walk_ret_slist = walk_ret_slist->next; } - else - hb_reta( 0 ); + hb_itemReturnRelease( pArray ); + + curl_slist_free_all( ret_slist ); } - break; + else + hb_reta( 0 ); } + break; } hb_stornl( ( long ) res, 3 ); @@ -1560,10 +1560,10 @@ HB_FUNC( CURL_EASY_GETINFO ) HB_FUNC( CURL_EASY_ESCAPE ) { - if( ISPOINTER( 1 ) ) + if( PHB_CURL_is( 1 ) ) { PHB_CURL hb_curl = PHB_CURL_par( 1 ); - + if( hb_curl ) { char * buffer = curl_easy_escape( hb_curl->curl, hb_parcx( 2 ), hb_parclen( 2 ) ); @@ -1579,10 +1579,10 @@ HB_FUNC( CURL_EASY_ESCAPE ) HB_FUNC( CURL_EASY_UNESCAPE ) { - if( ISPOINTER( 1 ) ) + if( PHB_CURL_is( 1 ) ) { PHB_CURL hb_curl = PHB_CURL_par( 1 ); - + if( hb_curl ) { int nLen = 0; @@ -1607,17 +1607,27 @@ HB_FUNC( CURL_EASY_UNESCAPE ) /* NOTE: Obsolete, superceded by curl_easy_escape() */ HB_FUNC( CURL_ESCAPE ) { - char * buffer = curl_escape( hb_parcx( 2 ), hb_parclen( 2 ) ); - hb_retc( buffer ); - curl_free( buffer ); + if( ISCHAR( 1 ) ) + { + char * buffer = curl_escape( hb_parc( 1 ), hb_parclen( 1 ) ); + hb_retc( buffer ); + curl_free( buffer ); + } + else + hb_errRT_BASE( EG_ARG, 2010, NULL, "CURL_ESCAPE", HB_ERR_ARGS_BASEPARAMS ); } /* NOTE: Obsolete, superceded by curl_easy_unescape() */ HB_FUNC( CURL_UNESCAPE ) { - char * buffer = curl_unescape( hb_parcx( 2 ), hb_parclen( 2 ) ); - hb_retc( buffer ); - curl_free( buffer ); + if( ISCHAR( 1 ) ) + { + char * buffer = curl_unescape( hb_parc( 1 ), hb_parclen( 1 ) ); + hb_retc( buffer ); + curl_free( buffer ); + } + else + hb_errRT_BASE( EG_ARG, 2010, NULL, "CURL_UNESCAPE", HB_ERR_ARGS_BASEPARAMS ); } #endif diff --git a/harbour-RC1/contrib/hbcurl/hbcurl.ch b/harbour-RC1/contrib/hbcurl/hbcurl.ch index c224fa6480..19282f087f 100644 --- a/harbour-RC1/contrib/hbcurl/hbcurl.ch +++ b/harbour-RC1/contrib/hbcurl/hbcurl.ch @@ -362,6 +362,7 @@ /* curl result codes. */ +#define HB_CURLE_ERROR -1 /* request not passed to libcurl (libcurl not initialized or unknown parameter) */ #define HB_CURLE_OK 0 #define HB_CURLE_UNSUPPORTED_PROTOCOL 1 /* */ #define HB_CURLE_FAILED_INIT 2 /* */ diff --git a/harbour-RC1/contrib/hbcurl/tests/ftp_uldl.prg b/harbour-RC1/contrib/hbcurl/tests/ftp_uldl.prg index 1026d3f5db..a9da187461 100644 --- a/harbour-RC1/contrib/hbcurl/tests/ftp_uldl.prg +++ b/harbour-RC1/contrib/hbcurl/tests/ftp_uldl.prg @@ -70,8 +70,8 @@ FUNCTION Main( cDL, cUL ) ? curl_easy_getinfo( curl, HB_CURLINFO_EFFECTIVE_URL ) ? curl_easy_getinfo( curl, HB_CURLINFO_TOTAL_TIME ) - info := curl_easy_getinfo( curl, HB_CURLINFO_SSL_ENGINES ) - ? + info := curl_easy_getinfo( curl, HB_CURLINFO_SSL_ENGINES, @tmp ) + ? "SSL ENGINES: ", tmp, Len( info ) FOR tmp := 1 TO Len( info ) ?? info[ tmp ] + " " NEXT @@ -116,12 +116,6 @@ FUNCTION Main( cDL, cUL ) ? curl_easy_getinfo( curl, HB_CURLINFO_EFFECTIVE_URL ) ? curl_easy_getinfo( curl, HB_CURLINFO_TOTAL_TIME ) - info := curl_easy_getinfo( curl, HB_CURLINFO_SSL_ENGINES ) - ? - FOR tmp := 1 TO Len( info ) - ?? info[ tmp ] + " " - NEXT - curl_easy_reset( curl ) ? "Press key..." diff --git a/harbour-RC1/contrib/hbfbird/make_b32.bat b/harbour-RC1/contrib/hbfbird/make_b32.bat index bf51a3134f..5ba5fee5da 100644 --- a/harbour-RC1/contrib/hbfbird/make_b32.bat +++ b/harbour-RC1/contrib/hbfbird/make_b32.bat @@ -40,7 +40,7 @@ if "%1" == "INSTALL" goto POST_INSTALL :POST_BUILD rem Use supplied .lib file. - if not exist ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.lib copy "%HB_DIR_FIREBIRD%\%_HB_DLL_NAME%_bor.lib" ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.lib > nul + if not exist ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.lib copy "%HB_DIR_FIREBIRD%\lib\%_HB_DLL_NAME%_bor.lib" ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.lib > nul goto POST_EXIT :POST_CLEAN diff --git a/harbour-RC1/contrib/hbfbird/make_vc.bat b/harbour-RC1/contrib/hbfbird/make_vc.bat index ae6eb7954d..3c3c5ec733 100644 --- a/harbour-RC1/contrib/hbfbird/make_vc.bat +++ b/harbour-RC1/contrib/hbfbird/make_vc.bat @@ -40,7 +40,7 @@ if "%1" == "INSTALL" goto POST_INSTALL :POST_BUILD rem Use supplied .lib file. - if not exist ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.lib copy "%HB_DIR_FIREBIRD%\%_HB_DLL_NAME%_ms.lib" ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.lib > nul + if not exist ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.lib copy "%HB_DIR_FIREBIRD%\lib\%_HB_DLL_NAME%_ms.lib" ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.lib > nul goto POST_EXIT :POST_CLEAN diff --git a/harbour-RC1/contrib/hbodbc/make_vc.bat b/harbour-RC1/contrib/hbodbc/make_vc.bat index 33269a1618..b6ece760f7 100644 --- a/harbour-RC1/contrib/hbodbc/make_vc.bat +++ b/harbour-RC1/contrib/hbodbc/make_vc.bat @@ -26,24 +26,6 @@ if "%1" == "INSTALL" goto POST_INSTALL :POST_BUILD - rem --------------------------------------------------------------- - rem This .dll to .lib conversion needs GNU sed.exe in the path - rem --------------------------------------------------------------- - echo./[ \t]*ordinal hint/,/^^[ \t]*Summary/{> _temp.sed - echo. /^^[ \t]\+[0-9]\+/{>> _temp.sed - echo. s/^^[ \t]\+[0-9]\+[ \t]\+[0-9A-Fa-f]\+[ \t]\+[0-9A-Fa-f]\+[ \t]\+\(.*\)/\1/p>> _temp.sed - echo. }>> _temp.sed - echo.}>> _temp.sed - DUMPBIN /EXPORTS "%HB_DLL_DIR%\%HB_DLL_NAME%.dll" > _dump.tmp - echo.LIBRARY "%HB_DLL_DIR%\%HB_DLL_NAME%.dll" > _temp.def - echo.EXPORTS >> _temp.def - sed -nf _temp.sed < _dump.tmp >> _temp.def - LIB /MACHINE:X86 /DEF:_temp.def /OUT:..\..\lib\%_HB_CC_NAME%\%HB_DLL_NAME%.lib >> %_HB_MAKELOG% - del _dump.tmp - del _temp.def - del _temp.sed - rem --------------------------------------------------------------- - goto POST_EXIT :POST_CLEAN diff --git a/harbour-RC1/contrib/xhb/Makefile b/harbour-RC1/contrib/xhb/Makefile index 78dbee4a27..07ec971ac5 100644 --- a/harbour-RC1/contrib/xhb/Makefile +++ b/harbour-RC1/contrib/xhb/Makefile @@ -5,6 +5,8 @@ ROOT = ../../ C_SOURCES=\ + freadlin.c \ + hbcrypt.c \ hbxml.c \ hbsyslog.c \ hboutdbg.c \ @@ -20,9 +22,6 @@ C_SOURCES=\ C_HEADERS=\ hbcompat.h \ - hbcomprs.h \ - hbfast.h \ - hbxml.h \ PRG_SOURCES=\ txml.prg \ @@ -32,17 +31,8 @@ PRG_SOURCES=\ xhbcomp.prg \ PRG_HEADERS=\ - classex.ch \ - cstruct.ch \ hbcompat.ch \ - hbctypes.ch \ - hblog.ch \ - hblogdef.ch \ - math.ch \ - usrrdd.ch \ - wintypes.ch \ xhb.ch \ - xhbextrn.ch \ LIBNAME=xhb diff --git a/harbour-RC1/contrib/xhb/common.mak b/harbour-RC1/contrib/xhb/common.mak index dc4fbf1ee1..ac36617844 100644 --- a/harbour-RC1/contrib/xhb/common.mak +++ b/harbour-RC1/contrib/xhb/common.mak @@ -8,24 +8,14 @@ LIB_PATH = $(LIB_DIR)$(LIBNAME)$(LIBEXT) C_HEADERS = \ hbcompat.h \ - hbcomprs.h \ - hbfast.h \ - hbxml.h \ PRG_HEADERS = \ - classex.ch \ - cstruct.ch \ hbcompat.ch \ - hbctypes.ch \ - hblog.ch \ - hblogdef.ch \ - math.ch \ - usrrdd.ch \ - wintypes.ch \ xhb.ch \ - xhbextrn.ch \ LIB_OBJS = \ + $(OBJ_DIR)freadlin$(OBJEXT) \ + $(OBJ_DIR)hbcrypt$(OBJEXT) \ $(OBJ_DIR)hbxml$(OBJEXT) \ $(OBJ_DIR)hbsyslog$(OBJEXT) \ $(OBJ_DIR)hboutdbg$(OBJEXT) \ diff --git a/harbour-RC1/include/hbgfx.ch b/harbour-RC1/include/hbgfx.ch index 0e4e967d37..18750edf25 100644 --- a/harbour-RC1/include/hbgfx.ch +++ b/harbour-RC1/include/hbgfx.ch @@ -51,11 +51,7 @@ * */ -/* - * WARNING: this file is also included in C code, so don't add xHarbour specific stuff, - * or protect it under #ifdef __XHARBOUR__ - * - */ +/* NOTE: This file is also used by C code. */ #ifndef _HBGFX_CH_ #define _HBGFX_CH_ @@ -65,31 +61,28 @@ /* * NOTE: ACQUIRE / RELEASE screen pair must work same way DispBegin()/DispEnd() pair does * (that is, with an internal counter), as lots of function may want to 'acquire/release' it. - * * However, a GT must properly manage its gfx output if the user didn't requested to acquire the * screen, so this is under user choice. * (the user just needs to know that it is not the same to aquire the screen, draw 100 lines, then - * release screen, than simply drawing 100 lines -as the GT will be acquiring/releasing the screen - * 100 times, which will slow down things a lot-) - * - * Mauricio - * + * release screen, than simply drawing 100 lines -as the GT will be acquiring/releasing the screen + * 100 times, which will slow down things a lot-) [Mauricio] */ -#xtranslate HB_GFXACQUIRESCREEN() => hb_gfxPrimitive(GFX_ACQUIRESCREEN) -#xtranslate HB_GFXRELEASESCREEN() => hb_gfxPrimitive(GFX_RELEASESCREEN) -#xtranslate HB_GFXMAKECOLOR(, , [, ]) => hb_gfxPrimitive(GFX_MAKECOLOR, , , [, ]) -#xtranslate HB_GFXGETCLIP(, , , ) => := hb_gfxPrimitive(GFX_CLIPTOP); := hb_gfxPrimitive(GFX_CLIPLEFT); := hb_gfxPrimitive(GFX_CLIPBOTTOM); := hb_gfxPrimitive(GFX_CLIPRIGHT) -#xtranslate HB_GFXSETCLIP(, , , ) => hb_gfxPrimitive(GFX_SETCLIP, , , , ) -#xtranslate HB_GFXDRAWINGMODE([]) => hb_gfxPrimitive(GFX_DRAWINGMODE[, ]) -#xtranslate HB_GFXGETPIXEL(, ) => hb_gfxPrimitive(GFX_GETPIXEL, , ) -#xtranslate HB_GFXPUTPIXEL(, , ) => hb_gfxPrimitive(GFX_PUTPIXEL, , , ) -#xtranslate HB_GFXLINE(, , , , ) => hb_gfxPrimitive(GFX_LINE, , , , , ) -#xtranslate HB_GFXRECT(, , , , ) => hb_gfxPrimitive(GFX_RECT, , , , , ) -#xtranslate HB_GFXFILLEDRECT(, , , , ) => hb_gfxPrimitive(GFX_FILLEDRECT, , , , , ) -#xtranslate HB_GFXCIRCLE(, , , ) => hb_gfxPrimitive(GFX_CIRCLE, , , , ) -#xtranslate HB_GFXFILLEDCIRCLE(, , , ) => hb_gfxPrimitive(GFX_FILLEDCIRCLE, , , , ) -#xtranslate HB_GFXELLIPSE(, , , , ) => hb_gfxPrimitive(GFX_ELLIPSE, , , , , ) -#xtranslate HB_GFXFILLEDELLIPSE(, , , , ) => hb_gfxPrimitive(GFX_FILLEDELLIPSE, , , , , ) -#xtranslate HB_GFXFLOODFILL(, , ) => hb_gfxPrimitive(GFX_FLOODFILL, , , ) -#endif /* _HBGFX_CH_ */ +#xtranslate hb_gfxAcquireScreen() => hb_gfxPrimitive( HB_GFX_ACQUIRESCREEN ) +#xtranslate hb_gfxReleaseScreen() => hb_gfxPrimitive( HB_GFX_RELEASESCREEN ) +#xtranslate hb_gfxMakeColor( , , [, ] ) => hb_gfxPrimitive( HB_GFX_MAKECOLOR, , , [, ] ) +#xtranslate hb_gfxGetClip( , , , ) => := hb_gfxPrimitive( HB_GFX_CLIPTOP ); := hb_gfxPrimitive( HB_GFX_CLIPLEFT ); := hb_gfxPrimitive( HB_GFX_CLIPBOTTOM ); := hb_gfxPrimitive( HB_GFX_CLIPRIGHT ) +#xtranslate hb_gfxSetClip( , , , ) => hb_gfxPrimitive( HB_GFX_SETCLIP, , , , ) +#xtranslate hb_gfxDrawingMode( [] ) => hb_gfxPrimitive( HB_GFX_DRAWINGMODE[, ] ) +#xtranslate hb_gfxGetPixel( , ) => hb_gfxPrimitive( HB_GFX_GETPIXEL, , ) +#xtranslate hb_gfxPutPixel( , , ) => hb_gfxPrimitive( HB_GFX_PUTPIXEL, , , ) +#xtranslate hb_gfxLine( , , , , ) => hb_gfxPrimitive( HB_GFX_LINE, , , , , ) +#xtranslate hb_gfxRect( , , , , ) => hb_gfxPrimitive( HB_GFX_RECT, , , , , ) +#xtranslate hb_gfxFilledRect( , , , , ) => hb_gfxPrimitive( HB_GFX_FILLEDRECT, , , , , ) +#xtranslate hb_gfxCircle( , , , ) => hb_gfxPrimitive( HB_GFX_CIRCLE, , , , ) +#xtranslate hb_gfxFilledCircle( , , , ) => hb_gfxPrimitive( HB_GFX_FILLEDCIRCLE, , , , ) +#xtranslate hb_gfxEllipse( , , , , ) => hb_gfxPrimitive( HB_GFX_ELLIPSE, , , , , ) +#xtranslate hb_gfxFilledEllipse( , , , , ) => hb_gfxPrimitive( HB_GFX_FILLEDELLIPSE, , , , , ) +#xtranslate hb_gfxFloodFill( , , ) => hb_gfxPrimitive( HB_GFX_FLOODFILL, , , ) + +#endif /* _HBHB_GFX_CH_ */ diff --git a/harbour-RC1/include/hbgfxdef.ch b/harbour-RC1/include/hbgfxdef.ch index 6198fa1764..99233fa377 100644 --- a/harbour-RC1/include/hbgfxdef.ch +++ b/harbour-RC1/include/hbgfxdef.ch @@ -4,7 +4,7 @@ /* * xHarbour Project source code: - * GT Graphics definitions (GFX_*) + * GT Graphics definitions (HB_GFX_*) * * Copyright 2004 Mauricio Abre * www - http://www.xharbour.org @@ -51,11 +51,7 @@ * */ -/* - * WARNING: this file is also included in C code, so don't add xHarbour specific stuff, - * or protect it under #ifdef __XHARBOUR__ - * - */ +/* NOTE: This file is also used by C code. */ #ifndef _HBGFXDEF_CH_ #define _HBGFXDEF_CH_ @@ -63,45 +59,72 @@ /* * NOTE: ACQUIRE / RELEASE screen pair must work same way DispBegin()/DispEnd() pair does * (that is, with an internal counter), as lots of function may want to 'acquire/release' it. - * * However, a GT must properly manage its gfx output if the user didn't requested to acquire the * screen, so this is under user choice. * (the user just needs to know that it is not the same to aquire the screen, draw 100 lines, then - * release screen, than simply drawing 100 lines -as the GT will be acquiring/releasing the screen - * 100 times, which will slow down things a lot-) - * - * Mauricio - * + * release screen, than simply drawing 100 lines -as the GT will be acquiring/releasing the screen + * 100 times, which will slow down things a lot-) [Mauricio] */ /* Misc, internals */ -#define GFX_ACQUIRESCREEN 1 /* Some GTs may require that you 'acquire' the screen before doing gfx things */ -#define GFX_RELEASESCREEN 2 /* Release a previously 'acquired' screen */ -#define GFX_MAKECOLOR 3 /* Calculate gfx color number based on RGBA values */ +#define HB_GFX_ACQUIRESCREEN 1 /* Some GTs may require that you 'acquire' the screen before doing gfx things */ +#define HB_GFX_RELEASESCREEN 2 /* Release a previously 'acquired' screen */ +#define HB_GFX_MAKECOLOR 3 /* Calculate gfx color number based on RGBA values */ /* Functions that affect drawing area */ -#define GFX_CLIPTOP 10 -#define GFX_CLIPLEFT 11 -#define GFX_CLIPBOTTOM 12 -#define GFX_CLIPRIGHT 13 -#define GFX_SETCLIP 14 /* NOTE: set to 0, 0, 0, 0 to disable ;) */ +#define HB_GFX_CLIPTOP 10 +#define HB_GFX_CLIPLEFT 11 +#define HB_GFX_CLIPBOTTOM 12 +#define HB_GFX_CLIPRIGHT 13 +#define HB_GFX_SETCLIP 14 /* NOTE: set to 0, 0, 0, 0 to disable ;) */ /* Functions that affect drawing mode */ -#define GFX_DRAWINGMODE 20 +#define HB_GFX_DRAWINGMODE 20 /* Drawing primitives */ -#define GFX_GETPIXEL 50 -#define GFX_PUTPIXEL 51 -#define GFX_LINE 52 -#define GFX_RECT 53 -#define GFX_FILLEDRECT 54 -#define GFX_CIRCLE 55 -#define GFX_FILLEDCIRCLE 56 -#define GFX_ELLIPSE 57 -#define GFX_FILLEDELLIPSE 58 -#define GFX_FLOODFILL 59 +#define HB_GFX_GETPIXEL 50 +#define HB_GFX_PUTPIXEL 51 +#define HB_GFX_LINE 52 +#define HB_GFX_RECT 53 +#define HB_GFX_FILLEDRECT 54 +#define HB_GFX_CIRCLE 55 +#define HB_GFX_FILLEDCIRCLE 56 +#define HB_GFX_ELLIPSE 57 +#define HB_GFX_FILLEDELLIPSE 58 +#define HB_GFX_FLOODFILL 59 /* Drawing mode constants */ -#define GFX_MODE_SOLID 1 /* Solid mode, no translucency, no patterned primitives */ -#define GFX_MODE_XOR 2 /* XOR with current screen contents */ -#define GFX_MODE_ALPHA 3 /* Use alpha for transluced effect (SLOW) */ +#define HB_GFX_MODE_SOLID 1 /* Solid mode, no translucency, no patterned primitives */ +#define HB_GFX_MODE_XOR 2 /* XOR with current screen contents */ +#define HB_GFX_MODE_ALPHA 3 /* Use alpha for transluced effect (SLOW) */ /* TODO: add patterned mode drawings */ +/* Compatibility #defines. + These codes are deprecated, _don't use them_. Please upgrade to the above versions. + For developers: Don't add any more new codes to this section. */ + +#ifndef HB_GT_NO_XHB + +#define GFX_ACQUIRESCREEN HB_GFX_ACQUIRESCREEN +#define GFX_RELEASESCREEN HB_GFX_RELEASESCREEN +#define GFX_MAKECOLOR HB_GFX_MAKECOLOR +#define GFX_CLIPTOP HB_GFX_CLIPTOP +#define GFX_CLIPLEFT HB_GFX_CLIPLEFT +#define GFX_CLIPBOTTOM HB_GFX_CLIPBOTTOM +#define GFX_CLIPRIGHT HB_GFX_CLIPRIGHT +#define GFX_SETCLIP HB_GFX_SETCLIP +#define GFX_DRAWINGMODE HB_GFX_DRAWINGMODE +#define GFX_GETPIXEL HB_GFX_GETPIXEL +#define GFX_PUTPIXEL HB_GFX_PUTPIXEL +#define GFX_LINE HB_GFX_LINE +#define GFX_RECT HB_GFX_RECT +#define GFX_FILLEDRECT HB_GFX_FILLEDRECT +#define GFX_CIRCLE HB_GFX_CIRCLE +#define GFX_FILLEDCIRCLE HB_GFX_FILLEDCIRCLE +#define GFX_ELLIPSE HB_GFX_ELLIPSE +#define GFX_FILLEDELLIPSE HB_GFX_FILLEDELLIPSE +#define GFX_FLOODFILL HB_GFX_FLOODFILL +#define GFX_MODE_SOLID HB_GFX_MODE_SOLID +#define GFX_MODE_XOR HB_GFX_MODE_XOR +#define GFX_MODE_ALPHA HB_GFX_MODE_ALPHA + +#endif + #endif /* _HBGFXDEF_CH_ */ diff --git a/harbour-RC1/include/hbgtinfo.ch b/harbour-RC1/include/hbgtinfo.ch index 8faa535b60..e64d1a7ffb 100644 --- a/harbour-RC1/include/hbgtinfo.ch +++ b/harbour-RC1/include/hbgtinfo.ch @@ -145,7 +145,9 @@ #define HB_GTI_KBD_ACCENT3 16384 #define HB_GTI_KBD_ACCENT4 32768 -/* Compatibility #defines */ +/* Compatibility #defines. + These codes are deprecated, _don't use them_. Please upgrade to the above versions. + For developers: Don't add any more new codes to this section. */ #ifndef HB_GT_NO_XHB diff --git a/harbour-RC1/source/rtl/dirdrive.c b/harbour-RC1/source/rtl/dirdrive.c index ba42224c95..d807de0c18 100644 --- a/harbour-RC1/source/rtl/dirdrive.c +++ b/harbour-RC1/source/rtl/dirdrive.c @@ -88,6 +88,8 @@ HB_FUNC( DIRREMOVE ) /* NOTE: Clipper 5.3 undocumented */ +#ifdef HB_C52_UNDOC + HB_FUNC( ISDISK ) { hb_retl( ( ISCHAR( 1 ) && hb_parclen( 1 ) > 0 ) ? @@ -112,3 +114,4 @@ HB_FUNC( DISKNAME ) #endif +#endif diff --git a/harbour-RC1/source/rtl/gtwvt/gtwvt.c b/harbour-RC1/source/rtl/gtwvt/gtwvt.c index 2cc7d35a9f..4622ae665c 100644 --- a/harbour-RC1/source/rtl/gtwvt/gtwvt.c +++ b/harbour-RC1/source/rtl/gtwvt/gtwvt.c @@ -1851,16 +1851,16 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, { switch( iType ) { - case GFX_ACQUIRESCREEN: - case GFX_RELEASESCREEN: + case HB_GFX_ACQUIRESCREEN: + case HB_GFX_RELEASESCREEN: iRet = 1; break; - case GFX_MAKECOLOR: + case HB_GFX_MAKECOLOR: iRet = (iTop << 16) | (iLeft << 8) | ( iBottom ); break; - case GFX_PUTPIXEL: + case HB_GFX_PUTPIXEL: SetGFXContext( iBottom ); MoveToEx( hdc, iLeft, iTop, NULL ); @@ -1870,7 +1870,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; - case GFX_LINE: + case HB_GFX_LINE: SetGFXContext( iColor ); MoveToEx( hdc, iLeft, iTop, NULL ); @@ -1880,7 +1880,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; - case GFX_RECT: + case HB_GFX_RECT: { RECT r; @@ -1897,7 +1897,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; } - case GFX_FILLEDRECT: + case HB_GFX_FILLEDRECT: SetGFXContext( iColor ); Rectangle( hdc, iLeft, iTop, iRight, iBottom ); @@ -1906,7 +1906,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; - case GFX_CIRCLE: + case HB_GFX_CIRCLE: SetGFXContext( iRight ); Arc( hdc, iLeft - iBottom / 2, iTop - iBottom / 2, iLeft + iBottom / 2, iTop + iBottom / 2, 0, 0, 0, 0 ); @@ -1915,7 +1915,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; - case GFX_FILLEDCIRCLE: + case HB_GFX_FILLEDCIRCLE: SetGFXContext( iRight ); Ellipse( hdc, iLeft - iBottom / 2, iTop - iBottom / 2, iLeft + iBottom / 2, iTop + iBottom / 2 ); @@ -1924,7 +1924,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; - case GFX_ELLIPSE: + case HB_GFX_ELLIPSE: SetGFXContext( iColor ); Arc( hdc, iLeft - iRight / 2, iTop - iBottom / 2, iLeft + iRight / 2, iTop + iBottom / 2, 0, 0, 0, 0 ); @@ -1933,7 +1933,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; - case GFX_FILLEDELLIPSE: + case HB_GFX_FILLEDELLIPSE: SetGFXContext( iColor ); Ellipse( hdc, iLeft - iRight / 2, iTop - iBottom / 2, iLeft + iRight / 2, iTop + iBottom / 2 ); @@ -1942,7 +1942,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = 1; break; - case GFX_FLOODFILL: + case HB_GFX_FLOODFILL: SetGFXContext( iBottom ); FloodFill( hdc, iLeft, iTop, iColor ); diff --git a/harbour-RC1/source/rtl/gtxwc/gtxwc.c b/harbour-RC1/source/rtl/gtxwc/gtxwc.c index a4a258fac0..ea795db1a1 100644 --- a/harbour-RC1/source/rtl/gtxwc/gtxwc.c +++ b/harbour-RC1/source/rtl/gtxwc/gtxwc.c @@ -3826,15 +3826,15 @@ static int hb_gt_xwc_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, switch( iType ) { - case GFX_ACQUIRESCREEN: + case HB_GFX_ACQUIRESCREEN: /* TODO: */ break; - case GFX_RELEASESCREEN: + case HB_GFX_RELEASESCREEN: /* TODO: */ break; - case GFX_MAKECOLOR: + case HB_GFX_MAKECOLOR: /* TODO: */ color.red = iTop * 256; color.green = iLeft * 256; @@ -3844,23 +3844,23 @@ static int hb_gt_xwc_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iRet = color.pixel; break; - case GFX_CLIPTOP: + case HB_GFX_CLIPTOP: iRet = wnd->ClipRect.y; break; - case GFX_CLIPLEFT: + case HB_GFX_CLIPLEFT: iRet = wnd->ClipRect.x; break; - case GFX_CLIPBOTTOM: + case HB_GFX_CLIPBOTTOM: iRet = wnd->ClipRect.y + wnd->ClipRect.height - 1; break; - case GFX_CLIPRIGHT: + case HB_GFX_CLIPRIGHT: iRet = wnd->ClipRect.x + wnd->ClipRect.width - 1; break; - case GFX_SETCLIP: + case HB_GFX_SETCLIP: wnd->ClipRect.y = iTop; wnd->ClipRect.x = iLeft; wnd->ClipRect.width = iBottom; @@ -3868,43 +3868,43 @@ static int hb_gt_xwc_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, XSetClipRectangles( wnd->dpy, wnd->gc, 0, 0, &wnd->ClipRect, 1, YXBanded ); break; - case GFX_DRAWINGMODE: - iRet = GFX_MODE_SOLID; + case HB_GFX_DRAWINGMODE: + iRet = HB_GFX_MODE_SOLID; break; - case GFX_GETPIXEL: + case HB_GFX_GETPIXEL: /* TODO: */ iRet = 0; break; - case GFX_PUTPIXEL: + case HB_GFX_PUTPIXEL: XSetForeground( wnd->dpy, wnd->gc, iBottom ); XDrawPoint( wnd->dpy, wnd->drw, wnd->gc, iLeft, iTop ); hb_gt_xwc_InvalidatePts( wnd, iLeft, iTop, iLeft, iTop ); break; - case GFX_LINE: + case HB_GFX_LINE: XSetForeground( wnd->dpy, wnd->gc, iColor ); XDrawLine( wnd->dpy, wnd->drw, wnd->gc, iLeft, iTop, iRight, iBottom ); hb_gt_xwc_InvalidatePts( wnd, iLeft, iTop, iRight, iBottom ); break; - case GFX_RECT: + case HB_GFX_RECT: XSetForeground( wnd->dpy, wnd->gc, iColor ); XDrawRectangle( wnd->dpy, wnd->drw, wnd->gc, iLeft, iTop, iRight - iLeft, iBottom - iTop ); hb_gt_xwc_InvalidatePts( wnd, iLeft, iTop, iRight, iBottom ); break; - case GFX_FILLEDRECT: + case HB_GFX_FILLEDRECT: XSetForeground( wnd->dpy, wnd->gc, iColor ); XFillRectangle( wnd->dpy, wnd->drw, wnd->gc, iLeft, iTop, iRight - iLeft, iBottom - iTop ); hb_gt_xwc_InvalidatePts( wnd, iLeft, iTop, iRight, iBottom ); break; - case GFX_CIRCLE: + case HB_GFX_CIRCLE: XSetForeground( wnd->dpy, wnd->gc, iRight ); XDrawArc( wnd->dpy, wnd->drw, wnd->gc, iLeft, iTop, iBottom, iBottom, 0, 360*64 ); @@ -3912,7 +3912,7 @@ static int hb_gt_xwc_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iLeft + iBottom, iTop + iBottom ); break; - case GFX_FILLEDCIRCLE: + case HB_GFX_FILLEDCIRCLE: XSetForeground( wnd->dpy, wnd->gc, iRight ); XFillArc( wnd->dpy, wnd->drw, wnd->gc, iLeft, iTop, iBottom, iBottom, 0, 360*64 ); @@ -3920,7 +3920,7 @@ static int hb_gt_xwc_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iLeft + iBottom, iTop + iBottom ); break; - case GFX_ELLIPSE: + case HB_GFX_ELLIPSE: XSetForeground( wnd->dpy, wnd->gc, iColor ); XDrawArc( wnd->dpy, wnd->drw, wnd->gc, iLeft, iTop, iRight, iBottom, 0, 360*64 ); @@ -3928,7 +3928,7 @@ static int hb_gt_xwc_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iLeft + iRight, iTop + iBottom ); break; - case GFX_FILLEDELLIPSE: + case HB_GFX_FILLEDELLIPSE: XSetForeground( wnd->dpy, wnd->gc, iColor ); XFillArc( wnd->dpy, wnd->drw, wnd->gc, iLeft, iTop, iRight, iBottom, 0, 360*64 ); @@ -3936,7 +3936,7 @@ static int hb_gt_xwc_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, iLeft + iRight, iTop + iBottom ); break; - case GFX_FLOODFILL: + case HB_GFX_FLOODFILL: /* TODO: */ hb_gt_xwc_InvalidatePts( wnd, 0, 0, wnd->width, wnd->height ); break;