home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / rexx / raz_errorparse.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1994-12-19  |  2.3 KB  |  101 lines

  1. /*
  2. **      $Id: RAZ_ErrorParse.rexx,v 1.5 1994/11/20 23:54:32 DBernard Rel $
  3. **
  4. **      DICE Error Parsing Script.  Script for AZur Editor (©1994 J.M. Forgeas).
  5. **
  6. **      From TurboText's original by John Toebes
  7. **
  8. **  Notes: This assumes that your DCC:Config/DCC.Config file contains the
  9. **         following line:
  10. **  cmd= rx DCC:Rexx/RAZ_ErrorParse.rexx %e "%n" "%c" "%f" "%0"
  11. */
  12.  
  13. OPTIONS RESULTS
  14.  
  15. PARSE ARG EFile '"' Fn '" "' CurDir '" "' CFile '" "' VPort '"'
  16. IF VPort = '?' THEN VPort = ''
  17.  
  18. portname = 'DICE_ERROR_PARSER'  /* DICEHelp's port name */
  19.  
  20. IF ~show('p',portname) then DO
  21.     ADDRESS COMMAND 'RUN >NIL: <NIL: DError REXXSTARTUP'
  22.  
  23.     DO i = 1 TO 6
  24.         IF ~show('p',portname) THEN
  25.             ADDRESS COMMAND 'wait 1'
  26.     END
  27.  
  28.     IF ~show('p',portname) then DO
  29.         SAY "Dice Error Parser (DERROR) program not found!"
  30.         ADDRESS COMMAND 'type' EFile
  31.         EXIT
  32.     END
  33. END
  34.  
  35. /**
  36.  ** Get the error messages loaded in.
  37.  ** This will return a list of lines within the file that have
  38.  ** errors associated with them (if any)
  39.  **/
  40. ADDRESS DICE_ERROR_PARSER LOAD EFile '"'CurDir'" "'Fn'" "'VPort'"'
  41. LINES = RESULT
  42.  
  43. /**
  44.  ** Go through CFile
  45.  **/
  46. IF LINES ~= '' & CFile ~= '' THEN DO
  47.     ADDRESS DICE_ERROR_PARSER 'TTXSAME "'CFile'" "'VPort'"'
  48.     EPort = RESULT
  49.     IF RC ~= 0 THEN DO
  50.         SAY 'Unable to open file' CFile 'for editing'
  51.         EXIT
  52.     END
  53.  
  54.     ADDRESS VALUE EPort
  55.  
  56.     'BMRemove' "PAT DERR_#?"
  57.  
  58.     'LOCK D ON'
  59.     DO I = 1 to WORDS(LINES)
  60.         L = word(LINES, I)
  61.         'BMAdd' "DERR_"||L "FOLDS LINE" L "COL 1"
  62.     END
  63.     'LOCK D OFF'
  64.  
  65. END
  66.  
  67. /**
  68.  ** Lastly, go to the first error message
  69.  **/
  70.  
  71. ADDRESS DICE_ERROR_PARSER Current E
  72. IF RC ~= 0 THEN
  73.    DO
  74.       ADDRESS VALUE EPort 'REQMULTI' "TEXT Plus d''erreurs !"
  75.       EXIT 0
  76.    END
  77.  
  78. IF E.LINE = 0 THEN DO
  79.     IF LEFT(E.TEXT, 5) = 'DLINK' THEN DO
  80.         TT = TRANSLATE(E.STRING, '-', '"')
  81.         /* This is a DLINK error, we need to handle it special */
  82.         SAY 'There were DLINK Errors'
  83.         ADDRESS COMMAND 'TYPE' EFILE
  84.         EXIT 0
  85.     END
  86. END
  87.  
  88. ADDRESS DICE_ERROR_PARSER 'TTXSAME "'E.FPATH'" "'E.ARGS'"'
  89. IF RC ~= 0 THEN DO
  90.     SAY 'Unable to open' E.FPATH
  91.     EXIT 0
  92. END
  93.  
  94. Port = RESULT
  95. ADDRESS VALUE Port
  96. if E.Col = 0 THEN E.Col = 1
  97. 'BM' "DERR_"||E.Line
  98. 'Cursor' "FOLDS COL" E.Col
  99. 'REQMULTI' "TEXT" E.STRING
  100.  
  101.