diff options
author | Andy Wingo <wingo@pobox.com> | 2016-05-13 10:05:23 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2016-05-13 10:05:23 +0200 |
commit | 6ff542ee7138ad6eb837f5a5ac59572a04ef3e45 (patch) | |
tree | 245ff8a6daea0cce08e11b67909da8116d731db9 /libguile/ports.h | |
parent | 704c42870d63eb469c52375575d1a8e3f8eadce3 (diff) | |
download | guile-6ff542ee7138ad6eb837f5a5ac59572a04ef3e45.tar.gz |
Add random_access_p port type method
* doc/ref/api-io.texi (I/O Extensions): Update documentation on
implementing port types. Document get_natural_buffer_sizes. Document
the new random_access_p.
* libguile/fports.c (scm_i_fdes_to_port, fport_random_access_p):
(scm_make_fptob): Instead of frobbing rw_random manually, implement a
random_access_p function.
* libguile/ports.c (default_random_access_p)
(scm_set_port_random_access_p): New functions.
scm_make_port_type, scm_c_make_port_with_encoding): Arrange for
random_access_p to work.
Diffstat (limited to 'libguile/ports.h')
-rw-r--r-- | libguile/ports.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libguile/ports.h b/libguile/ports.h index dc0b30dce..f9b638961 100644 --- a/libguile/ports.h +++ b/libguile/ports.h @@ -191,6 +191,7 @@ typedef struct scm_t_ptob_descriptor void (*get_natural_buffer_sizes) (SCM port, size_t *read_size, size_t *write_size); + int (*random_access_p) (SCM port); int (*input_waiting) (SCM port); @@ -230,6 +231,8 @@ SCM_API void scm_set_port_truncate (scm_t_bits tc, SCM_API void scm_set_port_input_waiting (scm_t_bits tc, int (*input_waiting) (SCM)); SCM_API void scm_set_port_get_natural_buffer_sizes (scm_t_bits tc, void (*get_natural_buffer_sizes) (SCM, size_t *, size_t *)); +SCM_API void scm_set_port_random_access_p (scm_t_bits tc, + int (*random_access_p) (SCM port)); /* The input, output, error, and load ports. */ SCM_API SCM scm_current_input_port (void); |