|
#ifndef SCM_FPORTS_H |
|
#define SCM_FPORTS_H |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "libguile/gc.h" |
|
#include "libguile/ports.h" |
|
|
|
|
|
|
|
|
|
typedef struct scm_t_fport { |
|
|
|
int fdes; |
|
|
|
unsigned int revealed; |
|
|
|
unsigned options; |
|
} scm_t_fport; |
|
|
|
SCM_API scm_t_port_type *scm_file_port_type; |
|
|
|
#define SCM_FSTREAM(x) ((scm_t_fport *) SCM_STREAM (x)) |
|
#define SCM_FPORT_FDES(x) (SCM_FSTREAM (x)->fdes) |
|
|
|
#define SCM_FPORTP(x) \ |
|
(SCM_PORTP (x) && SCM_PORT_TYPE (x) == scm_file_port_type) |
|
#define SCM_OPFPORTP(x) (SCM_FPORTP (x) && (SCM_CELL_WORD_0 (x) & SCM_OPN)) |
|
#define SCM_OPINFPORTP(x) (SCM_OPFPORTP (x) && (SCM_CELL_WORD_0 (x) & SCM_RDNG)) |
|
#define SCM_OPOUTFPORTP(x) (SCM_OPFPORTP (x) && (SCM_CELL_WORD_0 (x) & SCM_WRTNG)) |
|
|
|
#define SCM_VALIDATE_FPORT(pos, port) \ |
|
SCM_MAKE_VALIDATE_MSG (pos, port, FPORTP, "file port") |
|
#define SCM_VALIDATE_OPFPORT(pos, port) \ |
|
SCM_MAKE_VALIDATE_MSG (pos, port, OPFPORTP, "open file port") |
|
|
|
|
|
SCM_API void scm_evict_ports (int fd); |
|
SCM_INTERNAL int scm_i_mode_to_open_flags (SCM mode, int *is_binary, |
|
const char *FUNC_NAME); |
|
SCM_API SCM scm_open_file_with_encoding (SCM filename, SCM modes, |
|
SCM guess_encoding, SCM encoding); |
|
SCM_API SCM scm_open_file (SCM filename, SCM modes); |
|
SCM_API SCM scm_fdes_to_port (int fdes, char *mode, SCM name); |
|
SCM_API SCM scm_file_port_p (SCM obj); |
|
|
|
|
|
|
|
SCM_API int scm_revealed_count (SCM port); |
|
SCM_API SCM scm_port_revealed (SCM port); |
|
SCM_API SCM scm_set_port_revealed_x (SCM port, SCM rcount); |
|
SCM_API SCM scm_adjust_port_revealed_x (SCM port, SCM addend); |
|
|
|
|
|
SCM_INTERNAL void scm_init_fports_keywords (void); |
|
SCM_INTERNAL void scm_init_fports (void); |
|
|
|
|
|
|
|
#ifdef BUILDING_LIBGUILE |
|
enum scm_fport_option |
|
{ |
|
|
|
|
|
SCM_FPORT_OPTION_VERIFY = 1U<<0, |
|
|
|
|
|
SCM_FPORT_OPTION_NOT_SEEKABLE = 1U<<1 |
|
}; |
|
SCM_INTERNAL int scm_i_fdes_is_valid (int fdes, long mode_bits); |
|
SCM_INTERNAL SCM scm_i_fdes_to_port (int fdes, long mode_bits, SCM name, |
|
unsigned options); |
|
|
|
#endif |
|
|
|
#endif |
|
|