[PATCH] Avoid generating lines with trailing spaces when compiling BOOT files

2 views
Skip to first unread message

Qian Yun

unread,
Mar 14, 2021, 8:16:22 AM3/14/21
to fricas-devel
See https://github.com/oldk1331/fricas/commits/fix-boot-empty-line
for the 3 commits, but 2 of them are cleanups.

When compiling BOOT files, it used to have a lot of trailing
spaces, and we store some files under src/boot/compiled,
so this problem causes a little inconvenience for us before.
Now I fixed it from the root cause, now there should be no
more trailing spaces generated.

CI passes: https://github.com/oldk1331/fricas/runs/2106319522
Please review.

The core changes are
https://github.com/oldk1331/fricas/commit/555d2f695a414da3859b3b08d03108f99eab1d23.patch

or:

diff --git a/src/boot/ptyout.boot b/src/boot/ptyout.boot
index 002c6e0af..4ddebed70 100644
--- a/src/boot/ptyout.boot
+++ b/src/boot/ptyout.boot
@@ -258,14 +258,14 @@
else cons(car s,streamTake(n-1,cdr s))

shoeFileLines (lines,fn) ==
- shoeFileLine( '" ",fn)
+ shoeFileLine('"", fn)
for line in lines repeat shoeFileLine (shoeAddComment line,fn)
- shoeFileLine ('" ",fn)
+ shoeFileLine('"", fn)

shoeConsoleLines lines ==
- shoeConsole '" "
+ shoeConsole '""
for line in lines repeat shoeConsole shoeAddComment line
- shoeConsole '" "
+ shoeConsole '""

shoeFileLine(x, stream) ==
WRITE_-LINE(x, stream)
@@ -291,7 +291,12 @@
REALLYPRETTYPRINT fn
s:=CDR s

-shoeAddComment l== CONCAT('"; ",CAR l)
+shoeAddComment l ==
+ line := CAR l
+ if LENGTH line = 0 then
+ '";"
+ else
+ CONCAT('"; ", line)

shoeOutParse stream ==
$inputStream :local:= stream

Waldek Hebisch

unread,
Mar 14, 2021, 10:36:08 AM3/14/21
to fricas...@googlegroups.com
On Sun, Mar 14, 2021 at 08:16:09PM +0800, Qian Yun wrote:
> See https://github.com/oldk1331/fricas/commits/fix-boot-empty-line
> for the 3 commits, but 2 of them are cleanups.
>
> When compiling BOOT files, it used to have a lot of trailing
> spaces, and we store some files under src/boot/compiled,
> so this problem causes a little inconvenience for us before.
> Now I fixed it from the root cause, now there should be no
> more trailing spaces generated.
>
> CI passes: https://github.com/oldk1331/fricas/runs/2106319522
> Please review.

Looks OK, please commit.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages