*-----------------------------------------------------------------------
*     SWIQNP / SWIQID / SWIQCP / SWIQVL / SWISVL
*-----------------------------------------------------------------------
      SUBROUTINE SWIQNP(NCP)
      INTEGER   NCP
      CHARACTER CP*(*)

      PARAMETER (NPARA  = 8)
      PARAMETER (MAXWNU = 3)

      INTEGER   IX(NPARA)
      LOGICAL   LCHREQ, LFIRST
      CHARACTER CPARAS(NPARA)*8
      CHARACTER CPARAL(NPARA)*40
      CHARACTER CMSG*80

      EXTERNAL  LCHREQ,LENC

      SAVE
* ---- SHORT NAME ----
      DATA      CPARAS(1) / 'MAXWNU  ' / , IX(1) / MAXWNU /
      DATA      CPARAS(2) / 'IWS     ' / , IX(2) / 1 /
      DATA      CPARAS(3) / 'IPOSX   ' / , IX(3) / 0 /
      DATA      CPARAS(4) / 'IPOSY   ' / , IX(4) / 0 /
      DATA      CPARAS(5) / 'IWIDTH  ' / , IX(5) / 552 /
      DATA      CPARAS(6) / 'IHEIGHT ' / , IX(6) / 400 /
      DATA      CPARAS(7) / 'MODE    ' / , IX(7) / 1  /
      DATA      CPARAS(8) / 'MLIPS   ' / , IX(8) / 1  /
* ---- LONG NAME ----
      DATA      CPARAL(1) / '****MAXWNU  ' /
      DATA      CPARAL(2) / '****IWS     ' /
      DATA      CPARAL(3) / 'WINDOW_X_POS' /
      DATA      CPARAL(4) / 'WINDOW_Y_POS' /
      DATA      CPARAL(5) / 'WINDOW_WIDTH' /
      DATA      CPARAL(6) / 'WINDOW_HEIGHT' /
      DATA      CPARAL(7) / '****         ' /
      DATA      CPARAL(8) / '****         ' /

      DATA      LFIRST / .TRUE. /

      NCP = NPARA

      RETURN
*-----------------------------------------------------------------------
      ENTRY SWIQID(CP, IDX)

      DO 10 N = 1, NPARA
        IF (LCHREQ(CP, CPARAS(N))
     &        .OR. LCHREQ(CP, CPARAL(N))) THEN
          IDX = N
          RETURN
        END IF
   10 CONTINUE
      CMSG = 'PARAMETER '''//CP(1:LENC(CP))//''' IS NOT DEFINED.'
      CALL MSGDMP('E','SWIQID',CMSG)

      RETURN
*-----------------------------------------------------------------------
      ENTRY SWIQCP(IDX, CP)

      IF (1.LE.IDX .AND. IDX.LE.NPARA) THEN
        CP = CPARAS(IDX)
      ELSE
        CALL MSGDMP('E','SWIQCP','IDX IS OUT OF RANGE.')
      END IF

      RETURN
*-----------------------------------------------------------------------
      ENTRY SWIQCL(IDX, CP)

      IF (1.LE.IDX .AND. IDX.LE.NPARA) THEN
        CP = CPARAL(IDX)
      ELSE
        CALL MSGDMP('E','SWIQCL','IDX IS OUT OF RANGE.')
      END IF

      RETURN
*-----------------------------------------------------------------------
      ENTRY SWIQVL(IDX, IPARA)

      IF (LFIRST) THEN
        CALL RTIGET('SW:', CPARAS, IX, NPARA)
        CALL RLIGET(CPARAL, IX, NPARA)
        LFIRST=.FALSE.
      END IF

      IF (1.LE.IDX .AND. IDX.LE.NPARA) THEN
        IPARA = IX(IDX)
      ELSE
        CALL MSGDMP('E','SWIQVL','IDX IS OUT OF RANGE.')
      END IF

      RETURN
*-----------------------------------------------------------------------
      ENTRY SWISVL(IDX, IPARA)

      IF (LFIRST) THEN
        CALL RTIGET('SW:', CPARAS, IX, NPARA)
        CALL RLIGET(CPARAL, IX, NPARA)
        LFIRST = .FALSE.
      END IF

      IF (1.LE.IDX .AND. IDX.LE.NPARA) THEN
        IX(IDX) = IPARA
      ELSE
        CALL MSGDMP('E','SWISVL','IDX IS OUT OF RANGE.')
      END IF

      RETURN
*-----------------------------------------------------------------------
      ENTRY SWIQIN(CP, IN)

      DO 20 N = 1, NPARA
         IF (LCHREQ(CP, CPARAS(N)) .OR.
     &        LCHREQ(CP, CPARAL(N))) THEN
            IN = N
            RETURN
         ENDIF
 20   CONTINUE

      IN = 0

      RETURN
      END
