* Added a file-port? primitive.
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Thu, 25 Jan 2001 17:40:50 +0000 (17:40 +0000)
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Thu, 25 Jan 2001 17:40:50 +0000 (17:40 +0000)
NEWS
libguile/ChangeLog
libguile/fports.c
libguile/fports.h

diff --git a/NEWS b/NEWS
index 813f3ac..fc58c02 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -262,6 +262,10 @@ Instead, use scm_c_memq or scm_memq, scm_memv, scm_member.
 Returns a boolean indicating whether X is a port.  Equivalent to
 `(or (input-port? X) (output-port? X))'.
 
+** New function: file-port?
+
+Determines whether a given object is a port that is related to a file.
+
 ** New function: port-for-each proc
 
 Apply PROC to each port in the Guile port table in turn.  The
index 8ce25d6..6114d7a 100644 (file)
@@ -1,3 +1,7 @@
+2001-01-25  Dirk Herrmann  <D.Herrmann@tu-bs.de>
+
+       * fports.[ch] (scm_file_port_p):  New primitive.
+
 2001-01-25  Dirk Herrmann  <D.Herrmann@tu-bs.de>
 
        * tags.h (scm_tc16_fport, scm_tc16_strport, scm_tc16_sfport):
index 302303f..b711071 100644 (file)
@@ -226,6 +226,17 @@ scm_evict_ports (int fd)
     }
 }
 
+
+SCM_DEFINE (scm_file_port_p, "file-port?", 1, 0, 0,
+           (SCM obj),
+           "Determine whether OBJ is a port that is related to a file.")
+#define FUNC_NAME s_scm_file_port_p
+{
+  return SCM_BOOL (SCM_FPORTP (obj));
+}
+#undef FUNC_NAME
+
+
 /* scm_open_file
  * Return a new port open on a given file.
  *
index 8fc9925..3d970d9 100644 (file)
@@ -77,6 +77,7 @@ extern SCM scm_setvbuf (SCM port, SCM mode, SCM size);
 extern void scm_evict_ports (int fd);
 extern SCM scm_open_file (SCM filename, SCM modes);
 extern SCM scm_fdes_to_port (int fdes, char *mode, SCM name);
+extern SCM scm_file_port_p (SCM obj);
 extern void scm_init_fports (void);
 
 #endif  /* FPORTSH */