COMPILATION LISTING OF SEGMENT merge_ascii_ Compiled by: Multics PL/I Compiler, Release 27d, of October 11, 1982 Compiled at: Honeywell LISD Phoenix, System M Compiled on: 11/04/82 1818.3 mst Thu Options: optimize map 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 merge_ascii_: proc (a_maip); default (fixed&^precision&^constant) precision (21); /* DEFAULT */ 12 default (constant&real&^decimal) binary; 13 14 /* Subroutine implementing top level of merge/compare subsystem. */ 15 /* It is called with a pointer to a main control structure. */ 16 /* It may pass that pointer to procs it calls */ 17 /* This subroutine is not externally available. The interface can change. */ 18 19 /* Re-coded Spring '77 RE Mullen */ 20 21 dcl a_maip ptr; /* parameter */ 22 23 dcl ch char (999) based; 24 dcl skipchars (0:1) char (1) unal based; 25 dcl (i, j, k) fixed bin; 26 dcl code fixed bin (35); 27 dcl NL char (1) init (" 28 "); 29 30 dcl (ioa_, ioa_$nnl) entry options (variable); 31 dcl (iox_$user_input, iox_$user_output) ptr ext; 32 dcl iox_$put_chars entry (ptr, ptr, fixed bin, fixed bin (35)); 33 dcl iox_$get_line entry (ptr, ptr, fixed bin, fixed bin, fixed bin (35)); 34 35 dcl (ma_resynch_, ma_analyze_) entry (ptr); 36 37 dcl (addr, index, substr) builtin; 38 39 /* */ 40 1 1 /* BEGIN INCLUDE FILE ... merge_ascii_info.incl.pl1 ... REM Winter '77 */ 1 2 /* Modified for archive component convention THVV 1980 */ 1 3 /* Added output_iocb_ptr for cpa -output_file */ 1 4 1 5 dcl ma_info_ptr ptr; 1 6 1 7 /* programs modifiying variables are supplied im most comments */ 1 8 /* ma_info.control.*** modified by ma unless otherwise noted */ 1 9 /* ma_info.per_text(output).*** usually set by ma_edit_ instead */ 1 10 /* ma=merge_ascii ma_=merge_ascii_ mar_=ma_resynch_ maa_=ma_analyze_ mae_=ma_edit_ */ 1 11 1 12 dcl 1 ma_info aligned based (ma_info_ptr), 1 13 2 control aligned, /* stuff controling program action */ 1 14 3 minlines fixed bin, /* ma: resynch block must have >= minlines */ 1 15 3 minchars fixed bin, /* ma: resynch block must have >= minchars */ 1 16 3 lo fixed bin, /* ma: lowest seg_index to resynch */ 1 17 3 hi fixed bin, /* ma: highest seg_index to resynch */ 1 18 3 eof bit (1), /* set by mar_ and ma_.skip_same for ma_ */ 1 19 3 synchlen fixed bin, /* mar_: chars between resynch start and next diff */ 1 20 3 synchlines fixed bin, /* mar_: lines between resynch start and next diff */ 1 21 3 have_orig bit (1), /* "1"b if original provided */ 1 22 3 have_output bit (1), /* ma_: "1"b if merge and have got path */ 1 23 3 have_edit bit (1), /* if any "-edit" segs */ 1 24 3 convergence_ok bit (1) aligned, /* "1"b => ok to pick up identical changes */ 1 25 3 brief_mode bit (1) aligned, /* UNUSED */ 1 26 3 total_differences fixed bin, /* ma_: number of time synch lost */ 1 27 3 total_lines_differing fixed bin, /* ma_: summed over all diff in all texts */ 1 28 3 totals_only bit (1), /* ma: dont print differences */ 1 29 3 print_heading bit (1), /* ma: print heading before start */ 1 30 3 no_line_numbers bit (1), /* ma: dont print linnos with diffs */ 1 31 3 print_new_lines bit (1), /* ma: dont print context or old with diff */ 1 32 3 no_totals bit (1), /* ma: dont print totals line when done */ 1 33 3 abort_label label, /* goto abort label to bust out */ 1 34 3 op_dirname char (168), /* info about desired output seg */ 1 35 3 op_ename char (32), 1 36 3 op_ptr ptr, 1 37 3 output_iocb_ptr ptr, 1 38 2 per_text_info (8) aligned, /* 1=output_temp, 2=orig, 3+=updates */ 1 39 3 tptr ptr, /* ma: base of each text */ 1 40 3 tchars fixed bin, /* ma: chars in each text */ 1 41 3 tlines fixed bin, /* UNUSED */ 1 42 3 cp ptr, /* ma_: ->current position, next char to process */ 1 43 3 len fixed bin, /* ma_: chars remaining to process */ 1 44 3 line fixed bin, /* ma_: line number cp points at */ 1 45 3 difflen fixed bin, /* mar_: chars between synchs */ 1 46 3 difflines fixed bin, /* mar_: lines between synchs */ 1 47 3 same_as fixed bin, /* mar_: seg_index of lowest seg with identical diff */ 1 48 3 textid char (1) aligned, /* ma: char to identify text in display */ 1 49 3 edit bit (1) aligned, /* ma: not take automatically */ 1 50 3 pad_t (3) fixed bin, /* make 16 wds for indexing speed */ 1 51 2 text_id (8) aligned, /* names of the stff */ 1 52 3 dirname char (168), 1 53 3 ename char (32), 1 54 3 component char (32); 1 55 1 56 dcl ma_text_ids char (8) init ("mabcdefg")int static options (constant); 1 57 dcl MA_TEXT_IDS char (8) init ("MABCDEFG")int static options (constant); 1 58 dcl ma_max_texts fixed bin int static options (constant) init (8); 1 59 1 60 /* END INCLUDE FILE ... merge_ascii_info.incl.pl1 */ 41 42 /* */ 43 44 45 ma_info_ptr = a_maip; /* pointer at least to automatic */ 46 47 48 call find_same_at_start; /* skip over matching chars at start */ 49 if have_output then call take_same; /* pick up any found */ 50 call skip_same; /* skip over those chars */ 51 52 53 54 do while (^ma_info.eof); 55 call ma_resynch_ (ma_info_ptr); /* sets synchlen, difflen(*), eof, etc */ 56 57 total_differences = total_differences + 1; /* keep change counters */ 58 do i = lo to hi; 59 total_lines_differing = 60 total_lines_differing + difflines (i); 61 end; 62 63 if ^totals_only | have_output then 64 call ma_analyze_ (ma_info_ptr); /* print diff, auto-take, call editor */ 65 66 call skip_diff; /* advance past difflen(*) chars */ 67 68 if have_output then call take_same; /* pick up synchlen chars */ 69 70 call skip_same; /* advance past synchlen chars */ 71 end; 72 73 return; /* all done */ 74 75 /* */ 76 find_same_at_start: proc; /* IP to skip over matching lines */ 77 dcl (ssj, ssk) fixed bin; 78 dcl lo_cp ptr; 79 dcl lo_len fixed bin; 80 dcl same_len bit (1); 81 82 83 /* The objective of the following code is to determine the number of matching 84* lines. In order to avoid indexing into all segments, we index for newlines 85* only in the lowest segment and then compare those characters, including the 86* newline (if any), with the corresponding characters in the other segments. 87* If all compares come out equal, we have found one more matching line. 88* For this scheme to work we must not reference past the 89* end of any segment, so we compute the min of all lengths. If in text(lo) 90* we ever fail to find a newline then the end of text(lo) cannot match the other 91* texts unless they are all of the same length */ 92 93 synchlen = 0; /* skipped no chars yet */ 94 synchlines = 0; /* skipped no lines yet */ 95 96 lo_cp = cp (lo); 97 lo_len = len (lo); 98 99 100 /* Set lo_len to the minimum remaining length in any text */ 101 same_len = "1"b; 102 do ssk = lo + 1 to hi; 103 if len (ssk) < lo_len then do; /* found unequal and shorter text */ 104 lo_len = len (ssk); /* note new, lower min len */ 105 same_len = ""b; /* note all lengths not the same */ 106 end; 107 end; 108 109 /* Step through text(lo) line by line. Compare each line to text in 110* other texts. Whenever any other text differs we have found what is the same */ 111 ss_loop: 112 ssj = index (substr (lo_cp -> ch, synchlen + 1, lo_len - synchlen), NL); /* get current line length */ 113 if ssj = 0 then do; /* no new line found */ 114 if same_len then ssj = lo_len - synchlen; /* else get matching partial lines, not at EOF .. */ 115 if ssj = 0 then go to ss_done; 116 end; 117 do ssk = lo + 1 to hi; /* see if lines all match */ 118 if substr (lo_cp -> ch, synchlen + 1, ssj) ^= substr (cp (ssk) -> ch, synchlen + 1, ssj) 119 then go to ss_done; 120 end; 121 synchlen = synchlen + ssj; /* count more chars */ 122 synchlines = synchlines + 1; /* count this line */ 123 go to ss_loop; /* try for another */ 124 125 ss_done: /* here when cant match one more line */ 126 127 end find_same_at_start; 128 129 130 /* */ 131 skip_diff: proc; /* IP to skip over (processed) differences */ 132 133 dcl sdi fixed bin; 134 135 do sdi = lo to hi; /* for each input seg */ 136 cp (sdi) = addr (cp (sdi) -> skipchars (difflen (sdi))); /* advance ptr */ 137 line (sdi) = line (sdi) + difflines (sdi); /* advance linno */ 138 len (sdi) = len (sdi) - difflen (sdi); /* decrease remaining len */ 139 end; 140 141 end skip_diff; 142 143 144 skip_same: proc; /* IP to skip over synched block */ 145 146 dcl ssx fixed bin; 147 148 eof = "1"b; /* assume we are not at eof */ 149 do ssx = lo to hi; /* for each input seg */ 150 len (ssx) = len (ssx) - synchlen; /* decrement remaining length */ 151 if len (ssx) > 0 then eof = ""b; /* note if at eof */ 152 line (ssx) = line (ssx) + synchlines ; /* increment linno */ 153 cp (ssx) = addr (cp (ssx) -> skipchars (synchlen)); /* advance pointer */ 154 end; 155 156 end skip_same; 157 158 159 take_same: proc; /* IP to pick up unchanged text */ 160 161 substr (cp (1) -> ch, 1, synchlen) /* copy text */ 162 = substr (cp (lo) -> ch, 1, synchlen); /* grab chars */ 163 tlines (1) = tlines (1) + synchlines; /* increment output linno */ 164 tchars (1) = tchars (1) + synchlen; /* increment output charcount */ 165 cp (1) = addr (cp (1) -> skipchars (synchlen)); /* bump pointer */ 166 167 end take_same; 168 169 170 /* */ 171 172 /* print_diff: proc; /* temporary IP to print diffs, fo debugging */ 173 /* 174* /*dcl (pdi, pdj, pdk) fixed bin; 175* /* 176* /* do pdi = lo to hi; 177* /* call iox_$put_chars (iox_$user_output, cp (pdi), difflen (pdi), code); 178* /* end; 179* /* 180* /* end print_diff; 181* /*dump: proc; /* IP to dump key vars */ 182 /* dcl di fixed bin; 183* /* call ioa_ ("^/ sx tptp tch tlines cp len line dlen dlin same"); 184* /* do di = lo to hi; 185* /* 186* /* call ioa_ ("^4d: ^p ^4d ^4d ^p ^4d ^4d ^4d ^4d ^4d", 187* /* di, tptr (di), tchars (di), tlines (di), 188* /* cp (di), len (di), line (di), 189* /* difflen (di), difflines (di), 190* /* same_as (di)); 191* /* end; 192* /* 193* /* end dump; 194**/ 195 end merge_ascii_; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 11/04/82 1627.6 merge_ascii_.pl1 >dumps>old>recomp>merge_ascii_.pl1 41 1 09/28/82 1437.6 merge_ascii_info.incl.pl1 >ldd>include>merge_ascii_info.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. NL 000101 automatic char(1) initial unaligned dcl 27 set ref 27* 111 a_maip parameter pointer dcl 21 ref 11 45 addr builtin function dcl 37 ref 136 153 165 ch based char(999) unaligned dcl 23 set ref 111 118 118 161* 161 control based structure level 2 dcl 1-12 cp 122 based pointer array level 3 dcl 1-12 set ref 96 118 136* 136 153* 153 161 161 165* 165 difflen 126 based fixed bin(21,0) array level 3 dcl 1-12 ref 136 138 difflines 127 based fixed bin(21,0) array level 3 dcl 1-12 ref 59 137 eof 4 based bit(1) level 3 dcl 1-12 set ref 54 148* 151* have_output 10 based bit(1) level 3 dcl 1-12 ref 49 63 68 hi 3 based fixed bin(21,0) level 3 dcl 1-12 ref 58 102 117 135 149 i 000100 automatic fixed bin(21,0) dcl 25 set ref 58* 59* index builtin function dcl 37 ref 111 len 124 based fixed bin(21,0) array level 3 dcl 1-12 set ref 97 103 104 138* 138 150* 150 151 line 125 based fixed bin(21,0) array level 3 dcl 1-12 set ref 137* 137 152* 152 lo 2 based fixed bin(21,0) level 3 dcl 1-12 ref 58 96 97 102 117 135 149 161 lo_cp 000116 automatic pointer dcl 78 set ref 96* 111 118 lo_len 000120 automatic fixed bin(21,0) dcl 79 set ref 97* 103 104* 111 114 ma_analyze_ 000012 constant entry external dcl 35 ref 63 ma_info based structure level 1 dcl 1-12 ma_info_ptr 000102 automatic pointer dcl 1-5 set ref 45* 49 54 55* 57 57 58 58 59 59 59 63 63 63* 68 93 94 96 96 97 97 102 102 103 104 111 111 114 117 117 118 118 118 121 121 122 122 135 135 136 136 136 137 137 137 138 138 138 148 149 149 150 150 150 151 151 152 152 152 153 153 153 161 161 161 161 161 163 163 163 164 164 164 165 165 165 ma_resynch_ 000010 constant entry external dcl 35 ref 55 per_text_info 116 based structure array level 2 dcl 1-12 same_len 000121 automatic bit(1) unaligned dcl 80 set ref 101* 105* 114 sdi 000132 automatic fixed bin(21,0) dcl 133 set ref 135* 136 136 136 137 137 137 138 138 138* skipchars based char(1) array unaligned dcl 24 set ref 136 153 165 ssj 000114 automatic fixed bin(21,0) dcl 77 set ref 111* 113 114* 115 118 118 121 ssk 000115 automatic fixed bin(21,0) dcl 77 set ref 102* 103 104* 117* 118* ssx 000142 automatic fixed bin(21,0) dcl 146 set ref 149* 150 150 151 152 152 153 153* substr builtin function dcl 37 set ref 111 118 118 161* 161 synchlen 5 based fixed bin(21,0) level 3 dcl 1-12 set ref 93* 111 111 114 118 118 121* 121 150 153 161 161 164 165 synchlines 6 based fixed bin(21,0) level 3 dcl 1-12 set ref 94* 122* 122 152 163 tchars 120 based fixed bin(21,0) array level 3 dcl 1-12 set ref 164* 164 tlines 121 based fixed bin(21,0) array level 3 dcl 1-12 set ref 163* 163 total_differences 14 based fixed bin(21,0) level 3 dcl 1-12 set ref 57* 57 total_lines_differing 15 based fixed bin(21,0) level 3 dcl 1-12 set ref 59* 59 totals_only 16 based bit(1) level 3 dcl 1-12 ref 63 NAMES DECLARED BY DECLARE STATEMENT AND NEVER REFERENCED. MA_TEXT_IDS internal static char(8) initial unaligned dcl 1-57 code automatic fixed bin(35,0) dcl 26 ioa_ 000000 constant entry external dcl 30 ioa_$nnl 000000 constant entry external dcl 30 iox_$get_line 000000 constant entry external dcl 33 iox_$put_chars 000000 constant entry external dcl 32 iox_$user_input external static pointer dcl 31 iox_$user_output external static pointer dcl 31 j automatic fixed bin(21,0) dcl 25 k automatic fixed bin(21,0) dcl 25 ma_max_texts internal static fixed bin(21,0) initial dcl 1-58 ma_text_ids internal static char(8) initial unaligned dcl 1-56 NAMES DECLARED BY EXPLICIT CONTEXT. find_same_at_start 000102 constant entry internal dcl 76 ref 48 merge_ascii_ 000004 constant entry external dcl 11 skip_diff 000220 constant entry internal dcl 131 ref 66 skip_same 000251 constant entry internal dcl 144 ref 50 70 ss_done 000217 constant label dcl 125 ref 115 118 ss_loop 000140 constant label dcl 111 ref 123 take_same 000307 constant entry internal dcl 159 ref 49 68 THERE WERE NO NAMES DECLARED BY CONTEXT OR IMPLICATION. STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 374 410 332 404 Length 572 332 14 145 41 0 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME merge_ascii_ 113 external procedure is an external procedure. find_same_at_start internal procedure shares stack frame of external procedure merge_ascii_. skip_diff internal procedure shares stack frame of external procedure merge_ascii_. skip_same internal procedure shares stack frame of external procedure merge_ascii_. take_same internal procedure shares stack frame of external procedure merge_ascii_. STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME merge_ascii_ 000100 i merge_ascii_ 000101 NL merge_ascii_ 000102 ma_info_ptr merge_ascii_ 000114 ssj find_same_at_start 000115 ssk find_same_at_start 000116 lo_cp find_same_at_start 000120 lo_len find_same_at_start 000121 same_len find_same_at_start 000132 sdi skip_diff 000142 ssx skip_same THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. call_ext_out return ext_entry THE FOLLOWING EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. ma_analyze_ ma_resynch_ NO EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC 11 000001 27 000011 45 000013 48 000017 49 000020 50 000024 54 000025 55 000030 57 000037 58 000041 59 000050 61 000054 63 000056 66 000072 68 000073 70 000077 71 000100 73 000101 76 000102 93 000103 94 000105 96 000106 97 000112 101 000114 102 000116 103 000126 104 000134 105 000135 107 000136 111 000140 113 000156 114 000157 115 000164 117 000166 118 000176 120 000210 121 000212 122 000215 123 000216 125 000217 131 000220 135 000221 136 000231 137 000240 138 000244 139 000246 141 000250 144 000251 148 000252 149 000255 150 000264 151 000271 152 000275 153 000277 154 000304 156 000306 159 000307 161 000310 163 000321 164 000323 165 000325 167 000331 ----------------------------------------------------------- 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