home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 April / PCWorld_2000-04_cd.bin / Software / TemaCD / winedit / mserror.wb_ < prev    next >
Text File  |  1998-05-26  |  3KB  |  69 lines

  1. ;--------------------------------------------------------------------;
  2. ; mserror.wbt                                                        ;
  3. ;                                                                    ;
  4. ; Error parsing for Microsoft style output:                          ;
  5. ; "filename(lineno):text"                                            ;
  6. ;                                                                                           ;
  7. ; This script is included only as a template for you to use in           ;
  8. ; creating a custom error parsing script, since Microsoft style        ;
  9. ; output is handled internally by WinEdit.                                     ;
  10. ;                                                                    ;
  11. ; 1.  If called with param1 == "@GetErrorWords", return              ;
  12. ;     a comma-delimited list of words which identify a line          ;
  13. ;     as containing an error. In Microsoft style output that         ;
  14. ;     would be "error,warning".                                      ;
  15. ;                                                                    ;
  16. ; 2.  Otherwise, parse the variable @strLine to extract the filename ;
  17. ;     and line number.  In this case, the filename is all the        ;
  18. ;     characters up to the opening parenthesis, and the line number  ;
  19. ;     is all of the following characters up to the closing           ;
  20. ;     parenthesis.                                                   ;
  21. ;                                                                    ;
  22. ;--------------------------------------------------------------------;
  23.  
  24. @ErrFile = ""   ; return value
  25. @ErrLine = 0    ; return value
  26. @ErrWords = ""  ; return value
  27.  
  28. ;--------------------------------------------------------------------;
  29. ;  Return the error words                                            ;
  30. ;--------------------------------------------------------------------;
  31. if param1 == "@GetErrorWords"
  32.     @ErrWords = "error,warning"
  33.     exit
  34. endif
  35.  
  36. ;--------------------------------------------------------------------;
  37. ; extract the file name by searching for the '(' character           ;
  38. ;--------------------------------------------------------------------;
  39. finish = StrScan(@strLine, "(", 0, @FWDSCAN)
  40. if finish == 0 
  41.     exit
  42. endif
  43. strFile = strsub(@strLine,1,finish-1)
  44. if (FileExist(strFile))
  45.     @ErrFile = strFile
  46. else
  47.     drop(strFile,finish)
  48.     exit
  49. endif
  50.  
  51. ;--------------------------------------------------------------------;
  52. ; extract the line number, which follows the '(' character           ;
  53. ;--------------------------------------------------------------------;
  54. start = finish+1
  55. finish = StrScan(@strLine, ")", start, @FWDSCAN)
  56. if finish == 0
  57.     @ErrFile = ""
  58.     drop(strFile,start,finish)
  59.     exit
  60. endif
  61. strLine = StrSub(@strLine,start,finish-start)
  62. if IsInt(strLine)
  63.     @ErrLine = strLine
  64. else
  65.     @ErrFile = ""
  66. endif
  67.  
  68. drop(strLine,strFile,start,finish)
  69.