2012-07-19 21:10 UTC+0200 Viktor Szakats (harbour syenar.net)

* contrib/hbnf/descendn.c
  * contrib/hbnf/dispc.c
  * contrib/hbnf/fttext.c
  * contrib/hbnf/peek.c
  * contrib/hbnf/poke.c
  * contrib/hbnf/proper.c
  * contrib/hbnf/prtscr.c
    * uncrustified
    ! fixed warning on __max()/__min() macros by replacing them
      with Harbour macros
This commit is contained in:
Viktor Szakats
2012-07-19 19:15:15 +00:00
parent 8594097c52
commit 197b39966c
8 changed files with 854 additions and 819 deletions

View File

@@ -16,6 +16,18 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-07-19 21:10 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbnf/descendn.c
* contrib/hbnf/dispc.c
* contrib/hbnf/fttext.c
* contrib/hbnf/peek.c
* contrib/hbnf/poke.c
* contrib/hbnf/proper.c
* contrib/hbnf/prtscr.c
* uncrustified
! fixed warning on __max()/__min() macros by replacing them
with Harbour macros
2012-07-19 20:49 UTC+0200 Viktor Szakats (vszakats syenar.net)
* examples/hbapollo/dbedit.prg
! fix (to a source redone for Harbour)

View File

@@ -28,37 +28,37 @@ HB_FUNC( FT_DESCEND )
{
#if defined( HB_OS_DOS ) || defined( HB_OS_WIN )
{
PHB_ITEM iP = hb_itemParam( 1 );
HB_TYPE uiType = hb_itemType( iP );
PHB_ITEM iP = hb_itemParam( 1 );
HB_TYPE uiType = hb_itemType( iP );
PHB_ITEM iR = NULL;
HB_SIZE uiLen, n;
char * pDescend;
PHB_ITEM iR = NULL;
HB_SIZE uiLen, n;
char * pDescend;
if ( ( uiType & HB_IT_NUMERIC ) && ( uiType & HB_IT_DOUBLE ) )
if( ( uiType & HB_IT_NUMERIC ) && ( uiType & HB_IT_DOUBLE ) )
iR = hb_itemPutND( 0, 0 - hb_itemGetND( iP ) );
else if ( uiType & HB_IT_NUMERIC )
else if( uiType & HB_IT_NUMERIC )
iR = hb_itemPutNL( 0, 0 - hb_itemGetNL( iP ) );
else if ( uiType & HB_IT_DATE )
else if( uiType & HB_IT_DATE )
iR = hb_itemPutNL( 0, 0x4FD4C0L - hb_itemGetNL( iP ) );
else if ( uiType & HB_IT_TIMESTAMP )
else if( uiType & HB_IT_TIMESTAMP )
iR = hb_itemPutND( 0, 0x4FD4C0L - hb_itemGetTD( iP ) );
else if ( uiType & HB_IT_LOGICAL )
else if( uiType & HB_IT_LOGICAL )
iR = hb_itemPutL( 0, ( hb_itemGetL( iP ) > 0 ) ? 0 : 1 );
else if ( uiType & HB_IT_STRING )
else if( uiType & HB_IT_STRING )
{
uiLen = hb_itemSize( iP );
uiLen = hb_itemSize( iP );
pDescend = ( char * ) hb_xgrab( uiLen );
hb_itemCopyC( iP, pDescend, uiLen );
for ( n = 0; n < uiLen; n++ )
for( n = 0; n < uiLen; n++ )
pDescend[ n ] = ( char ) 0 - pDescend[ n ];
iR = hb_itemPutCL( 0, pDescend, uiLen );

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -37,25 +37,27 @@
HB_FUNC( FT_PEEK )
{
auto unsigned int ProtMode = cpmiIsProtected();
auto unsigned int ProtMode = cpmiIsProtected();
auto unsigned char * bytePtr;
if ( ( PCOUNT >= 2 ) && ( HB_ISNUM( 1 ) ) && ( HB_ISNUM( 2 ) ) )
if( ( PCOUNT >= 2 ) && ( HB_ISNUM( 1 ) ) && ( HB_ISNUM( 2 ) ) )
{
FP_SEG( bytePtr ) = hb_parni( 1 );
FP_OFF( bytePtr ) = hb_parni( 2 );
if ( ProtMode )
if( ProtMode )
{
FP_SEG( bytePtr ) = hb_cpmiProtectedPtr( bytePtr, 1 );
FP_OFF( bytePtr ) = 0;
if ( FP_SEG( bytePtr ) == 0 ) goto Bogus;
if( FP_SEG( bytePtr ) == 0 )
goto Bogus;
}
_retni( ( int ) *bytePtr );
if ( ProtMode ) hb_cpmiFreeSelector( FP_SEG( bytePtr ) );
if( ProtMode )
hb_cpmiFreeSelector( FP_SEG( bytePtr ) );
}
else
Bogus: hb_retni( -1 );

View File

@@ -37,25 +37,27 @@
HB_FUNC( FT_POKE )
{
auto unsigned int ProtMode = hb_cpmiIsProtected();
auto unsigned int ProtMode = hb_cpmiIsProtected();
auto unsigned char * bytePtr;
if ( ( PCOUNT >= 3 ) && ( HB_ISNUM( 1 ) ) && ( HB_ISNUM( 2 ) ) && ( HB_ISNUM( 3 ) ) )
if( ( PCOUNT >= 3 ) && ( HB_ISNUM( 1 ) ) && ( HB_ISNUM( 2 ) ) && ( HB_ISNUM( 3 ) ) )
{
FP_SEG( bytePtr ) = hb_parni( 1 );
FP_OFF( bytePtr ) = hb_parni( 2 );
if ( ProtMode )
if( ProtMode )
{
FP_SEG( bytePtr ) = hb_cpmiProtectedPtr( bytePtr, 1 );
FP_OFF( bytePtr ) = 0;
if ( FP_SEG( bytePtr ) == 0 ) goto Bogus;
if( FP_SEG( bytePtr ) == 0 )
goto Bogus;
}
*bytePtr = ( unsigned char ) hb_parni( 3 );
if ( ProtMode ) hb_cpmiFreeSelector( FP_SEG( bytePtr ) );
if( ProtMode )
hb_cpmiFreeSelector( FP_SEG( bytePtr ) );
hb_retl( HB_TRUE );
}

View File

@@ -61,42 +61,47 @@ static HB_BOOL _ftIsAlpha( char c )
HB_FUNC( FT_PROPER )
{
HB_ISIZ iLen = hb_parclen(1);
const char *cStr;
char *cDst = NULL;
HB_ISIZ i; /*, iPos = 0; */
HB_BOOL fCap = HB_TRUE;
HB_ISIZ iLen = hb_parclen( 1 );
const char * cStr;
char * cDst = NULL;
HB_ISIZ i; /*, iPos = 0; */
HB_BOOL fCap = HB_TRUE;
hb_storc( NULL, 1 );
cStr = hb_parc(1);
cStr = hb_parc( 1 );
for( i = 0; i < iLen; i++ ) {
if( _ftIsAlpha( cStr[i] ) ) {
if( !cDst ) {
cDst = (char *) hb_xgrab(iLen + 1);
memcpy(cDst, cStr, iLen + 1);
for( i = 0; i < iLen; i++ )
{
if( _ftIsAlpha( cStr[ i ] ) )
{
if( ! cDst )
{
cDst = ( char * ) hb_xgrab( iLen + 1 );
memcpy( cDst, cStr, iLen + 1 );
}
if( fCap )
cDst[i] = _ftToUpper( cDst[i] );
cDst[ i ] = _ftToUpper( cDst[ i ] );
else
cDst[i] = _ftToLower( cDst[i] );
}
fCap = ( cStr[i] == ' ' || cStr[i] == '-' || cStr[i] == 0x27 );
cDst[ i ] = _ftToLower( cDst[ i ] );
}
fCap = ( cStr[ i ] == ' ' || cStr[ i ] == '-' || cStr[ i ] == 0x27 );
}
/* Find "Mc" */
if( cDst ) {
if( cDst )
{
for( i = 0; i < iLen - 2; i++ )
if( cStr[i] == 'M' && cStr[i+1] == 'c' ) {
cDst[i+2] = _ftToUpper( cDst[i+2] );
if( cStr[ i ] == 'M' && cStr[ i + 1 ] == 'c' )
{
cDst[ i + 2 ] = _ftToUpper( cDst[ i + 2 ] );
}
}
/* // If "Mc" was found, Cap next letter if Alpha
if( iPos > 1 )
if( iPos > 1 )
if( iPos < iLen )
if( ! _ftIsUpper( cStr[iPos] ) )
cStr[iPos] = _ftToUpper( cStr[iPos] );
*/
*/
if( cDst )
hb_retclen_buffer( cDst, iLen );
else

View File

@@ -35,15 +35,15 @@
HB_FUNC( FT_PRTSCR )
{
#if defined( HB_OS_DOS )
if ( HB_ISLOG( 1 ) )
if( HB_ISLOG( 1 ) )
{
if ( hb_parl( 1 ) )
pbyte = 0;
if( hb_parl( 1 ) )
pbyte = 0;
else
pbyte = 1;
pbyte = 1;
}
if ( pbyte == 1)
if( pbyte == 1 )
hb_retl( HB_FALSE );
else
hb_retl( HB_TRUE );