aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-06-17 23:24:12 -0400
committerB. Watson <urchlay@slackware.uk>2024-06-17 23:24:12 -0400
commite1ba78324eccdb4db798bf05d640d616ccecc217 (patch)
tree3eabea30cc413c5e39cc24cba89e275842b41dd3
parentb57d048cf1b673c0b4820283858652e2042ecbcc (diff)
downloadbw-atari8-tools-e1ba78324eccdb4db798bf05d640d616ccecc217.tar.gz
renumbas: list which lines ref a nonexistent line.
-rw-r--r--renumbas.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/renumbas.c b/renumbas.c
index c113ddc..3eafc5e 100644
--- a/renumbas.c
+++ b/renumbas.c
@@ -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();