      SUBROUTINE AXES(XX,LXX,NDX,YY,LYY,NDY,IGRIL,ICARA)
      INCLUDE 'param.f'
C
C Trace des axes, des echelles et ecriture des legendes
C
      REAL*8 XX(NDX),YY(NDY),XTRAD,YTRAD
      REAL*4 XS,YS,XXXX(4),YYYY(4)
      LOGICAL*4 LXX(NDX),LYY(NDY),ZERO,LAX
      CHARACTER*1 CC(32)
      CHARACTER*2 LLOG
C
      IF (FRANCAIS) THEN
        CALL COMMENTE_PS('Début des axes',14)
      ELSE
        CALL COMMENTE_PS('Beginning of axis',17)
      ENDIF
C
C Ca c'est pour le bug du passage au double buffer (10/98)
C
      CALL GSCOL(1)
      CALL GSCOL(7)
C
C Quadrillage
C
      IF (IQUADR.LT.0.AND.IGRIL.EQ.0) THEN
        IF (FRANCAIS) THEN
          CALL COMMENTE_PS('Quadrillage',11)
        ELSE
          CALL COMMENTE_PS('Grid',4)
        ENDIF
        CALL GSLT(1)
        CALL GSLW(IGROS-1)
        DO I=1,NDX
          XS = REAL(XX(I))
          IF (XS.GE.XMIN.AND.XS.LE.XMAX) THEN
            IF (IQUADR.EQ.-2) THEN
              IF (LXX(I)) THEN
                CALL GSLW(IGROS)
                CALL GSMOVE(XS,YMIN)
                CALL GSLINE(XS,YMAX)
                CALL GSLW(IGROS-1)
              ELSE
                CALL GSMOVE(XS,YMIN)
                CALL GSLINE(XS,YMAX)
              ENDIF
            ELSEIF(LXX(I)) THEN
              CALL GSMOVE(XS,YMIN)
              CALL GSLINE(XS,YMAX)
            ENDIF
          ENDIF
        ENDDO
        DO I=1,NDY
          YS = REAL(YY(I))
          IF (YS.GE.YMIN.AND.YS.LE.YMAX) THEN
            IF (IQUADR.EQ.-2) THEN
              IF (LYY(I)) THEN
                CALL GSLW(IGROS)
                CALL GSMOVE(XMIN,YS)
                CALL GSLINE(XMAX,YS)
                CALL GSLW(IGROS-1)
              ELSE
                CALL GSMOVE(XMIN,YS)
                CALL GSLINE(XMAX,YS)
              ENDIF
            ELSEIF(LYY(I)) THEN
              CALL GSMOVE(XMIN,YS)
              CALL GSLINE(XMAX,YS)
            ENDIF
          ENDIF
        ENDDO
        CALL GSLW(IGROS+1)
        CALL GSLT(0)
        RETURN
      ENDIF
C
C Trace des axes et du reste
C
      CALL GSLW(IGROS+1)
      CALL GSQWIN(XFMIN,XFMAX,YFMIN,YFMAX)
      XBOX2 = TX*XBOX/TY
      YBOX2 = TY*YBOX/TX
