home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR8 / 123EXP.ZIP / WYSIFILE.CLA < prev    next >
Text File  |  1993-07-13  |  23KB  |  454 lines

  1. wysifile    PROCEDURE(op_code)
  2. !══════════════════════════════════════════════════════════════════════════════
  3.  
  4. !   RED - 06/22/93
  5. !
  6. !   This procedure performs all of the WYSIWYG file I/O.
  7. !
  8.  
  9. !══════════════════════════════════════════════════════════════════════════════
  10. op_code         EXTERNAL
  11.  
  12.     INCLUDE('c:\cla\wysiwyg.inc')
  13.  
  14. pos         BYTE
  15. ASCIIZ      STRING(SIZE(wys:string))
  16.  
  17. atrx        BYTE    ! General use index for attr_tab_no and/or wys:attr_tab
  18. attr_no     BYTE    ! General purpose counter
  19. font_idx    BYTE    ! Index for the wyv:fonts_to_use table
  20. font_no     BYTE
  21.  
  22. !──────────────────────────────────────────────────────────────────────────────
  23.     CODE
  24.  
  25.     CASE op_code                ! Perform the requested function
  26.     OF wyf:row_end_lump         ! Test first - performed most often
  27.         DO row_end_lump
  28.     OF wyf:write_clustr
  29.         DO write_clustr
  30.     OF wyf:setup
  31.         DO setup_file
  32.     OF wyf:std_init
  33.         DO std_init
  34.     OF wyf:std_attr
  35.         DO std_attr
  36.     OF wyf:first_clustr
  37.         DO first_clustr
  38.     OF wyf:flush_clustr
  39.         DO flush_clustr
  40.     OF wyf:prt_settings
  41.         DO prt_settings
  42.     OF wyf:eof
  43.         DO close_file
  44.     ELSE
  45.         err_msg(op_code & ' is an invalid WYSIFILE op-code!')
  46.         mem:status = false
  47.         RETURN
  48.     .
  49.     mem:status = true
  50.     RETURN
  51.  
  52. !──Routines────────────────────────────────────────────────────────────────────────────
  53.  
  54. setup_file  ROUTINE
  55.     pos = INSTRING('.WK1',wyv:filename,1) - 1       ! Format the name from
  56.     IF pos < 2                                      !   the spreadsheet
  57.         err_msg('Invalid WYSIWYG filename format.') !   filename. wys_filename
  58.         mem:status = false                          !   should start out equal
  59.         RETURN                                      !   to the spreadsheet
  60.     .                                               !   filename.
  61.     wyv:filename = RIGHT(wyv:filename,pos) & '.FMT'
  62.  
  63.     CREATE(wys_file)                ! Create (or re-create) the WYSIWYG file.
  64.     IF ERRORCODE()
  65.         err_msg('Unable to create the WYSIWYG format file.')
  66.         mem:status = false
  67.         RETURN
  68.     .
  69.     CLEAR(wys:record)               ! Initialize the spreadsheet record
  70.     wys:opcode   = wyf:bof          ! BOF op code
  71.     wys:version1 = wys_version1     ! Set to FMT 2
  72.     wys:version2 = wys_version2     !   version file
  73.     wys:length   = 2                ! Record size (2 bytes)
  74.     ADD(wys_file,wys:length +4)     ! Write the BOF record (length = data + op code + length)
  75.  
  76. std_init    ROUTINE     ! Write out the initial WYSIWYG records used for a
  77.                         !   standard spreadsheet.  If this function is not
  78.                         !   performed, the records generated here must be
  79.                         !   written individually by the caller using the
  80.                         !   seperate function codes and calls.
  81.     DO prt_cart_on
  82.  
  83.     ASCIIZ = ''                     ! No printer cartridges defined
  84.     wys:opcode = wyf:cartridge_1
  85.     DO write_ASCIIZ
  86.     wys:opcode = wyf:cartridge_2
  87.     DO write_ASCIIZ
  88.  
  89.     ASCIIZ = 'HP Laserjet III, IIID, and IIIP Wysiwyg'  ! Use the 123 2.3 printer name text
  90.     wys:opcode = wyf:printer_name
  91.     DO write_ASCIIZ
  92.  
  93.     CASE cfg:device                 ! Set the port according to the current
  94.     OF 'LPT1'                       !   application's setting
  95.         wys:port_code = wyp:DOS_LPT1
  96.     OF 'LPT2'
  97.         wys:port_code = wyp:DOS_LPT2
  98.     OF 'LPT3'
  99.         wys:port_code = wyp:DOS_LPT3
  100.     ELSE
  101.         wys:port_code = wyp:DOS_LPT1
  102.     .
  103.     wys:opcode = wyf:port_code
  104.     DO write_2_byte
  105.  
  106.     wys:baud   = wyb:baud_9600      ! Even though it's not used, set the
  107.     wys:opcode = wyf:baud           !   printer baud rate to 9,600.
  108.     DO write_2_byte
  109.  
  110.     ASCIIZ = 'XHPLJ3'               ! Use the 123 2.3 driver name text
  111.     wys:opcode = wyf:driver_name
  112.     DO write_ASCIIZ
  113.  
  114.     wys:line_color = rcc:black      ! Lines are black
  115.     DO line_color
  116.  
  117.     wys:color_neg  = rcc:red        ! Negative numbers are red
  118.     DO color_neg
  119.  
  120.     wys:shadow_color = rcc:black    ! Shadows are black
  121.     DO shadow_color
  122.                                     ! Generate the fonts that are used as the
  123.                                     !   standard 123 2.3 WYSIWYG fonts:
  124.                                     !   1 = HLV 12 pt       5 = TMS  8 pt
  125.                                     !   2 = HLV 14 pt       6 = TMS 10 pt
  126.                                     !   3 = HLV 24 pt       7 = TMS 12 pt
  127.     ASCIIZ = 'HLV'                  !   4 = TMS  6 pt       8 = SYM 12 pt
  128.     LOOP wys:font_number = 1 TO 3
  129.         DO font_face                ! First 3 fonts
  130.     .
  131.     ASCIIZ = 'TMS'
  132.     LOOP wys:font_number = 4 TO 7
  133.         DO font_face                ! Next 4 fonts
  134.     .
  135.     wys:font_number = 8
  136.     DO font_face                    ! Last font
  137.  
  138.     wys:opcode = wyf:font_pitch     ! Set the font PITCH size (same as the
  139.     wys:length = 16                 !   point size below)
  140.     wys:font_pitch[1] = 12
  141.     wys:font_pitch[2] = 14
  142.     wys:font_pitch[3] = 24
  143.     wys:font_pitch[4] =  6
  144.     wys:font_pitch[5] =  8
  145.     wys:font_pitch[6] = 10
  146.     wys:font_pitch[7] = 12
  147.     wys:font_pitch[8] = 12
  148.     ADD(wys_file,wys:length +4)
  149.  
  150.     wys:opcode = wyf:font_type      ! Set the font types
  151.     wys:length = 16
  152.     wys:font_type[1] = wft:helv
  153.     wys:font_type[2] = wft:helv
  154.     wys:font_type[3] = wft:helv
  155.     wys:font_type[4] = wft:TMS
  156.     wys:font_type[5] = wft:TMS
  157.     wys:font_type[6] = wft:TMS
  158.     wys:font_type[7] = wft:TMS
  159.     wys:font_type[8] = wft:symbol
  160.     ADD(wys_file,wys:length +4)
  161.  
  162.     wys:opcode = wyf:font_points    ! Set the font POINT sizes
  163.     wys:length = 16
  164.     wys:font_points[1] = 12
  165.     wys:font_points[2] = 14
  166.     wys:font_points[3] = 24
  167.     wys:font_points[4] =  6
  168.     wys:font_points[5] =  8
  169.     wys:font_points[6] = 10
  170.     wys:font_points[7] = 12
  171.     wys:font_points[8] = 12
  172.     ADD(wys_file,wys:length +4)
  173.  
  174. !──────────────────────────────────────────────────────────────────────────────
  175. std_attr    ROUTINE ! Create a standard attrbute record for the fonts listed
  176.                     !   in wys:fonts_to_use.
  177.     CLEAR(wys:attr_tab)             ! Clear the attribute table record area
  178.     CLEAR(attr_tab_nos)             ! Clear the attribute number assignments
  179.  
  180.     attr_no = 17                    ! Set to 1st available user-defined attribute
  181.  
  182.     LOOP font_idx = 1 TO MAXIMUM(wyv:font_to_use[],1)
  183.         font_no = wyv:font_to_use[font_idx]
  184.         IF font_no = 0
  185.             BREAK
  186.         .
  187.         LOOP atrx = 1 TO MAXIMUM(wat:attr_tab_no[],2)   ! Build the list of attribute
  188.             wat:attr_tab_no[font_no,atrx] = attr_no     !   table number assignments to
  189.             attr_no += 1                                !   be used for the font.
  190.     .   .
  191.  
  192.     wys:length = (attr_no - 1) * 4  ! Compute the required record length (the
  193.                                     !   highest entry used in the table times
  194.                                     !   4 bytes per entry)
  195.  
  196.     ! Build the attribute table in the WYSIWYG record using the table#
  197.     !   assignments generated above.  Do it once for each of the fonts to use.
  198.  
  199.     LOOP font_idx = 1 TO MAXIMUM(wyv:font_to_use[],1)
  200.         font_no = wyv:font_to_use[font_idx]
  201.         IF font_no = 0
  202.             BREAK
  203.         .
  204.         wys:char_attr[wat:no_attr  [font_no] ] = wya:use_font[font_no]  ! Set font only
  205.         wys:char_attr[wat:no_attr_t[font_no] ] = wya:use_font[font_no]  ! Set font only - in text range
  206.  
  207.         LOOP atrx = wat:n_l[font_no]  TO wat:n_lrt_db[font_no]      ! Normal
  208.             wys:char_attr[atrx] = wya:use_font[font_no]             ! Set font
  209.         .
  210.         LOOP atrx = wat:nt_l[font_no] TO wat:nt_lrt_db[font_no]     ! Normal, In text range
  211.             wys:char_attr[atrx] = wya:use_font[font_no]             ! Set font
  212.         .
  213.         LOOP atrx = wat:b[font_no]    TO wat:bs_lrt_db[font_no]     ! Set font and bold
  214.             wys:char_attr[atrx] = BOR(wya:use_font[font_no], wya:bold)
  215.         .
  216.         LOOP atrx = wat:bt[font_no]   TO wat:bts_lrt_db[font_no]    ! In text range
  217.             wys:char_attr[atrx] = BOR(wya:use_font[font_no], wya:bold)  ! Set font and bold
  218.         .
  219.         LOOP atrx = wat:bs[font_no] TO wat:bs_lrt_db[font_no]       ! Set light shading
  220.             wys:bg_attr  [atrx] = wya:light_shade
  221.         .
  222.         LOOP atrx = wat:bts[font_no] TO wat:bts_lrt_db[font_no]     ! In text range values
  223.             wys:bg_attr  [atrx] = wya:light_shade                   ! Set light shading
  224.         .
  225.         ! Setup the border attributes
  226.         wys:border_attr[wat:n_l     [font_no]] = wya:left_sngl
  227.         wys:border_attr[wat:n_r     [font_no]] = wya:right_sngl
  228.         wys:border_attr[wat:n_wt    [font_no]] = wya:top_wide
  229.         wys:border_attr[wat:n_wb    [font_no]] = wya:bottom_wide
  230.         wys:border_attr[wat:n_lr    [font_no]] = BOR(wys:border_attr[wat:n_l  [font_no]], wya:right_sngl)
  231.         wys:border_attr[wat:n_lrt   [font_no]] = BOR(wys:border_attr[wat:n_lr [font_no]], wya:top_sngl)
  232.         wys:border_attr[wat:n_lrb   [font_no]] = BOR(wys:border_attr[wat:n_lr [font_no]], wya:bottom_sngl)
  233.         wys:border_attr[wat:n_lrtb  [font_no]] = BOR(wys:border_attr[wat:n_lrb[font_no]], wya:top_sngl)
  234.         wys:border_attr[wat:n_lr_wb [font_no]] = BOR(wys:border_attr[wat:n_lr [font_no]], wya:bottom_wide)
  235.         wys:border_attr[wat:n_lr_db [font_no]] = BOR(wys:border_attr[wat:n_lr [font_no]], wya:bottom_dbl)
  236.         wys:border_attr[wat:n_lr_wt [font_no]] = BOR(wys:border_attr[wat:n_lr [font_no]], wya:top_wide)
  237.         wys:border_attr[wat:n_l_wt  [font_no]] = BOR(wys:border_attr[wat:n_l  [font_no]], wya:top_wide)
  238.         wys:border_attr[wat:n_l_wb  [font_no]] = BOR(wys:border_attr[wat:n_l  [font_no]], wya:bottom_wide)
  239.         wys:border_attr[wat:n_r_wt  [font_no]] = BOR(wys:border_attr[wat:n_r  [font_no]], wya:top_wide)
  240.         wys:border_attr[wat:n_r_wb  [font_no]] = BOR(wys:border_attr[wat:n_r  [font_no]], wya:bottom_wide)
  241.         wys:border_attr[wat:n_lrt_wb[font_no]] = BOR(wys:border_attr[wat:n_lrt[font_no]], wya:bottom_wide)
  242.         wys:border_attr[wat:n_lrt_db[font_no]] = BOR(wys:border_attr[wat:n_lrt[font_no]], wya:bottom_dbl)
  243.  
  244.         wys:border_attr[wat:b_l     [font_no]] = wya:left_sngl
  245.         wys:border_attr[wat:b_r     [font_no]] = wya:right_sngl
  246.         wys:border_attr[wat:b_lr    [font_no]] = BOR(wys:border_attr[wat:b_l  [font_no]], wya:right_sngl)
  247.         wys:border_attr[wat:b_lrt   [font_no]] = BOR(wys:border_attr[wat:b_lr [font_no]], wya:top_sngl)
  248.         wys:border_attr[wat:b_lrb   [font_no]] = BOR(wys:border_attr[wat:b_lr [font_no]], wya:bottom_sngl)
  249.         wys:border_attr[wat:b_lrtb  [font_no]] = BOR(wys:border_attr[wat:b_lrb[font_no]], wya:top_sngl)
  250.         wys:border_attr[wat:b_lr_wb [font_no]] = BOR(wys:border_attr[wat:b_lr [font_no]], wya:bottom_wide)
  251.         wys:border_attr[wat:b_lr_db [font_no]] = BOR(wys:border_attr[wat:b_lr [font_no]], wya:bottom_dbl)
  252.         wys:border_attr[wat:b_lr_wt [font_no]] = BOR(wys:border_attr[wat:b_lr [font_no]], wya:top_wide)
  253.         wys:border_attr[wat:b_l_wt  [font_no]] = BOR(wys:border_attr[wat:b_l  [font_no]], wya:top_wide)
  254.         wys:border_attr[wat:b_l_wb  [font_no]] = BOR(wys:border_attr[wat:b_l  [font_no]], wya:bottom_wide)
  255.         wys:border_attr[wat:b_r_wt  [font_no]] = BOR(wys:border_attr[wat:b_r  [font_no]], wya:top_wide)
  256.         wys:border_attr[wat:b_r_wb  [font_no]] = BOR(wys:border_attr[wat:b_r  [font_no]], wya:bottom_wide)
  257.         wys:border_attr[wat:b_lrt_wb[font_no]] = BOR(wys:border_attr[wat:b_lrt[font_no]], wya:bottom_wide)
  258.         wys:border_attr[wat:b_lrt_db[font_no]] = BOR(wys:border_attr[wat:b_lrt[font_no]], wya:bottom_dbl)
  259.  
  260.         wys:border_attr[wat:nt_l     [font_no]] = wys:border_attr[wat:n_l     [font_no]]
  261.         wys:border_attr[wat:nt_r     [font_no]] = wys:border_attr[wat:n_r     [font_no]]    ! Copy borders to "in
  262.         wys:border_attr[wat:nt_lr    [font_no]] = wys:border_attr[wat:n_lr    [font_no]]    !   in text range" areas
  263.         wys:border_attr[wat:nt_lrt   [font_no]] = wys:border_attr[wat:n_lrt   [font_no]]
  264.         wys:border_attr[wat:nt_lrb   [font_no]] = wys:border_attr[wat:n_lrb   [font_no]]
  265.         wys:border_attr[wat:nt_lrtb  [font_no]] = wys:border_attr[wat:n_lrtb  [font_no]]
  266.         wys:border_attr[wat:nt_lr_wb [font_no]] = wys:border_attr[wat:n_lr_wb [font_no]]
  267.         wys:border_attr[wat:nt_lr_db [font_no]] = wys:border_attr[wat:n_lr_db [font_no]]
  268.         wys:border_attr[wat:nt_lr_wt [font_no]] = wys:border_attr[wat:n_lr_wt [font_no]]
  269.         wys:border_attr[wat:nt_l_wt  [font_no]] = wys:border_attr[wat:n_l_wt  [font_no]]
  270.         wys:border_attr[wat:nt_l_wb  [font_no]] = wys:border_attr[wat:n_l_wb  [font_no]]
  271.         wys:border_attr[wat:nt_r_wt  [font_no]] = wys:border_attr[wat:n_r_wt  [font_no]]
  272.         wys:border_attr[wat:nt_r_wb  [font_no]] = wys:border_attr[wat:n_r_wb  [font_no]]
  273.         wys:border_attr[wat:nt_lrt_wb[font_no]] = wys:border_attr[wat:n_lrt_wb[font_no]]
  274.         wys:border_attr[wat:nt_lrt_db[font_no]] = wys:border_attr[wat:n_lrt_db[font_no]]
  275.  
  276.         wys:border_attr[wat:bt_l     [font_no]] = wys:border_attr[wat:n_l     [font_no]]
  277.         wys:border_attr[wat:bt_r     [font_no]] = wys:border_attr[wat:n_r     [font_no]]
  278.         wys:border_attr[wat:bt_lr    [font_no]] = wys:border_attr[wat:n_lr    [font_no]]
  279.         wys:border_attr[wat:bt_lrt   [font_no]] = wys:border_attr[wat:n_lrt   [font_no]]
  280.         wys:border_attr[wat:bt_lrb   [font_no]] = wys:border_attr[wat:n_lrb   [font_no]]
  281.         wys:border_attr[wat:bt_lrtb  [font_no]] = wys:border_attr[wat:n_lrtb  [font_no]]
  282.         wys:border_attr[wat:bt_lr_wb [font_no]] = wys:border_attr[wat:n_lr_wb [font_no]]
  283.         wys:border_attr[wat:bt_lr_db [font_no]] = wys:border_attr[wat:n_lr_db [font_no]]
  284.         wys:border_attr[wat:bt_lr_wt [font_no]] = wys:border_attr[wat:n_lr_wt [font_no]]
  285.         wys:border_attr[wat:bt_l_wt  [font_no]] = wys:border_attr[wat:n_l_wt  [font_no]]
  286.         wys:border_attr[wat:bt_r_wt  [font_no]] = wys:border_attr[wat:n_r_wt  [font_no]]
  287.         wys:border_attr[wat:bt_lrt_wb[font_no]] = wys:border_attr[wat:n_lrt_wb[font_no]]
  288.         wys:border_attr[wat:bt_lrt_db[font_no]] = wys:border_attr[wat:n_lrt_db[font_no]]
  289.  
  290.         wys:border_attr[wat:bs_l     [font_no]] = wys:border_attr[wat:n_l     [font_no]]
  291.         wys:border_attr[wat:bs_r     [font_no]] = wys:border_attr[wat:n_r     [font_no]]    ! Bold border attributes
  292.         wys:border_attr[wat:bs_lr    [font_no]] = wys:border_attr[wat:n_lr    [font_no]]    !   are the same as above
  293.         wys:border_attr[wat:bs_lrt   [font_no]] = wys:border_attr[wat:n_lrt   [font_no]]
  294.         wys:border_attr[wat:bs_lrb   [font_no]] = wys:border_attr[wat:n_lrb   [font_no]]
  295.         wys:border_attr[wat:bs_lrtb  [font_no]] = wys:border_attr[wat:n_lrtb  [font_no]]
  296.         wys:border_attr[wat:bs_lr_wb [font_no]] = wys:border_attr[wat:n_lr_wb [font_no]]
  297.         wys:border_attr[wat:bs_lr_db [font_no]] = wys:border_attr[wat:n_lr_db [font_no]]
  298.         wys:border_attr[wat:bs_lr_wt [font_no]] = wys:border_attr[wat:n_lr_wt [font_no]]
  299.         wys:border_attr[wat:bs_l_wt  [font_no]] = wys:border_attr[wat:n_l_wt  [font_no]]
  300.         wys:border_attr[wat:bs_l_wb  [font_no]] = wys:border_attr[wat:n_l_wb  [font_no]]
  301.         wys:border_attr[wat:bs_r_wt  [font_no]] = wys:border_attr[wat:n_r_wt  [font_no]]
  302.         wys:border_attr[wat:bs_r_wb  [font_no]] = wys:border_attr[wat:n_r_wb  [font_no]]
  303.         wys:border_attr[wat:bs_lrt_wb[font_no]] = wys:border_attr[wat:n_lrt_wb[font_no]]
  304.         wys:border_attr[wat:bs_lrt_db[font_no]] = wys:border_attr[wat:n_lrt_db[font_no]]
  305.  
  306.         wys:border_attr[wat:bts_l     [font_no]] = wys:border_attr[wat:n_l     [font_no]]
  307.         wys:border_attr[wat:bts_r     [font_no]] = wys:border_attr[wat:n_r     [font_no]]
  308.         wys:border_attr[wat:bts_lr    [font_no]] = wys:border_attr[wat:n_lr    [font_no]]
  309.         wys:border_attr[wat:bts_lrt   [font_no]] = wys:border_attr[wat:n_lrt   [font_no]]
  310.         wys:border_attr[wat:bts_lrb   [font_no]] = wys:border_attr[wat:n_lrb   [font_no]]
  311.         wys:border_attr[wat:bts_lrtb  [font_no]] = wys:border_attr[wat:n_lrtb  [font_no]]
  312.         wys:border_attr[wat:bts_lr_wb [font_no]] = wys:border_attr[wat:n_lr_wb [font_no]]
  313.         wys:border_attr[wat:bts_lr_db [font_no]] = wys:border_attr[wat:n_lr_db [font_no]]
  314.         wys:border_attr[wat:bts_lr_wt [font_no]] = wys:border_attr[wat:n_lr_wt [font_no]]
  315.         wys:border_attr[wat:bts_l_wt  [font_no]] = wys:border_attr[wat:n_l_wt  [font_no]]
  316.         wys:border_attr[wat:bts_l_wb  [font_no]] = wys:border_attr[wat:n_l_wb  [font_no]]
  317.         wys:border_attr[wat:bts_r_wt  [font_no]] = wys:border_attr[wat:n_r_wt  [font_no]]
  318.         wys:border_attr[wat:bts_r_wb  [font_no]] = wys:border_attr[wat:n_r_wb  [font_no]]
  319.         wys:border_attr[wat:bts_lrt_wb[font_no]] = wys:border_attr[wat:n_lrt_wb[font_no]]
  320.         wys:border_attr[wat:bts_lrt_db[font_no]] = wys:border_attr[wat:n_lrt_db[font_no]]
  321.  
  322.         LOOP atrx = wat:no_attr_t[font_no] TO wat:bts_lrt_db[font_no]   ! Set "in text range" flags
  323.             wys:bg_attr[atrx] = BOR(wys:bg_attr[atrx], wya:text_range)
  324.     .   .
  325.     DO write_attr
  326.  
  327.     LOOP font_idx = 1 TO MAXIMUM(wyv:font_to_use[],1)
  328.         font_no = wyv:font_to_use[font_idx]
  329.         IF font_no = 0                                  ! Adjust the global attribute
  330.             BREAK                                       !   table reference index
  331.         .                                               !   so that they are
  332.         LOOP atrx = 1 TO MAXIMUM(wat:attr_tab_no[],2)   !   relative to 0 - the way
  333.             wat:attr_tab_no[font_no,atrx] -= 1          !   1-2-3 expects them!
  334.     .   .
  335.  
  336. !──────────────────────────────────────────────────────────────────────────────
  337. ! Cluster I/O routines
  338. first_clustr    ROUTINE             ! Setup the 1st cluster record
  339.     wys:cluster_no = 0              ! # is relative to 0
  340.     DO init_clustr
  341.  
  342. flush_clustr    ROUTINE   ! Write out the final cluster record if it is pending
  343.     IF wyv:cluster_row > 1                              ! Cluster record pending?
  344.         LOOP wyv:cluster_row = wyv:cluster_row TO 16    ! Fill out the rows in the cluster
  345.             wys:row_height[wyv:cluster_row] = 14        ! Default row height
  346.             wys:row_lumps [wyv:cluster_row] = 0         ! 1 LUMP for this row (relative to 0!)
  347.  
  348.             wys:col_count [wyv:cluster_lump] = 255      ! All columns for the row
  349.             wys:attr_style[wyv:cluster_lump] = 0        ! Set to no attributes
  350.             wyv:cluster_lump += 1
  351.         .
  352.         DO write_clustr
  353.     .
  354.  
  355. row_end_lump    ROUTINE     ! Setup the last lump for the row with no attributes
  356.                             !   for the remaining (empty) columns and "write"
  357.                             !   the cluster.
  358.     wys:attr_style[wyv:cluster_lump] = 0
  359.     wyv:cluster_lump += 1
  360.  
  361.     DO write_clustr
  362.  
  363. write_clustr    ROUTINE     ! Write out the cluster if it is full (16 rows).
  364.     IF wyv:cluster_row > 15             ! Is the cluster full?
  365.         wys:opcode = wyf:cluster_info
  366.         wys:length = 51 + (wyv:cluster_lump * 2) - 1    ! Base record size is 51 bytes plus
  367.                                                     !   the number of LUMPs defined
  368.         ADD(wys_file,wys:length +4)     ! Write out the record
  369.  
  370.         DO init_clustr
  371.         wys:cluster_no += 1             ! Set the next cluster number
  372.     ELSE
  373.         wyv:cluster_row += 1            ! Not full - just increment the row#
  374.     .
  375.  
  376. init_clustr     ROUTINE             ! Initialize the WYSIWYG cluster record
  377.     CLEAR(wys:cluster_rec)
  378.  
  379.     wyv:cluster_row  = 1            ! Init the cluster's row count
  380.     wyv:cluster_lump = 1            ! Init the cluster record's lump count
  381.  
  382. !──────────────────────────────────────────────────────────────────────────────
  383. write_attr  ROUTINE ! Write out the attribute table record. wys:length must
  384.                     !   be computed by the caller!
  385.     wys:opcode = wyf:attr_tab
  386.  
  387.     ADD(wys_file,wys:length +4)     ! Write out the record
  388.  
  389. !──────────────────────────────────────────────────────────────────────────────
  390. prt_settings    ROUTINE ! Write out the print settings record.  The caller must
  391.                         !   initialize the settings record and move the settings
  392.                         !   directly into the WYSIWYG record.
  393.                         ! Be sure to write out any pending cluster_info record
  394.                         !   BEFORE this function is performed!
  395.  
  396.     IF wys:copies = 0               ! Be sure the defaults are set.  The
  397.         wys:copies = 1              !   FMT file will not load if
  398.     .                               !   these values are not supplied.
  399.     IF wys:compression = 0
  400.         wys:compression = 100
  401.     .
  402.  
  403.     wys:opcode = wyf:prt_settings
  404.     wys:length = 79                 ! Simply write a standard
  405.     ADD(wys_file,wys:length +4)     !   print settings record
  406.  
  407. close_file  ROUTINE
  408.     DO flush_clustr                 ! Write out any pending cluster_info record, if needed
  409.  
  410.     wys:opcode   = wyf:eof          ! EOF op code
  411.     wys:length   = 2                ! Record size (2 bytes)
  412.     ADD(wys_file,wys:length)        ! Write the EOF record
  413.  
  414.     CLOSE(wys_file)                 ! Close the file
  415.  
  416. !──Standard Record I/O routines────────────────────────────────────────────────────────
  417.  
  418. prt_cart_on ROUTINE                 ! Write out the printer cartridge
  419.     wys:prt_cart = true             !   flag record with the flag set
  420.     wys:opcode = wyf:prt_cart       !   to "yes" (on).
  421.     DO write_1_byte
  422.  
  423. line_color  ROUTINE                 ! Write out the Line Color Record
  424.     wys:opcode   = wyf:line_color
  425.     DO write_1_byte
  426.  
  427. color_neg   ROUTINE                 ! Write out the Negative color record
  428.     wys:opcode   = wyf:color_neg
  429.     DO write_1_byte
  430.  
  431. shadow_color    ROUTINE             ! Write out the Shadow color record
  432.     wys:opcode   = wyf:shadow_color
  433.     DO write_1_byte
  434.  
  435. font_face       ROUTINE             ! Write out a font face record (text name
  436.     wys:opcode    = wyf:font_face   !   in ASCIIZ and wys:number should be set)
  437.     wys:font_name = CLIP(ASCIIZ) & '<00>'
  438.     wys:length    = LEN(CLIP(wys:font_name)) + 1    ! Record size = the size of name plus 1 byte for the font number
  439.     ADD(wys_file,wys:length +4)
  440.  
  441. write_1_byte    ROUTINE             ! Write out a 1-byte record
  442.     wys:length   = 1
  443.     ADD(wys_file,5)
  444.  
  445. write_2_byte    ROUTINE             ! Write out a 2-byte record
  446.     wys:length   = 2
  447.     ADD(wys_file,6)
  448.  
  449. write_ASCIIZ    ROUTINE             ! Write out a variable ASCIIZ record
  450.     wys:string  = CLIP(ASCIIZ) & '<00>'     ! Add the null terminator (using only '' doesn't work)
  451.     wys:length  = LEN(CLIP(wys:string))     ! Record size = the size of the
  452.                                             !   string (with the null terminator!)
  453.     ADD(wys_file,wys:length +4)
  454.