C     THIS IS FILE TCDRIV.FOR
C     PURPOSE--THESE ARE THE FORTRAN ROUTINES WHICH SERVE AS
C              A DRIVER & BRIDGE BETWEEN THE DATAPLOT FORTRAN
C              AND THE TURBO-C C DRIVER, AND ULTIMATELY
C              THE TURBO C C ROUTINES.
C
C     TIME DRAIN--THE C CODE WILL NOT WORK & WILL GET ERROR MESSAGE:
C                 "REAL MODE LIBRARY TERMINATED IMPROPERLY--
C                 PLEASE REBOOT"
C                 UNLESS    COMSPACE   IN AUTOEXEC.BAT
C                 IS AT LEAST 400000 .
C                 THIS HAS BEEN A PROBLEM 3 TIMES!
C
C     NOTE--IT IS BEST THAT THE TURBO-C LOAD SWITCH (1/0) LOGIC
C           AND THE TURBO-C GRAPHICS STATUS (OPEN/CLOSE) LOGIC
C           IS DONE HEREIN RATHER THAN BE SCATTERED ABOUT
C           IN THE REST OF THE DATAPLOT CODE.
CCCCC NOTE--THE COMMON STRUCTURE IS--
CCCCC COMMON /FC/NTEXTF,NTEXTC,NPLOTF,TEXTFC,TEXTCF,PLOTFC(11)
CCCCC BYTES:       4      4      4      84     84     84*11
C
C NOTE--THESE ARE THE TURBO-C FILES--
C TEXT OUTPUT       7 C:\TURBOC\FRONTEND\DPTEXT.TEX TCSHME+ TCGECO-+
C GRAPHICS OUTPUT   8 C:\TURBOC\FRONTEND\DPPLOT.TEX
C TCDRIV DEBUG      9 C:\TURBOC\FRONTEND\TCDEBU.TEX TCLOTC+ TCGETC-
C COM. HIST. INPUT 10 C:\TURBOC\FRONTEND\DPCOMM.TEX TCINCF+- TCWRCO+-+-
C
C     NOTE--THERE ARE 4 TURBO-C SWITCHES--
C           1. TCLOAD
C              HAS CMAIN.EXE BEEN LOADED (& INIT. EXEC.)? YES/NO
C           2. TCMENU
C              IS THE TURBO C MENU ON THE SCREEN?         YES/NO
C           3. TCPLFI        FILE 8
C              WHAT IS STATUS OF THE TURBO C PLOT FILE?   OPEN/CLOS
C           4. TCTEFI        FILE 7
C              WHAT IS STATUS OF THE TURBO C TEXT FILE?   OPEN/CLOS
C              C:\TURBOC\FRONTEND\DPTEXT.TEX:
C              INITIAL OPENING:  MAIN => TCDRIV(TCSHME)
C                                (& SET TCTEFI TO OPEN)
C              REPEATEDLY CLOSE AND OPEN: TCDRIV(TCGECO)
C                                (& SET TCTEFI TO CLOS THEN OPEN)
C              REPEATEDLY WRITTEN: Many => GRWRST with IGUNIT=7
C              CLOSE WHEN HAVE   EXIT   COMMAND:  TCDRIV(TCGECO)
C                                (& SET TCTEFI TO CLOS)
C
C     NOTE--WHEN THE COMMAND    MENU   IS ENTERED ON THE FORTRAN SIDE,
C           THIS IS DETECTED IN     MAIN.FOR
C           AND THEN   TCLOTC IS CALLED FIRST
C           AND        TCSHME IS CALLED SECOND
C           (BOTH FROM    MAIN.FOR)
C     NOTE--THEY ARE INITIALLY ALLOCATED IN DPCODV.INC
C           THEY ARE INITIALLY DEFINED   IN INITOD.FOR
C     WRITTEN BY--JAMES J. FILLIBEN
C     ORIGINAL VERSION--MAY         1991
C     UPDATED         --MAY         1991
C     UPDATED         --JUNE        1991
C     UPDATED         --FEBRUARY    1995
C     UPDATED         --MARCH       1995
C
C ----------TCINCO-----------------------------
C
      SUBROUTINE TCINCO(ISUBRO)
C
C     PURPOSE--INITIALIZE TURBO-C COMMON
C              (THIS IS DONE ONLY ONCE PER DATAPLOT RUN)
C     DATAPLOT CALLING ROUTINE--INITOD ONLY (MAIN--MAININ--INITOD)
C     NOTE--WHEN THE USER ENTERS THE    MENU   COMMAND
C           FROM THE FORTRAN SIDE (BEFORE ANY MENU IS ON THE SCREEN)
C           TCINCO IS THE FIRST ROUTINE CALLED
C           TCLOTC IS THE SECOND ROUTINE CALLED
C           AND TCSHME IS THE THIRD ROUTINE CALLED
C           (ALL FROM MAIN)
CCCCC THE FOLLOWING COMMENT LINES WERE ADDED MAY 1992 (JJF)
C     DEFINE THE 4 GENERAL TURBO-C SWITCHES.
C     NOTE--THERE ARE 4 TURBO-C SWITCHES--
C           1. TCLOAD
C              HAS CMAIN.EXE BEEN LOADED (& INIT. EXEC.)? YES/NO
C           2. TCMENU
C              IS THE TURBO C MENU ON/OFF THE SCREEN?     ON/OFF
C           3. TCPLFI
C              WHAT IS STATUS OF THE TURBO C PLOT FILE?   OPEN/CLOS
C           4. TCTEFI
C              WHAT IS STATUS OF THE TURBO C TEXT FILE?   OPEN/CLOS
C     NOTE--THEY ARE INITIALLY ALLOCATED IN DPCODV.INC
C           THEY ARE INITIALLY DEFINED   IN TCINCO.FOR IN TCDRIV.FOR
C           THEY ARE USED                IN TCDRIV.FOR
C
C     UPDATED         --FEBRUARY  1995. COMMAND NUMBER ICOMID SET = 0
C     UPDATED         --FEBRUARY  1996. SOFT-CODE THE MENU PATH
C                                       TO ALLOW DRIVE D: TO BE USED
C
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
CCCCC THE FOLLOWING LINE WAS ADDED   FEBRUARY 1996
      INCLUDE 'DPCOF2.INC'
C
      CHARACTER*4 ISUBRO
CCCCC THE FOLLOWING LINE WAS ADDED     FEBRUARY 1996
      CHARACTER*80 FILEXX
C
      CHARACTER*4 IFEEDB
      CHARACTER*4 IPRINT
      COMMON /MACH/IRD,IPR,CPUMIN,CPUMAX,NUMBPC,NUMCPW,NUMBPW
      COMMON /PRINT/IFEEDB,IPRINT
C
CCCCC DELETE THE FOLLOWING LINE AFTER DEBUGGED
CCCCC THE FOLLOWING LINE WAS FIXED     FEBRUARY 1996
CCCCC OPEN(UNIT=9,FILE='C:\TURBOC\FRONTEND\TCDEBU.TEX')
      OPEN(UNIT=9,FILE='C:\TURBOC\FRONTEND\TCDEBU.TEX',ERR=9010)
 9010 CONTINUE
