h09487
s 00089/00000/00000
d D 1.1 83/03/17 15:47:23 tes 1 0
c date and time created 83/03/17 15:47:23 by tes
e
u
4
U
t
T
I 1
subroutine da40xx (rlin)
########################################################################
#                                                                      #
#          THIS MATERIAL IS CONFIDENTIAL AND IS FURNISHED UNDER        #
#          A WRITTEN LICENSE AGREEMENT.  IT MAY NOT BE USED,           #
#          COPIED OR DISCLOSED TO OTHERS EXCEPT IN ACCORDANCE          #
#          WITH THE TERMS OF THAT AGREEMENT.                           #
#                                                                      #
#          COPYRIGHT (C) 1982 GRAPHIC SOFTWARE SYSTEMS INC.            #
#          ALL RIGHTS RESERVED.                                        #
#                                                                      #
#     Function: GSS-CORE device driver dash emulation for 40xx devices #
#                                                                      #
#     Input Parameters:                                                #
#            rlin    -     Array of real input parameters              #
#                                                                      #
#     Output Parameters: none                                          #
#                                                                      #
#     Routines Called:                                                 #
#             dr40xx - do a move/draw                                  #
#                                                                      #
########################################################################
#local defines
define(`DASHxINCREMENT',`15.98')
 
real rlin(1)
 
integer actary(16), action, j, k, kk, opcode
real dx, dy, dxinc, dyinc, dr, plngth, pinc, p, p1(2), x, y
 
include(`ddcom')
 
# The following equivalence statements are used to decrease the amount of code
#    necessary to access specific array elements. The arrays and the
#    variables equivalenced are listed below:
#
#       p1(1) :: x
#       p1(2) :: y
 
equivalence (p1(1), x), (p1(2), y)
 
 
#action definitions for line styles 2-5: 0=move, 1=draw, 2=point
data actary / 2, 2, 2, 2,  2, 0, 1, 2,  0, 1, 0, 1,  0, 1, 1, 0 /
 
   dx = rlin(1) - zdxpos   # determine the distance from the current position
   dy = rlin(2) - zdypos
   dr = sqrt(dx**2 + dy**2)
   dxinc = (dx/dr)*DASHxINCREMENT / zdlgax   #normalize dx and dy
   dyinc = (dy/dr)*DASHxINCREMENT / zdlgax  #   and scale to incremental value
   plngth = abs(dy)
   pinc = abs(dyinc)
   if (abs(dx) > abs(dy)) {
      plngth = abs(dx)
      pinc = abs(dxinc)
      }
   # p1(1)
   x = zdxpos
   # p1(2)
   y  = zdypos
   j = 0
   k = (ndlntp-2)*4 + 1
   for (p=0.0; p<=plngth; p=p+pinc) {
      if (j > 3) {
         j = 0
         call gdevot (NEWLINE)   #flush output buffer
         }
      kk = k + j
      action = actary(kk)
      if (action == 0)      { opcode = MOVE }
      else if (action == 1) { opcode = DRAW }
      else {
         call dr40xx (MOVE, p1)
         opcode = DRAW
         }
      call dr40xx (opcode, p1)
      # p1(1) = p(1) + dxinc
      x = x + dxinc
      # p1(2) = p1(2) + dyinc
      y = y + dyinc
      j = j + 1
      }
   if (j > 3) j = 0
   kk = k + j
   if (actary(kk) == 1) { call dr40xx (DRAW, rlin) }
   else                 { call dr40xx (MOVE, rlin) }  # Insure that we are at
                                                      #    the end point.
   return
end
E 1
