:Editerror Command [EDITERROR]

Pulls up “errors” in source files for the user to correct. :Editerror depends upon a special error-file that is usually generated by the program that detects the errors. See Appendix B for the file format. Some compilers, such as SRN’s SPLash! compiler, can generate Qedit error-files. For COBOL, SPL, Pascal, and HP C, Qedit converts compile errors into :Editerror format using the Editerr utility program.

:EDITERROR error-file [VISUAL | NEXT | PREV]

(Default: Line mode)

There are two basic types of :Editerror command: the first command after a compile, and a subsequent command.

  /:editerror error-file [VISUAL] {first command}  /:editerror error-file NEXT      {subsequent}  

Finding the First Error

The first command after a compile would not specify NEXT or PREV and would find the first error in the error-file. Qedit prints the error message, then Opens or Texts the source file containing the error, and positions itself to the line with the error. If the current open file is a Qedit workfile, :Editerror does an automatic Shut command on it. If the current open file is Qeditscr and you did a previous Text and made some changes, :Editerror does an automatic Keep command on it (you will see the question “Purge existing file?”). :Editerror can handle Copylib members if the member name is enclosed in parentheses and followed by the name of the Copylib file (without a space).

If you specify VISUAL on the first command, Qedit assumes that you wish to correct the errors in Visual mode. Qedit does not throw you into Visual mode, but if you enter (or re-enter) Visual at this point, Qedit will display the error message at the top of the screen where the error occurred. If you do not specify Visual, Qedit assumes that you want to correct the errors in Line mode. Normally, the first command would be included in the UDC that does your compile.

Subsequent Errors

Subsequent commands retrieve the “next” (or “previous”) error in the same error-file.

If you used the Visual option on your first command, Qedit allows you to use the F4 and F3 keys in Visual to find the Next or Previous error. Visual mode does the necessary :Editerror commands for you automatically.

If you do any string searches in fixing your errors, you will lose the ability to use F4 and F3 for Next and Previous Error. This often happens when you must search backward in your file for the definition of a data item. If the current string value does not equal “$error”, the F4 and F3 keys do not pull up the next and previous errors to be fixed. You can now reactivate error-fixing by searching for “$error” explicitly.

You do not need to go through all the errors before recompiling. If you go past the last error to be fixed, Qedit prints a warning that says so. The same occurs if you try to go backwards beyond the first error to be fixed. Qedit does not turn off error-fixing just because you reach the end — you can still go back to the previous error by pressing F3.

Resetting :Editerror Mode

Once you do the :Editerror command you are in a special mode where the F4 and F3 keys pull up errors. This mode stays enabled until one of the following resets it:

  • another :Editerror operation
  • :Editerror without any parameters
  • any explicit Text, Open, Keep, Shut or New command
  • using the F8 key to exit from Visual back to Line mode

Line Mode Tip

If you use Line mode to correct your errors, you will need a UDC to retrieve the next and previous error. For example, if the error file is called cerrors:

  nexterror  option nolist  editerror cerrors next  *****  

Screen Format

In most programming languages, it makes more sense to see the lines above the point of error, rather than after. The error line becomes the current line in :Editerror and the default Visual display is zero lines above the current line and 19 lines after. You can of course override this with Set Vis Above and Set Vis Below. If your Above value is 0, :Editerror changes the screen format so that there are 9 lines above and 9 fewer lines below (with a minimum of 9). Naturally, :Editerror saves the original values and resets them when you end error-fixing mode.

UDCs

See the UDCs called COBERR and EDERR in the file Udc.Catalog.Robelle for examples of how to use the Editerror command effectively.

:Editerror Command [EDITERROR]