CLAHE FILEXX(1:NCMPAT)=MPATH(1:NCMPAT)
CLAHE FILEXX(NCMPAT+1:NCMPAT+11)='TCDEBU.TEX'
CLAHE OPEN(UNIT=9,FILE=FILEXX)
C
      IF(ISUBRO.EQ.'INCO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,999)
  999    FORMAT(1H )
         WRITE(9,51)
   51    FORMAT(1H ,'***** AT THE BEGINNING OF TCINCO IN TCDRIV--')
         WRITE(9,52)ISUBRO
   52    FORMAT(1H ,'ISUBRO = ',A4)
         WRITE(9,53)NCMPAT
   53    FORMAT(1H ,'NCMPAT = ',I8)
         WRITE(9,54)MPATH
   54    FORMAT(1H ,'MPATH = ',A80)
         WRITE(9,55)FILEXX
   55    FORMAT(1H ,'FILEXX = ',A80)
      ENDIF
C
      TCLOAD='NO'
      TCMENU='OFF'
CCCCC THE FOLLOWING 2 LINES WERE CORRECTED JULY 1992 (JJF)
CCCCC TCPLFI='OFF'
CCCCC TCTEFI='OFF'
      TCPLFI='CLOS'
      TCTEFI='CLOS'
      ITCST='OFF'
      TEXTFC=' '
      NTEXTF=0
CCCCC THE FOLLOWING 4 LINES WERE ADDED MAY 1992 (JJF)
      NPLOTF=0
      DO2100I=1,11
      PLOTFC(I)=' '
 2100 CONTINUE
C
CCCCC THE FOLLOWING LINE WAS ADDED                 FEBRUARY 1995
CCCCC TO COUNT COMMAND LINES ENTERED               FEBRUARY 1995
CCCCC SO THAT TEXT OUTPUT PAGES MAY BE NUMBERED    FEBRUARY 1995
CCCCC IN THE OUTPUT FILE DPTEXT.TEX                FEBRUARY 1995
CCCCC (NOTE--ICOMID IS IN DPCODV.COM)              FEBRUARY 1995
      ICOMID=0
C
      IF(ISUBRO.EQ.'LOTC'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,999)
         WRITE(9,9011)
 9011    FORMAT(1H ,'***** AT THE END       OF TCLOTC IN TCDRIV--')
         WRITE(9,9012)ISUBRO
 9012    FORMAT(1H ,'ISUBRO= ',A4)
         WRITE(IPR,9013)TCLOAD,TCMENU,TCPLFI,TCTEFI
 9013    FORMAT(1H ,'TCLOAD,TCMENU,TCPLFI,TCTEFI = ',
     1               A4,2X,A4,2X,A4,2X,A4)
      ENDIF
C
      RETURN
      END
C
C ----------TCLOTC-----------------------------
C
      SUBROUTINE TCLOTC(ISUBRO)
C
C     PURPOSE--INITIALIZE (LOAD IN) THE TURBO-C C DRIVER (CMAIN.C)
C              (THIS IS DONE ONLY ONCE PER DATAPLOT RUN)
C     NOTE--THE CALL TO REAL_MODE_LIBRARY@ MUST BE DONE
C           AT MOST ONCE DURING ANY DATAPLOT RUN.
C     DATAPLOT CALLING ROUTINE--MAIN ONLY
C     NOTE--WHEN THE USER ENTERS THE    MENU   COMMAND
C           FROM THE FORTRAN SIDE (BEFORE ANY MENU IS ON THE SCREEN)
C           TCLOTC IS THE FIRST ROUTINE CALLED
C           AND TCSHME IS THE SECOND ROUTINE CALLED
C           (BOTH FROM MAIN)
C     UPDATED         --FEBRUARY  1996. SOFT-CODE THE MENU PATH
C                                       TO ALLOW DRIVE D: TO BE USED
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
CCCCC THE FOLLOWING LINE WAS ADDED   FEBRUARY 1996
      INCLUDE 'DPCOF2.INC'
C
      CHARACTER*4 ISUBRO
CCCCC THE FOLLOWING LINE WAS ADDED     FEBRUARY 1996
      CHARACTER*80 FILEXX
C
      CHARACTER*4 IFEEDB
      CHARACTER*4 IPRINT
      COMMON /MACH/IRD,IPR,CPUMIN,CPUMAX,NUMBPC,NUMCPW,NUMBPW
      COMMON /PRINT/IFEEDB,IPRINT
C
      IF(ISUBRO.EQ.'LOTC'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,999)
  999    FORMAT(1H )
         WRITE(9,51)
   51    FORMAT(1H ,'***** AT THE BEGINNING OF TCLOTC IN TCDRIV--')
         WRITE(9,52)ISUBRO,TCLOAD
   52    FORMAT(1H ,'ISUBRO,TCLOAD = ',A4,2X,A4)
         WRITE(9,53)NCMPAT
   53    FORMAT(1H ,'NCMPAT = ',I8)
         WRITE(9,54)MPATH
   54    FORMAT(1H ,'MPATH = ',A80)
      ENDIF
C
      IF(TCLOAD.EQ.'NO')THEN
CLAHE    CALL REAL_MODE_SHORT_CUT@
CCCCC CALL PAUSE('1')
C
CCCCC THE FOLLOWING LINE WAS FIXED     FEBRUARY 1996
CCCCC    CALL LOAD_REAL_MODE_LIBRARY@('C:\TURBOC\FRONTEND\CMAIN.EXE')
CCCCCOLD CALL LOAD_REAL_MODE_LIBRARY@('C:\TURBOC\FRONTEND\CMAINF.EXE')
         FILEXX(1:NCMPAT)=MPATH(1:NCMPAT)
         FILEXX(NCMPAT+1:NCMPAT+10)='CMAIN.EXE'
CLAHE    CALL LOAD_REAL_MODE_LIBRARY@(FILEXX)
C
CCCCC ****************** DANGER ABOVE *********************
CCCCC ***** NOTE--DATAPLOT AND FED HAVE DIFFERENCE C-SIDE MAIN ROUTINES
CCCCC             DATAPLOT USES CMAIN.EXE
CCCCC             FED      USED CMAINF.EXE
CCCCC        IF NOT HAV PROPER CMAIN..  LOADED
CCCCC THEN WILL GET MESSAGE:
CCCCC REAL MODE LIBRARY HAS TERMINATED IMPROPERLY,
CCCCC SYSTEM MUST BE REBOOTED
CCCCC CALL PAUSE('2')
CCCCC CHANGE ABOVE AND ALSO WELL BELOW
         TCLOAD='YES'
      ENDIF
C
      IF(ISUBRO.EQ.'LOTC'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,999)
         WRITE(9,9011)
 9011    FORMAT(1H ,'***** AT THE END       OF TCLOTC IN TCDRIV--')
         WRITE(9,9012)ISUBRO,TCLOAD
 9012    FORMAT(1H ,'ISUBRO,TCLOAD = ',A4,2X,A4)
         WRITE(9,999)
         WRITE(9,9011)
         WRITE(9,9012)ISUBRO,TCLOAD
      ENDIF
C
      RETURN
      END
C
C ----------TCSHME-----------------------------
C
      SUBROUTINE TCSHME(ISUBRO)
C
C     PURPOSE--SHOW THE DATAPLOT GUI MENU UNDER TURBO-C
C     DATAPLOT CALLING ROUTINE--MAIN
C     NOTE--WHEN THE USER ENTERS THE    MENU   COMMAND
C           FROM THE FORTRAN SIDE (BEFORE ANY MENU IS ON THE SCREEN)
C           TCLOTC IS THE FIRST ROUTINE CALLED
C           AND TCSHME IS THE SECOND ROUTINE CALLED
C           (BOTH FROM MAIN)
C     UPDATED         --FEBRUARY  1996. SOFT-CODE THE MENU PATH
C                                       TO ALLOW DRIVE D: TO BE USED
C
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
CCCCC THE FOLLOWING LINE WAS ADDED   FEBRUARY 1996
      INCLUDE 'DPCOF2.INC'
C
      CHARACTER*4 ISUBRO
      INTEGER*4 NBYTES
CCCCC THE FOLLOWING LINE WAS ADDED     FEBRUARY 1996
      CHARACTER*80 FILEXX
C
      CHARACTER*4 IFEEDB
      CHARACTER*4 IPRINT
      COMMON /MACH/IRD,IPR,CPUMIN,CPUMAX,NUMBPC,NUMCPW,NUMBPW
      COMMON /PRINT/IFEEDB,IPRINT
C
      IF(ISUBRO.EQ.'SHME'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,999)
  999    FORMAT(1H )
         WRITE(9,51)
   51    FORMAT(1H ,'***** AT THE BEGINNING OF TCSHME IN TCDRIV--')
         WRITE(9,52)ISUBRO,TCLOAD
   52    FORMAT(1H ,'ISUBRO,TCLOAD = ',A4,2X,A4)
         WRITE(9,53)NCMPAT
   53    FORMAT(1H ,'NCMPAT = ',I8)
         WRITE(9,54)MPATH
   54    FORMAT(1H ,'MPATH = ',A80)
      ENDIF
C
      IF(TCMENU.EQ.'OFF')THEN
         TEXTFC(1:4)='SHME'
         TEXTFC(5:8)='SHME'
CCCCC    NBYTES=8+4
CCCCC    NBYTES=12+4
         NBYTES=12+4+4
CLAHE    CALL COPY_TO_REAL_MODE@(NTEXTF,NBYTES)
CLAHE    CALL REAL_MODE@
         TCMENU='ON'
CCCCC THE FOLLOWING LINE WAS FIXED     FEBRUARY 1996
CCCCC    OPEN(UNIT=7,FILE='C:\TURBOC\FRONTEND\DPTEXT.TEX')
         OPEN(UNIT=7,FILE='C:\TURBOC\FRONTEND\DPTEXT.TEX',ERR=9010)
 9010    CONTINUE
CLAHE    FILEXX(1:NCMPAT)=MPATH(1:NCMPAT)
CLAHE    FILEXX(NCMPAT+1:NCMPAT+11)='DPTEXT.TEX'
CLAHE    OPEN(UNIT=7,FILE=FILEXX)
         IPR=7
         TCTEFI='OPEN'
      ENDIF
C
      IF(ISUBRO.EQ.'SHME'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,999)
         WRITE(9,9011)
 9011    FORMAT(1H ,'***** AT THE END       OF TCSHME IN TCDRIV--')
         WRITE(9,9012)ISUBRO,TCLOAD,TEXTCF(1:4)
 9012    FORMAT(1H ,'ISUBRO,TCLOAD,TEXTCF(1:4) = ',A4,2X,A4,2X,A4)
      ENDIF
C
      RETURN
      END
C
C ----------TCGECO-----------------------------
C
      SUBROUTINE TCGECO(IB,NIB,IBUGS2,ISUBRO)
C
C     PURPOSE--GET A DATAPLOT COMMAND FROM THE GUI MENU
C     DATAPLOT CALLING ROUTINE--DPGETC
C
C     UPDATED         --FEBRUARY 1995. ALLOW ACCUMULATION OF DPTEXT.TEXT
C     UPDATED         --FEBRUARY 1995. WRITE _____ AS TEXT SEPARATOR
C                                      IN DPTEXT.TEX
C     UPDATED         --FEBRUARY 1995. WRITE COMMAND LINE NUMBER
C                                      ON _____ LINE IN DPTEXT.TEX
C     UPDATED         --FEBRUARY  1996. SOFT-CODE THE MENU PATH
C                                       TO ALLOW DRIVE D: TO BE USED
C
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
CCCCC THE FOLLOWING LINE WAS ADDED   FEBRUARY 1996
      INCLUDE 'DPCOF2.INC'
C
      INTEGER*4 NBYTES
      CHARACTER*4 ISUBRO
      CHARACTER*4 ISTEPN
      CHARACTER*4 IBUGS2
CCCCC CHARACTER*4 IFOUND
CCCCC CHARACTER*4 IERROR
CCCCC THE FOLLOWING LINE WAS ADDED     FEBRUARY 1996
      CHARACTER*80 FILEXX
C
      CHARACTER*4 IFEEDB
      CHARACTER*4 IPRINT
      COMMON /MACH/IRD,IPR,CPUMIN,CPUMAX,NUMBPC,NUMCPW,NUMBPW
      COMMON /PRINT/IFEEDB,IPRINT
C
      CHARACTER*80 IB
      CHARACTER*4 ISUBN1
      CHARACTER*4 ISUBN2
C
      ISUBN1='TCGE'
      ISUBN2='CO  '
C
      ISTEPN='--0-'
CCCCC ISUBRO='GECO'
      IF(IBUGS2.EQ.'ON'.OR.ISUBRO.EQ.'GECO'.OR.ISUBRO.EQ.'DRIV')
     1WRITE(9,105)ISTEPN,ISUBN1,ISUBN2
  105 FORMAT(1H ,'TRACE AT STEP ',A4,' OF ',A4,A4)
      NIB=0
      IF(TCMENU.EQ.'ON')THEN
C
CMS-F    ENDFILE 7
         CLOSE(7)
         IPR=6
         TCTEFI='CLOS'
         TEXTCF=' '
         TEXTFC(1:4)='GECO'
         TEXTFC(5:8)='GECO'
      ISTEPN='1'
      IF(IBUGS2.EQ.'ON'.OR.ISUBRO.EQ.'GECO'.OR.ISUBRO.EQ.'DRIV')
     1WRITE(9,105)ISTEPN,ISUBN1,ISUBN2
CCCCC    NBYTES=8+4
CCCCC    NBYTES=12+4
         NBYTES=12+4+4
C
CLAHE    CALL COPY_TO_REAL_MODE@(NTEXTF,NBYTES)
CLAHE    CALL REAL_MODE@
C
CCCCC    NBYTES=8+80
         NBYTES=12+84+84
CLAHE    CALL COPY_FROM_REAL_MODE@(NTEXTF,NBYTES)
      ISTEPN='4'
      IF(IBUGS2.EQ.'ON'.OR.ISUBRO.EQ.'GECO'.OR.ISUBRO.EQ.'DRIV')
     1WRITE(9,105)ISTEPN,ISUBN1,ISUBN2
      WRITE(9,885)NTEXTF,NTEXTC
  885 FORMAT(1H ,'FROM TCDRIV/TCGECO.FOR--NTEXTF,NTEXTC = ',2I8)
      WRITE(9,886)TEXTFC(1:10)
  886 FORMAT(1H ,'FROM TCDRIV/TCGECO.FOR--TEXTFC(1:10) = ',A10)
      WRITE(9,887)TEXTCF(1:10)
  887 FORMAT(1H ,'FROM TCDRIV/TCGECO.FOR--TEXTCF(1:10) = ',A10)
C
         NIB=NTEXTC
         IB=TEXTCF
C
         IF(TEXTCF(1:4).EQ.'EXME'.OR.TEXTCF(1:4).EQ.'ERRO')THEN
            TCMENU='OFF'
            TCTEFI='CLOS'
         ELSE IF(TEXTCF(1:4).EQ.'EXIT')THEN
            TCMENU='OFF'
            TCTEFI='CLOS'
CCCCC       ENDFILE 9  6/12/92
CCCCC       CLOSE(9) 6/12/92
CMS-F       ENDFILE 9
            CLOSE(9)
CCCCC THE FOLLOWING LINE WAS ADDED AUGUST 1992
            RETURN
         ELSE
CCCCC THE FOLLOWING LINE WAS COMMENTED OUT        FEBRUARY 1995
CCCCC AND REPLACED BY THE SUCCEEDING LINE         FEBRUARY 1995
CCCCC (WHICH HAPPENS TO BE NON-STANDARD FORTRAN)  FEBRUARY 1995
CCCCC SO AS TO ALLOW TEXT OUTPUT TO BE            FEBRUARY 1995
CCCCC ACCUMULATED IN THE DPTEXT.TEX FILE          FEBRUARY 1995
CCCCC SO AS TO ALLOW                              FEBRUARY 1995
CCCCC C-SIDE SCROLLING OF ALL TEXT OUTPUT         FEBRUARY 1995
CCCCC       OPEN(UNIT=7,FILE='C:\TURBOC\FRONTEND\DPTEXT.TEX')
CCCCC THE FOLLOWING 2 LINES WERE FIXED     FEBRUARY 1996
CCCCC       OPEN(UNIT=7,STATUS='APPEND',
            OPEN(UNIT=7,
CCCCC1           FILE='C:\TURBOC\FRONTEND\DPTEXT.TEX')
     1           FILE='C:\TURBOC\FRONTEND\DPTEXT.TEX',ERR=9020)
 9020       CONTINUE
CLAHE FILEXX(1:NCMPAT)=MPATH(1:NCMPAT)
CLAHE FILEXX(NCMPAT+1:NCMPAT+11)='DPTEXT.TEX'
CLAHE       OPEN(UNIT=7,STATUS='APPEND',
CLAHE1           FILE=FILEXX)
            IPR=7
            TCTEFI='OPEN'
C
CCCCC THE FOLLOWING 19 LINES WERE ADDED SO AS TO PROVIDE FEBRUARY 1995
CCCCC A VISUAL SEPARATOR OF UNDERSCORES BETWEEN         FEBRUARY 1995
CCCCC ACCUMULATED SUCCESSIVE TEXT OUTPUT                FEBRUARY 1995
CCCCC IN DPTEXT.TEX                                     FEBRUARY 1995
C
      ICOMID=ICOMID+1
      IF(ICOMID.LE.9)THEN
         WRITE(7,111)ICOMID
  111    FORMAT(1X,'_____','[',I1,']')
      ELSE IF(ICOMID.LE.99)THEN
         WRITE(7,112)ICOMID
  112    FORMAT(1X,'_____','[',I2,']')
      ELSE IF(ICOMID.LE.999)THEN
         WRITE(7,113)ICOMID
  113    FORMAT(1X,'_____','[',I3,']')
      ELSE IF(ICOMID.LE.9999)THEN
         WRITE(7,114)ICOMID
  114    FORMAT(1X,'_____','[',I4,']')
      ELSE IF(ICOMID.LE.99999)THEN
         WRITE(7,115)ICOMID
  115    FORMAT(1X,'_____','[',I4,']')
      ELSE
         WRITE(7,116)ICOMID
  116    FORMAT(1X,'_____','[',I8,']')
      ENDIF
C
         ENDIF
C
      ENDIF
C
      WRITE(9,888)TEXTCF(1:10)
  888 FORMAT(1H ,'FROM TCDRIV/TCGECO.FOR--TEXTCF(1:10) = ',A10)
      WRITE(9,889)IB
  889 FORMAT(1H ,'FROM TCDRIV/TCGECO.FOR--IB = ',A80)
      WRITE(9,890)NIB
  890 FORMAT(1H ,'FROM TCDRIV/TCGECO.FOR--NIB = ',I4)
      DO895I=1,80
      JIB=ICHAR(IB(I:I))
      IF(JIB.LE.31)IB(I:I)=' '
CCCCC WRITE(9,896)I,IB(I:I),JIB
CC896 FORMAT(1H ,'I,IB(I:I),JIB = ',I8,2X,A1,I8)
  895 CONTINUE
      WRITE(9,990)
  990 FORMAT(1H )
C
      ISTEPN='-99-'
      IF(IBUGS2.EQ.'ON'.OR.ISUBRO.EQ.'GECO'.OR.ISUBRO.EQ.'DRIV')
     1WRITE(9,105)ISTEPN,ISUBN1,ISUBN2
      RETURN
      END
C
C ----------TCINDE-----------------------------
C
      SUBROUTINE TCINDE
C
C     PURPOSE--INITIALIZE (LOAD IN) THE TURBO-C C DRIVER (CMAIN.C)
C              (THIS IS DONE ONLY ONCE PER DATAPLOT RUN)
C     NOTE--THE CALL TO REAL_MODE_LIBRARY@ MUST BE DONE
C           AT MOST ONCE DURING ANY DATAPLOT RUN.
C     DATAPLOT CALLING ROUTINE--INITOD AND GRINDE
C     NOTE--WHEN THE MENU IS ON THE SCREEN
C           AND THE USER ENTERS A PLOT COMMAND (SUCH AS HISTOGRAM Y),
C           TCINDE IS THE FIRST ROUTINE CALLED
C           AND TCOPDE IS THE SECOND ROUTINE CALLED
C           IN GETTING THE PLOT ONTO THE MENU'S PLOT WINDOW.
C           (TCINDE FROM GRINDE    AND    TCOPDE FROM GROPDE).
C           NOTE THAT THE FIRST CALL (TCINDE) IS IN FACT UNNECESSARY
C           SINCE THE FORTRAN-TO-C LINK HAS ALREADY BEEN ESTABLISHED
C           BACK IN THE SUBROUTINE TCLOTC--WHICH WAS CALLED
C           WHEN THE USER CAUSED THE MENU TO APPEAR
C           BY ENTERING THE FORTRAN-SIDE COMMAND    MENU.
C     NOTE--TCINDE.FOR    HAS NO CORRESPONDANCE IN    TUDRIV.C
C     UPDATED         --FEBRUARY  1996. SOFT-CODE THE MENU PATH
C                                       TO ALLOW DRIVE D: TO BE USED
C
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
CCCCC THE FOLLOWING LINE WAS ADDED   FEBRUARY 1996
      INCLUDE 'DPCOF2.INC'
C
      CHARACTER*4 ISUBRO
CCCCC THE FOLLOWING LINE WAS ADDED     FEBRUARY 1996
      CHARACTER*80 FILEXX
C
CCCCC THE FOLLOWING LINE SHOULD BE COMMENTED OUT WHEN DEBUGGED
      ISUBRO='DRIV'
      IF(ISUBRO.EQ.'INDE'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,999)
  999    FORMAT(1H )
         WRITE(9,51)
   51    FORMAT(1H ,'***** AT THE BEGINNING OF TCINDE IN TCDRIV--')
         WRITE(9,53)TCPLFI,TCTEFI,TCLOAD
   53    FORMAT(1H ,'TCPLFI,TCTEFI,TCLOAD= ',A4,2X,A4,2X,A4)
         WRITE(9,54)TCMENU,IPLATF
   54    FORMAT(1H ,'TCMENU,IPLATF = ',A4,2X,A10)
         WRITE(9,55)TEXTFC(1:20)
   55    FORMAT(1H ,'TEXTFC(1:20) = ',A20)
         WRITE(9,56)TEXTCF(1:20)
   56    FORMAT(1H ,'TEXTCF(1:20) = ',A20)
      ENDIF
C
      IF(TCLOAD.EQ.'NO')THEN
CLAHE    CALL REAL_MODE_SHORT_CUT@
CCCCC THE FOLLOWING LINE WAS FIXED     FEBRUARY 1996
CCCCC    CALL LOAD_REAL_MODE_LIBRARY@('C:\TURBOC\FRONTEND\CMAIN.EXE')
CCCCCOLD CALL LOAD_REAL_MODE_LIBRARY@('C:\TURBOC\FRONTEND\CMAINF.EXE')
         FILEXX(1:NCMPAT)=MPATH(1:NCMPAT)
         FILEXX(NCMPAT+1:NCMPAT+11)='CMAIN.EXE'
CLAHE    CALL LOAD_REAL_MODE_LIBRARY@(FILEXX)
         TCLOAD='YES'
      ENDIF
C
      IPLATF='WITHINMENU'
      IF(TCMENU.EQ.'OFF')IPLATF='STANDALONE'
C
      IF(ISUBRO.EQ.'INDE'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,999)
         WRITE(9,9011)
 9011    FORMAT(1H ,'***** AT THE END       OF TCINDE IN TCDRIV--')
         WRITE(9,9013)TCPLFI,TCTEFI,TCLOAD
 9013    FORMAT(1H ,'TCPLFI,TCTEFI,TCLOAD= ',A4,2X,A4,2X,A4)
         WRITE(9,9014)TCMENU,IPLATF
 9014    FORMAT(1H ,'TCMENU,IPLATF = ',A4,2X,A10)
         WRITE(9,9015)TEXTFC(1:20)
 9015    FORMAT(1H ,'TEXTFC(1:20) = ',A20)
         WRITE(9,9016)TEXTCF(1:20)
 9016    FORMAT(1H ,'TEXTCF(1:20) = ',A20)
      ENDIF
C
      RETURN
      END
C
C ----------TCOPDE-----------------------------
C
      SUBROUTINE TCOPDE
C
C     PURPOSE--OPEN TURBO-C GRAPHICS
C              (THE INITIALIZATION IS ALREADY ASSUMED TO BE DONE)
C     NOTE--THE CALL TO REAL_MODE_LIBRARY@ MUST BE DONE
C           AT MOST ONCE DURING ANY DATAPLOT RUN.
C     DATAPLOT CALLING ROUTINE--GROPDE
C     NOTE--WHEN THE MENU IS ON THE SCREEN
C           AND THE USER ENTERS A PLOT COMMAND (SUCH AS HISTOGRAM Y),
C           TCINDE IS THE FIRST ROUTINE CALLED
C           AND TCOPDE IS THE SECOND ROUTINE CALLED
C           IN GETTING THE PLOT ONTO THE MENU'S PLOT WINDOW.
C           (TCINDE FROM GRINDE    AND    TCOPDE FROM GROPDE).
C           NOTE THAT THE FIRST CALL (TCINDE) IS IN FACT UNNECESSARY
C           SINCE THE FORTRAN-TO-C LINK HAS ALREADY BEEN ESTABLISHED
C           BACK IN THE SUBROUTINE TCLOTC--WHICH WAS CALLED
C           WHEN THE USER CAUSED THE MENU TO APPEAR
C           BY ENTERING THE FORTRAN-SIDE COMMAND    MENU.
C
      CHARACTER*4 ISUBRO
      INTEGER*4 NBYTES
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
CCCCC THE FOLLOWING LINE SHOULD BE COMMENTED OUT WHEN DEBUGGED
      ISUBRO='DRIV'
      IF(ISUBRO.EQ.'OPDE'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,999)
  999    FORMAT(1H )
         WRITE(9,51)
   51    FORMAT(1H ,'***** AT THE BEGINNING OF TCOPDE IN TCDRIV--')
         WRITE(9,53)TCPLFI,TCTEFI,TCLOAD
   53    FORMAT(1H ,'TCPLFI,TCTEFI,TCLOAD= ',A4,2X,A4,2X,A4)
         WRITE(9,54)TCMENU,IPLATF
   54    FORMAT(1H ,'TCMENU,IPLATF = ',A4,2X,A10)
         WRITE(9,55)TEXTFC(1:20)
   55    FORMAT(1H ,'TEXTFC(1:20) = ',A20)
         WRITE(9,56)TEXTCF(1:20)
   56    FORMAT(1H ,'TEXTCF(1:20) = ',A20)
      ENDIF
C
CCCCC WRITE(6,777)TCPLFI
CC777 FORMAT(1H ,'TCPLFI = ',A4)
C
      IF(TCPLFI.EQ.'CLOS')THEN
CCCCC    OPEN(UNIT=8,FILE='C:\TURBOC\FRONTEND\DPPLOT.TEX')
         TEXTFC(1:4)='PLOT'
         TEXTFC(5:8)='OPDE'
CCCCC    NBYTES=8+4
CCCCC    NBYTES=12+4
         NBYTES=12+4+4
CLAHE    CALL COPY_TO_REAL_MODE@(NTEXTF,NBYTES)
CLAHE    CALL REAL_MODE@
         NPLOTF=0
         TCPLFI='OPEN'
      ENDIF
C
CCCCC WRITE(6,778)TCPLFI
CC778 FORMAT(1H ,'TCPLFI = ',A4)
C
      COMMFC='INDE'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),112)COMMFC,IPLATF,INULC
  112 FORMAT(A4,1X,A10,A1)
