      SUBROUTINE SYMBOL( X,Y,HT,IBCD,TH,NS )
C
C
C     DIT IS DE MICROSOFT FORTRAN VERSIE VAN DE CALCOMP ROUTINES.
C     DE KLEINE LETTERS WORDEN AFGEBEELD OP DE GROTE.
C 
      BYTE ITEM 
      INTEGER XPOS,XNEG,YPOS,YNEG,PEN1D,PEN2D,PENUP,PEND, 
     +   REPT,DIFF,UNTT,ACCT,TIME 
C 
      DIMENSION INDEX(79) 
      BYTE IBCD(1), KTAB(648) 
      BYTE KT1(135),KT2(135),KT3(135),KT4(135),KT5(108) 
      EQUIVALENCE (KT1(1),KTAB(1)), (KT2(1),KTAB(136)), 
     +   (KT3(1),KTAB(271)), (KT4(1),KTAB(406)), (KT5(1),KTAB(541)) 
C 
C 
      DATA INDEX  / 
     +    1,  2,  8, 18, 30, 43, 58, 71, 76, 81, 86, 98,104,111,114,
     +  120,123,133,139,149,163,168,178,191,197,214,227,239,252,256,
     +  262,266,278,294,304,317,326,334,342,349,360,367,374,381,388,
     +  392,398,403,414,422,435,446,459,464,471,475,481,487,493,498,
     +  503,506,511,515,518,527,540,547,555,563,571,579,586,595,603,
     +  618,632,639,644/
      DATA KT1  / 
     +    0,  5, 16, 17, 56, 18, 23,  9, 21, 23, 15, 21, 56, 37, 39,
     +   31, 37, 11,  4, 36, 56, 34,  2, 56,  9, 13, 56, 29, 25, 12,
     +    1, 25, 34, 35, 28, 12,  5, 14, 38, 56, 23, 16, 14,  0, 39,
     +   56, 22, 13,  6, 15, 22, 56, 26, 33, 24, 17, 26, 12, 34, 16,
     +    8,  1,  2, 29, 30, 23, 15,  6,  5, 32,  4, 29, 31, 23, 29,
     +    4, 24, 17, 22, 31,  4,  8, 17, 22, 15, 11, 17, 21, 19,  3,
     +   35, 19,  1, 37, 19,  5, 33,  5, 17, 21, 19,  3, 35,  6,  8,
     +   17, 18, 10,  9, 17,  2,  3, 35,  5,  8, 16, 17,  9,  8,  2,
     +    0, 39,  9, 33, 38, 31, 15,  6,  1,  8, 24, 33,  5, 14, 23/
      DATA KT2  / 
     +   16,  8, 24,  9,  5,  6, 15, 31, 38, 37,  1,  0, 32, 13,  6,
     +   15, 31, 38, 37, 28, 12, 28, 35, 33, 24,  8,  1,  4, 24, 31,
     +    2, 34,  9,  1,  8, 24, 33, 35, 28,  4,  7, 39, 12,  3, 12,
     +   28, 35, 33, 24,  8,  1,  6, 15, 31, 38,  5,  6,  7, 39, 17,
     +   16, 16, 12,  3,  1,  8, 24, 33, 35, 28, 12,  5,  6, 15, 31,
     +   38, 37, 28, 12,  1,  8, 24, 33, 38, 31, 15,  6,  4, 11, 27,
     +   36, 11,  9, 10, 18, 17,  9, 56, 12, 20, 21, 13, 12, 12,  8,
     +   17, 18, 10,  9, 17, 56, 19, 20, 12, 11, 19,  3, 33,  3, 37,
     +    5, 36,  4, 56,  2, 34,  3,  1, 35,  5, 11,  5,  6, 15, 31/
      DATA KT3  / 
     +   38, 37, 19, 18, 56, 17, 16, 15, 26, 27, 20, 11, 10, 17, 26,
     +   34, 36, 29, 13,  4,  1,  8, 24,  9,  0,  3, 35,  3,  6, 15,
     +   31, 38, 32, 12,  0,  7, 31, 38, 37, 28,  4, 28, 35, 33, 24,
     +    0,  8, 38, 31, 15,  6,  1,  8, 24, 33,  7,  0,  7, 31, 38,
     +   33, 24,  0,  7, 39,  7,  4, 28,  4,  0, 32,  6,  0,  4, 28,
     +    4,  7, 39, 10, 38, 31, 15,  6,  1,  8, 24, 33, 35, 19,  6,
     +    0,  7,  4, 36, 39, 32,  6,  8, 24, 16, 23, 15, 31,  6,  2,
     +    1,  8, 24, 33, 39,  6,  0,  7,  3, 39, 12, 32,  3,  7,  0,
     +   32,  5,  0,  7, 20, 39, 32,  4,  0,  7, 32, 39, 10, 29, 38/
      DATA KT4  / 
     +   31, 15,  6,  1,  8, 24, 33, 38,  7,  0,  7, 31, 38, 37, 28,
     +    4, 12, 33, 38, 31, 15,  6,  1,  8, 24, 33, 56, 18, 32, 10,
     +    0,  7, 31, 38, 37, 28,  4, 28, 35, 32, 12,  1,  8, 24, 33,
     +   35, 28, 12,  5,  6, 15, 31, 38,  4, 16, 23,  7, 39,  6,  7,
     +    1,  8, 24, 33, 39,  3,  7, 16, 39,  5,  7,  8, 19, 24, 39,
     +    5,  0, 39, 56,  7, 32,  5,  7, 20, 16, 20, 39,  4,  7, 39,
     +    0, 32,  4, 39, 23, 16, 32,  2,  7, 32,  4,  7, 23, 16,  0,
     +    3,  5, 23, 37,  2,  0, 32,  8, 18, 20,  4,  0, 32, 36, 20,
     +   18, 12, 18, 20, 12,  3,  1,  8, 24, 33, 35, 28, 20, 18,  6/
      DATA KT5  / 
     +   18, 20,  1, 33, 20, 18,  7, 18, 20, 16, 18,  2, 34, 18,  7,
     +   18,  0, 36, 18,  4, 32, 18,  7, 18, 20,  2, 16, 34, 20, 18,
     +    7, 18, 16, 20,  2, 34, 20, 18,  6, 18,  0, 36,  4, 32, 18,
     +    8, 18, 36,  4, 36,  0, 32,  0, 18,  7, 18,  4, 18, 16, 18,
     +   36, 18, 14, 18, 36, 27, 11,  4, 11,  9,  0,  9, 25, 32, 25,
     +   27, 18, 13, 18,  0, 36, 18, 20, 16, 18,  4, 32, 18,  2, 34,
     +   18,  6, 18, 36,  4, 32,  0, 18,  4, 18, 20, 16, 18,  4, 18,
     +    2, 34, 18/
