From db81ba67f7191b638ee48917418f119df30e24f2 Mon Sep 17 00:00:00 2001 From: Ole Streicher Date: Thu, 14 Sep 2017 14:57:17 +0200 Subject: [PATCH] Dont output line numbers before they were set first The first lines of an xpp preprocessed file contain stuff from include files; prominently `lib/sysruk.x`. Here, xpp does not issue line numbers. This patch prevents rpp from printing (wrong) linenumbers and the wrong input file. --- unix/boot/spp/rpp/rppfor/ngetch.f | 1 + unix/boot/spp/rpp/rppfor/outdon.f | 3 ++- unix/boot/spp/rpp/rpprat/ngetch.r | 4 +++- unix/boot/spp/rpp/rpprat/outdon.r | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/unix/boot/spp/rpp/rppfor/ngetch.f b/unix/boot/spp/rpp/rppfor/ngetch.f index 998e707a4..25d1ddec4 100644 --- a/unix/boot/spp/rpp/rppfor/ngetch.f +++ b/unix/boot/spp/rpp/rppfor/ngetch.f @@ -81,6 +81,7 @@ integer function ngetch (c) linect (level) = n - 1 23006 continue 23004 continue + if (.not.(linect (level) .gt. 0))goto23003 linect (level) = linect (level) + 1 23003 continue goto 23001 diff --git a/unix/boot/spp/rpp/rppfor/outdon.f b/unix/boot/spp/rpp/rppfor/outdon.f index d3582ff98..6e238b089 100644 --- a/unix/boot/spp/rpp/rppfor/outdon.f +++ b/unix/boot/spp/rpp/rppfor/outdon.f @@ -67,7 +67,8 @@ subroutine outdon data sline0(1)/35/,sline0(2)/108/,sline0(3)/105/,sline0(4)/110/,sl *ine0(5)/101/,sline0(6)/32/,sline0(7)/-2/ if (.not.(dbgout .eq. 1))goto 23000 - if (.not.(body .eq. 1 .or. dbglev .ne. level))goto 23002 + if (.not.((body .eq. 1 .or. dbglev .ne. level) + * .and. linect (level) .gt. 0))goto 23002 op = 1 ip=1 23004 if (.not.(sline0(ip) .ne. -2))goto 23006 diff --git a/unix/boot/spp/rpp/rpprat/ngetch.r b/unix/boot/spp/rpp/rpprat/ngetch.r index 26dce4de5..161c5e6e8 100644 --- a/unix/boot/spp/rpp/rpprat/ngetch.r +++ b/unix/boot/spp/rpp/rpprat/ngetch.r @@ -23,7 +23,9 @@ linect (level) = n - 1 } } - linect (level) = linect (level) + 1 + if (linect (level) > 0) { + linect (level) = linect (level) + 1 + } } else { c = buf (bp) diff --git a/unix/boot/spp/rpp/rpprat/outdon.r b/unix/boot/spp/rpp/rpprat/outdon.r index 5ea969bb9..3af87756c 100644 --- a/unix/boot/spp/rpp/rpprat/outdon.r +++ b/unix/boot/spp/rpp/rpprat/outdon.r @@ -13,7 +13,7 @@ # If dbgout is enabled output the "#line" statement. if (dbgout == YES) { - if (body == YES | dbglev != level) { + if ((body == YES | dbglev != level) & linect (level) > 0) { op = 1 for (ip=1; s_line(ip) != EOS; ip=ip+1) { obuf(op) = s_line(ip)