diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6f811c5f7e..ad6872d9c1 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,29 @@ The license applies to all entries newer than 2009-04-28. */ +2012-10-16 20:34 UTC+0200 Viktor Szakats (harbour syenar.net) + * contrib/hbnf/descendn.c + + enabled FT_DESCEND() for all platforms + + * contrib/hbnf/hbnf.hbp + * contrib/hbnf/hbnf.hbx + * contrib/hbnf/peek.c + * contrib/hbnf/poke.c + * FT_PEEK(), FT_POKE() will now be compiled and returning + permanent failure on all platforms. + + * contrib/hbnf/ftisprn.c + * contrib/hbnf/ftshadow.c + * contrib/hbnf/kspeed.c + * contrib/hbnf/setkeys.c + * contrib/hbnf/setlastk.c + * use HB_FUNC_TRANSLATE() + + * contrib/hbnf/getver.c + * contrib/hbnf/mkdir.c + * contrib/hbnf/proper.c + * minor fmt + 2012-10-16 19:24 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbzebra/datamtrx.c ! fixed a char truncation warning diff --git a/harbour/contrib/hbnf/descendn.c b/harbour/contrib/hbnf/descendn.c index 0ed4984120..e791779e34 100644 --- a/harbour/contrib/hbnf/descendn.c +++ b/harbour/contrib/hbnf/descendn.c @@ -25,50 +25,45 @@ 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 iR = NULL; + + if( ( uiType & HB_IT_NUMERIC ) && ( uiType & HB_IT_DOUBLE ) ) + iR = hb_itemPutND( 0, 0 - hb_itemGetND( iP ) ); + + else if( uiType & HB_IT_NUMERIC ) + iR = hb_itemPutNL( 0, 0 - hb_itemGetNL( iP ) ); + + else if( uiType & HB_IT_DATE ) + iR = hb_itemPutNL( 0, 0x4FD4C0L - hb_itemGetNL( iP ) ); + + else if( uiType & HB_IT_TIMESTAMP ) + iR = hb_itemPutND( 0, 0x4FD4C0L - hb_itemGetTD( iP ) ); + + else if( uiType & HB_IT_LOGICAL ) + iR = hb_itemPutL( 0, ( hb_itemGetL( iP ) > 0 ) ? 0 : 1 ); + + else if( uiType & HB_IT_STRING ) { - PHB_ITEM iP = hb_itemParam( 1 ); - HB_TYPE uiType = hb_itemType( iP ); + HB_SIZE uiLen = hb_itemSize( iP ); + HB_SIZE n; - PHB_ITEM iR = NULL; - HB_SIZE uiLen, n; - char * pDescend; + char * pDescend = ( char * ) hb_xgrab( uiLen ); - if( ( uiType & HB_IT_NUMERIC ) && ( uiType & HB_IT_DOUBLE ) ) - iR = hb_itemPutND( 0, 0 - hb_itemGetND( iP ) ); + hb_itemCopyC( iP, pDescend, uiLen ); - else if( uiType & HB_IT_NUMERIC ) - iR = hb_itemPutNL( 0, 0 - hb_itemGetNL( iP ) ); + for( n = 0; n < uiLen; n++ ) + pDescend[ n ] = ( char ) 0 - pDescend[ n ]; - else if( uiType & HB_IT_DATE ) - iR = hb_itemPutNL( 0, 0x4FD4C0L - hb_itemGetNL( iP ) ); + iR = hb_itemPutCL( 0, pDescend, uiLen ); - else if( uiType & HB_IT_TIMESTAMP ) - iR = hb_itemPutND( 0, 0x4FD4C0L - hb_itemGetTD( iP ) ); - - else if( uiType & HB_IT_LOGICAL ) - iR = hb_itemPutL( 0, ( hb_itemGetL( iP ) > 0 ) ? 0 : 1 ); - - else if( uiType & HB_IT_STRING ) - { - uiLen = hb_itemSize( iP ); - - pDescend = ( char * ) hb_xgrab( uiLen ); - - hb_itemCopyC( iP, pDescend, uiLen ); - - for( n = 0; n < uiLen; n++ ) - pDescend[ n ] = ( char ) 0 - pDescend[ n ]; - - iR = hb_itemPutCL( 0, pDescend, uiLen ); - - hb_xfree( pDescend ); - } - - hb_itemReturn( iR ); - - hb_itemRelease( iP ); - hb_itemRelease( iR ); + hb_xfree( pDescend ); } -#endif + + hb_itemReturn( iR ); + + hb_itemRelease( iP ); + hb_itemRelease( iR ); } diff --git a/harbour/contrib/hbnf/ftisprn.c b/harbour/contrib/hbnf/ftisprn.c index 730c4620dd..f5021c3856 100644 --- a/harbour/contrib/hbnf/ftisprn.c +++ b/harbour/contrib/hbnf/ftisprn.c @@ -79,10 +79,4 @@ #include "hbapi.h" /* TOFIX: Has different behaviour depending on platform/parameter. [vszakats] */ - -HB_FUNC_EXTERN( HB_ISPRINTER ); - -HB_FUNC( FT_ISPRINT ) -{ - HB_FUNC_EXEC( HB_ISPRINTER ) -} +HB_FUNC_TRANSLATE( FT_ISPRINT, HB_ISPRINTER ) diff --git a/harbour/contrib/hbnf/ftshadow.c b/harbour/contrib/hbnf/ftshadow.c index 0f0a35eed2..0a06b59d6e 100644 --- a/harbour/contrib/hbnf/ftshadow.c +++ b/harbour/contrib/hbnf/ftshadow.c @@ -54,12 +54,7 @@ #include "hbapi.h" #include "hbapigt.h" -HB_FUNC_EXTERN( HB_SHADOW ); - -HB_FUNC( FT_SHADOW ) -{ - HB_FUNC_EXEC( HB_SHADOW ); -} +HB_FUNC_TRANSLATE( FT_SHADOW, HB_SHADOW ) HB_FUNC( FT_SETATTR ) { diff --git a/harbour/contrib/hbnf/getver.c b/harbour/contrib/hbnf/getver.c index f93f399544..9a3a450797 100644 --- a/harbour/contrib/hbnf/getver.c +++ b/harbour/contrib/hbnf/getver.c @@ -95,6 +95,7 @@ HB_FUNC( FT_ISSHARE ) iShare = 0; } #endif + hb_retni( iShare ); } @@ -105,15 +106,16 @@ HB_FUNC( _FT_NWKSTAT ) #if defined( HB_OS_DOS ) { union REGS regs; - regs.HB_XREGS.ax = 0xDC; + regs.HB_XREGS.ax = 0xDC; HB_DOS_INT86( 0x2F, ®s, ®s ); - iConnect = regs.h.al; + iConnect = regs.h.al; } #else { iConnect = 0; } #endif + hb_retni( iConnect ); } @@ -122,8 +124,8 @@ HB_FUNC( FT_SETMODE ) #if defined( HB_OS_DOS ) { union REGS regs; - regs.h.ah = 0; - regs.h.al = hb_parni( 1 ); + regs.h.ah = 0; + regs.h.al = hb_parni( 1 ); HB_DOS_INT86( 0x10, ®s, ®s ); } #endif @@ -136,15 +138,16 @@ HB_FUNC( FT_GETMODE ) #if defined( HB_OS_DOS ) { union REGS regs; - regs.h.ah = 0x0F; + regs.h.ah = 0x0F; HB_DOS_INT86( 0x10, ®s, ®s ); - iMode = regs.h.al; + iMode = regs.h.al; } #else { iMode = 0; } #endif + hb_retni( iMode ); } diff --git a/harbour/contrib/hbnf/hbnf.hbp b/harbour/contrib/hbnf/hbnf.hbp index b605a03295..71d3dd687d 100644 --- a/harbour/contrib/hbnf/hbnf.hbp +++ b/harbour/contrib/hbnf/hbnf.hbp @@ -37,6 +37,8 @@ mouse.c n2color.c numlock.c origin.c +peek.c +poke.c proper.c prtscr.c putkey.c @@ -46,10 +48,6 @@ setlastk.c shift.c stod.c -# BAD_C_SOURCES -#peek.c -#poke.c - aading.prg aavg.prg acctadj.prg diff --git a/harbour/contrib/hbnf/hbnf.hbx b/harbour/contrib/hbnf/hbnf.hbx index 367092733f..5cad1d9d83 100644 --- a/harbour/contrib/hbnf/hbnf.hbx +++ b/harbour/contrib/hbnf/hbnf.hbx @@ -174,9 +174,11 @@ DYNAMIC FT_NWUID DYNAMIC FT_ONTICK DYNAMIC FT_ORIGIN DYNAMIC FT_PCHR +DYNAMIC FT_PEEK DYNAMIC FT_PEGS DYNAMIC FT_PENDING DYNAMIC FT_PICKDAY +DYNAMIC FT_POKE DYNAMIC FT_POPVID DYNAMIC FT_PROMPT DYNAMIC FT_PROPER diff --git a/harbour/contrib/hbnf/kspeed.c b/harbour/contrib/hbnf/kspeed.c index f054189db6..f832592867 100644 --- a/harbour/contrib/hbnf/kspeed.c +++ b/harbour/contrib/hbnf/kspeed.c @@ -24,6 +24,7 @@ */ #include "hbapi.h" + #if defined( HB_OS_DOS ) # include "dos.h" #endif diff --git a/harbour/contrib/hbnf/mkdir.c b/harbour/contrib/hbnf/mkdir.c index bd56be801d..93f4b81b82 100644 --- a/harbour/contrib/hbnf/mkdir.c +++ b/harbour/contrib/hbnf/mkdir.c @@ -3,25 +3,25 @@ */ /* - ; Author....: Ted Means - ; CIS ID....: 73067,3332 - ; - ; This is an original work by Ted Means and is placed in the - ; public domain. - ; - ; Modification history: - ; --------------------- - ; - ; Rev 1.2 15 Aug 1991 23:06:58 GLENN - ; Forest Belt proofread/edited/cleaned up doc - ; - ; Rev 1.1 14 Jun 1991 19:54:44 GLENN - ; Minor edit to file header - ; - ; Rev 1.0 01 Apr 1991 01:03:32 GLENN - ; Nanforum Toolkit - ; - ; + * Author....: Ted Means + * CIS ID....: 73067,3332 + * + * This is an original work by Ted Means and is placed in the + * public domain. + * + * Modification history: + * --------------------- + * + * Rev 1.2 15 Aug 1991 23:06:58 GLENN + * Forest Belt proofread/edited/cleaned up doc + * + * Rev 1.1 14 Jun 1991 19:54:44 GLENN + * Minor edit to file header + * + * Rev 1.0 01 Apr 1991 01:03:32 GLENN + * Nanforum Toolkit + * + * */ #include "hbapi.h" diff --git a/harbour/contrib/hbnf/peek.c b/harbour/contrib/hbnf/peek.c index a0cae6f0ae..c4fe5935af 100644 --- a/harbour/contrib/hbnf/peek.c +++ b/harbour/contrib/hbnf/peek.c @@ -29,35 +29,7 @@ #include "hbapi.h" -#include "cpmi.h" - -#define FP_SEG( fp ) ( *( ( unsigned int * ) &( fp ) + 1 ) ) -#define FP_OFF( fp ) ( *( ( unsigned int * ) &( fp ) ) ) - HB_FUNC( FT_PEEK ) { - auto unsigned int ProtMode = cpmiIsProtected(); - auto unsigned char * bytePtr; - - if( PCOUNT >= 2 && HB_ISNUM( 1 ) && HB_ISNUM( 2 ) ) - { - FP_SEG( bytePtr ) = hb_parni( 1 ); - FP_OFF( bytePtr ) = hb_parni( 2 ); - - if( ProtMode ) - { - FP_SEG( bytePtr ) = hb_cpmiProtectedPtr( bytePtr, 1 ); - FP_OFF( bytePtr ) = 0; - - if( FP_SEG( bytePtr ) == 0 ) - goto Bogus; - } - - hb_retni( ( int ) *bytePtr ); - - if( ProtMode ) - hb_cpmiFreeSelector( FP_SEG( bytePtr ) ); - } - else - Bogus: hb_retni( -1 ); + hb_retni( -1 ); } diff --git a/harbour/contrib/hbnf/poke.c b/harbour/contrib/hbnf/poke.c index 7085e066a5..8ddf16f2d1 100644 --- a/harbour/contrib/hbnf/poke.c +++ b/harbour/contrib/hbnf/poke.c @@ -29,37 +29,7 @@ #include "hbapi.h" -#include "cpmi.h" - -#define FP_SEG( fp ) ( *( ( unsigned int * ) &( fp ) + 1 ) ) -#define FP_OFF( fp ) ( *( ( unsigned int * ) &( fp ) ) ) - HB_FUNC( FT_POKE ) { - auto unsigned int ProtMode = hb_cpmiIsProtected(); - auto unsigned char * bytePtr; - - 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 ) - { - FP_SEG( bytePtr ) = hb_cpmiProtectedPtr( bytePtr, 1 ); - FP_OFF( bytePtr ) = 0; - - if( FP_SEG( bytePtr ) == 0 ) - goto Bogus; - } - - *bytePtr = ( unsigned char ) hb_parni( 3 ); - - if( ProtMode ) - hb_cpmiFreeSelector( FP_SEG( bytePtr ) ); - - hb_retl( HB_TRUE ); - } - else - Bogus: hb_retl( HB_FALSE ); + hb_retl( HB_FALSE ); } diff --git a/harbour/contrib/hbnf/proper.c b/harbour/contrib/hbnf/proper.c index 99483e14c1..bc8bca0f14 100644 --- a/harbour/contrib/hbnf/proper.c +++ b/harbour/contrib/hbnf/proper.c @@ -98,8 +98,8 @@ HB_FUNC( FT_PROPER ) /* // If "Mc" was found, Cap next letter if Alpha if( iPos > 1 ) if( iPos < iLen ) - if( ! _ftIsUpper( cStr[iPos] ) ) - cStr[iPos] = _ftToUpper( cStr[iPos] ); + if( ! _ftIsUpper( cStr[ iPos ] ) ) + cStr[ iPos ] = _ftToUpper( cStr[ iPos ] ); */ if( cDst ) hb_retclen_buffer( cDst, iLen ); diff --git a/harbour/contrib/hbnf/setkeys.c b/harbour/contrib/hbnf/setkeys.c index b5b7a202c3..164efd4f7d 100644 --- a/harbour/contrib/hbnf/setkeys.c +++ b/harbour/contrib/hbnf/setkeys.c @@ -67,9 +67,4 @@ #include "hbapi.h" -HB_FUNC_EXTERN( HB_SETKEYSAVE ); - -HB_FUNC( FT_SETKEYS ) -{ - HB_FUNC_EXEC( HB_SETKEYSAVE ) -} +HB_FUNC_TRANSLATE( FT_SETKEYS, HB_SETKEYSAVE ) diff --git a/harbour/contrib/hbnf/setlastk.c b/harbour/contrib/hbnf/setlastk.c index d7dfb72124..10164c52fe 100644 --- a/harbour/contrib/hbnf/setlastk.c +++ b/harbour/contrib/hbnf/setlastk.c @@ -67,9 +67,4 @@ #include "hbapi.h" -HB_FUNC_EXTERN( HB_SETLASTKEY ); - -HB_FUNC( FT_LASTKEY ) -{ - HB_FUNC_EXEC( HB_SETLASTKEY ) -} +HB_FUNC_TRANSLATE( FT_LASTKEY, HB_SETLASTKEY )