CCCCC IF(ISUBRO.EQ.'OPDE'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCOPDE.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      COMMFC='OPDE'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),111)COMMFC,INULC
  111 FORMAT(A4,A1)
      IF(NPLOTF.GE.10) CALL TCSEND
C
      IF(ISUBRO.EQ.'OPDE'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,999)
         WRITE(9,9011)
 9011    FORMAT(1H ,'***** AT THE END       OF TCOPDE IN TCDRIV--')
         WRITE(9,9013)TCPLFI,TCTEFI,TCLOAD
 9013    FORMAT(1H ,'TCPLFI,TCTEFI,TCLOAD= ',A4,2X,A4,2X,A4)
         WRITE(9,9014)TCMENU,IPLATF
 9014    FORMAT(1H ,'TCMENU,IPLATF = ',A4,2X,A10)
         WRITE(9,9015)TEXTFC(1:20)
 9015    FORMAT(1H ,'TEXTFC(1:20) = ',A20)
         WRITE(9,9016)TEXTCF(1:20)
 9016    FORMAT(1H ,'TEXTCF(1:20) = ',A20)
      ENDIF
C
      RETURN
      END
C
C ----------TCCLDE-----------------------------
C
      SUBROUTINE TCCLDE
C
C     PURPOSE--CLOSE TURBO C GRAPHICS
C     DATAPLOT CALLING ROUTINE--GRCLDE
C
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      COMMFC='CLDE'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),111)COMMFC,INULC
  111 FORMAT(A4,A1)
