/*
** $VER: DICE_ErrorNext.rexx 1.004 (22 Sep 1995) © Stefan Berendes
**
**
**  FUNCTION:
**      DICE error parsing. Jump to next error.
**
**      This assumes that your DCC:Config/DCC.Config file contains the
**      following line:
**
**  cmd= rx DCC:Rexx/GoldED_ErrorParse.rexx %e "%c" "%f" "%0"
**
** $HISTORY:
**
** 22 Sep 1995 : 001.004 : let message stay in status bar
** 10 Sep 1995 : 001.003 : Improved window handling
** 21 Jun 1995 : 001.002 : Can't pass args from Dock - splitted
** 18 Jun 1995 : 001.001 : initial release for GoldED
**
*/

OPTIONS RESULTS

portname = 'DICE_ERROR_PARSER'  /* DICEHelp's port name */

if ~show('p',portname) then
    exit 0

if (LEFT(ADDRESS(), 6) ~= "GOLDED") then address 'GOLDED.DICE'

'LOCK CURRENT'                              /* lock GUI, gain access   */
OPTIONS FAILAT 6                            /* ignore warnings         */
SIGNAL ON SYNTAX                            /* ensure clean exit       */

/* ------------------------ INSERT YOUR CODE HERE: ------------------- */

/*
** Get info on the next error
*/

ADDRESS DICE_ERROR_PARSER NEXT E

IF rc ~= 0 THEN DO
    'REQUEST PROBLEM="No More Errors"'
    'UNLOCK' /* VERY important: unlock GUI */
    EXIT
END

IF E.LINE = 0 THEN DO

    IF LEFT(E.TEXT, 5) = 'DLINK' THEN DO
        /* This is a DLINK error, we need to handle it special */
        TT = TRANSLATE(E.STRING, '-', '"')
        'REQUEST PROBLEM="There were DLINK Errors' TT '"'
        'UNLOCK' /* VERY important: unlock GUI */
        EXIT
    END

END

'WINDOW USE' E.FPATH 'FORCE'

'GOTO LINE'     E.LINE
'GOTO COLUMN'   E.COL

'REQUEST STAY STATUS="' || E.ERRNO E.STRING || '"'

/* ---------------------------- END OF YOUR CODE --------------------- */

'UNLOCK' /* VERY important: unlock GUI */
EXIT

SYNTAX:

SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
'UNLOCK'
EXIT

