2007-12-02 12:38 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbnf/nwsem.prg
* harbour/contrib/hbnf/prtesc.prg
* harbour/contrib/hbnf/mouse1.prg
* harbour/contrib/hbnf/workdays.prg
* harbour/contrib/hbnf/sleep.prg
* harbour/contrib/hbnf/xbox.prg
* harbour/contrib/hbnf/d2e.prg
* harbour/contrib/hbnf/mouse2.prg
* harbour/contrib/hbnf/ntow.prg
* harbour/contrib/hbnf/floptst.prg
* harbour/contrib/hbnf/e2d.prg
* converted TABs to SPACEs
This commit is contained in:
@@ -8,6 +8,20 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2007-12-02 12:38 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/contrib/hbnf/nwsem.prg
|
||||
* harbour/contrib/hbnf/prtesc.prg
|
||||
* harbour/contrib/hbnf/mouse1.prg
|
||||
* harbour/contrib/hbnf/workdays.prg
|
||||
* harbour/contrib/hbnf/sleep.prg
|
||||
* harbour/contrib/hbnf/xbox.prg
|
||||
* harbour/contrib/hbnf/d2e.prg
|
||||
* harbour/contrib/hbnf/mouse2.prg
|
||||
* harbour/contrib/hbnf/ntow.prg
|
||||
* harbour/contrib/hbnf/floptst.prg
|
||||
* harbour/contrib/hbnf/e2d.prg
|
||||
* converted TABs to SPACEs
|
||||
|
||||
2007-12-02 05:58 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/bin/hb-func.sh
|
||||
* updated for new contrib libraries names
|
||||
|
||||
@@ -31,37 +31,37 @@
|
||||
* $CATEGORY$
|
||||
* Conversion
|
||||
* $ONELINER$
|
||||
* Convert decimal to scientific notation
|
||||
* Convert decimal to scientific notation
|
||||
* $SYNTAX$
|
||||
* FT_D2E( <nDec>, <nPrecision> ) -> <cNumE>
|
||||
* FT_D2E( <nDec>, <nPrecision> ) -> <cNumE>
|
||||
* $ARGUMENTS$
|
||||
* <nDec> Decimal number to convert
|
||||
* <nDec> Decimal number to convert
|
||||
*
|
||||
* <nPrecision> Number of decimal places in result.
|
||||
* <nPrecision> Number of decimal places in result.
|
||||
* Defaults to 6 decimal places.
|
||||
* $RETURNS$
|
||||
* <cNumE> A string representing a number in
|
||||
* <cNumE> A string representing a number in
|
||||
* scientific notation
|
||||
* $DESCRIPTION$
|
||||
* Given a decimal number and the desired precision,
|
||||
* a string representing the equivalent in scientific
|
||||
* notation is returned.
|
||||
* Given a decimal number and the desired precision,
|
||||
* a string representing the equivalent in scientific
|
||||
* notation is returned.
|
||||
* $EXAMPLES$
|
||||
* ? FT_D2E( 12.345, 2 )
|
||||
* -> 1.23E1
|
||||
* ? FT_D2E( 12.345, 2 )
|
||||
* -> 1.23E1
|
||||
*
|
||||
* ? FT_D2E( -12.345, 3 )
|
||||
* -> -1.235E1
|
||||
* ? FT_D2E( -12.345, 3 )
|
||||
* -> -1.235E1
|
||||
*
|
||||
* ? FT_D2E( 0.00000543, 2 )
|
||||
* -> 5.43E-6
|
||||
* ? FT_D2E( 0.00000543, 2 )
|
||||
* -> 5.43E-6
|
||||
* $SEEALSO$
|
||||
* FT_E2D()
|
||||
* $END$
|
||||
*/
|
||||
|
||||
#define log10( num ) log( num ) / log( 10 )
|
||||
#define DEFAULT_PRECISION 6
|
||||
#define log10( num ) log( num ) / log( 10 )
|
||||
#define DEFAULT_PRECISION 6
|
||||
#command DEFAULT <p> TO <val> => <p> := iif( <p> == NIL, <val>, <p> )
|
||||
|
||||
#ifdef FT_TEST
|
||||
@@ -80,7 +80,7 @@ function ft_d2e( nDec, nPrecision )
|
||||
nExp := int( log10( nDec ) ) - 1
|
||||
else
|
||||
nExp := int( log10( abs(nDec)+0.00001 ) ) && 0.00001 == kludge
|
||||
endif && for imprecise logs
|
||||
endif && for imprecise logs
|
||||
|
||||
nDec /= 10 ^ nExp
|
||||
|
||||
|
||||
@@ -31,25 +31,25 @@
|
||||
* $CATEGORY$
|
||||
* Conversion
|
||||
* $ONELINER$
|
||||
* Convert scientific notation string to a decimal
|
||||
* Convert scientific notation string to a decimal
|
||||
* $SYNTAX$
|
||||
* FT_E2D( <cNumE> ) -> <nDec>
|
||||
* FT_E2D( <cNumE> ) -> <nDec>
|
||||
* $ARGUMENTS$
|
||||
* <cNumE> Scientific notation string to convert
|
||||
* <cNumE> Scientific notation string to convert
|
||||
* $RETURNS$
|
||||
* <nDec> Decimal number
|
||||
* <nDec> Decimal number
|
||||
* $DESCRIPTION$
|
||||
* Given a string in the format x.yEz, the decimal
|
||||
* equivalent is returned.
|
||||
* Given a string in the format x.yEz, the decimal
|
||||
* equivalent is returned.
|
||||
* $EXAMPLES$
|
||||
* ? FT_E2D( "1.23E1" )
|
||||
* -> 12.3
|
||||
* ? FT_E2D( "1.23E1" )
|
||||
* -> 12.3
|
||||
*
|
||||
* ? FT_E2D( "-1.235E1" )
|
||||
* -> -12.35
|
||||
* ? FT_E2D( "-1.235E1" )
|
||||
* -> -12.35
|
||||
*
|
||||
* ? ft_d2e( "5.43E-6" )
|
||||
* -> 0.0000543
|
||||
* ? ft_d2e( "5.43E-6" )
|
||||
* -> 0.0000543
|
||||
* $SEEALSO$
|
||||
* FT_D2E()
|
||||
* $END$
|
||||
|
||||
@@ -90,204 +90,204 @@
|
||||
|
||||
#include "ftint86.ch"
|
||||
|
||||
#define TRUE .T.
|
||||
#define FALSE .F.
|
||||
#define TRUE .T.
|
||||
#define FALSE .F.
|
||||
|
||||
#DEFINE ERR_WRONG_PARAMETERS -1
|
||||
#DEFINE ERR_NO_ERROR 0
|
||||
#DEFINE ERR_DRIVE_NOT_READY 1
|
||||
#DEFINE ERR_UNFORMATTED 2
|
||||
#DEFINE ERR_WRITE_PROTECTED 3
|
||||
#DEFINE ERR_UNKNOWN 4
|
||||
#DEFINE ERR_WRONG_PARAMETERS -1
|
||||
#DEFINE ERR_NO_ERROR 0
|
||||
#DEFINE ERR_DRIVE_NOT_READY 1
|
||||
#DEFINE ERR_UNFORMATTED 2
|
||||
#DEFINE ERR_WRITE_PROTECTED 3
|
||||
#DEFINE ERR_UNKNOWN 4
|
||||
|
||||
#IFDEF FT_TEST
|
||||
#define CR_LF chr(13)+chr(10)
|
||||
|
||||
PROCEDURE MAIN( ;
|
||||
cArg1 ;
|
||||
)
|
||||
LOCAL nErrCode
|
||||
PROCEDURE MAIN( ;
|
||||
cArg1 ;
|
||||
)
|
||||
LOCAL nErrCode
|
||||
|
||||
IF ValType( cArg1 ) == "C"
|
||||
nErrCode := FT_FLOPTST( Asc( Upper(cArg1) ) - Asc( "A" ) )
|
||||
OutStd( "Return Code is "+LTrim(Str(nErrCode)) +CR_LF )
|
||||
ELSE
|
||||
OutStd( "Usage: floptst cDrive"+CR_LF+" where cDrive is 'A' or 'B' etc..."+CR_LF )
|
||||
ENDIF
|
||||
IF ValType( cArg1 ) == "C"
|
||||
nErrCode := FT_FLOPTST( Asc( Upper(cArg1) ) - Asc( "A" ) )
|
||||
OutStd( "Return Code is "+LTrim(Str(nErrCode)) +CR_LF )
|
||||
ELSE
|
||||
OutStd( "Usage: floptst cDrive"+CR_LF+" where cDrive is 'A' or 'B' etc..."+CR_LF )
|
||||
ENDIF
|
||||
|
||||
RETURN
|
||||
|
||||
#ENDIF
|
||||
|
||||
|
||||
FUNCTION FT_FLOPTST( ; // error code defined by ERR_*
|
||||
nDriveNum_i ; // letter of floppy drive.
|
||||
)
|
||||
LOCAL cBuffer
|
||||
LOCAL nErrorCode
|
||||
LOCAL nRetCode
|
||||
FUNCTION FT_FLOPTST( ; // error code defined by ERR_*
|
||||
nDriveNum_i ; // letter of floppy drive.
|
||||
)
|
||||
LOCAL cBuffer
|
||||
LOCAL nErrorCode
|
||||
LOCAL nRetCode
|
||||
|
||||
nRetCode := ERR_WRONG_PARAMETERS
|
||||
IF ValType( nDriveNum_i ) == "N"
|
||||
nRetCode := ERR_WRONG_PARAMETERS
|
||||
IF ValType( nDriveNum_i ) == "N"
|
||||
|
||||
IF _GetDisketteNum( nDriveNum_i )
|
||||
_ResetDisketteSystem()
|
||||
_ReadBootSector( nDriveNum_i, @cBuffer, @nErrorCode )
|
||||
IF _GetDisketteNum( nDriveNum_i )
|
||||
_ResetDisketteSystem()
|
||||
_ReadBootSector( nDriveNum_i, @cBuffer, @nErrorCode )
|
||||
|
||||
IF nErrorCode == 0
|
||||
_WriteBootSector( nDriveNum_i, cBuffer, @nErrorCode )
|
||||
DO CASE
|
||||
CASE nErrorCode == 0
|
||||
nRetCode := ERR_NO_ERROR
|
||||
CASE nErrorCode == 3
|
||||
nRetCode := ERR_WRITE_PROTECTED
|
||||
OTHERWISE
|
||||
nRetCode := ERR_UNKNOWN
|
||||
ENDCASE
|
||||
ELSE
|
||||
DO CASE
|
||||
CASE nErrorCode == 128 // 80h
|
||||
nRetCode := ERR_DRIVE_NOT_READY
|
||||
CASE nErrorCode == 2
|
||||
nRetCode := ERR_UNFORMATTED
|
||||
OTHERWISE
|
||||
nRetCode := ERR_UNKNOWN
|
||||
END CASE
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
IF nErrorCode == 0
|
||||
_WriteBootSector( nDriveNum_i, cBuffer, @nErrorCode )
|
||||
DO CASE
|
||||
CASE nErrorCode == 0
|
||||
nRetCode := ERR_NO_ERROR
|
||||
CASE nErrorCode == 3
|
||||
nRetCode := ERR_WRITE_PROTECTED
|
||||
OTHERWISE
|
||||
nRetCode := ERR_UNKNOWN
|
||||
ENDCASE
|
||||
ELSE
|
||||
DO CASE
|
||||
CASE nErrorCode == 128 // 80h
|
||||
nRetCode := ERR_DRIVE_NOT_READY
|
||||
CASE nErrorCode == 2
|
||||
nRetCode := ERR_UNFORMATTED
|
||||
OTHERWISE
|
||||
nRetCode := ERR_UNKNOWN
|
||||
END CASE
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN nRetCode
|
||||
|
||||
#define BITS_6AND7 192 // value of byte when bits 6&7 are high
|
||||
#define BITS_6AND7 192 // value of byte when bits 6&7 are high
|
||||
|
||||
STATIC FUNCTION _GetDisketteNum( ; // returns false if no floppy drive installed or nDrive_i is invalid
|
||||
nDrive_i ; // drive number to query status
|
||||
)
|
||||
LOCAL aRegs[INT86_MAX_REGS]
|
||||
LOCAL lRetCode
|
||||
LOCAL nByte
|
||||
LOCAL nDriveCount
|
||||
STATIC FUNCTION _GetDisketteNum( ; // returns false if no floppy drive installed or nDrive_i is invalid
|
||||
nDrive_i ; // drive number to query status
|
||||
)
|
||||
LOCAL aRegs[INT86_MAX_REGS]
|
||||
LOCAL lRetCode
|
||||
LOCAL nByte
|
||||
LOCAL nDriveCount
|
||||
|
||||
// ASSERT 0 <= nDrive_i
|
||||
// ASSERT 0 <= nDrive_i
|
||||
|
||||
lRetCode := FALSE
|
||||
IF FT_INT86( 1*16+1, aRegs ) // INT for equipment determination
|
||||
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.
|
||||
nDriveCount := Asc( FT_BYTEAND( Chr(nByte), chr(BITS_6AND7) ) )
|
||||
IF nDriveCount >= nDrive_i
|
||||
lRetCode := TRUE
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
lRetCode := FALSE
|
||||
IF FT_INT86( 1*16+1, aRegs ) // INT for equipment determination
|
||||
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.
|
||||
nDriveCount := Asc( FT_BYTEAND( Chr(nByte), chr(BITS_6AND7) ) )
|
||||
IF nDriveCount >= nDrive_i
|
||||
lRetCode := TRUE
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN lRetCode
|
||||
|
||||
|
||||
STATIC PROCEDURE _ResetDisketteSystem()
|
||||
LOCAL aRegs[INT86_MAX_REGS]
|
||||
LOCAL aRegs[INT86_MAX_REGS]
|
||||
|
||||
aRegs[AX] := 0
|
||||
aRegs[AX] := 0
|
||||
|
||||
FT_INT86( 1*16+3, aRegs )
|
||||
FT_INT86( 1*16+3, aRegs )
|
||||
|
||||
RETURN
|
||||
|
||||
#define BUFFER_SIZEOF_SECTOR 512+1
|
||||
#define BUFFER_SIZEOF_SECTOR 512+1
|
||||
|
||||
STATIC FUNCTION _ReadBootSector( ;
|
||||
nDriveNum, ;
|
||||
cBuffer_o, ;
|
||||
nErrCode_o ;
|
||||
)
|
||||
// call BIOS INT 13 for sector read
|
||||
LOCAL aRegs[INT86_MAX_REGS]
|
||||
LOCAL cBuffer := Space( BUFFER_SIZEOF_SECTOR )
|
||||
LOCAL lSuccess
|
||||
LOCAL nErrorCode
|
||||
LOCAL lCarryFlag
|
||||
STATIC FUNCTION _ReadBootSector( ;
|
||||
nDriveNum, ;
|
||||
cBuffer_o, ;
|
||||
nErrCode_o ;
|
||||
)
|
||||
// call BIOS INT 13 for sector read
|
||||
LOCAL aRegs[INT86_MAX_REGS]
|
||||
LOCAL cBuffer := Space( BUFFER_SIZEOF_SECTOR )
|
||||
LOCAL lSuccess
|
||||
LOCAL nErrorCode
|
||||
LOCAL lCarryFlag
|
||||
|
||||
aRegs[DX] := nDriveNum // DH = 0 Head 0, DL = drive number
|
||||
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[DX] := nDriveNum // DH = 0 Head 0, DL = drive number
|
||||
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
|
||||
|
||||
lSuccess := _CallInt13hRetry( aRegs, @lCarryFlag, @nErrorCode )
|
||||
lSuccess := _CallInt13hRetry( aRegs, @lCarryFlag, @nErrorCode )
|
||||
|
||||
cBuffer_o := aRegs[ES]
|
||||
cBuffer_o := aRegs[ES]
|
||||
nErrCode_o := nErrorCode
|
||||
|
||||
RETURN lSuccess
|
||||
|
||||
|
||||
STATIC FUNCTION _WriteBootSector( ;
|
||||
nDriveNum, ;
|
||||
cBuffer_i, ;
|
||||
nErrCode_o ;
|
||||
)
|
||||
// call BIOS INT 13 for sector write
|
||||
LOCAL aRegs[INT86_MAX_REGS]
|
||||
LOCAL lSuccess
|
||||
LOCAL nErrorCode
|
||||
LOCAL lCarryFlag
|
||||
STATIC FUNCTION _WriteBootSector( ;
|
||||
nDriveNum, ;
|
||||
cBuffer_i, ;
|
||||
nErrCode_o ;
|
||||
)
|
||||
// call BIOS INT 13 for sector write
|
||||
LOCAL aRegs[INT86_MAX_REGS]
|
||||
LOCAL lSuccess
|
||||
LOCAL nErrorCode
|
||||
LOCAL lCarryFlag
|
||||
|
||||
aRegs[DX] := nDriveNum // DH = 0 Head 0 , DL = drive number
|
||||
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[DX] := nDriveNum // DH = 0 Head 0 , DL = drive number
|
||||
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
|
||||
|
||||
lSuccess := _CallInt13hRetry( aRegs, @lCarryFlag, @nErrorCode )
|
||||
lSuccess := _CallInt13hRetry( aRegs, @lCarryFlag, @nErrorCode )
|
||||
|
||||
nErrCode_o := nErrorCode
|
||||
|
||||
RETURN lSuccess
|
||||
|
||||
|
||||
STATIC FUNCTION _CallInt13hRetry( ; // logical: did the interrupt succeed?
|
||||
aRegs_io, ; // registers values for INT 13h
|
||||
lCarrySet_o, ; // status of carry flag if return code is true.
|
||||
nDriveStatus_o ; // status of drive ( error code )
|
||||
)
|
||||
LOCAL lCarrySet
|
||||
LOCAL aRegisters
|
||||
LOCAL lSuccess
|
||||
LOCAL nInterrupt_c := 1*16+3 // INT 13h
|
||||
LOCAL i
|
||||
STATIC FUNCTION _CallInt13hRetry( ; // logical: did the interrupt succeed?
|
||||
aRegs_io, ; // registers values for INT 13h
|
||||
lCarrySet_o, ; // status of carry flag if return code is true.
|
||||
nDriveStatus_o ; // status of drive ( error code )
|
||||
)
|
||||
LOCAL lCarrySet
|
||||
LOCAL aRegisters
|
||||
LOCAL lSuccess
|
||||
LOCAL nInterrupt_c := 1*16+3 // INT 13h
|
||||
LOCAL i
|
||||
|
||||
lCarrySet := FALSE
|
||||
aRegisters := AClone( aRegs_io )
|
||||
lSuccess := FT_INT86( nInterrupt_c, aRegisters )
|
||||
IF lSuccess
|
||||
lCarrySet := carrySet( aRegisters[FLAGS] )
|
||||
IF lCarrySet
|
||||
_ResetDisketteSystem()
|
||||
lCarrySet := FALSE
|
||||
aRegisters := AClone( aRegs_io )
|
||||
lSuccess := FT_INT86( nInterrupt_c, aRegisters )
|
||||
IF lSuccess
|
||||
lCarrySet := carrySet( aRegisters[FLAGS] )
|
||||
IF lCarrySet
|
||||
_ResetDisketteSystem()
|
||||
|
||||
aRegisters := AClone( aRegs_io )
|
||||
FT_INT86( nInterrupt_c, aRegisters )
|
||||
lCarrySet := carrySet( aRegisters[FLAGS] )
|
||||
IF lCarrySet
|
||||
_ResetDisketteSystem()
|
||||
aRegisters := AClone( aRegs_io )
|
||||
FT_INT86( nInterrupt_c, aRegisters )
|
||||
lCarrySet := carrySet( aRegisters[FLAGS] )
|
||||
IF lCarrySet
|
||||
_ResetDisketteSystem()
|
||||
|
||||
aRegisters := AClone( aRegs_io )
|
||||
FT_INT86( nInterrupt_c, aRegisters )
|
||||
lCarrySet := carrySet( aRegisters[FLAGS] )
|
||||
IF lCarrySet
|
||||
_ResetDisketteSystem()
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
aRegisters := AClone( aRegs_io )
|
||||
FT_INT86( nInterrupt_c, aRegisters )
|
||||
lCarrySet := carrySet( aRegisters[FLAGS] )
|
||||
IF lCarrySet
|
||||
_ResetDisketteSystem()
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
FOR i := 1 TO INT86_MAX_REGS
|
||||
// pass altered register back up
|
||||
aRegs_io[i] := aRegisters[i]
|
||||
NEXT // i
|
||||
lCarrySet_o := lCarrySet
|
||||
FOR i := 1 TO INT86_MAX_REGS
|
||||
// pass altered register back up
|
||||
aRegs_io[i] := aRegisters[i]
|
||||
NEXT // i
|
||||
lCarrySet_o := lCarrySet
|
||||
nDriveStatus_o := highByte( aRegisters[AX] )
|
||||
|
||||
RETURN lSuccess
|
||||
|
||||
@@ -20,17 +20,17 @@ static s_lMinit:=.F.
|
||||
local nHoriz, nVert, nDouble
|
||||
local nTime
|
||||
|
||||
IF nRow=NIL
|
||||
nRow=MAXROW()+1
|
||||
ELSE
|
||||
nRow=VAL(nRow)
|
||||
ENDIF
|
||||
IF nRow=NIL
|
||||
nRow=MAXROW()+1
|
||||
ELSE
|
||||
nRow=VAL(nRow)
|
||||
ENDIF
|
||||
|
||||
IF nCol=NIL
|
||||
nCol=MAXCOL()+1
|
||||
ELSE
|
||||
nCol=VAL(nCol)
|
||||
ENDIF
|
||||
IF nCol=NIL
|
||||
nCol=MAXCOL()+1
|
||||
ELSE
|
||||
nCol=VAL(nCol)
|
||||
ENDIF
|
||||
|
||||
if !FT_MINIT()
|
||||
@ maxrow(), 0 say "Mouse driver is not installed!"
|
||||
@@ -55,13 +55,13 @@ static s_lMinit:=.F.
|
||||
|
||||
* ..... Start the demo
|
||||
|
||||
@MAXROW(),0 SAY "Driver version: "+;
|
||||
ALLTRIM(STR(FT_MVERSION(@nMinor,@nType,@nIRQ),2,0))+"."+;
|
||||
ALLTRIM(STR(nMinor,2,0))
|
||||
@MAXROW(),0 SAY "Driver version: "+;
|
||||
ALLTRIM(STR(FT_MVERSION(@nMinor,@nType,@nIRQ),2,0))+"."+;
|
||||
ALLTRIM(STR(nMinor,2,0))
|
||||
@ ROW(),COL() SAY " "+aType[nType]+" mouse using IRQ "+STR(nIRQ,1,0)
|
||||
|
||||
FT_MGETSENS(@nHoriz,@nVert,@nDouble) // Get the current sensitivities
|
||||
FT_MSETSENS(70,70,60) // Bump up the sensitivity of the mouse
|
||||
FT_MSETSENS(70,70,60) // Bump up the sensitivity of the mouse
|
||||
|
||||
FT_MSHOWCRS()
|
||||
FT_MSETCOORD(10,20) // just an arbitrary place for demo
|
||||
@@ -533,15 +533,15 @@ FT_MGETSENS(@nCurHoriz, @nCurVert, @nCurDouble)
|
||||
// Set defaults if necessary
|
||||
|
||||
IF VALTYPE(nHoriz)!="N"
|
||||
nHoriz=nCurHoriz
|
||||
nHoriz=nCurHoriz
|
||||
ENDIF
|
||||
|
||||
IF VALTYPE(nVert)!="N"
|
||||
nVert=nCurVert
|
||||
nVert=nCurVert
|
||||
ENDIF
|
||||
|
||||
IF VALTYPE(nDouble)!="N"
|
||||
nDouble=nCurDouble
|
||||
nDouble=nCurDouble
|
||||
ENDIF
|
||||
|
||||
* Fill the registers
|
||||
@@ -938,12 +938,12 @@ RETURN NIL // no output from function
|
||||
|
||||
FUNCTION FT_MHIDECRS() // decrement internal cursor flag and hide cursor
|
||||
/*
|
||||
aReg[AX] := 2 // set mouse function call 2
|
||||
aReg[AX] := 2 // set mouse function call 2
|
||||
FT_INT86( 51, aReg ) // execute mouse interrupt
|
||||
*/
|
||||
_mse_mhidecrs()
|
||||
s_lCrsState := .f.
|
||||
RETURN NIL // no output from function
|
||||
RETURN NIL // no output from function
|
||||
|
||||
/*
|
||||
* $DOC$
|
||||
@@ -1274,8 +1274,8 @@ RETURN NIL // no function output
|
||||
FUNCTION FT_MBUTPRS( nButton, nButPrs, nX, nY ) // get button press information
|
||||
local aReg:={}
|
||||
/*
|
||||
aReg[AX] := 5 // set mouse function call 5
|
||||
aReg[BX] := nButton // pass parameter for left or right button
|
||||
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 := aReg[1] // store updated press count
|
||||
@@ -1401,11 +1401,11 @@ RETURN iButton
|
||||
|
||||
FUNCTION FT_MDEFCRS( nCurType, nScrMask, nCurMask ) // define text cursor type and masks
|
||||
/*
|
||||
aReg[AX] = 10 // set mouse function call 10
|
||||
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
|
||||
FT_INT86( 51, aReg ) // execute mouse interrupt
|
||||
*/
|
||||
_m_mdefcrs(nCurType, nScrMask, nCurMask )
|
||||
RETURN NIL // no function output
|
||||
|
||||
@@ -87,23 +87,23 @@ static lMinit:=.F.
|
||||
local nHoriz, nVert, nDouble
|
||||
local nTime
|
||||
|
||||
IF nRow=NIL
|
||||
nRow=MAXROW()+1
|
||||
ELSE
|
||||
nRow=VAL(nRow)
|
||||
ENDIF
|
||||
IF nRow=NIL
|
||||
nRow=MAXROW()+1
|
||||
ELSE
|
||||
nRow=VAL(nRow)
|
||||
ENDIF
|
||||
|
||||
IF nCol=NIL
|
||||
nCol=MAXCOL()+1
|
||||
ELSE
|
||||
nCol=VAL(nCol)
|
||||
ENDIF
|
||||
IF nCol=NIL
|
||||
nCol=MAXCOL()+1
|
||||
ELSE
|
||||
nCol=VAL(nCol)
|
||||
ENDIF
|
||||
|
||||
IF .NOT.SETMODE(nRow,nCol)
|
||||
@maxrow(),0 SAY "Mode Change unsuccessful:"+STR(nRow,2,0)+" by";
|
||||
+STR(nCol,3,0)
|
||||
RETURN NIL
|
||||
ENDIF
|
||||
IF .NOT.SETMODE(nRow,nCol)
|
||||
@maxrow(),0 SAY "Mode Change unsuccessful:"+STR(nRow,2,0)+" by";
|
||||
+STR(nCol,3,0)
|
||||
RETURN NIL
|
||||
ENDIF
|
||||
|
||||
if empty( FT_MINIT() )
|
||||
@ maxrow(), 0 say "Mouse driver is not installed!"
|
||||
@@ -128,13 +128,13 @@ static lMinit:=.F.
|
||||
|
||||
* ..... Start the demo
|
||||
|
||||
@MAXROW(),0 SAY "Driver version: "+;
|
||||
ALLTRIM(STR(FT_MVERSION(@nMinor,@nType,@nIRQ),2,0))+"."+;
|
||||
ALLTRIM(STR(nMinor,2,0))
|
||||
@MAXROW(),0 SAY "Driver version: "+;
|
||||
ALLTRIM(STR(FT_MVERSION(@nMinor,@nType,@nIRQ),2,0))+"."+;
|
||||
ALLTRIM(STR(nMinor,2,0))
|
||||
@ ROW(),COL() SAY " "+aType[nType]+" mouse using IRQ "+STR(nIRQ,1,0)
|
||||
|
||||
FT_MGETSENS(@nHoriz,@nVert,@nDouble) // Get the current sensitivities
|
||||
FT_MSETSENS(70,70,60) // Bump up the sensitivity of the mouse
|
||||
FT_MSETSENS(70,70,60) // Bump up the sensitivity of the mouse
|
||||
|
||||
FT_MSHOWCRS()
|
||||
FT_MSETCOORD(10,20) // just an arbitrary place for demo
|
||||
@@ -306,7 +306,7 @@ FUNCTION FT_MINIT()
|
||||
* If not previously initialized then try
|
||||
|
||||
IF !lMinit
|
||||
lMinit=(FT_MRESET()!=0)
|
||||
lMinit=(FT_MRESET()!=0)
|
||||
ELSE
|
||||
* Reset maximum x and y limits
|
||||
|
||||
@@ -352,16 +352,16 @@ RETURN lMinit
|
||||
|
||||
FUNCTION FT_MRESET()
|
||||
|
||||
aReg[AX] := 0 // set mouse function call 0
|
||||
FT_INT86( 51, aReg ) // execute mouse interrupt
|
||||
lCrsState=.F. // Cursor is off after reset
|
||||
aReg[AX] := 0 // set mouse function call 0
|
||||
FT_INT86( 51, aReg ) // execute mouse interrupt
|
||||
lCrsState=.F. // Cursor is off after reset
|
||||
|
||||
* Reset maximum x and y limits
|
||||
|
||||
FT_MYLIMIT(0,8*MAXROW())
|
||||
FT_MXLIMIT(0,8*MAXCOL())
|
||||
|
||||
RETURN aReg[AX] // return status code
|
||||
RETURN aReg[AX] // return status code
|
||||
|
||||
|
||||
/* $DOC$
|
||||
@@ -485,12 +485,12 @@ RETURN NIL // no output from function
|
||||
|
||||
|
||||
|
||||
FUNCTION FT_MHIDECRS() // decrement internal cursor flag and hide cursor
|
||||
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
|
||||
aReg[AX] := 2 // set mouse function call 2
|
||||
FT_INT86( 51, aReg ) // execute mouse interrupt
|
||||
lCrsState := .f.
|
||||
RETURN NIL // no output from function
|
||||
RETURN NIL // no output from function
|
||||
|
||||
|
||||
/*
|
||||
@@ -869,14 +869,14 @@ RETURN NIL // no function output
|
||||
|
||||
FUNCTION FT_MBUTPRS( nButton, nButPrs, nX, nY ) // get button press information
|
||||
|
||||
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
|
||||
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 := aReg[BX] // store updated press count
|
||||
nX := aReg[DX] // x-coordinate at last press
|
||||
nY := aReg[CX] // y-coordinate at last press
|
||||
|
||||
RETURN aReg[AX] // return button status
|
||||
RETURN aReg[AX] // return button status
|
||||
|
||||
|
||||
|
||||
@@ -996,10 +996,10 @@ RETURN aReg[AX] // 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
|
||||
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
|
||||
|
||||
RETURN NIL // no function output
|
||||
|
||||
@@ -51,22 +51,22 @@
|
||||
* Also, numeric 0 is returned as a null string. You will need to
|
||||
* make a decision how to output it (zero dollars, no dollars, etc).
|
||||
* $EXAMPLES$
|
||||
* ? FT_NTOW( 999 ) -> Nine Hundred Ninety Nine
|
||||
* ? FT_NTOW( 999 ) -> Nine Hundred Ninety Nine
|
||||
*
|
||||
* ? FT_NTOW( 1000 ) -> One Thousand
|
||||
* ? FT_NTOW( 1000 ) -> One Thousand
|
||||
*
|
||||
* ? FT_NTOW( 23 ) + " Dollars and " + FT_NTOW( 99 ) + " Cents"
|
||||
* -> Twenty Three Dollars and Ninety Nine Cents
|
||||
* ? FT_NTOW( 23 ) + " Dollars and " + FT_NTOW( 99 ) + " Cents"
|
||||
* -> Twenty Three Dollars and Ninety Nine Cents
|
||||
*
|
||||
* ? FT_NTOW( 23 ) + " Dollars and " + "99/100"
|
||||
* -> Twenty Three Dollars and 99/100
|
||||
* ? FT_NTOW( 23 ) + " Dollars and " + "99/100"
|
||||
* -> Twenty Three Dollars and 99/100
|
||||
*
|
||||
* x := -23.99
|
||||
* cents := str( (x - int( x )) * 100, 2, 0 ) + "/100"
|
||||
* x := int( x )
|
||||
* string := iif( x < 0, "Credit of ", "Debit of " )
|
||||
* ? string + FT_NTOW( abs(x) ) + " Dollars and " + "99/100"
|
||||
* -> Credit of Twenty Three Dollars and 99/100
|
||||
* x := -23.99
|
||||
* cents := str( (x - int( x )) * 100, 2, 0 ) + "/100"
|
||||
* x := int( x )
|
||||
* string := iif( x < 0, "Credit of ", "Debit of " )
|
||||
* ? string + FT_NTOW( abs(x) ) + " Dollars and " + "99/100"
|
||||
* -> Credit of Twenty Three Dollars and 99/100
|
||||
* $END$
|
||||
*/
|
||||
|
||||
@@ -107,7 +107,7 @@ function ft_ntow(nAmount)
|
||||
if nTemp > (nDiv /= 1000) .and. (nDiv > 1)
|
||||
sResult += ft_ntow( nTemp, nDiv )
|
||||
else
|
||||
sResult += grp_to_words(nTemp, "")
|
||||
sResult += grp_to_words(nTemp, "")
|
||||
endif
|
||||
return( ltrim(sResult) )
|
||||
|
||||
@@ -120,13 +120,13 @@ static function grp_to_words(nGrp, sQual)
|
||||
sResult += ones[ nGrp + 1 ] + iif( nGrp > 0, " Hundred", "")
|
||||
|
||||
do case
|
||||
case nTemp > 19
|
||||
sResult += tens[ int( nTemp / 10 ) + 1 ]
|
||||
sResult += ones[ int( nTemp % 10 ) + 1 ]
|
||||
case nTemp > 19
|
||||
sResult += tens[ int( nTemp / 10 ) + 1 ]
|
||||
sResult += ones[ int( nTemp % 10 ) + 1 ]
|
||||
case nTemp < 20 .and. nTemp > 9
|
||||
sResult += teens[ int( nTemp % 10 ) + 1 ]
|
||||
sResult += teens[ int( nTemp % 10 ) + 1 ]
|
||||
case nTemp < 10 .and. nTemp > 0
|
||||
sResult += ones[ int( nTemp) + 1 ]
|
||||
sResult += ones[ int( nTemp) + 1 ]
|
||||
endcase
|
||||
return(sResult + sQual)
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ function ft_nwSemOpen( cName, nInitVal, nHandle, nOpenCnt )
|
||||
* FT_NWSEMOPEN( "Semaphore Test", nInitVal, @nHandle, @nOpenCnt )
|
||||
*
|
||||
* nRc := FT_NWSEMWAIT( nHandle )
|
||||
* IF nRc == 254
|
||||
* IF nRc == 254
|
||||
* QOUT( "All slots for this resource are currently in use" )
|
||||
* QUIT
|
||||
* ENDIF
|
||||
|
||||
@@ -51,10 +51,10 @@
|
||||
* FT_ESCCODE( <cASCII> ) -> <cPrinterFormat>
|
||||
* $ARGUMENTS$
|
||||
* <cASCII> is the ASCII representation of the printer control
|
||||
* codes in Lotus 123 format (e.g. "\027E" for Chr(27)+"E")
|
||||
* codes in Lotus 123 format (e.g. "\027E" for Chr(27)+"E")
|
||||
*
|
||||
* "\nnn" will be converted to Chr(nnn)
|
||||
* "\\" will be converted to "\"
|
||||
* "\nnn" will be converted to Chr(nnn)
|
||||
* "\\" will be converted to "\"
|
||||
* $RETURNS$
|
||||
* The binary version of an ASCII coded printer setup string.
|
||||
* $DESCRIPTION$
|
||||
@@ -74,31 +74,31 @@
|
||||
FUNCTION FT_ESCCODE( cInput )
|
||||
|
||||
LOCAL cOutput := "" ,;
|
||||
cCurrent ,;
|
||||
nPointer := 1 ,;
|
||||
nLen := Len( cInput )
|
||||
cCurrent ,;
|
||||
nPointer := 1 ,;
|
||||
nLen := Len( cInput )
|
||||
|
||||
DO WHILE nPointer <= nLen
|
||||
|
||||
cCurrent := Substr( cInput, nPointer, 1 )
|
||||
cCurrent := Substr( cInput, nPointer, 1 )
|
||||
|
||||
DO CASE
|
||||
|
||||
CASE cCurrent == "\" .AND. ;
|
||||
IsDigit(Substr(cInput, nPointer+1, 1) ) .AND. ;
|
||||
IsDigit(Substr(cInput, nPointer+2, 1) ) .AND. ;
|
||||
IsDigit(Substr(cInput, nPointer+3, 1) )
|
||||
cOutput += Chr(Val(Substr(cInput, nPointer+1,3)))
|
||||
nPointer += 4
|
||||
IsDigit(Substr(cInput, nPointer+1, 1) ) .AND. ;
|
||||
IsDigit(Substr(cInput, nPointer+2, 1) ) .AND. ;
|
||||
IsDigit(Substr(cInput, nPointer+3, 1) )
|
||||
cOutput += Chr(Val(Substr(cInput, nPointer+1,3)))
|
||||
nPointer += 4
|
||||
|
||||
CASE cCurrent == "\" .AND. ;
|
||||
Substr(cInput, nPointer+1, 1) == "\"
|
||||
cOutput += "\"
|
||||
nPointer += 2
|
||||
Substr(cInput, nPointer+1, 1) == "\"
|
||||
cOutput += "\"
|
||||
nPointer += 2
|
||||
|
||||
OTHERWISE
|
||||
cOutput += cCurrent
|
||||
nPointer++
|
||||
cOutput += cCurrent
|
||||
nPointer++
|
||||
|
||||
ENDCASE
|
||||
ENDDO
|
||||
|
||||
@@ -88,13 +88,13 @@
|
||||
FUNCTION FT_SLEEP( nSeconds, nInitial )
|
||||
|
||||
IF nInitial == NIL .OR. VALTYPE( nInitial ) != "N"
|
||||
nInitial := SECONDS()
|
||||
nInitial := SECONDS()
|
||||
ENDIF
|
||||
|
||||
// correct for running at midnight
|
||||
|
||||
IF nInitial + nSeconds > 86399
|
||||
nInitial -= 86399
|
||||
nInitial -= 86399
|
||||
* Wait until midnight
|
||||
DO WHILE SECONDS() > 100 // no problem with a _very_ slow machine
|
||||
ENDDO
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
* $DESCRIPTION$
|
||||
* FT_WORKDAYS() returns a number indicating the number of work days
|
||||
* between two dates. Work days are considered Monday through Friday.
|
||||
* (The five day work week none of us Clipper programmers have.)
|
||||
* (The five day work week none of us Clipper programmers have.)
|
||||
*
|
||||
* $EXAMPLES$
|
||||
* ? FT_WorkDays( CTOD("5/16/91"), CTOD("5/20/91") ) // 3 (Th - Mo)
|
||||
@@ -64,35 +64,35 @@
|
||||
|
||||
|
||||
FUNCTION FT_WorkDays( dStart, dStop )
|
||||
LOCAL nWorkDays := 0, nDays, nAdjust
|
||||
LOCAL nWorkDays := 0, nDays, nAdjust
|
||||
|
||||
IF dStart # NIL .AND. dStop # NIL
|
||||
IF dStart # dStop
|
||||
IF dStart > dStop // Swap the values
|
||||
IF dStart # NIL .AND. dStop # NIL
|
||||
IF dStart # dStop
|
||||
IF dStart > dStop // Swap the values
|
||||
nAdjust := dStop
|
||||
dStop := dStart
|
||||
dStart := nAdjust
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
IF ( nDays := Dow( dStart ) ) == 1 // Sunday (change to next Monday)
|
||||
dStart++
|
||||
ELSEIF nDays == 7 // Saturday (change to next Monday)
|
||||
dStart += 2
|
||||
ENDIF
|
||||
IF ( nDays := Dow( dStart ) ) == 1 // Sunday (change to next Monday)
|
||||
dStart++
|
||||
ELSEIF nDays == 7 // Saturday (change to next Monday)
|
||||
dStart += 2
|
||||
ENDIF
|
||||
|
||||
IF ( nDays := Dow( dStop ) ) == 1 // Sunday (change to prev Friday)
|
||||
dStop -= 2
|
||||
ELSEIF nDays == 7 // Saturday (change to prev Friday)
|
||||
dStop--
|
||||
ENDIF
|
||||
IF ( nDays := Dow( dStop ) ) == 1 // Sunday (change to prev Friday)
|
||||
dStop -= 2
|
||||
ELSEIF nDays == 7 // Saturday (change to prev Friday)
|
||||
dStop--
|
||||
ENDIF
|
||||
|
||||
nAdjust := ( nDays := dStop - dStart + 1 ) % 7
|
||||
nAdjust := ( nDays := dStop - dStart + 1 ) % 7
|
||||
|
||||
IF Dow( dStop ) + 1 < Dow( dStart ) // Weekend adjustment
|
||||
nAdjust -= 2
|
||||
ENDIF
|
||||
IF Dow( dStop ) + 1 < Dow( dStart ) // Weekend adjustment
|
||||
nAdjust -= 2
|
||||
ENDIF
|
||||
|
||||
nWorkDays := Int( nDays / 7 ) * 5 + nAdjust
|
||||
nWorkDays := Int( nDays / 7 ) * 5 + nAdjust
|
||||
|
||||
ELSEIF ( Dow( dStart ) # 1 .AND. Dow( dStart ) # 7 )
|
||||
|
||||
|
||||
@@ -111,21 +111,21 @@
|
||||
|
||||
#ifdef FT_TEST
|
||||
FUNCTION MAIN()
|
||||
local i
|
||||
setcolor('W/B')
|
||||
* clear screen
|
||||
for i = 1 to 24
|
||||
@ i, 0 say replicate('@', 80)
|
||||
next
|
||||
local i
|
||||
setcolor('W/B')
|
||||
* clear screen
|
||||
for i = 1 to 24
|
||||
@ i, 0 say replicate('@', 80)
|
||||
next
|
||||
|
||||
FT_XBOX(,,,,,,,'This is a test','of the XBOX() function')
|
||||
FT_XBOX('L','W','D','GR+/R','W/B',1,10,'It is so nice',;
|
||||
'to not have to do the messy chore',;
|
||||
'of calculating the box size!')
|
||||
FT_XBOX(,,,,,,,'This is a test','of the XBOX() function')
|
||||
FT_XBOX('L','W','D','GR+/R','W/B',1,10,'It is so nice',;
|
||||
'to not have to do the messy chore',;
|
||||
'of calculating the box size!')
|
||||
FT_XBOX(,'W','D','GR+/R','W/B',16,10,'It is so nice',;
|
||||
'to not have to do the messy chore',;
|
||||
'of calculating the box size!',;
|
||||
'Even though this line is way too long, and is in fact more than 80 characters long, if you care to check!')
|
||||
'to not have to do the messy chore',;
|
||||
'of calculating the box size!',;
|
||||
'Even though this line is way too long, and is in fact more than 80 characters long, if you care to check!')
|
||||
|
||||
return ( nil )
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user