PRO Read_Test, text, default, value, MINIMUM = minimum, $
	MAXIMUM = maximum, HMS = hms

;+
; NAME:
;	Read_Test
; PURPOSE:
;	Reads a value on the terminal and sets a default 
;	if the return key has been pressed directly. 
; CATEGORY:
;	I/O
; CALLING SEQUENCE:
; 	Read_Test, text, default, value
; INPUTS:
;	text: a message to print before the reading action
;	default: the value to set to the variable if it has not
;		been entered
; OUTPUT:
;	value: the variable where the number read is stored.
; KEYWORDS: 
;	MINIMUM: the minimum set if the number is too low
;	MAXIMUM: the maximum set if the number is too high
;	HMS: The in/output format is of type hh:mm:ss.sss
; RESTRICTION:
;	The type of the variable is REAL
;
; MODIFICATION HISTORY:
;	Creadted by A.Csillaghy in June 1991
;	Max and min added in November 91
;-

  IF NOT Keyword_Set( MAXIMUM ) THEN maximum = 3.40282e38
  IF NOT Keyword_Set( MINIMUM ) THEN minimum = -3.40282e38
  IF NOT Keyword_Set( HMS ) THEN hms = 0 ELSE hms = 1

  REPEAT BEGIN
    val = ''
    IF hms THEN $
        Read, ''+text+'( = '+ HMSConvert(default)+' ): ', val $
    ELSE $
        Read, ''+text+'( = '+ StrTrim(default,2)+' ): ', val

    IF val EQ '' THEN  value = default $
    ELSE IF hms THEN value =  DecConvert( val ) $
    ELSE value = Double( val )

  END UNTIL (minimum LE value) AND (value LE maximum)

END