COMPILATION LISTING OF SEGMENT format_document Compiled by: Multics PL/I Compiler, Release 28d, of October 4, 1983 Compiled at: Honeywell Multics Op. - System M Compiled on: 11/01/84 1411.6 mst Thu Options: optimize map 1 /* *********************************************************** 2* * * 3* * * 4* * Copyright, (C) Honeywell Information Systems Inc., 1981 * 5* * * 6* * * 7* *********************************************************** */ 8 9 format_document: 10 fdoc: proc; 11 12 /* command to do simple text formatting, i.e. compose without much of its 13* capabilities and associated overhead. 14* Written 79.01.12 by Paul W. Benjamin 15* Re-written 81.02.10 by PWB. 16* Modified 83.02.15 by PWB to explicitly set 3 new switches (dont_compress_sw, 17* force_break_sw and max_line_length_sw) to "0"b. 18* Modified 83.03.01 by PWB to set dont_break_indented_lines_sw to "0"b. 19* Modified 83.03.03 by PWB to set sub_err_sw to "0"b. 20* Modified 83.06.07 by PWB to set dont_fill_sw to "0"b. 21* Modified 83.06.09 by PWB to implement -hyphenate. 22* Modified 83.08.30 by PWB to add -no_hyphenate, every ying deserving a yang. 23**/ 24 25 /* entries */ 26 27 dcl com_err_ entry options (variable); 28 dcl cu_$arg_count entry (fixed bin); 29 dcl cu_$arg_ptr entry (fixed bin, ptr, fixed bin, fixed bin (35)); 30 dcl expand_pathname_ entry (char (*), char (*), char (*), fixed bin (35)); 31 dcl expand_pathname_$add_suffix entry (char (*), char (*), char (*), char (*), fixed bin (35)); 32 dcl format_document_ entry (char (*), char (*), char (*), char (*), ptr, fixed bin (35)); 33 dcl format_document_$switch entry (char (*), char (*), ptr, ptr, fixed bin (35)); 34 35 /* external static */ 36 37 dcl error_table_$bad_arg external static fixed bin (35); 38 dcl error_table_$badopt external static fixed bin (35); 39 dcl error_table_$incorrect_access fixed bin(35) ext static; 40 dcl error_table_$mdc_path_dup_args fixed bin(35) ext static; 41 dcl error_table_$moderr fixed bin(35) ext static; 42 dcl error_table_$noarg external static fixed bin (35); 43 dcl iox_$user_output ptr ext static; 44 45 /* automatic */ 46 47 dcl alen fixed bin; /* length of input argument */ 48 dcl aptr ptr; /* ptr to input argument */ 49 dcl code fixed bin (35); /* system status code */ 50 dcl filout bit (1); /* output will go to file */ 51 dcl i fixed bin; /* do group index */ 52 dcl in_dname char (168); /* input file directory */ 53 dcl in_ename char (32); /* input file name */ 54 dcl in_path char (168); /* relative pathname of input file */ 55 dcl last_arg char (13) varying; /* temporary for last input arg */ 56 dcl nargs fixed bin; /* number of input arguments */ 57 dcl out_dname char (168); /* output file directory */ 58 dcl out_ename char (32); /* output file name */ 59 dcl out_path char (168); /* relative pathname of output file */ 60 61 dcl 1 auto_fdoc_options like format_document_options; /* structure to be passed to format_document_ */ 62 63 /* based */ 64 65 dcl arg char (alen) based (aptr); /* input argument */ 66 67 /* builtin */ 68 69 dcl (addr, binary, length, rtrim, substr, verify) builtin; 70 1 1 /* BEGIN INCLUDE FILE format_document_options.incl.pl1 1 2* 1 3* Modified 82.10.18 by Paul W. Benjamin to add dont_compress_sw and upgrade 1 4* to version_2. 1 5* Modified 83.02.15 by PWB to add break_word_sw and max_line_length_sw. 1 6* Modified 83.03.01 by PWB to add dont_break_indented_lines_sw. 1 7* Modified 83.03.03 by PWB to add sub_err_sw. 1 8* Modified 83.06.07 by PWB to add dont_fill_sw. 1 9* Modified 83.06.09 by PWB to add hyphenation_sw and syllable_size. 1 10**/ 1 11 1 12 dcl 1 format_document_options aligned based (format_document_options_ptr), 1 13 2 version_number fixed bin, /* input */ 1 14 /* must be format_document_version_2 */ 1 15 2 indentation fixed bin, /* input */ 1 16 /* all lines must be indented by this value */ 1 17 2 line_length fixed bin, /* input */ 1 18 /* initial line length */ 1 19 2 switches, 1 20 3 pgno_sw bit (1) unal, /* input */ 1 21 /* end each page with a centered page number */ 1 22 3 adj_sw bit (1) unal, /* input */ 1 23 /* adjust mode initially on */ 1 24 /* only meaningful if dont_fill_sw = "0"b */ 1 25 3 galley_sw bit (1) unal, /* input */ 1 26 /* galley mode -- no page breaks */ 1 27 3 error_sw bit (1) unal, /* input */ 1 28 /* report all errors on error_output */ 1 29 3 literal_sw bit (1) unal, /* input */ 1 30 /* "1"b - interpret all lines as text */ 1 31 /* "0"b - lines that start with "." are controls */ 1 32 3 file_sw bit (1) unal, /* output */ 1 33 /* has meaning for non-zero storage system status codes */ 1 34 /* "1"b code refers to output file */ 1 35 /* "0"b code refers to input file */ 1 36 3 dont_compress_sw bit (1) unal, /* input */ 1 37 /* "1"b - don't compress white space */ 1 38 /* "0"b - compress white space when filling */ 1 39 3 break_word_sw bit (1) unal, /* input */ 1 40 /* "1"b - break a word rather than exceed line_length */ 1 41 /* "0"b - write an overlength line if no spaces found */ 1 42 3 max_line_length_sw bit (1) unal, /* input */ 1 43 /* "1"b - line_length cannot be exceeded */ 1 44 /* "0"b - line_length can be exceeded (by .pdw controls) */ 1 45 3 dont_break_indented_lines_sw /* input */ 1 46 bit (1) unal, /* don't break a line that begins with whitespace */ 1 47 /* when it is the last line, or the next line is */ 1 48 /* null or the next line begins with whitespace */ 1 49 3 sub_err_sw bit (1) unal, /* input */ 1 50 /* quietly call sub_err_ with diagnostic errors */ 1 51 3 dont_fill_sw bit (1) unal, /* input */ 1 52 /* "1"b - fill mode off initially */ 1 53 /* "0"b - fill mode on initially */ 1 54 3 hyphenation_sw bit (1) unal, 1 55 3 mbz bit (23) unal, /* input */ 1 56 /* MUST be zero */ 1 57 2 syllable_size 1 58 fixed bin; /* input */ 1 59 /* smallest portion of word */ 1 60 /* to be left by hyphenation */ 1 61 1 62 dcl format_document_options_ptr ptr; 1 63 dcl format_document_version_2 fixed bin int static options (constant) init (2); 1 64 dcl format_document_version_1 fixed bin int static options (constant) init (1); 1 65 1 66 /* END INCLUDE FILE format_document_options.incl.pl1 */ 71 72 73 74 /* program */ 75 76 format_document_options_ptr = addr (auto_fdoc_options); /* initialize */ 77 format_document_options.version_number = format_document_version_2; 78 format_document_options.indentation = 0; 79 format_document_options.line_length = 65; 80 format_document_options.pgno_sw = "0"b; 81 format_document_options.adj_sw = "1"b; 82 format_document_options.galley_sw = "0"b; 83 format_document_options.error_sw = "1"b; 84 format_document_options.literal_sw = "0"b; 85 format_document_options.dont_compress_sw = "0"b; 86 format_document_options.break_word_sw = "0"b; 87 format_document_options.max_line_length_sw = "0"b; 88 format_document_options.dont_break_indented_lines_sw = "0"b; 89 format_document_options.sub_err_sw = "0"b; 90 format_document_options.dont_fill_sw = "0"b; 91 format_document_options.hyphenation_sw = "0"b; 92 format_document_options.mbz = "0"b; 93 format_document_options.syllable_size = 2; 94 in_path = ""; 95 out_path = ""; 96 filout = "0"b; 97 98 call cu_$arg_count (nargs); /* process command line */ 99 if nargs < 1 100 then do; 101 print_usage: call com_err_ (0, "format_document", 102 "Usage: format_document path {-indent(-ind) N} {-output_file(-of) {path}} {-page_numbers(-pgno)}"); 103 goto done; 104 end; 105 106 do i = 1 to nargs; 107 call cu_$arg_ptr (i, aptr, alen, code); 108 if code ^= 0 109 then do; 110 call com_err_ (code, "format_document"); 111 goto done; 112 end; 113 if substr (arg, 1, 1) ^= "-" 114 then do; 115 if in_path = "" 116 then in_path = arg; 117 else do; 118 call com_err_ (error_table_$mdc_path_dup_args, "format_document"); 119 goto print_usage; 120 end; 121 end; 122 else if arg = "-page_numbers" | arg = "-pgno" 123 then format_document_options.pgno_sw = "1"b; 124 else if arg = "-output_file" | arg = "-of" 125 then do; 126 filout = "1"b; 127 if i ^= nargs 128 then do; 129 i = i + 1; 130 call cu_$arg_ptr (i, aptr, alen, code); 131 if code ^= 0 132 then do; 133 call com_err_ (code, "format_document"); 134 goto done; 135 end; 136 if substr (arg, 1, 1) = "-" 137 then i = i - 1; 138 else out_path = arg; 139 end; 140 end; 141 else if arg = "-indent" | arg = "-ind" | arg = "-in" 142 then do; 143 i = i + 1; 144 if i > nargs 145 then do; /* no indentation number given */ 146 call com_err_ (error_table_$noarg, "format_document", "Following ^a", arg); 147 goto done; 148 end; 149 last_arg = arg; 150 call cu_$arg_ptr (i, aptr, alen, code); 151 if code ^= 0 152 then do; 153 call com_err_ (code, "format_document"); 154 goto done; 155 end; 156 if verify (arg, "1234567890") ^= 0 157 then do; 158 call com_err_ (error_table_$bad_arg, "format_document", "Following ^a", last_arg); 159 goto done; 160 end; 161 format_document_options.indentation = binary (arg); 162 end; 163 else if arg = "-hyphenate" | arg = "-hph" | /* undocumented */ arg = "-hyph" 164 then do; 165 format_document_options.hyphenation_sw = "1"b; 166 if i ^= nargs 167 then do; 168 last_arg = arg; 169 i = i + 1; 170 call cu_$arg_ptr (i, aptr, alen, code); 171 if code ^= 0 172 then do; 173 call com_err_ (code, "format_document"); 174 goto done; 175 end; 176 if substr (arg, 1, 1) = "-" 177 then i = i - 1; 178 else if verify (arg, "1234567890") ^= 0 179 then do; 180 call com_err_ (error_table_$bad_arg, "format_document", "Following ^a", last_arg); 181 goto done; 182 end; 183 else format_document_options.syllable_size = binary (arg); 184 end; 185 end; 186 else if arg = "-no_hyphenate" | arg = "-nhph" 187 then format_document_options.hyphenation_sw = "0"b; 188 else do; 189 call com_err_ (error_table_$badopt, "format_document", "^a", arg); 190 goto done; 191 end; 192 end; 193 194 if in_path = "" 195 then goto print_usage; 196 call expand_pathname_$add_suffix (in_path, "fdocin", in_dname, in_ename, code); 197 if code ^= 0 198 then do; 199 call com_err_ (code, "format_document", "^a", in_path); 200 goto done; 201 end; 202 if filout 203 then do; 204 if out_path = "" /* no output file name given, use default */ 205 then do; 206 call expand_pathname_$add_suffix ( 207 substr (in_ename, 1, length (rtrim (in_ename)) - 7), "fdocout", out_dname, out_ename, code); 208 if code ^= 0 209 then do; 210 call com_err_ (code, "format_document", "^a", 211 substr (in_ename, 1, length (rtrim (in_ename)) - 7) || ".fdocout"); 212 goto done; 213 end; 214 end; 215 else do; 216 call expand_pathname_ (out_path, out_dname, out_ename, code); 217 if code ^= 0 218 then do; 219 call com_err_ (code, "format_document", "^a", out_path); 220 goto done; 221 end; 222 end; 223 end; 224 225 if filout /* call subroutine to do actual work */ 226 then call format_document_ (in_dname, in_ename, out_dname, 227 out_ename, format_document_options_ptr, code); 228 else call format_document_$switch (in_dname, in_ename, 229 iox_$user_output, format_document_options_ptr, code); 230 231 if code ^= 0 /* examine code */ 232 then do; /* report error if found */ 233 if filout & format_document_options.file_sw & code = error_table_$incorrect_access 234 then code = error_table_$moderr; /* tssi crapped out */ 235 if filout /* tell him which file */ 236 then call com_err_ (code, 237 "format_document", 238 "^[^2s^]^a>^a", 239 (format_document_options.file_sw = "1"b), 240 in_dname, 241 in_ename, 242 out_dname, 243 out_ename); 244 else call com_err_ (code, /* must be input file */ 245 "format_document", 246 "^a>^a", 247 in_dname, 248 in_ename); 249 end; 250 done: /* and return */ 251 end; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 11/01/84 1304.2 format_document.pl1 >special_ldd>online>6675-11/01/84>format_document.pl1 71 1 11/01/84 1301.3 format_document_options.incl.pl1 >special_ldd>online>6675-11/01/84>format_document_options.incl.pl1 NAMES DECLARED IN THIS COMPILATION. IDENTIFIER OFFSET LOC STORAGE CLASS DATA TYPE ATTRIBUTES AND REFERENCES (* indicates a set context) NAMES DECLARED BY DECLARE STATEMENT. addr builtin function dcl 69 ref 76 adj_sw 3(01) based bit(1) level 3 packed unaligned dcl 1-12 set ref 81* alen 000100 automatic fixed bin(17,0) dcl 47 set ref 107* 113 115 122 122 124 124 130* 136 138 141 141 141 146 146 149 150* 156 161 163 163 163 168 170* 176 178 183 186 186 189 189 aptr 000102 automatic pointer dcl 48 set ref 107* 113 115 122 122 124 124 130* 136 138 141 141 141 146 149 150* 156 161 163 163 163 168 170* 176 178 183 186 186 189 arg based char unaligned dcl 65 set ref 113 115 122 122 124 124 136 138 141 141 141 146* 149 156 161 163 163 163 168 176 178 183 186 186 189* auto_fdoc_options 000405 automatic structure level 1 unaligned dcl 61 set ref 76 binary builtin function dcl 69 ref 161 183 break_word_sw 3(07) based bit(1) level 3 packed unaligned dcl 1-12 set ref 86* code 000104 automatic fixed bin(35,0) dcl 49 set ref 107* 108 110* 130* 131 133* 150* 151 153* 170* 171 173* 196* 197 199* 206* 208 210* 216* 217 219* 225* 228* 231 233 233* 235* 244* com_err_ 000010 constant entry external dcl 27 ref 101 110 118 133 146 153 158 173 180 189 199 210 219 235 244 cu_$arg_count 000012 constant entry external dcl 28 ref 98 cu_$arg_ptr 000014 constant entry external dcl 29 ref 107 130 150 170 dont_break_indented_lines_sw 3(09) based bit(1) level 3 packed unaligned dcl 1-12 set ref 88* dont_compress_sw 3(06) based bit(1) level 3 packed unaligned dcl 1-12 set ref 85* dont_fill_sw 3(11) based bit(1) level 3 packed unaligned dcl 1-12 set ref 90* error_sw 3(03) based bit(1) level 3 packed unaligned dcl 1-12 set ref 83* error_table_$bad_arg 000026 external static fixed bin(35,0) dcl 37 set ref 158* 180* error_table_$badopt 000030 external static fixed bin(35,0) dcl 38 set ref 189* error_table_$incorrect_access 000032 external static fixed bin(35,0) dcl 39 ref 233 error_table_$mdc_path_dup_args 000034 external static fixed bin(35,0) dcl 40 set ref 118* error_table_$moderr 000036 external static fixed bin(35,0) dcl 41 ref 233 error_table_$noarg 000040 external static fixed bin(35,0) dcl 42 set ref 146* expand_pathname_ 000016 constant entry external dcl 30 ref 216 expand_pathname_$add_suffix 000020 constant entry external dcl 31 ref 196 206 file_sw 3(05) based bit(1) level 3 packed unaligned dcl 1-12 ref 233 235 filout 000105 automatic bit(1) unaligned dcl 50 set ref 96* 126* 202 225 233 235 format_document_ 000022 constant entry external dcl 32 ref 225 format_document_$switch 000024 constant entry external dcl 33 ref 228 format_document_options based structure level 1 dcl 1-12 format_document_options_ptr 000412 automatic pointer dcl 1-62 set ref 76* 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 122 161 165 183 186 225* 228* 233 235 format_document_version_2 constant fixed bin(17,0) initial dcl 1-63 ref 77 galley_sw 3(02) based bit(1) level 3 packed unaligned dcl 1-12 set ref 82* hyphenation_sw 3(12) based bit(1) level 3 packed unaligned dcl 1-12 set ref 91* 165* 186* i 000106 automatic fixed bin(17,0) dcl 51 set ref 106* 107* 127 129* 129 130* 136* 136 143* 143 144 150* 166 169* 169 170* 176* 176* in_dname 000107 automatic char(168) unaligned dcl 52 set ref 196* 225* 228* 235* 244* in_ename 000161 automatic char(32) unaligned dcl 53 set ref 196* 206 206 206 206 210 210 225* 228* 235* 244* in_path 000171 automatic char(168) unaligned dcl 54 set ref 94* 115 115* 194 196* 199* indentation 1 based fixed bin(17,0) level 2 dcl 1-12 set ref 78* 161* iox_$user_output 000042 external static pointer dcl 43 set ref 228* last_arg 000243 automatic varying char(13) dcl 55 set ref 149* 158* 168* 180* length builtin function dcl 69 ref 206 206 210 line_length 2 based fixed bin(17,0) level 2 dcl 1-12 set ref 79* literal_sw 3(04) based bit(1) level 3 packed unaligned dcl 1-12 set ref 84* max_line_length_sw 3(08) based bit(1) level 3 packed unaligned dcl 1-12 set ref 87* mbz 3(13) based bit(23) level 3 packed unaligned dcl 1-12 set ref 92* nargs 000250 automatic fixed bin(17,0) dcl 56 set ref 98* 99 106 127 144 166 out_dname 000251 automatic char(168) unaligned dcl 57 set ref 206* 216* 225* 235* out_ename 000323 automatic char(32) unaligned dcl 58 set ref 206* 216* 225* 235* out_path 000333 automatic char(168) unaligned dcl 59 set ref 95* 138* 204 216* 219* pgno_sw 3 based bit(1) level 3 packed unaligned dcl 1-12 set ref 80* 122* rtrim builtin function dcl 69 ref 206 206 210 sub_err_sw 3(10) based bit(1) level 3 packed unaligned dcl 1-12 set ref 89* substr builtin function dcl 69 ref 113 136 176 206 206 210 switches 3 based structure level 2 dcl 1-12 syllable_size 4 based fixed bin(17,0) level 2 dcl 1-12 set ref 93* 183* verify builtin function dcl 69 ref 156 178 version_number based fixed bin(17,0) level 2 dcl 1-12 set ref 77* NAME DECLARED BY DECLARE STATEMENT AND NEVER REFERENCED. format_document_version_1 internal static fixed bin(17,0) initial dcl 1-64 NAMES DECLARED BY EXPLICIT CONTEXT. done 001776 constant label dcl 250 ref 103 111 134 147 154 159 174 181 190 200 212 220 fdoc 000130 constant entry external dcl 9 format_document 000137 constant entry external dcl 9 print_usage 000227 constant label dcl 101 ref 119 194 THERE WERE NO NAMES DECLARED BY CONTEXT OR IMPLICATION. STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 2402 2446 2212 2412 Length 2702 2212 44 220 167 0 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME fdoc 481 external procedure is an external procedure. STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME fdoc 000100 alen fdoc 000102 aptr fdoc 000104 code fdoc 000105 filout fdoc 000106 i fdoc 000107 in_dname fdoc 000161 in_ename fdoc 000171 in_path fdoc 000243 last_arg fdoc 000250 nargs fdoc 000251 out_dname fdoc 000323 out_ename fdoc 000333 out_path fdoc 000405 auto_fdoc_options fdoc 000412 format_document_options_ptr fdoc THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. r_e_as alloc_cs call_ext_out_desc call_ext_out return shorten_stack ext_entry any_to_any_tr THE FOLLOWING EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. com_err_ cu_$arg_count cu_$arg_ptr expand_pathname_ expand_pathname_$add_suffix format_document_ format_document_$switch THE FOLLOWING EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. error_table_$bad_arg error_table_$badopt error_table_$incorrect_access error_table_$mdc_path_dup_args error_table_$moderr error_table_$noarg iox_$user_output LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC 9 000127 76 000144 77 000146 78 000150 79 000151 80 000153 81 000155 82 000157 83 000161 84 000163 85 000165 86 000167 87 000171 88 000173 89 000175 90 000177 91 000201 92 000203 93 000205 94 000207 95 000212 96 000215 98 000216 99 000224 101 000227 103 000262 106 000263 107 000271 108 000306 110 000310 111 000333 113 000334 115 000341 118 000352 119 000375 121 000376 122 000377 124 000414 126 000424 127 000426 129 000431 130 000432 131 000447 133 000451 134 000474 136 000475 138 000505 140 000511 141 000512 143 000526 144 000527 146 000532 147 000575 149 000576 150 000606 151 000623 153 000625 154 000650 156 000651 158 000665 159 000725 161 000726 162 000741 163 000742 165 000756 166 000761 168 000764 169 000774 170 000775 171 001012 173 001014 174 001037 176 001040 178 001050 180 001063 181 001123 183 001124 185 001137 186 001140 189 001154 190 001214 192 001215 194 001217 196 001223 197 001255 199 001257 200 001314 202 001315 204 001317 206 001323 208 001377 210 001402 212 001454 214 001456 216 001457 217 001503 219 001505 220 001542 225 001543 228 001601 231 001631 233 001633 235 001651 244 001735 250 001776 ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group BULL including BULL HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell BULL Inc., Groupe BULL and BULL HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, BULL or BULL HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by BULL HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved