1. edx.ex :: function get_err_line() replacement

The function trim_tail can replace the entire function "delete_trailing_white". The function to_number can replace the entire function "numeric"

-- this entire function: 
function delete_trailing_white(sequence name)                                                        
    -- get rid of blanks, tabs, newlines at end of string                                            
    while length(name) > 0 do                                                                        
        if find(name[length(name)], "\n\r\t ") then                                                  
            name = name[1..length(name)-1]                                                           
        else                                                                                         
            exit                                                                                     
        end if                                                                                       
    end while                                                                                        
    return name                                                                                      
end function 
-- can be replaced by using: 
trim_tail(sequence name, "\t\r\n ")  -- requires include std/text.e 
-- in each instance that delete_trailing_white(sequence name) is called 
 
 
-- likewise to_number(sequence text_in) can replace  
-- the entire routine: 
function numeric(sequence string)                                                                    
    -- convert digit string to an integer                                                            
    atom n                                                                                           
                                                                                                     
    n = 0                                                                                            
    for i = 1 to length(string) do                                                                   
        if string[i] >= '0' and string[i] <= '9' then                                                
            n = n * 10 + string[i] - '0'                                                             
            if not integer(n) then                                                                   
                return 0                                                                                        end if                                                                                   
        else                                                                                         
            exit                                                                                     
        end if                                                                                       
    end for                                                                                          
    return n                                                                                         
end function              
 
-- This function much more clear and concise than the original ed.ex/edx.ex code:                          
-- requires include std/convert.e for to_number(sequence text_in) 
function get_err_line() 
    ---------------------------------------- 
    --  derived from Irv Mulling's, gneui.ex 
    ----------------------------------------- 
    object file_lines 
    object file 
    object temp_line 
    object err_line 
    integer err_col = 0, i = 0 
     
    file_lines = read_lines("ex.err") 
    if atom(file_lines) then  
	--                  crash("Cannot find ex.err!\n")  
	error_message = "" 
	return "" 
	break    
    else 
	 
	error_message = trim_tail(file_lines[2]) 
	 
	for n = 1 to length(file_lines) do 
	    if match("^^^ call-back from external source",file_lines[n]) = 1 then 
		file_lines = file_lines[1..n-1] 
		exit 
	    end if 
	end for	 
	 
	-- trap & process euphoria error report; 
	for n = 1 to length(file_lines) do 
	    if find('^', file_lines[n]) then 
		i = find(':',file_lines[1]) 
		err_col = match("^", expand_tabs(STANDARD_TAB_WIDTH, file_lines[n]))-1 
		file = file_lines[1][1..i-1] 
		err_line = to_number(file_lines[1][i+1..$]) 
		start_col = err_col 
		start_line = err_line 
		return file 
	    end if  
	end for 
    end if 
end function  

Ken

new topic     » topic index » view message » categorize

2. Re: edx.ex :: function get_err_line() replacement

K_D_R said...

The function trim_tail can replace the entire function "delete_trailing_white". The function to_number can replace the entire function "numeric"

...

Ken

I previously added the K_D_R Linux line positioning patch to ed.ex, but I think I got something wrong.

Where is the latest "KDR edx"? I think it would be easier to swap edx for edx rather than depend on my patchwork upgrades.

_tom

new topic     » goto parent     » topic index » view message » categorize

3. Re: edx.ex :: function get_err_line() replacement

_tom said...

I previously added the K_D_R Linux line positioning patch to ed.ex, but I think I got something wrong.

Where is the latest "KDR edx"? I think it would be easier to swap edx for edx rather than depend on my patchwork upgrades.

Be careful. I know there has been some modification of ed.ex in the euphoria repo aside from KDR's stuff. In particular, I know I worked on the multi-line syntax highlighting. I don't know if he's been pulling those changes into his code.

Matt

new topic     » goto parent     » topic index » view message » categorize

4. Re: edx.ex :: function get_err_line() replacement

mattlewis said...
_tom said...

I previously added the K_D_R Linux line positioning patch to ed.ex, but I think I got something wrong.

Where is the latest "KDR edx"? I think it would be easier to swap edx for edx rather than depend on my patchwork upgrades.

Be careful. I know there has been some modification of ed.ex in the euphoria repo aside from KDR's stuff. In particular, I know I worked on the multi-line syntax highlighting. I don't know if he's been pulling those changes into his code.

Matt

Understood.

My changes are now going into a new SCM branch "Unstable_Document"

Someday, someone with "great authority" can merge them into 4.1 ...

_tom

new topic     » goto parent     » topic index » view message » categorize

5. Re: edx.ex :: function get_err_line() replacement

_tom said...
mattlewis said...
_tom said...

I previously added the K_D_R Linux line positioning patch to ed.ex, but I think I got something wrong.

Where is the latest "KDR edx"? I think it would be easier to swap edx for edx rather than depend on my patchwork upgrades.

Be careful. I know there has been some modification of ed.ex in the euphoria repo aside from KDR's stuff. In particular, I know I worked on the multi-line syntax highlighting. I don't know if he's been pulling those changes into his code.

Matt

Understood.

My changes are now going into a new SCM branch "Unstable_Document"

Someday, someone with "great authority" can merge them into 4.1 ...

_tom

I have been trying to "pull" the multi-line syntax code changes into my edx.ex code, but it appears a good bit more editing in the latest ed.ex/edx.ex, keywords.e, syncolor.e, and tokenize.e files will be required, just to add color support for a "library" category in addition to the "keywords" and "builtins" categories.

said...

I previously added the K_D_R Linux line positioning patch to ed.ex, but I think I got something wrong. I previously added the K_D_R Linux line positioning patch to ed.ex, but I think I got something wrong.

Where is the latest "KDR edx"? I think it would be easier to swap edx for edx rather than depend on my patchwork upgrades. Where is the latest "KDR edx"? I think it would be easier to swap edx for edx rather than depend on my patchwork upgrades.

_tom, the error in the line positioning code was mine - sorry about that. The get_err_line code posted above works correctly.

I believe by tomorrow, or the next day, I should have the editor rebuilt, or at least have learned enough to ask the right questions for help.

Ken

new topic     » goto parent     » topic index » view message » categorize

6. Re: edx.ex :: function get_err_line() replacement

Once more, with feeling... This version uses expand_tabs to position the cursor accurately on the error column. I edited the original post so that it now contains this code.

I am experimenting with some code that will utilize Irv Mullins' code to "trap and process GTK signal 11 errors" by having edx.ex open another window and display the relevant information there.

-- file: edx.ex 
function get_err_line() 
    ---------------------------------------- 
    --  derived from Irv Mulling's, gneui.ex 
    ----------------------------------------- 
    object file_lines 
    object file 
    object temp_line 
    object err_line 
    integer err_col = 0, i = 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 match("^^^ call-back from external source",file_lines[n]) = 1 then 
		file_lines = file_lines[1..n-1] 
		exit 
	    end if 
	end for 
	-- trap & process euphoria error report; 
	for n = 1 to length(file_lines) do 
	    if find('^', file_lines[n]) then 
		i = find(':',file_lines[1]) 
		err_col = match("^", expand_tabs(STANDARD_TAB_WIDTH, file_lines[n]))-1 
		file = file_lines[1][1..i-1] 
		err_line = to_number(file_lines[1][i+1..$]) 
		start_col = err_col 
		start_line = err_line 
		return file 
	    end if  
	end for 
    end if 
end function  
new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu