ports.h 430 B

1234567891011121314151617181920212223242526
  1. typedef enum {
  2. PORT_EMPTY = 0,
  3. PORT_FILE = 1,
  4. PORT_PIPE = 2
  5. } port_tag;
  6. typedef struct port {
  7. port_tag tag;
  8. union {
  9. FILE* port;
  10. FILE* pipe[2];
  11. } body;
  12. } port;
  13. extern port port_table[100];
  14. extern port empty_port;
  15. void init_port_table();
  16. scm next_port(void);
  17. scm mk_port(FILE *f);
  18. scm mk_pipe(FILE *f, FILE *g);
  19. FILE* port_get_file(scm p);
  20. FILE* port_get_pipe_end(scm p);
  21. int port_empty(scm p);
  22. void port_close(scm p);