C
      ZERO = .TRUE.
      IF (IAXES.EQ.0) THEN
        XXXX(1) = XMIN
        XXXX(2) = XMAX
        XXXX(3) = XMAX
        XXXX(4) = XMIN
        YYYY(1) = YMIN
        YYYY(2) = YMIN
        YYYY(3) = YMAX
        YYYY(4) = YMAX
        CALL GSPLNEC(4,XXXX,YYYY)
        XMIMI = XMIN
        YMIMI = YMIN
      ELSE
        IF (IAXES.EQ.1) THEN
          XMIMI = XMIN
          YMIMI = YMIN
        ELSE
          IF (0..GT.XMAX) THEN
            XMIMI = XMAX
          ELSEIF(0.LT.XMIN) THEN
            XMIMI = XMIN
          ELSE
            XMIMI = 0.
          ENDIF
          IF (0..GT.YMAX) THEN
            YMIMI = YMAX
          ELSEIF(0.LT.YMIN) THEN
            YMIMI = YMIN
          ELSE
            YMIMI = 0.
          ENDIF
          IF (XMIMI.EQ.0.AND.YMIMI.EQ.0.) ZERO = .FALSE.
        ENDIF
        TTX = TX
        TTY = TY
        CALL GSMOVE(XMIMI,YMAX+1.5*TTX)
        CALL GSLINE(XMIMI,YMIN)
        CALL GSMOVE(XMAX+1.5*TTY,YMIMI)
        CALL GSLINE(XMIN,YMIMI)
        CALL GSPATF(7)
        CALL GSPAT(-16)
        XXXX(1) = XMIMI
        YYYY(1) = YMAX+1.5*TTX
        XXXX(2) = XMIMI+TTY
        YYYY(2) = YMAX+.5*TTX
        XXXX(3) = XMIMI
        YYYY(3) = YMAX+2.4*TTX
        XXXX(4) = XMIMI-TTY
        YYYY(4) = YMAX+.5*TTX
        CALL MY_GSAREA(0,XXXX,YYYY,4)
        XXXX(1) = XMAX+1.5*TTY
        YYYY(1) = YMIMI
        XXXX(2) = XMAX+.5*TTY
        YYYY(2) = YMIMI+TTX
        XXXX(3) = XMAX+2.4*TTY
        YYYY(3) = YMIMI
        XXXX(4) = XMAX+.5*TTY
        YYYY(4) = YMIMI-TTX
        CALL MY_GSAREA(0,XXXX,YYYY,4)
        CALL GSPATF(0)
        CALL GSPAT(16)
      ENDIF
C
C Legende sur Ox
C
      IF (ICARA.EQ.0) THEN
        IF (NABS.GT.0) THEN
          IF (FRANCAIS) THEN
            CALL COMMENTE_PS('Légende Ox',10)
          ELSE
            CALL COMMENTE_PS('Legend Ox',9)
          ENDIF
          CALL METSACCENTS(1)
          CALL ECABS(0)
          CALL METSACCENTS(0)
        ENDIF
C
C Legende sur Oy
C
        IF (NORD.GT.0) THEN
          IF (FRANCAIS) THEN
            CALL COMMENTE_PS('Légende Oy',10)
          ELSE
            CALL COMMENTE_PS('Legend Oy',9)
          ENDIF
          CALL METSACCENTS(1)
          CALL ECORD(0)
          CALL METSACCENTS(0)
        ENDIF
      ENDIF
C
C Echelles x
C 
      YECH   = YMIMI - YBOX
      YECHL1 = YMIMI - YBOX*.6
      YECHL2 = YMIMI - YBOX*1.1
      IF (ICARA.EQ.0) THEN
        IPUI = 0
        IDECAL = 0
        IF (ILOGX.GE.0) THEN
          IF (IENG.GE.0) THEN
            DO I=1,NDX
              XS = REAL(XX(I))
              IF (XS.GE.(XMIN-TY*.1) .AND. XS.LE.(XMAX+TY*.1)
     &     .AND.LXX(I).AND.XS.NE.0..AND.
     &         (DABS(XX(I)).GE.GRAND.OR.DABS(XX(I)).LT.PETIT)) IPUI=1
            ENDDO
          ENDIF
          IF (IPUI.EQ.1) THEN
            IF (XMAX.NE.0.) THEN
              IDECAL1 = NINT(DLOG10(DBLE(ABS(XMAX))))
            ELSE
              IDECAL1 = 0
            ENDIF
            IF (XMIN.NE.0.) THEN
              IDECAL2 = NINT(DLOG10(DBLE(ABS(XMIN))))
            ELSE
              IDECAL2 = 0
            ENDIF
            IF (ABS(IDECAL1).GT.ABS(IDECAL2)) THEN
              IDECAL = IDECAL1
            ELSE
              IDECAL = IDECAL2
            ENDIF
          ELSE
            IDECAL = 0
          ENDIF
        ENDIF
