/*-*-ratfor,readall-*-*/ include defs:symbols.def include defs:smr.def # symbiont manager defs include defs:spooler.def # option bit settings include defs:jbcmsg.def # jobcontrol return statuses define missing_parameter 0 # a warning /************************************************************************ * spooler -- set up files to be despooled * * * * usage i = spooler (file, que, option_word, copies, form, * * page_count, priority, release_time) * * where spooler returns an integer status based on success/ * * failure of routine -- these follow the VAX * * convention so that a logical test can be * * made on spooler. Failure codes returned * * may be from RMS of JBC. (A 0 indicates that * * the file was passed in, the only parameter * * that is needed) * * file is a valid VMS file specification * * que is the name of the queue the file is placed on * * option_word is a set of bits determining which options * * one would like (SPOOLER.DEF contains the bit * * settings) * * copies is a byte containing the number of copies desired* * (if greater than one) * * form is a byte containing the form specification * * page_count is a byte containing the number of pages to * * be printed * * priority is a byte containing the priority to enter the * * job at on the queue * * release_time is a longword value containing the binary * * time for the file to be released * * note Only the "file" parameter is required. All other * * parameters will default for the queue the file is * * placed in. The default queue is SYS$PRINT * ************************************************************************/ longword function spooler (file, que, option_word, copies, form, page_count, priority, release_time) character file (180), que (16), copies, form, page_count, priority longword option_word, release_time longword get_call_arg, addr, option_index, spoolset longword length, decode_options, i, sys$sndsmb longword sys$crembx,chan, logname(2), lun, status (2), unique_name character c_deref, option_list (4), mbx_name (32) string mbx_name_seed "SPMBX" string default_que "SYS$PRINT" label status_form longword buffer_desc (2) character buffer (100) # max size of symbiont message buffer is 92 word request character queuename (16) character devname (16) word fileid (3) word dirid (3) character filename (20) character options (26) longword time # a hack for convience equivalence ( buffer ( 1), request ) equivalence ( buffer ( 3), queuename (1) ) equivalence ( buffer (19), devname (1) ) equivalence ( buffer (35), fileid (1) ) equivalence ( buffer (41), dirid (1) ) equivalence ( buffer (47), filename (1) ) equivalence ( buffer (67), options (1) ) equivalence ( buffer (68), time ) # in case a time is specified data option_list / smo$k_copies, smo$k_formtype, smo$k_pagcnt, smo$k_jobpri / request = smr$k_enter # place this file on device queue if (get_call_arg (1) == 0) { spooler = missing_parameter return } spooler = spoolset (file, devname) if (^spooler) return if (get_call_arg (2) > 0) { # is a queuename passed in? queuename (1) = length (que) # length of que name do (i = 1, queuename (1)) # move over the name queuename (i + 1) = que (i) } else { # use default queuename queuename (1) = default_que_length # length of que name do (i = 1, default_que_length) # move over the name queuename (i + 1) = default_que (i) } option_index = 1 /*------> note: because of a hack with equivalences the last arg must * be the first checked */ if (get_call_arg (8) > 0) { options (option_index) = smo$k_rlstim time = release_time option_index = option_index + 9 # step out to next slot } if (get_call_arg (3) > 0) { i = decode_options (option_word, options (option_index)) option_index = option_index + i } do (i = 1, 4) if (get_call_arg (i + 3, addr) > 0) { options (option_index) = option_list (i) options (option_index + 1) = c_deref (addr) option_index = option_index + 2 } buffer_desc (1) = 65 + option_index buffer_desc (2) = %%loc (buffer) logname (1) = unique_name (mbx_name_seed, mbx_name) logname (2) = %%loc (mbx_name) spooler = sys$crembx(, chan,,,,, logname) if (^spooler) return call lib$get_lun (lun) open (unit = lun, name = mbx_name, readonly, status = "OLD") spooler = sys$sndsmb (buffer_desc, %%val(chan)) if (^spooler) return read (unit=lun, fmt = status_form) status status_form format (2a4) close (unit = lun) call lib$free_lun (lun) call sys$dassgn (%%val(chan)) spooler = status (2) return end /************************************************************************ * decode_options -- decode the option word for spooler * * * * usage i = decode_options (option_word, options) * * where decode_options returns an integer number of options * * selected * * option_word is an integer with bits set for the * * various desired options (see the file * * SPOOLER.DEF for the bit settings) * * options is a byte (character) vector that will recieve * * the options that the symbiont manager can * * understand * * note the three options that take a negative (burst_page, * * flag_page and lower) will exclude the choice of the * * negation if the option is specified. This prevents * * specifying conclicting options to the symbiont manager. * ************************************************************************/ longword function decode_options (option_word, options) longword option_word character options (26) longword index, i index = 1 for (i = 0 ; i < max_options ; i = i + 1) if ((option_word & 2**i) > 0) { switch (i) { case 0: options (index) = smo$k_brstpag i = i + 1 break case 1: options (index) = smo$k_nobrstpag break case 2: options (index) = smo$k_delete break case 3: options (index) = smo$k_flagpag i = i + 1 break case 4: options (index) = smo$k_noflagpag break case 5: options (index) = smo$k_hold break case 6: options (index) = smo$k_lower i = i + 1 break case 7: options (index) = smo$k_nolower break case 8: options (index) = smo$k_nofeed break case 9: options (index) = smo$k_paghdr # break } index = index + 1 } decode_options = index - 1 return end