home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / UE311CMD.ZIP / ERROR.CMD < prev    next >
OS/2 REXX Batch file  |  1990-06-19  |  3KB  |  152 lines

  1. ;    ERROR.CMD:    Parse Mark Williams C compilation error files
  2. ;            using MicroEMACS 3.9a
  3. ;
  4. ;    (C)opyright 1987 by Daniel M. Lawrence
  5. ;
  6.  
  7. ;    Load up the needed macros
  8.     set $discmd "FALSE"
  9.     write-message "[Setting UP]"
  10.  
  11. ;    page up/down for the Atari 1040ST
  12.     bind-to-key previous-page    FNC
  13.     bind-to-key next-page        FN<
  14.  
  15. ;    cycle to the next error
  16. 39    store-macro
  17.     run closelast
  18. !force    1 next-line
  19.     run getnext
  20. !endm
  21.     bind-to-key execute-macro-39    FN1
  22.  
  23. ;    cycle to the previous error
  24. 38    store-macro
  25.     run closelast
  26. !force    1 previous-line
  27.     run getnext
  28. !endm
  29.     bind-to-key execute-macro-38    FN2
  30.  
  31. ;    get the next error
  32. store-procedure    getnext
  33.  
  34.     ;check for end of errors
  35.     2 next-window
  36.     !if &seq $line ""
  37.         3 next-window
  38.         write-message "[No more errors]"
  39.         !return
  40.     !endif
  41.  
  42.     ;grab the line number and file name
  43.     delete-next-word
  44.     yank
  45.     set %eline $kill
  46.     search-forward " "
  47.     set-mark
  48.     search-forward ":"
  49.     backward-character
  50.     kill-region
  51.     yank
  52.     set %efile $kill
  53.  
  54.     ;mark the line
  55.     beginning-of-line
  56.     insert-string "["
  57.     end-of-line
  58.     insert-string "]"
  59.     beginning-of-line
  60.     unmark-buffer
  61.  
  62. ;    save the last file if different
  63.     3 next-window
  64.     !if ¬ &seq $lastfile ""
  65.         !if ¬ &seq %lastfile %efile
  66.             save-file
  67.             select-buffer "[temp]"
  68.             delete-buffer $lastfile
  69.         !endif
  70.     !endif
  71.     find-file %efile
  72.     %eline goto-line
  73.     update-screen
  74.     write-message &cat &cat &cat &cat "[Error found in " %efile " at line " %eline "]"
  75. !endm
  76.  
  77. ;    close the last error
  78. store-procedure    closelast
  79.  
  80.     ;if at the end.... go away
  81.     2 next-window
  82.     !if &seq $line ""
  83.         !return
  84.     !endif
  85.  
  86.     ;unmark the last error
  87.     beginning-of-line
  88.     delete-next-character
  89.     end-of-line
  90.     delete-previous-character
  91.     beginning-of-line
  92.  
  93.     ;and save the file name
  94.     set %lastfile %efile
  95. !endm
  96.  
  97. ;    Abort!
  98. 40    store-macro
  99.     4 exit-emacs
  100. !endm
  101.     bind-to-key execute-macro-40    FN5
  102.  
  103. ;    save current file
  104.  
  105.     bind-to-key save-file        FN9
  106.  
  107. ;    recompile!!!!
  108.  
  109.     bind-to-key    quick-exit    FN0
  110.  
  111.  
  112. ;    set the help window
  113.  
  114.     1 split-current-window
  115.     select-buffer "[MWC C-Errors]"
  116.     insert-string "Mark Williams C            Compilation Error Scanning~n"
  117.     insert-string "    F1    Go to next error    F9    Save current source file~n"
  118.     insert-string "    F2    Go to last error    F10    Re-compile~n"
  119.     insert-string "            F5    Abort compiler"
  120.     beginning-of-file
  121.     4 resize-window
  122.     add-mode "red
  123.     unmark-buffer
  124.  
  125. ;    set up the error line window
  126.  
  127.     next-window
  128.     1 split-current-window
  129.     4 resize-window
  130.     add-mode "black"
  131. *getcc
  132.     !if ¬ &seq &left $cbufname 2 "cc"
  133.         next-buffer
  134.         !goto getcc
  135.     !endif
  136.  
  137. ;    set up the current source window
  138.  
  139.     next-window
  140.     next-buffer
  141.     add-mode "blue
  142.  
  143. ;    initialize
  144.  
  145.     set %lastfile ""
  146.     run getnext
  147.     set $gflags 0
  148.  
  149. ;    wait for a command
  150.  
  151.     set $discmd "TRUE"
  152.