guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] branch wip-mingw updated: squash! Add 'set-binary/text-m


From: Jan Nieuwenhuizen
Subject: [Guile-commits] branch wip-mingw updated: squash! Add 'set-binary/text-mode!' procedure for MinGW.
Date: Tue, 13 Apr 2021 08:38:32 -0400

This is an automated email from the git hooks/post-receive script.

janneke pushed a commit to branch wip-mingw
in repository guile.

The following commit(s) were added to refs/heads/wip-mingw by this push:
     new fddeb57  squash! Add 'set-binary/text-mode!' procedure for MinGW.
fddeb57 is described below

commit fddeb57691b86cada99de906d7d9a2a6d52d6218
Author: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Tue Apr 13 13:31:17 2021 +0200

    squash! Add 'set-binary/text-mode!' procedure for MinGW.
    
    * doc/ref/api-io.texi (File Ports): Document it.
---
 doc/ref/api-io.texi    | 13 +++++++++++++
 libguile/ports.c       | 13 +++++++------
 module/ice-9/ports.scm |  2 +-
 3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/doc/ref/api-io.texi b/doc/ref/api-io.texi
index 87d4af4..aee4525 100644
--- a/doc/ref/api-io.texi
+++ b/doc/ref/api-io.texi
@@ -1143,6 +1143,19 @@ source of data, but only the value that is returned by
 Determine whether @var{obj} is a port that is related to a file.
 @end deffn
 
+@deffn {Scheme Procedure} set-port-binary/text-mode! port mode
+On MinGW, set the binary/text mode for @var{port}.  @var{mode} can be one
+of the following:
+@table @code
+@item O_BINARY
+binary mode
+@item O_TEXT
+text mode
+@end table
+
+Only open file ports are supported.  On POSIX, this is a no-op.
+@end deffn
+
 
 @node Bytevector Ports
 @subsubsection Bytevector Ports
diff --git a/libguile/ports.c b/libguile/ports.c
index b534ff0..be6b4bc 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -4134,7 +4134,7 @@ SCM_DEFINE (scm_sys_make_void_port, "%make-void-port", 1, 
0, 0,
 }
 #undef FUNC_NAME
 
-SCM_DEFINE (scm_set_binary_text_mode_x, "set-binary/text-mode!", 2, 0, 0,
+SCM_DEFINE (scm_set_port_binary_text_mode_x, "set-port-binary/text-mode!", 2, 
0, 0,
             (SCM port, SCM mode),
            "On MinGW, set the binary/text mode for @var{port}.  @var{mode} can 
be one\n"
             "of the following:\n"
@@ -4144,18 +4144,19 @@ SCM_DEFINE (scm_set_binary_text_mode_x, 
"set-binary/text-mode!", 2, 0, 0,
            "@item O_TEXT\n"
            "text mode\n"
            "@end table\n\n"
-           "Only certain types of ports are supported, most importantly\n"
-           "file ports.  On POSIX, this is a no-op.")
-#define FUNC_NAME s_scm_set_binary_text_mode_x
+           "Only open file ports are supported.  On POSIX, this is a no-op.")
+#define FUNC_NAME s_scm_set_port_binary_text_mode_x
 {
   int cmode = 0;
   int fd;
 
-  SCM_VALIDATE_PORT (1, port);
   if (scm_is_integer (port))
     fd = scm_to_int (port);
   else
-    fd = SCM_FPORT_FDES (port);
+    {
+      SCM_VALIDATE_OPFPORT (1, port);
+      fd = SCM_FPORT_FDES (port);
+    }
 
   SCM_VALIDATE_NUMBER (2, mode);
   cmode = scm_to_int (mode);
diff --git a/module/ice-9/ports.scm b/module/ice-9/ports.scm
index f6fd560..6252845 100644
--- a/module/ice-9/ports.scm
+++ b/module/ice-9/ports.scm
@@ -69,7 +69,7 @@
             port-for-each
             flush-all-ports
             %make-void-port
-            set-binary/text-mode!
+            set-port-binary/text-mode!
 
             ;; Definitions from fports.c.
             open-file



reply via email to

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