CCCCC IF(NPLOTF.GE.10) CALL TCSEND
      CALL TCSEND
C
CCCCC ENDFILE 8
CCCCC CLOSE(8)
      TCPLFI='CLOS'
C
CCCCC CLOSE(9)
C
CCCCC TEXTFC=' '
CCCCC TEXTFC(1:4)='CLDE'
CCCCC NBYTES=8+4
CCCCC CALL COPY_TO_REAL_MODE@(NTEXTF,NBYTES)
CCCCC CALL REAL_MODE@
C
      RETURN
      END
C
C ----------TCCHEX-----------------------------
C
      SUBROUTINE TCCHEX
C
C     PURPOSE--CHECK FOR EXPOSE AND CONFIGURATION EVENTS.
C              (NOT NEEDED FOR TURBO C)
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
C
      RETURN
      END
C
C ----------TCREMO-----------------------------
C
      SUBROUTINE TCREMO
C
C     PURPOSE--READ POSITION FROM THE GRAPHICS WINDOW.
C              THE MOUSE POSITION AT THE NEXT MOUSE CLICK
C              WILL BE DETERMINED.
C              THIS ROUTINE WILL WAIT UNTIL A MOUSE BUTTON
C              IS PRESSED.
C              THIS IS USED BY THE DATAPLOT CROSS-HAIR COMMAND.
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
C
      RETURN
      END
