wingo pushed a commit to branch wip-port-refactor
in repository guile.
commit a9d0fe9ea136563aaac3423faffe8041f0db68fe
Author: Andy Wingo <[email protected]>
Date: Sat May 14 23:25:39 2016 +0200
Update port mode bits documentation.
* libguile/ports.h: Update documentation of port mode bits.
---
libguile/ports.h | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/libguile/ports.h b/libguile/ports.h
index 709086c..43cd745 100644
--- a/libguile/ports.h
+++ b/libguile/ports.h
@@ -48,16 +48,15 @@ SCM_INTERNAL SCM scm_i_port_weak_set;
#define SCM_EOF_OBJECT_P(x) (scm_is_eq ((x), SCM_EOF_VAL))
-/* PORT FLAGS
- * A set of flags characterizes a port.
- * Note that we reserve the bits 1 << 24 and above for use by the
- * routines in the port's scm_ptobfuns structure.
- */
-#define SCM_OPN (1L<<16) /* Is the port open? */
-#define SCM_RDNG (2L<<16) /* Is it a readable port? */
-#define SCM_WRTNG (4L<<16) /* Is it writable? */
-#define SCM_BUF0 (8L<<16) /* Is it unbuffered? */
-#define SCM_BUFLINE (64L<<16) /* Is it line-buffered? */
+/* A port's first word contains its tag, which is a tc7 value. Above
+ there is a flag indicating whether the port is open or not, and then
+ some "mode bits": flags indicating whether the port is an input
+ and/or an output port and how Guile should buffer the port. */
+#define SCM_OPN (1U<<16) /* Is the port open? */
+#define SCM_RDNG (1U<<17) /* Is it a readable port? */
+#define SCM_WRTNG (1U<<18) /* Is it writable? */
+#define SCM_BUF0 (1U<<19) /* Is it unbuffered? */
+#define SCM_BUFLINE (1U<<20) /* Is it line-buffered? */
#define SCM_PORTP(x) (SCM_HAS_TYP7 (x, scm_tc7_port))
#define SCM_OPPORTP(x) (SCM_PORTP (x) && (SCM_CELL_WORD_0 (x) & SCM_OPN))