c:\harbour\contrib\hbclipsm
date.c |
Type | Function | Source | Line |
HB_FUNC | MDY(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.c | 58 |
HB_FUNC | DMY(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.c | 88 |
HB_FUNC | DATEASAGE(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.c | 117 |
HB_FUNC | ADDMONTH(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.c | 144 |
HB_FUNC | DATEASARRAY(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.c | 184 |
HB_FUNC | ARRAYASDATE(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.c | 216 |
HB_FUNC | DATEISLEAP(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.c | 228 |
HB_FUNC | NTOD(void)
HB_FUNC( NTOD )
{
hb_retd( hb_parni( 3 ), hb_parni( 1 ), hb_parni( 2 ) );
}
| date.c | 246 |
dbf.c |
Type | Function | Source | Line |
HB_FUNC | DBF(void)
HB_FUNC( DBF )
{
HB_FUNC_EXEC( ALIAS );
}
| dbf.c | 58 |
environ.c |
Type | Function | Source | Line |
HB_FUNC | FILEPATH(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.c | 56 |
HB_FUNC | FILEBASE(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.c | 72 |
HB_FUNC | FILEEXT(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.c | 86 |
HB_FUNC | FILEDRIVE(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.c | 103 |
gauge.c |
Type | Function | Source | Line |
STATIC VOID | hb_gaugeUpdate( PHB_ITEM pArray, float fPercent )
static void hb_gaugeUpdate( PHB_ITEM pArray, float fPercent )
{
int iCenter = ( ( hb_arrayGetNL( pArray, B_RIGHT ) - hb_arrayGetNL( pArray, B_LEFT ) ) / 2 ) + 1;
int iRatio = hb_arrayGetNL( pArray, B_RIGHT ) - hb_arrayGetNL( pArray, B_LEFT ) - 1;
int iRow;
int iCols;
int iMax;
char szOldColor[ CLR_STRLEN ];
char * szStr = " ";
char szPct[ 4 ];
hb_gtGetColorStr( szOldColor );
hb_gtSetColorStr( hb_arrayGetCPtr( pArray, B_BARCOLOR ) );
fPercent = ( fPercent < 0 ? 0 : ( fPercent > 1 ? 1 : fPercent ) );
iCols = (int) (fPercent * iRatio);
if( hb_arrayGetL( pArray, B_DISPLAYNUM ) )
{
/* sprintf( szPct, "%3.0f\%", fPercent * 100 ); */
snprintf( szPct, sizeof( szPct ), "%3.0f%%", fPercent * 100 );
hb_gtWriteAt( (USHORT) hb_arrayGetNL( pArray, B_TOP ),
(USHORT) iCenter + 2, (BYTE *) szPct, 4 );
}
hb_gtBox( hb_arrayGetNI( pArray, B_TOP ) + 1, hb_arrayGetNI( pArray, B_LEFT ) + 1,
hb_arrayGetNI( pArray, B_BOTTOM ) - 1, hb_arrayGetNI( pArray, B_RIGHT ) - 1,
( BYTE * ) szStr );
iMax = hb_arrayGetNL( pArray, B_BOTTOM ) - hb_arrayGetNL( pArray, B_TOP ) - 1;
for( iRow = 1; iRow <= iMax; iRow++ )
{
hb_gtRepChar( (USHORT) (iRow + hb_arrayGetNL( pArray, B_TOP )),
(USHORT) (hb_arrayGetNL( pArray, B_LEFT ) + 1),
( BYTE ) * hb_arrayGetCPtr( pArray, B_BARCHAR ), iCols );
}
hb_gtSetColorStr( szOldColor );
}
| gauge.c | 71 |
HB_FUNC | GAUGENEW(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.c | 111 |
HB_FUNC | GAUGEDISPLAY(void)
HB_FUNC( GAUGEDISPLAY )
{
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
if( pArray )
{
int iCenter = ( ( hb_arrayGetNL( pArray, B_RIGHT ) - hb_arrayGetNL( pArray, B_LEFT ) ) / 2 ) + 1;
char szOldColor[ CLR_STRLEN ];
char * szStr = " ";
hb_gtGetColorStr( szOldColor );
hb_gtSetColorStr( hb_arrayGetCPtr( pArray, B_BACKCOLOR ) );
hb_gtBox( (SHORT) hb_arrayGetNL( pArray, B_TOP ),
(SHORT) hb_arrayGetNL( pArray, B_LEFT ),
(SHORT) hb_arrayGetNL( pArray, B_BOTTOM ),
(SHORT) hb_arrayGetNL( pArray, B_RIGHT ),
(BYTE *) szStr );
hb_gtBox( (SHORT) hb_arrayGetNL( pArray, B_TOP ),
(SHORT) hb_arrayGetNL( pArray, B_LEFT ),
(SHORT) hb_arrayGetNL( pArray, B_BOTTOM ),
(SHORT) hb_arrayGetNL( pArray, B_RIGHT ),
(BYTE *) B_BOXLINES );
if( hb_arrayGetL( pArray, B_DISPLAYNUM ) )
hb_gtWriteAt( (USHORT) hb_arrayGetNL( pArray, B_TOP ),
iCenter, ( BYTE * ) "[ ]", 8 );
hb_gtSetColorStr( szOldColor );
hb_gaugeUpdate( pArray, (float) hb_arrayGetNL( pArray, B_PERCENT ) );
hb_itemReturn( pArray );
}
}
| gauge.c | 142 |
HB_FUNC | GAUGEUPDATE(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.c | 181 |
num.c |
Type | Function | Source | Line |
HB_FUNC | CEILING(void)
HB_FUNC( CEILING )
{
hb_retnl( (long) ceil( hb_parnd( 1 ) ) );
}
| num.c | 64 |
HB_FUNC | DTOR(void)
HB_FUNC( DTOR )
{
hb_retndlen( ( hb_parnd( 1 ) / 180 ) * PI, 10, 9 );
}
| num.c | 72 |
HB_FUNC | FLOOR(void)
HB_FUNC( FLOOR )
{
hb_retnl( (long) floor( hb_parnd( 1 ) ) );
}
| num.c | 80 |
HB_FUNC | NUMASLOG10(void)
HB_FUNC( NUMASLOG10 )
{
if( ISNUM( 1 ) )
{
hb_retnd( log10( hb_parnd(1) ) );
}
}
| num.c | 88 |
HB_FUNC | NUMGETDECIMALS(void)
HB_FUNC( NUMGETDECIMALS )
{
int iDec = 0;
if( ISNUM( 1 ) )
{
hb_itemGetNLen( hb_param( 1, HB_IT_NUMERIC ), NULL, &iDec );
}
hb_retnl( iDec );
}
| num.c | 99 |
HB_FUNC | NUMGETLEN(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.c | 114 |
HB_FUNC | RTOD(void)
HB_FUNC( RTOD )
{
hb_retnd( 180 * ( hb_parnd( 1 ) / PI ) );
}
| num.c | 153 |
HB_FUNC | SIGN(void)
HB_FUNC( SIGN )
{
if( ISNUM( 1 ) )
{
long lNumber = hb_parnl( 1 );
hb_retni( lNumber == 0 ? 0 : ( lNumber > 0 ? 1 : -1 ) );
}
}
| num.c | 161 |
HB_FUNC | NUMASCURRENCY(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.c | 177 |
stack.c |
Type | Function | Source | Line |
HB_FUNC | STACKNEW(void)
HB_FUNC( STACKNEW )
{
hb_itemReturnRelease( hb_itemArrayNew( 0 ) ); /* Create array */
}
| stack.c | 56 |
HB_FUNC | STACKPUSH(void)
HB_FUNC( STACKPUSH )
{
hb_arrayAdd( hb_param( 1, HB_IT_ARRAY ),
hb_param( 2, HB_IT_ANY ) );
}
| stack.c | 63 |
HB_FUNC | STACKPOP(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.c | 71 |
HB_FUNC | STACKISEMPTY(void)
HB_FUNC( STACKISEMPTY )
{
hb_retl( hb_arrayLen( hb_param( 1, HB_IT_ARRAY ) ) == 0 );
}
| stack.c | 91 |
HB_FUNC | STACKTOP(void)
HB_FUNC( STACKTOP )
{
PHB_ITEM pLast = hb_itemNew( NULL );
hb_arrayLast( hb_param( 1, HB_IT_ARRAY ), pLast );
hb_itemReturnRelease( pLast );
}
| stack.c | 98 |
status.c |
Type | Function | Source | Line |
HB_FUNC | STATUSNEW(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.c | 66 |
HB_FUNC | STATUSUPDATE(void)
HB_FUNC( STATUSUPDATE )
{
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
if( pArray )
{
char * szDisplay = "|/-\\";
long lCurrent = hb_arrayGetNL( pArray, ST_CURRENT );
char * szOldColor[ CLR_STRLEN ];
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.c | 80 |
time.c |
Type | Function | Source | Line |
HB_FUNC | SECONDSASDAYS(void)
HB_FUNC( SECONDSASDAYS )
{
HB_FUNC_EXEC( DAYS );
}
| time.c | 64 |
HB_FUNC | TIMEASAMPM(void)
HB_FUNC( TIMEASAMPM )
{
HB_FUNC_EXEC( AMPM );
}
| time.c | 71 |
HB_FUNC | TIMEASSECONDS(void)
HB_FUNC( TIMEASSECONDS )
{
HB_FUNC_EXEC( SECS );
}
| time.c | 78 |
HB_FUNC | TIMEASSTRING(void)
HB_FUNC( TIMEASSTRING )
{
HB_FUNC_EXEC( TSTRING );
}
| time.c | 85 |
HB_FUNC | TIMEDIFF(void)
HB_FUNC( TIMEDIFF )
{
HB_FUNC_EXEC( ELAPTIME );
}
| time.c | 92 |
HB_FUNC | TIMEISVALID(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.c | 99 |
|