/usr/share/jed/lib/compile.sl is in jed-common 1:0.99.19-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | % -*- SLang -*-
%
% run compiler in a subshell and/or parse error messages
%
% Changes made by Alexander Demenshin <aldem@barnet.kharkov.ua>
% Column support by Lutz Donnerhacke <lutz@iks-jena.de>.
%
% Public functions:
% compile_parse_errors parse next error
% compile_previous_error parse previous error
% compile_parse_buf parse current buffer as error messages
% compile run program and parse it output
% compile_select_compiler set compiler for parsing error messages
% compile_add_compiler add a compiler to database
%
% Public variables:
% Compile_Default_Compiler
%
% The file also contains a database for various compilers.
%---------------------------------------------------------------------------
% These variables are public because they are used by acompile.sl
variable Compile_Output_Buffer = "*shell-output*";
if (is_defined ("get_process_input"))
{
Compile_Output_Buffer = "*compile*";
}
variable Compile_Line_Mark = 0;
private variable Compile_Src_Dir = Null_String;
private variable Error_Regexp;
%
% These variables are used when parsing GNU's Make output (directory changes).
% I don't know what kind of output generated by other Make, so substitute
% it if needed. <aldem>
%
#ifdef UNIX
private variable Compile_Dir_Enter = "^g?make\\[\\d+\\]: Entering directory `\\(.+\\)'";
private variable Compile_Dir_Leave = "^g?make\\[\\d+\\]: Leaving directory `\\(.+\\)'";
private define compile_parse_make_chdir ()
{
variable beg_mark, end_mark;
variable end_line;
push_spot ();
EXIT_BLOCK
{
pop_spot ();
}
beg_mark = create_user_mark ();
end_mark = create_user_mark ();
forever
{
goto_user_mark (end_mark);
end_line = 0;
if (re_bsearch (Compile_Dir_Leave))
{
if (up_1 ())
end_line = what_line ();
move_user_mark (end_mark);
}
goto_user_mark (beg_mark);
!if (up_1 ()) return Null_String;
if (re_bsearch (Compile_Dir_Enter))
{
if (not(end_line)
or (what_line () > end_line))
break;
move_user_mark (beg_mark);
}
else return Null_String;
}
regexp_nth_match (1);
}
#endif
private define compile_find_file (file, line, col)
{
#ifdef UNIX
variable dir;
dir = compile_parse_make_chdir ();
if (strlen (dir) and (file[0] != '/'))
file = dircat (dir, file);
#endif
if (1 != file_status (file))
{
file = Compile_Src_Dir + file;
while (1 != file_status (file))
{
file = read_file_from_mini ("Find this file's errors:");
}
}
Compile_Src_Dir = path_dirname (file);
() = find_file (file);
widen_buffer ();
goto_line (line);
if (col > 0)
goto_column_best_try (col);
else
bol_skip_white ();
}
private define compile_parse_errors_dir (next_error_fun, next_line_fun)
{
variable cbuf, obuf = Compile_Output_Buffer;
variable line, file, col;
Compile_Line_Mark = 0;
!if (bufferp(obuf))
{
flush ("Did you compile?");
return;
}
if (MINIBUFFER_ACTIVE) return;
cbuf = pop2buf_whatbuf (obuf);
if (@next_error_fun (&file, &line, &col))
{
!if (strlen (line)) return;
!if (strlen (col)) col = "0";
bol();
Compile_Line_Mark = create_line_mark (3);
@next_line_fun ();
line = strtrim_beg (line, " \t0");
col = strtrim_beg (col, " \t0");
compile_find_file (file, integer (line), integer (col));
cbuf = whatbuf ();
sw2buf (obuf);
}
pop2buf (cbuf);
}
private define compile_find_next_error_fun (filep, linep, colp)
{
eol ();
if (eobp ())
{
message ("No more errors!");
return 0;
}
if (typeof (Error_Regexp) == Ref_Type)
return @(Error_Regexp) (1, filep, linep, colp);
bol ();
!if (re_fsearch (Error_Regexp))
{
eob ();
return 0;
}
@filep = regexp_nth_match (1); % file name
@linep = regexp_nth_match (2); % line number (string)
@colp = regexp_nth_match (3); % column number (string)
1;
}
private define compile_find_prev_error_fun (filep, linep, colp)
{
bol ();
if (bobp ())
{
message ("No more errors!");
0;
}
if (typeof (Error_Regexp) == Ref_Type)
return @Error_Regexp (-1, filep, linep, colp);
!if (re_bsearch (Error_Regexp))
{
bob ();
return 0;
}
@filep = regexp_nth_match (1); % file name
@linep = regexp_nth_match (2); % line number (string)
@colp = regexp_nth_match (3); % column number (string)
1;
}
public define compile_parse_errors ()
{
compile_parse_errors_dir (&compile_find_next_error_fun, &go_down_1);
}
public define compile_previous_error ()
{
compile_parse_errors_dir (&compile_find_prev_error_fun, &bol);
}
public define compile ()
{
variable b, n;
variable cmd = NULL;
if (_NARGS != 0)
cmd = ();
b = whatbuf();
call ("save_some_buffers");
if (cmd == NULL) do_shell_cmd ();
else shell_perform_cmd (cmd, 0);
bob();
pop2buf(b);
compile_parse_errors ();
}
%
% Parse current buffer as error output
%
public define compile_parse_buf ()
{
Compile_Output_Buffer = whatbuf();
bob ();
compile_parse_errors ();
}
$1 = "acompile.sl";
if (is_defined ("get_process_input"))
{
() = evalfile ($1);
}
% The current implementation for the database uses an associative array.
private variable Compiler_Database = Assoc_Type [Any_Type, NULL];
public define compile_select_compiler (name)
{
variable c;
c = Compiler_Database[name];
if (c == NULL)
verror ("Compiler %s is not supported. See compile.sl for more information", name);
Error_Regexp = c;
}
public define compile_add_compiler (name, regexp)
{
Compiler_Database [name] = regexp;
}
%---------------------------------------------------------------------------
% Compiler database
%---------------------------------------------------------------------------
%Borland bcc/tcc compilers
%Error foo.c 4: Undefined symbol 'x' in function main
%Warning foo.c 34: Possible use of 'y' before definition in function main
compile_add_compiler ("bcc", "^[EW][a-r]+ \\(.+\\) \\(\\d+\\):\\(\\)");
compile_add_compiler ("tcc", "^[EW][a-r]+ \\(.+\\) \\(\\d+\\):\\(\\)");
%--------------------------------------------------------------------------
%Ultrix cc compiler
%ccom: Error: t.c, line 14: LC_ALL undefined
compile_add_compiler ("ultrix_cc", "[WE][ar][r][no][ir]n?g?: +\\(.+\\), line \\(\\d+\\):\\(\\)");
%--------------------------------------------------------------------------
%hp cc compiler
%cc: "t.c", line 3: error 1588: "ddkldkjdldkj" undefined.
compile_add_compiler ("hp_cc", "^cc: +\\\"\\(.+\\)\\\", line \\(\\d+\\):\\(\\)");
%--------------------------------------------------------------------------
%Sun acc compiler
%"filename.c", line 123: error: buffer undefined
%"filename.c", line 123: warning: fin not used
compile_add_compiler ("sun_acc", "^\\\"\\(.+\\)\\\", line \\(\\d+\\):\\(\\)");
%--------------------------------------------------------------------------
%AIX compiler, which may be referenced under any of these names.
%The Fortran compiler has the same format, so allow that too
%"foo.c", line 13.4: 1506-045 (S) Undeclared identifier bar.
%"foo.f", line 21.20: 1515-019 (S) Syntax is incorrect.
%@aix;
%@xlc;
%@xlf;
compile_add_compiler ("aix", "^\\\"\\(.+\\)\\\", line \\(\\d+\\)\\.\\(\\d+\\)");
compile_add_compiler ("xlc", "^\\\"\\(.+\\)\\\", line \\(\\d+\\)\\.\\(\\d+\\)");
compile_add_compiler ("xlf", "^\\\"\\(.+\\)\\\", line \\(\\d+\\)\\.\\(\\d+\\)");
%--------------------------------------------------------------------------
%The GNU compiler
%cmds.adb:33:20: ';' expected.
%cmds.c:33: warning: initialization of non-const * pointer...
%cmds.c:1041 (cmds.o): Undefined symbol _Screen_Height referenced...
%In file included from /usr/local/src/jed/src/xterm.c:10:
compile_add_compiler ("gcc", "^\\([^ :]+\\):\\(\\d+\\)[^:]*:\\(\\d*\\)");
%--------------------------------------------------------------------------
%The WATCOM compiler wcc
%keymap.c(71): Error! E1011: Symbol 'show_memory' has not been declared
%event.c(22): Warning! W202: Symbol 'xx' has been defined, but not referenced
%Warning(1028): PhGetMsgSize_ is an undefined reference
%file event.o(/home/qnx/rwm/photon/event.c): undefined symbol PhAttach_
compile_add_compiler ("wcc", "^\\(.+\\)(\\(\\d+\\)): [EW].+[rg]! [EW]\\d+:\\(\\)");
%--------------------------------------------------------------------------
%The Java compiler javac
%Test.java:151: Method getNumber() not found in class java.lang.String.
%@javac;
compile_add_compiler ("javac", "^\\(.+\\):\\(\\d+\\):\\(\\)");
%--------------------------------------------------------------------------
%Microsoft Visual C
%cob.cpp(30) : warning C4091: no symbols were declared
%cob.cpp(32) : error C2665: 'COBFileHeader::COBFileHeader' : none of the
%2 overloads can convert parameter 1 from type 'char [34]' (new behavior;
%please see help)
%cob.cpp(38) : warning C4091: no symbols were declared
%cob.cpp(45) : warning C4091: no symbols were declared
%cob.cpp(50) : error C2239: unexpected token '{' following declaration of
%'COBChunkHead'
%@vc;
%compile_add_compiler ("vc", "^\\(.+\\)(\\(\\d+\\)) : [ew].+:\\(\\)");
%--------------------------------------------------------------------------
%Microsoft Visual C
%cob.cpp(30) : warning C4091: no symbols were declared
%cob.cpp(32) : error C2665: 'COBFileHeader::COBFileHeader' : none of the
%c:\work\library\terrain\lodland.h(12) : fatal error C1083: Cannot open include file: 'fallocr.h': No such file or directory
%c:\work\library\terrain\lodvrtx.h(62) : see declaration of 'public: static class lodland_vertex_generator * lodvertex::gen'
%@vc;
compile_add_compiler ("vc", "^[ \t]*\\(.+\\)(\\(\\d+\\)) : .*");
%--------------------------------------------------------------------------
%rgbds gameboy assembler
%*ERROR* GBC_Main.s(1) :
%*ERROR* GBC_Main.s(10) -> GBC_Hardware.h(27) :=0D
%*ERROR* : Worldsys.s(366) : Value must be 8-bit
%@rgbds;
compile_add_compiler ("rgbds", "^\\*ERROR\\*.*[\t ]\\(.+\\)(\\(\\d+\\))");
%---------------------------------------------------------------------------
% End of data base
%---------------------------------------------------------------------------
%!%+
%\variable{Compile_Default_Compiler}
%\usage{variable Compile_Default_Compiler = "gcc";}
%\description
% This variable specifies the default compiler to be assumed when parsing
% error messages in the compile buffer. If not set, "gcc" is assumed.
% Currently supported compilers include:
%#v+
% gcc (GNU C Compiler)
% bcc (Borland C Compiler)
% tcc (Turbo C Compiler)
% ultrix_cc (Ultrix C Compiler)
% hp_cc (HP C compiler)
% sun_acc (Sun ANSI C compiler)
% aix, xlc, xlf (Various AIX C compilers)
% wcc (Watcom C compiler)
% javac (Java Compiler)
% vc (Microsoft Visual C)
%#v-
%\notes
% The primary purpose of this variable is to select a compiler prior to
% loading compile.sl. Once compile.sl has been loaded, the value of this
% variable has no effect. To switch compilers, the \var{compile_select_compiler}
% function must be used.
%\seealso{compile_select_compiler, compile_add_compiler}
%!%-
custom_variable ("Compile_Default_Compiler", "gcc");
compile_select_compiler (Compile_Default_Compiler);
|