guile-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guile/guile-core/libguile ChangeLog filesys.c f...


From: Gary Houston
Subject: guile/guile-core/libguile ChangeLog filesys.c f...
Date: Tue, 07 Nov 2000 13:34:45 -0800

CVSROOT:        /cvs
Module name:    guile
Changes by:     Gary Houston <address@hidden>   00/11/07 13:34:45

Modified files:
        guile-core/libguile: ChangeLog filesys.c filesys.h ioext.c 
                             ioext.h ports.c ports.h 

Log message:
        2000-11-07  Gary Houston  <address@hidden>
        
        * ports.c (scm_port_for_each): new proc.  implements port-for-each,
        which applies a procedure to each port in the port table.
        ports.h: declare scm_port_for_each.
        
        * ioext.c (scm_dup2): new proc.  implements "dup2" which is a simple
        wrapper for the dup2 system call (unlike dup->fdes or
        primitive-move->fdes).
        * ioext.h: declare scm_dup2.
        
        * filesys.c (scm_close_fdes): new proc.  implements "close-fdes"
        which is a simple wrapper for close system call (unlike scm_close).
        * filesys.h: declare for scm_close_fdes.

CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ChangeLog.diff?r1=1.1162&r2=1.1163
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/filesys.c.diff?r1=1.84&r2=1.85
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/filesys.h.diff?r1=1.26&r2=1.27
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ioext.c.diff?r1=1.70&r2=1.71
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ioext.h.diff?r1=1.20&r2=1.21
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ports.c.diff?r1=1.119&r2=1.120
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ports.h.diff?r1=1.67&r2=1.68

Patches:
Index: guile/guile-core/libguile/ChangeLog
diff -u guile/guile-core/libguile/ChangeLog:1.1162 
guile/guile-core/libguile/ChangeLog:1.1163
--- guile/guile-core/libguile/ChangeLog:1.1162  Mon Nov  6 18:18:30 2000
+++ guile/guile-core/libguile/ChangeLog Tue Nov  7 13:34:44 2000
@@ -1,3 +1,18 @@
+2000-11-07  Gary Houston  <address@hidden>
+
+       * ports.c (scm_port_for_each): new proc.  implements port-for-each,
+       which applies a procedure to each port in the port table.
+       ports.h: declare scm_port_for_each.
+
+       * ioext.c (scm_dup2): new proc.  implements "dup2" which is a simple
+       wrapper for the dup2 system call (unlike dup->fdes or
+       primitive-move->fdes).
+       * ioext.h: declare scm_dup2.
+
+       * filesys.c (scm_close_fdes): new proc.  implements "close-fdes"
+       which is a simple wrapper for close system call (unlike scm_close).
+       * filesys.h: declare for scm_close_fdes.
+
 2000-11-06  Mikael Djurfeldt  <address@hidden>
 
        * eval.c (SCM_IM_DISPATCH), objects.c (scm_mcache_lookup_cmethod):
Index: guile/guile-core/libguile/filesys.c
diff -u guile/guile-core/libguile/filesys.c:1.84 
guile/guile-core/libguile/filesys.c:1.85
--- guile/guile-core/libguile/filesys.c:1.84    Mon Oct 30 03:42:26 2000
+++ guile/guile-core/libguile/filesys.c Tue Nov  7 13:34:45 2000
@@ -335,6 +335,26 @@
 }
 #undef FUNC_NAME
 
+SCM_DEFINE (scm_close_fdes, "close-fdes", 1, 0, 0, 
+            (SCM fd),
+           "A simple wrapper for the @code{close} system call.\n"
+           "Close file descriptor @var{fd}, which must be an integer.\n"
+           "Unlike close (@pxref{Ports and File Descriptors, close}),\n"
+           "the file descriptor will be closed even if a port is using it.\n"
+           "The return value is unspecified.")
+#define FUNC_NAME s_scm_close_fdes
+{
+  int c_fd;
+  int rv;
+
+  SCM_VALIDATE_INUM_COPY (1, fd, c_fd);
+  SCM_SYSCALL (rv = close (c_fd));
+  if (rv < 0)
+    SCM_SYSERROR;
+  return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
 
 /* {Files}
  */
Index: guile/guile-core/libguile/filesys.h
diff -u guile/guile-core/libguile/filesys.h:1.26 
guile/guile-core/libguile/filesys.h:1.27
--- guile/guile-core/libguile/filesys.h:1.26    Mon Jun 12 05:28:23 2000
+++ guile/guile-core/libguile/filesys.h Tue Nov  7 13:34:45 2000
@@ -64,6 +64,7 @@
 extern SCM scm_open_fdes (SCM path, SCM flags, SCM mode);
 extern SCM scm_open (SCM path, SCM flags, SCM mode);
 extern SCM scm_close (SCM fd_or_port);
+extern SCM scm_close_fdes (SCM fd);
 extern SCM scm_stat (SCM object);
 extern SCM scm_link (SCM oldpath, SCM newpath);
 extern SCM scm_rename (SCM oldname, SCM newname);
Index: guile/guile-core/libguile/ioext.c
diff -u guile/guile-core/libguile/ioext.c:1.70 
guile/guile-core/libguile/ioext.c:1.71
--- guile/guile-core/libguile/ioext.c:1.70      Mon Oct 30 03:42:26 2000
+++ guile/guile-core/libguile/ioext.c   Tue Nov  7 13:34:45 2000
@@ -412,6 +412,31 @@
 }
 #undef FUNC_NAME
 
