X-Git-Url: http://nitlanguage.org diff --git a/c_src/stream_nit.c b/c_src/stream_nit.c index de71a41..14bfece 100644 --- a/c_src/stream_nit.c +++ b/c_src/stream_nit.c @@ -13,84 +13,13 @@ #include "stream_nit.h" -#include -#include - int stream_FDStream_FDStream_native_read_char_1(void *s, int fd) { int result; char buf; ssize_t r = read(fd, &buf, 1); - if (r == 0) + if (r == 0) result = -1; - else + else result = buf; return result; } -#ifndef NONITCNI - -/* -C implementation of stream::Object::intern_poll - -Imported methods signatures: - bigint Array_length( Array recv ) for array::AbstractArrayRead::(abstract_collection::Collection::length) - nullable_Object Array__index( Array recv, bigint index ) for array::Array::(abstract_collection::SequenceRead::[]) - int nullable_Object_is_a_bigint( nullable_Object value ) to check if a nullable Object is a Int - bigint nullable_Object_as_bigint( nullable_Object value ) to cast from nullable Object to Int - int Int_is_null( nullable_Int value ) to check if a nullable Int is a Int - bigint bigint_as_not_null( nullable_Int value ) to cast from nullable Int to Int -*/ -nullable_Int Object_intern_poll___impl( Object recv, Array in_fds, Array out_fds ) { - int in_len, out_len, total_len; - struct pollfd *c_fds; - sigset_t sigmask; - int i; - nullable_Object tmp_nit_obj; - int first_polled_fd = -1; - int result; - - in_len = Array_length( in_fds ); - out_len = Array_length( out_fds ); - total_len = in_len + out_len; - c_fds = malloc( sizeof(struct pollfd) * total_len ); - - /* input streams */ - for ( i=0; i 0 ) { - /* analyse results */ - for ( i=0; i