* ports.h: new prototype.
authorGary Houston <ghouston@arglist.com>
Sat, 21 Jun 1997 18:46:27 +0000 (18:46 +0000)
committerGary Houston <ghouston@arglist.com>
Sat, 21 Jun 1997 18:46:27 +0000 (18:46 +0000)
* ports.c (scm_flush_all_ports): new procedure, scsh compatible.

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

diff --git a/NEWS b/NEWS
index b54b13f..19a1b8a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -196,6 +196,9 @@ facility.  Maybe this is not needed, since the thread support may
 provide solutions to the problem of consistent access to data
 structures.
 
+** A new procedure `flush-all-ports' is equivalent to running
+`force-output' on every port open for output.
+
 \f
 Changes in Guile 1.1 (Fri May 16 1997):
 
index a0709ee..bb344bf 100644 (file)
@@ -1,3 +1,8 @@
+Sat Jun 21 18:44:03 1997  Gary Houston  <ghouston@actrix.gen.nz>
+
+       * ports.h: new prototype.
+       * ports.c (scm_flush_all_ports): new procedure, scsh compatible.
+
 Sat Jun 21 00:25:03 1997  Jim Blandy  <jimb@floss.red-bean.com>
 
        Make things compile neatly under Sun's C compiler.
index 7cdba24..c7788e2 100644 (file)
@@ -49,6 +49,7 @@
 #include "fports.h"
 #include "strports.h"
 #include "vports.h"
+#include "kw.h"
 
 #include "ports.h"
 
@@ -456,6 +457,23 @@ scm_force_output (port)
   }
 }
 
+SCM_PROC (s_flush_all_ports, "flush-all-ports", 0, 1, 0, scm_flush_all_ports);
+SCM
+scm_flush_all_ports (void)
+{
+  int i;
+
+  for (i = 0; i < scm_port_table_size; i++)
+    {
+      SCM port = scm_port_table[i]->port;
+      if (SCM_OPOUTPORTP (port))
+       {
+         scm_sizet ptob = SCM_PTOBNUM (port);
+         (scm_ptobs[ptob].fflush) (SCM_STREAM (port));
+       }
+    }
+  return SCM_UNSPECIFIED;
+}
 
 SCM_PROC(s_read_char, "read-char", 0, 1, 0, scm_read_char);
 
index 1a4b231..eb81d68 100644 (file)
@@ -2,7 +2,7 @@
 
 #ifndef PORTSH
 #define PORTSH
-/*     Copyright (C) 1995,1996 Free Software Foundation, Inc.
+/*     Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -183,6 +183,7 @@ extern SCM scm_input_port_p SCM_P ((SCM x));
 extern SCM scm_output_port_p SCM_P ((SCM x));
 extern SCM scm_eof_object_p SCM_P ((SCM x));
 extern SCM scm_force_output SCM_P ((SCM port));
+extern SCM scm_flush_all_ports SCM_P ((void));
 extern SCM scm_read_char SCM_P ((SCM port));
 extern SCM scm_peek_char SCM_P ((SCM port));
 extern SCM scm_unread_char SCM_P ((SCM cobj, SCM port));