summaryrefslogtreecommitdiff
path: root/libguile/ports.h
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-05-13 11:21:41 +0200
committerAndy Wingo <wingo@pobox.com>2016-05-13 11:27:37 +0200
commite5d2f4e566586f768bda99c28a74fd2303ecace1 (patch)
tree71fead353c58b0a42e7c3dbf71bd4e9d884297b4 /libguile/ports.h
parent9a9e0cceae8433ba45e2ab9b37c02dd3b3c71d9a (diff)
downloadguile-e5d2f4e566586f768bda99c28a74fd2303ecace1.tar.gz
Make scm_t_port private
* libguile/ports-internal.h (enum scm_port_encoding_mode): Remove unused enum. (scm_t_port_internal, scm_t_port): Make encoding and conversion_strategy private. Instead of scm_t_port_internal containing scm_t_port, now that all members are private, we can store the user's "stream" in a word in the port object itself and make the whole of scm_t_port private. The next commit will remove scm_t_port_internal. (SCM_PTAB_ENTRY, SCM_PORT_DESCRIPTOR): Make private. * libguile/ports.c (scm_c_make_port_with_encoding): Adapt to new port layout. (scm_port_print): Use SCM_PTAB_ENTRY when printing. * libguile/ports.h: Remove scm_t_port definition. * libguile/ioext.c (get_matching_port): Simplify. * libguile/fports.c (scm_i_evict_port): Simplify.
Diffstat (limited to 'libguile/ports.h')
-rw-r--r--libguile/ports.h24
1 files changed, 3 insertions, 21 deletions
diff --git a/libguile/ports.h b/libguile/ports.h
index 14f4c83db..f90a6b6c5 100644
--- a/libguile/ports.h
+++ b/libguile/ports.h
@@ -41,22 +41,6 @@
-/* An internal-only structure defined in ports-internal.h. */
-struct scm_port_internal;
-
-/* C representation of a Scheme port. */
-
-typedef struct
-{
- /* Data for the underlying port implementation as a raw C value. */
- scm_t_bits stream;
-
- /* Character encoding support. */
- SCM encoding; /* A symbol of upper-case ASCII. */
- SCM conversion_strategy; /* A symbol; either substitute, error, or escape. */
-} scm_t_port;
-
-
SCM_INTERNAL SCM scm_i_port_weak_set;
@@ -86,11 +70,9 @@ SCM_INTERNAL SCM scm_i_port_weak_set;
#define SCM_CLR_PORT_OPEN_FLAG(p) \
SCM_SET_CELL_WORD_0 ((p), SCM_CELL_WORD_0 (p) & ~SCM_OPN)
-#define SCM_PTAB_ENTRY(x) ((scm_t_port *) SCM_CELL_WORD_1 (x))
-#define SCM_PORT_DESCRIPTOR(port) ((scm_t_ptob_descriptor *) SCM_CELL_WORD_2 (port))
-#define SCM_SETPTAB_ENTRY(x, ent) (SCM_SET_CELL_WORD_1 ((x), (scm_t_bits) (ent)))
-#define SCM_STREAM(x) (SCM_PTAB_ENTRY(x)->stream)
-#define SCM_SETSTREAM(x, s) (SCM_PTAB_ENTRY(x)->stream = (scm_t_bits) (s))
+#define SCM_STREAM(port) (SCM_CELL_WORD_1 (port))
+#define SCM_SETSTREAM(port, stream) (SCM_SET_CELL_WORD_1 (port, stream))
+
/* Maximum number of port types. */
#define SCM_I_MAX_PORT_TYPE_COUNT 256