diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f21c50b1cd..84621f24e3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,14 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-10-18 13:47 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbsocket.h + * harbour/src/rtl/hbsocket.c + * added new function b_socketResolveInetAddr() + + * harbour/ChangeLog + * minor formatting + 2009-10-17 21:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbmemio/memio.c * casting for 64bit builds @@ -1314,7 +1322,7 @@ * utils/hbtest/rt_stra.prg * utils/hbtest/rt_array.prg * examples/hbdoc/examples/core_es/dbstrux.txt - * examples/hbdoc2/hbdoc2.prg + * examples/hbdoc2/hbdoc2.prg * HB_C52_STRICT -> HB_CLP_STRICT We use it cover strict Clipper compatibility in general, not just for C5.2. @@ -82254,7 +82262,7 @@ 2007-05-22 12:20 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/bin/hb-func.sh - + added -lpcreposix to system libraries when C_USR has -DHB_PCRE_REGEX + + added -lpcreposix to system libraries when C_USR has -DHB_PCRE_REGEX * harbour/include/hbregex.h * removed pcre/ path from PCRE header files - if you want to build Harbour with PCRE regex and PCRE header files are not in default\ @@ -97276,12 +97284,12 @@ NOTE: *an example character mapping 2004-01-08 18:45 UTC-0500 David G. Holm - * contrib/Makefile + * contrib/Makefile + Added a section for rsxnt, which is unable to compile Ole and odbc. - Removed odbc from default section, because it includes the windows.h include file, which is unlikely to exist on non-Windows systems. - * contrib/odbc/odbc.c + * contrib/odbc/odbc.c ! Added type overrides for MSVC. 2004-01-08 16:45 UTC-0500 David G. Holm @@ -97289,12 +97297,12 @@ NOTE: ! Usage of fdatasync updated to match current POSIX specification. 2004-01-08 16:00 UTC-0500 David G. Holm - * source/rtl/filesys.c + * source/rtl/filesys.c + Added an error return check to fdatasync when using POSIX synchronized I/O, so that if unimplemented, the slower method will be used to ensure that the file gets flushed. - * utils/hbpp/hbpp.c + * utils/hbpp/hbpp.c ! Removed another refererence to malloc.h, which is obsoleted by stdlib.h and doesn't even exist in gcc 3.x implementations. @@ -99970,7 +99978,7 @@ All this changes (except Ron's PP) are my work borrowed from xHarbour. * if building Harbour under NT, use the alternate makefile.nt * for faster builds. * if you would prefer not to use batch mode, - * run make_vc /y (just like nmake) + * run make_vc /y (just like nmake) 2002-11-03 20:28 UTC+0300 Alexander Kresin * source/rdd/dbcmd.c @@ -100743,11 +100751,11 @@ All this changes (except Ron's PP) are my work borrowed from xHarbour. 2002-08-03 22:50 UTC+0100 Tomaz Zupan * contrib/odbc/odbc.c - contrib/odbc/todbc.prg - * Added bof(), reccount(), lastrec() and recno() functionality to - ODBC library. + * contrib/odbc/todbc.prg + * Added bof(), reccount(), lastrec() and recno() functionality to + ODBC library. * contrib/odbc/browodbc.prg - * enabled statusline + * enabled statusline 2002-08-02 12:35 UTC-0400 David G. Holm * doc/howtobsd.txt @@ -101592,11 +101600,11 @@ All this changes (except Ron's PP) are my work borrowed from xHarbour. + Internationalization Started 2002-05-15 23:43 UTC-0800 Brian Hays - * contrib/rdd_ads/ads1.c - * Fixed adsSeek for non-ADS filter conditions. - If a filter is set that is not valid for ADS, we need to skip - off of any invalid records (IOW, filter at the Harbour level if ADS - can't because the filter has UDFs or PUBLICVAR references). + * contrib/rdd_ads/ads1.c + * Fixed adsSeek for non-ADS filter conditions. + If a filter is set that is not valid for ADS, we need to skip + off of any invalid records (IOW, filter at the Harbour level if ADS + can't because the filter has UDFs or PUBLICVAR references). 2002-05-15 22:25 UTC-0300 Luiz Rafael Culik * contrib/mysql/mysql.c @@ -102463,21 +102471,21 @@ All this changes (except Ron's PP) are my work borrowed from xHarbour. ! Bug fixed, reported by Mike Romberg 2002-03-03 17:17 UTC-0800 Brian Hays - * source/rtl/persist.prg - * added 254 as linelength to MLCount call in LoadFromText so - it matches later call to MemoLine + * source/rtl/persist.prg + * added 254 as linelength to MLCount call in LoadFromText so + it matches later call to MemoLine - * source\common\hbffind.c - * fixed the "Directory() can't see files with cleared - archive bits" problem. + * source\common\hbffind.c + * fixed the "Directory() can't see files with cleared + archive bits" problem. 2002-03-03 16:20 GMT-3 Luiz Rafael Culik * include/hbapifs.h - + prototype for hb_fsPOpen() api + + prototype for hb_fsPOpen() api * source/rtl/set.c - source/rtl/filesys.c + * source/rtl/filesys.c * Added Code to Support SET PRINTER TO PIPE - Code provided by Przemyslaw CzerPak druzus@polbox.com + Code provided by Przemyslaw CzerPak druzus@polbox.com * utils/hbmake/hbmake.prg * Minor fix for Library create response file for ar archiver * utils/hbmake/hbmutils.prg @@ -109528,30 +109536,28 @@ e.vc */ 2001-05-27 02:19 UTC-0800 Brian Hays + * source/rdd/dbcmd.c + * fixed ordListAdd pointer bug reported by JF - * source/rdd/dbcmd.c - * fixed ordListAdd pointer bug reported by JF + * contrib/rdd_ads/ads.ch + + added COMMIT command to call AdsWriteAllRecords + (our dbCommitAll() loops through all workareas. AdsWriteAllRecords + is an optimized single call to the server.) - * contrib/rdd_ads/ads.ch - + added COMMIT command to call AdsWriteAllRecords - (our dbCommitAll() loops through all workareas. AdsWriteAllRecords - is an optimized single call to the server.) + * contrib/rdd_ads/ads1.c + * corrected commit to only flush current workarea + * fixed DBOI_ORDERCOUNT parameter handling - * contrib/rdd_ads/ads1.c - * corrected commit to only flush current workarea - * fixed DBOI_ORDERCOUNT parameter handling + * contrib/rdd_ads/adsfunc.c + + added AdsWriteAllRecords() & AdsGetNumIndexes() - * contrib/rdd_ads/adsfunc.c - + added AdsWriteAllRecords() & AdsGetNumIndexes() - - * contrib\rdd_ads\doc\en\readme.txt - * minor edits + * contrib\rdd_ads\doc\en\readme.txt + * minor edits 2001-05-26 10:25 UTC-0800 Brian Hays - - * source/rdd/dbcmd.c - * Harrier's fix to APPEND FROM from a source file - with a different structure than the target. + * source/rdd/dbcmd.c + * Harrier's fix to APPEND FROM from a source file + with a different structure than the target. Thanks, Harrier, it works! 2001-05-25 12:20 UTC-0800 Ron Pinkas @@ -109567,89 +109573,86 @@ e.vc thus overriding the assigned item. 2001-05-24 01:09 UTC-0800 Brian Hays + * source/rdd/dbcmd.c + * fixed dbSetIndex/ordListAdd to set the order and go top IF + it's the first bag - * source/rdd/dbcmd.c - * fixed dbSetIndex/ordListAdd to set the order and go top IF - it's the first bag + * contrib/rdd_ads/ads.ch + + added #define ADS_LOCAL_SERVER, ADS_REMOTE_SERVER, + ADS_AIS_SERVER for "ORing" options + * fixed _SET_DELETED typo - * contrib/rdd_ads/ads.ch - + added #define ADS_LOCAL_SERVER, ADS_REMOTE_SERVER, - ADS_AIS_SERVER for "ORing" options - * fixed _SET_DELETED typo - - * contrib/rdd_ads/ads1.c - * Fixed EOF flag when doing a GO 0 + * contrib/rdd_ads/ads1.c + * Fixed EOF flag when doing a GO 0 2001-05-23 21:15 UTC-0800 Ron Pinkas - * include/hbclass.ch - ! Corrected few minor typos. + * include/hbclass.ch + ! Corrected few minor typos. - * source/compiler/harbour.slx - * source/macro/macro.slx - - Commented few unused lines. + * source/compiler/harbour.slx + * source/macro/macro.slx + - Commented few unused lines. - * contrib/dot/pp.prg - % Rewrote NextToken() and NextExp(). - + Added NextIdentifier() - ! Found that Clipper PP is not processing tokens read by NextToken() and NextExp() so removed recursive support, - and changed logic in ProcessLine() to linear process: - #defines against all valid Identifiers - Expansion forces a resacn from top. + * contrib/dot/pp.prg + % Rewrote NextToken() and NextExp(). + + Added NextIdentifier() + ! Found that Clipper PP is not processing tokens read by NextToken() and NextExp() so removed recursive support, + and changed logic in ProcessLine() to linear process: + #defines against all valid Identifiers - Expansion forces a resacn from top. + #[x]translates against all tokens - Expansion forces a resacn from top of #defines. + #[x]command agains the first token - Expansion forces a resacn from top of #defines. + ! Corrected and refined many aspects of Interpreter mode. + + Added ExecuteMethod() and support for OO syntax. + + Added support for -I command line switch. + + * contrib/dot/rp_run.ch + + Added support for OO syntax. + + * contrib/dot/pp.txt + * Updated documentation. + valid Identifiers - Expansion forces a resacn from top. #[x]translates against all tokens - Expansion forces a resacn from top of #defines. #[x]command agains the first token - Expansion forces a resacn from top of #defines. - ! Corrected and refined many aspects of Interpreter mode. - + Added ExecuteMethod() and support for OO syntax. - + Added support for -I command line switch. + ! Corrected and refined many aspects of Interpreter mode. + + Added ExecuteMethod() and support for OO syntax. + + Added support for -I command line switch. - * contrib/dot/rp_run.ch - + Added support for OO syntax. + * contrib/dot/rp_run.ch + + Added support for OO syntax. - * contrib/dot/pp.txt - * Updated documentation. -valid Identifiers - Expansion forces a resacn from top. - #[x]translates against all tokens - Expansion forces a resacn from top of #defines. - #[x]command agains the first token - Expansion forces a resacn from top of #defines. - ! Corrected and refined many aspects of Interpreter mode. - + Added ExecuteMethod() and support for OO syntax. - + Added support for -I command line switch. + * contrib/dot/pp.txt + * Updated documentation. - * contrib/dot/rp_run.ch - + Added support for OO syntax. + PP Interpreter mode, is now capable of running code like this: + //---------------------------// + Function Main() + LOCAL o := TTest():New() - * contrib/dot/pp.txt - * Updated documentation. + o:Increment() + Alert( o:nVar ) + Return nil - /* PP Interpreter mode, is now capable of running code like this: - //---------------------------// - Function Main() - LOCAL o := TTest():New() + CLASS TTest + VAR nVar + METHOD New CONSTRUCTOR + METHOD Increment() + ENDCLASS - o:Increment() - Alert( o:nVar ) - Return nil + METHOD New //CLASS TTest /* CLASS clause now optional */ + ::nVar := 0 + return Self - CLASS TTest - VAR nVar - METHOD New CONSTRUCTOR - METHOD Increment() - ENDCLASS - - METHOD New //CLASS TTest /* CLASS clause now optional */ - ::nVar := 0 - return Self - - METHOD Increment CLASS TTest // () No longer required - Return (++::nVar) - //---------------------------// - */ + METHOD Increment CLASS TTest // () No longer required + Return (++::nVar) + //---------------------------// 2001-05-21 21:35 UTC+1 JFL (mafact) - * harbour/source/vm/Proc.c - + MethodName(nLevel) ==> Same as ProcName(nLevel) - * harbour/include/hbclass.ch + * harbour/source/vm/Proc.c + + MethodName(nLevel) ==> Same as ProcName(nLevel) + * harbour/include/hbclass.ch - delete xTranslate 'MethodName' 2001-05-21 14:30 UTC-0400 David G. Holm - * source/rtl/tget.prg ! In METHOD KillFocus(), don't call ::Display() until after clearing ::hasFocus. Per bug report from "Robert Haley" @@ -114176,7 +114179,7 @@ NOTE! some modules still use a direct access to the eval stack * added Maximum Tables Configuration info * workarea.c * fixed hb_waSkipFilter to limit lToSkip to 1 when passed to SkipRaw - * doc\en\rdddb.txt + * doc\en\rdddb.txt * fixed dbCreate() 4th parameter docs 2000-10-25 15:00 UTC-0400 David G. Holm diff --git a/harbour/include/hbsocket.h b/harbour/include/hbsocket.h index 817eaf21d9..cad19ace66 100644 --- a/harbour/include/hbsocket.h +++ b/harbour/include/hbsocket.h @@ -78,6 +78,7 @@ HB_EXPORT extern BOOL hb_socketLocalAddr( void ** pSockAddr, unsigned * HB_EXPORT extern BOOL hb_socketInetAddr( void ** pSockAddr, unsigned * puiLen, const char * szAddr, int iPort ); HB_EXPORT extern BOOL hb_socketInet6Addr( void ** pSockAddr, unsigned * puiLen, const char * szAddr, int iPort ); HB_EXPORT extern char * hb_socketAddrGetName( const void * pSockAddr, unsigned len ); +HB_EXPORT extern BOOL hb_socketResolveInetAddr( void ** pSockAddr, unsigned * puiLen, const char * szAddr, int iPort ); HB_EXPORT extern char * hb_socketResolveAddr( const char * szAddr, int af ); HB_EXPORT extern PHB_ITEM hb_socketGetHosts( const char * szAddr, int af ); HB_EXPORT extern PHB_ITEM hb_socketGetAliases( const char * szAddr, int af ); diff --git a/harbour/src/rtl/hbsocket.c b/harbour/src/rtl/hbsocket.c index 8c9e56218b..49947b27aa 100644 --- a/harbour/src/rtl/hbsocket.c +++ b/harbour/src/rtl/hbsocket.c @@ -667,6 +667,16 @@ int hb_socketSelect( PHB_ITEM pArrayRD, BOOL fSetRD, return -1; } +BOOL hb_socketResolveInetAddr( void ** pSockAddr, unsigned * puiLen, const char * szAddr, int iPort ) +{ + HB_SYMBOL_UNUSED( szAddr ); + HB_SYMBOL_UNUSED( iPort ); + hb_socketSetRawError( HB_SOCKET_ERR_AFNOSUPPORT ); + *pSockAddr = NULL; + *puiLen = 0; + return FALSE; +} + char * hb_socketResolveAddr( const char * szAddr, int af ) { HB_SYMBOL_UNUSED( szAddr ); @@ -2631,6 +2641,82 @@ int hb_socketSelect( PHB_ITEM pArrayRD, BOOL fSetRD, } /* DNS functions */ +BOOL hb_socketResolveInetAddr( void ** pSockAddr, unsigned * puiLen, const char * szAddr, int iPort ) +{ +#if defined( AF_INET ) + struct sockaddr_in sa; + BOOL fTrans ; + + memset( &sa, 0, sizeof( sa ) ); + sa.sin_family = AF_INET; + sa.sin_port = htons( ( hbU16 ) iPort ); + if( !szAddr || !*szAddr ) + { + sa.sin_addr.s_addr = htonl( INADDR_ANY ); + *pSockAddr = memcpy( hb_xgrab( sizeof( sa ) + 1 ), &sa, sizeof( sa ) ); + *puiLen = ( unsigned ) sizeof( sa ); + return TRUE; + } + +#if defined( HB_HAS_INET_PTON ) + fTrans = inet_pton( AF_INET, szAddr, &sa.sin_addr ) > 0; +#elif defined( HB_HAS_INET_ATON ) + fTrans = inet_aton( szAddr, &sa.sin_addr ) != 0; +#else + sa.sin_addr.s_addr = inet_addr( szAddr ); + fTrans = sa.sin_addr.s_addr != INADDR_NONE || + strcmp( "255.255.255.255", szAddr ) == 0; /* dirty hack */ +#endif + + if( !fTrans ) + { +#if defined( HB_HAS_ADDRINFO ) + struct addrinfo hints, *res = NULL; + + hb_vmUnlock(); + memset( &hints, 0, sizeof( hints ) ); + hints.ai_family = AF_INET; + if( getaddrinfo( szAddr, NULL, &hints, &res ) == 0 ) + { + if( res->ai_addrlen >= sizeof( struct sockaddr_in ) && + hb_socketGetAddrFamilly( res->ai_addr, res->ai_addrlen ) == AF_INET ) + { + sa.sin_addr.s_addr = ( ( struct sockaddr_in * ) res->ai_addr )->sin_addr.s_addr; + fTrans = TRUE; + } + freeaddrinfo( res ); + } + hb_vmLock(); +#else + struct hostent * he; + + hb_vmUnlock(); + he = gethostbyname( szAddr ); + if( he && he->h_addr_list[ 0 ] ) + { + sa.sin_addr.s_addr = ( ( struct in_addr * ) he->h_addr_list[ 0 ] )->s_addr; + fTrans = TRUE; + } + hb_vmLock(); +#endif + } + + if( fTrans ) + { + *pSockAddr = memcpy( hb_xgrab( sizeof( sa ) + 1 ), &sa, sizeof( sa ) ); + *puiLen = ( unsigned ) sizeof( sa ); + return TRUE; + } +#else + HB_SYMBOL_UNUSED( szAddr ); + HB_SYMBOL_UNUSED( iPort ); + hb_socketSetRawError( HB_SOCKET_ERR_AFNOSUPPORT ); +#endif + *pSockAddr = NULL; + *puiLen = 0; + return FALSE; +} + char * hb_socketResolveAddr( const char * szAddr, int af ) { char * szResult = NULL;