C
        IF (FRANCAIS) THEN
          CALL COMMENTE_PS('Echelles x',10)
        ELSE
          CALL COMMENTE_PS('x scale',7)
        ENDIF
        IF (ISAUTX.NE.0) THEN
          IZER = 0
          DO I=1,NDX
            IF (XX(I).EQ.0.D0) IZER = I
          ENDDO
          IF (IZER.EQ.0) THEN
            CALL TRAD(XX(1),CC,NC,XMIN,XMAX,IDECAL)
            IDD = ICHAR(CC(NC))
            IF (MOD(IDD,2).EQ.0) THEN
              IIMOD = -1
            ELSE
              IIMOD = 1
            ENDIF
          ELSEIF(MOD(IZER,2).EQ.0) THEN
            IIMOD = -1
          ELSE
            IIMOD = 1
          ENDIF
        ELSE
          IIMOD = 1
        ENDIF
C
        IF (IDECAL.NE.0) THEN
          NC1M = 0
          NC2M = 0
          DO I=1,NDX
            IF (LXX(I).AND.XX(I).NE.0.) THEN
              CALL TRAD(XX(I),CC,NC1,XMIN,XMAX,IDECAL)
              CALL TRAD2(CC,NC1,NCB)
              CALL TRAD(XX(I),CC,NC2,XMIN,XMAX,0)
              NC1M = MAX(NC1M,NC1-3)
              IF (NC2.NE.1.OR.CC(1).NE.'0') NC2M = MAX(NC2M,NC2)
            ENDIF
          ENDDO
          IF (IDECAL.GT.0) THEN
            IF (NC2M.NE.0.AND.NC1M.GT.NC2M-3) IDECAL = 0
          ELSE
            IF (NC2M.NE.0.AND.NC1M.GT.NC2M-4) IDECAL = 0
          ENDIF
          IF (IDECAL.EQ.0) IPUI = 0
        ENDIF
C
        LLOG = '10'
        NLOG = 2
        TLOG = TAILLE_CHAINE(LLOG,NLOG)
C
        IF (ILOGX.LT.0) THEN
          NNN = 0
          DO I=1,NDX
            XS = REAL(XX(I))
            IF (XS.GE.(XMIN-TY*.1).AND.XS.LE.(XMAX+TY*.1).AND.LXX(I))
     &           NNN=NNN+1
          ENDDO
          LAX = NNN.LE.1
        ELSE
          LAX = .FALSE.
        ENDIF
      ENDIF
