COMPILATION LISTING OF SEGMENT manipulate_pathname_ Compiled by: Multics PL/I Compiler, Release 27d, of October 11, 1982 Compiled at: Honeywell LISD Phoenix, System M Compiled on: 11/15/82 1628.2 mst Mon Options: optimize map 1 /* *********************************************************** 2* * * 3* * Copyright, (C) Honeywell Information Systems Inc., 1982 * 4* * * 5* * Copyright (c) 1974 by Massachusetts Institute of * 6* * Technology and Honeywell Information Systems, Inc. * 7* * * 8* * Copyright (c) 1972 by Massachusetts Institute of * 9* * Technology and Honeywell Information Systems, Inc. * 10* * * 11* *********************************************************** */ 12 13 14 manipulate_pathname_: 15 procedure (); 16 17 /* "manipulate_pathname_" -- procedure that contains */ 18 /* several routines to manipulate pathnames (as opposed to */ 19 /* dirnames and enames). Such manipulations include getting */ 20 /* the equivalent pathname which is of the shortest character */ 21 /* length, the equivalent pathname which contains only */ 22 /* primary enames, etc. It is a feature of the routines that */ 23 /* the caller may use the same string for input and output */ 24 /* pathnames. Also note that the concept of directory links */ 25 /* is ignored by these routines. */ 26 27 /* Originally coded by D. M. Wells in Spring, 1973. */ 28 /* Last modified by D. M. Wells to February, 1974 to prepare */ 29 /* for installation. */ 30 31 32 /* * * * * PARAMETER DECLARATIONS * * * * * * * */ 33 34 declare 35 (bv_err_code bit (36) aligned, 36 bv_input_pathname character (*), 37 bv_output_pathname character (*)) 38 parameter; 39 40 /* * * * * AUTOMATIC STORAGE DECLARATIONS * * * */ 41 42 declare 43 ((indx, output_ename_indx) fixed binary (17), 44 (cur_loc, name_len, next_loc, output_ename_len) fixed binary (24), 45 desired_type character (8), 46 name character (32), 47 (in_name, out_name) character (168) varying, 48 (area_ptr, link_ptr, names_ptr) pointer) 49 automatic; 50 51 declare 52 1 entry_branch unaligned automatic, 53 2 type bit (2) unaligned, 54 2 nnames bit (16) unaligned, 55 2 nrp bit (18) unaligned, 56 2 dtm bit (36) unaligned, 57 2 dtu bit (36) unaligned, 58 2 mode bit (5) unaligned, 59 2 padding bit (13) unaligned, 60 2 records bit (18) unaligned; 61 62 /* * * * * DEFINED DECLARATIONS * * * * * * * * */ 63 64 declare 65 1 link_branch unaligned defined (entry_branch), 66 2 type bit (2) unaligned, 67 2 nnames bit (16) unaligned, 68 2 nrp bit (18) unaligned, 69 2 dtem bit (36) unaligned, 70 2 dtd bit (36) unaligned, 71 2 pnl bit (18) unaligned, 72 2 pnrp bit (18) unaligned; 73 74 /* * * * * BASED & TEMPLATE DECLARATIONS * * * * */ 75 76 declare 77 (based_names (1 : 1) character (32) aligned, 78 based_link_pathname character (binary (link_branch.pnl, 18)) aligned, 79 based_area area) 80 based; 81 82 /* * * * * EXTERNAL STATIC DECLARATIONS * * * * */ 83 84 declare 85 error_table_$bad_segment 86 bit (36) aligned external static; 87 88 89 /* * * * * ENTRY & PROCEDURE DECLARATIONS * * * */ 90 91 declare 92 establish_cleanup_proc_ constant entry (entry), 93 get_system_free_area_ constant entry () returns (ptr), 94 hcs_$status_ constant entry (char (*), char (*), fixed bin (1), ptr, ptr, bit (36) aligned); 95 96 declare 97 (addr, binary, index, length, max, pointer, reverse, substr, verify) 98 builtin; 99 100 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 101 102 /* Entry point to prepare the shortest equivalent */ 103 /* pathname (as measured in characters). */ 104 105 get_shortest_pathname_: 106 entry (bv_input_pathname, bv_output_pathname, bv_err_code); 107 108 desired_type = "shortest"; 109 110 goto common_code; 111 112 /* * * * * * * * * * * * * * * * * * * * * * * * */ 113 114 /* Entry point to prepare the longest equivalent */ 115 /* pathname (as measured in characters). */ 116 117 get_longest_pathname_: 118 entry (bv_input_pathname, bv_output_pathname, bv_err_code); 119 120 desired_type = "longest "; 121 goto common_code; 122 123 /* * * * * * * * * * * * * * * * * * * * * * * * */ 124 125 /* Entry point to prepare the equivalent pathname */ 126 /* using only primary entry names. */ 127 128 get_primary_pathname_: 129 entry (bv_input_pathname, bv_output_pathname, bv_err_code); 130 131 desired_type = "primary "; 132 133 goto common_code; 134 135 /* * * * * * * * * * * * * * * * * * * * * * * * */ 136 137 common_code: 138 name_len = length (bv_input_pathname) - verify (reverse (bv_input_pathname), " ") + 1; 139 in_name = substr (bv_input_pathname, 1, name_len) || ">"; 140 141 cur_loc = 1; 142 out_name = ""; 143 144 area_ptr = get_system_free_area_ (); 145 names_ptr = null (); 146 link_ptr = null (); 147 148 entry_branch.nrp = ""b; 149 link_branch.pnrp = ""b; 150 151 call establish_cleanup_proc_ (cleanup); 152 153 do while ("1"b); 154 next_loc = index (substr (in_name, cur_loc + 1), ">"); 155 if next_loc = 0 then goto almost_done; 156 157 next_loc = cur_loc + next_loc; 158 159 call hcs_$status_ (substr (in_name, 1, max (cur_loc - 1, 1)), substr (in_name, cur_loc + 1, next_loc - cur_loc - 1), 160 0b, addr (entry_branch), area_ptr, bv_err_code); 161 if bv_err_code ^= ""b 162 then return; 163 164 names_ptr = pointer (area_ptr, entry_branch.nrp); 165 entry_branch.nrp = ""b; 166 167 if entry_branch.type = "00"b 168 then link_ptr = pointer (area_ptr, link_branch.pnrp); 169 else link_ptr = null (); 170 link_branch.pnrp = ""b; 171 172 if desired_type = "primary " then do; 173 output_ename_indx = 1; 174 output_ename_len = length (names_ptr -> based_names (1)) - verify (reverse (names_ptr -> based_names (1)), " ") + 1; 175 out_name = out_name || ">" || substr (names_ptr -> based_names (output_ename_indx), 1, output_ename_len); 176 end; 177 else if desired_type = "shortest" then do; 178 output_ename_len = 33; 179 output_ename_indx = 0; 180 181 do indx = 1 by 1 to binary (entry_branch.nnames, 16); 182 name = names_ptr -> based_names (indx); 183 name_len = length (name) - verify (reverse (name), " ") + 1; 184 if name_len < output_ename_len then do; 185 output_ename_indx = indx; 186 output_ename_len = name_len; 187 end; 188 end; 189 out_name = out_name || ">" || substr (names_ptr -> based_names (output_ename_indx), 1, output_ename_len); 190 end; 191 else if desired_type = "longest " then do; 192 output_ename_len = -1; 193 output_ename_indx = 0; 194 195 do indx = 1 by 1 to binary (entry_branch.nnames, 16); 196 name = names_ptr -> based_names (indx); 197 name_len = length (name) - verify (reverse (name), " ") + 1; 198 if name_len > output_ename_len then do; 199 output_ename_indx = indx; 200 output_ename_len = name_len; 201 end; 202 end; 203 out_name = out_name || ">" || substr (names_ptr -> based_names (output_ename_indx), 1, output_ename_len); 204 end; 205 else goto something_got_messed_up_in_here; 206 207 call cleanup (); 208 209 cur_loc = next_loc; 210 end; 211 212 /* * * * * * * * * * * * * * * * * * * */ 213 214 almost_done: 215 bv_output_pathname = out_name; 216 217 bv_err_code = ""b; 218 219 return; 220 221 /* * * * * * * * * * * * * * * * * * * * * * * * */ 222 223 something_got_messed_up_in_here: 224 bv_err_code = error_table_$bad_segment; /* only this time, its us that's bad */ 225 226 return; 227 228 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 229 230 cleanup: 231 procedure (); 232 233 /* * * * * * * * * * * * * * * * * * * * * * * * */ 234 235 if names_ptr ^= null () 236 then free names_ptr -> based_names in (area_ptr -> based_area); 237 238 if link_ptr ^= null () 239 then free link_ptr -> based_link_pathname in (area_ptr -> based_area); 240 else if (entry_branch.type = "00"b) & (link_branch.pnrp ^= ""b) 241 then free pointer (area_ptr, link_branch.pnrp) -> based_link_pathname in (area_ptr -> based_area); 242 243 return; 244 245 end cleanup; 246 247 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 248 249 end manipulate_pathname_; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 11/15/82 1504.5 manipulate_pathname_.pl1 >dumps>old>recomp>manipulate_pathname_.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 96 ref 159 159 area_ptr 000246 automatic pointer dcl 42 set ref 144* 159* 164 167 235 238 240 240 based_area based area(1024) dcl 76 ref 235 238 240 based_link_pathname based char dcl 76 ref 238 240 based_names based char(32) array dcl 76 ref 174 174 175 182 189 196 203 235 binary builtin function dcl 96 ref 181 195 238 238 240 240 bv_err_code parameter bit(36) dcl 34 set ref 105 117 128 159* 161 217* 223* bv_input_pathname parameter char unaligned dcl 34 ref 105 117 128 137 137 139 bv_output_pathname parameter char unaligned dcl 34 set ref 105 117 128 214* cur_loc 000102 automatic fixed bin(24,0) dcl 42 set ref 141* 154 157 159 159 159 159 159 159 209* desired_type 000106 automatic char(8) unaligned dcl 42 set ref 108* 120* 131* 172 177 191 entry_branch 000254 automatic structure level 1 packed unaligned dcl 51 set ref 149* 149 159 159 167 167 170* 170 238 238 238 238 240 240 240 240 240 240 240 240 error_table_$bad_segment 000010 external static bit(36) dcl 84 ref 223 establish_cleanup_proc_ 000012 constant entry external dcl 91 ref 151 get_system_free_area_ 000014 constant entry external dcl 91 ref 144 hcs_$status_ 000016 constant entry external dcl 91 ref 159 in_name 000120 automatic varying char(168) dcl 42 set ref 139* 154 159 159 159 159 index builtin function dcl 96 ref 154 indx 000100 automatic fixed bin(17,0) dcl 42 set ref 181* 182 185* 195* 196 199* length builtin function dcl 96 ref 137 174 183 197 link_branch defined structure level 1 packed unaligned dcl 64 link_ptr 000250 automatic pointer dcl 42 set ref 146* 167* 169* 238 238 max builtin function dcl 96 ref 159 159 name 000110 automatic char(32) unaligned dcl 42 set ref 182* 183 183 196* 197 197 name_len 000103 automatic fixed bin(24,0) dcl 42 set ref 137* 139 183* 184 186 197* 198 200 names_ptr 000252 automatic pointer dcl 42 set ref 145* 164* 174 174 175 182 189 196 203 235 235 next_loc 000104 automatic fixed bin(24,0) dcl 42 set ref 154* 155 157* 157 159 159 209 nnames 0(02) 000254 automatic bit(16) level 2 packed unaligned dcl 51 set ref 181 195 nrp 0(18) 000254 automatic bit(18) level 2 packed unaligned dcl 51 set ref 148* 164 165* out_name 000173 automatic varying char(168) dcl 42 set ref 142* 175* 175 189* 189 203* 203 214 output_ename_indx 000101 automatic fixed bin(17,0) dcl 42 set ref 173* 175 179* 185* 189 193* 199* 203 output_ename_len 000105 automatic fixed bin(24,0) dcl 42 set ref 174* 175 178* 184 186* 189 192* 198 200* 203 pnl 3 defined bit(18) level 2 packed unaligned dcl 64 ref 238 238 240 240 pnrp 3(18) defined bit(18) level 2 packed unaligned dcl 64 set ref 149* 167 170* 240 240 pointer builtin function dcl 96 ref 164 167 240 reverse builtin function dcl 96 ref 137 174 183 197 substr builtin function dcl 96 ref 139 154 159 159 159 159 175 189 203 type 000254 automatic bit(2) level 2 packed unaligned dcl 51 set ref 167 240 verify builtin function dcl 96 ref 137 174 183 197 NAMES DECLARED BY EXPLICIT CONTEXT. almost_done 000705 constant label dcl 214 ref 155 cleanup 000723 constant entry internal dcl 230 ref 151 151 207 common_code 000126 constant label dcl 137 ref 110 121 133 get_longest_pathname_ 000056 constant entry external dcl 117 get_primary_pathname_ 000103 constant entry external dcl 128 get_shortest_pathname_ 000031 constant entry external dcl 105 manipulate_pathname_ 000017 constant entry external dcl 14 something_got_messed_up_in_here 000716 constant label dcl 223 ref 191 NAME DECLARED BY CONTEXT OR IMPLICATION. null builtin function ref 145 146 169 235 238 STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 1134 1154 1001 1144 Length 1336 1001 20 145 132 0 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME manipulate_pathname_ 226 external procedure is an external procedure. cleanup 68 internal procedure is assigned to an entry variable. STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME manipulate_pathname_ 000100 indx manipulate_pathname_ 000101 output_ename_indx manipulate_pathname_ 000102 cur_loc manipulate_pathname_ 000103 name_len manipulate_pathname_ 000104 next_loc manipulate_pathname_ 000105 output_ename_len manipulate_pathname_ 000106 desired_type manipulate_pathname_ 000110 name manipulate_pathname_ 000120 in_name manipulate_pathname_ 000173 out_name manipulate_pathname_ 000246 area_ptr manipulate_pathname_ 000250 link_ptr manipulate_pathname_ 000252 names_ptr manipulate_pathname_ 000254 entry_branch manipulate_pathname_ THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. alloc_cs cat_realloc_cs call_ext_out_desc call_ext_out call_int_this return shorten_stack ext_entry ext_entry_desc int_entry free_based THE FOLLOWING EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. establish_cleanup_proc_ get_system_free_area_ hcs_$status_ THE FOLLOWING EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. error_table_$bad_segment LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC 14 000016 105 000024 108 000051 110 000053 117 000054 120 000076 121 000100 128 000101 131 000123 133 000125 137 000126 139 000147 141 000167 142 000172 144 000173 145 000202 146 000204 148 000205 149 000207 151 000210 154 000222 155 000236 157 000237 159 000241 161 000327 164 000333 165 000340 167 000342 169 000353 170 000355 172 000357 173 000362 174 000364 175 000402 176 000443 177 000445 178 000447 179 000451 181 000452 182 000463 183 000471 184 000507 185 000511 186 000513 188 000515 189 000517 190 000560 191 000562 192 000564 193 000566 195 000567 196 000600 197 000606 198 000624 199 000626 200 000630 202 000632 203 000634 204 000675 207 000676 209 000702 210 000704 214 000705 217 000714 219 000715 223 000716 226 000721 230 000722 235 000730 238 000737 240 000754 243 000777 ----------------------------------------------------------- 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