[comp.os.vms] Line numbers in EVE

nigam%mwvms@MITRE.ARPA.UUCP (06/07/87)

--------
Does anyone know of a way to determine the line number when editing
a file with the EVE editor?  Something like the "." command
in EDT is wanted.
     
Alok C. Nigam
M14875%MWVM@MITRE.ORG
     

BOLTHOUSE%MCOPN1@eg.ti.COM.UUCP (06/08/87)

I can't help you with vanilla EVE.  But you can add this to your own
section file...  This comes with EVEPLUS, by the way.

David L. Bolthouse
Texas Instruments Defense Electronics Information Systems VAX System Support
McKinney, Texas

ma bell:    214.952.2059
internet:   bolthouse%mcopn1@ti-eg.com

------------------------------Cut here-------------------------------------
!+
!	WHAT.TPU - Displays a message with the current line number,
!		   total number of lines in the file, and the percentage.
!-
!

procedure eve_what_line		! What line am I on?

local this_position,		! marker - current position
      start_of_buffer,		! marker - beginning of current buffer
      this_line_position,	! marker - position at start of this_line
      total_lines,		! integer - total lines in buffer
      high_line,		! integer - high line limit for binary search
      low_line,			! integer - low line limit for binary search
      this_line,		! integer - line number of current guess
      percent;			! integer - percent of way through buffer

! Initialization

this_position := mark (none);
start_of_buffer := beginning_of (current_buffer);
total_lines := get_info (current_buffer, "record_count") + 1;
high_line := total_lines;
if this_position = end_of (current_buffer) then
    low_line := total_lines;
else
    low_line := 1;
endif;

! Binary search

loop
    exitif high_line - low_line <= 1;
    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;

! TPU will truncate numbers on division; make it round instead

percent := (((low_line * 1000) / total_lines)+5)/10;

! Display message and return to original position

message (fao ("You are on line !SL out of !SL (!SL%)",
	      low_line, total_lines, percent));
position (this_position);

endprocedure;

nigam%mwvms@MITRE.ARPA.UUCP (06/12/87)

--------
Thanks to everyone who responded to my query.
The EVE+ procedure most people pointed me to is just what I
needed.
     
Alok C. Nigam