summaryrefslogtreecommitdiff
path: root/module/ice-9/suspendable-ports.scm
Commit message (Collapse)AuthorAgeFilesLines
* Fix some invalid unicode handling issues with suspendable ports.Christopher Baines2023-03-201-4/+4
| | | | | | | | | | | | | | | | Fixes <https://bugs.gnu.org/62290>. Based on the implementation in ports.c. I don't understand what this code is really doing, but the suspendable ports implementation differs from the similar C code for a couple of inequalities. * module/ice-9/suspendable-ports.scm (decode-utf8, bad-utf8-len): Flip a couple of inequalities. * test-suite/tests/ports.test ("string ports"): Add additional invalid UTF-8 test case. * NEWS: Update. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Fix suspendable implementation of 'get-bytevector-some!'Andrew Whatson2021-03-121-1/+1
| | | | | * module/ice-9/suspendable-ports.scm (get-bytevector-some!): Fix incorrect arguments to bytevector-copy!
* Revert "Handle CRLF and Unicode line endings in read-line"Andy Wingo2021-03-121-74/+3
| | | | | | | | This reverts commit 0f983e3db0c43ad7c89f57ea84f792ede373ba0c. After discussing with Mike we are going to punt the read-line changes for now. Open the port in O_TEXT mode if you want to chomp the CR in CFLF sequences.
* Handle CRLF and Unicode line endings in read-lineMike Gran2021-03-111-3/+74
| | | | | | | | | * libguile/rdelim.c (scm_read_line): handle CRLF, LS and PS * module/ice-9/suspendable-ports.scm (read-line): handle CRLF, LS, and PS * module/web/http.scm (read-header-line): take advantage of CRLF in read-line (read-header): don't need to test for \return * test-suite/tests/rdelim.test: new tests for read-line CRLF, LS and PS * doc/ref/api-io.texi: update doc for read-line
* Make 'get-bytevector-n!' suspendable.Mark H Weaver2019-06-181-45/+67
| | | | | | * module/ice-9/suspendable-ports.scm (get-bytevector-n!): New procedure. (get-bytevector-n): Rewrite in terms of 'get-bytevector-n!'. (port-bindings): Add 'get-bytevector-n!'.
* Make 'get-bytevector-some' and 'get-bytevector-some!' suspendable.Mark H Weaver2019-06-181-1/+30
| | | | | | * module/ice-9/suspendable-ports.scm (get-bytevector-some) (get-bytevector-some!): New procedures. (port-bindings): Add them.
* Add accept4 supportAndy Wingo2017-02-151-2/+2
| | | | | | | | | | | * doc/ref/posix.texi (Network Sockets and Communication): Add documentation. * libguile/socket.c (scm_accept4): New function, replaces accept implementation. (scm_accept): Call scm_accept4. (scm_init_socket): Define SOCK_CLOEXEC and SOCK_NONBLOCK. * libguile/socket.h: Add private scm_accept4 decl. * module/ice-9/suspendable-ports.scm (accept): Update.
* Prevent TOCTTOU bugs in suspendable portsAndy Wingo2017-02-081-81/+86
| | | | | | * module/ice-9/suspendable-ports.scm: Prevent TOCTTOU bugs by additionally returning the buffer and offset when we compute an amount-buffered.
* Non-blocking accept/connect Scheme supportAndy Wingo2016-06-091-1/+22
| | | | * module/ice-9/sports.scm (accept, connect): New Scheme functions.
* put-char in SchemeAndy Wingo2016-06-091-3/+14
| | | | | | | | * libguile/ports.c (scm_port_encode_char): New function. * module/ice-9/ports.scm (port-encode-char): Export port-encode-char to the internals module. * module/ice-9/sports.scm (put-char): New function. (port-bindings): Add put-char and put-string.
* Update port documentation, rename sports to suspendable portsAndy Wingo2016-06-091-0/+700
* module/ice-9/suspendable-ports.scm: Rename from ice-9/sports.scm, and adapt module names. Remove exports that are not related to the suspendable ports facility; we want people to continue using the port operations from their original locations. Add put-string to the replacement list. * module/Makefile.am: Adapt to rename. * test-suite/tests/suspendable-ports.test: Rename from sports.test. * test-suite/Makefile.am: Adapt to rename. * module/ice-9/textual-ports.scm (unget-char, unget-string): New functions. * doc/ref/api-io.texi (Textual I/O, Simple Output): Flesh out documentation. (Line/Delimited): Undocument write-line, read-string, and read-string!. This is handled by (ice-9 textual-ports). (Bytevector Ports): Fix duplicated section. (String Ports): Move the note about encodings down to the end. (Custom Ports): Add explanatory text. Remove mention of C functions; they should use the C port interface. (Venerable Port Interfaces): Add text, and make documentation refer to recommended interfaces. (Using Ports from C): Add documentation. (Non-Blocking I/O): Document more fully and adapt to suspendable-ports name change.