COMPILATION LISTING OF SEGMENT alphabetize_strings_ Compiled by: Multics PL/I Compiler, Release 27d, of October 11, 1982 Compiled at: Honeywell LISD Phoenix, System M Compiled on: 11/18/82 1646.9 mst Thu Options: optimize map 1 /* *********************************************************** 2* * * 3* * Copyright, (C) Honeywell Information Systems Inc., 1981 * 4* * * 5* * Copyright (c) 1972 by Massachusetts Institute of * 6* * Technology and Honeywell Information Systems, Inc. * 7* * * 8* *********************************************************** */ 9 10 11 alphabetize_strings_: proc (pm_data_p, pm_count); 12 13 /* A procedure to sort a collection of strings into alphabetical order. */ 14 15 /* Coded 10/19/77 by J. Stern */ 16 17 18 /* Parameters */ 19 20 dcl pm_data_p ptr; /* ptr to an array of string descriptors */ 21 dcl pm_count fixed bin (21); /* number of strings to alphabetize */ 22 23 24 /* Automatic */ 25 26 dcl code fixed bin (35); 27 dcl temp_ptrs (3) ptr; 28 dcl (data_p, new_data_p) ptr; 29 dcl buffer_p ptr; 30 dcl max_seglen fixed bin (21); 31 dcl buffer_len fixed bin (21); 32 dcl str_p ptr; 33 dcl str_len fixed bin (21); 34 dcl i fixed bin (21); 35 dcl saved_blen fixed bin (21); 36 37 38 /* Based */ 39 40 dcl 1 sort_data (pm_count) aligned based (data_p) like sort_entry; 41 42 dcl 1 new_sort_data (pm_count) aligned based (new_data_p) like sort_entry; 43 44 dcl 1 sort_entry aligned based, 45 2 string_p ptr unal, 46 2 string_len fixed bin (21); 47 48 dcl buffer char (buffer_len) based (buffer_p); 49 dcl buf_vector (buffer_len) char (1) based (buffer_p); 50 dcl cstring char (str_len) based (str_p); 51 52 53 /* Static */ 54 55 dcl sys_info$max_seg_size fixed bin (21) ext; 56 dcl error_table_$action_not_performed fixed bin (35) ext; 57 58 dcl capital_letters char (26) int static options (constant) init ("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); 59 dcl small_letters char (26) int static options (constant) init ("abcdefghijklmnopqrstuvwxyz"); 60 61 62 /* Conditions */ 63 64 dcl cleanup condition; 65 66 67 /* Builtins */ 68 69 dcl (substr, addr, search, translate, null, verify) builtin; 70 71 72 /* Entries */ 73 74 dcl get_temp_segments_ entry (char (*), (*) ptr, fixed bin (35)); 75 dcl release_temp_segments_ entry (char (*), (*) ptr, fixed bin (35)); 76 dcl sub_err_ entry options (variable); 77 dcl sort_strings_$indirect entry (ptr, fixed bin (21), ptr); 78 dcl ascii_to_abcdef_ entry (char (*), char (*)); 79 80 /* get some temporary segments */ 81 82 temp_ptrs (*) = null; 83 on cleanup call cleaner; 84 85 retry: call get_temp_segments_ ("alphabetize_strings_", temp_ptrs, code); 86 if code ^= 0 87 then do; 88 call sub_err_ (code, "alphabetize_strings_", "h", null, (0), "Cannot get temporary segments."); 89 go to retry; 90 end; 91 92 /* build a new array of string descriptors */ 93 /* transform strings containing control chars or capital letters */ 94 95 new_data_p = temp_ptrs (1); 96 buffer_p = temp_ptrs (2); 97 data_p = pm_data_p; 98 max_seglen = 4 * sys_info$max_seg_size; 99 buffer_len = 0; 100 101 do i = 1 to pm_count; 102 str_p = sort_data (i).string_p; 103 str_len = sort_data (i).string_len; 104 if verify (cstring, small_letters) = 0 105 then do; /* plain vanilla string, use in place */ 106 new_sort_data (i) = sort_data (i); 107 go to next_string; 108 end; 109 110 if buffer_len + 2*str_len + 1 > max_seglen /* buffer is full */ 111 then do; /* switch to next temp seg */ 112 if buffer_p = temp_ptrs (3) /* already used spare temp seg */ 113 then call sub_err_ (error_table_$action_not_performed, "alphabetize_strings_", "s", null, (0), 114 "Temporary storage limit exceeded."); 115 116 call ascii_to_abcdef_ (buffer, buffer); /* rearrange char codes so letters precede all else */ 117 buffer_p = temp_ptrs (3); 118 buffer_len = 0; 119 end; 120 121 saved_blen = buffer_len; 122 if search (cstring, capital_letters) ^= 0 123 then do; 124 substr (buffer, buffer_len + 1, str_len + 1) = translate (cstring, small_letters, capital_letters); 125 buffer_len = buffer_len + str_len + 1; /* extra +1 to insert SPACE */ 126 end; 127 128 substr (buffer, buffer_len+1, str_len) = cstring; 129 buffer_len = buffer_len + str_len; 130 131 new_sort_data (i).string_p = addr (buf_vector (saved_blen+1)); 132 new_sort_data (i).string_len = buffer_len - saved_blen; 133 next_string: 134 end; 135 136 call ascii_to_abcdef_ (buffer, buffer); /* rearrange char codes so letters precede all else */ 137 138 call sort_strings_$indirect (new_data_p, pm_count, data_p); 139 140 call cleaner; 141 142 return; 143 144 cleaner: proc; 145 146 if temp_ptrs (1) ^= null 147 then call release_temp_segments_ ("alphabetize_strings_", temp_ptrs, code); 148 149 end cleaner; 150 151 152 end alphabetize_strings_; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 11/18/82 1629.0 alphabetize_strings_.pl1 >dumps>old>recomp>alphabetize_strings_.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 131 ascii_to_abcdef_ 000024 constant entry external dcl 78 ref 116 136 buf_vector based char(1) array unaligned dcl 49 set ref 131 buffer based char unaligned dcl 48 set ref 116* 116* 124* 128* 136* 136* buffer_len 000117 automatic fixed bin(21,0) dcl 31 set ref 99* 110 116 116 116 116 118* 121 124 124 125* 125 128 128 129* 129 132 136 136 136 136 buffer_p 000114 automatic pointer dcl 29 set ref 96* 112 116 116 117* 124 128 131 136 136 capital_letters 000007 constant char(26) initial unaligned dcl 58 ref 122 124 cleanup 000126 stack reference condition dcl 64 ref 83 code 000100 automatic fixed bin(35,0) dcl 26 set ref 85* 86 88* 146* cstring based char unaligned dcl 50 ref 104 122 124 128 data_p 000110 automatic pointer dcl 28 set ref 97* 102 103 106 138* error_table_$action_not_performed 000012 external static fixed bin(35,0) dcl 56 set ref 112* get_temp_segments_ 000014 constant entry external dcl 74 ref 85 i 000123 automatic fixed bin(21,0) dcl 34 set ref 101* 102 103 106 106 131 132* max_seglen 000116 automatic fixed bin(21,0) dcl 30 set ref 98* 110 new_data_p 000112 automatic pointer dcl 28 set ref 95* 106 131 132 138* new_sort_data based structure array level 1 dcl 42 set ref 106* null builtin function dcl 69 ref 82 88 88 112 112 146 pm_count parameter fixed bin(21,0) dcl 21 set ref 11 101 138* pm_data_p parameter pointer dcl 20 ref 11 97 release_temp_segments_ 000016 constant entry external dcl 75 ref 146 saved_blen 000124 automatic fixed bin(21,0) dcl 35 set ref 121* 131 132 search builtin function dcl 69 ref 122 small_letters 000000 constant char(26) initial unaligned dcl 59 ref 104 124 sort_data based structure array level 1 dcl 40 ref 106 sort_entry based structure level 1 dcl 44 sort_strings_$indirect 000022 constant entry external dcl 77 ref 138 str_len 000122 automatic fixed bin(21,0) dcl 33 set ref 103* 104 110 122 124 124 125 128 128 129 str_p 000120 automatic pointer dcl 32 set ref 102* 104 122 124 128 string_len 1 based fixed bin(21,0) array level 2 in structure "new_sort_data" dcl 42 in procedure "alphabetize_strings_" set ref 132* string_len 1 based fixed bin(21,0) array level 2 in structure "sort_data" dcl 40 in procedure "alphabetize_strings_" ref 103 string_p based pointer array level 2 in structure "sort_data" packed unaligned dcl 40 in procedure "alphabetize_strings_" ref 102 string_p based pointer array level 2 in structure "new_sort_data" packed unaligned dcl 42 in procedure "alphabetize_strings_" set ref 131* sub_err_ 000020 constant entry external dcl 76 ref 88 112 substr builtin function dcl 69 set ref 124* 128* sys_info$max_seg_size 000010 external static fixed bin(21,0) dcl 55 ref 98 temp_ptrs 000102 automatic pointer array dcl 27 set ref 82* 85* 95 96 112 117 146 146* translate builtin function dcl 69 ref 124 verify builtin function dcl 69 ref 104 NAMES DECLARED BY EXPLICIT CONTEXT. alphabetize_strings_ 000072 constant entry external dcl 11 cleaner 000570 constant entry internal dcl 144 ref 83 140 next_string 000521 constant label dcl 133 ref 107 retry 000134 constant label dcl 85 ref 89 THERE WERE NO NAMES DECLARED BY CONTEXT OR IMPLICATION. STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 1574 1622 1431 1604 Length 2006 1431 26 147 142 0 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME alphabetize_strings_ 144 external procedure is an external procedure. on unit on line 83 64 on unit cleaner 84 internal procedure is called by several nonquick procedures. STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME alphabetize_strings_ 000100 code alphabetize_strings_ 000102 temp_ptrs alphabetize_strings_ 000110 data_p alphabetize_strings_ 000112 new_data_p alphabetize_strings_ 000114 buffer_p alphabetize_strings_ 000116 max_seglen alphabetize_strings_ 000117 buffer_len alphabetize_strings_ 000120 str_p alphabetize_strings_ 000122 str_len alphabetize_strings_ 000123 i alphabetize_strings_ 000124 saved_blen alphabetize_strings_ THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. alloc_cs call_ext_out_desc call_ext_out call_int_this call_int_other return enable shorten_stack ext_entry int_entry THE FOLLOWING EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. ascii_to_abcdef_ get_temp_segments_ release_temp_segments_ sort_strings_$indirect sub_err_ THE FOLLOWING EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. error_table_$action_not_performed sys_info$max_seg_size LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC 11 000066 82 000077 83 000112 85 000134 86 000163 88 000165 89 000240 95 000241 96 000243 97 000245 98 000251 99 000255 101 000256 102 000265 103 000271 104 000275 106 000307 107 000315 110 000316 112 000324 116 000403 117 000426 118 000430 121 000431 122 000433 124 000447 125 000471 128 000476 129 000503 131 000505 132 000515 133 000521 136 000523 138 000546 140 000562 142 000566 144 000567 146 000575 149 000630 ----------------------------------------------------------- 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