      SUBROUTINE G0DIVL(IAXIS)
C
C          ------------------------------------------------
C          ROUTINE NO. ( 236)   VERSION (A7.5)    11:FEB:85
C          ------------------------------------------------
C
C          THIS FINDS THE POSITIONS OF THE INTERVALS ON THE GIVEN AXIS
C          (FOR LOG. SCALING) WHICH LIE WITHIN THE CURRENT WINDOW AREA.
C
C
C          <IAXIS>  GIVES THE REQUIRED AXIS BY ITS MODULUS:
C                   = 1, THE X-AXIS IS TAKEN, OR
C                   = 2, THE Y-AXIS IS TAKEN.
C
C
C          THE FOLLOWING ARGUMENTS ARE SUPPLIED THROUGH COMMON:
C
C          <X1WND0>    THE COORDINATES
C          <X2WND0>    OF
C          <Y1WND0>    THE
C          <Y2WND0>    WINDOW RECTANGLE.
C
C          <AXPOSX> THE POSITION OF THE X-AXIS ALONG Y.
C          <AXPOSY> THE POSITION OF THE Y-AXIS ALONG X.
C          <NOTATE> IF ZERO, NO ANNOTATION IS REQUIRED,
C                   IF NON-ZERO, ANNOT. FORMAT MUST BE CALCULATED.
C
C
C          THE FOLLOWING ARGUMENTS ARE RETURNED THROUGH COMMON:
C          (ONLY THE ARGS. RELEVANT TO THE GIVEN AXIS ARE CHANGED):
C
C          <KTYPEX> IS THE X-AXIS TYPE (= 2 FOR LOG. AXIS).
C          <KTYPEY> IS THE Y-AXIS TYPE (= 2 FOR LOG. AXIS).
C          <DIVLX>  GIVES THE X-AXIS SIGN.
C          <DIVLY>  GIVES THE Y-AXIS SIGN.
C          <NSKIPX> IS THE X-AXIS START-POINT EXPONENT.
C          <NSKIPY> IS THE Y-AXIS START-POINT EXPONENT.
C          <NTIKLX> IS THE X-AXIS START-POINT MANTISSA.
C          <NTIKLY> IS THE Y-AXIS START-POINT MANTISSA.
C          <NTIKHX> IS THE NO. OF X-AXIS TICK MARKS.
C          <NTIKHY> IS THE NO. OF Y-AXIS TICK MARKS.
C          <NDECSX> IS THE NO. OF DECADE MARKS ON THE X-AXIS.
C          <NDECSY> IS THE NO. OF DECADE MARKS ON THE Y-AXIS.
C          <NCHRSX> IS THE NO. OF CHARS. IN X-AXIS ANNOTATION.
C          <NCHRSY> IS THE NO. OF CHARS. IN Y-AXIS ANNOTATION.
C          <KAXIS>  IS SET BY <IAXIS> FOR SUBSEQUENT USE.
C
C
      LOGICAL ERRON
C
      COMMON /T0AARG/ KAXIS
      COMMON /T0ADIX/ DIVLX,NTIKLX,NTIKHX
      COMMON /T0ADIY/ DIVLY,NTIKLY,NTIKHY
      COMMON /T0ANOX/ KANNX,NCHRSX,NAFTPX
      COMMON /T0ANOY/ KANNY,NCHRSY,NAFTPY
      COMMON /T0ASKX/ NSKIPX,NDECSX
      COMMON /T0ASKY/ NSKIPY,NDECSY
      COMMON /T0ATYP/ KTYPEX,KTYPEY
      COMMON /T0WNDO/ X1WND0,X2WND0,Y1WND0,Y2WND0
      COMMON /T3ERRS/ ERRON,NUMERR
C
C
C          THE AXIS TYPE IS SET, THE SIGN OF THE AXIS REGION IS
C          FOUND, AND THE END POINTS ARE APPROPRIATELY SET.
C
      KAXIS= IAXIS