C  NEW START POINT
      X0=X
      Y0=Y
      THETA=TH*0.017453294
      COST=COS(THETA) 
      SINT=SIN(THETA) 
C  INITIALIZATION 
      IC=3
      IB=1
C     GRID=7.0
C  -NT- IS NUMBER OF CHARACTERS 
      NT=1
      IF( NS.EQ.0 ) GOTO 100
      IF( NS.LT.0 ) GOTO 200
C   INITIALIZE FOR HOLLERITH STRING 
      NT=NS 
C     H=HT/GRID 
100   H=HT/7.0
C  UNIT IN GRID 
      XA=COST*H 
      YA=SINT*H 
C  NEXT CHARACTER 
110   IBYTE=IBCD(IB)
      IB=IB+1 
C -ICH- IS INDEX IN TABLE KTAB
      ICH=IABS(IBYTE) 
      IF( ICH.LT.32 .OR. ICH.GT.127 ) GOTO 190
      IF( ICH.GT.95 ) ICH=ICH-32
      ICH=INDEX(ICH-31) 
C  -NR- IS NUMBER OF OFFSETS
130   NR=KTAB(ICH)
      IF( NR.EQ.0 ) GOTO 190
140   ICH=ICH+1 
      IWRD=KTAB(ICH)
      IX=IWRD/8 
      IY=IWRD-8*IX
      IF( IX.NE.7 ) GOTO 160
C  NEXT MOVE WITH PEN UP
      IC=3
      GOTO 180
160   CONTINUE
      CALL PLOT(X0+IX*XA-IY*YA, Y0+IX*YA+IY*XA, IC) 
      IC=2
180   NR=NR-1 
      IF( NR.GT.0 ) GOTO 140
C  NEXT CHARACTER 
190   IC=3
      X0=X0+XA*6.0
      Y0=Y0+YA*6.0
      IF( IB.LE.NT ) GOTO 110 
      IF( NS.LT.0 ) GOTO 210
C 
      RETURN
C 
C  SPECIAL CHARACTERS 
C 
200   ICH=IBCD(1)+65
      IF( ICH.LT.65 .OR. ICH.GT.78 ) GOTO 190 
      ICH=INDEX(ICH)
      IF( NS.LT.-1 ) IC=2 
C     GRID=4.0
      H=HT/4.0
      XA=COST*H 
      YA=SINT*H 
      IB=2
      XS=(COST-SINT)*HT*0.5 
      YS=(COST+SINT)*HT*0.5 
      X0=X0-XS
      Y0=Y0-YS
      GOTO 130
C  SET X0,Y0 TO PROPER VALUES 
210   X0=X0+XS
      Y0=Y0+YS
C 
      RETURN
C 
      END 
      SUBROUTINE NUMBER(X,Y,H,FNO,THETA,IF) 
C
C X: X POSITIE
C Y: Y POSITIE
C H: MAATFACTOR
C FNO : GETAL
C THETA : ROTATIE IN GRADEN
C IF: NUL :AFRONDEN OP INTEGER
C     NEG :VERM MET 10**(IF+1)
C     POS :AANTAL POSITIES ACHTER DE KOMMA
C
C     BYTE IFORM(8),ITEMP(22) 
C NUMBER VS CALCOMP SPECIFICATIONS
C A MAXIMIUM OF 6 DIGITS AFTER THE DECIMAL POINT
C 200 IF (IF.GT.6) GOTO 300 
C     FH = ABS(FNO) 
C     IF (IF.EQ.0) FH=FH+.5 
C     IF (IF.GE.0) GOTO 210 
C CORRECT ROUNDING
C     FH=FH*(10.**(IF+1))+.5
C AT LEAST 1 DIGIT
C 210 IW=1
C     IF (FH.GE.10.) IW=IFIX(ALOG10(FH))+1
C A MAXIMUM OF 6 DIGITS BEFORE THE DECIMAL POINT
C     IF (IW.GT.6) GOTO 300 
C     IF (IF.LE.0) FH=AINT(FH)
C     FH=SIGN(1.,FNO)*FH
C FOR MINUS SIGN
C     IF (FH.LT.0.) IW=IW+1 
C FOR DECIMAL POINT 
C     ID=MAX0(1,IF) 
C     IW=IW+ID+1
C  FORMAT FIW.ID
C     ENCODE(IFORM,1000) IW,ID
C     ENCODE(ITEMP,IFORM) FH
C     IF (IF.EQ.0) IW=IW-1
C     IF (IF.LT.0) IW=IW-2
C 250 CALL SYMBOL(X,Y,H,ITEMP,THETA,IW)
C     CALL PEN(.TRUE.)
C     RETURN
C   INCORRECT FORMAT, USED IS G9.3
C300  IW=9
C     ENCODE(ITEMP,1001) FNO
C     GOTO 250
C 
C1000 FORMAT( 2H(F,I2,1H.,I2,1H) )
C1001 FORMAT( G9.3 )
      RETURN
      END 
      SUBROUTINE CGRID(NOPT, NX, SX, XS, XF, NY, SY, YS, YF)
C SUBROUTINE WHICH DRAWS A FRAME AROUND THE PLOT AND DRAWS
C EITHER TICK MARKS OR GRID LINES.
C PARAMETERS:  NOPT -- =0, DRAW TICKS ONLY
C                      =1, DRAW GRID LINES
C                      =2, DRAW GRID LINES TO EDGE OF FRAME.
C              NX -- NUMBER OF INTERVALS IN X DIRECTION
C              SX -- SPACING IN CENTIMETER BETWEEN TICK MARKS OR GRID
C                    LINES ALONG THE X AXIS
C              XS -- LOCATION OF FIRST TICK OR GRID LINE ON X AXIS
C              XF -- LOCATION OF RIGHT EDGE OF FRAME
C              NY -- NUMBER OF INTERVALS IN Y DIRECTION
C              SY -- SPACING IN CENTIMETERS BETWEEN TICK MARKS OR GRID
C                    LINES ALONG THE Y AXIS
C              YS -- LOCATION OF FIRST TICK OR GRID LINE ON Y AXIS
C              YF -- LOCATION OF TOP EDGE OF FRAME
C ASSUMPTIONS: NX, SX, NY, SY ALL POSITIVE.
C              THE LOWER LEFT-HAND CORNER OF THE FRAME IS DRAWN AT (0,0)
C              IF XS<0, USE 0; IF YS<0, USE 0
C              IF XF<=0, USE NX*SX; IF YF<=0, USE NY*SY.
C
      XINC = SX
      YINC = SY
      XMAX=NX*SX
      YMAX=NY*SY
      XLGTH=XMAX
      YLGTH=YMAX
      XMIN = 0.
      YMIN = 0.
