h29529
s 00537/00000/00000
d D 1.1 83/03/17 15:49:33 tes 1 0
c date and time created 83/03/17 15:49:33 by tes
e
u
4
U
t
T
I 1
#-h-  ddw636.c            local   03/24/82  11:21
#-h-  ddw636.rat          local   03/24/82  11:21
subroutine ddw636 (contrl, intin, rlin, intout, rlout)
########################################################################
#                                                                      #
#          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 for WATANABE WX4636 ten pen     #
#               plotter                                                #
#                                                                      #
#     Input Parameters:                                                #
#            contrl(1-3) - An integer array with following information #
#                          contrl(1) - opcode for driver function      #
#                          contrl(2) - length of integer array intin   #
#                          contrl(3) - length of real input array rlin #
#                                                                      #
#            intin   -     Array of integer input parameters           #
#                                                                      #
#            rlin    -     Array of real input parameters              #
#                                                                      #
#     Output Parameters:                                               #
#            contrl(4-6) - contrl(4) - length of integer array intout  #
#                          contrl(5) - length of integer array rlout   #
#                          contrl(6) - count of any other control parms#
#                                                                      #
#            rlout  -     Array of integer output parameters           #
#                                                                      #
#     Routines Called:                                                 #
#            drw636 - move/draw for Watanabe plotter                   #
#            dpw636 - change pens for Watanabe plotter                 #
#            gdevot - put a character to device                        #
#            gdstot - convert a binary integer to a character string   #
#            gimnmx - function to range check an integer parameter     #
#                                                                      #
########################################################################
include mgsdef
 
# local defines
define(X_LIMITS_WAT4636,3810.)             #plotter surface width
define(Y_LIMITS_WAT4636,2540.)             #plotter surface height
define(NDC_TO_WAT4636,.0002624)   # Conversion from ndc to watanabe space
 
integer contrl(1),intin(1),intout(1)
real rlin(1),rlout(1)
 
integer opcode, i, length, icnvt(4), gimnmx,
        setup(12), txsize(2), mrkout(5),
        lstyle(3), kstyle, makfil(3),
        makbox(3), endbox(5), barang(7), barspc(7), xcnvt(4), ycnvt(4),
        line(24), tries, ginok, istop,
        txtcap, lstcap, clrcap, tszcap, mrkcap, trtcap, bflcap,
        gincap, fntcap
 
real chrwid, chrhgt, rtemp, x1, x2, y1, y2, hlfsiz, fulsiz
 
include mgscom
 
# 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:
#
#       devcap(TEXT_CAP)         :: txtcap
#       devcap(LINESTYLE_CAP)    :: lstcap
#       devcap(COLOR_CAP)        :: clrcap
#       devcap(TEXT_SIZE_CAP)    :: tszcap
#       devcap(MARKER_CAP)       :: mrkcap
#       devcap(TEXT_ROT_CAP)     :: trtcap
#       devcap(BAR_FILL_CAP)     :: bflcap
#       devcap(GIN_CAP)          :: gincap
#       devcap(FONT_CAP)         :: fntcap
#
#       lstyle(2) :: kstyle
#
#
equivalence (devcap(TEXT_CAP), txtcap), (devcap(LINESTYLE_CAP), lstcap),
            (devcap(COLOR_CAP), clrcap), (devcap(TEXT_SIZE_CAP), tszcap),
            (devcap(MARKER_CAP), mrkcap), (devcap(TEXT_ROT_CAP), trtcap),
            (devcap(BAR_FILL_CAP), bflcap), (devcap(GIN_CAP),gincap),
            (devcap(FONT_CAP), fntcap), (lstyle(2), kstyle)
 
#    The watanabe WX4636 defines characters by using a base cell of 30 units
#    square. The character height is 30 units and width is 17 with an inter-
#    character gap of 13 units. There is no interline gap specified. We will
#    add 10% to the height to obtain an interline gap.
 
#    chrwid = 30./X_LIMITS_WAT4636
data chrwid /0.007874/
 
# chrhgt = (30.+3.)/X_LIMITS_WAT4636
data chrhgt /0.0086614/
 
# fulsiz = default character size
data fulsiz /0.015748/
 
# hlfsiz = 2. / default character size (half width/height of marker)
data hlfsiz /0.007874/
 
#            Marker output /S 6 0 , N /
data mrkout /BIGS, DIG6, DIG0, COMMA, BIGN/
 
