shithub: femtolisp

Download patch

ref: a8d1ad751face3ee5a4f405db2b0b3cd98ba840e
parent: 1abba471c0aa02eb166c4acc3437e799e994fe49
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Mon Dec 23 14:58:33 EST 2024

remove eof-object

--- a/compiler.lsp
+++ b/compiler.lsp
@@ -485,8 +485,6 @@
                ((eq? x nil) (emit g 'loadnil))
                ((void? x)   (emit g 'loadvoid))
                ((fits-i8 x) (emit g 'loadi8 x))
-               ((eof-object? x)
-                (compile-in g env tail? (list (top-level-value 'eof-object))))
                (else        (emit g 'loadv x))))
         ((eq? (car x) 'aset!)
          (compile-aset! g env (cdr x)))
--- a/flisp.boot
+++ b/flisp.boot
@@ -131,10 +131,10 @@
   encode-byte-code bcode:code const-to-idx-vec bcode:cenv) compile-f-)
 	    compile-if #fn("A000n470051700517005183T718351728351B3;0738351@6074508;DC=07501828<64:8;OC=07501828=64:7501O8;895547602789534780885247501828<544823<07602952@;07602:8:534780895247501828=5447808:62:" #(make-label
   caddr cdddr cadddr void compile-in emit brf mark-label ret jmp) compile-if)
-	    compile-in #fn("B000\x8740005000\x884000I60O?4483R3<0700183D64:83H3\xc0083EC:07102262:83KC:07102362:83DC:07102462:83OC:07102562:83qC:07102662:7783513:07102862:7983513<07102:8363:2;83513C07<01822=2>51e164:7102?8363:83<2@C<07A0183=63:83<RS;ID0483<Z;I;047B83<1523=07C01828364:83<892DCS07E83T513>07<018283T64:7102?83T63:892FC=07G01828364:892HC>07I018283=64:892JC;07K018363:892LCD07M2N183>22O01>262:892PC@07Q018283=8465:892RC>07S018283=64:892TCE07U0183T2H7V8351P64:892WCE07<01D83T5447102X62:892YC\x93083T7V83517Z8;518:R360O@807[2\\5148<3`08;=?;47]8:8<8;<B;3G047^8;<<51;3:047_8;<5153@30O47`018:8;<64:892aCp07<01O2Lq83Te35447b7c835151360O@807[2d5147<01O7c83515447102a62:7C01828364:" #(compile-sym
-  emit load0 load1 loadt loadf loadnil void? loadvoid fits-i8 loadi8 #fn(eof-object?) compile-in #fn(top-level-value)
-  eof-object loadv aset! compile-aset! in-env? compile-app quote self-evaluating? if compile-if
-  begin compile-begin prog1 compile-prog1 λ call-with-values #fn("7000n070AF62:" #(compile-f-))
+	    compile-in #fn("B000\x8740005000\x884000I60O?4483R3<0700183D64:83H3\xa6083EC:07102262:83KC:07102362:83DC:07102462:83OC:07102562:83qC:07102662:7783513:07102862:7983513<07102:8363:7102;8363:83<2<C<07=0183=63:83<RS;ID0483<Z;I;047>83<1523=07?01828364:83<892@CS07A83T513>07B018283T64:7102;83T63:892CC=07D01828364:892EC>07F018283=64:892GC;07H018363:892ICD07J2K183>22L01>262:892MC@07N018283=8465:892OC>07P018283=64:892QCE07R0183T2E7S8351P64:892TCE07B01D83T5447102U62:892VC\x93083T7S83517W8;518:R360O@807X2Y5148<3`08;=?;47Z8:8<8;<B;3G047[8;<<51;3:047\\8;<5153@30O47]018:8;<64:892^Cp07B01O2Iq83Te35447_7`835151360O@807X2a5147B01O7`83515447102^62:7?01828364:" #(compile-sym
+  emit load0 load1 loadt loadf loadnil void? loadvoid fits-i8 loadi8 loadv aset! compile-aset!
+  in-env? compile-app quote self-evaluating? compile-in if compile-if begin compile-begin prog1
+  compile-prog1 λ call-with-values #fn("7000n070AF62:" #(compile-f-))
   #fn("9000n270A2105341\x85K02223AF>2152470A242515163:\x8d:" #(emit loadv #fn(for-each)
 							       #fn("9000n170AF0O64:" #(compile-sym))
 							       closure #fn(length))) and
@@ -244,11 +244,9 @@
 	    index-of #fn("9000n31J40O:01<C5082:7001=82KM63:" #(index-of) index-of) inlineable?
 	    #fn("9000n10<85B;3u047085<51;3i047185T51;3]04727385T52;3O047485T2552S;3@047685T270=5162:" #(is-lambda?
   list? every symbol? length> 255 length= #fn(length)) inlineable?)
-	    io-readall #fn("8000n12050218505242285518623d3?0240513702560:86:" #(#fn(buffer)
-										#fn(io-copy)
-										#fn(iostream->string)
-										"" #fn(io-eof?)
-										#fn(eof-object)) io-readall)
+	    io-readall #fn("8000n1205021850524228561:" #(#fn(buffer)
+							 #fn(io-copy)
+							 #fn(iostream->string)) io-readall)
 	    io-readline #fn("7000n12002162:" #(#fn(io-readuntil) #\newline) io-readline)
 	    io-readlines #fn("7000n17071062:" #(read-all-of io-readline) io-readlines) iota
 	    #fn("7000n17071062:" #(map-int identity) iota) is-lambda? #fn("6000n1020Q;I704020Q:" #(λ) is-lambda?)
--- a/iostream.c
+++ b/iostream.c
@@ -52,13 +52,6 @@
 	return isiostream(args[0]) ? FL_t : FL_f;
 }
 
-BUILTIN("eof-object", eof_object)
-{
-	USED(args);
-	argcount(nargs, 0);
-	return FL_eof;
-}
-
 BUILTIN("eof-object?", eof_objectp)
 {
 	argcount(nargs, 1);
--- a/mkboot0.lsp
+++ b/mkboot0.lsp
@@ -2,7 +2,6 @@
 
 (if (not (bound? 'top-level-value)) (set! top-level-value %eval))
 (if (not (bound? 'set-top-level-value!)) (set! set-top-level-value! set))
-(if (not (bound? 'eof-object?)) (set! eof-object? (λ (x) #f)))
 
 (define update-compiler
    (let ((C ()))
--- a/system.lsp
+++ b/system.lsp
@@ -599,10 +599,7 @@
 (define (io-readall s)
   (let ((b (buffer)))
     (io-copy b s)
-    (let ((str (iostream->string b)))
-      (if (and (equal? str "") (io-eof? s))
-          (eof-object)
-          str))))
+    (iostream->string b)))
 
 (define-macro (with-output-to stream . body)
   `(with-bindings ((*output-stream* ,stream))
--- a/test/unittest.lsp
+++ b/test/unittest.lsp
@@ -256,16 +256,6 @@
 (assert (not (equal? (string (gensym)) (string (gensym)))))
 (let ((gs (gensym))) (assert (eq? gs gs)))
 
-; eof object
-(assert (eof-object? (eof-object)))
-(assert (not (eof-object? 1)))
-(assert (not (eof-object? 'a)))
-(assert (not (eof-object? '())))
-(assert (not (eof-object? #f)))
-(assert (not (null? (eof-object))))
-(assert (not (builtin? (eof-object))))
-(assert (not (function? (eof-object))))
-
 ; ok, a couple end-to-end tests as well
 (define (fib n) (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))
 (assert (equal? (fib 20) 6765))