]> gitweb.factorcode.org Git - factor.git/commitdiff
fix fcopy
authorSlava Pestov <slava@factorcode.org>
Fri, 3 Sep 2004 01:51:19 +0000 (01:51 +0000)
committerSlava Pestov <slava@factorcode.org>
Fri, 3 Sep 2004 01:51:19 +0000 (01:51 +0000)
Makefile
TODO.FACTOR.txt
library/cross-compiler.factor
library/platform/native/io-internals.factor
native/port.c
native/port.h
native/primitives.c
native/primitives.h
native/write.c

index 68aeb295752f9095b782afa31d231212e22f905e..4ed97ccb129ac1b2fd9ce649b09668796abae417 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-CC = gcc34
-CFLAGS = -Os -ffast-math -march=pentium4 -Wall -fomit-frame-pointer
+CC = gcc
+CFLAGS = -g -Wall
 LIBS = -lm
 STRIP = strip
 
@@ -18,7 +18,7 @@ OBJS = native/arithmetic.o native/array.o native/bignum.o \
 
 f: $(OBJS)
        $(CC) $(LIBS) -o $@ $(OBJS)
-       $(STRIP) $@
+#      $(STRIP) $@
 
 clean:
        rm -f $(OBJS)
index 3b2515ca93748a7f1ff38cca6411d3a32a3caf10..6508c2527cd203a49eb1a086a7b69b21e58f61a5 100644 (file)
@@ -69,6 +69,8 @@
 \r
 + native:\r
 \r
+- fix error postoning -- not all errors thrown by i/o code are\r
+  postponed\r
 - sbuf-hashcode\r
 - vector-hashcode\r
 - irc: stack underflow?\r
index 573f20eb7088b279a31dd372847f887e8311eaf8..2d115962bc62f433b7594f4d3a651b06a14b70e3 100644 (file)
@@ -79,6 +79,7 @@ DEFER: can-write?
 DEFER: add-write-io-task
 DEFER: write-fd-8
 DEFER: add-copy-io-task
+DEFER: pending-io-error
 DEFER: next-io-task
 
 IN: math
@@ -247,6 +248,7 @@ IN: cross-compiler
         add-write-io-task
         write-fd-8
         add-copy-io-task
+        pending-io-error
         next-io-task
         room
         os-env
index b3ce88c243ce1ec4d5e9843aa0f8bf864610f747..47302832a95f1d067042c347d63ff424e8130ab2 100644 (file)
@@ -73,4 +73,5 @@ USE: threads
     dup wait-to-accept accept-fd ;
 
 : blocking-copy ( in out -- )
-    [ add-copy-io-task (yield) ] callcc0 2drop ;
+    [ add-copy-io-task (yield) ] callcc0
+    pending-io-error pending-io-error ;
index 25e5d876ec2c70f4948b116ef630c431dd31fd97..88c468dc4e2435fb80c10987e7b0f1c5b40f2d3c 100644 (file)
@@ -100,3 +100,8 @@ void pending_io_error(PORT* port)
                general_error(ERROR_IO,io_error);
        }
 }
+
+void primitive_pending_io_error(void)
+{
+       pending_io_error(untag_port(dpop()));
+}
index 3553a037aae01d3b82411617bc206f52bb11962e..fa2d0d9df95b958b1aace90c7179051012db7f52 100644 (file)
@@ -42,3 +42,4 @@ void collect_port(PORT* port);
 void postpone_io_error(PORT* port, const char* func);
 void io_error(const char* func);
 void pending_io_error(PORT* port);
+void primitive_pending_io_error(void);
index e845e32604edeb78193e6989ac6cc8668a0a258c..b2607d68f1c0aa256b8ce2cdeeb99528a61688f5 100644 (file)
@@ -133,6 +133,7 @@ XT primitives[] = {
        primitive_add_write_io_task,
        primitive_write_8,
        primitive_add_copy_io_task,
+       primitive_pending_io_error,
        primitive_next_io_task,
        primitive_room,
        primitive_os_env,
index 66097546ab52ef949d83c44b3089d40d896d53d7..95ef45ac2f83315721cff7212fecd8757cfcfafb 100644 (file)
@@ -1,4 +1,4 @@
 extern XT primitives[];
-#define PRIMITIVE_COUNT 147
+#define PRIMITIVE_COUNT 148
 
 CELL primitive_to_xt(CELL primitive);
index 917d335524424d31464ed4b1756407b2fbe4b2ea..c918a9adc0b6d13e13d4f9c96776c01cf3743a47 100644 (file)
@@ -21,8 +21,6 @@ bool can_write(PORT* port, FIXNUM len)
 {
        CELL buf_capacity;
 
-       pending_io_error(port);
-
        if(port->type != PORT_WRITE)
                general_error(ERROR_INCOMPATIBLE_PORT,tag_object(port));
 
@@ -42,6 +40,7 @@ void primitive_can_write(void)
 {
        PORT* port = untag_port(dpop());
        FIXNUM len = to_fixnum(dpop());
+       pending_io_error(port);
        dpush(tag_boolean(can_write(port,len)));
 }
 
@@ -73,6 +72,8 @@ void write_char_8(PORT* port, FIXNUM ch)
 {
        char c = (char)ch;
 
+       pending_io_error(port);
+
        if(!can_write(port,1))
                io_error(__FUNCTION__);
 
@@ -94,6 +95,8 @@ void write_string_8(PORT* port, STRING* str)
 {
        char* c_str;
        
+       pending_io_error(port);
+
        /* Note this ensures the buffer is large enough to fit the string */
        if(!can_write(port,str->capacity))
                io_error(__FUNCTION__);