C
C     DRAW FRAME.
C
      CALL PLOT(0., 0., 3)
      CALL PLOT(XMAX, 0., 2)
      CALL PLOT(XMAX, YMAX, 2)
      CALL PLOT(0., YMAX, 2)
      CALL PLOT(0., 0., 2)
      IF (NOPT.NE.0) GO TO 130
C
C     DRAW TICK MARKS.
C
      DO 120 J=1,4
        GO TO (10, 50, 20, 40), J
   10   X2 = 0.
        IF (XMIN.NE.0.) X2 = XMIN - SX
        Y2 = 0.
        GO TO 30
   20   XINC = -SX
        X2 = XMIN + XLGTH + SX
        IF (XMAX.EQ.XMIN+XLGTH) X2 = XMAX
        Y2 = YMAX
   30   Y1 = Y2
        Y2 = Y2 + SIGN(0.125,XINC)
        N = NX
        IF (ABS(XMAX-XMIN-XLGTH)+ABS(XMIN)) 70, 80, 70
   40   YINC = -SY
        Y2 = YMIN + YLGTH + SY
        IF (YMAX.EQ.YMIN+YLGTH) Y2 = YMAX
        X2 = 0.
        GO TO 60
   50   Y2 = 0.
        IF (YMIN.NE.0.) Y2 = YMIN - SY
        X2 = XMAX
   60   X1 = X2
        N = NY
        X2 = X2 - SIGN(0.125,YINC)
        IF (ABS(YMAX-YMIN-YLGTH)+ABS(YMIN)) 70, 80, 70
   70   N = N + 1
   80   DO 110 I=1,N
          IF (MOD(J,2).EQ.0) GO TO 90
          X2 = X2 + XINC
          X1 = X2
          GO TO 100
   90     Y2 = Y2 + YINC
          Y1 = Y2
  100     CALL PLOT(X1, Y1, 3)
          CALL PLOT(X2, Y2, 2)
  110   CONTINUE
  120 CONTINUE
      GO TO 240
C
C     DRAW GRID LINES
C
  130 X1 = XMIN
      X2 = XMIN + XLGTH
      IF (NOPT.NE.2) GO TO 140
      X1 = 0.
      X2 = XMAX
  140 Y1 = YMIN - SY
      N = NY + 1
      IF (YMAX.EQ.YMIN+YLGTH) N = N - 1
      IF (YMIN.NE.0.) GO TO 150
      Y1 = 0.
      N = N - 1
  150 IF (N.LE.0) GO TO 170
      J = 1
      DO 160 I=1,N
        J = -J
        Y1 = Y1 + SY
        CALL PLOT(X1, Y1, 3)
        CALL PLOT(X2, Y1, 2)
        XX = X1
        X1 = X2
        X2 = XX
  160 CONTINUE
  170 Y1 = YLGTH
      Y2 = YMIN
      IF (NOPT.NE.2) GO TO 180
      Y1 = YMAX
      Y2 = 0.
  180 N = NX + 1
      IF (J.LT.0) GO TO 200
      X1 = XMIN - SX
      IF (XMAX.EQ.XMIN+XLGTH) N = N - 1
      IF (XMIN.NE.0.) GO TO 190
      X1 = 0.
      N = N - 1
  190 IF (N.LE.0) GO TO 240
      XINC = SX
      GO TO 220
  200 X1 = XMIN + XLGTH + SX
      IF (XMIN.EQ.0.) N = N - 1
      IF (XMAX.NE.XLGTH+XMIN) GO TO 210
      N = N - 1
      X1 = XMAX
  210 XINC = -SX
  220 DO 230 I=1,N
        X1 = X1 + XINC
        CALL PLOT(X1, Y1, 3)
        CALL PLOT(X1, Y2, 2)
        XX = Y1
        Y1 = Y2
        Y2 = XX
  230 CONTINUE
  240 CONTINUE
      RETURN
      END





















             LINES ALONG THE X AX