C
      ENDMIN= AMIN1(X1WND0,X2WND0)
      ENDMAX= AMAX1(X1WND0,X2WND0)
      IF (IABS(KAXIS).EQ.1) GO TO 1
      ENDMIN= AMIN1(Y1WND0,Y2WND0)
      ENDMAX= AMAX1(Y1WND0,Y2WND0)
C
    1 AXSIGN= +1.0
      IF (ENDMIN.GT.0.0) GO TO 2
      AXSIGN= -1.0
      SWOP=   ABS(ENDMIN)
      ENDMIN= ABS(ENDMAX)
      ENDMAX= SWOP
C
C          THE START-POINT EXPONENT AND MANTISSA ARE FOUND.
C          THE SECOND SECTION ALLOWS FOR ROUNDING ERRORS.
C
    2 EXP= ALOG10(ENDMIN)
      IF (EXP.LT.0.0) EXP= EXP-1.0
      IDEC1= EXP
      TIKPT= ENDMIN*(10.0**(-IDEC1))
      ITIK1= TIKPT+0.99999
C
      IF (ITIK1.LT.10) GO TO 3
      ITIK1= 1
      IDEC1= IDEC1+1
      GO TO 4
    3 IF (ITIK1.GE.1) GO TO 4
      ITIK1= 9
      IDEC1= IDEC1-1
C
C          THE SAME IS THEN DONE FOR THE END-POINT VALUES.
C
    4 EXP= ALOG10(ENDMAX)
      IF (EXP.LT.0.0) EXP= EXP-1.0
      IDEC2= EXP
      TIKPT= ENDMAX*(10.0**(-IDEC2))
      ITIK2= TIKPT+0.00001
C
      IF (ITIK2.LT.10) GO TO 5
      ITIK2= 1
      IDEC2= IDEC2+1
      GO TO 6
    5 IF (ITIK2.GE.1) GO TO 6
      ITIK2= 9
      IDEC2= IDEC2-1
C
C          THE NO. OF TICK AND DECADE MARKS CAN THEN BE CALCULATED.
C
    6 NDECS= IDEC2-IDEC1
      IF (NDECS.GT.20) GO TO 901
      NTICKS= 9*NDECS+(ITIK2-ITIK1)+1
      IF (ITIK1.EQ.1) NDECS= NDECS+1
C
C          THE NO. OF CHARS. IN THE ANNOTATION FORMAT IS FOUND
C          WHEN THE VALUES WILL BE PRINTED IN NON-EXPONENT FORM.
C
      NCHARS= 2
      IF (NTICKS.GT.10)   GO TO 7
      NCHARS= IDEC2+2
      IF (IDEC1.GE.0)     GO TO 7
      NCHARS= 3-IDEC1
      IF (IDEC1.EQ.IDEC2) GO TO 7
      NCHARS= NCHARS+1
C
C          ONCE THE VALUES HAVE BEEN FOUND, THEY ARE PLACED
C          INTO THE APPROPRIATE VARIABLES IN THE COMMON BLOCK.
C
    7 IF (IABS(KAXIS).EQ.2) GO TO 8
      KTYPEX= 2
      NTIKLX= ITIK1
      NSKIPX= IDEC1
      NTIKHX= NTICKS
      NDECSX= NDECS
      DIVLX= AXSIGN
      NCHRSX= NCHARS
      RETURN
C
    8 KTYPEY= 2
      NTIKLY= ITIK1
      NSKIPY= IDEC1
      NTIKHY= NTICKS
      NDECSY= NDECS
      DIVLY= AXSIGN
      NCHRSY= NCHARS
      RETURN
C
C          IF MORE THAN 20 CYCLES IS NECESSARY, AN ERROR
C          MESSAGE IS PRINTED AND THE MARKING IS SUPPRESSED.
C
  901 NUMERR= 32
      IF (ERRON) CALL G0ERMS
      IF (IABS(KAXIS).EQ.1) NTIKHX= 0
      IF (IABS(KAXIS).EQ.2) NTIKHY= 0
      RETURN
      END
