PROCEDURE EDTP$Line_mode(Num_lines) !ctrl z (line mode) LOCAL command_name , continue_cmd, eve_cmd_line, term_char , old_position, original_line, org_line_length, new_line_length, command_index, line_number; continue_cmd := "CONTINUE"; ! ! Keep looping until we see something that will cause us to exit. ! Right now this is only the Change or Continue commands ! LOOP IF (Num_lines = EDTP$Single_line) THEN EDTP$x_line := READ_LINE('EDTP Command >'); ELSE message('Type CONTINUE to exit from line mode to screen mode'); EDTP$x_line := READ_LINE('*'); ENDIF; ! Save the original line in case this is a substitute command original_line := EDTP$x_line; org_line_length := LENGTH (original_line); ! If they don't type something, set up the continue command if org_line_length = 0 then EDTP$x_line := continue_cmd; endif; ! upshift the command line change_case(EDTP$x_line,upper); ! if continue cmd, return if EDTP$x_line = continue_cmd then message(" "); message(" "); return; endif; ! Did user enter a number only ??? line_number := int(EDTP$x_line); if line_number <> 0 then ! go to line number entered eve_line(line_number); return; endif; ! What command is it? command_name := EDTP$next_token('/',term_char); if command_name = EDTP$x_empty then if EDTP$x_line <> EDTP$x_empty then command_name := EDTP$x_line; else command_name := 'XXXX'; endif; endif; command_index := index(EDTP$x_commands,(' ' + command_name)); command_index := ((command_index + EDTP$x_command_length)-1) / EDTP$x_command_length; CASE command_index FROM 1 TO 18 [outrange]: message(command_name + ' not supported') ; [2]: pce_change_width; [3]: if (term_char = '/') then EDTP$exit(1); else exit; endif; [4]: if (term_char = '/') then EDTP$quit(1); else quit; endif; [5]: eve_include_file(EDTP$next_token(EDTP$x_empty,term_char)); [6]: eve_write_file(EDTP$next_token(EDTP$x_empty,term_char)); [7]: eve_buffer(EDTP$next_token(EDTP$x_empty,term_char)); [8]: EDTP$set; [9]: EDTP$show; [10]: if EDTP$x_line = EDTP$x_empty then EDTP$help ('EDTP HELP'); else EDTP$help ('EDTP LINE_MODE ' + EDTP$x_line); endif; exitif; [11]: ! Get the original line back because the case is important new_line_length := LENGTH (EDTP$x_line); EDTP$x_line := substr (original_line, (org_line_length - new_line_length) + 1, new_line_length); ! Skip over blanks and tabs looking for a valid substitution delimiter loop exitif (term_char <> ' ') AND (term_char <> ' '); term_char := substr (EDTP$x_line, 1, 1); EDTP$x_line := substr (EDTP$x_line, 2, length (EDTP$x_line)-1); endloop; EDTP$x_subs_term := term_char; old_position := Mark(none); EDTP$line_mode_substitute; POSITION(old_position); [12]: EDTP$delete_range; [13]: eve_type_all; [14]: spawn(""); [15]: EDTP$fill_parag; [16]: eve_trim; [17]: EDTP$eve_do(EDTP$next_token(EDTP$x_empty,term_char)); [18]: eve_line(int(EDTP$next_token(EDTP$x_empty,term_char))); ENDCASE; update(current_window); IF (Num_lines = EDTP$Single_line) THEN RETURN; ENDIF; endloop; ENDPROCEDURE;