home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windoware
/
WINDOWARE_1_6.iso
/
source
/
f4w3api
/
f4w3api.kit
/
WINDEV
/
FORTRAN
/
FWCLOCK
/
DIGIT.FOR
< prev
next >
Wrap
Text File
|
1991-11-09
|
10KB
|
203 lines
$DEFINE GDI
$DEFINE USER
INCLUDE 'WINDOWS.FI'
SUBROUTINE DIGIT(IX,IY,IDIGIT,ZFIRST,IZY)
IMPLICIT NONE
C
C Author : Kevin Black
C Date written : February 1986
C Abstract :
C
C Subroutine to one of the numerical digits on the clock face. The data used
C to generate the digits is from the Hershey character set.
C
C Arguments
C
INTEGER*2 IX,IY,IDIGIT,IZY ! Digit to draw and positioning
LOGICAL ZFIRST ! True for first digit of digit pair
C
C Local parameters, variables and function declarations
C
INCLUDE 'WINDOWS.FD' ! Include windows functions and parameters
INCLUDE 'FWCLOCK.FD' ! Include FWClock variables and parameters
REAL SCALE ! Scaling factor
INTEGER IOP,IVLR,IV ! Data table indexing
INTEGER*2 ITX,ITY ! Coordinates for drawing
LOGICAL FIRST ! First digit control flag
INTEGER*2 CSTART(10) ! Character data index
BYTE CDATA(2,530) ! Character data
BYTE ZERO(90),ONE(60),TWO(100),THREE(120),FOUR(90)
BYTE FIVE(110),SIX(120),SEVEN(80),EIGHT(150),NINE(130)
EQUIVALENCE (CDATA(1,1) ,ZERO) ,(CDATA(1,46) ,ONE),
* (CDATA(1,76),TWO) ,(CDATA(1,126),THREE),
* (CDATA(1,186),FOUR) ,(CDATA(1,231),FIVE),
* (CDATA(1,286),SIX) ,(CDATA(1,346),SEVEN),
* (CDATA(1,386),EIGHT),(CDATA(1,461),NINE)
C
C Data for index to start position in character data of each character
C
DATA CSTART/ 1, 46, 76, 126, 186, 231, 286, 346, 386, 461/
C
C Character data
C
DATA ZERO/
* -10, 10, -6, -10, -6, 6, -8, 7, -64, 0,
* -5, -9, -5, 6, -2, 8, -64, 0, -4, -10,
* -4, 6, -2, 7, -1, 8, -64, 0, -6, -10,
* -4, -10, 1, -11, 3, -12, -64, 0, 1, -11,
* 2, -10, 4, -9, 4, 7, -64, 0, 2, -11,
* 5, -9, 5, 6, -64, 0, 3, -12, 4, -11,
* 6, -10, 8, -10, 6, -9, 6, 7, -64, 0,
* -8, 7, -6, 7, -4, 8, -3, 9, -1, 8,
* 4, 7, 6, 7, -64, -64, 0, 0, 0, 0/
DATA ONE/
* -10, 10, -3, -10, -2, -9, -1, -7, -1, 6,
* -3, 7, -64, 0, -1, -9, -2, -10, -1, -11,
* 0, -9, 0, 7, 2, 8, -64, 0, -3, -10,
* 0, -12, 1, -10, 1, 6, 3, 7, 4, 7,
* -64, 0, -3, 7, -2, 7, 0, 8, 1, 9,
* 2, 8, 4, 7, -64, -64, 0, 0, 0, 0/
DATA TWO/
* -10, 10, -6, -10, -4, -10, -2, -11, -1, -12,
* 1, -11, 4, -10, 6, -10, -64, 0, -2, -10,
* 0, -11, -64, 0, -6, -10, -4, -9, -2, -9,
* 0, -10, 1, -11, -64, 0, 4, -10, 4, -2,
* -64, 0, 5, -9, 5, -3, -64, 0, 6, -10,
* 6, -2, -1, -2, -4, -1, -6, 1, -7, 4,
* -7, 9, -64, 0, -7, 9, -3, 7, 1, 6,
* 4, 6, 8, 7, -64, 0, -4, 8, -1, 7,
* 4, 7, 7, 8, -64, 0, -7, 9, -2, 8,
* 3, 8, 6, 9, 8, 7, -64, -64, 0, 0/
DATA THREE/
* -10, 10, -6, -10, -5, -10, -3, -11, -2, -12,
* 0, -11, 4, -10, 6, -10, -64, 0, -3, -10,
* -1, -11, -64, 0, -6, -10, -4, -9, -2, -9,
* 0, -11, -64, 0, 4, -10, 4, -3, -64, 0,
* 5, -9, 5, -4, -64, 0, 6, -10, 6, -3,
* 4, -3, 1, -2, -1, -1, -64, 0, -1, -2,
* 1, -1, 4, 0, 6, 0, 6, 7, -64, 0,
* 5, 1, 5, 6, -64, 0, 4, 0, 4, 7,
* -64, 0, -7, 7, -5, 6, -3, 6, -1, 7,
* 0, 8, -64, 0, -3, 7, -1, 8, -64, 0,
* -7, 7, -5, 7, -3, 8, -2, 9, 0, 8,
* 4, 7, 6, 7, -64, -64, 0, 0, 0, 0/
DATA FOUR/
* -10, 10, 3, -12, -7, -2, -7, 3, 2, 3,
* -64, 0, 4, 3, 8, 3, 9, 4, 9, 2,
* 8, 3, -64, 0, -6, -2, -6, 2, -64, 0,
* -5, -4, -5, 3, -64, 0, 2, -11, 2, 6,
* 0, 7, -64, 0, 3, -8, 4, -10, 3, -11,
* 3, 7, 5, 8, -64, 0, 3, -12, 5, -10,
* 4, -8, 4, 6, 6, 7, 7, 7, -64, 0,
* 0, 7, 1, 7, 3, 8, 4, 9, 5, 8,
* 7, 7, -64, -64, 0, 0, 0, 0, 0, 0/
DATA FIVE/
* -10, 10, -6, -12, -6, -3, -64, 0, -6, -12,
* 6, -12, -64, 0, -5, -11, 4, -11, -64, 0,
* -6, -10, 3, -10, 5, -11, 6, -12, -64, 0,
* 4, -6, 3, -5, 1, -4, -3, -3, -6, -3,
* -64, 0, 1, -4, 2, -4, 4, -3, 4, 7,
* -64, 0, 3, -5, 5, -4, 5, 6, -64, 0,
* 4, -6, 5, -5, 7, -4, 8, -4, 6, -3,
* 6, 7, -64, 0, -7, 7, -5, 6, -3, 6,
* -1, 7, 0, 8, -64, 0, -3, 7, -1, 8,
* -64, 0, -7, 7, -5, 7, -3, 8, -2, 9,
* 0, 8, 4, 7, 6, 7, -64, -64, 0, 0/
DATA SIX/
* -10, 10, -6, -10, -6, 6, -8, 7, -64, 0,
* -5, -9, -5, 6, -2, 8, -64, 0, -4, -10,
* -4, 6, -2, 7, -1, 8, -64, 0, -6, -10,
* -4, -10, 0, -11, 2, -12, 3, -11, 5, -10,
* 6, -10, -64, 0, 1, -11, 3, -10, -64, 0,
* 0, -11, 2, -9, 4, -9, 6, -10, -64, 0,
* -4, -2, -3, -2, 1, -3, 3, -4, 4, -5,
* -64, 0, 1, -3, 2, -3, 4, -2, 4, 7,
* -64, 0, 3, -4, 5, -2, 5, 6, -64, 0,
* 4, -5, 5, -4, 7, -3, 8, -3, 6, -2,
* 6, 7, -64, 0, -8, 7, -6, 7, -4, 8,
* -3, 9, -1, 8, 4, 7, 6, 7, -64, -64/
DATA SEVEN/
* -10, 10, -7, -10, -5, -12, -2, -11, 3, -11,
* 8, -12, -64, 0, -6, -11, -3, -10, 2, -10,
* 5, -11, -64, 0, -7, -10, -3, -9, 0, -9,
* 4, -10, 8, -12, -64, 0, 8, -12, 7, -10,
* 5, -7, 1, -3, -1, 0, -2, 3, -2, 6,
* -1, 9, -64, 0, 0, -1, -1, 2, -1, 5,
* 0, 8, -64, 0, 3, -5, 1, -2, 0, 1,
* 0, 4, 1, 7, -1, 9, -64, -64, 0, 0/
DATA EIGHT/
* -10, 10, -6, -9, -6, -3, -64, 0, -5, -8,
* -5, -4, -64, 0, -4, -9, -4, -3, -64, 0,
* -6, -9, -4, -9, 1, -10, 3, -11, 4, -12,
* -64, 0, 1, -10, 2, -10, 4, -9, 4, -3,
* -64, 0, 3, -11, 5, -10, 5, -4, -64, 0,
* 4, -12, 5, -11, 7, -10, 8, -10, 6, -9,
* 6, -3, -64, 0, -6, -3, -4, -3, 4, 0,
* 6, 0, -64, 0, 6, -3, 4, -3, -4, 0,
* -6, 0, -64, 0, -6, 0, -6, 6, -8, 7,
* -64, 0, -5, 1, -5, 6, -2, 8, -64, 0,
* -4, 0, -4, 6, -2, 7, -1, 8, -64, 0,
* 4, 0, 4, 7, -64, 0, 5, 1, 5, 6,
* -64, 0, 6, 0, 6, 7, -64, 0, -8, 7,
* -6, 7, -4, 8, -3, 9, -1, 8, 4, 7,
* 6, 7, -64, -64, 0, 0, 0, 0, 0, 0/
DATA NINE/
* -10, 10, -6, -10, -6, -1, -8, 0, -64, 0,
* -5, -9, -5, 0, -3, 1, -64, 0, -4, -10,
* -4, -1, -2, 0, -1, 0, -64, 0, -6, -10,
* -4, -10, 1, -11, 3, -12, -64, 0, 1, -11,
* 2, -10, 4, -9, 4, 7, -64, 0, 2, -11,
* 5, -9, 5, 6, -64, 0, 3, -12, 4, -11,
* 6, -10, 8, -10, 6, -9, 6, 7, -64, 0,
* -8, 0, -7, 0, -5, 1, -4, 2, -3, 1,
* -1, 0, 3, -1, 4, -1, -64, 0, -7, 7,
* -5, 6, -3, 6, -1, 7, 0, 8, -64, 0,
* -3, 7, -1, 8, -64, 0, -7, 7, -5, 7,
* -3, 8, -2, 9, 0, 8, 4, 7, 6, 7,
* -64, -64, 0, 0, 0, 0, 0, 0, 0, 0/
C
C Compute scaling, initialise for digit time and get initial character
C data indexing information
C
SCALE=FLOAT(RADIUS)/175.0
FIRST=ZFIRST
IX=IX+SCALE*FLOAT(IZY)
IOP=1
IVLR=CSTART(IDIGIT+1)
IV=IVLR+1
IOP=1
IF(.NOT.FIRST)IX=IX-INT(FLOAT(CDATA(1,IVLR))*SCALE)
FIRST=.FALSE.
C
C Loop through all the data for the digit and draw/move the pen as
C indicated to draw the character
C
20 ITX=CDATA(1,IV)
ITY=CDATA(2,IV)
IF(ITX.EQ.-64)THEN
IF(ITY.EQ.-64)THEN
IX=IX+INT(FLOAT(CDATA(2,IVLR))*SCALE)
RETURN
ELSE
IF(ITY.EQ.0)THEN
IOP=1
IV=IV+1
GOTO 20
ELSE
CALL FatalAppExit(0,'FWClock fatal error in DIGIT'C)
RETURN ! Catch all, there should be no return from FatalAppExit
ENDIF
ENDIF
ENDIF
ITX=IX+INT(FLOAT(ITX)*SCALE)
ITY=IY+INT(FLOAT(ITY)*SCALE)
IF(IOP.EQ.1)THEN
WSTATUS=MoveTo(FWCPS.HDC,ITX,ITY)
IOP=2
ELSE
WSTATUS=LineTo(FWCPS.HDC,ITX,ITY)
ENDIF
IV=IV+1
GOTO 20
END