2009-10-23 11:47 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbapi.h
  * harbour/src/vm/extend.c
    + added hb_parldef() function

  * harbour/src/vm/thread.c
  * harbour/src/vm/memvars.c
  * harbour/src/vm/arrayshb.c
  * harbour/src/vm/classes.c
  * harbour/src/rtl/hbtoken.c
  * harbour/src/rtl/maxrow.c
  * harbour/src/rtl/strtoexp.c
  * harbour/src/rtl/filesys.c
  * harbour/src/rtl/hbregex.c
  * harbour/src/rtl/dateshb.c
  * harbour/src/rtl/hbi18n1.c
  * harbour/src/rtl/mlcfunc.c
  * harbour/src/rtl/itemseri.c
  * harbour/src/rtl/strc.c
  * harbour/src/rtl/gete.c
  * harbour/src/rtl/mouse53.c
  * harbour/src/rtl/fssize.c
  * harbour/src/rdd/dbsql.c
  * harbour/src/rdd/dbdetach.c
  * harbour/src/rdd/dbcmd.c
  * harbour/src/rdd/dbcmd53.c
  * harbour/src/rdd/hbsix/sxord.c
  * harbour/src/rdd/hbsix/sxfname.c
  * harbour/contrib/hbct/bitnum.c
  * harbour/contrib/hbct/screen2.c
  * harbour/contrib/hbct/ctnet.c
  * harbour/contrib/hbct/files.c
  * harbour/contrib/hbct/charswap.c
  * harbour/contrib/hbct/lton.c
  * harbour/contrib/hbct/color.c
  * harbour/contrib/hbct/num1.c
  * harbour/contrib/hbct/token1.c
  * harbour/contrib/hbct/numcount.c
  * harbour/contrib/hbct/ctwfunc.c
  * harbour/contrib/hbct/ctstrfil.c
  * harbour/contrib/hbct/dattime2.c
  * harbour/contrib/xhb/bkgtsks.c
  * harbour/contrib/xhb/xhbtrim.c
  * harbour/contrib/hbnf/prtscr.c
  * harbour/contrib/hbnf/fttext.c
  * harbour/contrib/hbnetio/netiosrv.c
  * harbour/contrib/gtwvg/wincallb.c
  * harbour/contrib/gtwvg/wvgwing.c
  * harbour/contrib/rddads/adsfunc.c
  * harbour/contrib/hbwin/win_prn1.c
  * harbour/contrib/hbwin/win_prn2.c
    % optimized HB_ISLOG() / hb_parl() usage
This commit is contained in:
Przemyslaw Czerpak
2009-10-23 09:48:38 +00:00
parent 4acf2beda2
commit 6b282c790b
49 changed files with 174 additions and 102 deletions

View File

@@ -17,6 +17,59 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-10-23 11:47 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapi.h
* harbour/src/vm/extend.c
+ added hb_parldef() function
* harbour/src/vm/thread.c
* harbour/src/vm/memvars.c
* harbour/src/vm/arrayshb.c
* harbour/src/vm/classes.c
* harbour/src/rtl/hbtoken.c
* harbour/src/rtl/maxrow.c
* harbour/src/rtl/strtoexp.c
* harbour/src/rtl/filesys.c
* harbour/src/rtl/hbregex.c
* harbour/src/rtl/dateshb.c
* harbour/src/rtl/hbi18n1.c
* harbour/src/rtl/mlcfunc.c
* harbour/src/rtl/itemseri.c
* harbour/src/rtl/strc.c
* harbour/src/rtl/gete.c
* harbour/src/rtl/mouse53.c
* harbour/src/rtl/fssize.c
* harbour/src/rdd/dbsql.c
* harbour/src/rdd/dbdetach.c
* harbour/src/rdd/dbcmd.c
* harbour/src/rdd/dbcmd53.c
* harbour/src/rdd/hbsix/sxord.c
* harbour/src/rdd/hbsix/sxfname.c
* harbour/contrib/hbct/bitnum.c
* harbour/contrib/hbct/screen2.c
* harbour/contrib/hbct/ctnet.c
* harbour/contrib/hbct/files.c
* harbour/contrib/hbct/charswap.c
* harbour/contrib/hbct/lton.c
* harbour/contrib/hbct/color.c
* harbour/contrib/hbct/num1.c
* harbour/contrib/hbct/token1.c
* harbour/contrib/hbct/numcount.c
* harbour/contrib/hbct/ctwfunc.c
* harbour/contrib/hbct/ctstrfil.c
* harbour/contrib/hbct/dattime2.c
* harbour/contrib/xhb/bkgtsks.c
* harbour/contrib/xhb/xhbtrim.c
* harbour/contrib/hbnf/prtscr.c
* harbour/contrib/hbnf/fttext.c
* harbour/contrib/hbnetio/netiosrv.c
* harbour/contrib/gtwvg/wincallb.c
* harbour/contrib/gtwvg/wvgwing.c
* harbour/contrib/rddads/adsfunc.c
* harbour/contrib/hbwin/win_prn1.c
* harbour/contrib/hbwin/win_prn2.c
% optimized HB_ISLOG() / hb_parl() usage
2009-10-23 11:33 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbssl/evpciph.c
* contrib/hbssl/sslsess.c

View File

@@ -175,8 +175,8 @@ HB_FUNC( _ASCALLBACK )
return;
}
Callback.iFormalParams = HB_ISNUM( 3 ) ? hb_parni( 3 ) : 4 ; /* default to 4 formal parameters */
Callback.bVoid = HB_ISLOG( 4 ) ? hb_parl ( 4 ) : FALSE; /* default to non-void function */
Callback.iFormalParams = HB_ISNUM( 3 ) ? hb_parni( 3 ) : 4; /* default to 4 formal parameters */
Callback.bVoid = hb_parl( 4 ); /* default to non-void function */
Callback.iCargoParams = hb_pcount() - 4;
Callback.pParams = ( PHB_ITEM * ) hb_xgrab( Callback.iCargoParams * sizeof( PHB_ITEM ) );

