COMPILATION LISTING OF SEGMENT parse_command_ Compiled by: Multics PL/I Compiler, Release 27d, of October 11, 1982 Compiled at: Honeywell LISD Phoenix, System M Compiled on: 11/15/82 1703.6 mst Mon 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 parse_command_: proc (command_line, p, ec); 12 13 /* Procedure to parse the command_line string into a structure 14* containing one element per token up to the maximum requested */ 15 16 dcl command_line char (*); 17 dcl p ptr; /* pointer to the structure we fill in */ 18 dcl ec fixed bin (35); /* error code */ 19 dcl len fixed bin; /* general index variable for length */ 20 dcl i fixed bin; /* do index */ 21 dcl start fixed bin; /* starting position of the token */ 22 dcl line char (128); /* internal copy of the command line */ 23 dcl first char (1) based (addr (line)); /* first char of the line */ 24 dcl quote char (1) int static init (""""); /* a quote char for compare */ 25 dcl space_or_tab char (2) int static init (" "); /* space and tab chars */ 26 dcl nl char (1) int static init (" 27 "); /* a new line char */ 28 dcl (search, verify, length, substr, index) builtin; 29 30 dcl 1 elements aligned based (p), /* this is the structure we fill in */ 31 2 max_wanted fixed bin, /* the number of tokens to look for */ 32 2 n fixed bin, /* number of valid tokens */ 33 2 token (max_wanted) char (64) var; /* save exact length with each */ 34 35 dcl error_table_$noarg fixed bin (35) ext static; 36 dcl error_table_$bigarg fixed bin (35) ext static; 37 dcl error_table_$unbalanced_quotes ext fixed bin (35); 38 39 40 n = 0; /* initialize to none found */ 41 len = length (command_line); /* how long is it? */ 42 if len > 127 then do; /* if too long to leave trailing blank */ 43 ec = error_table_$bigarg; /* give a code */ 44 return; /* and quit now */ 45 end; 46 line = command_line; /* copy the string */ 47 i = index (line, nl); /* see if there was a nl char */ 48 if i > 0 then line = substr (line, 1, i - 1); /* and drop it and the rest */ 49 do i = 1 to max_wanted; /* look for max_wanted tokens */ 50 len = verify (line, space_or_tab); /* correct for leading spaces or tabs */ 51 if len = 0 then go to tally; /* nothing left so quit */ 52 if len > 1 then line = substr (line, len); /* left justify */ 53 start = 1; /* assume the first char is good */ 54 if first = quote then do; /* different action for quoted string */ 55 start = 2; /* so we will skip the quote later */ 56 len = index (substr (line, 2), quote); /* find the closing quote */ 57 if len = 0 then do; 58 ec = error_table_$unbalanced_quotes; /* too bad */ 59 return; /* return what we found */ 60 end; 61 end; 62 else len = search (line, space_or_tab); /* find end of token */ 63 if len > 64 then do; /* complain if too long */ 64 ec = error_table_$bigarg; 65 return; /* return what we found */ 66 end; 67 n = n + 1; /* add one more token to the list */ 68 token (n) = substr (line, start, len - 1); 69 line = substr (line, len + start); /* get ready for the next one...left shift */ 70 end; 71 72 tally: if n = 0 then /* if none found, give an error */ 73 ec = error_table_$noarg; 74 else ec = 0; 75 return; 76 77 end parse_command_; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 11/15/82 1508.5 parse_command_.pl1 >dumps>old>recomp>parse_command_.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. command_line parameter char unaligned dcl 16 ref 11 41 46 ec parameter fixed bin(35,0) dcl 18 set ref 11 43* 58* 64* 72* 74* elements based structure level 1 dcl 30 error_table_$bigarg 000012 external static fixed bin(35,0) dcl 36 ref 43 64 error_table_$noarg 000010 external static fixed bin(35,0) dcl 35 ref 72 error_table_$unbalanced_quotes 000014 external static fixed bin(35,0) dcl 37 ref 58 first based char(1) unaligned dcl 23 ref 54 i 000101 automatic fixed bin(17,0) dcl 20 set ref 47* 48 48 49* index builtin function dcl 28 ref 47 56 len 000100 automatic fixed bin(17,0) dcl 19 set ref 41* 42 50* 51 52 52 56* 57 62* 63 68 69 length builtin function dcl 28 ref 41 line 000103 automatic char(128) unaligned dcl 22 set ref 46* 47 48* 48 50 52* 52 54 56 62 68 69* 69 max_wanted based fixed bin(17,0) level 2 dcl 30 ref 49 n 1 based fixed bin(17,0) level 2 dcl 30 set ref 40* 67* 67 68 72 nl constant char(1) initial unaligned dcl 26 ref 47 p parameter pointer dcl 17 ref 11 40 49 67 67 68 68 72 quote constant char(1) initial unaligned dcl 24 ref 54 56 search builtin function dcl 28 ref 62 space_or_tab constant char(2) initial unaligned dcl 25 ref 50 62 start 000102 automatic fixed bin(17,0) dcl 21 set ref 53* 55* 68 69 substr builtin function dcl 28 ref 48 52 56 68 69 token 2 based varying char(64) array level 2 dcl 30 set ref 68* verify builtin function dcl 28 ref 50 NAMES DECLARED BY EXPLICIT CONTEXT. parse_command_ 000007 constant entry external dcl 11 tally 000223 constant label dcl 72 ref 51 NAME DECLARED BY CONTEXT OR IMPLICATION. addr builtin function ref 54 STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 712 730 636 722 Length 1076 636 16 132 53 0 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME parse_command_ 103 external procedure is an external procedure. STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME parse_command_ 000100 len parse_command_ 000101 i parse_command_ 000102 start parse_command_ 000103 line parse_command_ THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. return ext_entry_desc NO EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. THE FOLLOWING EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. error_table_$bigarg error_table_$noarg error_table_$unbalanced_quotes LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC 11 000003 40 000022 41 000026 42 000027 43 000031 44 000033 46 000034 47 000040 48 000051 49 000056 50 000065 51 000077 52 000100 53 000112 54 000114 55 000120 56 000122 57 000133 58 000134 59 000140 61 000141 62 000142 63 000154 64 000157 65 000163 67 000164 68 000170 69 000206 70 000221 72 000223 74 000234 75 000235 ----------------------------------------------------------- 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