1. ed.ex / edx.ex :: get_err_line()

---------------------------------------------- 
--      replace each call to:               -- 
--              goto_line(start_line, 1)    -- 
--              set_err_pointer()           -- 
--              show_message()              -- 
--                                          -- 
--      with a call to:                     -- 
--              show_error_message()        -- 
---------------------------------------------- 
procedure show_error_message() 
     
    -- set cursor at point of error 
    goto_line(start_line, start_col) 
    previous_word() 
     
    /*   

	display error message from ex.err 
	from ex. err on the status line 
	(top line menu bar):  
    */ 
    if length(error_message) > 0 then 
	set_top_line("") 
	puts(SCREEN, error_message) 
	normal_video() 
    end if 
     
    set_position(s_line, s_col) 
     
end procedure 
 
function get_err_line() 
    ------------------------------------------------------- 
    --    derived from Irv Mulling's, gneui.ex           -- 
    --    which was a major rewrite of my program,       -- 
    --    gneui.ex, which was derived from               -- 
    --    get_err_line(). All the world's a circle.      --        
    ------------------------------------------------------- 
    object file, file_lines 
    natural colon_pos = 0 
     
    file_lines = read_lines("ex.err") 
    if atom(file_lines) then 
	error_message = "" 
	return "" 
	break 
    else 
	error_message = trim_tail(file_lines[2]) 
	for n = 1 to length(file_lines) do 
	    if find('^', file_lines[n]) then 
		colon_pos = find(':',file_lines[1]) 
		start_col = find('^', expand_tabs(STANDARD_TAB_WIDTH, file_lines[n])) 
		file = file_lines[1][1..colon_pos-1] 
		start_line = to_number(file_lines[1][colon_pos+1..$]) 
		return file 
	    end if 
	end for 
    end if 
return "" 
end function 
new topic     » topic index » view message » categorize

2. Re: ed.ex / edx.ex :: get_err_line()

Sometimes I just can't leave well enough alone....

---------------------------------------------- 
--      replace each call to:               -- 
--              goto_line(start_line, 1)    -- 
--              set_err_pointer()           -- 
--              show_message()              -- 
--                                          -- 
--      with a call to:                     -- 
--              show_error_message()        -- 
---------------------------------------------- 
procedure show_error_message() 
     
    goto_line(start_line, start_col) 
    -- set cursor at point of error 
    --  exactly on the column  
    --  as the caret in 'ex.err' 
    arrow_left() 
     
    --  or use previous_word() to position  
    --  the cursor at the beginning  
    --  of the last word/command 
    --  previous_word() 
     
    --      /*   
    --          display error message from ex.err 
    --          from ex. err on the status line 
    --          (top line menu bar):  
    --      */ 
    if length(error_message) > 0 then 
	set_top_line("") 
	puts(SCREEN, error_message) 
	normal_video() 
    end if 
     
    set_position(s_line, s_col) 
     
    file_history = update_history(file_history, "ex.err") 
     
--      After a delay of 2 seconds, a "View ex.err  
--      prompt is   displayed on the top line 
--      message bar. If you comment out this 
--      code segment, you can still load 'ex.err' 
--      in a new window pane by "ESCAPE + 'o'         
    delay(2) 
    set_top_line("") 
    puts(SCREEN, " View \'ex.err\' ? ") yn() 
    if yes then 
	if length(window_list) >= 5 then 
	    shell( "more ex.err") 
	else 
	    add_queue(ESCAPE & 'o' & "ex.err" & CR) 
	end if 
    else 
	 
    end if 
     
end procedure 
 
 
-- mdx 
function get_err_line() 
    ------------------------------------------------------- 
    --    derived from Irv Mulling's, gneui.ex           -- 
    --    which was a major rewrite of my program,       -- 
    --    gneui.ex, which was derived from               -- 
    --    get_err_line(). All the world's a circle.      --        
    ------------------------------------------------------- 
    object file_lines 
    natural colon_pos = 0 
     
    file_lines = read_lines("ex.err") 
    if atom(file_lines) then 
	error_message = "" 
	return "" 
	break 
    else 
	error_message = trim_tail(file_lines[2]) 
	for n = 1 to length(file_lines) do 
	    if find('^', file_lines[n]) then 
		colon_pos = find(':',file_lines[1]) 
		start_col = find('^', expand_tabs(STANDARD_TAB_WIDTH, file_lines[n]))-1 
		file_name = file_lines[1][1..colon_pos-1] 
		start_line = to_number(file_lines[1][colon_pos+1..$]) 
		return file_name 
	    end if 
	end for 
    end if 
    return "" 
end function 
 
new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu