home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / AP / JED / JED097-1.TAR / jed / lib / compile.sl < prev    next >
Encoding:
Text File  |  1994-12-12  |  2.0 KB  |  94 lines

  1. % run compiler in a subshell and parse error messages
  2. % The file compile.dat is a database for various compilers.  Set the
  3. % string 'compile_parse_error_function' to the approriate compiler.
  4. % This file reads the function from compile.dat.
  5.  
  6. !if (is_defined ("compile_parse_error_function"))
  7. {
  8.    error ("'compile_parse_error_function' needs set.  See jed.rc for info.");
  9. }
  10.  
  11.  
  12. % this function pulls the correct function out of the compile.dat file
  13. . (
  14. .   [type] =type
  15. .   [ret] 0 =ret
  16.   
  17. .   "compile.dat" find_jedlib_file
  18. .     { "compile.dat file not found!" error} !if
  19.  
  20. .   widen bob
  21. .   "%@" type strcat bol_fsearch
  22. .      {
  23. .         push_mark   
  24. .     "--------" bol_fsearch {1 go_up}{eob} else
  25. .     narrow
  26. .         evalbuffer
  27. .     1 =ret
  28. .      } if
  29. .    whatbuf delbuf
  30. .    widen
  31. .    ret
  32. . ) compile_select_compiler
  33.  
  34. . compile_parse_error_function compile_select_compiler
  35. . { "Compiler type not in database!." error } !if
  36.  
  37. . "compile_parse_errors"    "^X'"   setkey
  38.  
  39. define compile_parse_errors ()
  40. {
  41.    variable obuf = "*shell-output*";
  42.    variable cbuf = whatbuf ();
  43.    variable istr, file;
  44.    
  45.    pop2buf (obuf);
  46.    if (markp ()) pop_mark (0);
  47.    eol ();
  48.    if (eobp) message ("No more errors!");
  49.    
  50.    while (eol, not (eobp()))
  51.      {
  52.     if (compile_is_this_line_error ())
  53.       {
  54.          (istr, file) = ();
  55.          message (strcat ("Line ", istr));
  56.          bol(); call ("set_mark_cmd"); eol ();
  57.          !if (strlen (istr)) return;
  58.          find_file (file); pop ();
  59.          cbuf = whatbuf ();
  60.          goto_line (integer(istr));
  61.          bol (); skip_white ();
  62.          sw2buf (obuf);
  63.          break;
  64.       }
  65.     go_down (1);
  66.      }
  67.    
  68.    go_down (1);
  69.    pop2buf (cbuf);
  70. }
  71.  
  72. . (
  73. .    [b] whatbuf =b
  74. .    "save_buffers" call
  75. .    do_shell_cmd bob % "\n" insert  % so we can assume the top line is junk
  76. .    b pop2buf
  77. .    compile_parse_errors
  78. . ) compile
  79.  
  80. define compile_previous_error ()
  81. {
  82.    variable buf = "*shell-output*";
  83.    !if (bufferp(buf))
  84.    {
  85.       flush("Did you compile?");
  86.       return;
  87.    }
  88.    pop2buf(buf);
  89.    go_up(2);
  90.    compile_parse_errors();
  91. }
  92.  
  93.  
  94.