summaryrefslogtreecommitdiff
path: root/libguile/fports.h
diff options
context:
space:
mode:
authorGreg J. Badros <gjb@cs.washington.edu>1999-12-16 03:46:42 +0000
committerGreg J. Badros <gjb@cs.washington.edu>1999-12-16 03:46:42 +0000
commitd3a6bc94840464e1af8109de5dddd5859560c679 (patch)
tree87475ee6d125df4493b89e5e6a9a13933c8ab356 /libguile/fports.h
parentf353a9e2323b3957cd8475bcf10f7b489a8ce000 (diff)
downloadguile-d3a6bc94840464e1af8109de5dddd5859560c679.tar.gz
* *.h: Use SCM_NIMP(X) && in all the FOOP macros.
* *.[ch]: Use do { ... } while (0) idiom in macros that expanded to a bare block.
Diffstat (limited to 'libguile/fports.h')
-rw-r--r--libguile/fports.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/libguile/fports.h b/libguile/fports.h
index 78619c7fd..dcd0f1928 100644
--- a/libguile/fports.h
+++ b/libguile/fports.h
@@ -42,6 +42,9 @@
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
#include "libguile/__scm.h"
@@ -58,10 +61,10 @@ struct scm_fport {
#define SCM_FSTREAM(x) ((struct scm_fport *) SCM_STREAM (x))
#define SCM_FPORT_FDES(x) (SCM_FSTREAM (x)->fdes)
-#define SCM_FPORTP(x) (SCM_TYP16S(x)==scm_tc7_port)
-#define SCM_OPFPORTP(x) (((0xfeff | SCM_OPN) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN))
-#define SCM_OPINFPORTP(x) (((0xfeff | SCM_OPN | SCM_RDNG) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN | SCM_RDNG))
-#define SCM_OPOUTFPORTP(x) (((0xfeff | SCM_OPN | SCM_WRTNG) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN | SCM_WRTNG))
+#define SCM_FPORTP(x) (SCM_NIMP(x) && (SCM_TYP16S(x)==scm_tc7_port))
+#define SCM_OPFPORTP(x) (SCM_NIMP(x) && (((0xfeff | SCM_OPN) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN)))
+#define SCM_OPINFPORTP(x) (SCM_NIMP(x) && (((0xfeff | SCM_OPN | SCM_RDNG) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN | SCM_RDNG)))
+#define SCM_OPOUTFPORTP(x) (SCM_NIMP(x) && (((0xfeff | SCM_OPN | SCM_WRTNG) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN | SCM_WRTNG)))
/* test whether fdes supports random access. */
#define SCM_FDES_RANDOM_P(fdes) ((lseek (fdes, 0, SEEK_CUR) == -1) ? 0 : 1)