hbclipsm

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  
c:\harbour\contrib\hbclipsm
date.c
TypeFunctionSourceLine
HB_FUNCMDY(void)
HB_FUNC( MDY )
{
   int iYear, iMonth, iDay;
   char szDate[ 9 ];
   char szFormatted[ 11 ];
   char * szReturn;
   int iBufferLen;
   int iYearLen;
   int iLen;

   hb_dateDecode( hb_parnl( 1 ), &iYear, &iMonth, &iDay );
   hb_dateFormat( hb_pardsbuff( szDate, 1 ), szFormatted, "MM/DD/YYYY" );

   iLen = strlen( hb_dateCMonth( iMonth ) );
   iYearLen = hb_setGetCentury() ? 4 : 2;

   iBufferLen = iLen + 5 + iYearLen;
   szReturn = ( char * ) hb_xgrab( iBufferLen + 1 );

   memset( szReturn, ' ', iBufferLen );
   memcpy( szReturn, hb_dateCMonth( iMonth ), iLen );
   memcpy( szReturn + iLen + 1, szFormatted + 3, 2 );
   szReturn[ iLen + 3 ] = ',';
   memcpy( szReturn + iLen + 5, szFormatted + 10 - iYearLen, iYearLen );

   hb_retclen_buffer( szReturn, iBufferLen );
}
date.c58
HB_FUNCDMY(void)
HB_FUNC( DMY )
{
   int iYear, iMonth, iDay;
   char szDate[ 9 ];
   char szFormatted[ 11 ];
   char * szReturn;
   int iBufferLen;
   int iYearLen;
   int iLen;

   hb_dateDecode( hb_parnl( 1 ), &iYear, &iMonth, &iDay );
   hb_dateFormat( hb_pardsbuff( szDate, 1 ), szFormatted, "MM/DD/YYYY" );

   iLen = strlen( hb_dateCMonth( iMonth ) );
   iYearLen = hb_setGetCentury() ? 4 : 2;

   iBufferLen = iLen + 4 + iYearLen;
   szReturn = ( char * ) hb_xgrab( iBufferLen + 1 );

   memset( szReturn, ' ', iBufferLen );
   memcpy( szReturn, szFormatted + 3, 2 );
   memcpy( szReturn + 3, hb_dateCMonth( iMonth ), iLen );
   memcpy( szReturn + iLen + 4, szFormatted + 10 - iYearLen, iYearLen );

   hb_retclen_buffer( szReturn, iBufferLen );
}
date.c88
HB_FUNCDATEASAGE(void)
HB_FUNC( DATEASAGE )
{
   int iAge = 0;
   PHB_ITEM pDate = hb_param( 1, HB_IT_DATE );

   if( pDate )
   {
      int iYear, iMonth, iDay;
      int iThisYear, iThisMonth, iThisDay;

      hb_dateToday( &iThisYear, &iThisMonth, &iThisDay );
      hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );
      
      if( iThisYear > iYear )
      {
         iAge = iThisYear - iYear;
      
         if( iThisMonth < iMonth || ( iThisMonth == iMonth && iThisDay < iDay ) )
            --iAge;
      }
   }

   hb_retni( iAge );
}
date.c117
HB_FUNCADDMONTH(void)
HB_FUNC( ADDMONTH )
{
   int iMonths = hb_parnl( 2 );
   int iYear, iMonth, iDay;

   int iLimit, iMonthAdd, iYearAdd;
   long lNew;

   hb_dateDecode( hb_parnl( 1 ), &iYear, &iMonth, &iDay );

   iLimit = 12 - iMonth + 1;
   iYearAdd = iMonths / 12;
   iMonths %= 12;

   if( iMonths >= iLimit )
      iYearAdd++;

   iYear += iYearAdd;

   iMonthAdd = iMonths % 12;
   iMonth    = ( iMonth + iMonthAdd ) % 12;

   if( iMonth == 0 )
      iMonth = 12;

   lNew = hb_dateEncode( iYear, iMonth, iDay );

   if( !lNew )
   {
      iMonth = ( iMonth + 1 ) % 12;
      iDay = 1;
      iYear = iYear + ( ( iMonth + 1 ) / 12 );
   }

   hb_retd( iYear, iMonth, iDay );
}
date.c144
HB_FUNCDATEASARRAY(void)
HB_FUNC( DATEASARRAY )
{
   PHB_ITEM pReturn = hb_itemArrayNew( 3 );     /* Create array */
   PHB_ITEM pDate = hb_param( 1, HB_IT_DATE );

   if( pDate )
   {
      PHB_ITEM pItem;
      int iYear, iMonth, iDay;

      hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );

      pItem = hb_itemPutNI( NULL, iYear );
      hb_itemArrayPut( pReturn, 1, pItem );
      hb_itemRelease( pItem );

      pItem = hb_itemPutNI( NULL, iMonth );
      hb_itemArrayPut( pReturn, 2, pItem );
      hb_itemRelease( pItem );

      pItem = hb_itemPutNI( NULL, iDay );
      hb_itemArrayPut( pReturn, 3, pItem );
      hb_itemRelease( pItem );
   }

   hb_itemReturn( pReturn );
   hb_itemRelease( pReturn );
}
date.c184
HB_FUNCARRAYASDATE(void)
HB_FUNC( ARRAYASDATE )
{
   PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );

   if( pArray )
      hb_retd( hb_arrayGetNI( pArray, 1 ), hb_arrayGetNI( pArray, 2 ), hb_arrayGetNI( pArray, 3 ) );
   else
      hb_retdl( 0 );
}
date.c216
HB_FUNCDATEISLEAP(void)
HB_FUNC( DATEISLEAP )
{
   PHB_ITEM pDate = hb_param( 1, HB_IT_DATE );

   if( pDate )
   {
      int iYear, iMonth, iDay;

      hb_dateDecode( hb_itemGetDL( pDate ), &iYear, &iMonth, &iDay );

      hb_retl( ( iYear % 4 == 0 && iYear % 100 != 0 ) || ( iYear % 400 == 0 ) );
   }
   else
      hb_retl( FALSE );
}
date.c228
HB_FUNCNTOD(void)
HB_FUNC( NTOD )
{
   hb_retd( hb_parni( 3 ), hb_parni( 1 ), hb_parni( 2 ) );
}
date.c246
environ.c
TypeFunctionSourceLine
HB_FUNCFILEPATH(void)
HB_FUNC( FILEPATH )
{
   if( ISCHAR( 1 ) )
   {
      PHB_FNAME pFileName = hb_fsFNameSplit( hb_parc( 1 ) );
      hb_retc( pFileName->szPath );
      hb_xfree( pFileName );
   }
   else
      hb_retc( NULL );
}
environ.c56
HB_FUNCFILEBASE(void)
HB_FUNC( FILEBASE )
{
   if( ISCHAR( 1 ) )
   {
      PHB_FNAME pFileName = hb_fsFNameSplit( hb_parc( 1 ) );
      hb_retc( pFileName->szName );
      hb_xfree( pFileName );
   }
   else
      hb_retc( NULL );
}
environ.c72
HB_FUNCFILEEXT(void)
HB_FUNC( FILEEXT )
{
   if( ISCHAR( 1 ) )
   {
      PHB_FNAME pFileName = hb_fsFNameSplit( hb_parc( 1 ) );
      if( pFileName->szExtension != NULL )
         hb_retc( ( pFileName->szExtension ) + 1 ); /* Skip the dot */
      else
         hb_retc( NULL );
      hb_xfree( pFileName );
   }
   else
      hb_retc( NULL );
}
environ.c86
HB_FUNCFILEDRIVE(void)
HB_FUNC( FILEDRIVE )
{
   if( ISCHAR( 1 ) )
   {
      PHB_FNAME pFileName = hb_fsFNameSplit( hb_parc( 1 ) );
      hb_retclen( pFileName->szDrive, 1 ); /* Only the drive letter */
      hb_xfree( pFileName );
   }
   else
      hb_retc( NULL );
}
environ.c103
gauge.c
TypeFunctionSourceLine
STATIC VOIDhb_gaugeUpdate( PHB_ITEM pArray, float fPercent )
static void hb_gaugeUpdate( PHB_ITEM pArray, float fPercent )
{
   SHORT iCenter = ( SHORT ) ( ( ( hb_arrayGetNI( pArray, B_RIGHT ) - hb_arrayGetNI( pArray, B_LEFT ) ) / 2 ) + 1 );
   SHORT iRatio = ( SHORT ) ( hb_arrayGetNI( pArray, B_RIGHT ) - hb_arrayGetNI( pArray, B_LEFT ) - 1 );
   SHORT iRow;
   SHORT iCols;
   SHORT iMax;
   char szOldColor[ HB_CLRSTR_LEN ];
   const char * szStr = "        ";
   char szPct[ 5 ];

   hb_gtGetColorStr( szOldColor );
   hb_gtSetColorStr( hb_arrayGetCPtr( pArray, B_BARCOLOR ) );

   fPercent = ( fPercent < 0 ? 0 : ( fPercent > 1 ? 1 : fPercent ) );
   iCols    = ( SHORT ) ( fPercent * iRatio );

   if( hb_arrayGetL( pArray, B_DISPLAYNUM ) )
   {
      snprintf( szPct, sizeof( szPct ), "%3.0f%%", fPercent * 100 );
      hb_gtWriteAt( ( SHORT ) hb_arrayGetNI( pArray, B_TOP ),
                    iCenter + 2,
                    ( BYTE * ) szPct, 4 );
   }

   hb_gtBox( ( SHORT ) hb_arrayGetNI( pArray, B_TOP ) + 1,
             ( SHORT ) hb_arrayGetNI( pArray, B_LEFT ) + 1,
             ( SHORT ) hb_arrayGetNI( pArray, B_BOTTOM ) - 1,
             ( SHORT ) hb_arrayGetNI( pArray, B_RIGHT ) - 1,
             ( BYTE * ) szStr );

   iMax = ( SHORT ) ( hb_arrayGetNI( pArray, B_BOTTOM ) - hb_arrayGetNI( pArray, B_TOP ) - 1 );
   for( iRow = 1; iRow <= iMax; iRow++ )
   {
      hb_gtRepChar( ( SHORT ) ( hb_arrayGetNI( pArray, B_TOP ) + iRow ),
                    ( SHORT ) ( hb_arrayGetNI( pArray, B_LEFT ) + 1 ),
                    ( BYTE ) * hb_arrayGetCPtr( pArray, B_BARCHAR ),
                    iCols );
   }

   hb_gtSetColorStr( szOldColor );
}
gauge.c71
HB_FUNCGAUGENEW(void)
HB_FUNC( GAUGENEW )
{
   PHB_ITEM pReturn = hb_itemArrayNew( B_LEN );   /* Create array */

   hb_arraySetNL( pReturn, B_TOP, hb_parni( B_TOP ) );
   hb_arraySetNL( pReturn, B_LEFT, hb_parni( B_LEFT ) );
   hb_arraySetNL( pReturn, B_BOTTOM,
              ISNUM( B_BOTTOM ) ?
               ( hb_parni( B_BOTTOM ) < hb_parni( B_TOP ) + 2 ?
                   hb_parni( B_TOP ) + 2 : hb_parni( B_BOTTOM ) ) : 0 );
   hb_arraySetNL( pReturn, B_RIGHT,
              ISNUM( B_RIGHT ) ?
               ( hb_parni( B_RIGHT ) < hb_parni( B_LEFT ) + 4 ?
                  hb_parni( B_LEFT ) + 4 : hb_parni( B_RIGHT ) ) : 0 );
   hb_arraySetC( pReturn, B_BACKCOLOR, ISCHAR( B_BACKCOLOR ) ? hb_parc( B_BACKCOLOR ) : "W/N" );
   hb_arraySetC( pReturn, B_BARCOLOR, ISCHAR( B_BARCOLOR ) ? hb_parc( B_BARCOLOR ) : "W+/N" );
   hb_arraySetL( pReturn, B_DISPLAYNUM, 
              !( ISNUM( B_RIGHT ) && 
                 ISNUM( B_LEFT ) && 
                 ( hb_parni( B_RIGHT ) < hb_parni( B_LEFT ) + 9 ) ) );
   hb_arraySetC( pReturn, B_BARCHAR, ISCHAR( B_BARCHAR ) ? hb_parc( B_BARCHAR ) : "\xdb" );
   hb_arraySetNL( pReturn, B_PERCENT, 0 );

   hb_itemReturnRelease( pReturn );
}
gauge.c114
HB_FUNCGAUGEDISPLAY(void)
HB_FUNC( GAUGEDISPLAY )
{
   PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );

   if( pArray )
   {
      SHORT iCenter = ( SHORT ) ( ( ( hb_arrayGetNI( pArray, B_RIGHT ) - hb_arrayGetNI( pArray, B_LEFT ) ) / 2 ) + 1 );
      char szOldColor[ HB_CLRSTR_LEN ];
      const char * szStr = "        ";

      hb_gtGetColorStr( szOldColor );
      hb_gtSetColorStr( hb_arrayGetCPtr( pArray, B_BACKCOLOR ) );

      hb_gtBox( ( SHORT) hb_arrayGetNI( pArray, B_TOP ),
                ( SHORT) hb_arrayGetNI( pArray, B_LEFT ),
                ( SHORT) hb_arrayGetNI( pArray, B_BOTTOM ),
                ( SHORT) hb_arrayGetNI( pArray, B_RIGHT ),
                ( BYTE * ) szStr );

      hb_gtBox( ( SHORT ) hb_arrayGetNI( pArray, B_TOP ),
                ( SHORT ) hb_arrayGetNI( pArray, B_LEFT ),
                ( SHORT ) hb_arrayGetNI( pArray, B_BOTTOM ),
                ( SHORT ) hb_arrayGetNI( pArray, B_RIGHT ),
                ( BYTE * ) B_BOXLINES );

      if( hb_arrayGetL( pArray, B_DISPLAYNUM ) )
         hb_gtWriteAt( ( SHORT ) hb_arrayGetNI( pArray, B_TOP ),
                       iCenter,
                       ( BYTE * ) "[      ]", 8 );

      hb_gtSetColorStr( szOldColor );

      hb_gaugeUpdate( pArray, ( float ) hb_arrayGetND( pArray, B_PERCENT ) );

      hb_itemReturn( pArray );
   }
}
gauge.c145
HB_FUNCGAUGEUPDATE(void)
HB_FUNC( GAUGEUPDATE )
{
   PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );

   if( pArray )
   {
      hb_gaugeUpdate( pArray, ISNUM( 2 ) ? ( float ) hb_parnd( 2 ) : 0 );

      hb_itemReturn( pArray );
   }
}
gauge.c185
num.c
TypeFunctionSourceLine
HB_FUNCDTOR(void)
HB_FUNC( DTOR )
{
   hb_retndlen( ( hb_parnd( 1 ) / 180 ) * PI, 10, 9 );
}
num.c64
HB_FUNCNUMASLOG10(void)
HB_FUNC( NUMASLOG10 )
{
   if( ISNUM( 1 ) )
   {
      hb_retnd( log10( hb_parnd(1) ) );
   }
}
num.c72
HB_FUNCNUMGETDECIMALS(void)
HB_FUNC( NUMGETDECIMALS )
{
   int iDec = 0;

   if( ISNUM( 1 ) )
   {
      hb_itemGetNLen( hb_param( 1, HB_IT_NUMERIC ), NULL, &iDec );
   }

   hb_retnl( iDec );
}
num.c83
HB_FUNCNUMGETLEN(void)
HB_FUNC( NUMGETLEN )
{
   ULONG ulLen = 0;

   if( ISNUM( 1 ) )
   {
      char * szBuffer = hb_itemStr( hb_param( 1, HB_IT_NUMERIC ), NULL, NULL );
      char * ptr = szBuffer;

      while( HB_ISSPACE( *ptr ) )
         ptr++;

      if( !strchr( ptr, '.' ) )
      {
         while( *ptr )
         {
            ptr++;
            ulLen++;
         }
      }
      else
      {
         while( *ptr != '.' )
         {
            ptr++;
            ulLen++;
         }
      }

      if( szBuffer )
         hb_xfree( szBuffer );
   }

   hb_retnl( ulLen );
}
num.c98
HB_FUNCRTOD(void)
HB_FUNC( RTOD )
{
   hb_retnd( 180 * ( hb_parnd( 1 ) / PI ) );
}
num.c137
HB_FUNCSIGN(void)
HB_FUNC( SIGN )
{
   if( ISNUM( 1 ) )
   {
      long lNumber = hb_parnl( 1 );

      hb_retni( lNumber == 0 ? 0 : ( lNumber > 0 ? 1 : -1 ) );
   }
}
num.c145
HB_FUNCNUMASCURRENCY(void)
HB_FUNC( NUMASCURRENCY )
{
   char * szBuffer = hb_itemStr( hb_param( 1, HB_IT_NUMERIC ), NULL, NULL );
   long ulSymbolLen = hb_itemGetCLen( hb_param( 2, HB_IT_STRING ) );
   char * ptr = szBuffer;
   char * szCurrency;
   ULONG ulLen;

   ulLen = strlen( ptr );
   szCurrency = ( char * ) hb_xgrab( ulLen + ulSymbolLen ) ;

   if( hb_parni( 3 ) < 0 )
   {
      while( HB_ISSPACE( *ptr ) )
         ptr++;

      ulLen = strlen( ptr );

      memcpy( szCurrency, hb_parc( 2 ), ulSymbolLen );
      memcpy( szCurrency + ulSymbolLen, ptr, ulLen );
   }
   else
   {
      memcpy( szCurrency, ptr, ulLen );
      memcpy( szCurrency + ulLen, hb_parc( 2 ), ulSymbolLen );
   }

   if( szBuffer )
      hb_xfree( szBuffer );

   hb_retclen( szCurrency, ulLen + ulSymbolLen );
   hb_xfree( szCurrency );
}
num.c161
numceil.c
TypeFunctionSourceLine
HB_FUNCCEILING(void)
HB_FUNC( CEILING )
{
   hb_retnl( (long) ceil( hb_parnd( 1 ) ) );
}
numceil.c58
numfloor.c
TypeFunctionSourceLine
HB_FUNCFLOOR(void)
HB_FUNC( FLOOR )
{
   hb_retnl( (long) floor( hb_parnd( 1 ) ) );
}
numfloor.c58
stack.c
TypeFunctionSourceLine
HB_FUNCSTACKNEW(void)
HB_FUNC( STACKNEW )
{
   hb_itemReturnRelease( hb_itemArrayNew( 0 ) ); /* Create array */
}
stack.c56
HB_FUNCSTACKPUSH(void)
HB_FUNC( STACKPUSH )
{
   hb_arrayAdd( hb_param( 1, HB_IT_ARRAY ), 
                hb_param( 2, HB_IT_ANY ) );
}
stack.c63
HB_FUNCSTACKPOP(void)
HB_FUNC( STACKPOP )
{
   PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
   long ulLen = hb_arrayLen( pArray );
   PHB_ITEM pLast = hb_itemNew( NULL );

   if( ulLen )
   {
      hb_arrayLast( pArray, pLast );
      hb_arrayDel( pArray, ulLen );
      --ulLen;
      hb_arraySize( pArray, HB_MAX( ulLen, 0 ) );
   }

   hb_itemReturnRelease( pLast );
}
stack.c71
HB_FUNCSTACKISEMPTY(void)
HB_FUNC( STACKISEMPTY )
{
   hb_retl( hb_arrayLen( hb_param( 1, HB_IT_ARRAY ) ) == 0 );
}
stack.c91
HB_FUNCSTACKTOP(void)
HB_FUNC( STACKTOP )
{
   PHB_ITEM pLast = hb_itemNew( NULL );

   hb_arrayLast( hb_param( 1, HB_IT_ARRAY ), pLast );

   hb_itemReturnRelease( pLast );
}
stack.c98
status.c
TypeFunctionSourceLine
HB_FUNCSTATUSNEW(void)
HB_FUNC( STATUSNEW )
{
   PHB_ITEM pReturn = hb_itemArrayNew( ST_LEN );   /* Create array */

   hb_arraySetNL( pReturn, ST_ROW, hb_parni( ST_ROW ) );
   hb_arraySetNL( pReturn, ST_COL, hb_parni( ST_COL ) );
   hb_arraySetC( pReturn, ST_COLOR, ISCHAR( ST_COLOR ) ? hb_parc( ST_COLOR ) : "W+/N" );
   hb_arraySetNL( pReturn, ST_CURRENT, 1 );

   hb_itemReturnRelease( pReturn );
}
status.c66
HB_FUNCSTATUSUPDATE(void)
HB_FUNC( STATUSUPDATE )
{
   PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );

   if( pArray )
   {
      const char * szDisplay  = "|/-\\";
      long lCurrent = hb_arrayGetNL( pArray, ST_CURRENT );
      char * szOldColor[ HB_CLRSTR_LEN ];
      PHB_ITEM pCurrent = hb_itemNew( NULL );

      lCurrent = ( ++lCurrent > 4 ? 1 : lCurrent );
      hb_itemArrayPut( pArray, ST_CURRENT, hb_itemPutNL( pCurrent, lCurrent ) );

      hb_gtGetColorStr( (char*) szOldColor );
      hb_gtSetColorStr( hb_arrayGetCPtr( pArray, ST_COLOR ) );
      hb_gtWriteAt( (USHORT) hb_arrayGetNL( pArray, ST_ROW ),
                    (USHORT) hb_arrayGetNL( pArray, ST_COL ),
                    ( BYTE * ) szDisplay + lCurrent - 1, 1 );

      hb_gtSetColorStr( (char*) szOldColor );
      hb_itemRelease( pCurrent );
   }
}
status.c80
time.c
TypeFunctionSourceLine
HB_FUNCSECONDSASDAYS(void)
HB_FUNC( SECONDSASDAYS )
{
   HB_FUNC_EXEC( DAYS );
}
time.c64
HB_FUNCTIMEASAMPM(void)
HB_FUNC( TIMEASAMPM )
{
   HB_FUNC_EXEC( AMPM );
}
time.c71
HB_FUNCTIMEASSECONDS(void)
HB_FUNC( TIMEASSECONDS )
{
   HB_FUNC_EXEC( SECS );
}
time.c78
HB_FUNCTIMEASSTRING(void)
HB_FUNC( TIMEASSTRING )
{
   HB_FUNC_EXEC( TSTRING );
}
time.c85
HB_FUNCTIMEDIFF(void)
HB_FUNC( TIMEDIFF )
{
   HB_FUNC_EXEC( ELAPTIME );
}
time.c92
HB_FUNCTIMEISVALID(void)
HB_FUNC( TIMEISVALID )
{
   char * pszTime = hb_parc( 1 );
   BOOL bRet = FALSE;

   if( pszTime )
   {
      if( atol( pszTime ) < 24 &&
          atol( pszTime + 3 ) < 60 &&
          atol( pszTime + 6 ) < 60 )
      {
         bRet = TRUE;
      }
   }

   hb_retl( bRet );
}
time.c99
<

Page url: http://www.yourdomain.com/help/index.html?hbclipsm.htm