shithub: femtolisp

Download patch

ref: e7b05893fe8529135e7f4ce31f3f8bcaec4746c4
parent: f99b92aae9240ad9834ccf8e8f9c322ad2fbd4fc
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Nov 4 19:41:45 EST 2024

rename io-tostring! → iostream->string

--- a/aliases.scm
+++ b/aliases.scm
@@ -110,7 +110,7 @@
 (define (open-output-string) (buffer))
 (define (open-string-output-port)
   (let ((b (buffer)))
-    (values b (lambda () (io-tostring! b)))))
+    (values b (lambda () (iostream->string b)))))
 
 (define (get-output-string b)
   (let ((p (io-pos b)))
@@ -280,7 +280,7 @@
 (define (with-output-to-string nada thunk)
   (let ((b (buffer)))
     (with-output-to b (thunk))
-    (io-tostring! b)))
+    (iostream->string b)))
 
 (define (read-u8) (io-read *input-stream* 'uint8))
 (define modulo mod)
--- a/compiler.lsp
+++ b/compiler.lsp
@@ -156,7 +156,7 @@
 				 (- (get label-to-loc labl)
 				    addr)))))
        fixup-to-label)
-      (io-tostring! bcode))))
+      (iostream->string bcode))))
 
 (define (const-to-idx-vec e)
   (let ((cvec (vector-alloc (bcode:nconst e))))
--- a/flisp.boot
+++ b/flisp.boot
@@ -228,7 +228,7 @@
   (loadv.l loadg.l setg.l loada.l seta.l largc lvargc call.l tcall.l)
   #fn(io-write) int32 (loadc setc) uint8 (loadc.l setc.l optargs keyargs)
   keyargs)) table-foreach #fn("<000n22090405242190491037072@4073249021520\x805162:" #(#fn(io-seek)
-  #fn(io-write) int32 int16 #fn(get))) #fn(io-tostring!)))
+  #fn(io-write) int32 int16 #fn(get))) #fn(iostream->string)))
   #fn(length) #fn(table) #fn(buffer))) >= #fn(length) 65536)) list->vector))
 						      reverse!) encode-byte-code)
 	    error #fn(":000|020210P61:" #(#fn(raise) error) error) eval
@@ -277,7 +277,7 @@
 	    io-readall #fn("7000n120>215061:" #(#fn("8000n1200A52421>2205161:" #(#fn(io-copy)
   #fn("7000n1020d;3:0421910513702260:0:" #("" #fn(io-eof?)
 					   #fn(eof-object)))
-  #fn(io-tostring!))) #fn(buffer)) io-readall)
+  #fn(iostream->string))) #fn(buffer)) io-readall)
 	    io-readline #fn("8000n12002162:" #(#fn(io-readuntil) #\newline) io-readline)
 	    io-readlines #fn("8000n17071062:" #(read-all-of io-readline) io-readlines)
 	    iota #fn("8000n17071062:" #(map-int identity) iota) keyword->symbol
@@ -376,7 +376,7 @@
   *interactive* filter closure? #fn(map) #fn("7000n10Z;380420061:" #(#fn(top-level-value)))
   #fn(environment)))) print-stack-trace)
 	    print-to-string #fn("7000n120>215061:" #(#fn("8000n120A052421061:" #(#fn(write)
-  #fn(io-tostring!))) #fn(buffer)) print-to-string)
+  #fn(iostream->string))) #fn(buffer)) print-to-string)
 	    printable? #fn("7000n120051;I80421051S:" #(#fn(iostream?)
 						       #fn(eof-object?)) printable?)
 	    quote-value #fn("7000n1700513400:210e2:" #(self-evaluating? quote) quote-value)
@@ -413,11 +413,11 @@
   unquote-nsplicing unquote length>) splice-form?)
 	    string-join #fn("7000n20J5020:21>225061:" #("" #fn("8000n1200A<5247122>A=52423061:" #(#fn(io-write)
   for-each #fn("8000n120A91152420A062:" #(#fn(io-write)))
-  #fn(io-tostring!))) #fn(buffer)) string-join)
+  #fn(iostream->string))) #fn(buffer)) string-join)
 	    string-lpad #fn(";000n3207182122051\x8052062:" #(#fn(string)
 							     string-rep #fn(string-length)) string-lpad)
 	    string-map #fn("9000n220>21502215162:" #(#fn("7000n220>E51421061:" #(#fn(";000n1D0FL3P0420A910219110525152472051?0@\x0e/:" #(#fn(io-putc)
-  #fn(string-char) 1+)) #fn(io-tostring!)))
+  #fn(string-char) 1+)) #fn(iostream->string)))
 						     #fn(buffer)
 						     #fn(string-length)) string-map)
 	    string-rep #fn(";000n21r4L3`0701E5235021:1Kl38022061:1r2l390220062:2200063:731513@02207401K\x805262:742200521r2j262:" #(<=
--- a/iostream.c
+++ b/iostream.c
@@ -394,7 +394,7 @@
 	return str;
 }
 
-BUILTIN("io-tostring!", io_tostring)
+BUILTIN("iostream->string", io_tostring)
 {
 	argcount(nargs, 1);
 	ios_t *src = toiostream(args[0]);
--- a/system.lsp
+++ b/system.lsp
@@ -619,7 +619,7 @@
 (define (io-readall s)
   (let ((b (buffer)))
     (io-copy b s)
-    (let ((str (io-tostring! b)))
+    (let ((str (iostream->string b)))
       (if (and (equal? str "") (io-eof? s))
 	  (eof-object)
 	  str))))
@@ -704,7 +704,7 @@
       (while (< i n)
 	     (begin (io-putc b (f (string-char s i)))
 		    (set! i (1+ i)))))
-    (io-tostring! b)))
+    (iostream->string b)))
 
 (define (string-rep s k)
   (cond ((< k 4)
@@ -721,7 +721,7 @@
 (define (print-to-string v)
   (let ((b (buffer)))
     (write v b)
-    (io-tostring! b)))
+    (iostream->string b)))
 
 (define (string-join strlist sep)
   (if (null? strlist) ""
@@ -730,7 +730,7 @@
 	(for-each (λ (s) (begin (io-write b sep)
 				     (io-write b s)))
 		  (cdr strlist))
-	(io-tostring! b))))
+	(iostream->string b))))
 
 ; toplevel --------------------------------------------------------------------
 
--- a/test/unittest.lsp
+++ b/test/unittest.lsp
@@ -336,7 +336,7 @@
 (define (with-output-to-string nada thunk)
   (let ((b (buffer)))
     (with-output-to b (thunk))
-    (io-tostring! b)))
+    (iostream->string b)))
 
 (let ((c #\a))
   (assert (equal? (with-output-to-string #f (lambda () (print (list c c))))