mirror of
https://github.com/open-simh/simtools.git
synced 2026-04-30 21:38:29 +00:00
Always list lines that have an error
This commit is contained in:
22
listing.c
22
listing.c
@@ -30,16 +30,26 @@ FILE *lstfile = NULL;
|
|||||||
|
|
||||||
int list_pass_0 = 0;/* Also list what happens during the first pass */
|
int list_pass_0 = 0;/* Also list what happens during the first pass */
|
||||||
|
|
||||||
|
static int errline = 0; /* Set if current line has an error */
|
||||||
|
|
||||||
|
/* maybe_list returns TRUE if listing may happen for this line. */
|
||||||
|
|
||||||
|
static int can_list(
|
||||||
|
void)
|
||||||
|
{
|
||||||
|
int ok = lstfile != NULL &&
|
||||||
|
(pass > 0 || list_pass_0);
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
/* do_list returns TRUE if listing is enabled. */
|
/* do_list returns TRUE if listing is enabled. */
|
||||||
|
|
||||||
static int dolist(
|
static int dolist(
|
||||||
void)
|
void)
|
||||||
{
|
{
|
||||||
int ok = lstfile != NULL &&
|
int ok = can_list () &&
|
||||||
(pass > 0 || list_pass_0) &&
|
(list_level > 0 || errline);
|
||||||
list_level > 0;
|
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@@ -50,9 +60,11 @@ void list_source(
|
|||||||
STREAM *str,
|
STREAM *str,
|
||||||
char *cp)
|
char *cp)
|
||||||
{
|
{
|
||||||
if (dolist()) {
|
if (can_list()) {
|
||||||
int len = strcspn(cp, "\n");
|
int len = strcspn(cp, "\n");
|
||||||
|
|
||||||
|
/* Not an error yet */
|
||||||
|
errline = 0;
|
||||||
/* Save the line text away for later... */
|
/* Save the line text away for later... */
|
||||||
if (listline)
|
if (listline)
|
||||||
free(listline);
|
free(listline);
|
||||||
@@ -165,6 +177,8 @@ void report(
|
|||||||
if (!pass && list_pass_0 < 2)
|
if (!pass && list_pass_0 < 2)
|
||||||
return; /* Don't report now. */
|
return; /* Don't report now. */
|
||||||
|
|
||||||
|
errline = 1;
|
||||||
|
|
||||||
if (str) {
|
if (str) {
|
||||||
name = str->name;
|
name = str->name;
|
||||||
line = str->line;
|
line = str->line;
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
4 ;
|
4 ;
|
||||||
5
|
5
|
||||||
6 ; This should get listed (list_level 1)
|
6 ; This should get listed (list_level 1)
|
||||||
7 .nlist
|
9 .list
|
||||||
10 ; This should get listed (list_level 1)
|
10 ; This should get listed (list_level 1)
|
||||||
11 .list
|
11 .list
|
||||||
12 ; This should get listed (list_level 2)
|
12 ; This should get listed (list_level 2)
|
||||||
13 .nlist
|
13 .nlist
|
||||||
14 ; This should get listed (list_level 1)
|
14 ; This should get listed (list_level 1)
|
||||||
15 .nlist
|
21 .list
|
||||||
22 ; This should get listed (list_level 1)
|
22 ; This should get listed (list_level 1)
|
||||||
22
|
22
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user