SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: HansNet on April 16, 2007, 08:09:13 pm

Title: Handling compiler error-parsing
Post by: HansNet on April 16, 2007, 08:09:13 pm
At the company I'm working we want to start using SE for editting (on pc) and compiling (on the host mainframe system). For downloading and uploading files from/to the host a Slick-C macro is used that calls a function in a dll which makes a winsock connection.
For the compilation-process also a function in the dll is called via a Slick-C macro. This dll-function does the following :
- upload the modified source-file from the pc to the host
- send a command to the host that triggers a compilation at the host
- waits for the compile to end
- when the compile went wrong the dll receives the name of the hostfile, that includes the compiler-errors
- the (host)error-file is downloaded to the pc

- then the dll-call, from out of the Slick-C macro, returns and the Slick-C macro continues. The Slick-C macro knows the fysical location of the download error-file on the pc (lets say C:\hosterrors.txt)
This file contains one line per error (pc-filename, line, column, error-tekst).
I already have setup an error-parser via "Build - Configure error parsing" in the category "user". I named it "myerrorparser". I validated it on a line in C:\hosterrors.txt and it works.

But now my question : how do I get the compile-error window (or whatever it is called) activated and filled with the errors in C:\hosterrors.txt via parser "myerrorparser"  .... so that I can double-click on an error to correct the error in the sourcefile.

Can somebody please tell me how to do this in a Slick-C macro ?
Title: Re: Handling compiler error-parsing
Post by: hs2 on April 16, 2007, 10:51:55 pm
Hi HansNet,

you could try this sample. It's just a remix of a few related things already posted.
Hope it works for you !

Code: [Select]
_command void hpostbuild ( )
   // reset a few things
   clear_pbuffer ();

   cmdline = "C:\\hosterrors.cmd";
   concur_command (cmdline);

this little helper:
Code: [Select]
_command void serr () name_info(','VSARG2_REQUIRES_EDITORCTL)

   // maybe goto 1st error
   if ( next_error () )
      // or not ...
      bottom_of_build ( );
      _beep ();
and hosterrors.cmd
Code: [Select]
type C:\hosterrors.txt
echo <binary 1>serr

I attached the batch incl. the <binary 1>.  The forum SW hangs when a <binary 1> is contained in the message text.
(It also contains the Slick macros.)

Title: Re: Handling compiler error-parsing
Post by: HansNet on April 17, 2007, 08:35:25 pm
thanks ... I got it working. One additional question ... when the cmd-file is executed, it types the text-file with the errors in it, I get the following information visible in the build window :

*F:\SSCFORW0.sco(29)Error C2078: too many initializers
*F:\SSCFORW0.sco(31)Error C2078: copy not found

line 2 and 3 are my errors in the typed txt-file, but line 1 and 4 also appear. When I double-click on line 1, hosterrors.cmd is editted. When I double-click on line 4, a "Find file" window appears to select a file.
How can I get rid of line 1 and 4 ?

And do you perhaps know how to deal with spaces in some of the directories in the path ?
Like example when I do "type C;\my docs\err.txt" in a dos-box ... it gives an error because of the one space after "my".
Title: Re: Handling compiler error-parsing
Post by: hs2 on April 17, 2007, 10:54:31 pm
@HansNet: Glad to hear that it's working for you !

Golden rule: Avoid SPACEs in filenames/paths. It makes life a lot easier ...
Otherwise you need to quote them like this: type "C:\Path with SPACEs\file with SPACES.txt"

The line 1 and 4 cannot be removed. Remember that the 'Build' window is just wraps and enhances the cmd shell but incl. prompt etc.
So you shouldn't d-click (same as r-click->Goto Error) on the lines you are not interested in or just ESCape the 'Find File' dialog after accidentally doing so ;)