C===========================CF.FOR (main)===============================
c This program converts from one set of units to another. Conversion
c factors and unit abreviations are defined according to the listing
c given in the "...UNITS" section of the HP-28S reference manual.
c
c CASE IS SIGNIFICANT when entering units.
c
c The degrees symbol, "ø" is produced by holding down Alt and typing
c 248 on the numeric key pad.
c The prefix micro is represented by lowercase u. /DEE 1-89
PARAMETER (MAXUNIT=5, MAXARG=70)
REAL*8 TV(120), SUCF, EUCF, CF
INTEGER TFUP(120,8), SUPOW(8), EUPOW(8), TUIND(120)
CHARACTER*423 TU
CHARACTER*(MAXARG) SU,EU
CHARACTER*(MAXUNIT) U
C==================MAIN PROGRAM
CALL TVAL (TV)
CALL TUNIT (TU,TUIND)
CALL TFUPOW (TFUP)
C------------Get Starting and Ending unit conversion arguments-----------
CALL GETC('Enter the original starting units:',SU)
CALL GETC('Enter the units to convert to:',EU)
C------------Compiling unit strings to a conversion factor and an
c integer unit vector...
CALL COMP(SUCF, SUPOW, SU, TV, TU, TUIND, TFUP)
CALL COMP(EUCF, EUPOW, EU, TV, TU, TUIND, TFUP)
C------------Check for consistancy of units...
DO 10, K=1, 8
IF ((SUPOW(K)-EUPOW(K)) .NE. 0) GOTO 20
10 CONTINUE
CF=SUCF/EUCF
PRINT *, 'The conversion factor is: ',CF
GOTO 30
20 PRINT *, 'Hey stupid the units do not check!'
30 END