+SCM_DEFINE (scm_dup2, "dup2", 2, 0, 0, 
+            (SCM oldfd, SCM newfd),
+           "A simple wrapper for the @code{dup2} system call.\n"
+           "Copies the file descriptor @var{oldfd} to descriptor\n"
+           "number @var{newfd}, replacing the previous meaning\n"
+           "of @var{newfd}.  Both @var{oldfd} and @var{newfd} must\n"
+           "be integers.\n"
+           "Unlike for dup->fdes or primitive-move->fdes, no attempt\n"
+           "is made to move away ports which are using @var{newfd}\n".
+           "The return value is unspecified.")
+#define FUNC_NAME s_scm_dup2
+{
+  int c_oldfd;
+  int c_newfd;
+  int rv;
+
+  SCM_VALIDATE_INUM_COPY (1, oldfd, c_oldfd);
+  SCM_VALIDATE_INUM_COPY (2, newfd, c_newfd);
+  rv = dup2 (c_oldfd, c_newfd);
+  if (rv == -1)
+    SCM_SYSERROR;
+  return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
 SCM_DEFINE (scm_fileno, "fileno", 1, 0, 0, 
             (SCM port),
            "Returns the integer file descriptor underlying @var{port}.\n"
Index: guile/guile-core/libguile/ioext.h
diff -u guile/guile-core/libguile/ioext.h:1.20 
guile/guile-core/libguile/ioext.h:1.21
--- guile/guile-core/libguile/ioext.h:1.20      Mon Jun 12 05:28:23 2000
+++ guile/guile-core/libguile/ioext.h   Tue Nov  7 13:34:45 2000
@@ -54,6 +54,7 @@
 extern SCM scm_ftell (SCM object);
 extern SCM scm_redirect_port (SCM into_pt, SCM from_pt);
 extern SCM scm_dup_to_fdes (SCM fd_or_port, SCM newfd);
+extern SCM scm_dup2 (SCM oldfd, SCM newfd);
 extern SCM scm_fileno (SCM port);
 extern SCM scm_isatty_p (SCM port);
 extern SCM scm_fdopen (SCM fdes, SCM modes);
Index: guile/guile-core/libguile/ports.c
diff -u guile/guile-core/libguile/ports.c:1.119 
guile/guile-core/libguile/ports.c:1.120
--- guile/guile-core/libguile/ports.c:1.119     Sat Nov  4 15:24:14 2000
+++ guile/guile-core/libguile/ports.c   Tue Nov  7 13:34:45 2000
@@ -668,6 +668,26 @@
 }
 #undef FUNC_NAME
 
+SCM_DEFINE (scm_port_for_each, "port-for-each", 1, 0, 0,
+           (SCM proc),
+           "Apply @var{proc} to each port in the Guile port table\n"
+           "in turn.  The return value is unspecified.")
+#define FUNC_NAME s_scm_port_for_each
+{
+  int i;
+  SCM_VALIDATE_PROC (1, proc);
+
+  /* when pre-emptive multithreading is supported, access to the port
+     table will need to be controlled by a mutex.  */
+  SCM_DEFER_INTS;
+  for (i = 0; i < scm_port_table_size; i++)
+    {
+      scm_apply (proc, scm_cons (scm_port_table[i]->port, SCM_EOL), SCM_EOL);
+    }
+  return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
 SCM_DEFINE (scm_close_all_ports_except, "close-all-ports-except", 0, 0, 1,
            (SCM ports),
            "Close all open file ports used by the interpreter\n"
Index: guile/guile-core/libguile/ports.h
diff -u guile/guile-core/libguile/ports.h:1.67 
guile/guile-core/libguile/ports.h:1.68
--- guile/guile-core/libguile/ports.h:1.67      Sat Nov  4 15:24:14 2000
+++ guile/guile-core/libguile/ports.h   Tue Nov  7 13:34:45 2000
@@ -266,6 +266,7 @@
 extern SCM scm_close_input_port (SCM port);
 extern SCM scm_close_output_port (SCM port);
 extern SCM scm_close_port (SCM port);
+extern SCM scm_port_for_each (SCM proc);
 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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]