COMPILATION LISTING OF SEGMENT cobol_su_ Compiled by: Multics PL/I Compiler, Release 31b, of April 24, 1989 Compiled at: Bull HN, Phoenix AZ, System-M Compiled on: 05/24/89 1025.1 mst Wed Options: optimize map 1 /****^ *********************************************************** 2* * * 3* * Copyright, (C) BULL HN Information Systems Inc., 1989 * 4* * * 5* * Copyright, (C) Honeywell Information Systems Inc., 1982 * 6* * * 7* * Copyright (c) 1972 by Massachusetts Institute of * 8* * Technology and Honeywell Information Systems, Inc. * 9* * * 10* *********************************************************** */ 11 12 13 14 15 /****^ HISTORY COMMENTS: 16* 1) change(89-04-23,Zimmerman), approve(89-04-23,MCR8060), 17* audit(89-05-05,RWaters), install(89-05-24,MR12.3-1048): 18* MCR8060 cobol_su_.pl1 Reformatted code to new Cobol standard. 19* END HISTORY COMMENTS */ 20 21 22 /* Modified on 03/31/77 by Bob Chang to fix the bug for tally count. */ 23 /* Modified 03/27/76 by ORN to avoid initializing the tally parameter (tout) to zero. */ 24 /* Modified since Version 2.0 */ 25 26 /* format: style3 */ 27 cobol_su_: 28 proc; 29 30 dcl i fixed bin; 31 dcl k fixed bin; 32 dcl newk fixed bin; 33 34 dcl str char (100000) based; 35 36 37 /*************************************/ 38 tally: 39 entry (tptr); 40 41 dcl tptr ptr; 42 dcl tout_ptr ptr; 43 dcl tout (512) fixed bin based (tout_ptr); 44 45 dcl 1 t based (tptr), 46 2 ssp ptr, 47 2 slen fixed bin, 48 2 n fixed bin, 49 2 tally (0 refer (t.n)), 50 3 ccode fixed bin, /* 0=CHARACTERS, 1=LEADING, 2=ALL */ 51 3 lcode fixed bin, /* 0=unspecified(enabled), 1=BEFORE, 2=AFTER, 3=disabled */ 52 3 lpos fixed bin, /* char pos to enable after's or disable before's */ 53 3 llen fixed bin, /* length of BEFORE/AFTER string */ 54 3 lsp ptr, /* ptr to BEFORE/AFTER string (if lcode ^= 0) */ 55 3 csp ptr, /* ptr to LEADING/ALL string (if ccode > 0) */ 56 3 clen fixed bin, /* length of LEADING/ALL string */ 57 3 tally_ind fixed bin; /* tally count */ 58 59 start_tally: 60 tout_ptr = addrel (tptr, t.n * 10 + 4); 61 do i = 1 to t.n; 62 if t.lcode (i) ^= 0 63 then do; 64 k = index (substr (t.ssp -> str, 1, t.slen), substr (t.lsp (i) -> str, 1, t.llen (i))); 65 if k = 0 66 then t.lpos (i) = t.slen + 1; 67 else do; 68 if t.lcode (i) = 2 69 then t.lpos (i) = k + t.llen (i); 70 /* AFTER */ 71 else do; /* BEFORE */ 72 if t.ccode (i) ^= 0 73 then k = k - t.clen (i) + 1; 74 t.lpos (i) = k; 75 end; 76 end; 77 end; 78 end; 79 80 do k = 1 to t.slen; 81 newk = k; 82 do i = 1 to t.n; 83 if t.lcode (i) = 2 84 then if k >= t.lpos (i) 85 then t.lcode (i) = 0; /* enable AFTER tally */ 86 else ; 87 else if t.lcode (i) = 1 88 then if k >= t.lpos (i) 89 then t.lcode (i) = 3; /* disable BEFORE tally */ 90 if t.lcode (i) < 2 91 then do; /* if this tally is enabled */ 92 if t.ccode (i) = 0 93 then do; /* CHARACTERS */ 94 tout (t.tally_ind (i)) = tout (t.tally_ind (i)) + 1; 95 do i = i + 1 to t.n;/* scrap any eligible LEADING's and discontinue search */ 96 if t.lcode (i) < 2 97 then if t.ccode (i) = 1 98 then t.lcode (i) = 3; 99 end; 100 end; 101 else do; 102 if k + t.clen (i) - 1 ^> t.slen 103 then do; /* enough string left to compare */ 104 if substr (t.ssp -> str, k, t.clen (i)) 105 = substr (t.csp (i) -> str, 1, t.clen (i)) 106 then do; 107 tout (t.tally_ind (i)) = tout (t.tally_ind (i)) + 1; 108 newk = k + t.clen (i) - 1; 109 do i = i + 1 to t.n; 110 if t.lcode (i) < 2 111 then if t.ccode (i) = 1 112 then t.lcode (i) = 3; 113 end; 114 end; 115 else if t.ccode (i) = 1 116 then t.lcode (i) = 3; 117 /* disable LEADING */ 118 end; 119 else if t.ccode (i) = 1 120 then t.lcode (i) = 3; 121 end; 122 end; 123 end; 124 k = newk; 125 end; 126 return; 127 128 129 /*************************************/ 130 replace: 131 entry (rptr); 132 133 dcl rptr ptr; 134 135 dcl 1 r based (rptr), 136 2 ssp ptr, 137 2 slen fixed bin, 138 2 n fixed bin, 139 2 repl (0 refer (r.n)), 140 3 ccode fixed bin, /* 3=FIRST */ 141 3 lcode fixed bin, 142 3 lpos fixed bin, 143 3 llen fixed bin, 144 3 lsp ptr, 145 3 csp ptr, 146 3 clen fixed bin, 147 3 bsp ptr; /* ptr to BY string (length must = clen) */ 148 149 start_replace: 150 do i = 1 to r.n; 151 if r.lcode (i) ^= 0 152 then do; 153 k = index (substr (r.ssp -> str, 1, r.slen), substr (r.lsp (i) -> str, 1, r.llen (i))); 154 if k = 0 155 then r.lpos (i) = r.slen + 1; 156 else do; 157 if r.lcode (i) = 2 158 then r.lpos (i) = k + r.llen (i); 159 /* AFTER */ 160 else do; /* BEFORE */ 161 if r.ccode (i) ^= 0 162 then k = k - r.clen (i) + 1; 163 r.lpos (i) = k; 164 end; 165 end; 166 end; 167 end; 168 169 do k = 1 to r.slen; 170 newk = k; 171 do i = 1 to r.n; 172 if r.lcode (i) = 2 173 then if k >= r.lpos (i) 174 then r.lcode (i) = 0; /* enable AFTER tally */ 175 else ; 176 else if r.lcode (i) = 1 177 then if k >= r.lpos (i) 178 then r.lcode (i) = 3; /* disable BEFORE tally */ 179 if r.lcode (i) < 2 180 then do; /* if this tally enabled */ 181 if r.ccode (i) = 0 182 then do; /* CHARACTERS */ 183 substr (r.ssp -> str, k, 1) = substr (r.bsp (i) -> str, 1, 1); 184 do i = i + 1 to r.n;/* scrap any eligible LEADING's and discontinue search */ 185 if r.lcode (i) < 2 186 then if r.ccode (i) = 1 187 then r.lcode = 3; 188 end; 189 end; 190 else do; 191 if k + r.clen (i) - 1 ^> r.slen 192 then do; /* enought string left? */ 193 if substr (r.ssp -> str, k, r.clen (i)) 194 = substr (r.csp (i) -> str, 1, r.clen (i)) 195 then do; 196 substr (r.ssp -> str, k, r.clen (i)) = 197 substr (r.bsp (i) -> str, 1, r.clen (i)); 198 if r.ccode (i) = 3 199 then r.lcode (i) = 3; 200 /* FIRST - disable it now */ 201 newk = k + r.clen (i) - 1; 202 do i = i + 1 to r.n; 203 if r.lcode (i) < 2 204 then if r.ccode (i) = 1 205 then r.lcode (i) = 3; 206 end; 207 end; 208 else if r.ccode (i) = 1 209 then r.lcode (i) = 3; 210 /* disable LEADING */ 211 end; 212 else if r.ccode (i) = 1 213 then r.lcode (i) = 3; 214 end; 215 end; 216 end; 217 k = newk; 218 end; 219 return; 220 221 222 /***** Declaration for builtin function *****/ 223 224 dcl (substr, mod, binary, fixed, addr, addrel, rel, length, string, unspec, null, index) 225 builtin; 226 227 /***** End of declaration for builtin function *****/ 228 229 end cobol_su_; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 05/24/89 0836.8 cobol_su_.pl1 >spec>install>MR12.3-1048>cobol_su_.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. addrel builtin function dcl 224 ref 59 bsp 16 based pointer array level 3 dcl 135 ref 183 196 ccode 4 based fixed bin(17,0) array level 3 in structure "r" dcl 135 in procedure "cobol_su_" ref 161 181 185 198 203 208 212 ccode 4 based fixed bin(17,0) array level 3 in structure "t" dcl 45 in procedure "cobol_su_" ref 72 92 96 110 115 119 clen 14 based fixed bin(17,0) array level 3 in structure "r" dcl 135 in procedure "cobol_su_" ref 161 191 193 193 196 196 201 clen 14 based fixed bin(17,0) array level 3 in structure "t" dcl 45 in procedure "cobol_su_" ref 72 102 104 104 108 csp 12 based pointer array level 3 in structure "r" dcl 135 in procedure "cobol_su_" ref 193 csp 12 based pointer array level 3 in structure "t" dcl 45 in procedure "cobol_su_" ref 104 i 000100 automatic fixed bin(17,0) dcl 30 set ref 61* 62 64 64 65 68 68 68 72 72 74* 82* 83 83 83 87 87 87 90 92 94 94 95* 95* 96 96 96* 102 104 104 104 107 107 108 109* 109* 110 110 110* 115 115 119 119* 149* 151 153 153 154 157 157 157 161 161 163* 171* 172 172 172 176 176 176 179 181 183 184* 184* 185 185* 191 193 193 193 196 196 196 198 198 201 202* 202* 203 203 203* 208 208 212 212* index builtin function dcl 224 ref 64 153 k 000101 automatic fixed bin(17,0) dcl 31 set ref 64* 65 68 72* 72 74 80* 81 83 87 102 104 108 124* 153* 154 157 161* 161 163 169* 170 172 176 183 191 193 196 201 217* lcode 5 based fixed bin(17,0) array level 3 in structure "r" dcl 135 in procedure "cobol_su_" set ref 151 157 172 172* 176 176* 179 185 185* 198* 203 203* 208* 212* lcode 5 based fixed bin(17,0) array level 3 in structure "t" dcl 45 in procedure "cobol_su_" set ref 62 68 83 83* 87 87* 90 96 96* 110 110* 115* 119* llen 7 based fixed bin(17,0) array level 3 in structure "t" dcl 45 in procedure "cobol_su_" ref 64 68 llen 7 based fixed bin(17,0) array level 3 in structure "r" dcl 135 in procedure "cobol_su_" ref 153 157 lpos 6 based fixed bin(17,0) array level 3 in structure "t" dcl 45 in procedure "cobol_su_" set ref 65* 68* 74* 83 87 lpos 6 based fixed bin(17,0) array level 3 in structure "r" dcl 135 in procedure "cobol_su_" set ref 154* 157* 163* 172 176 lsp 10 based pointer array level 3 in structure "t" dcl 45 in procedure "cobol_su_" ref 64 lsp 10 based pointer array level 3 in structure "r" dcl 135 in procedure "cobol_su_" ref 153 n 3 based fixed bin(17,0) level 2 in structure "r" dcl 135 in procedure "cobol_su_" ref 149 171 184 185 202 n 3 based fixed bin(17,0) level 2 in structure "t" dcl 45 in procedure "cobol_su_" ref 59 61 82 95 109 newk 000102 automatic fixed bin(17,0) dcl 32 set ref 81* 108* 124 170* 201* 217 r based structure level 1 unaligned dcl 135 repl 4 based structure array level 2 unaligned dcl 135 rptr parameter pointer dcl 133 ref 130 149 151 153 153 153 153 154 154 157 157 157 161 161 163 169 171 172 172 172 176 176 176 179 181 183 183 184 185 185 185 191 191 193 193 193 193 196 196 196 196 198 198 201 202 203 203 203 208 208 212 212 slen 2 based fixed bin(17,0) level 2 in structure "t" dcl 45 in procedure "cobol_su_" ref 64 65 80 102 slen 2 based fixed bin(17,0) level 2 in structure "r" dcl 135 in procedure "cobol_su_" ref 153 154 169 191 ssp based pointer level 2 in structure "r" dcl 135 in procedure "cobol_su_" ref 153 183 193 196 ssp based pointer level 2 in structure "t" dcl 45 in procedure "cobol_su_" ref 64 104 str based char(100000) packed unaligned dcl 34 set ref 64 64 104 104 153 153 183* 183 193 193 196* 196 substr builtin function dcl 224 set ref 64 64 104 104 153 153 183* 183 193 193 196* 196 t based structure level 1 unaligned dcl 45 tally 4 based structure array level 2 unaligned dcl 45 tally_ind 15 based fixed bin(17,0) array level 3 dcl 45 ref 94 94 107 107 tout based fixed bin(17,0) array dcl 43 set ref 94* 94 107* 107 tout_ptr 000104 automatic pointer dcl 42 set ref 59* 94 94 107 107 tptr parameter pointer dcl 41 ref 38 59 59 61 62 64 64 64 64 65 65 68 68 68 72 72 74 80 82 83 83 83 87 87 87 90 92 94 94 95 96 96 96 102 102 104 104 104 104 107 107 108 109 110 110 110 115 115 119 119 NAMES DECLARED BY DECLARE STATEMENT AND NEVER REFERENCED. addr builtin function dcl 224 binary builtin function dcl 224 fixed builtin function dcl 224 length builtin function dcl 224 mod builtin function dcl 224 null builtin function dcl 224 rel builtin function dcl 224 string builtin function dcl 224 unspec builtin function dcl 224 NAMES DECLARED BY EXPLICIT CONTEXT. cobol_su_ 000002 constant entry external dcl 27 replace 000324 constant entry external dcl 130 start_replace 000331 constant label dcl 149 start_tally 000020 constant label dcl 59 tally 000013 constant entry external dcl 38 THERE WERE NO NAMES DECLARED BY CONTEXT OR IMPLICATION. STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 710 720 652 720 Length 1064 652 10 127 36 0 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME cobol_su_ 83 external procedure is an external procedure. STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME cobol_su_ 000100 i cobol_su_ 000101 k cobol_su_ 000102 newk cobol_su_ 000104 tout_ptr cobol_su_ THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. return_mac ext_entry set_chars_eis index_chars_eis NO EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. NO EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC 27 000001 38 000007 59 000020 61 000031 62 000041 64 000050 65 000060 68 000065 72 000074 74 000102 78 000104 80 000106 81 000121 82 000122 83 000135 86 000152 87 000153 90 000163 92 000167 94 000171 95 000174 96 000203 99 000221 100 000223 102 000224 104 000231 107 000241 108 000244 109 000250 110 000257 113 000275 114 000277 115 000300 118 000305 119 000306 123 000313 124 000315 125 000317 126 000321 130 000322 149 000331 151 000343 153 000352 154 000362 157 000367 161 000376 163 000404 167 000406 169 000410 170 000423 171 000424 172 000437 175 000454 176 000455 179 000465 181 000471 183 000473 184 000501 185 000507 188 000544 189 000546 191 000547 193 000554 196 000564 198 000570 201 000575 202 000601 203 000607 206 000625 207 000627 208 000630 211 000635 212 000636 216 000643 217 000645 218 000647 219 000651 ----------------------------------------------------------- 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