C
C ----------TCERSC-----------------------------
C
      SUBROUTINE TCERSC(ICOLOR)
C
C     PURPOSE--ERASE THE SCREEN (= REGION (X1,Y1)-(X2,Y2).)
C              DEFINE A VIEWPORT THAT WILL BE USED
C              AS THE GRAPHICS AREA.
C              (AND ERASE THE AREA ONLY).
C
C     ROUTINES CALLING TCERSC--GRERSC(38)
C
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      CHARACTER*4 ICOLOR
C
      COMMFC='ERSC'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),111)COMMFC,INULC
  111 FORMAT(A4,A1)
CCCCC IF(ISUBRO.EQ.'ERSC'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCERSC.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCRIBE-----------------------------
C
      SUBROUTINE TCRIBE
C
C     PURPOSE--RING THE BELL
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      COMMFC='RIBE'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),111)COMMFC,INULC
  111 FORMAT(A4,A1)
CCCCC IF(ISUBRO.EQ.'RIBE'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCRIBE.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCCOSC-----------------------------
C
      SUBROUTINE TCCOSC
C
C     PURPOSE--COPY THE SCREEN
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      COMMFC='COSC'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),111)COMMFC,INULC
  111 FORMAT(A4,A1)
CCCCC IF(ISUBRO.EQ.'COSC'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCCOSC.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCRESC----------------------------
C
      SUBROUTINE TCRESC(PX1,PY1)
C
C     PURPOSE--READ THE SCREEN (VIA CROSS-HAIR OR MOUSE)
CCCCC ***** NOT YET WORKING *****
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      COMMFC='RESC'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),122)COMMFC,PX1,PY1,INULC
  122 FORMAT(A4,1X,F10.5,1X,F10.5,A1)
CCCCC IF(ISUBRO.EQ.'RESC'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCRESC.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCUPSC-----------------------------
C
      SUBROUTINE TCUPSC
C
C     PURPOSE--COPY THE PIXMAP TO THE SCREEN.
C              UPDATE THE GRAPHICS WINDOW WITH
C              A PREVIOUSLY SAVED WINDOW.
C              (NOT USED FOR PC DRIVER)
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
C
      RETURN
      END
C
C ----------TCFLBU-----------------------------
C
      SUBROUTINE TCFLBU
C
C     PURPOSE--FLUSH THE SCREEN BUFFER.
C              (NEEDED ON PC?)
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
C
      RETURN
      END
C
C ----------TCSEMO-----------------------------
C
      SUBROUTINE TCSEMO(IMODE)
C
C     PURPOSE--SET THE MODE
C
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
      CHARACTER*4 IMODE
C
      COMMFC='SEMO'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),112)COMMFC,IMODE,INULC
  112 FORMAT(A4,1X,A4,A1)
