COMPILATION LISTING OF SEGMENT rs_open_str_out_ Compiled by: Multics PL/I Compiler, Release 29, of July 28, 1986 Compiled at: Honeywell Bull, Phx, AZ, Sys-M Compiled on: 09/10/87 1451.3 mst Thu Options: optimize list 1 /* *********************************************************** 2* * * 3* * Copyright, (C) Honeywell Information Systems Inc., 1982 * 4* * * 5* * Copyright (c) 1972 by Massachusetts Institute of * 6* * Technology and Honeywell Information Systems, Inc. * 7* * * 8* *********************************************************** */ 9 10 11 /* record_stream_ program for handling stream output mode of opening */ 12 rs_open_str_out_: 13 proc (iocb_ptr_arg); 14 iocb_ptr = iocb_ptr_arg; 15 /* set entry in iocb for valid operation */ 16 put_chars = put_chars_rs; 17 return; /* finished with opening routine */ 18 19 put_chars_rs: 20 entry (iocb_ptr_arg, buff_ptr_arg, buff_len_arg, code); 21 iocb_ptr = iocb_ptr_arg -> actual_iocb_ptr; 22 rsab_ptr = attach_data_ptr; 23 rs_buff_ptr = open_data_ptr; 24 buff_len = buff_len_arg; 25 buff_ptr = buff_ptr_arg; 26 if buff_len_arg < 0 27 then code = error_table_$negative_nelem; 28 else do; /* process characters in output buffer */ 29 code = 0; 30 if length_n <= 0 31 then /* default case */ 32 do while ((buff_len > 0) & (code = 0)); 33 line_len = index (buffer, newline) - 1; 34 if line_len ^= 0 35 then /* non-null line in output buffer */ 36 if line_len < 0 /* no newline found */ 37 then go to append; /* append remaining chars to rs_buffer */ 38 else /* newline found in output buffer */ 39 if n_left > 0 40 then /* rs_buffer not empty */ 41 do; /* append rest of line to rs_buffer and flush */ 42 substr (rs_buffer, n_left + 1, line_len) = substr (buffer, 1, line_len); 43 call iox_$write_record (target_iocb_ptr, rs_buff_ptr, line_len + n_left, code); 44 n_left = 0; 45 end; /* rs_buffer now empty */ 46 else call iox_$write_record (target_iocb_ptr, buff_ptr, line_len, code); 47 buff_len = buff_len - line_len - 1; 48 buff_ptr = addr (buff (line_len + 2)); 49 end; /* end of default case */ 50 51 else do; /* -length n case */ 52 if n_left > 0 53 then /* rs_buffer not empty */ 54 if n_left + buff_len >= length_n 55 then /* enough for full record */ 56 do; /* append and write out record from rs_buffer */ 57 tail_len = length_n - n_left; 58 substr (rs_buffer, n_left + 1, tail_len) = substr (buffer, 1, tail_len); 59 call iox_$write_record (target_iocb_ptr, rs_buff_ptr, length_n, code); 60 buff_len = buff_len - tail_len; 61 buff_ptr = addr (buff (tail_len + 1)); 62 n_left = 0; /* rs_buffer mpty */ 63 end; 64 else go to append; /* not enough for full record to be written */ 65 66 do while (buff_len >= length_n); 67 call iox_$write_record (target_iocb_ptr, buff_ptr, length_n, code); 68 buff_len = buff_len - length_n; 69 buff_ptr = addr (buff (length_n + 1)); 70 end; /* fewer than length_n characters remain */ 71 72 append: 73 if buff_len > 0 74 then /* characters remain, but not enough for a full record */ 75 do; /* append remaining chars to rs_buffer */ 76 substr (rs_buffer, n_left + 1, buff_len) = buffer; 77 n_left = n_left + buff_len; 78 end; 79 end; /* end of -length n case */ 80 end; /* no more characters to process */ 81 return; /* end of put_chars routine */ 82 83 /* declarations for entire program */ 84 dcl (iocb_ptr_arg, iocb_ptr) 85 ptr; 86 dcl code fixed (35); 1 1 /* BEGIN: rs_attach_block.incl.pl1 * * * * * */ 1 2 1 3 1 4 /****^ HISTORY COMMENTS: 1 5* 1) change(75-02-13,Asherman), approve(), audit(), install(): 1 6* Initial coding. 1 7* 2) change(87-08-30,GWMay), approve(87-08-30,MCR7730), audit(87-09-10,GDixon), 1 8* install(87-09-10,MR12.1-1104): 1 9* Changed target_name to be unaligned. 1 10* END HISTORY COMMENTS */ 1 11 1 12 1 13 dcl rsab_ptr ptr; 1 14 dcl 1 rs_attach_block based (rsab_ptr) aligned, 1 15 /* record_stream_ attach block */ 1 16 /* the following are set during attachment */ 1 17 2 attach_descrip, 1 18 3 attach_descrip_len 1 19 fixed (35), 1 20 3 attach_descrip_string 1 21 char (66), /* "record_stream_