#            Line style /L 0 ,/
data lstyle /BIGL, 0, COMMA/
 
#            text size , text space / , Q /
data txsize /COMMA, BIGQ/
 
#            Create a box   / % 1 , /
data makbox / PERCENT, DIG1, COMMA/
 
#            Create a filled area  / % 2 , /
data makfil / PERCENT, DIG2, COMMA/
 
#            End the box  / , 0 , 0 ,/
data endbox / COMMA, DIG0, COMMA, DIG0, COMMA/
 
#     Table to specify the angle of the fills inside a bar in .1 increments
data barang / 0, 900, 0, 450, 1350, 300, 1200/
 
#     Table to specify the distance between lines of a bar
data barspc / 1, 20, 20, 20, 20, 10, 10/
 
#            Set up the plotter
#                 Set the command terminator:  = <cr> <cr>
#                 Do an alpha reset:           A
#                 Set solid line pattern and default scale:
#                                              L 0 , B 5 0,
#                 Move to home:                H
data setup  / EQUALS, CR, CR, BIGA, BIGL, DIG0, COMMA, BIGB, DIG5,
              DIG0, COMMA, BIGH /
 
 
opcode=contrl(OPCODE)
 
#
#  opcode move and draw
#
if  ((opcode == DRAW) | (opcode == MOVE)) {
 
   if (opcode == DRAW & ndclrp ~= ndclrl)  {
      i = ndclrl
      call dpw636 (i)
      }
 
   call drw636 (opcode, rlin)
   }
 
#
#  opcode text
#
else if (opcode == TEXT) {
 
      if (ndclrp ~= ndclrt)  {
           i = ndclrt
           call dpw636 (i)
           }
      call gdevot (BIGP)                # text command
      i = contrl(INTEGER_IN_LENGTH)
      call gdstot (i, intin)
      call gdevot (CR)                  # terminate string
      call gdevot (NEWLINE)
      }
 
#
#  opcode marker
#
else if (opcode == MARKER) {
 
      # clip marker to device limits
      x1 = rlin(1) - hlfsiz
      x2 = x1 + fulsiz
      y1 = rlin(2) - hlfsiz
      y2 = y1 + fulsiz
      if ((amin1(x1,y1) < 0.0) | (x2 > zdxlng) | (y2 > zdylng)) return
 
      if (ndclrp ~= ndclrm)   {
           i = ndclrm
           call dpw636 (i)
           }
 
      intout(1) = gimnmx (intin(1), 1, 15)  # Map marker 1-15 into device 1-15
 
      # set text scale for marker, we use size 60
      call gdstot ( 5, mrkout)
      length = itoch (intout(1), icnvt, 2, ierror)
      call gdstot (length, icnvt)
      call gdevot (COMMA)
 
      # restore the correct character size
      length = itoch (ndtxsz, icnvt, 4, ierror)
 
      call gdevot (BIGS)
      call gdstot (length, icnvt)
      call gdevot (COMMA)
      }
 
#
#  opcode bar fill
#
else if  (opcode == BAR_FILL) {
 
   if (ndclrp ~= ndclrl)  {
      i = ndclrl
      call dpw636 (i)
      }
   call drw636 (MOVE, rlin)
 
   #  Convert x point to a string
   i = (rlin(3)-rlin(1)) / NDC_TO_WAT4636
   lenx = itoch (i, xcnvt, 4, ierror)
 
   #  Convert y point to a string
   i = (rlin(4)-rlin(2)) / NDC_TO_WAT4636
   leny = itoch (i, ycnvt, 4, ierror)
 
   if (ndclrf > 0 )   {  # The bar is to be filled
      # Put out the cross hatching
      call gdstot (3, makfil)
      call gdstot (lenx, xcnvt)
      call gdevot (COMMA)
      call gdstot (leny, ycnvt)
      call gdevot (COMMA)
      length = itoch (barspc(ndclrf), icnvt, 2, ierror)
      call gdstot (length, icnvt)
      call gdevot (COMMA)
      if (ndclrf == 1)  {  # Use a solid fill
         #  Detemine which is the long axis and fill along that one
         if (rlin(4)-rlin(2) > rlin(3)-rlin(1))   {  barang(1) = 900  }
         else                                     {  barang(1) = 0    }
         }
      length = itoch (barang(ndclrf), icnvt, 4, ierror)
      call gdstot (length, icnvt)
      call gdevot (COMMA)
      call drw636 (MOVE, rlin)  # Need to move back to the lower left corner
      }
   # Now do the outline ( This will help any bleeding that may result)
   call gdstot (3, makbox)
   call gdstot (lenx, xcnvt)
   call gdevot (COMMA)
   call gdstot (leny, ycnvt)
   call gdstot (5, endbox)
   }
 
#
#  opcode set fill color
#
else if (opcode == SET_FILL_COLOR) {
   ndclrf = gimnmx( intin(1), 0, 7) # Emulated fill has 8 patterns
   intout(1) = ndclrf
   }
 
#
#  opcode text size
#
else if (opcode == TEXT_SIZE) {
      i = rlin(2) / NDC_TO_WAT4636 # Convert the ndc into device size
      if (i == 0)    i = 1  # Make it the smallest possible
      length = itoch (i, icnvt, 4, ierror)
 
      call gdevot (BIGS)    # The scale command
      call gdstot (length, icnvt) # What size to make it
      call gdstot (2, txsize)     # A comma and the text space command
      call gdstot (length, icnvt) # Make the space the same as the size
      call gdevot (COMMA)
 
      ndtxsz = i  # Save this size for later when restoring text sizes
 
      rlout(2) = float(i) * NDC_TO_WAT4636 *1.1  # Allow 10% interline
      rlout(1) = float(i) * NDC_TO_WAT4636  # Character cell width is height
      }
 
#
#  opcode line style
#
else if (opcode == LINESTYLE) {
      i = gimnmx (intin(1), 1, 9) - 1    # Device pattern in range (0,8)
      # lstyle(2) is kstyle
      kstyle = i + DIG0            # Set the pattern
      call gdstot (3, lstyle)
      intout(1) = i + 1               # return the line style selected
      }
 
#
#  opcode line color
#
else if (opcode == SET_LINE_COLOR) {
      ndclrl = gimnmx(intin(1), 1, 10)   # Device has 10 pen stations
      intout (1) = ndclrl          # Inform upper level of color selected
      }
 
#
#  opcode text color
#
else if (opcode == SET_TEXT_COLOR) {
      ndclrt = gimnmx(intin(1), 1, 10)   # Device has 10 pen stations
      intout (1) = ndclrt          # Inform upper level of color selected
      }
#
#  opcode marker color
#
else if (opcode == SET_MARKER_COLOR) {
      ndclrm = gimnmx(intin(1), 1, 10)   # Device has 10 pen stations
      intout (1) = ndclrm          # Inform upper level of color selected
      }
#
#  opcode text rotation
#
else if (opcode == CHAR_ROTATION) {
      # The device can rotate text in tenths of a degree
      i = amod ((rlin(1)+.05)*10.,3600.)
 
      call gdevot (BIGR)
      length = itoch (i, icnvt, 4, ierror)
      call gdstot (length, icnvt)
      call gdevot (COMMA)
 
      rlout(1) = float(i) / 10.
      }
#
#    opcode new_frame
#
else if (opcode == NEW_FRAME) {
      call gdevot (BIGH)        # Go to home position
      call dnfplt               # prompt user for new paper
      }
 
#
# opcode set_device_parameters
#
else if (opcode == SET_DEVICE_PARAMETERS) {
 
      # set up device capability array
 
      txtcap = YES   # Text capability
      lstcap = 9     # Capable of 9 different linestyles
      clrcap = 10    # Capable of 10 different colors
      tszcap = 100   # Capable of many different text sizes
      mrkcap = 15    # Capable of 15 different markers
      trtcap = 360   # Capable of 360 different text rotations
      bflcap = 8     # Capable of filling rectangles
      gincap = YES   # Capable of graphic input
      fntcap = 11    # Capable of 11 fonts
 
      # Initialize Device Driver globals
 
      zdlgax = X_LIMITS_WAT4636 # Set the length of the longest axis in device
                                #    units
      zdxlng = 1.0              # Set x and y axis lengths in NDC units
      zdylng = 0.66666666       # Y_LIMITS_WAT1/X_LIMITS_WAT1
 
      ndtxrt = 0
      ndtxsz = 100
      ndlntp = 1
      ndclrp = 0
      ndclrl = 1
      ndclrt = 1
      ndclrm = 1
      ndclrf = 0     # Do not fill the bars initially
      zdxpos = 0.0
      zdypos = 0.0
 
      # initialize plotter
 
      call gdstot (12, setup)
      }
