aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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();