diff --git a/ChangeLog.txt b/ChangeLog.txt index a6dec78623..508a4e27a3 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,17 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-09-16 11:25 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * doc/cmpopt.txt + * doc/xhb-diff.txt + * typos + + * src/rtl/hbsocket.c + * simplified hb_socketSelect() code + + * src/rtl/mtran.c + ! updated HB_TRACE message + 2013-09-10 02:09 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rtl/cdpapi.c ! added missing static in s_en_buffer declaration diff --git a/doc/cmpopt.txt b/doc/cmpopt.txt index b1781cbecb..d1a7c1ed34 100644 --- a/doc/cmpopt.txt +++ b/doc/cmpopt.txt @@ -63,7 +63,7 @@ arguments are well known and can be calculated at compile time: // can contain '&' character. Harbour checks // if concatenation can change existing valid // macro name or ignore '&' when -kM compiler - // switch which disable macro substitution + // switch which disables macro substitution // is used - => - => @@ -73,7 +73,7 @@ arguments are well known and can be calculated at compile time: // can contain '&' character. Harbour checks // if concatenation can change existing valid // macro name or ignore '&' when -kM compiler - // switch which disable macro substitution + // switch which disables macro substitution // is used * => / => // Clipper optimize only integers @@ -85,7 +85,7 @@ arguments are well known and can be calculated at compile time: // can contain '&' character. Harbour checks // if after '&' is potentially valid macro // name or ignore '&' when -kM compiler switch - // which disable macro substitution is used + // which disables macro substitution is used == => == => == => @@ -94,7 +94,7 @@ arguments are well known and can be calculated at compile time: // can contain '&' character. Harbour checks // if after '&' is potentially valid macro // name or ignore '&' when -kM compiler switch - // which disable macro substitution is used + // which disables macro substitution is used NIL == => == NIL => diff --git a/doc/xhb-diff.txt b/doc/xhb-diff.txt index 37479226f6..1e3cda29ad 100644 --- a/doc/xhb-diff.txt +++ b/doc/xhb-diff.txt @@ -10,7 +10,7 @@ It describes status of both compiler at the end of October 2009: Przemek, -(Przemyslaw Czerpak, druzus/at/acn.waw.pl) +(Przemyslaw Czerpak, druzus /at/ priv.onet.pl) @@ -742,12 +742,12 @@ If it's possible then for macrocodeblocks Harbour compiler tries to generate early eval code in which macros are expanded when codeblock is created. Otherwise macros are expanded each time codeblock is evaluated. -xHarbour has also similar extension but limited to only to macro -variables and it works only if other macros are not used in the -same expression. When more complicated examples are create xHarbour -compiler generates broken code which generate RTE or GPF during -execution. It also does not support codeblocks which contain mixed -macros and refuse to compile such code. +xHarbour has also similar extension but limited to macro variables +and it works only if other macros are not used in the same expression. +When more complicated examples are created xHarbour compiler generates +broken code which causes RTE or GPF during execution. It also does not +support codeblocks which contain mixed macros and refuse to compile +such code. This example illustrates macros with declared symbols. diff --git a/src/rtl/hbsocket.c b/src/rtl/hbsocket.c index e57267a898..0f90362dfa 100644 --- a/src/rtl/hbsocket.c +++ b/src/rtl/hbsocket.c @@ -2736,6 +2736,20 @@ int hb_socketSelectWriteEx( HB_SOCKET sd, HB_MAXINT timeout ) return ret; } +static HB_SOCKET s_socketSelectCallback( PHB_ITEM pItem ) +{ + HB_SOCKET sd = HB_NO_SOCKET; + + if( pItem ) + { + if( HB_IS_NUMERIC( pItem ) ) + sd = ( HB_SOCKET ) hb_itemGetNInt( pItem ); + else if( HB_IS_POINTER( pItem ) ) + sd = ( HB_SOCKET ) ( HB_PTRDIFF ) hb_itemGetPtr( pItem ); + } + return sd; +} + int hb_socketSelect( PHB_ITEM pArrayRD, HB_BOOL fSetRD, PHB_ITEM pArrayWR, HB_BOOL fSetWR, PHB_ITEM pArrayEX, HB_BOOL fSetEX, @@ -2749,6 +2763,9 @@ int hb_socketSelect( PHB_ITEM pArrayRD, HB_BOOL fSetRD, fd_set fds[ 3 ], * pfds[ 3 ]; struct timeval tv, * ptv; + if( pFunc == NULL ) + pFunc = s_socketSelectCallback; + pItemSets[ 0 ] = pArrayRD; pItemSets[ 1 ] = pArrayWR; pItemSets[ 2 ] = pArrayEX; @@ -2766,18 +2783,7 @@ int hb_socketSelect( PHB_ITEM pArrayRD, HB_BOOL fSetRD, FD_ZERO( &fds[ i ] ); for( ul = 1; ul <= nLen; ul++ ) { - if( pFunc ) - sd = pFunc( hb_arrayGetItemPtr( pItemSets[ i ], ul ) ); - else - { - HB_TYPE type = hb_arrayGetType( pItemSets[ i ], ul ); - if( type & HB_IT_NUMERIC ) - sd = ( HB_SOCKET ) hb_arrayGetNInt( pItemSets[ i ], ul ); - else if( type & HB_IT_POINTER ) - sd = ( HB_SOCKET ) ( HB_PTRDIFF ) hb_arrayGetPtr( pItemSets[ i ], ul ); - else - sd = HB_NO_SOCKET; - } + sd = pFunc( hb_arrayGetItemPtr( pItemSets[ i ], ul ) ); if( sd != HB_NO_SOCKET ) { if( maxsd < sd ) @@ -2811,18 +2817,7 @@ int hb_socketSelect( PHB_ITEM pArrayRD, HB_BOOL fSetRD, nLen = hb_arrayLen( pItemSets[ i ] ); for( ul = 1; ul <= nLen; ul++ ) { - if( pFunc ) - sd = pFunc( hb_arrayGetItemPtr( pItemSets[ i ], ul ) ); - else - { - HB_TYPE type = hb_arrayGetType( pItemSets[ i ], ul ); - if( type & HB_IT_NUMERIC ) - sd = ( HB_SOCKET ) hb_arrayGetNInt( pItemSets[ i ], ul ); - else if( type & HB_IT_POINTER ) - sd = ( HB_SOCKET ) ( HB_PTRDIFF ) hb_arrayGetPtr( pItemSets[ i ], ul ); - else - sd = HB_NO_SOCKET; - } + sd = pFunc( hb_arrayGetItemPtr( pItemSets[ i ], ul ) ); if( sd != HB_NO_SOCKET && FD_ISSET( ( HB_SOCKET_T ) sd, pfds[ i ] ) ) { if( ++nPos != ul ) diff --git a/src/rtl/mtran.c b/src/rtl/mtran.c index 0b1263749e..6733c3f04f 100644 --- a/src/rtl/mtran.c +++ b/src/rtl/mtran.c @@ -56,7 +56,7 @@ HB_SIZE hb_strMemotran( char * pszResult, const char * pszString, HB_SIZE nStrin HB_SIZE nStringPos = 0; HB_SIZE nResultPos = 0; - HB_TRACE( HB_TR_DEBUG, ( "hb_strMemotran(%p, %p, %s, %" HB_PFS "u, %x, %x)", pszResult, pnResultLen, pszString, nStringLen, cHardCR, cSoftCR ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_strMemotran(%p, %s, %" HB_PFS "u, %x, %x)", pszResult, pszString, nStringLen, cHardCR, cSoftCR ) ); while( nStringPos < nStringLen ) {