#
#     select new font
#
else if (opcode == FONT)  {
   intout(1) = gimnmx( intin(1), 1, 11)  # Map fonts (1,11) into (0,10)
   call gdevot (DOLLAR)
   length = itoch ( intout(1)-1, icnvt, 2, ierror)
   call gdstot (length, icnvt)
   call gdevot (COMMA)
   }
 
#
#    get point
#
else if (opcode == GET_POINT)  {
   tries = 0
   repeat  {
      ginok = YES
      call gdevot (BIGC)  # Invoke gin
      call gdevot (NEWLINE)  # Flush the buffer
      call gdstin (24, line, i)
      if (i <= 22) {
         ginok = YES
         }
      tries = tries + 1
      }  until (tries >= 3 | ginok == YES)
 
   if (ginok == YES)  {
      call chtoi (line, 1, i, istop)
      rlout(1) = i / X_LIMITS_WAT4636
      call chtoi (line, 8, i, istop)
      rlout(2) = i / X_LIMITS_WAT4636
      call chtoi (line, 13, i, istop)
      intout(1) = mod(i,2) + DIG0
      contrl(4) = 1
      }
   }
 
#
#     stop graphics
#
else if (opcode == STOP_GRAPHICS) {
      call gdevot (BIGH)
      call gdevot (NEWLINE)
      }
 
#
#     inquire screen size
#
else if (opcode == INQUIRE_SCREEN_SIZE) {
      rlout(1) = zdxlng
      rlout(2) = zdylng
      rlout(3) = X_LIMITS_WAT4636
      }
 
#
#  opcode escape
#
else if (opcode == ESCAPE) {
      i = contrl(INTEGER_IN_LENGTH)
      call gdstot (i, intin)
      }
 
return
end
#-t-  ddbtur.rat          local   03/24/82  11:21
#-h-  dpw636.rat          local   03/24/82  11:21
subroutine dpw636 (color)
########################################################################
#                                                                      #
#          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 pen changer for the Watanabe    #
#               plotter                                                #
#                                                                      #
#     Input Parameters:                                                #
#            color - pen station to change to                          #
#                                                                      #
#     Output Parameters: none                                          #
#                                                                      #
#     Routines Called:                                                 #
#            gdstot - output a string to the current routine           #
#            gdevot - output a character to the current device         #
#                                                                      #
########################################################################
 
include mgsdef
 
integer color
 
integer icnvt(2), len
 
include mgscom
 
   ndclrp = color         # set the current pen color
 
   call gdevot (BIGJ)     # Change the pen
   len = itoch (color, icnvt, 2, ierror)
   call gdstot (len, icnvt)
   call gdevot (COMMA)
 
   return
end
#-t-  dpw636.rat          local   03/24/82  11:21
#-h-  drw636.rat          local   03/24/82  11:21
subroutine drw636 (opcode, 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 move / draw for Watanabe        #
#               plotter                                                #
#                                                                      #
#     Input Parameters:                                                #
#            opcode - driver function, either move/draw                #
#            rlin   - Array of real input parameters                   #
#                                                                      #
#     Output Parameters: none                                          #
#                                                                      #
#     Routines Called:                                                 #
#            gdstot - output a string to the current routine           #
#            gdevot - output a character to the current device         #
#            itoch  - convert an integer into a string of characters   #
#                                                                      #
########################################################################
 
include mgsdef
 
integer opcode
 
real rlin(1)
 
integer length, positn,xcoord,ycoord,string(4)
 
include mgscom
equivalence (xcoord, ycoord), (length, positn)
 
   positn = BIGM
   if (opcode == DRAW)  { positn = BIGD }
   call gdevot (positn)
   zdxpos = rlin(1)
   xcoord = int(zdxpos*zdlgax)
   length = itoch (xcoord, string, 4, ierror)
   call gdstot(length, string)
   call gdevot (COMMA)
   zdypos = rlin(2)
   ycoord = int (zdypos*zdlgax)
   length = itoch (ycoord,string,4,ierror)
   call gdstot (length, string)
   call gdevot (CR)
   return
end
#-t-  drw636.rat          local   03/24/82  11:21
#-t-  ddw636.c            local   03/24/82  11:21
#-h-  ddw675.c            local   03/24/82  11:21
E 1
