fix fcopy

cvs
Slava Pestov 2004-09-03 01:51:19 +00:00
parent f75e3ca0a8
commit a7036e5e7a
9 changed files with 22 additions and 7 deletions

View File

@ -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)

View File

@ -69,6 +69,8 @@
+ native:
- fix error postoning -- not all errors thrown by i/o code are
postponed
- sbuf-hashcode
- vector-hashcode
- irc: stack underflow?

View 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

View 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 ;

View 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()));
}

View 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);

View 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,

View File

@ -1,4 +1,4 @@
extern XT primitives[];
#define PRIMITIVE_COUNT 147
#define PRIMITIVE_COUNT 148
CELL primitive_to_xt(CELL primitive);

View 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__);