home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / useful / dev / obero / oberon-a / rexx / readerr.aed < prev   
Encoding:
Text File  |  1994-08-08  |  1.5 KB  |  62 lines

  1. /* ReadErr.aed -- mark errors in an Oberon module */
  2.  
  3. /* trace all */
  4. options results
  5.  
  6. if ~show('L','rexxsupport.library') then
  7.    call addlib('rexxsupport.library',0,-30)
  8.  
  9. /* Extract the module name and generate the error file name */
  10.  
  11. 'top first ( ) left'
  12. 'find MODULE' ; 'wright'
  13. 'scanf %[~;]'
  14. 'top first del'
  15. 'getval $scanf'
  16. module = result
  17. errFile = module || '.err'
  18.  
  19. /* Open the error file and skip the header */
  20.  
  21. if open('err', errFile, 'R') then do
  22.   /* Check first to see if it is a binary error file */
  23.   if readch('err', 4) = 'OAER' then do
  24.     /* Close the error file and call OEL instead */
  25.     close('err')
  26.     address command 'OBERON-A:Source/OEL/OEL >t:ErrMsgs NOANSI COLWIDTH=70' module
  27.     'newwindow newfile t:ErrMsgs'
  28.   end
  29.   else do
  30.     /* Could be a text error file, try to parse it */
  31.     seek('err', 0, 'B')
  32.  
  33.     /* Skip the header lines */
  34.     do i = 1 to 4
  35.       line = readln('err')
  36.       if eof('err') then do
  37.         say ' !! Error in' errFile
  38.         exit
  39.       end
  40.     end
  41.  
  42.     /* We should now be positioned to read the error lines */
  43.     do i = 1
  44.       /* Read a line, parse it and store it in a stem variable */
  45.       line = readln('err')
  46.       if eof('err') then leave
  47.       parse var line 'line' errs.i.l ', col' errs.i.c ': err =' errs.i.e .
  48.     end
  49.  
  50.     /* Now insert the error reports in the source file */
  51.     do j = (i - 1) to 1 by -1
  52.       'noscrupdate goto ' || errs.j.l || ' gotocol ' || errs.j.c
  53.       'noscrupdate down insline (\^-- err: ' || errs.j.e || ')'
  54.     end
  55.   end
  56. end
  57. else do
  58.   say ' !! Could not open' errFile
  59.   exit
  60. end
  61.  
  62.