merged everything except read.c
parent
c88fb98ef8
commit
41e63af7e5
|
@ -1,4 +1,4 @@
|
|||
#include "factor.h"
|
||||
#include "../factor.h"
|
||||
|
||||
/* Return true if something was read */
|
||||
bool read_step(F_PORT* port)
|
|
@ -1,4 +1,4 @@
|
|||
#include "factor.h"
|
||||
#include "../factor.h"
|
||||
|
||||
void signal_handler(int signal, siginfo_t* siginfo, void* uap)
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
#include "factor.h"
|
||||
#include "../factor.h"
|
||||
|
||||
void init_sockaddr(struct sockaddr_in* name,
|
||||
const char* hostname, uint16_t port)
|
|
@ -1,4 +1,4 @@
|
|||
#include "factor.h"
|
||||
#include "../factor.h"
|
||||
|
||||
/* Return true if write was done */
|
||||
void write_step(F_PORT* port)
|
|
@ -0,0 +1,50 @@
|
|||
#include "../factor.h"
|
||||
|
||||
void primitive_add_write_io_task (void)
|
||||
{
|
||||
callback_list = cons(dpop(), callback_list);
|
||||
dpop();
|
||||
}
|
||||
|
||||
void primitive_can_write (void)
|
||||
{
|
||||
dpop(); dpop();
|
||||
box_boolean(true);
|
||||
}
|
||||
|
||||
void write_char_8 (PORT *port, FIXNUM ch)
|
||||
{
|
||||
char buf = (char)ch;
|
||||
WriteFile((HANDLE)port->fd, &buf, 1, NULL, NULL);
|
||||
}
|
||||
|
||||
void write_string_8 (PORT *port, STRING *str)
|
||||
{
|
||||
WriteFile((HANDLE)port->fd, to_c_string(str), str->capacity, NULL, NULL);
|
||||
}
|
||||
|
||||
void primitive_write_8 (void)
|
||||
{
|
||||
PORT *port;
|
||||
CELL text, type;
|
||||
|
||||
maybe_garbage_collection();
|
||||
|
||||
port = untag_port(dpop());
|
||||
text = dpop();
|
||||
type = type_of(text);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case FIXNUM_TYPE:
|
||||
case BIGNUM_TYPE:
|
||||
write_char_8(port, to_fixnum(text));
|
||||
break;
|
||||
case STRING_TYPE:
|
||||
write_string_8(port, untag_string(text));
|
||||
break;
|
||||
default:
|
||||
type_error(TEXT_TYPE, text);
|
||||
break;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue