next up previous contents
Next: EXAMPLE 2 - Up: EXAMPLES Previous: EXAMPLES

EXAMPLE 1 - SIMPLE PROMPTED INPUT

This example just prompts the User for a few quantities and then performs some actions on the basis of these.

C------------------- EXAMPLE 1 CODE ------------------------


      PROGRAM EXAMPLE1
C
C       Description:-
C       =============
C       Example Program to exercise UIPACK Prompted Input
C       Subprograms.
C
C       Global Declarations:-
C       =====================
C
$$If VAX
      Implicit None
$$Endif
$$Include 'UIPack$Library:UINames.Inc'
$$Include 'UIPack$Library:UIParam.Inc'
$$Include 'UIPack$Library:UIError.Inc'
C
C       Local Declarations
C       ==================
C
      LOGICAL      LOGVAL,EXECUT, LEARN
      INTEGER      INTVAL,STATUS,NVALUE
      REAL         RVALUE
      INTEGER      ILIST (2,64)
      REAL         RBOUND(2)
      CHARACTER*32 STRING
      CHARACTER*64 FILNAM
C
C       Executable Code:-
C       =================
C
      STATUS = UIINIT()                                         (1)
      LEARN  = .FALSE.
      STATUS = UIGTYE('Enable Automatic Learning',LEARN)        (2)
      IF (LEARN) THEN
         FILNAM = ' '
         STATUS = UIGTTX('Filename',FILNAM)
         STATUS = UIENLE(FILNAM)
      ENDIF
      EXECUT = .FALSE.
      STATUS = UIGTYE('Automatically Execute Command File',     (3)
     &                 EXECUTE)
      IF (EXECUT) THEN
         FILNAM = ' '
         STATUS = UIGTTX('Filename',FILNAM)
         STATUS = UIEXFI(FILNAM)
      ENDIF
C
      INTVAL = 1                                                (4)
      STATUS = UISUCC
100   CONTINUE
      IF (STATUS .EQ. UISUCC) THEN
         STATUS = UIGTIN('Integer Value',INTVAL)
         TYPE *,'Integer Value =',INTVAL
         GO TO 100
      ENDIF
C
      STATUS = UISUCC                                           (5)
110   CONTINUE
      IF (STATUS .EQ. UISUCC) THEN
         STATUS = UIGTIN('Integer Value',INTVAL,0,10)
         TYPE *,'STATUS, Integer Value =',STATUS,INTVAL
         GO TO 110
      ENDIF
C                                                               (6)
      LOGVAL = .FALSE.
      STATUS = UIGTLO('Logical Value',LOGVAL)
      TYPE *,'Logical Value =',LOGVAL
C                                                               (7)
      STRING = 'Hi'
      STATUS = UISUCC
120   CONTINUE
      IF (STATUS .EQ. UISUCC) THEN
         STATUS = UIGTTX('Text Value',STRING)
         TYPE *,'String =',STRING
         GO TO 120
      ENDIF
C                                                               (8)
      RBOUND(1) =  0.0
      RBOUND(2) = 10.0
      STATUS = UISUCC
130   CONTINUE
      IF (STATUS .EQ. UISUCC) THEN
         STATUS = UIGTRB('Real Bounds',RBOUND)
         TYPE *,'Real Bounds =',RBOUND
         GO TO 130
      ENDIF
C                                                               (9)
      NVALUE = 1
140   CONTINUE
      IF (STATUS .EQ. UISUCC) THEN
         STATUS = UIGTIL('Integer List',ILIST,64,NVALUE)
         TYPE *,'Integer List =',NVALUE,INTLIST(1,1),
     &                                  INTLIST(2,1),
     &                                  INTLIST(1,2),
     &                                  INTLIST(2,2)
         GO TO 140
      ENDIF
C                                                               (10)
      STATUS = UIFINI()
      STOP
      END
C
C
C ----------------- END OF EXAMPLE 1 -----------------------

Notes:

  1. This call initialises UIPACK with its default settings.
  2. This code will prompt the User whether he wants the Commands in this session (or until he types ``}" as a response) to be written to a file. If he indicates that the session should be saved, then he will be prompted to specify a filename.
  3. This code will prompt the User whether he wants Input to be taken from an Indirect Command File rather than the Keyboard. If he indicates that this is the case, then he will be prompted to specify an input filename.
  4. This code will loop prompting the User to supply an Integer value and display the response until the user specifies a default response.
  5. This code will loop prompting the User to supply an Integer value within the specified range and display the response until the user specifies a default response.
  6. This code prompts the User to supply a Logical (True/False) value.
  7. This code will loop prompting the User to supply a Text value and display the response until the user specifies a default response.
  8. This code will loop prompting the User to supply Real Bounds and display the response until the user specifies a default response.
  9. This code will loop prompting the User to supply a List of Integer values and display the first few elements until the user specifies a null list.
  10. This code terminates the use of UIPACK.



Liz Buckle
Fri Jan 13 17:20:31 CST 1995