shithub: femtolisp

Download patch

ref: 413350ab6658c7d7fd041a35d5b1981b4bc356b4
parent: 12a2928c2a6ecbac382c5fe20c8fe28dec47d8c4
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Nov 11 15:49:06 EST 2024

print_iostream: dump the filename as well, if any; make std* file names match their in-lisp symbols

--- a/ios.c
+++ b/ios.c
@@ -796,17 +796,17 @@
 {
 	ios_stdin = LLT_ALLOC(sizeof(ios_t));
 	ios_fd(ios_stdin, STDIN_FILENO, 0, 0);
-	ios_stdin->filename = LLT_STRDUP("<stdin>");
+	ios_stdin->filename = LLT_STRDUP("*stdin*");
 
 	ios_stdout = LLT_ALLOC(sizeof(ios_t));
 	ios_fd(ios_stdout, STDOUT_FILENO, 0, 0);
 	ios_stdout->bm = bm_line;
-	ios_stdout->filename = LLT_STRDUP("<stdout>");
+	ios_stdout->filename = LLT_STRDUP("*stdout*");
 
 	ios_stderr = LLT_ALLOC(sizeof(ios_t));
 	ios_fd(ios_stderr, STDERR_FILENO, 0, 0);
 	ios_stderr->bm = bm_none;
-	ios_stderr->filename = LLT_STRDUP("<stderr>");
+	ios_stderr->filename = LLT_STRDUP("*stderr*");
 }
 
 /* higher level interface */
--- a/iostream.c
+++ b/iostream.c
@@ -10,7 +10,12 @@
 print_iostream(value_t v, ios_t *f)
 {
 	USED(v);
-	fl_print_str("#<io stream>", f);
+	fl_print_str("#<io stream", f);
+	if(*f->filename){
+		fl_print_chr(' ', f);
+		fl_print_str(f->filename, f);
+	}
+	fl_print_chr('>', f);
 }
 
 static void