! EDREVIEW - The EDWIN PDF reviewing routine

!############################################################################
!#                                                                          #
!#  This is a module from the EDWIN Graphics Package, which was developed   #
!#  in the Department of Computer Science, at Edinburgh University, from    #
!#  1978 to the present day, release 5 of EDWIN in October 1984.            #
!#                                                                          #
!#  The principal author of the EDWIN Graphics Package was J Gordon Hughes, #
!#  while working for the Edinburgh University Computer Sceince Department. #
!#  Parts of EDWIN have been produced by many different people, too many    #
!#  too mention, working for different departments of Edinburgh and Leeds   #
!#  Universities.                                                           #
!#                                                                          #
!#  This module is regarded as being in the public domain, and the authors  #
!#  and accept no responsibility regarding the uses to which the software   #
!#  will be put.                                                            #
!#                                                                          #
!############################################################################

from Edwin include iprocs
from Edwin include icodes
from Edwin include types
from Edwin include specs
from Edwin include shapes

external routine REVIEW alias "EDWIN_REVIEW"
   integer WORD, CODE, R, X, Y, Z, P, XL, YB, XR, YT, ACTION, WX, WY
   switch C (0:15)

   Action = False
   cycle
      READ (WORD)
      CODE = WORD&15
      if CODE<=5 start;    !Draw, Move, Point
          READ(X)
          if WORD&16=0 start;   !Long form
              READ(Y)
          finishelse start
              Y=X&255; X=X>>8&255
              X=X!!(¬255) if X&128#0
              Y=Y!!(¬255) if Y&128#0
          finish
    finish
    ->C(CODE)

C(0): LINE ABS (X, Y)
      continue

C(1): MOVE ABS (X, Y)
      continue

C(2): MARKER ABS (WORD>>12&15, X, Y)
      Action = True
      continue

C(3): LINE REL (X, Y)
      Action = True
      continue

C(4): MOVE REL (X, Y)
      continue

C(5): MARKER REL (WORD>>12&15, X, Y)
      Action = True
      continue

C(6): ! Polygons
      READ (X)
      begin
         record (POINTFM) array P (1:X)
         integer I
         for I = 1, 1, X cycle
              READ (P(I)_X);   READ (P(I)_Y)
         repeat
         Polygon (X, P)
      end
      continue

C(8): ! SET new WINDOW
      READ(XL);  READ(XR);  READ(CODE);  READ (YB);  READ (YT)
      WINDOW (XL, XR, YB, YT)
      continue

C(9): ! Character
      Character (Word >> 4)
      Action = true
      continue

C(11): ! Newframe
       return if Action = true
       continue

C(12): ! Terminate
       return

C(13): ! Rectangle
       READ (WX);   READ (WY);   READ (WORD);  READ (X);   READ (Y)
       RECTANGLE (WX, WY, X, Y)
       continue

C(14): !Circle
       READ (X)
       Circle (X)
       continue

C(15): ! New attribute setting.
C(10): if CODE=10 then X=WORD>>4&255 else READ(X)
       Y = WORD >> 12 & 15
       if Y=15 start
           ASPECT RATIOING (X)
       else
           if CODE = 10 start
               PDF INSERT ((Y <<8 ! X) << 4 ! Pdf attribute, 0, 0)
           else
               PDF INSERT (Y << 12 ! Pdf gen attrib, X, 0)
           finish
           SET ATTRIBUTE (Y, X)
       finish
  repeat

C(*): signal 14, 5
end

end of file