From 61c2f3b43deecc96e46f89c0612f5be892057da4 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 16 Oct 2012 14:52:35 +0000 Subject: [PATCH] 2012-10-16 16:50 UTC+0200 Viktor Szakats (harbour syenar.net) - contrib/hbnf/dosver.prg - contrib/hbnf/isshare.prg - contrib/hbnf/mouse2.prg - contrib/hbnf/page.prg - contrib/hbnf/vidmode.prg * contrib/hbnf/at2.prg * contrib/hbnf/blink.prg * contrib/hbnf/byteneg.prg * contrib/hbnf/cntryset.prg * contrib/hbnf/d2e.prg * contrib/hbnf/diskfunc.prg * contrib/hbnf/dispc.c * contrib/hbnf/elapmil.prg * contrib/hbnf/elapsed.prg * contrib/hbnf/findith.prg * contrib/hbnf/floptst.prg * contrib/hbnf/ftint86.c * contrib/hbnf/ftint86.ch * contrib/hbnf/getver.c * contrib/hbnf/getvid.c * contrib/hbnf/hbnf.hbp * contrib/hbnf/hbnf.hbx * contrib/hbnf/hex2dec.prg * contrib/hbnf/madd.prg * contrib/hbnf/menu1.prg * contrib/hbnf/mouse.c * contrib/hbnf/mouse1.prg * contrib/hbnf/nooccur.prg * contrib/hbnf/nwlstat.prg * contrib/hbnf/nwsem.prg * contrib/hbnf/nwuid.prg * contrib/hbnf/rand1.prg * contrib/hbnf/savearr.prg * contrib/hbnf/scregion.prg * contrib/hbnf/sinkey.prg * contrib/hbnf/sleep.prg * contrib/hbnf/tempfile.prg ! FT_MBUTPRS() fixed RTE ! fixed FT_DSKFREE(), also made it work on platform w/o drive letters ! fixed FT_DSKSIZE(), also made it work on platform w/o drive letters ! fixed FT_DOSVER() to return string type on all platforms + rewritten functions to use HB_BIT*() and hex number handling functions + rewritten FT_SLEEP() to use hb_idleSleep() internally % dispc.c rewritten to use hb_gtRectSize( 0, 0, 0, 0, &nSize ) to find out cell size and cleaned code to adapt with minimal redundancy % optimized out several .prg level stubs % using SWITCH, hb_default(), hb_ntos() in some more places * removed some unuseful macros * minor formatting + fixed warnings and errors and enabled mouse1.prg % deleted outdated and duplicate mouse2.prg % deleted lots of MS-DOS specific commented code ! deleted #include for stdlib.h and string.h * include/hbapigt.h * src/rtl/gtapi.c - deleted just added hb_gtIsCompatBuffer(). It's better to use hb_gtRectSize( 0, 0, 0, 0, &nSize ) for this purpose. * contrib/hbformat/hbfmtcls.prg * minor formatting --- harbour/ChangeLog | 63 +++++++ harbour/contrib/hbformat/hbfmtcls.prg | 2 +- harbour/contrib/hbnf/at2.prg | 9 +- harbour/contrib/hbnf/blink.prg | 20 +-- harbour/contrib/hbnf/byteneg.prg | 7 +- harbour/contrib/hbnf/cntryset.prg | 2 +- harbour/contrib/hbnf/d2e.prg | 8 +- harbour/contrib/hbnf/diskfunc.prg | 6 +- harbour/contrib/hbnf/dispc.c | 42 ++--- harbour/contrib/hbnf/dosver.prg | 45 ----- harbour/contrib/hbnf/elapmil.prg | 6 +- harbour/contrib/hbnf/elapsed.prg | 10 +- harbour/contrib/hbnf/findith.prg | 19 +- harbour/contrib/hbnf/floptst.prg | 14 +- harbour/contrib/hbnf/ftint86.c | 4 - harbour/contrib/hbnf/ftint86.ch | 16 +- harbour/contrib/hbnf/getver.c | 13 +- harbour/contrib/hbnf/getvid.c | 16 +- harbour/contrib/hbnf/hbnf.hbp | 9 +- harbour/contrib/hbnf/hbnf.hbx | 17 +- harbour/contrib/hbnf/hex2dec.prg | 10 +- harbour/contrib/hbnf/isshare.prg | 44 ----- harbour/contrib/hbnf/madd.prg | 10 +- harbour/contrib/hbnf/menu1.prg | 2 +- harbour/contrib/hbnf/mouse.c | 22 ++- harbour/contrib/hbnf/mouse1.prg | 236 +++++-------------------- harbour/contrib/hbnf/mouse2.prg | 242 -------------------------- harbour/contrib/hbnf/nooccur.prg | 9 +- harbour/contrib/hbnf/nwlstat.prg | 14 +- harbour/contrib/hbnf/nwsem.prg | 34 ++-- harbour/contrib/hbnf/nwuid.prg | 18 +- harbour/contrib/hbnf/page.prg | 54 ------ harbour/contrib/hbnf/rand1.prg | 1 + harbour/contrib/hbnf/savearr.prg | 19 +- harbour/contrib/hbnf/scregion.prg | 1 + harbour/contrib/hbnf/sinkey.prg | 21 +-- harbour/contrib/hbnf/sleep.prg | 27 +-- harbour/contrib/hbnf/tempfile.prg | 6 +- harbour/contrib/hbnf/vidmode.prg | 57 ------ harbour/include/hbapigt.h | 1 - harbour/src/rtl/gtapi.c | 16 -- 41 files changed, 286 insertions(+), 886 deletions(-) delete mode 100644 harbour/contrib/hbnf/dosver.prg delete mode 100644 harbour/contrib/hbnf/isshare.prg delete mode 100644 harbour/contrib/hbnf/mouse2.prg delete mode 100644 harbour/contrib/hbnf/page.prg delete mode 100644 harbour/contrib/hbnf/vidmode.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1d7a097919..352a24afd7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,69 @@ The license applies to all entries newer than 2009-04-28. */ +2012-10-16 16:50 UTC+0200 Viktor Szakats (harbour syenar.net) + - contrib/hbnf/dosver.prg + - contrib/hbnf/isshare.prg + - contrib/hbnf/mouse2.prg + - contrib/hbnf/page.prg + - contrib/hbnf/vidmode.prg + * contrib/hbnf/at2.prg + * contrib/hbnf/blink.prg + * contrib/hbnf/byteneg.prg + * contrib/hbnf/cntryset.prg + * contrib/hbnf/d2e.prg + * contrib/hbnf/diskfunc.prg + * contrib/hbnf/dispc.c + * contrib/hbnf/elapmil.prg + * contrib/hbnf/elapsed.prg + * contrib/hbnf/findith.prg + * contrib/hbnf/floptst.prg + * contrib/hbnf/ftint86.c + * contrib/hbnf/ftint86.ch + * contrib/hbnf/getver.c + * contrib/hbnf/getvid.c + * contrib/hbnf/hbnf.hbp + * contrib/hbnf/hbnf.hbx + * contrib/hbnf/hex2dec.prg + * contrib/hbnf/madd.prg + * contrib/hbnf/menu1.prg + * contrib/hbnf/mouse.c + * contrib/hbnf/mouse1.prg + * contrib/hbnf/nooccur.prg + * contrib/hbnf/nwlstat.prg + * contrib/hbnf/nwsem.prg + * contrib/hbnf/nwuid.prg + * contrib/hbnf/rand1.prg + * contrib/hbnf/savearr.prg + * contrib/hbnf/scregion.prg + * contrib/hbnf/sinkey.prg + * contrib/hbnf/sleep.prg + * contrib/hbnf/tempfile.prg + ! FT_MBUTPRS() fixed RTE + ! fixed FT_DSKFREE(), also made it work on platform w/o drive letters + ! fixed FT_DSKSIZE(), also made it work on platform w/o drive letters + ! fixed FT_DOSVER() to return string type on all platforms + + rewritten functions to use HB_BIT*() and hex number handling functions + + rewritten FT_SLEEP() to use hb_idleSleep() internally + % dispc.c rewritten to use hb_gtRectSize( 0, 0, 0, 0, &nSize ) to find + out cell size and cleaned code to adapt with minimal redundancy + % optimized out several .prg level stubs + % using SWITCH, hb_default(), hb_ntos() in some more places + * removed some unuseful macros + * minor formatting + + fixed warnings and errors and enabled mouse1.prg + % deleted outdated and duplicate mouse2.prg + % deleted lots of MS-DOS specific commented code + ! deleted #include for stdlib.h and string.h + + * include/hbapigt.h + * src/rtl/gtapi.c + - deleted just added hb_gtIsCompatBuffer(). + It's better to use hb_gtRectSize( 0, 0, 0, 0, &nSize ) for this purpose. + + * contrib/hbformat/hbfmtcls.prg + * minor formatting + 2012-10-16 12:29 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbnf/bitclr.prg * contrib/hbnf/bitset.prg diff --git a/harbour/contrib/hbformat/hbfmtcls.prg b/harbour/contrib/hbformat/hbfmtcls.prg index d466cbdc44..62708c2251 100644 --- a/harbour/contrib/hbformat/hbfmtcls.prg +++ b/harbour/contrib/hbformat/hbfmtcls.prg @@ -840,7 +840,7 @@ METHOD Array2File( cFileName, aFile ) CLASS HBFORMATCODE STATIC FUNCTION rf_AINS( arr, nItem, cItem ) - IF Atail( arr ) != NIL + IF ATail( arr ) != NIL AAdd( arr, NIL ) ENDIF AIns( arr, nItem ) diff --git a/harbour/contrib/hbnf/at2.prg b/harbour/contrib/hbnf/at2.prg index 7e7196ff7d..46eb9742df 100644 --- a/harbour/contrib/hbnf/at2.prg +++ b/harbour/contrib/hbnf/at2.prg @@ -45,10 +45,8 @@ FUNCTION FT_AT2( cSearch, cTarget, nOccurs, lCaseSens ) // Store position of next occurrence of cSearch. IF lCaseSens nPos := At( cSearch, cSubstr ) - ELSE nPos := At( Upper( cSearch ), Upper( cSubstr ) ) - ENDIF // Store position of cSearch relative to original string. @@ -62,7 +60,6 @@ FUNCTION FT_AT2( cSearch, cTarget, nOccurs, lCaseSens ) IF nPos == 0 EXIT ENDIF - NEXT RETURN nPos2 @@ -76,20 +73,26 @@ FUNCTION FT_RAT2( cSearch, cTarget, nOccurs, lCaseSens ) IF lCaseSens == NIL lCaseSens := .T. ENDIF + IF nOccurs == NIL nOccurs := 1 ENDIF + FOR nCount := 1 TO nOccurs + // Store position of next occurrence of cSearch. IF lCaseSens nPos := RAt( cSearch, cSubstr ) ELSE nPos := RAt( Upper( cSearch ), Upper( cSubstr ) ) ENDIF + // Store position of cSearch relative to original string. nPos2 := nPos + // Resize cSubstr cSubstr := SubStr( cSubstr, 1, RAt( cSearch, cSubstr ) - 1 ) + // Breakout if there are no occurences here IF nPos == 0 EXIT diff --git a/harbour/contrib/hbnf/blink.prg b/harbour/contrib/hbnf/blink.prg index 94670d74fc..12fbada60e 100644 --- a/harbour/contrib/hbnf/blink.prg +++ b/harbour/contrib/hbnf/blink.prg @@ -29,17 +29,15 @@ FUNCTION FT_BLINK( cMsg, nRow, nCol ) LOCAL cSavColor - // Return if no msg. - IF cMsg == NIL - RETURN NIL + IF cMsg != NIL + + cSavColor := SetColor() + + // If blink colors not already set, add blink to current foreground color. + hb_DispOutAt( iif( nRow == NIL, Row(), nRow ), ; + iif( nCol == NIL, Col(), nCol ), ; + cMsg, ; + iif( "*" $ Left( cSavColor, 4 ), cSavColor, "*" + cSavColor ) ) ENDIF - cSavColor := SetColor() - - // IF blink colors not already set, add blink to current foreground color. - hb_DispOutAt( iif( nRow == NIL, Row(), nRow ), ; - iif( nCol == NIL, Col(), nCol ), ; - cMsg, ; - iif( "*" $ Left( cSavColor, 4 ), cSavColor, "*" + cSavColor ) ) - RETURN NIL diff --git a/harbour/contrib/hbnf/byteneg.prg b/harbour/contrib/hbnf/byteneg.prg index e7d76bd8db..9f8f2fbbf4 100644 --- a/harbour/contrib/hbnf/byteneg.prg +++ b/harbour/contrib/hbnf/byteneg.prg @@ -24,4 +24,9 @@ */ FUNCTION FT_BYTENEG( cByte ) - RETURN iif( HB_ISSTRING( cByte ), hb_BChar( ( 256 - hb_BCode( cByte ) ) % 256 ), NIL ) + + IF HB_ISSTRING( cByte ) + RETURN hb_BChar( ( 256 - hb_BCode( cByte ) ) % 256 ) + ENDIF + + RETURN NIL diff --git a/harbour/contrib/hbnf/cntryset.prg b/harbour/contrib/hbnf/cntryset.prg index 185ff16e46..15f414dac2 100644 --- a/harbour/contrib/hbnf/cntryset.prg +++ b/harbour/contrib/hbnf/cntryset.prg @@ -26,7 +26,7 @@ FUNCTION FT_SETCENTURY( lNewSetState ) // Note that if CENTURY is ON then - // DTOC() Will Return a String of Length + // DToC() Will Return a String of Length // 10, Otherwise it Will be of Length 8 LOCAL lOldSetState := ( Len( DToC( Date() ) ) == 10 ) diff --git a/harbour/contrib/hbnf/d2e.prg b/harbour/contrib/hbnf/d2e.prg index e1bdc18853..6e89b93b14 100644 --- a/harbour/contrib/hbnf/d2e.prg +++ b/harbour/contrib/hbnf/d2e.prg @@ -23,12 +23,12 @@ * */ -#define log10( num ) Log( num ) / Log( 10 ) +#define log10( num ) ( Log( num ) / Log( 10 ) ) #define DEFAULT_PRECISION 6 FUNCTION ft_d2e( nDec, nPrecision ) - LOCAL nExp, sScn + LOCAL nExp __defaultNIL( @nPrecision, DEFAULT_PRECISION ) @@ -47,6 +47,4 @@ FUNCTION ft_d2e( nDec, nPrecision ) nExp++ ENDIF // another kludge FOR stuff LIKE "999999999" - sScn := LTrim( Str( nDec, nPrecision + 3, nPrecision ) ) - - RETURN sScn + "E" + AllTrim( Str( nExp, 5, 0 ) ) + RETURN LTrim( Str( nDec, nPrecision + 3, nPrecision ) ) + "E" + hb_ntos( nExp ) diff --git a/harbour/contrib/hbnf/diskfunc.prg b/harbour/contrib/hbnf/diskfunc.prg index b50914ae17..e54df2d613 100644 --- a/harbour/contrib/hbnf/diskfunc.prg +++ b/harbour/contrib/hbnf/diskfunc.prg @@ -27,10 +27,8 @@ #include "fileio.ch" -#define DRVTABLE "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - FUNCTION FT_DSKSIZE( cDrive ) - RETURN DiskSpace( iif( cDrive == NIL, 0, At( Upper( cDrive ), DRVTABLE ) ), HB_DISK_TOTAL ) + RETURN hb_DiskSpace( cDrive + hb_osDriveSeparator(), HB_DISK_TOTAL ) FUNCTION FT_DSKFREE( cDrive ) - RETURN DiskSpace( iif( cDrive == NIL, 0, At( Upper( cDrive ), DRVTABLE ) ), HB_DISK_FREE ) + RETURN hb_DiskSpace( cDrive + hb_osDriveSeparator(), HB_DISK_FREE ) diff --git a/harbour/contrib/hbnf/dispc.c b/harbour/contrib/hbnf/dispc.c index 472b76343b..bee48d3e0a 100644 --- a/harbour/contrib/hbnf/dispc.c +++ b/harbour/contrib/hbnf/dispc.c @@ -98,7 +98,7 @@ typedef struct char * buffer; /* file buffer pointer */ char * lbuff; /* line buffer pointer */ HB_UCHAR * vseg; /* video segment variable */ - HB_BOOL fCompatBuffer; /* HB_GTI_COMPATBUFFER setting */ + int iCellSize; /* size of one buffer cell */ } FT_DISPC, * PFT_DISPC; static HB_TSD_NEW( s_dispc, sizeof( FT_DISPC ), NULL, NULL ); @@ -130,21 +130,13 @@ static void chattr( PFT_DISPC dispc, int x, int y, int len, int attr ) /* calc the screen memory coord */ HB_UCHAR * vmem; - /* write the new attribute value */ - if( dispc->fCompatBuffer ) - { - vmem = dispc->vseg + ( y * ( dispc->width + 1 ) * 2 ) + ( x * 2 ) + 1; + vmem = dispc->vseg + ( y * ( dispc->width + 1 ) * dispc->iCellSize ) + ( x * dispc->iCellSize ) + 1; - for( i = 0; i <= len; i++, vmem += 2 ) - *vmem = ( char ) attr; - } - else - { - vmem = dispc->vseg + ( y * ( dispc->width + 1 ) * 4 ) + ( x * 4 ) + 2; + if( dispc->iCellSize == 4 ) + vmem++; - for( i = 0; i <= len; i++, vmem += 4 ) /* write the new attribute value */ - *vmem = ( char ) attr; - } + for( i = 0; i <= len; i++, vmem += dispc->iCellSize ) /* write the new attribute value */ + *vmem = ( char ) attr; } /* @@ -311,10 +303,7 @@ static void disp_update( PFT_DISPC dispc, int offset ) from the line start */ - if( dispc->fCompatBuffer ) - pos = ( line * ( dispc->width + 1 ) * 2 ); - else - pos = ( line * ( dispc->width + 1 ) * 4 ); + pos = ( line * ( dispc->width + 1 ) * dispc->iCellSize ); /* copy string to temp buffer */ @@ -341,12 +330,7 @@ static void disp_update( PFT_DISPC dispc, int offset ) for( i = dispc->wincol, col = 0; col <= dispc->width; col++ ) { - HB_UCHAR * vmem; - - if( dispc->fCompatBuffer ) - vmem = dispc->vseg + pos + ( col * 2 ); - else - vmem = dispc->vseg + pos + ( col * 4 ); + HB_UCHAR * vmem = dispc->vseg + pos + ( col * dispc->iCellSize ); *vmem = dispc->lbuff[ i++ ]; } @@ -517,7 +501,7 @@ HB_FUNC( _FT_DFINIT ) int rval; HB_ISIZ j; HB_ISIZ i; - HB_SIZE ulSize; + HB_SIZE nSize; rval = 0; @@ -529,10 +513,12 @@ HB_FUNC( _FT_DFINIT ) dispc->width = dispc->ecol - dispc->scol; /* calc width of window */ dispc->height = dispc->eline - dispc->sline + 1; /* calc height of window */ - dispc->fCompatBuffer = hb_gtIsCompatBuffer(); + hb_gtRectSize( 0, 0, 0, 0, &nSize ); - hb_gtRectSize( dispc->sline, dispc->scol, dispc->eline, dispc->ecol, &ulSize ); - dispc->vseg = ( HB_UCHAR * ) hb_xalloc( ulSize ); + dispc->iCellSize = ( int ) nSize; + + hb_gtRectSize( dispc->sline, dispc->scol, dispc->eline, dispc->ecol, &nSize ); + dispc->vseg = ( HB_UCHAR * ) hb_xalloc( nSize ); if( dispc->vseg != NULL ) hb_gtSave( dispc->sline, dispc->scol, dispc->eline, dispc->ecol, dispc->vseg ); diff --git a/harbour/contrib/hbnf/dosver.prg b/harbour/contrib/hbnf/dosver.prg deleted file mode 100644 index 39a214860d..0000000000 --- a/harbour/contrib/hbnf/dosver.prg +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id$ - */ - -/* - * Author....: Glenn Scott - * CIS ID....: ? - * - * This is an original work by Glenn Scott and is placed in the - * public domain. - * - * Modification history: - * --------------------- - * - * Rev 1.2 15 Aug 1991 23:02:24 GLENN - * Forest Belt proofread/edited/cleaned up doc - * - * Rev 1.1 12 Jun 1991 02:38:24 GLENN - * Documentation mod and removal of reference to constant INT86_SUCCESS. - * Checked for ft_int86() compatibility. - * - * Rev 1.0 01 Apr 1991 01:01:14 GLENN - * Nanforum Toolkit - * - */ - -#include "ftint86.ch" - -#define DOS 33 -#define DOSVER 48 - -FUNCTION FT_DOSVER() - -// LOCAL aRegs[ INT86_MAX_REGS ] - LOCAL cResult - -/* aRegs[ AX ] := MAKEHI( DOSVER ) - IF FT_INT86( DOS, aRegs ) - cResult := hb_ntos( LOWBYTE( aRegs[ AX ] ) ) + "." + ; - hb_ntos( HIGHBYTE( aRegs[ AX ] ) ) - ENDIF -*/ - cResult := _get_dosver() - - RETURN cResult diff --git a/harbour/contrib/hbnf/elapmil.prg b/harbour/contrib/hbnf/elapmil.prg index 28b785e684..20deb70b8d 100644 --- a/harbour/contrib/hbnf/elapmil.prg +++ b/harbour/contrib/hbnf/elapmil.prg @@ -23,7 +23,7 @@ * */ -FUNCTION FT_ELAPMIN( cTIME1, cTIME2 ) +FUNCTION FT_ELAPMIN( cTime1, cTime2 ) - RETURN ( ( Val( Left( cTIME2, 2 ) ) * 60 ) + ( Val( Right( cTIME2, 2 ) ) ) ) - ; - ( ( Val( Left( cTIME1, 2 ) ) * 60 ) + ( Val( Right( cTIME1, 2 ) ) ) ) + RETURN ( ( Val( Left( cTime2, 2 ) ) * 60 ) + ( Val( Right( cTime2, 2 ) ) ) ) - ; + ( ( Val( Left( cTime1, 2 ) ) * 60 ) + ( Val( Right( cTime1, 2 ) ) ) ) diff --git a/harbour/contrib/hbnf/elapsed.prg b/harbour/contrib/hbnf/elapsed.prg index 49fced7f0c..99b046676d 100644 --- a/harbour/contrib/hbnf/elapsed.prg +++ b/harbour/contrib/hbnf/elapsed.prg @@ -28,7 +28,7 @@ FUNCTION FT_ELAPSED( dStart, dEnd, cTimeStart, cTimeEnd ) - LOCAL nTotalSec, nCtr, nConstant, nTemp, aRetVal[ 4, 2 ] + LOCAL nTotalSec, nCtr, nConstant, nTemp, aRetVal[ 4 ][ 2 ] IF HB_ISSTRING( dStart ) cTimeStart := dStart @@ -51,7 +51,7 @@ FUNCTION FT_ELAPSED( dStart, dEnd, cTimeStart, cTimeEnd ) cTimeEnd := "00:00:00" ENDIF - nTotalSec := ( dEnd - dStart ) * 86400 + ; + nTotalSec := ( dEnd - dStart ) * 86400 + ; Val( cTimeEnd ) * 3600 + ; Val( SubStr( cTimeEnd, At( ":", cTimeEnd ) + 1, 2 ) ) * 60 + ; iif( RAt( ":", cTimeEnd ) == At( ":", cTimeEnd ), 0, ; @@ -65,9 +65,9 @@ FUNCTION FT_ELAPSED( dStart, dEnd, cTimeStart, cTimeEnd ) FOR nCtr := 1 TO 4 nConstant := iif( nCtr == 1, 86400, iif( nCtr == 2, 3600, iif( nCtr == 3, 60, 1 ) ) ) - aRetVal[ nCtr, 1 ] := Int( nTemp / nConstant ) - aRetval[ nCtr, 2 ] := nTotalSec / nConstant - nTemp -= aRetVal[ nCtr, 1 ] * nConstant + aRetVal[ nCtr ][ 1 ] := Int( nTemp / nConstant ) + aRetval[ nCtr ][ 2 ] := nTotalSec / nConstant + nTemp -= aRetVal[ nCtr ][ 1 ] * nConstant NEXT RETURN aRetVal diff --git a/harbour/contrib/hbnf/findith.prg b/harbour/contrib/hbnf/findith.prg index 91d15c55be..919543a418 100644 --- a/harbour/contrib/hbnf/findith.prg +++ b/harbour/contrib/hbnf/findith.prg @@ -23,28 +23,21 @@ * */ -#define MAKE_UPPER( cString ) ( cString := UPPER( cString ) ) -#define NULL "" - FUNCTION FT_FINDITH( cCheckFor, cCheckIn, nWhichOccurrence, lIgnoreCase ) LOCAL nIthOccurrence - // Is Case Sensitivity Important?? - IF ! HB_ISLOGICAL( lIgnoreCase ) .OR. ; - lIgnoreCase - - MAKE_UPPER( cCheckFor ) // No, Force Everything to Uppercase - MAKE_UPPER( cCheckIn ) - - ENDIF // IS_NOT_LOGICAL(lIgnoreCase) or - // lIgnoreCase + // Is Case Important?? + IF ! HB_ISLOGICAL( lIgnoreCase ) .OR. lIgnoreCase + cCheckFor := Upper( cCheckFor ) + cCheckIn := Upper( cCheckIn ) + ENDIF RETURN iif( nWhichOccurrence == 1, ; At( cCheckFor, cCheckIn ), ; iif( ( nIthOccurrence := At( cCheckFor, ; StrTran( cCheckIn, cCheckFor, ; - NULL, 1, ; + "", 1, ; nWhichOccurrence - 1 ) ) ) == 0, ; 0, ; nIthOccurrence + ( ( nWhichOccurrence - 1 ) * Len( cCheckFor ) ) ) ) diff --git a/harbour/contrib/hbnf/floptst.prg b/harbour/contrib/hbnf/floptst.prg index 0cc58a16de..b1d4e58a17 100644 --- a/harbour/contrib/hbnf/floptst.prg +++ b/harbour/contrib/hbnf/floptst.prg @@ -96,7 +96,7 @@ STATIC FUNCTION _GetDisketteNum( nDrive_i ) // drive number to query status lRetCode := .F. IF FT_INT86( 1 * 16 + 1, aRegs ) // INT for equipment determination - nByte := lowbyte( aRegs[ AX ] ) + nByte := LOWBYTE( aRegs[ AX ] ) // bit 0 indicates floppy drive installed IF Int( nByte / 2 ) * 2 != nByte // is it odd i.e. is bit 0 set?? // bits 6 & 7 indicate number of floppies installed upto 4. @@ -138,7 +138,7 @@ STATIC FUNCTION _ReadBootSector( ; aRegs[ CX ] := 1 // CH = 0 track 0, CL=1 sector 1 aRegs[ BX ] := REG_ES // buffer in ES:BX aRegs[ ES ] := cBuffer - aRegs[ AX ] := makehi( 2 ) + 1 // AH = 02 read, AL=1 read one sector + aRegs[ AX ] := MAKEHI( 2 ) + 1 // AH = 02 read, AL=1 read one sector lSuccess := _CallInt13hRetry( aRegs, @lCarryFlag, @nErrorCode ) @@ -163,7 +163,7 @@ STATIC FUNCTION _WriteBootSector( ; aRegs[ CX ] := 1 // CH = 0 track 0, CL=1 sector 1 aRegs[ BX ] := REG_ES // buffer in ES:BX aRegs[ ES ] := cBuffer_i - aRegs[ AX ] := makehi( 3 ) + 1 // AH = 03 write, AL=1 read one sector + aRegs[ AX ] := MAKEHI( 3 ) + 1 // AH = 03 write, AL=1 read one sector lSuccess := _CallInt13hRetry( aRegs, @lCarryFlag, @nErrorCode ) @@ -186,19 +186,19 @@ STATIC FUNCTION _CallInt13hRetry( ; // logical: did the interrupt succeed? aRegisters := AClone( aRegs_io ) lSuccess := FT_INT86( nInterrupt_c, aRegisters ) IF lSuccess - lCarrySet := carrySet( aRegisters[ FLAGS ] ) + lCarrySet := CARRYSET( aRegisters[ FLAGS ] ) IF lCarrySet _ResetDisketteSystem() aRegisters := AClone( aRegs_io ) FT_INT86( nInterrupt_c, aRegisters ) - lCarrySet := carrySet( aRegisters[ FLAGS ] ) + lCarrySet := CARRYSET( aRegisters[ FLAGS ] ) IF lCarrySet _ResetDisketteSystem() aRegisters := AClone( aRegs_io ) FT_INT86( nInterrupt_c, aRegisters ) - lCarrySet := carrySet( aRegisters[ FLAGS ] ) + lCarrySet := CARRYSET( aRegisters[ FLAGS ] ) IF lCarrySet _ResetDisketteSystem() ENDIF @@ -211,6 +211,6 @@ STATIC FUNCTION _CallInt13hRetry( ; // logical: did the interrupt succeed? aRegs_io[ i ] := aRegisters[ i ] NEXT lCarrySet_o := lCarrySet - nDriveStatus_o := highByte( aRegisters[ AX ] ) + nDriveStatus_o := HIGHBYTE( aRegisters[ AX ] ) RETURN lSuccess diff --git a/harbour/contrib/hbnf/ftint86.c b/harbour/contrib/hbnf/ftint86.c index 398b7a4aba..9e529a4cbe 100644 --- a/harbour/contrib/hbnf/ftint86.c +++ b/harbour/contrib/hbnf/ftint86.c @@ -11,7 +11,3 @@ HB_FUNC( FT_INT86 ) #if defined( HB_OS_DOS ) #endif } - -HB_FUNC( _FT_SETVPG ) -{ -} diff --git a/harbour/contrib/hbnf/ftint86.ch b/harbour/contrib/hbnf/ftint86.ch index bffbbb6e6b..223abccb3f 100644 --- a/harbour/contrib/hbnf/ftint86.ch +++ b/harbour/contrib/hbnf/ftint86.ch @@ -14,15 +14,15 @@ * --------------------- * * Rev 1.5 07 Jan 1993 08:01:04 GLENN - * We forgot to escape the less-than symbols in the highbyte() and - * lowbyte() #translates. + * We forgot to escape the less-than symbols in the HIGHBYTE() and + * LOWBYTE() #translates. * * Rev 1.4 31 Dec 1992 21:35:46 GLENN * Some typos made it into the most recent version of ftint86, - * particularly within the highbyte() macro. This has been fixed. + * particularly within the HIGHBYTE() macro. This has been fixed. * * Rev 1.3 01 Jul 1992 01:00:52 GLENN - * Rodgers Moore submitted some fixes to the highbyte() and lowbyte() + * Rodgers Moore submitted some fixes to the HIGHBYTE() and LOWBYTE() * macros that take negative numbers into account. Ted Means and * Glenn Scott added #defines for the Flag registers. General cleanup * of formatting, etc. @@ -66,11 +66,11 @@ #define FLAG_DIR 10 // Direction flag #define FLAG_OFLOW 11 // Overflow flag -#translate makehi( ) => ( ( ) * 256 ) +#translate MAKEHI( ) => ( ( ) * 256 ) #translate REG_DS => .T. #translate REG_ES => .F. -#translate highbyte( ) => ( int( iif( () \< 0, 65536 + (), () ) / 256 ) ) -#translate lowbyte( ) => ( iif( () \< 0, 65536 + (), () ) % 256 ) -#translate carrySet( ) => ( hb_bitTest( , FLAG_CARRY ) ) +#translate HIGHBYTE( ) => ( Int( iif( ( ) \< 0, 65536 + ( ), ( ) ) / 256 ) ) +#translate LOWBYTE( ) => ( iif( ( ) \< 0, 65536 + ( ), ( ) ) % 256 ) +#translate CARRYSET( ) => ( hb_bitTest( , FLAG_CARRY ) ) #endif // __FTINT86_CH__ diff --git a/harbour/contrib/hbnf/getver.c b/harbour/contrib/hbnf/getver.c index 07147ae97d..f93f399544 100644 --- a/harbour/contrib/hbnf/getver.c +++ b/harbour/contrib/hbnf/getver.c @@ -53,13 +53,12 @@ #include "hbapi.h" #include "hbapiitm.h" + #if defined( HB_OS_DOS ) # include "dos.h" #endif -#include "string.h" -#include "stdlib.h" -HB_FUNC( _GET_DOSVER ) +HB_FUNC( FT_DOSVER ) { #if defined( HB_OS_DOS ) { @@ -74,10 +73,12 @@ HB_FUNC( _GET_DOSVER ) hb_retc_buffer( pszPlatform ); } +#else + hb_retc_null(); #endif } -HB_FUNC( _FT_ISSHARE ) +HB_FUNC( FT_ISSHARE ) { int iShare; @@ -116,7 +117,7 @@ HB_FUNC( _FT_NWKSTAT ) hb_retni( iConnect ); } -HB_FUNC( _FT_SETMODE ) +HB_FUNC( FT_SETMODE ) { #if defined( HB_OS_DOS ) { @@ -128,7 +129,7 @@ HB_FUNC( _FT_SETMODE ) #endif } -HB_FUNC( _FT_GETMODE ) +HB_FUNC( FT_GETMODE ) { int iMode; diff --git a/harbour/contrib/hbnf/getvid.c b/harbour/contrib/hbnf/getvid.c index a25fb949f5..520f750641 100644 --- a/harbour/contrib/hbnf/getvid.c +++ b/harbour/contrib/hbnf/getvid.c @@ -52,20 +52,21 @@ */ #include "hbapi.h" + #if defined( HB_OS_DOS ) # include "dos.h" #endif -HB_FUNC( _FT_GETVPG ) +HB_FUNC( FT_GETVPG ) { int iPage; #if defined( HB_OS_DOS ) { union REGS registers; - registers.h.ah = 0x0F; + registers.h.ah = 15; HB_DOS_INT86( 0x10, ®isters, ®isters ); - iPage = registers.h.bh; + iPage = registers.h.bh; } #else { @@ -76,14 +77,13 @@ HB_FUNC( _FT_GETVPG ) hb_retni( iPage ); } -HB_FUNC( _V_SETVPG ) +HB_FUNC( FT_SETVPG ) { #if defined( HB_OS_DOS ) { - int iPage; - union REGS registers; - iPage = hb_parni( 1 ); - registers.h.ah = 0x05; + int iPage = hb_parni( 1 ); + union REGS registers; + registers.h.ah = 5; registers.h.al = iPage; HB_DOS_INT86( 0x10, ®isters, ®isters ); } diff --git a/harbour/contrib/hbnf/hbnf.hbp b/harbour/contrib/hbnf/hbnf.hbp index 2b33a015e3..b605a03295 100644 --- a/harbour/contrib/hbnf/hbnf.hbp +++ b/harbour/contrib/hbnf/hbnf.hbp @@ -87,7 +87,6 @@ dectobin.prg dfile.prg diskfunc.prg dispmsg.prg -dosver.prg e2d.prg easter.prg elapmil.prg @@ -101,7 +100,6 @@ hex2dec.prg invclr.prg isbit.prg isbiton.prg -isshare.prg lastday.prg linked.prg madd.prg @@ -111,7 +109,7 @@ metaph.prg miltime.prg min2dhm.prg month.prg -mouse2.prg +mouse1.prg netpv.prg nooccur.prg ntow.prg @@ -119,7 +117,6 @@ nwlstat.prg nwsem.prg nwuid.prg ontick.prg -page.prg pchr.prg pegs.prg pending.prg @@ -145,13 +142,9 @@ tbwhile.prg tempfile.prg vertmenu.prg vidcur.prg -vidmode.prg wda.prg week.prg workdays.prg woy.prg xbox.prg year.prg - -# BAD_PRG_SOURCES -#mouse1.prg diff --git a/harbour/contrib/hbnf/hbnf.hbx b/harbour/contrib/hbnf/hbnf.hbx index 0c4cd4a253..c071d6471f 100644 --- a/harbour/contrib/hbnf/hbnf.hbx +++ b/harbour/contrib/hbnf/hbnf.hbx @@ -124,13 +124,18 @@ DYNAMIC FT_LINKED DYNAMIC FT_MADD DYNAMIC FT_MBUTPRS DYNAMIC FT_MBUTREL +DYNAMIC FT_MCONOFF DYNAMIC FT_MCURSOR +DYNAMIC FT_MDBLCLK +DYNAMIC FT_MDEFCRS DYNAMIC FT_MENU1 DYNAMIC FT_MENU2 DYNAMIC FT_MENUTO DYNAMIC FT_METAPH DYNAMIC FT_MGETCOORD +DYNAMIC FT_MGETPAGE DYNAMIC FT_MGETPOS +DYNAMIC FT_MGETSENS DYNAMIC FT_MGETX DYNAMIC FT_MGETY DYNAMIC FT_MHIDECRS @@ -139,12 +144,17 @@ DYNAMIC FT_MIL2MIN DYNAMIC FT_MIN2DHM DYNAMIC FT_MIN2MIL DYNAMIC FT_MINIT +DYNAMIC FT_MINREGION DYNAMIC FT_MKDIR +DYNAMIC FT_MMICKEYS DYNAMIC FT_MONTH DYNAMIC FT_MRESET DYNAMIC FT_MSETCOORD +DYNAMIC FT_MSETPAGE DYNAMIC FT_MSETPOS +DYNAMIC FT_MSETSENS DYNAMIC FT_MSHOWCRS +DYNAMIC FT_MVERSION DYNAMIC FT_MXLIMIT DYNAMIC FT_MYLIMIT DYNAMIC FT_N2COLOR @@ -216,14 +226,8 @@ DYNAMIC FT_YEAR DYNAMIC _FTADDERTAPEUDF DYNAMIC _FT_DFCLOS DYNAMIC _FT_DFINIT -DYNAMIC _FT_GETMODE -DYNAMIC _FT_GETVPG -DYNAMIC _FT_ISSHARE DYNAMIC _FT_NWKSTAT -DYNAMIC _FT_SETMODE -DYNAMIC _FT_SETVPG DYNAMIC _FT_TEMPFIL -DYNAMIC _GET_DOSVER DYNAMIC _MGET_DOUBLESPEED DYNAMIC _MGET_HORISPEED DYNAMIC _MGET_MICS @@ -247,7 +251,6 @@ DYNAMIC _M_MSETPOS DYNAMIC _M_MXLIMIT DYNAMIC _M_MYLIMIT DYNAMIC _M_RESET -DYNAMIC _V_SETVPG DYNAMIC __FTACUDF #if defined( __HBEXTREQ__ ) .OR. defined( __HBEXTERN__HBNF__REQUEST ) diff --git a/harbour/contrib/hbnf/hex2dec.prg b/harbour/contrib/hbnf/hex2dec.prg index 7833bdb11d..1b8a8f9722 100644 --- a/harbour/contrib/hbnf/hex2dec.prg +++ b/harbour/contrib/hbnf/hex2dec.prg @@ -27,12 +27,4 @@ */ FUNCTION FT_HEX2DEC( cHexNum ) - - LOCAL n, nDec := 0, nHexPower := 1 - - FOR n := Len( cHexNum ) TO 1 STEP -1 - nDec += ( At( SubStr( Upper( cHexNum ), n, 1 ), "0123456789ABCDEF" ) - 1 ) * nHexPower - nHexPower *= 16 - NEXT - - RETURN nDec + RETURN hb_HexToNum( cHexNum ) diff --git a/harbour/contrib/hbnf/isshare.prg b/harbour/contrib/hbnf/isshare.prg deleted file mode 100644 index 8e75e93a94..0000000000 --- a/harbour/contrib/hbnf/isshare.prg +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id$ - */ - -/* - * Author....: Glenn Scott (from Tom Leylan C source) - * CIS ID....: ? - * - * This is an original work by tom leylan and is placed in the - * public domain. - * - * Modification history: - * --------------------- - * - * Rev 1.3 15 Aug 1991 23:03:48 GLENN - * Forest Belt proofread/edited/cleaned up doc - * - * Rev 1.2 14 Jun 1991 19:52:06 GLENN - * Minor edit to file header - * - * Rev 1.1 12 Jun 1991 02:14:56 GLENN - * Documentation adjustment and checking ft_int86() call for compatibility - * with new return value. - * - * Rev 1.0 01 Apr 1991 01:01:34 GLENN - * Nanforum Toolkit - * - */ - -#include "ftint86.ch" - -FUNCTION ft_isshare() - /* - LOCAL aRegs[ INT86_MAX_REGS ] // Declare the register array - - aRegs[ AX ] := makehi( 16 ) // share service - aRegs[ CX ] := 0 // Specify file attribute - - FT_Int86( 47, aRegs) // multiplex interrupt - - RETURN lowbyte( aRegs[ AX ] ) - */ - - RETURN _ft_isshare() diff --git a/harbour/contrib/hbnf/madd.prg b/harbour/contrib/hbnf/madd.prg index 0df82d437b..d408907bec 100644 --- a/harbour/contrib/hbnf/madd.prg +++ b/harbour/contrib/hbnf/madd.prg @@ -30,15 +30,15 @@ FUNCTION FT_MADD( dGivenDate, nAddMonths, lMakeEOM ) LOCAL nAdjDay, dTemp, i - IF ! HB_ISDATE( dGivenDate ); dGivenDate := Date() ; ENDIF - IF ! HB_ISNUMERIC( nAddMonths ); nAddMonths := 0 ; ENDIF - IF ! HB_ISLOGICAL( lMakeEOM ); lMakeEom := .F. ; ENDIF + hb_default( @dGivenDate, Date() ) + hb_default( @nAddMonths, 0 ) + hb_default( @lMakeEOM, .F. ) nAdjDay := Day( dGivenDate ) - 1 /* If givendate is end of month and lMakeEom, then force EOM.*/ - lMakeEom := ( lMakeEom .AND. dGivenDate == dGivenDate - nAdjDay + 31 - ; + lMakeEom := ( lMakeEom .AND. dGivenDate == dGivenDate - nAdjDay + 31 - ; Day( dGivenDate - nAdjDay + 31 ) ) dTemp := dGivenDate - nAdjDay // first of month @@ -52,7 +52,7 @@ FUNCTION FT_MADD( dGivenDate, nAddMonths, lMakeEOM ) IF lMakeEom dTemp += 31 - Day( dTemp + 31 ) ELSE - dTemp := Min( ( dTemp + nAdjday ), ( dTemp += 31 - Day( dTemp + 31 ) ) ) + dTemp := Min( dTemp + nAdjday, ( dTemp += 31 - Day( dTemp + 31 ) ) ) ENDIF RETURN dTemp diff --git a/harbour/contrib/hbnf/menu1.prg b/harbour/contrib/hbnf/menu1.prg index 4c4ce19ec4..c60066d3b6 100644 --- a/harbour/contrib/hbnf/menu1.prg +++ b/harbour/contrib/hbnf/menu1.prg @@ -117,7 +117,7 @@ FUNCTION FT_MENU1( aBar, aOptions, aColors, nTopRow, lShadow ) // this is the routine that calculates the position of each item // on the menu bar. - aBarCol[1] := 0 + aBarCol[ 1 ] := 0 nTtlUsed := Len( aBar[ 1 ] ) + 1 AEval( aBar, ; {| x, i | HB_SYMBOL_UNUSED( x ), aBarcol[ i ] := nTtlUsed, nTtlUsed += ( Len( aBar[ i ] ) + 1 ) }, ; diff --git a/harbour/contrib/hbnf/mouse.c b/harbour/contrib/hbnf/mouse.c index 0b983f65be..14c97a2df5 100644 --- a/harbour/contrib/hbnf/mouse.c +++ b/harbour/contrib/hbnf/mouse.c @@ -52,11 +52,12 @@ */ #include "hbapi.h" +#include "hbapigt.h" +#include "hbapiitm.h" + #if defined( HB_OS_DOS ) # include "dos.h" #endif -#include "hbapiitm.h" -#include "hbapigt.h" HB_FUNC( _MGET_PAGE ) { @@ -74,6 +75,7 @@ HB_FUNC( _MGET_PAGE ) iPage = 0; } #endif + hb_retni( iPage ); } @@ -145,6 +147,7 @@ HB_FUNC( _MGET_HORISPEED ) iSpeed = 0; } #endif + hb_retni( iSpeed ); } @@ -164,6 +167,7 @@ HB_FUNC( _MGET_VERSPEED ) iSpeed = 0; } #endif + hb_retni( iSpeed ); } @@ -183,6 +187,7 @@ HB_FUNC( _MGET_DOUBLESPEED ) iSpeed = 0; } #endif + hb_retni( iSpeed ); } @@ -246,23 +251,22 @@ HB_FUNC( _MGET_MICS ) HB_FUNC( _M_RESET ) { - int iMouse; + HB_BOOL fMouse; #if defined( HB_OS_DOS ) { union REGS regs; regs.HB_XREGS.ax = 0; HB_DOS_INT86( 0x33, ®s, ®s ); - iMouse = regs.HB_XREGS.ax; + fMouse = regs.HB_XREGS.ax != 0; } #else { - iMouse = 0; + fMouse = HB_FALSE; } #endif - { - hb_retl( iMouse ); - } + + hb_retl( fMouse ); } HB_FUNC( _MSE_SHOWCURS ) @@ -332,6 +336,7 @@ HB_FUNC( _M_GETX ) iRow = 0; } #endif + hb_retni( iRow ); } @@ -351,6 +356,7 @@ HB_FUNC( _M_GETY ) iCol = 0; } #endif + hb_retni( iCol ); } diff --git a/harbour/contrib/hbnf/mouse1.prg b/harbour/contrib/hbnf/mouse1.prg index 0fa205c0ba..e125f778f7 100644 --- a/harbour/contrib/hbnf/mouse1.prg +++ b/harbour/contrib/hbnf/mouse1.prg @@ -5,17 +5,12 @@ THREAD STATIC t_lCrsState := .F. THREAD STATIC t_lMinit := .F. -FUNCTION FT_MMICKEYS( nX, nY ) // read mouse motion counters -/* - aReg[ AX ] := 11 // set mouse function call 11 - FT_INT86( 51, aReg ) // execute mouse interrupt - */ +FUNCTION FT_MMICKEYS( /* @ */ nX, /* @ */ nY ) // read mouse motion counters - LOCAL areturn + LOCAL aReturn := _mget_mics() - areturn := _mget_mics() - nX := areturn[ 1 ] // store horizontal motion units - nY := areturn[ 2 ] // store vertical motion units + nX := aReturn[ 1 ] // store horizontal motion units + nY := aReturn[ 2 ] // store vertical motion units RETURN NIL // no function output @@ -108,23 +103,14 @@ FUNCTION FT_MDBLCLK( nClick, nButton, nInterval, nRow, nCol, nStart ) FUNCTION FT_MCONOFF( nTop, nLeft, nBottom, nRight ) - // Fill the registers - -/* - aReg[ AX ] := 16 - aReg[ DX ] := nTop * 8 - aReg[ CX ] := nLeft * 8 - aReg[ DI ] := nBottom * 8 - aReg[ SI ] := nRight * 8 - FT_INT86( 51, aReg ) // execute mouse interrupt -*/ _mse_conoff( nTop * 8, nLeft * 8, nBottom * 8, nRight * 8 ) RETURN NIL FUNCTION FT_MINREGION( nTR, nLC, nBR, nRC ) - RETURN FT_MGETX() >= nTR .AND. FT_MGETX() <= nBR .AND. ; + RETURN ; + FT_MGETX() >= nTR .AND. FT_MGETX() <= nBR .AND. ; FT_MGETY() >= nLC .AND. FT_MGETY() <= nRC FUNCTION FT_MSETSENS( nHoriz, nVert, nDouble ) @@ -154,19 +140,7 @@ FUNCTION FT_MSETSENS( nHoriz, nVert, nDouble ) RETURN NIL -FUNCTION FT_MGETSENS( nHoriz, nVert, nDouble ) -/* - // Fill the register - - aReg[ AX ] := 27 - - // Execute interupt - - FT_INT86( 51, aReg ) // execute mouse interrupt - -*/ - - // Set the return values +FUNCTION FT_MGETSENS( /* @ */ nHoriz, /* @ */ nVert, /* @ */ nDouble ) nHoriz := _mget_horispeed() nVert := _mget_verspeed() @@ -174,55 +148,22 @@ FUNCTION FT_MGETSENS( nHoriz, nVert, nDouble ) RETURN NIL -FUNCTION FT_MVERSION( nMinor, nType, nIRQ ) +FUNCTION FT_MVERSION( /* @ */ nMinor, /* @ */ nType, /* @ */ nIRQ ) - LOCAL aReturn + LOCAL aReturn := _mget_mversion() - // Set up register -/* - aReg[ AX ] := 36 + nMinor := aReturn[ 1 ] + nType := aReturn[ 2 ] + nIRQ := aReturn[ 3 ] - // Call interupt - - FT_INT86( 51, aReg) -*/ - // decode out of half registers - areturn := _mget_mversion() - - nMinor := areturn[ 1 ] - nType := areturn[ 2 ] - nIRQ := areturn[ 3 ] - - // Return - - RETURN areturn[ 4 ] + RETURN aReturn[ 4 ] FUNCTION FT_MSETPAGE( nPage ) - // Set up register -/* - aReg[ AX ] := 29 - aReg[ BX ] := nPage - - // Call interupt - - FT_INT86( 51, aReg) -*/ - _mset_page( nPage ) - - RETURN NIL + RETURN _mset_page( nPage ) FUNCTION FT_MGETPAGE() - // Set up register -/* - aReg[ AX ] := 30 - - // Call interupt - - FT_INT86( 51, aReg) -*/ - RETURN _mget_page() FUNCTION FT_MINIT() @@ -243,10 +184,6 @@ FUNCTION FT_MINIT() FUNCTION FT_MRESET() LOCAL lStatus -/* - aReg[ AX ] := 0 // set mouse function call 0 - FT_INT86( 51, aReg ) // execute mouse interrupt -*/ t_lCrsState := .F. // Cursor is off after reset lStatus := _m_reset() @@ -272,169 +209,84 @@ FUNCTION FT_MCURSOR( lState ) RETURN lSavState FUNCTION FT_MSHOWCRS() -/* - aReg[ AX ] := 1 // set mouse function call 1 - FT_INT86( 51, aReg ) // execute mouse interrupt -*/ _mse_showcurs() + t_lCrsState := .T. RETURN NIL // no output from function FUNCTION FT_MHIDECRS() // decrement internal cursor flag and hide cursor -/* - aReg[ AX ] := 2 // set mouse function call 2 - FT_INT86( 51, aReg ) // execute mouse interrupt -*/ _mse_mhidecrs() + t_lCrsState := .F. RETURN NIL // no output from function -FUNCTION FT_MGETPOS( nX, nY ) +FUNCTION FT_MGETPOS( /* @ */ nX, /* @ */ nY ) - LOCAL amse + LOCAL aReturn := _mse_getpos() - nX := iif( nX == NIL, 0, nX ) - nY := iif( nY == NIL, 0, nY ) -/* - aReg[ AX ] := 3 // set mouse function call 3 - FT_INT86( 51, aReg ) // execute mouse interrupt -*/ - amse := _mse_getpos() + nX := aReturn[ 1 ] // store new x-coordinate + nY := aReturn[ 2 ] // store new y-coordinate - nX := amse[1] // store new x-coordinate - nY := amse[2] // store new y-coordinate - - RETURN amse[3] // return button status + RETURN aReturn[ 3 ] // return button status FUNCTION FT_MGETX() - // Duplicated code from FT_MGETPOS() for speed reasons -/* - aReg[ AX ] := 3 // set mouse function call 3 - FT_INT86( 51, aReg ) // execute mouse interrupt -*/ - RETURN _m_getx() / 8 // return x-coordinate FUNCTION FT_MGETY() -// Duplicated code from FT_MGETPOS() for speed reasons - /* - aReg[ AX ] := 3 // set mouse function call 3 - FT_INT86( 51, aReg ) // execute mouse interrupt - */ - RETURN _m_gety() / 8 // return y-coordinate FUNCTION FT_MSETPOS( nX, nY ) // set mouse cursor location -/* - aReg[ AX ] := 4 // set mouse function call 4 - aReg[ CX ] := nY // assign new x-coordinate - aReg[ DX ] := nX // assign new y-coordinate - FT_INT86( 51, aReg ) // execute mouse interrupt -*/ - _m_msetpos( nY, nX ) - - RETURN NIL // no function output + RETURN _m_msetpos( nY, nX ) FUNCTION FT_MSETCOORD( nX, nY ) // set mouse cursor location -/* - aReg[ AX ] := 4 // set mouse function call 4 - aReg[ CX ] := nY*8 // assign new x-coordinate - aReg[ DX ] := nX*8 // assign new y-coordinate - FT_INT86( 51, aReg ) // execute mouse interrupt -*/ - _m_MSETCOORD( nY * 8, nX * 8 ) - - RETURN NIL // no function output + RETURN _m_MSETCOORD( nY * 8, nX * 8 ) FUNCTION FT_MXLIMIT( nXMin, nXMax ) // set vertical minimum and maximum coordinates -/* - aReg[ AX ] := 7 // set mouse function call 7 - aReg[ CX ] := nXMin // load vertical minimum parameter - aReg[ DX ] := nXMax // load vertical maximum parameter - FT_INT86( 51, aReg ) // execute mouse interrupt -*/ - _m_mxlimit( nXMin, nXMAX ) - - RETURN NIL + RETURN _m_mxlimit( nXMin, nXMAX ) FUNCTION FT_MYLIMIT( nYMin, nYMax ) // set horizontal minimum and maximum coordinates -/* - aReg[ AX ] := 8 // set mouse function call 8 - aReg[ CX ] := nYMin // load horz minimum parameter - aReg[ DX ] := nYMax // load horz maximum parameter - FT_INT86( 51, aReg ) // execute mouse interrupt -*/ - _m_mYlimit( nYMin, nYMAX ) + RETURN _m_mYlimit( nYMin, nYMAX ) - RETURN NIL // no function output +FUNCTION FT_MBUTPRS( nButton, /* @ */ nButPrs, /* @ */ nX, /* @ */ nY ) // get button press information -FUNCTION FT_MBUTPRS( nButton, nButPrs, nX, nY ) // get button press information + LOCAL aReturn := _m_MBUTPRS( nButton ) - LOCAL aReg := {} -/* - aReg[ AX ] := 5 // set mouse function call 5 - aReg[ BX ] := nButton // pass parameter for left or right button - FT_INT86( 51, aReg ) // execute mouse interrupt -*/ + nButPrs := aReturn[ 1 ] // store updated press count + nX := aReturn[ 2 ] // x-coordinate at last press + nY := aReturn[ 3 ] // y-coordinate at last press - nButPrs := aReg[ 1 ] // store updated press count - nX := aReg[ 2 ] // x-coordinate at last press - nY := aReg[ 3 ] // y-coordinate at last press + RETURN aReturn[ 4 ] // return button status - _m_MBUTPRS( nButton ) +FUNCTION FT_MBUTREL( nButton, /* @ */ nButRel, /* @ */ nX, /* @ */ nY ) // get button release information - RETURN aReg[4 ] // return button status + LOCAL aReturn := _m_MBUTREL( nButton ) -FUNCTION FT_MBUTREL( nButton, nButRel, nX, nY ) // get button release information + nButRel := aReturn[ 1 ] // store updated release count + nX := aReturn[ 2 ] // x-coordinate at last release + nY := aReturn[ 3 ] // y-coordinate at last release - LOCAL areg - LOCAL iButton - - areg := _m_MBUTREL( nButton ) - nButRel := aReg[ 1 ] // store updated release count - nX := aReg[ 2 ] // x-coordinate at last release - nY := aReg[ 3 ] // y-coordinate at last release - iButton := aReg[ 4 ] // return button status - - RETURN iButton + RETURN aReturn[ 4 ] // return button status FUNCTION FT_MDEFCRS( nCurType, nScrMask, nCurMask ) // define text cursor type and masks -/* - aReg[ AX ] := 10 // set mouse function call 10 - aReg[ BX ] := nCurType // load cursor type parameter - aReg[ CX ] := nScrMask // load screen mask value - aReg[ DX ] := nCurMask // load cursor mask value - FT_INT86( 51, aReg ) // execute mouse interrupt -*/ - _m_mdefcrs( nCurType, nScrMask, nCurMask ) + RETURN _m_mdefcrs( nCurType, nScrMask, nCurMask ) - RETURN NIL // no function output +// Duplicated code from FT_MGETPOS() for speed reasons +FUNCTION FT_MGETCOORD( /* @ */ nX, /* @ */ nY ) -FUNCTION FT_MGETCOORD( nX, nY ) + LOCAL aReturn := _m_mgetcoord() - // Duplicated code from FT_MGETPOS() for speed reasons - LOCAL aReg - LOCAL iButton - nX := iif( nX == NIL, 0, nX ) - nY := iif( nY == NIL, 0, nY ) -/* - aReg[ AX ] := 3 // set mouse function call 3 - FT_INT86( 51, aReg ) // execute mouse interrupt -*/ - areg := _m_mgetcoord() - nX := Int( aReg[ 1 ] / 8 ) // store new x-coordinate - nY := Int( aReg[ 2 ] / 8 ) // store new y-coordinate - iButton := aReg[ 3 ] // return button status + nX := Int( aReturn[ 1 ] / 8 ) // store new x-coordinate + nY := Int( aReturn[ 2 ] / 8 ) // store new y-coordinate - RETURN iButton + RETURN aReturn[ 3 ] // return button status diff --git a/harbour/contrib/hbnf/mouse2.prg b/harbour/contrib/hbnf/mouse2.prg deleted file mode 100644 index f2b9fcfc48..0000000000 --- a/harbour/contrib/hbnf/mouse2.prg +++ /dev/null @@ -1,242 +0,0 @@ -/* - * $Id$ - */ - -/* - * Author....: Leo Letendre - * CIS ID....: 73607,233 - * - * This is an original work by Robert DiFalco and is placed in the - * public domain. - * - * Modification history: - * --------------------- - * - * Rev 1.9 17 Oct 1992 16:28:58 GLENN - * Leo cleaned up documentation blocks. - * - * Rev 1.8 28 Sep 1992 01:38:14 GLENN - * Leo added FT_MGETSENS(), FT_MSETSENS(), FT_MSETPAGE(), FT_MGETPAGE(), - * and FT_MVERSION(). - * - * - * Rev 1.7 01 Jul 1992 01:45:18 GLENN - * Leo added documentation to FT_MDEFCRS and others. Added FT_MCONOFF(), - * FT_MINIT(), FT_MGETCOORD() and FT_MSETCOORD(). Restructured - * FT_MGETX() and FT_MGETY() for possible speed improvement and MAIN to - * better demonstrate some of the concerns when programming the mouse. - * Added ability to change the number of rows and columns to demonstrate - * use in 43, 50 row mode etc. which is now supported in FT_MRESET() and - * FT_MINIT(). - * - * Rev 1.6 23 Sep 1991 01:14:38 GLENN - * Corrected errors in syntax documention for FT_MBUTPRS() and FT_MDBLCLK(), - * found by Nantucket's Steve Silverwood. - * - * Rev 1.5 17 Aug 1991 15:34:52 GLENN - * Don Caton fixed some spelling errors in the doc - * - * Rev 1.4 15 Aug 1991 23:06:24 GLENN - * Forest Belt proofread/edited/cleaned up doc - * - * Rev 1.3 17 Jul 1991 22:28:40 GLENN - * Leo fixed a potential bug in ft_mcursor(). - * - * Rev 1.2 27 May 1991 13:40:30 GLENN - * Leo Letendre sent me a revision of mouse1.prg where he built in support - * for a three-button mouse, and revised the "double click" detection - * algorithm. - * - * Brought in compliance with new ft_int86(). - * - * Rev 1.1 11 May 1991 00:16:48 GLENN - * ft_mgetpos() had a bug where the x and y coordinates were reversed. - * Changed x coordinate to aRegs[3] and y coordinate to aRegs[4], just - * like in ft_msetpos(). - * - * Rev 1.0 01 Apr 1991 01:01:48 GLENN - * Nanforum Toolkit - * - */ - -// The original mouse routines were written by Robert diFalco but -// Leo Letendre has made such major additions and modifications -// and fixes that I've given him sole credit. -- G. Scott - -#include "ftint86.ch" - -THREAD STATIC t_aReg[ 10 ] -THREAD STATIC t_lCrsState := .F. -THREAD STATIC t_lMinit := .F. - -FUNCTION FT_MINIT() - - // If not previously initialized then try - - IF ! t_lMinit - t_lMinit := ( FT_MRESET() != 0 ) - ELSE - // Reset maximum x and y limits - - FT_MYLIMIT( 0, 8 * MaxRow() ) - FT_MXLIMIT( 0, 8 * MaxCol() ) - ENDIF - - RETURN t_lMinit - -FUNCTION FT_MRESET() - - t_aReg[ AX ] := 0 // set mouse function call 0 - FT_INT86( 51, t_aReg ) // execute mouse interrupt - t_lCrsState := .F. // Cursor is off after reset - - // Reset maximum x and y limits - - FT_MYLIMIT( 0, 8 * MaxRow() ) - FT_MXLIMIT( 0, 8 * MaxCol() ) - - RETURN t_aReg[ AX ] // return status code - -FUNCTION FT_MCURSOR( lState ) - - LOCAL lSavState := t_lCrsState - - IF HB_ISLOGICAL( lState ) - IF ( t_lCrsState := lState ) - FT_MSHOWCRS() - ELSE - FT_MHIDECRS() - ENDIF - ENDIF - - RETURN lSavState - -FUNCTION FT_MSHOWCRS() - - t_aReg[ AX ] := 1 // set mouse function call 1 - FT_INT86( 51, t_aReg ) // execute mouse interrupt - t_lCrsState := .T. - - RETURN NIL // no output from function - -FUNCTION FT_MHIDECRS() // decrement internal cursor flag and hide cursor - - t_aReg[ AX ] := 2 // set mouse function call 2 - FT_INT86( 51, t_aReg ) // execute mouse interrupt - t_lCrsState := .F. - - RETURN NIL // no output from function - -FUNCTION FT_MGETPOS( nX, nY ) - - nX := iif( nX == NIL, 0, nX ) - nY := iif( nY == NIL, 0, nY ) - - t_aReg[ AX ] := 3 // set mouse function call 3 - FT_INT86( 51, t_aReg ) // execute mouse interrupt - nX := t_aReg[ DX ] // store new x-coordinate - nY := t_aReg[ CX ] // store new y-coordinate - - RETURN t_aReg[ BX ] // return button status - -FUNCTION FT_MGETCOORD( nX, nY ) - - // Duplicated code from FT_MGETPOS() for speed reasons - - nX := iif( nX == NIL, 0, nX ) - nY := iif( nY == NIL, 0, nY ) - - t_aReg[ AX ] := 3 // set mouse function call 3 - FT_INT86( 51, t_aReg ) // execute mouse interrupt - nX := Int( t_aReg[ DX ] / 8 ) // store new x-coordinate - nY := Int( t_aReg[ CX ] / 8 ) // store new y-coordinate - - RETURN t_aReg[ BX ] // return button status - -FUNCTION FT_MGETX() - - // Duplicated code from FT_MGETPOS() for speed reasons - - t_aReg[ AX ] := 3 // set mouse function call 3 - FT_INT86( 51, t_aReg ) // execute mouse interrupt - - RETURN Int( t_aReg[ DX ] / 8 ) // return x-coordinate - -FUNCTION FT_MGETY() - - // Duplicated code from FT_MGETPOS() for speed reasons - - t_aReg[ AX ] := 3 // set mouse function call 3 - FT_INT86( 51, t_aReg ) // execute mouse interrupt - - RETURN Int( t_aReg[ CX ] / 8 ) // return y-coordinate - -FUNCTION FT_MSETPOS( nX, nY ) // set mouse cursor location - - t_aReg[ AX ] := 4 // set mouse function call 4 - t_aReg[ CX ] := nY // assign new x-coordinate - t_aReg[ DX ] := nX // assign new y-coordinate - FT_INT86( 51, t_aReg ) // execute mouse interrupt - - RETURN NIL // no function output - -FUNCTION FT_MSETCOORD( nX, nY ) // set mouse cursor location - - t_aReg[ AX ] := 4 // set mouse function call 4 - t_aReg[ CX ] := nY * 8 // assign new x-coordinate - t_aReg[ DX ] := nX * 8 // assign new y-coordinate - FT_INT86( 51, t_aReg ) // execute mouse interrupt - - RETURN NIL // no function output - -FUNCTION FT_MXLIMIT( nXMin, nXMax ) // set vertical minimum and maximum coordinates - - t_aReg[ AX ] := 7 // set mouse function call 7 - t_aReg[ CX ] := nXMin // load vertical minimum parameter - t_aReg[ DX ] := nXMax // load vertical maximum parameter - FT_INT86( 51, t_aReg ) // execute mouse interrupt - - RETURN NIL - -FUNCTION FT_MYLIMIT( nYMin, nYMax ) // set horizontal minimum and maximum coordinates - - t_aReg[ AX ] := 8 // set mouse function call 8 - t_aReg[ CX ] := nYMin // load horz minimum parameter - t_aReg[ DX ] := nYMax // load horz maximum parameter - FT_INT86( 51, t_aReg ) // execute mouse interrupt - - RETURN NIL // no function output - -FUNCTION FT_MBUTPRS( nButton, nButPrs, nX, nY ) // get button press information - - t_aReg[ AX ] := 5 // set mouse function call 5 - t_aReg[ BX ] := nButton // pass parameter for left or right button - FT_INT86( 51, t_aReg ) // execute mouse interrupt - nButPrs := t_aReg[ BX ] // store updated press count - nX := t_aReg[ DX ] // x-coordinate at last press - nY := t_aReg[ CX ] // y-coordinate at last press - - RETURN t_aReg[ AX ] // return button status - -FUNCTION FT_MBUTREL( nButton, nButRel, nX, nY ) // get button release information - - t_aReg[ AX ] := 6 // set mouse function call 6 - t_aReg[ BX ] := nButton // pass parameter for left or right button - FT_INT86( 51, t_aReg ) // execute mouse interrupt - nButRel := t_aReg[ BX ] // store updated release count - nX := t_aReg[ DX ] // x-coordinate at last release - nY := t_aReg[ CX ] // y-coordinate at last release - - RETURN t_aReg[ AX ] // return button status - -/* -FUNCTION FT_MDEFCRS( nCurType, nScrMask, nCurMask ) // define text cursor type and masks - - t_aReg[ AX ] := 10 // set mouse function call 10 - t_aReg[ BX ] := nCurType // load cursor type parameter - t_aReg[ CX ] := nScrMask // load screen mask value - t_aReg[ DX ] := nCurMask // load cursor mask value - FT_INT86( 51, t_aReg ) // execute mouse interrupt - - RETURN NIL // no function output -*/ diff --git a/harbour/contrib/hbnf/nooccur.prg b/harbour/contrib/hbnf/nooccur.prg index cf7e874287..450860ca0e 100644 --- a/harbour/contrib/hbnf/nooccur.prg +++ b/harbour/contrib/hbnf/nooccur.prg @@ -23,18 +23,13 @@ * */ -#define MAKE_UPPER( x ) ( x := UPPER( x ) ) - FUNCTION FT_NOOCCUR( cCheckFor, cCheckIn, lIgnoreCase ) // Is Case Important?? IF ! HB_ISLOGICAL( lIgnoreCase ) .OR. lIgnoreCase - - MAKE_UPPER( cCheckFor ) // No, Force Everything to Uppercase - MAKE_UPPER( cCheckIn ) - + cCheckFor := Upper( cCheckFor ) + cCheckIn := Upper( cCheckIn ) ENDIF - // lIgnoreCase RETURN iif( Len( cCheckFor ) == 0 .OR. Len( cCheckIn ) == 0, ; 0, ; diff --git a/harbour/contrib/hbnf/nwlstat.prg b/harbour/contrib/hbnf/nwlstat.prg index 8a755cf818..dae8e2c98e 100644 --- a/harbour/contrib/hbnf/nwlstat.prg +++ b/harbour/contrib/hbnf/nwlstat.prg @@ -24,20 +24,10 @@ * */ -#include "ftint86.ch" - -#define DOS 33 -#define STATNUM 220 - FUNCTION FT_NWLSTAT() -// LOCAL aRegs[ INT86_MAX_REGS ] - LOCAL nStation -/* - aRegs[ AX ] := MAKEHI( STATNUM ) - FT_INT86( DOS, aRegs ) - */ - nStation := _ft_nwkstat() /* LOWBYTE( aRegs[ AX ] ) */ + LOCAL nStation := _ft_nwkstat() + IF nStation < 0 nStation += 256 ENDIF diff --git a/harbour/contrib/hbnf/nwsem.prg b/harbour/contrib/hbnf/nwsem.prg index ae39d96c6a..99e2d2d678 100644 --- a/harbour/contrib/hbnf/nwsem.prg +++ b/harbour/contrib/hbnf/nwsem.prg @@ -38,7 +38,7 @@ #include "ftint86.ch" -#define INT21 33 +#define INT21 33 #define WAIT_SEMAPHORE 2 #define SIGNAL_SEMAPHORE 3 @@ -59,17 +59,17 @@ FUNCTION ft_nwSemOpen( cName, nInitVal, nHandle, nOpenCnt ) cName := iif( hb_BLen( cName ) > 127, hb_BSubStr( cName, 1, 127 ), cName ) cRequest := hb_BChar( Len( cName ) ) + cName - aRegs[ AX ] := makehi( 197 ) // C5h - aRegs[ DS ] := cRequest - aRegs[ DX ] := REG_DS - aRegs[ CX ] := nInitVal + aRegs[ AX ] := MAKEHI( 197 ) // C5h + aRegs[ DS ] := cRequest + aRegs[ DX ] := REG_DS + aRegs[ CX ] := nInitVal ft_int86( INT21, aRegs ) nHandle := Bin2L( I2Bin( aRegs[ CX ] ) + I2Bin( aRegs[ DX ] ) ) - nOpenCnt := lowbyte( aRegs[ BX ] ) + nOpenCnt := LOWBYTE( aRegs[ BX ] ) - nRet := lowbyte( aRegs[ AX ] ) + nRet := LOWBYTE( aRegs[ AX ] ) RETURN iif( nRet < 0, nRet + 256, nRet ) @@ -81,15 +81,15 @@ FUNCTION ft_nwSemEx( nHandle, nValue, nOpenCnt ) __defaultNIL( @nValue, 0 ) __defaultNIL( @nOpenCnt, 0 ) - aRegs[ AX ] := makehi( 197 ) + 1 // C5h, 01h - aRegs[ CX ] := Bin2I( hb_BSubStr( L2Bin( nHandle ), 1, 2 ) ) - aRegs[ DX ] := Bin2I( hb_BSubStr( L2Bin( nHandle ), 3, 2 ) ) + aRegs[ AX ] := MAKEHI( 197 ) + 1 // C5h, 01h + aRegs[ CX ] := Bin2I( hb_BSubStr( L2Bin( nHandle ), 1, 2 ) ) + aRegs[ DX ] := Bin2I( hb_BSubStr( L2Bin( nHandle ), 3, 2 ) ) ft_int86( INT21, aRegs ) nValue := aRegs[ CX ] - nOpenCnt := lowbyte( aRegs[ DX ] ) - nRet := lowbyte( aRegs[ AX ] ) + nOpenCnt := LOWBYTE( aRegs[ DX ] ) + nRet := LOWBYTE( aRegs[ AX ] ) RETURN iif( nRet < 0, nRet + 256, nRet ) @@ -117,13 +117,13 @@ STATIC FUNCTION _ftnwsem( nOp, nHandle, nTimeout ) __defaultNIL( @nHandle, 0 ) __defaultNIL( @nTimeout, 0 ) - aRegs[ AX ] := makehi( 197 ) + nOp - aRegs[ CX ] := Bin2I( hb_BSubStr( L2Bin( nHandle ), 1, 2 ) ) - aRegs[ DX ] := Bin2I( hb_BSubStr( L2Bin( nHandle ), 3, 2 ) ) - aRegs[ BP ] := nTimeout + aRegs[ AX ] := MAKEHI( 197 ) + nOp + aRegs[ CX ] := Bin2I( hb_BSubStr( L2Bin( nHandle ), 1, 2 ) ) + aRegs[ DX ] := Bin2I( hb_BSubStr( L2Bin( nHandle ), 3, 2 ) ) + aRegs[ BP ] := nTimeout ft_int86( INT21, aRegs ) - nRet := lowbyte( aRegs[ AX ] ) + nRet := LOWBYTE( aRegs[ AX ] ) nRet := iif( nRet < 0, nRet + 256, nRet ) RETURN nRet diff --git a/harbour/contrib/hbnf/nwuid.prg b/harbour/contrib/hbnf/nwuid.prg index e64f2120ff..c71edb7c9b 100644 --- a/harbour/contrib/hbnf/nwuid.prg +++ b/harbour/contrib/hbnf/nwuid.prg @@ -46,21 +46,21 @@ FUNCTION FT_NWUID( nConn ) // Set up request packet - cReqPkt := hb_BChar( 22 ) // Function 22: Get Connection Information - cReqPkt += hb_BChar( nConn ) - cReqPkt := I2Bin( hb_BLen( cReqPkt ) ) + cReqPkt + cReqPkt := hb_BChar( 22 ) // Function 22: Get Connection Information + cReqPkt += hb_BChar( nConn ) + cReqPkt := I2Bin( hb_BLen( cReqPkt ) ) + cReqPkt // Set up reply packet - cRepPkt := Space( 63 ) + cRepPkt := Space( 63 ) // Assign registers - aRegs[ AX ] := MAKEHI( NW_LOG ) - aRegs[ DS ] := cReqPkt - aRegs[ SI ] := REG_DS - aRegs[ ES ] := cRepPkt - aRegs[ DI ] := REG_ES + aRegs[ AX ] := MAKEHI( NW_LOG ) + aRegs[ DS ] := cReqPkt + aRegs[ SI ] := REG_DS + aRegs[ ES ] := cRepPkt + aRegs[ DI ] := REG_ES FT_INT86( DOS, aRegs ) diff --git a/harbour/contrib/hbnf/page.prg b/harbour/contrib/hbnf/page.prg deleted file mode 100644 index 571378132a..0000000000 --- a/harbour/contrib/hbnf/page.prg +++ /dev/null @@ -1,54 +0,0 @@ -/* - * $Id$ - */ - -/* - * Author....: Glenn Scott - * CIS ID....: 71620,1521 - * - * This is an original work by Glenn Scott and is placed in the - * public domain. - * - * Modification history: - * --------------------- - * - * Rev 1.3 15 Aug 1991 23:05:18 GLENN - * Forest Belt proofread/edited/cleaned up doc - * - * Rev 1.2 14 Jun 1991 19:52:36 GLENN - * Minor edit to file header - * - * Rev 1.1 12 Jun 1991 02:29:14 GLENN - * Documentation mods and check for ft_int86() compatibility - * - * Rev 1.0 01 Apr 1991 01:01:58 GLENN - * Nanforum Toolkit - * - */ - -#include "ftint86.ch" - -#define VIDEO 16 - -FUNCTION FT_SETVPG( nPage ) -/* - LOCAL aRegs[ INT86_MAX_REGS ] - - aRegs[ AX ] := MAKEHI( 5 ) + nPage - FT_INT86( VIDEO, aRegs ) - */ - - _ft_setvpg( nPage ) - - RETURN NIL - -FUNCTION FT_GETVPG() -/* - LOCAL aRegs[ INT86_MAX_REGS ] - - aRegs[ AX ] := MAKEHI( 15 ) - FT_INT86( VIDEO, aRegs ) - - RETURN HIGHBYTE( aRegs[ BX ] ) */ - - RETURN _ft_getvpg() diff --git a/harbour/contrib/hbnf/rand1.prg b/harbour/contrib/hbnf/rand1.prg index 3aa0530510..6109ef732a 100644 --- a/harbour/contrib/hbnf/rand1.prg +++ b/harbour/contrib/hbnf/rand1.prg @@ -26,6 +26,7 @@ FUNCTION ft_rand1( nMax ) THREAD STATIC t_nSeed + LOCAL m := 100000000, b := 31415621 t_nSeed := iif( t_nSeed == NIL, Seconds(), t_nSeed ) // init_seed() diff --git a/harbour/contrib/hbnf/savearr.prg b/harbour/contrib/hbnf/savearr.prg index b87ecf987b..9754f59e14 100644 --- a/harbour/contrib/hbnf/savearr.prg +++ b/harbour/contrib/hbnf/savearr.prg @@ -120,28 +120,33 @@ STATIC FUNCTION _ftrestsub( nHandle, nErrorCode ) nLen := Bin2L( cLenStr ) nErrorCode := FError() IF nErrorCode == 0 - DO CASE - CASE cValType == "A" + SWITCH cValType + CASE "A" xMemVar := {} FOR nk := 1 TO nLen AAdd( xMemVar, _ftrestsub( nHandle ) ) // Recursive call NEXT - CASE cValType == "C" + EXIT + CASE "C" xMemVar := Space( nLen ) FRead( nHandle, @xMemVar, nLen ) - CASE cValType == "D" + EXIT + CASE "D" cMemVar := Space( 8 ) FRead( nHandle, @cMemVar, 8 ) xMemVar := CToD( cMemVar ) /* TOFIX: It's not Y2K compatible, and it needs same _SET_DATEFORMAT on save and load */ - CASE cValType == "L" + EXIT + CASE "L" cMemVar := " " FRead( nHandle, @cMemVar, 1 ) xMemVar := ( cMemVar == "T" ) - CASE cValType == "N" + EXIT + CASE "N" cMemVar := Space( nLen ) FRead( nHandle, @cMemVar, nLen ) xMemVar := Val( cMemVar ) - ENDCASE + EXIT + ENDSWITCH nErrorCode := FError() ENDIF diff --git a/harbour/contrib/hbnf/scregion.prg b/harbour/contrib/hbnf/scregion.prg index 81ccd66359..2746c5cd0e 100644 --- a/harbour/contrib/hbnf/scregion.prg +++ b/harbour/contrib/hbnf/scregion.prg @@ -54,6 +54,7 @@ FUNCTION FT_RSTRGN( cScreen, nTop, nLeft ) FUNCTION FT_RGNSTACK( cAction, nTop, nLeft, nBottom, nRight ) THREAD STATIC t_nStackPtr := 0 + LOCAL nPopTop IF cAction == "push" diff --git a/harbour/contrib/hbnf/sinkey.prg b/harbour/contrib/hbnf/sinkey.prg index 7331be6b40..9268ade238 100644 --- a/harbour/contrib/hbnf/sinkey.prg +++ b/harbour/contrib/hbnf/sinkey.prg @@ -25,17 +25,15 @@ FUNCTION FT_SINKEY( waittime ) - LOCAL key, cblock + LOCAL key, cBlock DO CASE - - /* if no WAITTIME passed, go straight through */ - CASE PCount() == 0 + CASE PCount() == 0 /* if no WAITTIME passed, go straight through */ key := Inkey() - /* dig this... if you pass inkey(NIL), it is identical to INKEY(0)! - therefore, I allow you to pass FT_SINKEY(NIL) -- hence this mild bit - of convolution */ + /* dig this... if you pass Inkey( NIL ), it is identical to Inkey( 0 )! + therefore, I allow you to pass FT_SINKEY( NIL ) -- hence this mild bit + of convolution */ CASE waittime == NIL .AND. PCount() == 1 key := Inkey( 0 ) @@ -45,15 +43,10 @@ FUNCTION FT_SINKEY( waittime ) ENDCASE - cblock := SetKey( key ) - - IF cblock != NIL - + IF ( cBlock := SetKey( key ) ) != NIL // run the code block associated with this key and pass it the // name of the previous procedure and the previous line number - - Eval( cblock, ProcName( 1 ), ProcLine( 1 ), NIL ) - + Eval( cBlock, ProcName( 1 ), ProcLine( 1 ), NIL ) ENDIF RETURN key diff --git a/harbour/contrib/hbnf/sleep.prg b/harbour/contrib/hbnf/sleep.prg index ec0b27ae94..cc5a45a26d 100644 --- a/harbour/contrib/hbnf/sleep.prg +++ b/harbour/contrib/hbnf/sleep.prg @@ -22,26 +22,15 @@ FUNCTION FT_SLEEP( nSeconds, nInitial ) - IF ! HB_ISNUMERIC( nInitial ) - nInitial := Seconds() + IF HB_ISNUMERIC( nInitial ) + nInitial -= Seconds() + IF nInitial > 0 + nInitial -= 86399 + ENDIF + // calculate final time + nSeconds += ninitial ENDIF - // correct for running at midnight - - IF nInitial + nSeconds > 86399 - nInitial -= 86399 - // Wait until midnight - DO WHILE Seconds() > 100 // no problem with a _very_ slow machine - ENDDO - ENDIF - - // calculate final time - - nSeconds += ninitial - - // Loop until we are done - - DO WHILE Seconds() < nSeconds - ENDDO + hb_idleSleep( nSeconds ) RETURN NIL diff --git a/harbour/contrib/hbnf/tempfile.prg b/harbour/contrib/hbnf/tempfile.prg index 482cce0fe7..0ec777b5b0 100644 --- a/harbour/contrib/hbnf/tempfile.prg +++ b/harbour/contrib/hbnf/tempfile.prg @@ -61,11 +61,9 @@ FUNCTION FT_TEMPFIL( cPath, lHide, nHandle ) LOCAL cRet, aRegs[ 3 ] - cPath := iif( ! HB_ISSTRING( cPath ), ; - Replicate( hb_BChar( 0 ), 13 ), ; - cPath += Replicate( hb_BChar( 0 ), 13 ) ) - + cPath := iif( HB_ISSTRING( cPath ), cPath, "" ) + Replicate( hb_BChar( 0 ), 13 ) lHide := iif( HB_ISLOGICAL( lHide ), lHide, .F. ) + /* aRegs[ AX ] := MAKEHI( TEMPNAME ) aRegs[ CX ] := iif( lHide, 2, 0 ) diff --git a/harbour/contrib/hbnf/vidmode.prg b/harbour/contrib/hbnf/vidmode.prg deleted file mode 100644 index 049527bbfa..0000000000 --- a/harbour/contrib/hbnf/vidmode.prg +++ /dev/null @@ -1,57 +0,0 @@ -/* - * $Id$ - */ - -/* - * Author....: Glenn Scott - * CIS ID....: 71620,1521 - * - * This is an original work by Glenn Scott and is placed in the - * public domain. - * - * Modification history: - * --------------------- - * - * Rev 1.3 15 Aug 1991 23:06:12 GLENN - * Forest Belt proofread/edited/cleaned up doc - * - * Rev 1.2 14 Jun 1991 19:53:14 GLENN - * Minor edit to file header - * - * Rev 1.1 14 Jun 1991 18:00:42 GLENN - * Documentation change (minor), and checked for compatibility with new - * ft_int86(). - * - * Rev 1.0 01 Apr 1991 01:02:30 GLENN - * Nanforum Toolkit - * - */ - -#include "ftint86.ch" - -#define VIDEO 16 -#define GETMODE 15 - -FUNCTION FT_SETMODE( nMode ) -/* - LOCAL aRegs[ INT86_MAX_REGS ] - - aRegs[ AX ] := nMode - FT_INT86( VIDEO, aRegs ) -*/ - - _ft_setmode( nMode ) - - RETURN NIL - -FUNCTION FT_GETMODE() -/* - LOCAL aRegs[ INT86_MAX_REGS ] - - aRegs[ AX ] := MAKEHI( GETMODE ) - FT_INT86( VIDEO, aRegs ) - - RETURN LOWBYTE( aRegs[ AX ] ) -*/ - - RETURN _ft_getmode() diff --git a/harbour/include/hbapigt.h b/harbour/include/hbapigt.h index 7b6eee73f3..2be3207c98 100644 --- a/harbour/include/hbapigt.h +++ b/harbour/include/hbapigt.h @@ -179,7 +179,6 @@ extern HB_EXPORT HB_ERRCODE hb_gtGetBlink( HB_BOOL * pbBlink ); extern HB_EXPORT HB_ERRCODE hb_gtGetColorStr( char * pszColorString ); extern HB_EXPORT HB_ERRCODE hb_gtGetCursor( int * piCursorShape ); extern HB_EXPORT HB_ERRCODE hb_gtGetPos( int * piRow, int * piCol ); -extern HB_EXPORT HB_BOOL hb_gtIsCompatBuffer( void ); extern HB_EXPORT HB_BOOL hb_gtIsColor( void ); extern HB_EXPORT int hb_gtMaxCol( void ); extern HB_EXPORT int hb_gtMaxRow( void ); diff --git a/harbour/src/rtl/gtapi.c b/harbour/src/rtl/gtapi.c index 22dc21d626..2c7adc2783 100644 --- a/harbour/src/rtl/gtapi.c +++ b/harbour/src/rtl/gtapi.c @@ -1033,22 +1033,6 @@ HB_ERRCODE hb_gtSetKeyCP( const char * pszTermCDP, const char * pszHostCDP ) return errCode; } -HB_BOOL hb_gtIsCompatBuffer( void ) -{ - HB_BOOL fCompatBuffer = HB_TRUE; - PHB_GT pGT; - - HB_TRACE(HB_TR_DEBUG, ("hb_gtCompatBuffer()")); - - pGT = hb_gt_Base(); - if( pGT ) - { - fCompatBuffer = pGT->fVgaCell; - hb_gt_BaseFree( pGT ); - } - return fCompatBuffer; -} - PHB_CODEPAGE hb_gtHostCP( void ) { PHB_CODEPAGE cdp = NULL;