diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0ec8c64fd1..23165f5bb9 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,11 +8,23 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2002-10-28 11:10 UTC-0500 Paul Tucker + * source/rtl/gtwin/gtwin.c + * modified by Robert Haley to allow Tone() + * to work correctly under Win9x. + * source/vm/maindllp.c + * remove redundant returns. Set parc to return NULL not "" + * source/rtl/transform.c + * changed nFor decl to UINT + * source/rtl/defpath.c + * removed unneeded assignment to size + * source/rdd/dbfcdx/dbfcdx1.c + * removed unneeded assignement to uiLen + 2002-10-27 21:35 UTC+0100 J-F lefebvre * source/rdd/dbf1.c * added missing typecasting for msvc. - 2002-10-27 10:28 UTC+0200 Chen Kedem * doc/en/lang.txt + Added Russian KIO-8 to HB_LANGSELECT() list of supported ID's diff --git a/harbour/source/rdd/dbfcdx/dbfcdx1.c b/harbour/source/rdd/dbfcdx/dbfcdx1.c index 68a4750b40..8e5327cf28 100644 --- a/harbour/source/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/source/rdd/dbfcdx/dbfcdx1.c @@ -5796,7 +5796,6 @@ ERRCODE hb_cdxOrderCreate( CDXAREAP pAreaCdx, LPDBORDERCREATEINFO pOrderInfo ) } uiType = hb_itemType( pResult ); - uiLen = 0; switch( uiType ) { diff --git a/harbour/source/rtl/defpath.c b/harbour/source/rtl/defpath.c index 433dc03704..a8436b0811 100644 --- a/harbour/source/rtl/defpath.c +++ b/harbour/source/rtl/defpath.c @@ -59,7 +59,7 @@ HB_FUNC( DEFPATH ) { char buffer[ _POSIX_PATH_MAX +1 ]; char delimiter[ 2 ] = ":"; - int size = 0; + int size; buffer[0] = '\0'; diff --git a/harbour/source/rtl/gtwin/gtwin.c b/harbour/source/rtl/gtwin/gtwin.c index e2bf636b31..372ac89964 100644 --- a/harbour/source/rtl/gtwin/gtwin.c +++ b/harbour/source/rtl/gtwin/gtwin.c @@ -89,6 +89,10 @@ #include #include +#if defined( _MSC_VER ) + #include +#endif + /* *********************************************************************** */ #if defined(__IBMCPP__) @@ -894,26 +898,6 @@ void hb_gt_SetBlink( BOOL bBlink ) HB_SYMBOL_UNUSED( bBlink ); } -/* *********************************************************************** */ - -void hb_gt_Tone( double dFrequency, double dDuration ) -{ - HB_TRACE(HB_TR_DEBUG, ("hb_gt_Tone(%lf, %lf)", dFrequency, dDuration)); - - /* The conversion from Clipper timer tick units to - milliseconds is * 1000.0 / 18.2. */ - - dDuration = dDuration * 1000.0 / 18.2; /* milliseconds */ - dDuration = HB_MIN( HB_MAX( 0, dDuration ), ULONG_MAX ); - - if( dDuration > 0.0 ) { - /* Bad news for non-NT Windows platforms: Beep() ignores - both parameters and either generates the default sound - event or the standard system beep. */ - Beep( ( ULONG ) HB_MIN( HB_MAX( 0.0, dFrequency ), 32767.0 ), - ( ULONG ) dDuration ); - } -} /* *********************************************************************** */ @@ -1512,5 +1496,210 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask ) return ch; } + /* *********************************************************************** */ +static int hb_Inp9x( USHORT usPort ) +{ + USHORT usVal; + + HB_TRACE(HB_TR_DEBUG, ("hb_Inp9x(%hu)", usPort)); + + #if defined(__BORLANDC__) + _DX = usPort; + __emit__(0xEC); /* ASM IN AL, DX */ + __emit__(0x32,0xE4); /* ASM XOR AH, AH */ + usVal = _AX; + #else + usVal = _inp( usPort ); + #endif + + return usVal; +} + +/* *********************************************************************** */ + +static int hb_Outp9x( USHORT usPort, USHORT usVal ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_Outp9x(%hu, %hu)", usPort, usVal)); + + #if defined(__BORLANDC__) + _DX = usPort; + _AL = usVal; + __emit__(0xEE); /* ASM OUT DX, AL */ + __emit__(0x32,0xE4); /* ASM XOR AH, AH */ + usVal = _AX; + #else + usVal = _outp( usPort, usVal ); + #endif + + return usVal; +} + + +/* *********************************************************************** */ + +static void hb_gt_w9xTone( double dFreq, double dDurat, double dTick ) +{ + INT uLSB,uMSB; + UINT uiValue; + ULONG lAdjFreq; + clock_t end_clock; + + HB_TRACE(HB_TR_DEBUG, ("hb_gt_w9xtone(%lf, %lf, %lf)", dFreq, dDurat, dTick)); + + /* Clipper ignores Tone() requests if Frequency is less than + < 20 hz (and so should we) to maintain compatibility .. */ + + if ( dFreq > 20.0 ) + { + + /* Setup Sound Control Port Registers.. */ + + /* select timer channel 2 */ + + hb_Outp9x(67, 182) ; + + lAdjFreq = (ULONG)( 1193180 / dFreq ) ; + + if( lAdjFreq < 0 ) + uLSB = lAdjFreq + 65536; + else + uLSB = lAdjFreq % 256; + + if( lAdjFreq < 0 ) + uMSB = lAdjFreq + 65536; + else + uMSB = lAdjFreq / 256; + + + /* set the frequency (LSB,MSB) */ + + hb_Outp9x(66, uLSB); + hb_Outp9x(66, uMSB); + + /* Get current Port setting */ + + uiValue = hb_Inp9x( 97 ); + + /* enable Speaker Data & Timer gate bits */ + + uiValue = uiValue | 3; /* 00000011B is bitmask to enable sound */ + + /* Turn on Speaker - sound Tone for duration.. */ + + hb_Outp9x(97, uiValue); + + end_clock = clock() + ( clock_t ) ( dDurat ); + while( clock() < end_clock ) + { + hb_idleState(); + } + hb_idleReset(); + + /* Read back current Port value for Reset */ + + uiValue = hb_Inp9x( 97 ); + + /* disable Speaker Data & Timer gate bits */ + uiValue = uiValue & 0xFC ; + + /* Turn off the Speaker ! */ + + hb_Outp9x(97, uiValue); + + } + + /* Delay (1) clock tick, just like Clipper .. */ + + end_clock = clock() + ( clock_t ) ( dTick ); + while( clock() < end_clock ) + { + hb_idleState(); + } + hb_idleReset(); + +} + +/* *********************************************************************** */ + +static void hb_gt_wNtTone( double dFreq, double dDurat, double dTick ) +{ + clock_t end_clock; + + HB_TRACE(HB_TR_DEBUG, ("hb_gt_wNtTone(%lf, %lf, %lf)", dFreq, dDurat, dTick)); + + /* Clipper ignores Tone() requests if Frequency is less than + < 20 hz (and so should we) to maintain compatibility .. */ + + if ( dFreq > 20.0 ) + { + Beep( (ULONG) dFreq, (ULONG) dDurat ); + } + + /* Delay (1) clock tick, just like Clipper .. */ + + end_clock = clock() + ( clock_t ) ( dTick ); + while( clock() < end_clock ) + { + hb_idleState(); + } + hb_idleReset(); + +} + +/* *********************************************************************** */ + + +void hb_gt_Tone( double dFrequency, double dDuration ) +{ + double dMillisecs; + OSVERSIONINFO osv; + + HB_TRACE(HB_TR_DEBUG, ("hb_gt_Tone(%lf, %lf)", dFrequency, dDuration)); + + /* The conversion from Clipper timer tick units to + milliseconds is * 1000.0 / 18.2. */ + + dDuration = HB_MIN( HB_MAX( 0, dDuration ), ULONG_MAX ); + + if( dDuration > 0 ) + { + + #if defined( _MSC_VER ) + double dTick = (double) ( 1000.0 / CLOCKS_PER_SEC ); + #else + double dTick = (double) ( CLOCKS_PER_SEC / 18.2 ); + #endif + + dMillisecs = dDuration * dTick; /* milliseconds */ + + /* What version of Windows are you running? */ + osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&osv); + + /* If Windows 95 or 98, use w9xTone for BCC32, MSVC */ + if (osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) + { + #if defined(__BORLANDC__) || defined( _MSC_VER ) + hb_gt_w9xTone( HB_MIN( HB_MAX( 0.0, dFrequency ), 32767.0 ), + dMillisecs, dTick ); + #else + hb_gt_wNtTone( HB_MIN( HB_MAX( 0.0, dFrequency ), 32767.0 ), + dMillisecs, dTick ); + #endif + } + + /* If Windows NT or NT2k, use wNtTone, which provides TONE() + reset sequence support (new) */ + else if (osv.dwPlatformId == VER_PLATFORM_WIN32_NT) + { + /* We pass the Millisecond converted value here .. */ + hb_gt_wNtTone( HB_MIN( HB_MAX( 0.0, dFrequency ), 32767.0 ), + dMillisecs, dTick ); + } + } +} + + +/* *********************************************************************** */ diff --git a/harbour/source/rtl/transfrm.c b/harbour/source/rtl/transfrm.c index ee0fa7d5b6..befc202067 100644 --- a/harbour/source/rtl/transfrm.c +++ b/harbour/source/rtl/transfrm.c @@ -669,7 +669,7 @@ HB_FUNC( TRANSFORM ) char szPicDate[ 11 ]; char szDate[ 9 ]; - int nFor; + UINT nFor; szResult = ( char * ) hb_xgrab( 13 ); diff --git a/harbour/source/vm/maindllp.c b/harbour/source/vm/maindllp.c index 388e0a45bd..702f4c042e 100644 --- a/harbour/source/vm/maindllp.c +++ b/harbour/source/vm/maindllp.c @@ -133,8 +133,8 @@ char * hb_parc( int iParam, ... ) else return ( ( EXT_PARC1 ) pParC )( iParam ); } - else - return ""; + + return NULL; } PHB_ITEM hb_param( int iParam, int iMask ) /* retrieve a generic parameter */ @@ -302,8 +302,8 @@ ULONG hb_parclen( int iParam, ... ) /* retrieve a string parameter length */ else return ( ( HB_PARCLEN ) pParC )( iParam ); } - else - return 0; + + return 0; } ULONG hb_parcsiz( int iParam, ... )/* retrieve a by-reference string parameter length, including terminator */ @@ -327,8 +327,8 @@ ULONG hb_parcsiz( int iParam, ... )/* retrieve a by-reference string paramete else return ( ( HB_PARCSIZ ) pParcSiz )( iParam ); } - else - return 0; + + return 0; } char * hb_pards( int iParam, ... ) /* retrieve a date as a string yyyymmdd */ @@ -352,8 +352,8 @@ char * hb_pards( int iParam, ... ) /* retrieve a date as a string yyyymmdd */ else return ( ( HB_PARDS ) pParDs )( iParam ); } - else - return ""; + + return ""; } char * hb_pardsbuff( char * szDate, int iParam, ... ) /* retrieve a date as a string yyyymmdd */ @@ -377,8 +377,8 @@ char * hb_pardsbuff( char * szDate, int iParam, ... ) /* retrieve a date as a st else return ( ( HB_PARDSBUFF ) pParDsBuff )( szDate, iParam ); } - else - return ""; + + return ""; } int hb_parl( int iParam, ... ) /* retrieve a logical parameter as an int */ @@ -403,8 +403,8 @@ int hb_parl( int iParam, ... ) /* retrieve a logical parameter as an int */ else return ( ( HB_PARL ) pParL )( iParam ); } - else - return 0; + + return 0; } double hb_parnd( int iParam, ... ) /* retrieve a numeric parameter as a double */ @@ -429,8 +429,8 @@ double hb_parnd( int iParam, ... ) /* retrieve a numeric parameter as a double * else return ( ( HB_PARND ) pParNd )( iParam ); } - else - return 0; + + return 0; } int hb_parni( int iParam, ... ) /* retrieve a numeric parameter as a integer */ @@ -455,8 +455,8 @@ int hb_parni( int iParam, ... ) /* retrieve a numeric parameter as a integer */ else return ( ( HB_PARNI ) pParNi )( iParam ); } - else - return 0; + + return 0; } long hb_parnl( int iParam, ... ) /* retrieve a numeric parameter as a long */ @@ -481,8 +481,8 @@ long hb_parnl( int iParam, ... ) /* retrieve a numeric parameter as a long */ else return ( ( HB_PARNL ) pParNl )( iParam ); } - else - return 0; + + return 0; } int hb_storc( char * szText, int iParam, ... ) @@ -509,8 +509,6 @@ int hb_storc( char * szText, int iParam, ... ) ( ( HB_STORC ) pStorC )( szText, iParam ); return 1; } - - return 0; } return 0; @@ -541,7 +539,6 @@ int hb_storclen( char * szText, ULONG ulLen, int iParam, ... ) return 1; } - return 0; } return 0; @@ -573,7 +570,6 @@ int hb_stords( char * szDate, int iParam, ... ) return 1; } - return 0; } return 0; @@ -604,7 +600,6 @@ int hb_storl( int iLogical, int iParam, ... ) return 1; } - return 0; } return 0; @@ -635,7 +630,6 @@ int hb_storni( int iValue, int iParam, ... ) return 1; } - return 0; } return 0; @@ -666,7 +660,6 @@ int hb_stornl( long lValue, int iParam, ... ) return 1; } - return 0; } return 0; @@ -697,7 +690,6 @@ int hb_stornd( double dNumber, int iParam, ... ) return 1; } - return 0; } return 0;