/************************************************************************ * "Epsilon", "EEL" and "Lugaru" are trademarks of Lugaru Software, Ltd. * * * * Copyright (C) 1985, 1989 Lugaru Software Ltd. All rights reserved. * * * * Limited permission is hereby granted to reproduce and modify this * * copyrighted material provided that the resulting code is used only in * * conjunction with Lugaru products and that this notice is retained in * * any such reproduction or modification. * ************************************************************************/ #include "eel.h" char ignore_error[70]; /* if error matches this pattern, we will ignore it */ /* to ignore warnings, for example, set to .*warning.* */ int ndp_error; /* does this error msg match NDP pattern? */ #define ERROR_PATTERN "^(error |warning |\"*)(([a-z]:)*[+-9A-z]+)\"*\ ([ (:]|(, line ))([0-9]+)(:|[^0-9\n].*:).*" #define FILE_PAREN 2 /* filename is in 2nd () pair above */ #define LINE_PAREN 6 /* line# is in 6th pair of parens above */ #define NDP_ERROR_PATTERN "^%*%*%*%* Error on line ([0-9]+) of \ (([a-z]:)*[+-9A-z]+) :" #define NDP_FILE_PAREN 2 /* filename is in 2nd () pair above */ #define NDP_LINE_PAREN 1 /* line# is in 1st pair of parens above */ do_next_error(count) { char *orig = bufname, file[FNAMELEN], number[30], line[130], *msg; int lineno, origpt, dir, old; if (!exist("process")) error("No process buffer to read errors from."); bufname = "process"; origpt = point; case_fold = 1; if (error_spot) point = *error_spot; else { error_spot = alloc_spot(); point = 0; } msg = point ? "No more errors" : "No errors"; sayput("Searching..."); if (!count) find_error(-1), count = 1; dir = (count > 0) ? 1 : -1; for (; count; count -= dir) { if (!find_error(dir)) { point = origpt; bufname = orig; say(msg); return 0; } if (dir > 0) to_end_line(); } if (ndp_error) { grab(find_group(NDP_FILE_PAREN, 1), find_group(NDP_FILE_PAREN, 0), file); grab(find_group(NDP_LINE_PAREN, 1), find_group(NDP_LINE_PAREN, 0), number); parse_string(1, "\n.*\n[ \t]*^(.*)", (char *)0); grab(find_group(1, 1), find_group(1, 0), line); } else { grab(find_group(FILE_PAREN, 1), find_group(FILE_PAREN, 0), file); grab(find_group(LINE_PAREN, 1), find_group(LINE_PAREN, 0), number); grab(find_group(0, 1), find_group(0, 0), line); } *error_spot = point; point = origpt; lineno = strtoi(number, 10); absolute(file); bufname = orig; locate_window("", file); find_it(file, 1); go_line(lineno); say("=>%.78s", line); return 1; } find_error(dir) /* find next error in direction, return 1 */ { int old = point; while (search(dir, ":")) { to_begin_line(); if ((!*ignore_error || !parse_string(1, ignore_error, (char *)0)) && is_line_error()) return 1; if (dir > 0) nl_forward(); } *error_spot = old; return 0; } is_line_error() { ndp_error = 0; if (parse_string(1, ERROR_PATTERN, (char *)0)) return 1; ndp_error = 1; return parse_string(1, NDP_ERROR_PATTERN, (char *)0); }