factor/native/io.h

68 lines
1.5 KiB
C
Raw Normal View History

2004-08-26 22:21:17 -04:00
FILE* debug_fd;
2004-08-13 02:19:22 -04:00
typedef enum {
IO_TASK_READ_LINE,
IO_TASK_READ_COUNT,
IO_TASK_WRITE,
IO_TASK_ACCEPT,
IO_TASK_COPY_FROM,
IO_TASK_COPY_TO
2004-08-13 02:19:22 -04:00
} IO_TASK_TYPE;
2004-08-13 01:38:15 -04:00
typedef struct {
2004-08-13 02:19:22 -04:00
IO_TASK_TYPE type;
CELL port;
/* Used for COPY_FROM and COPY_TO only */
CELL other_port;
2004-08-23 20:44:58 -04:00
/* TAGGED list of callbacks, or F */
/* Multiple callbacks per port are only permitted for IO_TASK_WRITE. */
CELL callbacks;
2004-08-13 01:38:15 -04:00
} IO_TASK;
2004-12-11 15:02:34 -05:00
void primitive_next_io_task(void);
void primitive_close(void);
void collect_io_tasks(void);
void primitive_add_copy_io_task(void);
void init_io(void);
#ifdef WIN32
extern CELL callback_list;
#else
2004-08-13 01:38:15 -04:00
fd_set read_fd_set;
IO_TASK read_io_tasks[FD_SETSIZE];
int read_fd_count;
fd_set write_fd_set;
IO_TASK write_io_tasks[FD_SETSIZE];
int write_fd_count;
2004-08-19 02:29:14 -04:00
fd_set except_fd_set;
2004-08-13 01:38:15 -04:00
void init_io_tasks(fd_set* fd_set, IO_TASK* io_tasks);
2004-08-15 21:50:44 -04:00
IO_TASK* add_io_task(
2004-08-13 02:19:22 -04:00
IO_TASK_TYPE type,
CELL port,
CELL other_port,
2004-08-13 01:38:15 -04:00
CELL callback,
IO_TASK* io_tasks,
int* fd_count);
2004-08-15 21:50:44 -04:00
void remove_io_task(
F_PORT* port,
2004-08-13 01:38:15 -04:00
IO_TASK* io_tasks,
int* fd_count);
void remove_io_tasks(F_PORT* port);
bool perform_copy_from_io_task(F_PORT* port, F_PORT* other_port);
bool perform_copy_to_io_task(F_PORT* port, F_PORT* other_port);
2004-08-23 20:44:58 -04:00
CELL pop_io_task_callback(
IO_TASK_TYPE type,
F_PORT* port,
2004-08-23 20:44:58 -04:00
IO_TASK* io_tasks,
int* fd_count);
bool set_up_fd_set(fd_set* fdset, int fd_count, IO_TASK* io_tasks,
bool* closed);
2004-08-23 20:44:58 -04:00
CELL perform_io_task(IO_TASK* io_task, IO_TASK* io_tasks, int* fd_count);
CELL perform_io_tasks(fd_set* fdset, IO_TASK* io_tasks, int* fd_count);
2004-08-15 21:50:44 -04:00
CELL next_io_task(void);
2004-12-11 15:02:34 -05:00
#endif