home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / maths / pgplot_1 / SYS_ARC / f77 / GRsyxd < prev    next >
Text File  |  1996-01-02  |  4KB  |  102 lines

  1. C*GRSYXD -- obtain the polyline representation of a given symbol
  2. C+
  3.       SUBROUTINE GRSYXD (SYMBOL, XYGRID, UNUSED)
  4.       INTEGER SYMBOL
  5.       INTEGER XYGRID(300)
  6.       LOGICAL UNUSED
  7. C
  8. C February 1994: INTEGER*2 removed to allow compilation on the Acorn
  9. C                Archimedes compiler where this is not allowed.
  10. C                Here an INTEGER FUNCTION BUFFER(INDEX) unpacks the 
  11. C                16-bit word from the INTEGER*4 array BUFFPK(13500)
  12. C                rather than the INTEGER*2 BUFFER(27000) of 
  13. C                the original code.
  14. C                                   D.J. Crennell (Fortran Friends)
  15. C
  16. C Return the digitization coordinates of a character. Each character is
  17. C defined on a grid with X and Y coordinates in the range (-49,49), 
  18. C with the origin (0,0) at the center of the character.  The coordinate
  19. C system is right-handed, with X positive to the right, and Y positive
  20. C upward.  
  21. C
  22. C Arguments:
  23. C  SYMBOL (input)  : symbol number in range (1..3000).
  24. C  XYGRID (output) : height range, width range, and pairs of (x,y)
  25. C                    coordinates returned.  Height range = (XYGRID(1),
  26. C                    XYGRID(3)).  Width range = (XYGRID(4),XYGRID(5)).
  27. C                    (X,Y) = (XYGRID(K),XYGRID(K+1)) (K=6,8,...).
  28. C  UNUSED (output) : receives .TRUE. if SYMBOL is an unused symbol
  29. C                    number. A character of normal height and zero width
  30. C                    is returned. Receives .FALSE. if SYMBOL is a 
  31. C                    valid symbol number.
  32. C The height range consists of 3 values: (minimum Y, baseline Y,
  33. C maximum Y).  The first is reached by descenders on lower-case g, p,
  34. C q, and y.  The second is the bottom of upper-case letters.  The third
  35. C is the top of upper-case letters.  A coordinate pair (-64,0) requests
  36. C a pen raise, and a pair (-64,-64) terminates the coordinate list. It
  37. C is assumed that movement to the first coordinate position will be
  38. C done with the pen raised - no raise command is explicitly included to
  39. C do this. 
  40. C--
  41. C  7-Mar-1983.
  42. C 15-Dec-1988 - standardize.
  43. C-----------------------------------------------------------------------
  44.       INTEGER      BUFFPK(13500),BUFFER
  45.       INTEGER      INDEX(3000), IX, IY, K, L, LOCBUF
  46.       INTEGER      NC1, NC2
  47.       COMMON       /GRSYMB/ NC1, NC2, INDEX, BUFFPK
  48. C
  49. C Extract digitization.
  50. C
  51.       IF (SYMBOL.LT.NC1 .OR. SYMBOL.GT.NC2) GOTO 3000
  52.       L = SYMBOL - NC1 + 1
  53.       LOCBUF = INDEX(L)
  54.       IF (LOCBUF .EQ. 0) GOTO 3000
  55.       XYGRID(1) = BUFFER(LOCBUF)
  56.       LOCBUF = LOCBUF + 1
  57.       K = 2
  58.       IY = -1
  59. C     -- DO WHILE (IY.NE.-64)
  60.   100 IF (IY.NE.-64) THEN
  61.           IX = BUFFER(LOCBUF)/128
  62.           IY = BUFFER(LOCBUF) - 128*IX - 64
  63.           XYGRID(K) = IX - 64
  64.           XYGRID(K+1) = IY
  65.           K = K + 2
  66.           LOCBUF = LOCBUF + 1
  67.       GOTO 100
  68.       END IF
  69. C     -- end DO WHILE
  70.       UNUSED = .FALSE.
  71.       RETURN
  72. C
  73. C Unimplemented character.
  74. C
  75. 3000  XYGRID(1) = -16
  76.       XYGRID(2) =  -9
  77.       XYGRID(3) = +12
  78.       XYGRID(4) =   0
  79.       XYGRID(5) =   0
  80.       XYGRID(6) = -64
  81.       XYGRID(7) = -64
  82.       UNUSED = .TRUE.
  83.       RETURN
  84.       END
  85. C
  86.       INTEGER FUNCTION BUFFER(K)
  87.       INTEGER      BUFFPK(13500), INDEX(3000)
  88.       COMMON       /GRSYMB/ NC1, NC2, INDEX, BUFFPK
  89.       LOGICAL BTEST
  90. C           unpack buffer as INTEGER*2 from BUFFPK
  91.       K1 = ISHFT(K+1,-1)
  92.       IF(K1+K1 .EQ. K) THEN
  93.         BUFFER = ISHFT(BUFFPK(K1),-16)
  94.       ELSE
  95.         BUFFER = IAND(BUFFPK(K1),65535)
  96.       ENDIF
  97. C               correct for negative word
  98.       IF(BTEST(BUFFER,15)) BUFFER = IOR(BUFFER, ?IFFFF0000)
  99.       RETURN
  100.       END
  101.