C
C SUBROUTINE 'TASKF'
C ==================
C
C Output a text prompt to the terminal with a default floating point value
C (and log file if required). Read in and return a floating point value.
C
C If the reply has invalid syntax then the prompt will be repeated
C
C (Max length for reply and value in prompt is 25 characters)
C
C Logging as for TPROMP and TREAD
C
C If possible do not output a carriage return or linefeed after the prompt.
C
      SUBROUTINE TASKF (STR, VALUE, ND, EOF)
C
C Parameters:
C
C      STR (I)   Character string for the question 
C                The default value will be appended as ' [value]: '
C    VALUE (I/O) On input:  the default value
C                On output:  the value read in
C       ND (I)   The number of decimal places for the value in the prompt
C                (if -ve then use E format) (Max 2 digits)
C      EOF (O)   Logical flag = .true. if end of file (or read error) 
C                encountered else .false.
C
C====== Specification statements
C
      CHARACTER*(*) STR
      REAL VALUE
      INTEGER ND
      LOGICAL EOF, ERR
      CHARACTER*120 PROMPT
      CHARACTER*25 FPSTR
      CHARACTER*8 FMT
      LOGICAL LOG
      COMMON /TTCOMN/ LUNR, LUNW, LUNLR, LUNLW, MODETT, LOG
      SAVE /TTCOMN/
C
C====== Get length less trailing blanks
C
      LL = LEN(STR)
      DO 100 L=LL,1,-1
         IF (STR(L:L).NE.' ') GO TO 120
100   CONTINUE
      L=1
C
C====== Write floating point value to a string
C
120   IF (ND.GT.0) THEN
         FMT = '(F25.  )'
         WRITE (FMT(6:7),'(I2.2)') ND
         WRITE (FPSTR,FMT) VALUE
      ELSE IF (ND.LT.0) THEN
         FMT = '(E25.  )'
         WRITE (FMT(6:7),'(I2.2)') -ND
         WRITE (FPSTR,FMT) VALUE
      ELSE
         WRITE (FPSTR,'(I25)') NINT(VALUE)
      ENDIF
C
C====== Form prompt string
C
      PROMPT = STR(1:L)//' ['
      L = L + 2
      DO 130 I=1,25
         IF (FPSTR(I:I).NE.' ') THEN
            L = L + 1
            PROMPT(L:L) = FPSTR(I:I)
         ENDIF
130   CONTINUE
      PROMPT(L+1:) =']: '
      L = L + 3
C
C====== Output prompt
C
200   CALL TPROMP (PROMPT(1:L))
C
C====== Get reply
C
      CALL TREAD (FPSTR, EOF)
      IF (EOF) RETURN
      IF (FPSTR.EQ.' ') RETURN
      X = FLPVAL(FPSTR,ERR)
      IF (ERR) GO TO 200
      VALUE = X
      RETURN
      END