View File

@@ -881,9 +881,9 @@ HB_FUNC( WVG_CHOOSEFONT )
Flags = Flags | CF_NOSIMULATIONS; /* ::synthesizeFonts == .f. */
#endif
if( HB_ISLOG( 5 ) && hb_parl( 5 ) )
if( hb_parl( 5 ) )
Flags = Flags | CF_SCREENFONTS;
if( HB_ISLOG( 6 ) && hb_parl( 6 ) )
if( hb_parl( 6 ) )
Flags = Flags | CF_PRINTERFONTS;
cf.lStructSize = sizeof( CHOOSEFONT );
@@ -1055,7 +1055,7 @@ HB_FUNC( WVG_ADDTOOLBARBUTTON )
HB_TCHAR_FREE( szCaption );
#if 1
if( HB_ISLOG( 6 ) && ( hb_parl( 6 ) ) )
if( hb_parl( 6 ) )
{
SendMessage( hWndTB, TB_SETMAXTEXTROWS, ( WPARAM ) 0, ( LPARAM ) 0 );
}

View File

@@ -178,7 +178,7 @@ HB_FUNC( NUMROL )
if( __numParam( 1, &lValue ) && lValue == ( lValue & 0xffff ) && __numParam( 2, &lShift )
&& lShift == ( lShift & 0xffff ) )
{
if( HB_ISLOG( 3 ) && hb_parl( 3 ) )
if( hb_parl( 3 ) )
{
USHORT us = ( USHORT ) ( lValue & 0xff ) << ( lShift & 0x07 );
@@ -203,7 +203,7 @@ HB_FUNC( NUMMIRR )
if( __numParam( 1, &lValue ) && lValue == ( lValue & 0xffff ) )
{
USHORT usBits = HB_ISLOG( 2 ) && hb_parl( 2 ) ? 8 : 16;
USHORT usBits = hb_parl( 2 ) ? 8 : 16;
USHORT usResult = ( USHORT ) ( lValue >> usBits );
do
@@ -291,7 +291,7 @@ HB_FUNC( INTNEG )
if( __numParam( 1, &lValue ) )
{
BOOL f32Bit = HB_ISLOG( 2 ) && hb_parl( 2 );
BOOL f32Bit = hb_parl( 2 );
if( f32Bit )
hb_retnint( ( INT16 ) lValue );
@@ -308,7 +308,7 @@ HB_FUNC( INTPOS )
if( __numParam( 1, &lValue ) )
{
BOOL f32Bit = HB_ISLOG( 2 ) && hb_parl( 2 );
BOOL f32Bit = hb_parl( 2 );
if( f32Bit )
hb_retnint( ( UINT16 ) lValue );

View File

@@ -93,7 +93,7 @@ static void do_charswap( int iSwitch )
if( iSwitch == DO_CHARSWAP_WORDSWAP )
{
iShift = 4;
if( HB_ISLOG( 2 ) && hb_parl( 2 ) )
if( hb_parl( 2 ) )
{
iSwitch = DO_CHARSWAP_WORDSWAP_CHARSWAP;
}

View File

@@ -200,7 +200,7 @@ HB_FUNC( NTOCOLOR )
if( iColor >= 0x00 && iColor <= 0xff )
{
if( HB_ISLOG( 2 ) && hb_parl( 2 ) )
if( hb_parl( 2 ) )
hb_gtColorsToString( &iColor, 1, szColorString, 10 );
else
hb_snprintf( szColorString, 10, "%02d/%02d", iColor & 0x0f, iColor >> 4 );

View File

@@ -202,7 +202,7 @@ HB_FUNC( NETREDIR )
LPTSTR lpLocalDev = HB_TCHAR_CONVTO( hb_parcx( 1 ) );
LPTSTR lpSharedRes = HB_TCHAR_CONVTO( hb_parcx( 2 ) );
LPTSTR lpPassword = HB_TCHAR_CONVTO( hb_parcx( 3 ) );
BOOL bShowError = ( HB_ISLOG( 4 ) ? hb_parl( 4 ) : FALSE );
BOOL bShowError = hb_parl( 4 );
if( hb_pcount() >= 3 && HB_ISCHAR( 3 ) )
dwResult = WNetAddConnection( lpSharedRes, lpPassword, lpLocalDev );

View File

@@ -140,8 +140,8 @@ HB_FUNC( STRFILE )
if( HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) )
{
hb_retnl( ct_StrFile( hb_parc( 2 ), hb_parc( 1 ),
hb_parclen( 1 ), HB_ISLOG( 3 ) && hb_parl( 3 ),
hb_parnl( 4 ), HB_ISLOG( 5 ) && hb_parl( 5 ) ) );
hb_parclen( 1 ), hb_parl( 3 ),
hb_parnl( 4 ), hb_parl( 5 ) ) );
}
else
hb_retni( 0 );
@@ -158,7 +158,7 @@ HB_FUNC( FILESTR )
LONG lFileSize = hb_fsSeek( hFile, 0, FS_END );
LONG lPos = hb_fsSeek( hFile, hb_parnl( 3 ), FS_SET ), lLength;
char *pcResult, *pCtrlZ;
BOOL bCtrlZ = HB_ISLOG( 4 ) && hb_parl( 4 );
BOOL bCtrlZ = hb_parl( 4 );
if( HB_ISNUM( 2 ) )
{
@@ -205,8 +205,8 @@ HB_FUNC( SCREENFILE )
hb_gtSave( 0, 0, hb_gtMaxRow(), hb_gtMaxCol(), pBuffer );
hb_retnl( ct_StrFile( hb_parc( 1 ), pBuffer,
ulSize, HB_ISLOG( 2 ) && hb_parl( 2 ), hb_parnl( 3 ),
HB_ISLOG( 4 ) && hb_parl( 4 ) ) );
ulSize, hb_parl( 2 ), hb_parnl( 3 ),
hb_parl( 4 ) ) );
hb_xfree( pBuffer );
}
else

View File

@@ -121,7 +121,7 @@ HB_FUNC( WSETSHADOW )
HB_FUNC( WSETMOVE )
{
hb_retl( hb_ctwSetMoveMode( HB_ISLOG( 1 ) ? hb_parl( 1 ) : -1 ) != 0 );
hb_retl( hb_ctwSetMoveMode( hb_parldef( 1, -1 ) ) != 0 );
}
HB_FUNC( WSTEP )
@@ -134,10 +134,10 @@ HB_FUNC( WSTEP )
HB_FUNC( WMODE )
{
hb_retni( hb_ctwSetBorderMode( HB_ISLOG( 1 ) ? ( hb_parl( 1 ) ? 1 : 0 ) : -1,
HB_ISLOG( 2 ) ? ( hb_parl( 2 ) ? 1 : 0 ) : -1,
HB_ISLOG( 3 ) ? ( hb_parl( 3 ) ? 1 : 0 ) : -1,
HB_ISLOG( 4 ) ? ( hb_parl( 4 ) ? 1 : 0 ) : -1 ) );
hb_retni( hb_ctwSetBorderMode( hb_parldef( 1, -1 ),
hb_parldef( 2, -1 ),
hb_parldef( 3, -1 ),
hb_parldef( 4, -1 ) ) );
}
HB_FUNC( WBOARD )
@@ -156,7 +156,7 @@ HB_FUNC( WOPEN )
hb_retni( hb_ctwCreateWindow( hb_parni( 1 ), hb_parni( 2 ),
hb_parni( 3 ), hb_parni( 4 ),
hb_parl( 5 ), iColor,
!HB_ISLOG( 7 ) || hb_parl( 7 ) ) );
hb_parldef( 7, 1 ) ) );
}
HB_FUNC( WCLOSE )
@@ -175,7 +175,7 @@ HB_FUNC( WSELECT )
{
/* 2-nd parameter (fBringToTop) is Harbour extension */
hb_retni( HB_ISNUM( 1 ) ? hb_ctwSelectWindow( hb_parni( 1 ),
!HB_ISLOG( 2 ) || hb_parl( 2 ) ) :
hb_parldef( 2, 1 ) ) :
hb_ctwCurrentWindow() );
}
@@ -342,7 +342,7 @@ HB_FUNC( CTWLASTKEY )
HB_FUNC( HBCT_MAXROW ) /* Return the maximum screen/window row number (zero origin) */
{
if( HB_ISLOG( 1 ) && hb_parl( 1 ) )
if( hb_parl( 1 ) )
{
int iRows, iCols;
hb_gtScrDim( &iRows, &iCols );
@@ -354,7 +354,7 @@ HB_FUNC( HBCT_MAXROW ) /* Return the maximum screen/window row number (zero orig
HB_FUNC( HBCT_MAXCOL ) /* Return the maximum screen/window column number (zero origin) */
{
if( HB_ISLOG( 1 ) && hb_parl( 1 ) )
if( hb_parl( 1 ) )
{
int iRows, iCols;
hb_gtScrDim( &iRows, &iCols );

View File

@@ -586,8 +586,8 @@ HB_FUNC( ISLEAP )
*/
HB_FUNC( DAYSTOMONTH )
{
int iMonth = ( HB_ISNUM( 1 ) ? hb_parni( 1 ) : 0 );
BOOL bLeap = ( HB_ISLOG( 2 ) ? hb_parl( 2 ) : FALSE );
int iMonth = hb_parni( 1 );
BOOL bLeap = hb_parl( 2 );
hb_retni( ct_daystomonth( iMonth, bLeap ) );
}
@@ -622,8 +622,8 @@ HB_FUNC( DAYSTOMONTH )
*/
HB_FUNC( DAYSINMONTH )
{
int iMonth = ( HB_ISNUM( 1 ) ? hb_parni( 1 ) : 0 );
BOOL bLeap = ( HB_ISLOG( 2 ) ? hb_parl( 2 ) : FALSE );
int iMonth = hb_parni( 1 );
BOOL bLeap = hb_parl( 2 );
hb_retni( ct_daysinmonth( iMonth, bLeap ) );
@@ -838,7 +838,7 @@ HB_FUNC( WEEK )
{
int iYear, iMonth, iDay, iWeek;
long lDate;
BOOL bSWN = ( HB_ISLOG( 2 ) ? hb_parl( 2 ) : FALSE );
BOOL bSWN = hb_parl( 2 );
if( HB_ISDATETIME( 1 ) )
{

View File

@@ -134,7 +134,7 @@ static PHB_FFIND _hb_fileStart( BOOL fNext, ULONG ulAttr )
szFile = hb_fsNameConv( szFile, &pszFree );
if( HB_ISNUM( 2 ) )
ulAttr = ( ULONG ) hb_parnl( 2 );
pFFData->ulAttr = HB_ISLOG( 3 ) && hb_parl( 3 ) ? ulAttr : 0;
pFFData->ulAttr = hb_parl( 3 ) ? ulAttr : 0;
pFFData->ffind = hb_fsFindFirst( szFile, ulAttr );
if( pszFree )
hb_xfree( pszFree );

View File

@@ -55,5 +55,5 @@
HB_FUNC( LTON )
{
hb_retni( HB_ISLOG( 1 ) && hb_parl( 1 ) ? 1 : 0 );
hb_retni( hb_parl( 1 ) );
}

View File

@@ -236,7 +236,7 @@ HB_FUNC( FAHRENHEIT )
HB_FUNC( INFINITY )
{
if( HB_ISLOG( 1 ) && hb_parl( 1 ) )
if( hb_parl( 1 ) )
hb_retnd( DBL_MAX );
else
hb_retnd( 93786976294838206460.00 );

View File

@@ -57,7 +57,7 @@ static LONG s_lCounter = 0;
HB_FUNC( NUMCOUNT )
{
BOOL bMode = HB_ISLOG( 2 ) && hb_parl( 2 );
BOOL bMode = hb_parl( 2 );
if( HB_ISNUM( 1 ) )
{

View File

@@ -170,7 +170,7 @@ HB_FUNC( SAYMOVEIN )
BOOL fBack;
lDelay = HB_ISNUM( 2 ) ? hb_parnl( 2 ) : 4;
fBack = HB_ISLOG( 5 ) && hb_parl( 5 );
fBack = hb_parl( 5 );
iMaxRow = hb_gtMaxRow();
iMaxCol = hb_gtMaxCol();
@@ -426,14 +426,14 @@ HB_FUNC( _HB_CTDSPTIME )
hb_dateTimeStr( szTime );
iLen = 8;
if( HB_ISLOG( 3 ) && hb_parl( 3 ) )
if( hb_parl( 3 ) )
iLen -= 3;
if( HB_ISLOG( 5 ) && hb_parl( 5 ) )
if( hb_parl( 5 ) )
{
int iHour = ( szTime[0] - '0' ) * 10 + ( szTime[1] - '0' );
if( HB_ISLOG( 6 ) && hb_parl( 6 ) )
if( hb_parl( 6 ) )
szTime[iLen++] = iHour >= 12 ? 'p' : 'a';
if( iHour > 12 )
iHour -= 12;

View File

@@ -792,7 +792,7 @@ HB_FUNC( TOKENSEP )
{
char cRet;
if( HB_ISLOG( 1 ) && hb_parl( 1 ) )
if( hb_parl( 1 ) )
{
/* return the separator char BEHIND the last token */
if( siPostSeparator != -1 )

View File

@@ -392,7 +392,7 @@ static void s_listenRet( HB_SOCKET sd, const char * szRootPath )
HB_FUNC( NETIO_SERVERSTOP )
{
PHB_LISTENSD lsd = s_listenParam( 1, FALSE );
BOOL fStop = !HB_ISLOG( 2 ) || hb_parl( 2 );
BOOL fStop = hb_parldef( 2, 1 );
if( lsd )
lsd->stop = fStop;

View File

@@ -1332,7 +1332,7 @@ HB_FUNC( FT_FWRITEL )
{
const char * theData = hb_parc( 1 );
int iDataLen = hb_parclen( 1 );
int lInsert = ( HB_ISLOG( 2 ) ? hb_parl( 2 ) : 0 );
int lInsert = hb_parl( 2 );
int err;
int iLineLen = 0;
int iRead, iEOL;

View File

@@ -64,7 +64,7 @@
HB_FUNC( FT_PRTSCR )
{
#if defined( HB_OS_DOS )
if ( hb_pcount() && HB_ISLOG( 1 ) )
if ( HB_ISLOG( 1 ) )
{
if ( hb_parl( 1 ) )
pbyte = 0;

View File

@@ -178,7 +178,7 @@ HB_FUNC( WIN_ENDDOC )
if( hDC )
{
if( HB_ISLOG( 2 ) && hb_parl( 2 ) )
if( hb_parl( 2 ) )
Result = ( AbortDoc( hDC ) > 0 );
else
Result = ( EndDoc( hDC ) > 0 );
@@ -297,7 +297,7 @@ HB_FUNC( WIN_GETTEXTSIZE )
GetTextExtentPoint32( hDC, lpData, iLen, &sSize ); /* Get the length of the text in device size */
if( HB_ISLOG( 4 ) && !hb_parl( 4 ) )
if( !hb_parldef( 4, 1 ) )
Result = ( LONG ) sSize.cy; /* return the height */
else
Result = ( LONG ) sSize.cx; /* return the width */
@@ -319,7 +319,7 @@ HB_FUNC( WIN_GETCHARSIZE )
TEXTMETRIC tm;
GetTextMetrics( hDC, &tm );
if( HB_ISLOG( 2 ) && hb_parl( 2 ) )
if( hb_parl( 2 ) )
Result = ( LONG ) tm.tmHeight;
else
Result = ( LONG ) tm.tmAveCharWidth;

View File

@@ -422,7 +422,7 @@ HB_FUNC( PRINTERPORTTONAME )
if( HB_ISCHAR( 1 ) && hb_parclen( 1 ) > 0 &&
hb_GetPrinterNameByPort( szDefaultPrinter, &pdwBufferSize, hb_parcx( 1 ),
HB_ISLOG( 2 ) ? hb_parl( 2 ) : FALSE ) )
hb_parl( 2 ) ) )
hb_retc( szDefaultPrinter );
else
hb_retc_null();
@@ -531,7 +531,7 @@ HB_FUNC( GETPRINTERS )
if( HB_ISLOG( 1 ) )
bPrinterNamesOnly = ! hb_parl( 1 );
bLocalPrintersOnly = HB_ISLOG( 2 ) ? hb_parl( 2 ) : FALSE;
bLocalPrintersOnly = hb_parl( 2 );
if( hb_iswinnt() )
{

View File

@@ -2176,13 +2176,13 @@ HB_FUNC( ADSCREATEFTSINDEX )
( UNSIGNED32 ) HB_ISNUM( 4 ) ? hb_parnl( 4 ) : ADS_DEFAULT /* ulPageSize */ ,
( UNSIGNED32 ) HB_ISNUM( 5 ) ? hb_parnl( 5 ) : 3 /* ulMinWordLen */ ,
( UNSIGNED32 ) HB_ISNUM( 6 ) ? hb_parnl( 6 ) : 30 /* ulMaxWordLen */ ,
HB_ISLOG( 7 ) ? ( UNSIGNED16 ) hb_parl( 7 ) : TRUE /* usUseDefaultDelim */ ,
( UNSIGNED16 ) hb_parldef( 7, 1 ) /* usUseDefaultDelim */ ,
( UNSIGNED8 * ) hb_parc( 8 ) /* pucDelimiters */ ,
HB_ISLOG( 9 ) ? ( UNSIGNED16 ) hb_parl( 9 ) : TRUE /* usUseDefaultNoise */ ,
( UNSIGNED16 ) hb_parldef( 9, 1 ) /* usUseDefaultNoise */ ,
( UNSIGNED8 * ) hb_parc( 10 ) /* pucNoiseWords */ ,
HB_ISLOG( 11 ) ? ( UNSIGNED16 ) hb_parl( 11 ) : TRUE /* usUseDefaultDrop */ ,
( UNSIGNED16 ) hb_parldef( 11, 1 ) /* usUseDefaultDrop */ ,
( UNSIGNED8 * ) hb_parc( 12 ) /* pucDropChars */ ,
HB_ISLOG( 13 ) ? ( UNSIGNED16 ) hb_parl( 13 ) : TRUE /* usUseDefaultConditionals */ ,
( UNSIGNED16 ) hb_parldef( 13, 1 ) /* usUseDefaultConditionals */ ,
( UNSIGNED8 * ) hb_parc( 14 ) /* pucConditionalChars */ ,
( UNSIGNED8 * ) hb_parc( 15 ) /* pucReserved1 */ ,
( UNSIGNED8 * ) hb_parc( 16 ) /* pucReserved2 */ ,

View File

@@ -451,7 +451,7 @@ HB_FUNC( HB_BACKGROUNDACTIVE )
if( s_pBackgroundTasks && HB_ISNUM( 1 ) )
{
/* TODO: access to pointers from harbour code */
bOldActive = hb_backgroundActive( hb_parnl( 1 ), HB_ISLOG( 2 ) ? hb_parl( 2 ) : TRUE );
bOldActive = hb_backgroundActive( hb_parnl( 1 ), hb_parldef( 2, 1 ) );
}
hb_retl( bOldActive ); /* return old active value */

View File

@@ -68,7 +68,7 @@ HB_FUNC( XHB_RTRIM )
const char * szText = hb_itemGetCPtr( pText );
ulSrc = hb_itemGetCLen( pText );
ulLen = hb_strRTrimLen( szText, ulSrc, HB_ISLOG( 2 ) && hb_parl( 2 ) );
ulLen = hb_strRTrimLen( szText, ulSrc, hb_parl( 2 ) );
if( ulLen == ulSrc )
hb_itemReturn( pText );
@@ -100,7 +100,7 @@ HB_FUNC( XHB_ALLTRIM )
const char * szText = hb_itemGetCPtr( pText );
ulSrc = hb_itemGetCLen( pText );
ulLen = hb_strRTrimLen( szText, ulSrc, HB_ISLOG( 2 ) && hb_parl( 2 ) );
ulLen = hb_strRTrimLen( szText, ulSrc, hb_parl( 2 ) );
szText = hb_strLTrim( szText, &ulLen );
if( ulLen == ulSrc )

View File

@@ -632,6 +632,7 @@ extern HB_EXPORT long hb_pardl( int iParam ); /* retrieve a date as a lo
extern HB_EXPORT double hb_partd( int iParam ); /* retrieve a timestamp as a double number */
extern HB_EXPORT BOOL hb_partdt( long * plJulian, long * plMilliSec , int iParam ); /* retrieve a timestamp as two long numbers */
extern HB_EXPORT int hb_parl( int iParam ); /* retrieve a logical parameter as an int */
extern HB_EXPORT int hb_parldef( int iParam, int iDefValue ); /* retrieve a logical parameter as an int, return default value if parameter isn't logical */
extern HB_EXPORT double hb_parnd( int iParam ); /* retrieve a numeric parameter as a double */
extern HB_EXPORT int hb_parni( int iParam ); /* retrieve a numeric parameter as a integer */
extern HB_EXPORT int hb_parnidef( int iParam, int iDefValue ); /* retrieve a numeric parameter as a integer, return default value if parameter isn't numeric */

View File

@@ -280,7 +280,7 @@ HB_FUNC( DBAPPEND )
if( pArea )
{
BOOL bUnLockAll = HB_ISLOG( 1 ) ? hb_parl( 1 ) : TRUE;
BOOL bUnLockAll = hb_parldef( 1, 1 );
HB_ERRCODE errCode;
/* Clipper clears NETERR flag before APPEND */
@@ -740,7 +740,7 @@ HB_FUNC( DBSEEK )
{
PHB_ITEM pKey = hb_param( 1, HB_IT_ANY );
BOOL bSoftSeek = HB_ISLOG( 2 ) ? ( BOOL ) hb_parl( 2 ) : hb_setGetSoftSeek();
BOOL bFindLast = HB_ISLOG( 3 ) ? hb_parl( 3 ) : FALSE, fFound = FALSE;
BOOL bFindLast = hb_parl( 3 ), fFound = FALSE;
if( SELF_SEEK( pArea, bSoftSeek, pKey, bFindLast ) == HB_SUCCESS )
{
if( SELF_FOUND( pArea, &fFound ) != HB_SUCCESS )
@@ -1195,7 +1195,7 @@ HB_FUNC( ORDCONDSET )
pItem = hb_param( 2, HB_IT_BLOCK );
lpdbOrdCondInfo->itmCobFor = pItem ? hb_itemNew( pItem ) : NULL;
lpdbOrdCondInfo->fAll = ! HB_ISLOG( 3 ) || hb_parl( 3 );
lpdbOrdCondInfo->fAll = hb_parldef( 3, 1 );
lpdbOrdCondInfo->abWhile = hb_parclen( 17 ) > 0 ?
hb_strdup( hb_parc( 17 ) ) : NULL;

View File

@@ -159,7 +159,7 @@ HB_FUNC( ORDFINDREC )
memset( &pOrderInfo, 0, sizeof( DBORDERINFO ) );
pOrderInfo.itmNewVal = hb_param( 1 , HB_IT_NUMERIC );
pOrderInfo.itmResult = hb_itemPutL( NULL, FALSE );
SELF_ORDINFO( pArea, HB_ISLOG( 2 ) && hb_parl( 2 ) ? DBOI_FINDRECCONT :
SELF_ORDINFO( pArea, hb_parl( 2 ) ? DBOI_FINDRECCONT :
DBOI_FINDREC, &pOrderInfo );
hb_itemReturnRelease( pOrderInfo.itmResult );
}

View File

@@ -108,8 +108,8 @@ HB_FUNC( HB_DBREQUEST )
if( HB_ISNIL( 1 ) || HB_ISCHAR( 1 ) )
{
szAlias = hb_parc( 1 );
fNewArea = HB_ISLOG( 2 ) && hb_parl( 2 );
fWait = HB_ISLOG( 4 ) && hb_parl( 4 );
fNewArea = hb_parl( 2 );
fWait = hb_parl( 4 );
pCargo = HB_ISBYREF( 3 ) ? hb_itemNew( NULL ) : NULL;
pArea = hb_rddRequestArea( szAlias, pCargo, fNewArea, fWait );

View File

@@ -355,10 +355,10 @@ HB_FUNC( __DBSQL )
PHB_ITEM pWhile = hb_param( 6, HB_IT_BLOCK );
PHB_ITEM pNext = hb_param( 7, HB_IT_NUMERIC );
PHB_ITEM pRecord = HB_ISNIL( 8 ) ? NULL : hb_param( 8, HB_IT_ANY );
BOOL fRest = pWhile != NULL || ( HB_ISLOG( 9 ) && hb_parl( 9 ) );
BOOL fAppend = HB_ISLOG( 10 ) && hb_parl( 10 );
BOOL fInsert = HB_ISLOG( 11 ) && hb_parl( 11 );
BOOL fRecno = HB_ISLOG( 12 ) && hb_parl( 12 );
BOOL fRest = pWhile != NULL || hb_parl( 9 );
BOOL fAppend = hb_parl( 10 );
BOOL fInsert = hb_parl( 11 );
BOOL fRecno = hb_parl( 12 );
const char * szSep = hb_parcx( 13 );
const char * szDelim = hb_parcx( 14 );
const char * szEsc = hb_parcx( 15 );

View File

@@ -71,9 +71,9 @@ HB_FUNC( SX_FNAMEPARSER )
if( pszFree )
hb_xfree( pszFree );
if( ! HB_ISLOG( 2 ) || ! hb_parl( 2 ) )
if( !hb_parl( 2 ) )
pFileName->szPath = NULL;
if( ! HB_ISLOG( 3 ) || ! hb_parl( 3 ) )
if( !hb_parl( 3 ) )
pFileName->szExtension = NULL;
if( !hb_setGetTrimFileName() )

View File

@@ -652,7 +652,7 @@ HB_FUNC( SX_SEEKLAST )
if( pArea && hb_pcount() > 0 )
{
PHB_ITEM pKey = hb_param( 1, HB_IT_ANY );
BOOL bSoftSeek = HB_ISLOG( 2 ) && hb_parl( 2 );
BOOL bSoftSeek = hb_parl( 2 );
if( SELF_SEEK( pArea, bSoftSeek, pKey, TRUE ) == HB_SUCCESS )
{
@@ -683,7 +683,7 @@ HB_FUNC( SX_WILDSEEK )
{
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
const char * szPattern = hb_parc( 1 );
BOOL fCont = HB_ISLOG( 2 ) && hb_parl( 2 );
BOOL fCont = hb_parl( 2 );
BOOL fFound = FALSE;
int iOrder = 0;

View File

@@ -424,7 +424,7 @@ HB_FUNC( HB_TSTOSTR )
char szBuffer[ 24 ];
hb_timeStampStr( szBuffer, lDate, lTime );
if( HB_ISLOG( 2 ) && hb_parl( 2 ) )
if( hb_parl( 2 ) )
{
if( lTime == 0 )
{

View File

@@ -3375,5 +3375,5 @@ static BOOL hb_fsDisableWaitLocks( int iSet )
HB_FUNC( HB_DISABLEWAITLOCKS )
{
hb_retl( hb_fsDisableWaitLocks( HB_ISLOG( 1 ) ? ( hb_parl( 1 ) ? 1 : 0 ) : -1 ) );
hb_retl( hb_fsDisableWaitLocks( hb_parldef( 1, -1 ) ) );
}

View File

@@ -145,5 +145,5 @@ HB_FOFFSET hb_fsFSize( const char * pszFileName, BOOL bUseDirEntry )
HB_FUNC( HB_FSIZE )
{
const char * pszFile = hb_parc( 1 );
hb_retnint( pszFile ? hb_fsFSize( pszFile, HB_ISLOG( 2 ) ? hb_parl( 2 ) : TRUE ) : 0 );
hb_retnint( pszFile ? hb_fsFSize( pszFile, hb_parldef( 2, 1 ) ) : 0 );
}

View File

@@ -166,7 +166,7 @@ HB_FUNC( HB_GETENV )
szValue = hb_getenv( pszName );
if( szValue && szValue[ 0 ] != '\0' )
{
if( ! HB_ISLOG( 3 ) || hb_parl( 3 ) )
if( hb_parldef( 3, 1 ) )
szValue = ( char * ) hb_osDecodeCP( szValue, NULL, NULL );
hb_retc_buffer( szValue );
}
@@ -196,7 +196,7 @@ HB_FUNC( HB_SETENV )
const char * pszValue = hb_parc( 2 );
char * pszFreeName = NULL, * pszFreeVal = NULL;
if( ( ! HB_ISLOG( 3 ) || hb_parl( 3 ) ) )
if( hb_parldef( 3, 1 ) )
{
pszName = hb_osEncodeCP( pszName, &pszFreeName, NULL );
if( pszValue )

View File

@@ -908,8 +908,8 @@ HB_FUNC( HB_I18N_CODEPAGE )
if( pI18N )
hb_retc( hb_i18n_setcodepage( pI18N, hb_parc( iParam ),
HB_ISLOG( iParam + 1 ) && hb_parl( iParam + 1 ),
HB_ISLOG( iParam + 2 ) && hb_parl( iParam + 2 ) ) );
hb_parl( iParam + 1 ),
hb_parl( iParam + 2 ) ) );
else
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
@@ -925,7 +925,7 @@ HB_FUNC( HB_I18N_PLURALFORM )
{
PHB_ITEM pOldForm = hb_itemNew( NULL );
PHB_ITEM pForm = hb_param( iParam, HB_IT_STRING | HB_IT_BLOCK );
BOOL fBase = HB_ISLOG( iParam + 1 ) && hb_parl( iParam + 1 );
BOOL fBase = hb_parl( iParam + 1 );
if( hb_i18n_getpluralform( pI18N, pOldForm, fBase ) )
hb_itemReturn( pOldForm );

View File

@@ -164,7 +164,7 @@ HB_FUNC( HB_REGEXCOMP )
int iFlags = HBREG_EXTENDED;
PHB_REGEX pRegEx;
if( HB_ISLOG( 2 ) && !hb_parl( 2 ) )
if( !hb_parldef( 2, 1 ) )
iFlags |= HBREG_ICASE;
if( hb_parl( 3 ) )
iFlags |= HBREG_NEWLINE;
@@ -201,7 +201,7 @@ HB_FUNC( HB_ATX )
pszString = hb_itemGetCPtr( pString );
ulLen = hb_itemGetCLen( pString );
pRegEx = hb_regexGet( hb_param( 1, HB_IT_ANY ),
HB_ISLOG( 3 ) && !hb_parl( 3 ) ? HBREG_ICASE : 0 );
!hb_parldef( 3, 1 ) ? HBREG_ICASE : 0 );
if( !pRegEx )
return;
@@ -258,7 +258,7 @@ static BOOL hb_regex( int iRequest )
return FALSE;
}
pRegEx = hb_regexGet( hb_param( 1, HB_IT_ANY ),
( HB_ISLOG( 3 ) && !hb_parl( 3 ) ? HBREG_ICASE : 0 ) |
( !hb_parldef( 3, 1 ) ? HBREG_ICASE : 0 ) |
( hb_parl( 4 ) ? HBREG_NEWLINE : 0 ) );
if( !pRegEx )
return FALSE;
@@ -361,7 +361,7 @@ static BOOL hb_regex( int iRequest )
PHB_ITEM pAtxArray;
int iMax = hb_parni( 5 ); /* max nuber of matches I want, 0 = unlimited */
int iGetMatch = hb_parni( 6 ); /* Gets if want only one single match or a sub-match */
BOOL fOnlyMatch = ! HB_ISLOG( 7 ) || hb_parl( 7 ); /* if TRUE returns only matches and sub-matches, not positions */
BOOL fOnlyMatch = hb_parldef( 7, 1 ); /* if TRUE returns only matches and sub-matches, not positions */
ULONG ulOffSet = 0;
int iCount = 0;
int iSO, iEO;

View File

@@ -217,10 +217,10 @@ static BOOL hb_tokenParam( int iParam, ULONG ulSkip,
while( ulLen && szLine[ ulLen - 1 ] == szDelim[ 0 ] )
--ulLen;
}
if( HB_ISLOG( iParam + 1 ) && hb_parl( iParam + 1 ) )
if( hb_parl( iParam + 1 ) )
{
iFlags |= _HB_TOK_RESPECT_DQUOTE | _HB_TOK_RESPECT_SQUOTE;
if( HB_ISLOG( iParam + 2 ) && hb_parl( iParam + 2 ) )
if( hb_parl( iParam + 2 ) )
iFlags &= ~_HB_TOK_RESPECT_SQUOTE;
}
}

View File

@@ -1305,8 +1305,7 @@ HB_FUNC( HB_SERIALIZE )
cdpIn = pszCdpIn ? hb_cdpFindExt( pszCdpIn ) : hb_vmCDP();
cdpOut = pszCdpOut ? hb_cdpFindExt( pszCdpOut ) : hb_vmCDP();
pBuffer = hb_itemSerializeCP( pItem, HB_ISLOG( 2 ) && hb_parl( 2 ),
cdpIn, cdpOut, &ulSize );
pBuffer = hb_itemSerializeCP( pItem, hb_parl( 2 ), cdpIn, cdpOut, &ulSize );
hb_retclen_buffer( pBuffer, ulSize );
}
}

View File

@@ -79,7 +79,7 @@ HB_FUNC( MAXROW ) /* Return the maximum screen/window row number (zero origin) *
* in CT3, [druzus]
*/
if( HB_ISLOG( 1 ) && hb_parl( 1 ) )
if( hb_parl( 1 ) )
{
int iRows, iCols;
hb_gtScrDim( &iRows, &iCols );
@@ -94,7 +94,7 @@ HB_FUNC( MAXCOL ) /* Return the maximum screen/window column number (zero origin
{
#ifdef HB_COMPAT_CT3
/* See notes about MaxRow(.T.) above */
if( HB_ISLOG( 1 ) && hb_parl( 1 ) )
if( hb_parl( 1 ) )
{
int iRows, iCols;
hb_gtScrDim( &iRows, &iCols );

View File

@@ -233,7 +233,7 @@ static const char * hb_mlGetParams( int iParAdd, ULONG * pulLen,
* pulLineLength = 79;
* pulLen = hb_parclen( 1 );
* pulTabSize = HB_ISNUM( 3 + iParAdd ) ? hb_parnl( 3 + iParAdd ) : 4;
* pfWordWrap = HB_ISLOG( 4 + iParAdd ) ? hb_parl( 4 + iParAdd ) : TRUE;
* pfWordWrap = hb_parldef( 4 + iParAdd, 1 );
* pEOLs = hb_mlGetEOLs( 5 + iParAdd, piEOLs );
#ifdef HB_CLP_STRICT
if( * pulLineLength > 254 )

View File

@@ -85,7 +85,7 @@ HB_FUNC( MSETCURSOR )
HB_FUNC( MROW )
{
if( HB_ISLOG( 1 ) && hb_parl( 1 ) )
if( hb_parl( 1 ) )
{
int iRow, iCol;
@@ -98,7 +98,7 @@ HB_FUNC( MROW )
HB_FUNC( MCOL )
{
if( HB_ISLOG( 1 ) && hb_parl( 1 ) )
if( hb_parl( 1 ) )
{
int iRow, iCol;

View File

@@ -93,7 +93,7 @@ HB_FUNC( HB_STRCDECODE )
if( pText )
{
ULONG ulLen = hb_itemGetCLen( pText );
BOOL fCont = HB_ISLOG( 2 ) && hb_parl( 2 );
BOOL fCont = hb_parl( 2 );
if( ulLen > 0 )
{
const char * pszSrc = hb_itemGetCPtr( pText );

View File

@@ -90,7 +90,7 @@ HB_FUNC( HB_STRTOEXP )
break;
}
}
if( iType == 7 || ( HB_ISLOG( 2 ) && hb_parl( 2 ) ) )
if( iType == 7 || hb_parl( 2 ) )
{
ulRet = ulLen + 3 + uQ;
pDst = pszResult = ( char * ) hb_xgrab( ulRet + 1 );

View File

@@ -318,7 +318,7 @@ HB_FUNC( HB_AINS )
if( lPos == 0 )
lPos = 1;
if( HB_ISLOG( 4 ) && hb_parl( 4 ) )
if( hb_parl( 4 ) )
{
ULONG ulLen = hb_arrayLen( pArray ) + 1;
if( lPos >= 1 && ( ULONG ) lPos <= ulLen )
@@ -348,7 +348,7 @@ HB_FUNC( HB_ADEL )
if( hb_arrayDel( pArray, lPos ) )
{
if( HB_ISLOG( 3 ) && hb_parl( 3 ) )
if( hb_parl( 3 ) )
hb_arraySize( pArray, hb_arrayLen( pArray ) - 1 );
}

View File

@@ -4243,9 +4243,9 @@ HB_FUNC_STATIC( msgClassSel )
USHORT nParam, nScope;
BOOL lFull;
nParam = hb_pcount() > 0 ? ( USHORT ) hb_parni( 1 ) : HB_MSGLISTALL;
nScope = hb_pcount() > 1 ? ( USHORT ) hb_parni( 2 ) : 0;
lFull = hb_pcount() > 2 && HB_ISLOG( 3 ) && hb_parl( 3 );
nParam = hb_parnidef( 1, HB_MSGLISTALL );
nScope = ( USHORT ) hb_parni( 2 );
lFull = hb_parl( 3 );
pReturn = hb_itemArrayNew( pClass->uiMethods );
do
@@ -4867,7 +4867,7 @@ HB_FUNC( __CLSGETPROPERTIES )
ULONG ulLimit, ulCount;
USHORT uiScope = HB_OO_CLSTP_PERSIST;
if( HB_ISLOG( 2 ) && hb_parl( 2 ) )
if( hb_parl( 2 ) )
uiScope |= HB_OO_CLSTP_EXPORTED;
ulCount = 0;

View File

@@ -431,6 +431,26 @@ int hb_parl( int iParam )
return 0;
}
int hb_parldef( int iParam, int iDefValue )
{
HB_STACK_TLS_PRELOAD
HB_TRACE(HB_TR_DEBUG, ("hb_parldef(%d,%d)", iParam, iDefValue));
if( iParam >= -1 && iParam <= hb_pcount() )
{
PHB_ITEM pItem = ( iParam == -1 ) ? hb_stackReturnItem() : hb_stackItemFromBase( iParam );
if( HB_IS_BYREF( pItem ) )
pItem = hb_itemUnRef( pItem );
if( HB_IS_LOGICAL( pItem ) )
return pItem->item.asLogical.value ? 1 : 0;
}
return iDefValue;
}
double hb_parnd( int iParam )
{
HB_STACK_TLS_PRELOAD

View File

@@ -1600,7 +1600,7 @@ HB_FUNC( __MVRESTORE )
bIncludeMask = TRUE;
#else
pszMask = hb_memvarGetMask( 3 );
bIncludeMask = ! HB_ISLOG( 4 ) || hb_parl( 4 );
bIncludeMask = hb_parldef( 4, 1 );
#endif
while( hb_fsRead( fhnd, buffer, HB_MEM_REC_LEN ) == HB_MEM_REC_LEN )

View File

@@ -1354,7 +1354,7 @@ HB_FUNC( HB_THREADWAIT )
#if defined( HB_MT_VM )
# define HB_THREAD_WAIT_ALLOC 16
HB_STACK_TLS_PRELOAD
BOOL fAll = FALSE;
BOOL fAll;
ULONG ulMilliSec = HB_THREAD_INFINITE_WAIT;
PHB_THREADSTATE * pThreads, pAlloc[ HB_THREAD_WAIT_ALLOC ];
int iThreads = -1;
@@ -1397,8 +1397,7 @@ HB_FUNC( HB_THREADWAIT )
ulMilliSec = dTimeOut > 0 ? ( ULONG ) ( dTimeOut * 1000 ) : 0;
}
if( HB_ISLOG( 3 ) )
fAll = hb_parl( 3 );
fAll = hb_parl( 3 );
hb_retni( hb_threadWait( pThreads, iThreads, fAll, ulMilliSec ) );
}