1. editors: GTK error reporting

In Irv Mullins' latest EuGTK you will find a very much improved version of gneui (EuGeany). Everyone should start using Irv's version immediately.

I would like to see Irv's code adapted to work with ed.ex's ex.err/error processing routines.

Here is the code. NICE WORK, IRV! And thanks again for EuGTK!

 
-- gneui.ex 1.0  
--  
-- 2013 2013-03-21  
-- Kenneth Rhodes <wolfmanjacques@gmail.com>  
--  
-- This file wraps the Euphoria interpreter  
-- together with a routine which extracts  
-- ex.err file data and passes the name,  
-- path, line and column to the Geany editor  
--  
-- usage: Geany run_cmd = eui gneui.ex ./%f  
-- Set run source code command to this as well,  
-- Execute your code from Geany, upon error,  
-- Geany will position the cursor at the line  
-- and column of the error.  
--  
--// Heavily modified by Irv Mullins to handle signal 11 errors from GTK 
--// will usually leave the cursor on the line where the error occurs... 
 
include std/io.e  
include std/convert.e  
include std/error.e  
include std/filesys.e  
 
object file_name, command 
integer exit_code = 0 
 
sequence cl = command_line()  
clear_screen()  
if length(cl) >= 3 then  
    file_name = cl[3]  
    -- UNIX: 
    ifdef UNIX then  
		command = sprintf( "eui -D DEBUG \"%s\"", {file_name} )  
    elsedef  
    -- WIN: 
		if wildcard:is_match( "*.ew", file_name )  
		or wildcard:is_match( "*.exw", file_name) then  
			command = sprintf( "euiw -D DEBUG \"%s\"", {file_name} )  
		else  
			command = sprintf( "eui -D DEBUG \"%s\"", {file_name} )  
		end if  
    end ifdef  
     
    if  file_exists("ex.err") then  
		delete_file("ex.err")  
    end if  
  
    exit_code = system_exec ( command, 0 )  
    if exit_code != 0 then  
		ParseErrorFile()  
    end if  
     
end if  
system("clear",0)  
 
-------------------------- 
procedure ParseErrorFile()  
-------------------------- 
object file_lines 
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")  
	else 
		printf(1,"Read %d lines\n",length(file_lines)) 
	end if 
 
	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] 
			printf(1,"Lines clipped: %d\n",length(file_lines)) 
			exit 
		end if 
	end for 
  
	-- trap & process GTK signal 11 errors; 
		for n = length(file_lines) to 2 by -1 do 
			if match("... called from /", file_lines[n]) then  
				i = find(':', file_lines[n])  
				file_name = file_lines[n][17..i-1] 
				err_line = file_lines[n][i+1..$] 
				i = find(' ',err_line) 
				err_line = err_line[1..i-1] 
				err_line = to_number(err_line) 
				printf(1,"FILE:%s - LINE:%d \n",{file_name,err_line}) 
				system( sprintf("geany \"%s:%d\"", {file_name, err_line} ))  
				abort(0) 
			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("^",file_lines[n])-1 
				file_name = file_lines[1][1..i-1] 
				err_line = to_number(file_lines[1][i+1..$]) 
				printf(1,"FILE:%s - LINE:%d COL:%d\n",{file_name,err_line,err_col}) 
				system( sprintf("geany \"%s:%d:%d\" & ", {file_name, err_line, err_col} ))  
				abort(0) 
			end if  
		end for 
 
end procedure  
new topic     » topic index » view message » categorize

2. Re: editors: GTK error reporting

Thanks.

For anyone who is interested, there will be a new version of EuGTK posted in July, which has been completely re-written. It is at the moment 95% complete, and is smaller with cleaner code, so it runs faster and is a bit 'smarter' as well.

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

3. Re: editors: GTK error reporting

irv said...

... EuGTK... has been completely re-written.

Wow! You are a coding beast, irv. smile

You would be a mega-beast if this was made available, by you, for Winblows. tongue

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

4. Re: editors: GTK error reporting

euphoric said...
irv said...

... EuGTK... has been completely re-written.

Wow! You are a coding beast, irv. smile

You would be a mega-beast if this was made available, by you, for Winblows. tongue

Although support has improved since the 1.3 days (back when GTK was at 1.2 and only the unofficial "1.3" version of the library (derived from unstable/testing CVS) was available on Winblows)), it's still pretty hard to do this: http://www.gtk.org/download/win32.php (Note the lack of support for an installation for an end-user.)

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

5. Re: editors: GTK error reporting

euphoric said...

You would be a mega-beast if this was made available, by you, for Winblows. tongue

Have you looked at http://sourceforge.net/projects/eugtk/ btw? That version seems to be dual-platform.

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

6. Re: editors: GTK error reporting

I have just finished the last major hurdle, the print library. With it, printing a file or generated text complete with colorful headers and footers requires exactly one line of code. Beat that, Windows! I'll try to post the new pkg. next week. Still revising the docs.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu