Finding Compile errors

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
pwdiener
Posts: 134
Joined: Wed Jul 11, 2007 3:45 pm

Finding Compile errors

Post by pwdiener »

Jussi,

I'm working with a compiler that only provides listing line numbers for errors, which can not be easily translated to source file line numbers. The full text of the line is available, however. Any ideas on how I might get from the compile window to the source line and use next/prev error?

Bill Diener
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Hi Bill,
Any ideas on how I might get from the compile window to the source line and use next/prev error?

The only way this can be made to work is add the missing line number information to the error file.

You might be able to do this using a batch file and have the batch file capture the output. Then you could use the batch for loop to process the error file line by line.

Syntax of the batch for loop: http://command-line-programming.suite10 ... arse_files

Within that batch file if you have a line of text from the error file you should be able to convert this line into a fully qualified file by running the line through xfgrep utility and appending the output to a new error file:

Code: Select all

xfgrep.exe -f -n "some line of text" some_file.txt
Finally just use the type new_error.txt command at the end of the batch file to pipe the erros to Zeus.

Other option might be to use a macro to run the compile based on the following psuedo code:

Code: Select all

function key_macro() 
   -- build up a command line here and pipe the output to the c:\\temp\\output.txt
   local cmd = "compiler.exe " .. macro_tag("$fn") ............ "c:\\temp\\output.txt"

   -- run the command using a DOS window and wait for it to finish 
   local flags = 16+32+64 
   local dir = "c:\\temp" 

   -- run command which should display a DOS window 
   system(cmd, dir, flags) 

   -- add some magic here to add the file line number to the output file generated above
   ?????

   -- send the output to a Zeus compiler window 
   file_open_compiler("c:\\temp\\output.txt","My Compiler") 
end 

key_macro() -- run the macro
Cheers Jussi
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

This batch file command will read a text file one line at a time:

Code: Select all

rem the location of the file to be parsed
cd c:\temp\

rem the file to be parsed
dir test.txt

rem red the file one line at a time
FOR /F "eol=; tokens=1* delims=" %%i in (test.txt) do echo %%i
So changing the FOR line above to be something more like this might work:

Code: Select all

rem remove the error file
if exists new_errors.txt del new_errors.txt

rem use xfgrep for each of the lines of text to add the line information
FOR /F "eol=; tokens=1* delims=" %%i in (box.lua) do xfgrep.exe -f -n '%%i' compiled_file_name >> new_errors.txt

rem send the output to Zeus
type new_errors.txt
Cheers Jussi
Post Reply