shithub: femtolisp

Download patch

ref: d1a1d3b2a82b874b79d971a4c2456854068b026a
parent: ce0ad5efc68f2f70e4c177ea89dd02c6e5ec5b3a
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Mar 9 16:22:09 EST 2023

fix bootstrapping, #\linefeed and use iswprint when printing

--- a/flisp.boot
+++ b/flisp.boot
@@ -278,7 +278,7 @@
   #fn("7000r1|c0>16:02c1i1031670c240;|;" ["" #fn(io.eof?)
 					  #fn(eof-object)])
   #fn(io.tostring!)]) #fn(buffer)] io.readall)
-	  io.readline #fn("8000r1c0|c142;" [#fn(io.readuntil) #\newline] io.readline)
+	  io.readline #fn("8000r1c0|c142;" [#fn(io.readuntil) #\linefeed] io.readline)
 	  io.readlines #fn("8000r1e0e1|42;" [read-all-of io.readline] io.readlines)
 	  iota #fn("8000r1e0e1|42;" [map-int identity] iota) keyword->symbol
 	  #fn("9000r1c0|316@0c1c2c3|313141;|;" [#fn(keyword?)
--- a/llt/utf8.c
+++ b/llt/utf8.c
@@ -18,7 +18,7 @@
 #define snprintf snprint
 #define vsnprintf vsnprint
 // iswprint straight from musl
-static int
+int
 iswprint(u32int c)
 {
 	if(c < 0xff)
--- a/print.c
+++ b/print.c
@@ -1,7 +1,7 @@
 #ifdef PLAN9
 #define isnan isNaN
 #define snprintf snprint
-#define iswprint(x) 1
+int iswprint(u32int c);
 #endif
 #include "ieee754.h"
 
@@ -652,13 +652,13 @@
             else if (wc == 0x07) outsn("alarm", f, 5);
             else if (wc == 0x08) outsn("backspace", f, 9);
             else if (wc == 0x09) outsn("tab", f, 3);
-            //else if (wc == 0x0A) outsn("linefeed", f, 8);
+            else if (wc == 'l') outsn("linefeed", f, 8);
             else if (wc == 0x0A) outsn("newline", f, 7);
             else if (wc == 0x0B) outsn("vtab", f, 4);
             else if (wc == 0x0C) outsn("page", f, 4);
             else if (wc == 0x0D) outsn("return", f, 6);
             else if (wc == 0x1B) outsn("esc", f, 3);
-            //else if (wc == 0x20) outsn("space", f, 5);
+            else if (wc == 's') outsn("space", f, 5);
             else if (wc == 0x7F) outsn("delete", f, 6);
             else if (iswprint(wc)) outs(seq, f);
             else HPOS+=ios_printf(f, "x%04x", (int)wc);