C
      DO 10 I=1,NDX
        XS = REAL(XX(I))
        IF (ISAUTX.NE.0) IIMOD = -IIMOD
        IF (ICARA.EQ.0) THEN
          ILOGPUI = 0
          IF (XS.GE.(XMIN-TY*.1) .AND. XS.LE.(XMAX+TY*.1) ) THEN
            IF (LAX.OR.(LXX(I).AND.(ISAUTX.EQ.0.OR.IIMOD.GT.0))) THEN
              IF (XX(I).NE.0.D0) THEN
                IF (ILOGX.LT.0) THEN
                  IF (IENG.LT.0) THEN
                    XTRAD = 10.**XX(I)
                  ELSE
                    IF (LXX(I)) THEN
                      XTRAD = XX(I)
                    ELSE
                      XTRAD = 10.**XX(I)
                      ILOGPUI = 1
                    ENDIF
                  ENDIF
                ELSE
                  XTRAD = XX(I)
                ENDIF
                IF (ITIMEX.NE.0) THEN
                  CALL TRADHMS2(XTRAD,CC,NC,ITIMEX)
                  TAILL = TAILLE_CHAINE(CC,NC)
                ELSE
                  CALL TRAD(XTRAD,CC,NC,XMIN,XMAX,IDECAL)
                  IF (IPUI.EQ.1.OR.ILOGPUI.EQ.1) THEN
                    CALL TRADVERIF(XTRAD,CC,NC,NC2,ILOGPUI,IRC)
                    IF (IRC.EQ.0) CALL TRAD2(CC,NC,NC2)
                    TAILL1=TAILLE_CHAINE(CC,NC)
                    TAILL2=TAILLE_CHAINE(CC(NC+1),NC2)*.45/.65
                  ELSE
                    TAILL = TAILLE_CHAINE(CC,NC)
                  ENDIF
                ENDIF
              ELSE
                IF (ILOGX.LT.0.AND.IENG.LT.0) THEN
                  CC(1) = '1'
                ELSE
                  CC(1) = '0'
                ENDIF
                NC = 1
                TAILL = TAILLE_CHAINE(CC,NC)
              ENDIF
              IF (ILOGX.GE.0.OR.IENG.LT.0.OR.ILOGPUI.EQ.1) THEN
                IF (ILOGPUI.EQ.0.AND.(IPUI.EQ.0.OR.XS.EQ.0.)) THEN
                  IF (XS.EQ.0..AND..NOT.ZERO) THEN
                    CALL GSCHAR(XS-TAILL*1.5,YECH,NC,CC)
                  ELSE
                    IF ((XS+TAILL*.5).LE.XHELP) THEN
                      CALL GSCHAR(XS-TAILL*.5,YECH,NC,CC)
                    ELSE
                      CALL GSCHAR(XHELP-TAILL*1.05,YECH,NC,CC)
                    ENDIF
                  ENDIF
                ELSE
                  TOTO = XS+(TAILL1+TAILL2)*.5
                  IF (TOTO.LE.XHELP) THEN
                    CALL GSLSS(IFONT3)
                    CALL GSCHAR
     &                   (XS+(TAILL1-TAILL2)*.5,YECHL1,NC2,CC(NC+1))
                    CALL GSLSS(IFONT2)
                    CALL GSCHAR(XS-(TAILL1+TAILL2)*.5,YECHL2,NC,CC)
                  ELSE
                    CALL GSLSS(IFONT3)
                    TOTO = XHELP-TAILL2*1.05
                    CALL GSCHAR(TOTO,YECHL1,NC2,CC(NC+1))
                    CALL GSLSS(IFONT2)
                    CALL GSCHAR(TOTO-TAILL1,YECHL2,NC,CC)
                  ENDIF
                ENDIF
              ELSE
                TAILL2 = (.45/.65)*TAILL
                IF ((XS+(TAILL2+TLOG)*.5).LE.XHELP) THEN
                  CALL GSLSS(IFONT3)
                  CALL GSCHAR(XS+(TLOG-TAILL2)*.5,YECHL1,NC,CC)
                  CALL GSLSS(IFONT2)
                  CALL GSCHAR(XS-(TLOG+TAILL2)*.5,YECHL2,NLOG,LLOG)
                ELSE
                  CALL GSLSS(IFONT3)
                  TOTO = XHELP-TAILL2*1.05
                  CALL GSCHAR(TOTO,YECHL1,NC,CC)
                  CALL GSLSS(IFONT2)
                  CALL GSCHAR(TOTO-TLOG,YECHL2,NLOG,LLOG)
                ENDIF
              ENDIF
            ENDIF
          ENDIF
        ENDIF
        IF (XS.GE.XMIN.AND.XS.LE.XMAX) THEN
          IF (LXX(I)) THEN
            T = TX*2.
          ELSE
            T = TX
          ENDIF
          IF (IAXES.EQ.2) THEN
            YMI = YMIMI-.5*T
            YMA = YMAX+.5*T
          ELSE
            YMI = YMIN
            YMA = YMAX
          ENDIF
          CALL GSMOVE(XS,YMI)
          CALL GSLINE(XS,YMI+T)
          IF (IAXES.EQ.0) THEN
            CALL GSMOVE(XS,YMA-T)
            CALL GSLINE(XS,YMA)
          ENDIF
        ENDIF
 10   CONTINUE
C
C Echelles y
C
      IF (ICARA.EQ.0) THEN
        IPUI = 0
        IDECAL = 0
        IF (ILOGY.GE.0) THEN
          IF (IENG.GE.0) THEN
            DO I=1,NDY
              YS = REAL(YY(I))
              IF (YS.GE.(YMIN-TX*.1) .AND. YS.LE.(YMAX+TX*.1)
     &             .AND.LYY(I).AND.YS.NE.0..AND.
     &        (DABS(YY(I)).GE.GRAND.OR.DABS(YY(I)).LT.PETIT)) IPUI = 1
            ENDDO
          ENDIF
          IF (IPUI.EQ.1) THEN
            IF (YMAX.NE.0.) THEN
              IDECAL1 = NINT(DLOG10(DBLE(ABS(YMAX))))
            ELSE
              IDECAL1 = 0
            ENDIF
            IF (YMIN.NE.0.) THEN
              IDECAL2 = NINT(DLOG10(DBLE(ABS(YMIN))))
            ELSE
              IDECAL2 = 0
            ENDIF
            IF (ABS(IDECAL1).GT.ABS(IDECAL2)) THEN
              IDECAL = IDECAL1
            ELSE
              IDECAL = IDECAL2
            ENDIF
          ELSE
            IDECAL = 0
          ENDIF
        ENDIF
C
        IF (ISAUTY.NE.0) THEN
          IZER = 0
          DO I=1,NDY
            IF (YY(I).EQ.0.D0) IZER = I
          ENDDO
          IF (IZER.EQ.0) THEN
            CALL TRAD(YY(1),CC,NC,YMIN,YMAX,IDECAL)
            IDD = ICHAR(CC(NC))
            IF (MOD(IDD,2).EQ.0) THEN
              IIMOD = -1
            ELSE
              IIMOD = 1
            ENDIF
          ELSEIF(MOD(IZER,2).EQ.0) THEN
            IIMOD = -1
          ELSE
            IIMOD = 1
          ENDIF
        ELSE
          IIMOD = 1
        ENDIF
C
        IF (IDECAL.NE.0) THEN
          NC1M = 0
          NC2M = 0
          DO I=1,NDY
            IF (LYY(I).AND.YY(I).NE.0.) THEN
              CALL TRAD(YY(I),CC,NC1,YMIN,YMAX,IDECAL)
              CALL TRAD2(CC,NC1,NCB)
              CALL TRAD(YY(I),CC,NC2,YMIN,YMAX,0)
              NC1M = MAX(NC1M,NC1-3)
              IF (NC2.NE.1.OR.CC(1).NE.'0') NC2M = MAX(NC2M,NC2)
            ENDIF
          ENDDO
          IF (IDECAL.GT.0) THEN
            IF (NC2M.NE.0.AND.NC1M.GT.NC2M-3) IDECAL = 0
          ELSE
            IF (NC2M.NE.0.AND.NC1M.GT.NC2M-4) IDECAL = 0
          ENDIF
          IF (IDECAL.EQ.0) IPUI = 0
        ENDIF
C
        IF (FRANCAIS) THEN
          CALL COMMENTE_PS('Echelles y',10)
        ELSE
          CALL COMMENTE_PS('y scale',7)
        ENDIF
C
        IF (ILOGY.LT.0) THEN
          NNN = 0
          DO I=1,NDY
            YS = REAL(YY(I))
            IF (YS.GE.(YMIN-TX*.1).AND.YS.LE.(YMAX+TX*.1).AND.LYY(I))
     &           NNN=NNN+1
          ENDDO
          LAX = NNN.LE.1
        ELSE
          LAX = .FALSE.
        ENDIF
      ENDIF