CCCCC IF(ISUBRO.EQ.'SEMO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCSEMO.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCSECO-----------------------------
C
      SUBROUTINE TCSECO(ICASE,ICOL)
C
C     PURPOSE--SET THE COLOR
C
      INTEGER*4 NBYTES
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
      CHARACTER*4 ICASE
      CHARACTER*4 ICOL
C
      IF(TCPLFI.EQ.'CLOS')THEN
CCCCC    OPEN(UNIT=8,FILE='C:\TURBOC\FRONTEND\DPPLOT.TEX')
         TEXTFC(1:4)='PLOT'
         TEXTFC(5:8)='SECO'
CCCCC    NBYTES=8+4
CCCCC    NBYTES=12+4
         NBYTES=12+4+4
CLAHE    CALL COPY_TO_REAL_MODE@(NTEXTF,NBYTES)
CLAHE    CALL REAL_MODE@
         NPLOTF=0
         TCPLFI='OPEN'
C
         COMMFC='INDE'
         NPLOTF=NPLOTF+1
         PLOTFC(NPLOTF)=' '
         WRITE(PLOTFC(NPLOTF),112)COMMFC,IPLATF,INULC
  112    FORMAT(A4,1X,A10,A1)
CCCCC IF(ISUBRO.EQ.'SECO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCSECO.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
         IF(NPLOTF.GE.10) CALL TCSEND
C
         COMMFC='OPDE'
         NPLOTF=NPLOTF+1
         PLOTFC(NPLOTF)=' '
         WRITE(PLOTFC(NPLOTF),111)COMMFC,INULC
  111    FORMAT(A4,A1)
CCCCC IF(ISUBRO.EQ.'SECO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
CCCCC ENDIF
         IF(NPLOTF.GE.10) CALL TCSEND
C
      ENDIF
C
      COMMFC='SECO'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),113)COMMFC,ICASE,ICOL,INULC
  113 FORMAT(A4,1X,A4,1X,A4,A1)
CCCCC IF(ISUBRO.EQ.'SECO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCSEPA-----------------------------
C
      SUBROUTINE TCSEPA(ICASE,IPATT)
C
C     PURPOSE--SET THE PATTERN
C
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
      CHARACTER*4 ICASE
      CHARACTER*4 IPATT
C
      COMMFC='SEPA'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),113)COMMFC,ICASE,IPATT,INULC
  113 FORMAT(A4,1X,A4,1X,A4,A1)
CCCCC IF(ISUBRO.EQ.'SEPA'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCSEPA.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCSETH----------------------------
C
      SUBROUTINE TCSETH(PTHICK)
C
C     PURPOSE--SET LINE THICKNESS.
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      COMMFC='SETH'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),122)COMMFC,PTHICK,INULC
  122 FORMAT(A4,1X,F10.5,A1)
CCCCC IF(ISUBRO.EQ.'SETH'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCSETH.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCSEFO----------------------------
C
      SUBROUTINE TCSEFO(FONT)
C
C     PURPOSE--SET TEXT FONT.
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
      CHARACTER*4 FONT
C
      COMMFC='SEFO'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),112)COMMFC,FONT,INULC
  112 FORMAT(A4,1X,A4,A1)
CCCCC IF(ISUBRO.EQ.'SEFO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCSEFO.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCSECA----------------------------
C
      SUBROUTINE TCSECA(ICASE)
C
C     PURPOSE--SET TEXT CASE.
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
      CHARACTER*4 ICASE
C
      COMMFC='SECA'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),112)COMMFC,ICASE,INULC
  112 FORMAT(A4,1X,A4,A1)
CCCCC IF(ISUBRO.EQ.'SECA'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCSECA.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCSEFI----------------------------
C
      SUBROUTINE TCSEFI(IFILL)
C
C     PURPOSE--SET REGION FILL.???
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
      CHARACTER*4 IFILL
C
      COMMFC='SEFI'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),112)COMMFC,IFILL,INULC
  112 FORMAT(A4,1X,A4,A1)
CCCCC IF(ISUBRO.EQ.'SEFI'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCSEFI.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCSESI----------------------------
C
      SUBROUTINE TCSESI(PHEIG2,PWIDT2,PVEGA2,PHOGA2)
CCCCC SUBROUTINE TCSESI(PHEIGH,PWIDTH,PVEGAP,PHOGAP)
C     THE ABOVE LINE WAS FIXED                        MARCH 1995
C     TO ALLOW CORRECT SIZING OF TEXT CHARACTERS,     MARCH 1995
C     TITLES, LABEL, LEGENDS, ETC.                    MARCH 1995
C
C     PURPOSE--SET TEXT SIZE.
C     UPDATED         --MARCH    1995. MORE FIX FOR MULTI-PLOT
C                                      LABEL SIZE FOR VGA/TURBOC
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      COMMFC='SESI'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
C     THE FOLLOWING LINE WAS FIXED                    MARCH 1995
C     TO ALLOW CORRECT SIZING OF TEXT CHARACTERS,     MARCH 1995
C     TITLES, LABEL, LEGENDS, ETC.                    MARCH 1995
CCCCC WRITE(PLOTFC(NPLOTF),123)COMMFC,PHEIGH,PWIDTH,INULC
      WRITE(PLOTFC(NPLOTF),123)COMMFC,PHEIG2,PWIDT2,INULC
  123 FORMAT(A4,1X,F10.5,1X,F10.5,A1)
CCCCC IF(ISUBRO.EQ.'SESI'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCSESI.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCSEDI----------------------------
C
      SUBROUTINE TCSEDI(IDIR)
C
C     PURPOSE--SET TEXT DIRECTION.
      CHARACTER*4 IDIR
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      COMMFC='SEDI'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),112)COMMFC,IDIR,INULC
  112 FORMAT(A4,1X,A4,A1)
CCCCC IF(ISUBRO.EQ.'SEDI'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCSEDI.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCSEJU----------------------------
C
      SUBROUTINE TCSEJU(JUST)
C
C     PURPOSE--SET TEXT JUSTIFICATION.
      CHARACTER*4 JUST
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      COMMFC='SEJU'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),112)COMMFC,JUST,INULC
  112 FORMAT(A4,1X,A4,A1)
CCCCC IF(ISUBRO.EQ.'SEJU'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCSEJU.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCMOTO----------------------------
C
      SUBROUTINE TCMOTO(PX1,PY1)
C
C     PURPOSE--MOVE TO A POINT (INVISIBLY)
C              DO NOT DRAW.   DO NOT ACTIVATE THE PIXEL.
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      COMMFC='MOTO'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),122)COMMFC,PX1,PY1,INULC
  122 FORMAT(A4,1X,F10.5,1X,F10.5,A1)
CCCCC IF(ISUBRO.EQ.'MOTO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCMOTO.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCDRPO----------------------------
C
      SUBROUTINE TCDRPO(PX1,PY1)
C
C     PURPOSE--DRAW A POINT (ACTIVATE A PIXEL).
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      COMMFC='DRPO'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),122)COMMFC,PX1,PY1,INULC
  122 FORMAT(A4,1X,F10.5,1X,F10.5,A1)
CCCCC IF(ISUBRO.EQ.'DRPO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCDRPO.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCDRLI----------------------------
C
      SUBROUTINE TCDRLI(PX1,PY1,PX2,PY2)
C
C     PURPOSE--DRAW A (P1-SEGMENT) LINE FROM (PX1,PY1) TO (PX2,PY2).
C
C     ROUTINES CALLING TCDRLI--GRDRLI(37)
C
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      COMMFC='MOTO'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),123)COMMFC,PX1,PY1,INULC
  123 FORMAT(A4,1X,F10.5,1X,F10.5,A1)
CCCCC IF(ISUBRO.EQ.'DRLI'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCDRLI.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      COMMFC='DRTO'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),123)COMMFC,PX2,PY2,INULC
CCCCC IF(ISUBRO.EQ.'DRLI'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCDRBO----------------------------
C
      SUBROUTINE TCDRBO(PX1,PY1,PX2,PY2)
C
C     PURPOSE--DRAW A BOX (BUT DO NOTHING ABOUT FILL).
C              THE COLOR OF THE BOX BORDER IS DICTATED BY
C              THE LAST CALL TO TCFIFC (FORE!GROUND COLOR).
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      COMMFC='MOTO'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),123)COMMFC,PX1,PY1,INULC
  123 FORMAT(A4,1X,F10.5,1X,F10.5,A1)
