home *** CD-ROM | disk | FTP | other *** search
- /*
-
- CED-ShowError
-
- This Arexx program displays the errors generated by the PCQ Pascal
- compiler, using the CygnusEd Professional text editor. It should
- be called as follows:
-
- CED-ShowError SourceFile OutputFile ErrorFile
-
- CED-ShowErrors reads the errorfile, which must have been generated
- by PCQ Pascal in "quiet" mode. It displays the first error in the
- appropriate source file (not necessarily the SourceFile), then
- erases the OutputFile and ErrorFile.
-
- This file was designed to be an error handler for the PCQ make
- utility. It might work for other purposes, but I'd be careful if
- I were you.
-
- To use this file with PCQ, you'll need to include the following
- line in your configuration file:
-
- CompilerError rx CED-ShowError \s \d \e
-
- You will also, of course, need CygnusEd Professional and Arexx,
- both of which are commercial products.
-
- */
-
- /* Read the command line parameters */
-
- parse arg SourceFileName OutputFileName ErrorFileName .
-
- options results
-
-
- /* Get the first error */
-
- if open(logfile, ErrorFileName, 'R') then do
-
- if eof(logfile) then do /* There were no errors */
- FileName = SourceFileName
- LineNo = 1
- ColumnNo = 1
- ErrorText = "No Errors"
- end; else do
- ErrorString = readln(logfile)
-
- /* This first test is just a reminder, in case you want to */
- /* process all errors. "Abort" would never come first. */
-
- if ErrorString = "Compilation Aborted" then do
- address command 'delete >nil:' outputfile
- 'okay1 Compilation Aborted'
- exit
- end
-
- if ErrorString ~= "" then do
- parse var ErrorString '"' FileName '" At ' LineNo,
- ',' ColumnNo ' :' ErrorText
- end; else do
- FileName = SourceFileName
- LineNo = 1
- ColumnNo = 1
- ErrorText = "No Errors"
- end
- end
- close(logfile)
- end; else do
- say 'Could not open error file'
- exit
- end
-
- /* Strip the directory and volume name for comparisons */
-
- JustFileName = Right(FileName,Length(FileName)-,
- Max(LastPos('/',FileName),LastPos(':',FileName)))
-
-
- /* If CygnusEd isn't loaded, load it */
-
- if ~show(Ports,'rexx_ced') then do
- address command Ed FileName
- do until show(Ports, 'rexx_ced')
- address command wait 1
- end;
- end; else do
-
- /* If CED was loaded, we want to activate it, then check all */
- /* of the open views for the file that we've been compiling. */
-
- address 'rexx_ced'
- cedtofront
- status 66
- views = result
-
- found = 0
- i = 1
- do until found | (i > views)
- status 21
- found = found | (JustFileName = result)
- if ~found then 'Next view'
- i = i + 1
- end
-
- /* If it wasn't found, then load it. If the current view is */
- /* not empty, create a new view. */
-
- if ~found then do
- status 21
- if result ~= "" then 'Open New'
- 'Open ' FileName
- end
- end
-
- /* Display the error */
-
- address 'rexx_ced'
-
- 'jumpto' LineNo 1
- do for ColumnNo
- 'right'
- end
-
- 'okay1 Error:' || ErrorText
-
- /* Delete the temporary files */
-
- address command 'delete >Nil:' ErrorFileName
- address command 'delete >Nil:' OutputFileName
-
-