C
      DO 20 I=1,NDY
        YS = REAL(YY(I))
        IF (ICARA.EQ.0) THEN
          ILOGPUI = 0
          IF ( YS.GE.(YMIN-TX*.1).AND.YS.LE.(YMAX+TX*.1) ) THEN
            IF (ISAUTY.NE.0) IIMOD = -IIMOD
            IF (LAX.OR.(LYY(I).AND.(ISAUTY.EQ.0.OR.IIMOD.GT.0))) THEN
              IF (YY(I).NE.0.D0) THEN
                IF (ILOGY.LT.0) THEN
                  IF (IENG.LT.0) THEN
                    YTRAD = 10.**YY(I)
                  ELSE
                    IF (LYY(I)) THEN
                      YTRAD = YY(I)
                    ELSE
                      YTRAD = 10.**YY(I)
                      ILOGPUI = 1
                    ENDIF
                  ENDIF
                ELSE
                  YTRAD = YY(I)
                ENDIF
                IF (ITIMEY.NE.0) THEN
                  CALL TRADHMS2(YTRAD,CC,NC,ITIMEY)
                  TAILL= TAILLE_CHAINE(CC,NC)
                ELSE
                  CALL TRAD(YTRAD,CC,NC,YMIN,YMAX,IDECAL)
                  IF (IPUI.EQ.1.OR.ILOGPUI.EQ.1) THEN
                    CALL TRADVERIF(YTRAD,CC,NC,NC2,ILOGPUI,IRC)
                    IF (IRC.EQ.0) CALL TRAD2(CC,NC,NC2)
                    TAILL1=TAILLE_CHAINE(CC,NC)
                    TAILL2=TAILLE_CHAINE(CC(NC+1),NC2)*.45/.65
                  ELSE
                    TAILL= TAILLE_CHAINE(CC,NC)
                  ENDIF
                ENDIF
              ELSE
                IF (ILOGY.LT.0.AND.IENG.LT.0) THEN
                  CC(1) = '1'
                ELSE
                  CC(1) = '0'
                ENDIF
                NC = 1
                TAILL = TAILLE_CHAINE(CC,NC)
              ENDIF
              IF (ILOGY.GE.0.OR.IENG.LT.0.OR.ILOGPUI.EQ.1) THEN
                IF (YS.NE.0..OR.ZERO) THEN
                  IF (ILOGPUI.EQ.0.AND.(IPUI.EQ.0.OR.YS.EQ.0.)) THEN
                    CALL GSCHAR(XMIMI-1.5*TY-TAILL,YS-YBOX*.25,NC,CC)
                  ELSE
                    CALL GSLSS(IFONT3)
                    TOTO = XMIMI-1.5*TY-TAILL2
                    CALL GSCHAR(TOTO,YS+YBOX*.1,NC2,CC(NC+1))
                    CALL GSLSS(IFONT2)
                    CALL GSCHAR(TOTO-TAILL1,YS-YBOX*.35,NC,CC)
                  ENDIF
                ENDIF
              ELSE
                TAILL2 = (.45/.65)*TAILL
                CALL GSLSS(IFONT3)
                TOTO = XMIMI-1.5*TY-TAILL2
                CALL GSCHAR(TOTO,YS+YBOX*.1,NC,CC)
                CALL GSLSS(IFONT2)
                CALL GSCHAR(TOTO-TLOG,YS-YBOX*.35,NLOG,LLOG)
              ENDIF
            ENDIF
          ENDIF
        ENDIF
        IF (YS.GE.YMIN.AND.YS.LE.YMAX) THEN
          IF (LYY(I)) THEN
            T = TY*2.
          ELSE
            T = TY
          ENDIF
          IF (IAXES.EQ.2) THEN
            XMI = XMIMI-.5*T
            XMA = XMAX+.5*T
          ELSE
            XMI = XMIN
            XMA = XMAX
          ENDIF
          CALL GSMOVE(XMI,YS)
          CALL GSLINE(XMI+T,YS)
          IF (IAXES.EQ.0) THEN
            CALL GSMOVE(XMA,YS)
            CALL GSLINE(XMA-T,YS)
          ENDIF
        ENDIF
 20   CONTINUE
C
C Axes
C
      IF (IOPT.LT.0) THEN
        CALL GSLT(3)
        IF (XMIN.LT.0..AND.XMAX.GT.0.) THEN
          CALL GSMOVE(0.,YMIN)
          CALL GSLINE(0.,YMAX)
        ENDIF
        IF (YMIN.LT.0..AND.YMAX.GT.0.) THEN
          CALL GSMOVE(XMIN,0.)
          CALL GSLINE(XMAX,0.)
        ENDIF
      ENDIF
      CALL GSLT(0)
C
      CALL LEG
C
C Titre general
C
      IF (NGEN.GT.0) THEN
        IF (FRANCAIS) THEN
          CALL COMMENTE_PS('Titre général',13)
        ELSE
          CALL COMMENTE_PS('General title',13)
        ENDIF
        CALL METSACCENTS(1)
        CALL ECGEN(1)
        CALL METSACCENTS(0)
      ENDIF
      IF (FRANCAIS) THEN
        CALL COMMENTE_PS('Fin des axes',12)
      ELSE
        CALL COMMENTE_PS('End of axis',11)
      ENDIF
      END
C-----------------------------------------------------------------------
      SUBROUTINE ECANNEXE(TAILL,XLL,YLL,IOP,IVER)
      INCLUDE 'param.f'
C
      IF (IVER.EQ.0) THEN
        IF (IOP.EQ.1) THEN
          YINPUT(1) = YLL - YBOX*.3
          YINPUT(2) = YINPUT(1)
ccc          YINPUT(3) = YLL + YBOX*0.9
          YINPUT(3) = YLL + YBOX*0.85
          YINPUT(4) = YINPUT(3)
          XINPUT(1) = XLL -.5*XBOX
          XINPUT(2) = XLL + TAILL + .5*XBOX
        ELSEIF((XLL -.5*XBOX).GT.XINPUT(1)) THEN
          XOLD2 = XINPUT(2)
          XINPUT(2) = XLL -.5*XBOX
          XINPUT(3) = XINPUT(2)
          XINPUT(4) = XINPUT(1)
          IF (IOP.EQ.2) THEN
            CALL GSPATF(8)
            CALL GSCOL(8)
          ELSE
            CALL GSPATF(0)
            CALL GSCOL(0)
          ENDIF
          CALL GSPAT(16)
          CALL MY_GSAREA(1,XINPUT,YINPUT,4)
          XINPUT(1) = XLL + TAILL + .5*XBOX
          XINPUT(2) = XOLD2
          XINPUT(3) = XINPUT(2)
          XINPUT(4) = XINPUT(1)
          CALL MY_GSAREA(1,XINPUT,YINPUT,4)
          XINPUT(2) = XINPUT(1)
          XINPUT(1) = XLL -.5*XBOX
          CALL GSCOL(7)
        ELSE
          XINPUT(1) = XLL -.5*XBOX
          XINPUT(2) = XLL + TAILL + .5*XBOX
        ENDIF
        XINPUT(3) = XINPUT(2)
        XINPUT(4) = XINPUT(1)
      ELSE
        IF (IOP.EQ.1) THEN
          XINPUT(1) = XLL + .6*XBOX
          XINPUT(2) = XLL - .9*XBOX
          XINPUT(3) = XINPUT(2)
          XINPUT(4) = XINPUT(1)
          YINPUT(1) = YLL - YBOX*.5
          YINPUT(2) = YINPUT(1)
          YINPUT(3) = YLL + TAILL + YBOX*.5
          YINPUT(4) = YINPUT(3)
        ELSEIF((YLL -.5*YBOX).GT.YINPUT(1)) THEN
          YOLD3 = YINPUT(3)
          YINPUT(2) = YINPUT(1)
          YINPUT(3) = YLL -.5*YBOX
          YINPUT(4) = YINPUT(3)
          IF (IOP.EQ.2) THEN
            CALL GSPATF(8)
            CALL GSCOL(8)
          ELSE
            CALL GSPATF(0)
            CALL GSCOL(0)
          ENDIF
          CALL GSPAT(16)
          CALL MY_GSAREA(1,XINPUT,YINPUT,4)
          YINPUT(1) = YLL + TAILL + .5*YBOX
          YINPUT(2) = YINPUT(1)
          YINPUT(3) = YOLD3
          YINPUT(4) = YINPUT(3)
          CALL MY_GSAREA(1,XINPUT,YINPUT,4)
          YINPUT(3) = YINPUT(1)
          YINPUT(1) = YLL -.5*YBOX
          CALL GSCOL(7)
        ELSE
          YINPUT(1) = YLL -.5*YBOX
          YINPUT(3) = YLL + TAILL + .5*YBOX
        ENDIF
        YINPUT(2) = YINPUT(1)
        YINPUT(4) = YINPUT(3)
      ENDIF
      CALL GSPATF(0)
      CALL GSPAT(16)
      IF (IOP.GT.2) THEN
        CALL GSCOL(0)
        CALL MY_GSAREA(1,XINPUT,YINPUT,4)
        CALL GSCOL(7)
      ELSE
        CALL MY_GSAREA(1,XINPUT,YINPUT,4)
      ENDIF
      END
