      SUBROUTINE GIGI(X,Y,IND)
CC
CC         Notice of Public Domain nature of this Program
CC
CC      'This computer program is a work of the United States 
CC       Government and as such is not subject to protection by 
CC       copyright (17 U.S.C. # 105.)  Any person who fraudulently 
CC       places a copyright notice or does any other act contrary 
CC       to the provisions of 17 U.S. Code 506(c) shall be subject 
CC       to the penalties provided therein.  This notice shall not 
CC       be altered or removed from this software and is to be on 
CC       all reproductions.'
CC
      CHARACTER*1 ESC, ASCII
      COMMON/ OUTPUT/ IPAPER,IPAGE
      COMMON /ASCIIC/ ASCII( 0: 255)
      INTEGER PIXROW, PIXCOL, PIXEL
      COMMON /TERM/ IMAXR, IMAXC, PIXROW, PIXCOL, PIXEL, LCOUNT, INGRAF,
     .              IXL, IXR, IYT, IYB, NCOLOR, MCOLOR( 64 ), ITTRM,
     .              MARGX, MARGY
** VARIABLES IN COMMON TERM:
**  IMAXR = MAX NUMBER OF ROWS
**  IMAXC = MAX NUMBER OF COLUMNS
**  PIXROW = NUMBER OF PIXELS PER ROW
**  PIXCOL = NUMBER OF PIXELS PER COLUMN
**  PIXEL  = LESSER OF PIXROW OR PIXCOL
**  LCOUNT = NUMBER OF LINES CURRENTLY WRITTEN TO DIALOG AREA
**  INGRAF = 0=> HOST TEXT GOES TO MONITOR SPACE\\ 1=> TEXT TO GRAPHICS
**  IXL    = LEFT MOST VALUE OF X
**  IXR    = RIGHT MOST VALUE OF X
**  IYT    = VALUE OF Y AT TOP OF SCREEN
**  IYB    = VALUE OF Y AT BOTTOM OF SCREEN
**  NCOLOR = NUMBER OF COLORS IN MCOLOR MAP
**  MCOLOR = MAP OF COLORS
**  ITTRM  = UNIQUE MODEL NUMBER OF GENERAL TERMINAL TYPE
**  MARGX  = NUMBER OF PIXELS PADDED TO X-COORDINATE
**  MARGY  = NUMBER OF PIXELS PADDED TO Y-COORDINATE
**
**
      EQUIVALENCE ( ESC, ASCII(27) )
CC
CC   CODES FOR IND:
CC
CC     IND = 0   =>  REMOVE ALL GRAPHICS TO QUIT
CC     IND = 1   =>  ANY ONE TIME ONLY INITIALIZATION
CC     IND = 2   =>  MOVE GRAPHICS TO POINT (X,Y) -- DO NOT DRAW LINE
CC     IND = 3   =>  DRAW LINE FROM LAST POINT TO NEW (X,Y)
CC     IND = 4   =>  DRAW DARK LINE
CC     IND = 5   =>  DRAW BRIGHT SOLID LINE
CC     IND = 6   =>  INITIALIZE & SET-UP FOR NEXT PICTURE
CC     IND = 8   =>  TEMPORARY RELEASE FROM GRAPHICS
CC     IND = 9   =>  RETURN TO GRAPHICS FROM TEMP RELEASE
CC     IND =10   =>  DONE DRAWING PICTURE
CC     IND =99   =>  CHANGE COLOR TO VALUE IN X
CC
      PIXEL = 479. * IPAGE / 100.

      IF (IND.EQ.0) THEN
CC  ALL DONE -- CLEAR TERMINAL AND WE WILL QUIT
        WRITE (*,*) 'S(E)'//ESC//'H'//ESC//'J'
      ELSEIF (IND.EQ.1) THEN
CC  ONE TIME ONLY INITIALIZATION OF TRMINAL  (IF NEEDED)
        WRITE (*,*) ESC//'PpS(EI(D))W(I(W))'
      ELSEIF (IND.EQ.2 ) THEN
**  MOVE TO POINT ( NO DRAW )
        IXLX = X * PIXEL
        IYLY = (1.0 - Y ) * PIXEL
        WRITE ( *, '('' P['',I3,'','',I3,'']'')') IXLX, IYLY
        IXLAST = IXLX
        IYLAST = IYLY
      ELSEIF (IND.EQ.3) THEN
CC DRAW LINE FROM LAST POINT TO NEW POINT
        IXLX = X * PIXEL
        IYLY = (1.0 - Y ) * PIXEL
        WRITE ( *, '('' V['',I3,'','',I3,'']'')') IXLX, IYLY
        IXLAST = IXLX
        IYLAST = IYLY
      ELSEIF (IND.EQ.4) THEN
** DRAW DARK LINE ( ERASES PREVIOUS LINES )
        WRITE ( *, '('' W(I(D))'')')
      ELSEIF (IND.EQ.5) THEN
** DRAW BRIGHT (I.E. WHITE LINE)
        WRITE ( *, '('' W(I(W))'')')
      ELSEIF (IND.EQ.6) THEN
CC  INITIALIZE FOR DRAWING NEXT PICTURE
        WRITE (*,*) ESC//'PpS(EI(D))W(I(W))'
CC?         WRITE ( *, *) ESC//'PpS(E)'
      ELSEIF (IND.EQ.8) THEN
CC TEMPORARY RELEASE FROM GRPHICS  (USUALLY FOR TEXT)
CC?         WRITE ( *, * ) ESC//'\'
CC?         WRITE ( *, *) 'T"'
      ELSEIF (IND.EQ.9) THEN
CC RETURN TO GRAPHICS FROM TEMPORARY RELEASE
CC?         WRITE ( *, *) ESC//'Pp'
CC?         WRITE ( *, *) '"'
      ELSEIF (IND.EQ.10) THEN
CC DONE DRAWING PICTURE
        WRITE ( *, *) ESC//'\\'
      ELSEIF (IND.EQ.99) THEN
CC REQUEST CHANGE COLOR
**  NOT SUPPORTED HERE
        CONTINUE
      ELSE
CC WE HAVE AN ERROR IN IND
        WRITE ( *, *) ' ERROR IN PLOT, IND=',IND
      ENDIF
      RETURN
      END
