C*GREXEC -- PGPLOT device handler dispatch routine
C+
      SUBROUTINE GREXEC(IDEV,IFUNC,RBUF,NBUF,CHR,LCHR)
      INTEGER IDEV, IFUNC, NBUF, LCHR
      REAL    RBUF(*)
      CHARACTER*(*) CHR
C---
      INTEGER NDEV
      PARAMETER (NDEV=21)
      CHARACTER*10 MSG
C---
      GOTO(1,2,3,4,5,6,7,8,9,10,11,12,13,14,
     +     15,16,17,18,19,20,21) IDEV
      IF (IDEV.EQ.0) THEN
          RBUF(1) = NDEV
          NBUF = 1
      ELSE
          WRITE (MSG,'(I10)') IDEV
          CALL GRWARN('Unknown device code in GREXEC: '//MSG)
      END IF
      RETURN
C---
1     CALL GIDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,1)
      RETURN
2     CALL GIDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,2)
      RETURN
3     CALL GLDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,1)
      RETURN
4     CALL GLDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,2)
      RETURN
5     CALL HGDRIV(IFUNC,RBUF,NBUF,CHR,LCHR)
      RETURN
6     CALL LXDRIV(IFUNC,RBUF,NBUF,CHR,LCHR)
      RETURN
7     CALL NUDRIV(IFUNC,RBUF,NBUF,CHR,LCHR)
      RETURN
8     CALL PPDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,1)
      RETURN
9     CALL PPDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,2)
      RETURN
10    CALL PSDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,1)
      RETURN
11    CALL PSDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,2)
      RETURN
12    CALL PSDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,3)
      RETURN
13    CALL PSDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,4)
      RETURN
14    CALL TTDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,4)
      RETURN
15    CALL TTDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,5)
      RETURN
16    CALL TTDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,9)
      RETURN
17    CALL WDDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,1)
      RETURN
18    CALL WDDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,2)
      RETURN
19    CALL X2DRIV(IFUNC,RBUF,NBUF,CHR,LCHR)
      RETURN
20    CALL XWDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,1)
      RETURN
21    CALL XWDRIV(IFUNC,RBUF,NBUF,CHR,LCHR,2)
      RETURN
C
      END
