2000-11-04 Gary Houston <ghouston@arglist.com>
authorGary Houston <ghouston@arglist.com>
Sat, 4 Nov 2000 23:24:14 +0000 (23:24 +0000)
committerGary Houston <ghouston@arglist.com>
Sat, 4 Nov 2000 23:24:14 +0000 (23:24 +0000)
* ports.c (scm_port_p): new function, implements "port?" which
is mentioned in R5RS.
* ports.h: declare scm_port_p.

NEWS
libguile/ChangeLog
libguile/ports.c
libguile/ports.h

diff --git a/NEWS b/NEWS
index 5a9c3e2..943de34 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -169,6 +169,11 @@ Guile.
 
 Instead, use scm_memq, scm_memv, scm_member.
 
+** New function: port? X
+
+Returns a boolean indicating whether X is a port.  Equivalent to
+`(or (input-port? X) (output-port? X))'.
+
 * Changes to the gh_ interface
 
 * Changes to the scm_ interface
index a47fef9..5b3a541 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-04  Gary Houston  <ghouston@arglist.com>
+
+       * ports.c (scm_port_p): new function, implements "port?" which
+       is mentioned in R5RS.
+       * ports.h: declare scm_port_p.
+
 2000-11-01  Dirk Herrmann  <D.Herrmann@tu-bs.de>
 
        * backtrace.c (display_expression, display_error_body), fports.c
index 3f952a6..7476613 100644 (file)
@@ -735,6 +735,16 @@ SCM_DEFINE (scm_output_port_p, "output-port?", 1, 0, 0,
 }
 #undef FUNC_NAME
 
+SCM_DEFINE (scm_port_p, "port?", 1, 0, 0,
+           (SCM x),
+            "Returns a boolean indicating whether @var{x} is a port.\n"
+           "Equivalent to @code{(or (input-port? X) (output-port? X))}.")
+#define FUNC_NAME s_scm_port_p
+{
+  return SCM_BOOL (SCM_PORTP (x));
+}
+#undef FUNC_NAME
+
 SCM_DEFINE (scm_port_closed_p, "port-closed?", 1, 0, 0,
            (SCM port),
            "Returns @code{#t} if @var{port} is closed or @code{#f} if it is open.")
index 0b12af5..d4f884e 100644 (file)
@@ -269,6 +269,7 @@ extern SCM scm_close_port (SCM port);
 extern SCM scm_close_all_ports_except (SCM ports);
 extern SCM scm_input_port_p (SCM x);
 extern SCM scm_output_port_p (SCM x);
+extern SCM scm_port_p (SCM x);
 extern SCM scm_port_closed_p (SCM port);
 extern SCM scm_eof_object_p (SCM x);
 extern SCM scm_force_output (SCM port);