C-----------------------------------------------------------------------
      SUBROUTINE ECABS(IOP)
      INCLUDE 'param.f'
C
      TAILL = TAILLE_CHAINE(ABSC,NABS)
      XLL = .5*(XMIN+XMAX-TAILL)
      YLL = YFMIN+.2*YBOX
      IF (IOP.NE.0) CALL ECANNEXE(TAILL,XLL,YLL,IOP,0)
      CALL GSCHAR(XLL,YLL,NABS,ABSC)
      END
C-----------------------------------------------------------------------
      SUBROUTINE ECORD(IOP)
      INCLUDE 'param.f'
C
      CALL GSCA(0.,1.)
      TAILL = TAILLE_CHAINE(ORDON,NORD)
      IF (IOP.NE.0) THEN
        XLL = XFMIN+1.2*XBOX
        YLL = .5*(YMIN+YMAX-TAILL)
        CALL ECANNEXE(TAILL,XLL,YLL,IOP,1)
        CALL GSCHAR(XLL,YLL,NORD,ORDON)
      ELSEIF(TAILL.LT.YMAX-YMIN) THEN
        XLL = XFMIN+1.2*XBOX
        YLL = .5*(YMIN+YMAX-TAILL)
        CALL GSCHAR(XLL,YLL,NORD,ORDON)
      ELSE
        ICOUPE = 0
        T2 = .5*TAILL
        DO I=1,NORD
          IF (ORDON(I:I).EQ.' ') THEN
            TATA = TAILLE_CHAINE(ORDON,I)
            IF (TATA.GT.T2) THEN
              ICOUPE = I
              GOTO 10
            ENDIF
          ENDIF
        ENDDO
 10     IF (ICOUPE.EQ.0) ICOUPE = NORD/2
        TAILL = TAILLE_CHAINE(ORDON,ICOUPE)
        XLL = XFMIN+1.2*XBOX
        YLL = .5*(YMIN+YMAX-TAILL)
        CALL GSCHAR(XLL,YLL,ICOUPE,ORDON)
        TAILL = TAILLE_CHAINE(ORDON(ICOUPE+1:NORD),NORD-ICOUPE)
        XLL = XFMIN+3.*XBOX
        YLL = .5*(YMIN+YMAX-TAILL)
        CALL GSCHAR(XLL,YLL,NORD-ICOUPE,ORDON(ICOUPE+1:NORD))
      ENDIF
      CALL GSCA(1.,0.)
      END
C-----------------------------------------------------------------------
      SUBROUTINE ECGEN(IOP)
      INCLUDE 'param.f'
C
      TAILL = TAILLE_CHAINE(GENE,NGEN)
      XLL = .5*(XMIN+XMAX-TAILL)
      YLL = YMAX-YBOX*.3
      CALL ECANNEXE(TAILL,XLL,YLL,IOP,0)
      CALL GSCHAR(XLL,YLL,NGEN,GENE)
      END
