diff options
author | B. Watson <urchlay@slackware.uk> | 2024-06-17 23:24:12 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-06-17 23:24:12 -0400 |
commit | e1ba78324eccdb4db798bf05d640d616ccecc217 (patch) | |
tree | 3eabea30cc413c5e39cc24cba89e275842b41dd3 | |
parent | b57d048cf1b673c0b4820283858652e2042ecbcc (diff) | |
download | bw-atari8-tools-e1ba78324eccdb4db798bf05d640d616ccecc217.tar.gz |
renumbas: list which lines ref a nonexistent line.
-rw-r--r-- | renumbas.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -75,7 +75,7 @@ CALLBACK(renumber_line) { if(lineno < limit || lineno == 32768) return; if(newno >= 32768) { - fprintf(stderr, "Fatal: New line number %d out of range, renumber failed.\n", newno); + fprintf(stderr, "%s: Fatal: New line number %d out of range, renumber failed.\n", self, newno); exit(1); } @@ -89,14 +89,21 @@ CALLBACK(renumber_line) { newno += increment; } -void renumber(void) { - int i; +void check_refs(void) { + int i, j; for(i = 0; i < 32768; i++) { - if(refcounts[i] && !lines_exist[i]) - fprintf(stderr, "Warning: Line %d is referenced, but does not exist.\n", i); + if(refcounts[i] && !lines_exist[i]) { + for(j = 0; j < refcounts[i]; j++) { + fprintf(stderr, "%s: Warning: Line %d references nonexistent line %d.\n", + self, linerefs[i][j].lineno, i); + } + } } +} +void renumber(void) { + check_refs(); newno = startlineno; on_start_line = renumber_line; walk_all_code(); |