CCCCC IF(ISUBRO.EQ.'DRBO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCDRBO.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      COMMFC='DRTO'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),123)COMMFC,PX2,PY1,INULC
CCCCC IF(ISUBRO.EQ.'DRBO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),123)COMMFC,PX2,PY2,INULC
CCCCC IF(ISUBRO.EQ.'DRBO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),123)COMMFC,PX1,PY2,INULC
CCCCC IF(ISUBRO.EQ.'DRBO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),123)COMMFC,PX1,PY1,INULC
CCCCC IF(ISUBRO.EQ.'DRBO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCDRPL----------------------------
C
      SUBROUTINE TCDRPL(PXV,PYV,NV)
C
C     PURPOSE--DRAW A LINE OR POLYLINE.
C              NOTE THAT THE ATTRIBUTES OF THE LINE HAVE ALREADY
C              BEEN SET (BY THE TCSELP, TCSELT, AND TCSEFG ROUTINES).
C
C     ROUTINES CALLING TCDRPL--GRDRPL(37) (ONLY)
C     CALLING SEQUENCE--
C        PLOT TRACE--DPDRPL(13) CALLS GRDRPL(37) CALLS TCDRPL(37)
C        BARS      --D3DRBA(36) CALLS GRDRPL(37) CALLS TCDRPL(37)
C        SPIKES    --D3DRSP(36) CALLS GRDRPL(37) CALLS TCDRPL(37)
C        TIC MARKS --DPDRFR(XX) CALLS
C
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      DIMENSION PXV(*)
      DIMENSION PYV(*)
C
      COMMFC='MOTO'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
C
      WRITE(PLOTFC(NPLOTF),123)COMMFC,PXV(1),PYV(1),INULC
  123 FORMAT(A4,1X,F10.5,1X,F10.5,A1)
C
CCCCC IF(ISUBRO.EQ.'DRPL'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)NV,PXV(1),PYV(1)
  811    FORMAT(1H ,'FROM TCDRPL.FOR--NV,PXV(1),PYV(1) = ',I8,2F10.1)
         WRITE(9,812)
  812    FORMAT(1H ,'FROM TCDRPL.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,813)NPLOTF,PLOTFC(NPLOTF)
  813    FORMAT(1H ,2X,I4,2X,A84)
CCCCC ENDIF
C
      IF(NPLOTF.GE.10) CALL TCSEND
C
      IF(NV.LE.1)GOTO1090
      COMMFC='DRTO'
      DO1000I=2,NV
         NPLOTF=NPLOTF+1
         PLOTFC(NPLOTF)=' '
         WRITE(PLOTFC(NPLOTF),123)COMMFC,PXV(I),PYV(I),INULC
CCCCC    IF(ISUBRO.EQ.'DRPL'.OR.ISUBRO.EQ.'DRIV')THEN
            WRITE(9,811)NV,PXV(1),PYV(1)
            WRITE(9,812)
            WRITE(9,813)NPLOTF,PLOTFC(NPLOTF)
CCCCC    ENDIF
         IF(NPLOTF.GE.10) CALL TCSEND
 1000 CONTINUE
 1090 CONTINUE
C
      RETURN
      END
C
C ----------TCFIBO----------------------------
C
      SUBROUTINE TCFIBO(PX1,PY1,PX2,PY2)
C
C     PURPOSE--FILL A BOX (BUT ONLY WITH SOLID FILL).
C              THE COLOR OF THE FILL IS DICTATED BY
C              THE LAST CALL TO ...
C              HATCH PATTERNS MUST BE DRAWN BY THE CALLING
C              PROGRAM (I.E., SEND THE INDIVIDUAL LINES TO THE
C              TCDRLI ROUTINE).  ???
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      COMMFC='MOTO'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),123)COMMFC,PX1,PY1,INULC
  123 FORMAT(A4,1X,F10.5,1X,F10.5,A1)
CCCCC IF(ISUBRO.EQ.'FIBO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCFIBO.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      COMMFC='DRTO'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),123)COMMFC,PX2,PY1,INULC
CCCCC IF(ISUBRO.EQ.'FIBO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),123)COMMFC,PX2,PY2,INULC
      IF(NPLOTF.GE.10) CALL TCSEND
CCCCC IF(ISUBRO.EQ.'FIBO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
CCCCC ENDIF
C
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),123)COMMFC,PX1,PY2,INULC
CCCCC IF(ISUBRO.EQ.'FIBO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      WRITE(PLOTFC(NPLOTF),123)COMMFC,PX1,PY1,INULC
CCCCC IF(ISUBRO.EQ.'FIBO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCWRTE----------------------------
C
      SUBROUTINE TCWRTE(ISTRI4,NSTRI4)
C
C     PURPOSE--WRITE OUT A HORIZONTAL STRING AT CURRENT POISTION
CCCCC THE FOLLOWING 3 LINES WERE ADDED     SEPTEMBER 1994
C     NOTE--A TYPICAL TURBO-C CALLING SEQUENCE (FOR CHAR X & PLOT):
C           PLOTG2(42) DPDRCH(13) DPCLCH(11) DPDRPM(13) GRDRPM(37)
C                      GRDRPH(37) TCWRTE(TCDRIV)
C
C     ROUTINES CALLING TCWRTE--GRDRPH(37), GRWRTH(39), GRWRTV(39)
C
      CHARACTER*4 ISTRI4
      DIMENSION ISTRI4(*)
C
CCCCC THE FOLLOWING 2 LINES WERE ADDED      SEPTEMBER 1995
      CHARACTER*1 ISTRI1
      DIMENSION ISTRI1(200)
      CHARACTER*1 IC1
      CHARACTER*4 IC4
C
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
C
      COMMFC='WRTE'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
C
CCCCC IF(ISUBRO.EQ.'WRTE'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM BEGINNING OF TCWRTE.FOR--')
         WRITE(9,812)NSTRI4
  812    FORMAT(1H ,'NSTRI4 = ',I8)
         WRITE(9,813)ISTRI4(1),ISTRI4(2)
CC813    FORMAT(1H ,'ISTRI4(1),ISTRI4(2) = ',A1,2X,A1)
  813    FORMAT(1H ,'ISTRI4(1),ISTRI4(2) = ',2A4)
CCCCC ENDIF
C
ccccc bombing on the next line   sept 4, 1993
CCCCC WRITE(PLOTFC(NPLOTF),132)COMMFC,(ISTRI4(I),I=1,NSTRI4),INULC
CC132 FORMAT(A4,1X,80A1,A1)
C
CCCCC THE FOLLOWING 9 LINES WERE ADDED      SEPTEMBER 1995
      DO150I=1,NSTRI4
         IC4=ISTRI4(I)
         IC1=IC4(1:1)
         ISTRI1(I)=IC1
  150 CONTINUE
      WRITE(9,814)ISTRI1(1),ISTRI1(2)
  814 FORMAT(1H ,'ISTRI1(1),ISTRI1(2) = ',2A1)
C
      WRITE(PLOTFC(NPLOTF),132)COMMFC,(ISTRI1(I),I=1,NSTRI4),INULC
  132 FORMAT(A4,1X,80A1,A1)
C
      WRITE(9,815)NPLOTF,PLOTFC(NPLOTF)
  815 FORMAT(1H ,I4,2X,A84)
C
      IF(NPLOTF.GE.10) CALL TCSEND
C
      RETURN
      END
C
C ----------TCFIRE----------------------------
C
      SUBROUTINE TCFIRE(PXV,PYV,NV)
C
C     PURPOSE--FILL A REGION.
C              RECTANGULAR REGIONS WILL BE FILLED DIFFERENTLY
C              THAN NON-RECTANGULAR REGIONS.  DATAPLOT ONLY
C              HANDLES CONVEX POLYGONS, SO SET THIS (FOR FASTER
C              PERFORMANCE).
C              THIS ROUTINE ONLY DOES SOLID FILL.
C              THE COLOR OF THE FILL IS DICTATED BY
C              THE LAST CALL TO TCFIFC (FORE!GROUND COLOR).
C              HATCH PATTERNS MUST BE DRAWN BY THE CALLING
C              HATCH PATTERNS MUST BE DRAWN BY THE CALLING
C              PROGRAM (I.E., SEND THE INDIVIDUAL LINES TO THE
C              TCDRLI ROUTINE).
C
C     DATAPLOT CALLING ROUTINES--TCFIRE(38)
C
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
      CHARACTER*4 COMMFC
      DIMENSION PXV(*)
      DIMENSION PYV(*)
C
      COMMFC='FIRE'
      NPLOTF=NPLOTF+1
      PLOTFC(NPLOTF)=' '
      DO2100I=1,NV
CCCCC NOT YET DONE
CCCCC IF(ISUBRO.EQ.'FIRE'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCFIRE.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
      IF(NPLOTF.GE.10) CALL TCSEND
 2100 CONTINUE
C
      RETURN
      END
C
C ----------TCSEND----------------------------
C
      SUBROUTINE TCSEND
C
C     PURPOSE--SEND NGRBYT BYTES
C              OF TC'S COMMON--
C                 84 BYTES OF TEXTFC,
C                 4 BYTES OF NTEXTF,
C                 4 BYTES FOR NPLOTF,
C                 (AT MOST) 11*84 BYTES OF PLOTFC
C              TO THE C-SIDE.
C
C     WRITTEN BY--JAMES J. FILLIBEN
C     ORIGINAL VERSION--MAY  18, 1991
C
      INTEGER*4 NBYTES
      INCLUDE 'DPCODV.INC'
      INCLUDE 'DPCONP.INC'
C
CCCCC IF(ISUBRO.EQ.'SEND'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,811)
  811    FORMAT(1H ,'FROM TCSEND.FOR--NPLOTF,PLOTFC(NPLOTF) =')
         WRITE(9,812)NPLOTF,PLOTFC(NPLOTF)
  812    FORMAT(1H ,I4,2X,A84)
CCCCC ENDIF
C
CCCCC NBYTES=(8+84)+(84*NPLOTF)
      NBYTES=(12+84+84)+(84*NPLOTF)
CLAHE CALL COPY_TO_REAL_MODE@(NTEXTF,NBYTES)
CLAHE CALL REAL_MODE@
      NPLOTF=0
C
      RETURN
      END
C
C ----------TCINCF-----------------------------
C
      SUBROUTINE TCINCF(ISUBRO)
C
C     PURPOSE--INITIALIZE (= MAKE EMPTY) THE FILE ...DPCOMM
C              THAT WILL RECEIVE COMMAND LINES.
C     DATAPLOT CALLING ROUTINE--MAIN
C     UPDATED         --FEBRUARY  1996. SOFT-CODE THE MENU PATH
C                                       TO ALLOW DRIVE D: TO BE USED
C
CCCCC THE FOLLOWING LINE WAS ADDED   FEBRUARY 1996
      INCLUDE 'DPCOF2.INC'
C
      CHARACTER*4 ISUBRO
CCCCC THE FOLLOWING LINE WAS ADDED     FEBRUARY 1996
      CHARACTER*80 FILEXX
C
      CHARACTER*4 IFEEDB
      CHARACTER*4 IPRINT
C
      COMMON /MACH/IRD,IPR,CPUMIN,CPUMAX,NUMBPC,NUMCPW,NUMBPW
      COMMON /PRINT/IFEEDB,IPRINT
C
      IF(ISUBRO.EQ.'INCF'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,999)
  999    FORMAT(1H )
         WRITE(9,51)
   51    FORMAT(1H ,'***** AT THE BEGINNING OF TCINCF IN TCDRIV--')
         WRITE(9,52)ISUBRO
   52    FORMAT(1H ,'ISUBRO = ',A4)
      ENDIF
C
CCCCC THE FOLLOWING LINE WAS FIXED     FEBRUARY 1996
CCCCC OPEN(UNIT=10,FILE='C:\TURBOC\FRONTEND\DPCOMM.TEX')
      OPEN(UNIT=10,FILE='C:\TURBOC\FRONTEND\DPCOMM.TEX',ERR=9010)
 9010 CONTINUE
CLAHE FILEXX(1:NCMPAT)=MPATH(1:NCMPAT)
CLAHE FILEXX(NCMPAT+1:NCMPAT+11)='DPCOMM.TEX'
CLAHE OPEN(UNIT=10,FILE=FILEXX)
CMS-F ENDFILE 10
      CLOSE(10)
C
      IF(ISUBRO.EQ.'INCF'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,999)
         WRITE(9,9021)
 9021    FORMAT(1H ,'***** AT THE END       OF TCINCF IN TCDRIV--')
         WRITE(9,9022)ISUBRO
 9022    FORMAT(1H ,'ISUBRO = ',A4)
      ENDIF
C
      RETURN
      END
C
C ----------TCWRCO-----------------------------
C
      SUBROUTINE TCWRCO(STRING,ISUBRO)
C
C     PURPOSE--WRITE THE LAST ENTERED COMMAND LINE
C              (CONSISTING OF 80 CHARACTERS IN STRING())
C              TO THE    END
C              OF FILE C:\TURBOC\FRONTEND\DPCOMM.TEX
C
C     TCWRCO DOES THE FOLLOWING--
C        1) OPEN THE FILE
C        2) GO TO THE END OF THE FILEXX
C        3) BACK UP 1 RECORD
C        4) APPEND THE SINGLE COMMAND LINE TO THE FILE
C
C     DATAPLOT CALLING ROUTINE--DPGETC
C
CCCCC UPDATED         --FEBRUARY 1995. SPEED UP APPEND
C     UPDATED         --FEBRUARY  1996. SOFT-CODE THE MENU PATH
C                                       TO ALLOW DRIVE D: TO BE USED
C
CCCCC THE FOLLOWING LINE WAS ADDED   FEBRUARY 1996
      INCLUDE 'DPCOF2.INC'
C
      CHARACTER*80 STRING
      CHARACTER*4 ISUBRO
      CHARACTER*1 ICJUNK
CCCCC THE FOLLOWING LINE WAS ADDED     FEBRUARY 1996
      CHARACTER*80 FILEXX
C
      CHARACTER*4 IFEEDB
      CHARACTER*4 IPRINT
      COMMON /MACH/IRD,IPR,CPUMIN,CPUMAX,NUMBPC,NUMCPW,NUMBPW
      COMMON /PRINT/IFEEDB,IPRINT
C
      IF(ISUBRO.EQ.'WRCO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,999)
  999    FORMAT(1H )
         WRITE(9,51)
   51    FORMAT(1H ,'***** AT THE BEGINNING OF TCWRCO IN TCDRIV--')
         WRITE(9,52)ISUBRO
   52    FORMAT(1H ,'ISUBRO = ',A4)
         WRITE(9,54)STRING(1:80)
   54    FORMAT(1H ,'STRING(1:80) = ',A80)
      ENDIF
C
C      STEP 1--OPEN & GO TO THE END OF THE DPCOMM.TEX FILE
C
CCCCC THE FOLLOWING 7 LINES WERE COMMENTED OUT        FEBRUARY 1995
CCCCC AND REPLACED BY A NON-STANDARD OPEN STATEMENT   FEBRUARY 1995
CCCCC SO AS TO ATTEMPT TO SPEED UP THE OPEN & APPEND  FEBRUARY 1995
C
CCCCC OPEN(UNIT=10,FILE='C:\TURBOC\FRONTEND\DPCOMM.TEX')
CCCCC DO1100I=1,1000000
CCCCC    READ(10,1105,END=1180)ICJUNK
C1105    FORMAT(A1)
C1100 CONTINUE
C1180 CONTINUE
CCCCC BACKSPACE 10
C
CCCCC THE FOLLOWING 2 LINES WERE FIXED     FEBRUARY 1996
CCCCC OPEN(UNIT=10,STATUS='APPEND',
      OPEN(UNIT=10,
CCCCC1      FILE='C:\TURBOC\FRONTEND\DPCOMM.TEX')
     1      FILE='C:\TURBOC\FRONTEND\DPCOMM.TEX',ERR=9020)
 9020 CONTINUE
CLAHE FILEXX(1:NCMPAT)=MPATH(1:NCMPAT)
CLAHE FILEXX(NCMPAT+1:NCMPAT+11)='DPCOMM.TEX'
CLAHE OPEN(UNIT=10,STATUS='APPEND',
CLAHE1      FILE=FILEXX)
C
C     STEP 2--WRITE OUT THE COMMAND LINE TO DPCOMM.TEX
C
      WRITE(10,1181)STRING(1:80)
 1181 FORMAT(A80)
C
C     STEP 3--CLOSE THE FILE DPCOMM.TEX
C
CMS-F ENDFILE 10
      CLOSE(10)
C
      IF(ISUBRO.EQ.'WRCO'.OR.ISUBRO.EQ.'DRIV')THEN
         WRITE(9,999)
         WRITE(9,9021)
 9021    FORMAT(1H ,'***** AT THE END       OF TCWRCO IN TCDRIV--')
         WRITE(9,9022)ISUBRO
 9022    FORMAT(1H ,'ISUBRO = ',A4)
         WRITE(9,9024)STRING(1:80)
 9024    FORMAT(1H ,'STRING(1:80) = ',A80)
      ENDIF
C
      RETURN
      END
