      PROGRAM MHELP
C          to make an !SrcEdit type help file
      CHARACTER LINE*80, TEST*80
      LOGICAL NOGR
   10 PRINT 101
  101 FORMAT(' Exclude GRxxxx routines? (Y/N) ',$)
      READ(*,102,ERR=10)TEST
  102 FORMAT(A)
      IF(TEST.EQ.'Y'.OR.TEST.EQ.'y') THEN
        NOGR=.TRUE.
      ELSEIF(TEST.EQ.'N'.OR.TEST.EQ.'n') THEN
        NOGR=.FALSE.
      ELSE
        GO TO 10
      ENDIF
      OPEN(10,FILE='<PGPlot_Dir>.f77.PGPlot',STATUS='OLD',ERR=90)
      OPEN(11,FILE='<PGPlot_Dir>.HelpPGPLOT',STATUS='UNKNOWN')
   20 READ(10,102,END=80)LINE
      IF(LINE(1:2).NE.'C*') GO TO 20
   30 IF(LINE(3:4).EQ.'GR'.AND.NOGR) GO TO 20
   40 READ(10,102,END=80)TEST
      IF(TEST(1:2).EQ.'C*') THEN
        LINE=TEST
        GO TO 30
      ENDIF
      IF(TEST(1:2).NE.'C+') GO TO 40
      L=LNBLNK(LINE)
      I=INDEX(LINE,' ')
      WRITE(11,102)'%'//LINE(3:I-1)
      PRINT 102,LINE(3:I-1)
      I=INDEX(LINE(I+1:),' ')+I
      WRITE(11,102)LINE(I:L)
   50 READ(10,102,END=80)LINE
      IF(LINE(1:3).EQ.'C--') THEN
        WRITE(11,*)
        GO TO 20
      ELSE
        L=MAX(2,LNBLNK(LINE))
        WRITE(11,102)LINE(2:L)
      ENDIF
      GO TO 50
   80 CLOSE(10)
      CLOSE(11)
      CALL OSCLI('SetType <PGPlot_Dir>.HelpPGPLOT FFF')
      STOP
   90 STOP 'Can not find PGPLOT source in f77 directory'
      END
