$pascal '92071-1X035 REV.2041 800626'$ $heap 0$ $subprogram$ PROGRAM LINE_; { * *NAME: LINE_ *SOURCE: 92071-18035 *RELOC: 92071-16035 *PGMR: DAVE NEFF * **************************************************************** * (C) COPYRIGHT HEWLETT-PACKARD COMPANY, 1980. ALL RIGHTS * * RESERVED. NO PART OF THIS PROGRAM MAY BE PHOTOCOPIED, * * REPRODUCED OR TRANSLATED TO ANOTHER PROGRAM LANGUAGE WITHOUT * * THE PRIOR WRITTEN CONSENT OF HEWLETT-PACKARD COMPANY. * **************************************************************** } {LINE_ is a routine which reads a string from the input file, echoes and parses the line. It is used by segments 1 and 4, or can be relocated with the main. The segment option allows for smaller partition requirements, but slower response by the BUILD prompt.} {Read in the global constants, variables and types.} $include 'BUGBL'$ PROCEDURE namr(VAR buffer:namr_parse_buffer; VAR inline:input_line; length:integer; VAR istrc:integer);external; {line_read gets a line from the ifile device or file, returns the line of text in inlin, and echoes the line to terminal or other lu if needed. It always causes a line feed to occur at the output files (for readability.) The line is also parsed once using namr, and stored in namr_buffer.} PROCEDURE line_read; $direct$ LABEL 99; VAR line_position:integer; {Position of last character on pending line of list device.} BEGIN {Resetting ifile in interactive cases allows recover from the single case, as well as the echoing feature using only 2 file dcb's (rather than 3).} IF interactive THEN reset(ifile); {read entire line, and set eoln(ifile) false unless its a .} {A here sets eof(ifile) true but not eoln(ifile).} IF eof(ifile) THEN BEGIN {An unexpected eof took place. Recover in the interactive case, but end in the command file case.} IF interactive THEN BEGIN rewrite(ifile); {Skip a line.} writeln(ofile); IF echo_write THEN writeln(ifile); IF NOT terminal_outfile THEN writeln(ofile); {Make sure the proper error message will occur.} namr_buffer.types.param1:=null; END ELSE {Not an interactive run of BUILD.} build_ended:=true; goto 99; END ELSE {No unexpected eof so read the line.} readln(ifile,inline); {Must rewrite here to allow writes after reads.} IF interactive THEN rewrite(ifile); {Echo the line to various devices if necessary.} {The length is specified less than 72 to prevent problems due to overwriting on one line. This is no problem, but just looks bad. When the output file is not a terminal, linepos insures the proper truncation will occur. This does not work for the terminal output file case, hence the maximum prompt length is used to determine truncation.} IF terminal_outfile THEN line_position:=39 ELSE line_position:=linepos(ofile); IF echo_read THEN writeln(ofile,inline:(line_length-line_position)); {Send a blank line to output files.} writeln(ofile); IF echo_write THEN writeln(ifile); {Do the first parse now.} istrc:=1; namr(namr_buffer,inline,line_length,istrc); {Did the user type any control string? If so, set the corresponding global booleans true.} IF (namr_buffer.types.param1=ascii) AND (namr_buffer.param1.command[1]='/') AND (namr_buffer.param1.file_name[3]=space1) THEN CASE namr_buffer.param1.command[2] OF 'A': abort:=true; 'C': completed_partitioning:=true; 'E': build_ended:=true; 'R': restart_partitioning:=true; OTHERWISE END; slash_control:=abort OR build_ended OR completed_partitioning OR restart_partitioning; 99: END;.{line_read}