!+B! WHAT_LINE.TPU - Displays a message with the current line number,A! total number of lines in the file, and the percentage.!-!-procedure lsi_what_line ! What line am I on?1local this_position, ! marker - current position> start_of_buffer, ! marker - beginning of current bufferC this_line_position, ! marker - position at start of this_line5 total_lines, ! integer - total lines in buffer: this_line, ! integer - line number of current guess: percent; ! integer - percent of way through buffer! Initialization9total_lines := get_info (current_buffer, "record_count");this_position := mark (none);1start_of_buffer := beginning_of (current_buffer);'this_line := lsi_determine_line_number;>! TPU will truncate numbers on division; make it round instead5percent := (((this_line * 1000) / total_lines)+5)/10;! Display message 6message (fao ("You are on line !SL out of !SL (!SL%)",) this_line, total_lines, percent)); endprocedure; #PROCEDURE lsi_determine_line_number1LOCAL this_position, ! marker - current position> start_of_buffer, ! marker - beginning of current bufferC this_line_position, ! marker - position at start of this_line5 total_lines, ! integer - total lines in buffer: this_line, ! integer - line number of current guess? high_line, ! integer - high line limit for binary search> low_line; ! integer - low line limit for binary search! Initialization=total_lines := get_info (current_buffer, "record_count") + 1;this_position := mark (none);/if this_position = end_of (current_buffer) then return total_lines - 1else low_line := 1endif;1start_of_buffer := beginning_of (current_buffer);high_line := total_lines;! Binary searchloop% exitif high_line - low_line <= 1;9 this_line := low_line + ((high_line - low_line) / 2); position (start_of_buffer);" move_vertical (this_line - 1);' if mark (none) > this_position then high_line := this_line; else low_line := this_line;$ if mark (none) = this_position then high_line := this_line; endif; endif;endloop;position (this_position);return low_line(ENDPROCEDURE ! lsi_determine_line_number