summaryrefslogtreecommitdiff
Commit message (Expand)AuthorAgeFilesLines
* add (web server ethreads)•••* module/web/server/ethreads.scm: New file, an ethreads-based HTTP server. * module/Makefile.am: Add to build. wip-ethreadsAndy Wingo2016-06-092-0/+173
* add examples/ethreads/memcached-{client,server}•••* examples/ethreads/memcached-client.scm: * examples/ethreads/memcached-server.scm: Two new ethreads examples. Not really optimized, no consideration for memory use, but perhaps instructive. Andy Wingo2016-06-092-0/+299
* add (ice-9 ethreads)•••* module/ice-9/ethreads.scm: New module, providing cooperative lightweight threads that yield when they would otherwise sleep or wait for I/O. * module/Makefile.am: Add to build. Andy Wingo2016-06-092-0/+266
* add (ice-9 epoll)•••* configure.ac: Add checks for sys/epoll.h, epoll_create, and epoll_create1. * libguile/poll.c (scm_primitive_epoll_create, scm_primitive_epoll_ctl) (scm_primitive_epoll_wait): New primitives for (ice-9 epoll). Registered via a scm_init_epoll extension. * module/Makefile.am: Add ice-9/epoll.scm. * module/ice-9/epoll.scm: New file. Andy Wingo2016-06-094-1/+265
* Non-blocking accept/connect Scheme support•••* module/ice-9/sports.scm (accept, connect): New Scheme functions. Andy Wingo2016-06-091-1/+22
* Support `connect' on nonblocking sockets•••* libguile/socket.c (scm_connect): * doc/ref/posix.texi (Network Sockets and Communication): Support connect on nonblocking ports. Andy Wingo2016-06-092-6/+11
* `accept' on nonblocking socket can return #f•••* doc/ref/posix.texi (Network Sockets and Communication): * libguile/socket.c (scm_accept): Return #f if the socket is nonblocking and no connection is ready. Andy Wingo2016-06-092-18/+32
* put-char in Scheme•••* 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. Andy Wingo2016-06-093-3/+35
* Update port documentation, rename sports to suspendable ports•••* 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. Andy Wingo2016-06-096-245/+214
* Big ports documentation update•••* doc/ref/api-io.texi: Update to document ports more thoroughly. Still some work needed. * doc/ref/r6rs.texi: Move ports documentation back to r6rs.texi, now that Guile has a more thorough binary/textual I/O story, heavily based on R6RS. * doc/ref/api-control.texi: * doc/ref/api-data.texi: * doc/ref/api-options.texi: * doc/ref/misc-modules.texi: * doc/ref/posix.texi: * doc/ref/srfi-modules.texi: Update references. Andy Wingo2016-06-088-1279/+1250
* Undocument (ice-9 rw)•••* doc/ref/api-io.texi (Block Reading and Writing): Undocument (ice-9 rw). The R6RS routines do the same job and are not so clunky. Andy Wingo2016-06-081-101/+0
* Add (ice-9 textual-ports)•••* module/ice-9/textual-ports.scm: New module. * module/Makefile.am: Add new module. Andy Wingo2016-06-082-0/+58
* put-char, put-string in (ice-9 ports internals)•••* libguile/ports.h (scm_put_char): * libguile/ports.c (scm_put_char): New function. (scm_put_string): Add docstrings, and expose to the internal ports module. * module/ice-9/ports.scm (put-char, put-string): Expose these bindings only through the internals module. Andy Wingo2016-06-083-3/+28
* socket: TCP_CORK, TCP_NODELAY•••* libguile/socket.c (scm_init_socket): Define TCP_NODELAY and TCP_CORK if they are available. * doc/ref/posix.texi (Network Sockets and Communication): Add documentation. * NEWS: Add entry. Andy Wingo2016-06-043-0/+21
* put-string in Scheme•••* module/ice-9/ports.scm: Export port-encode-chars and port-clear-stream-start-for-bom-write via the internals module. * module/ice-9/sports.scm (put-string): New function. Andy Wingo2016-06-012-0/+26
* Rework text encoding to be more Scheme-friendly•••* libguile/ports.c (scm_port_clear_stream_start_for_bom_write): Instead of returning the BOM, take an optional buffer in which to write the BOM. Return number of bytes written. (port_clear_stream_start_for_bom_write): Remove. (scm_i_write): Adapt scm_port_clear_stream_start_for_bom_write call. (try_encode_char_to_iconv_buf, encode_latin1_chars_to_latin1_buf): (encode_latin1_chars_to_utf8_buf, encode_latin1_chars_to_iconv_buf): (encode_latin1_chars, encode_utf32_chars_to_latin1_buf): (encode_utf32_chars_to_utf8_buf, encode_utf32_chars_to_iconv_buf): (encode_utf32_chars, port_encode_chars): New helpers. (scm_port_encode_chars): New procedure. (scm_c_put_latin1_chars, scm_c_put_utf32_chars): Rework to use new encoding helpers. (scm_lfwrite): Use scm_c_put_latin1_chars. Andy Wingo2016-06-011-281/+286
* Simplify string, symbol, char display/write impls•••* libguile/print.h: * libguile/print.c: Use the new routines from ports.[ch]. Andy Wingo2016-05-302-525/+72
* Add scm_c_put_escaped_char, scm_c_can_put_char•••* libguile/ports.h: * libguile/ports.c (scm_c_put_escaped_char, scm_c_can_put_char): New helpers. Andy Wingo2016-05-302-1/+50
* iprin1 uses scm_c_put_string•••* libguile/print.c (iprin1): Use scm_c_put_string for strings. * test-suite/test-suite/lib.scm (exception:encoding-error): Add an additional expected error string for `encoding-error'. Andy Wingo2016-05-302-6/+3
* print_normal_symbol uses new port functions•••* libguile/print.c (print_normal_symbol): Use new port functions. Andy Wingo2016-05-301-7/+9
* Beginnings of supporting encoding text in ports.c•••* libguile/ports.h (scm_c_put_latin1_chars, scm_c_put_utf32_chars) (scm_c_put_char, scm_c_put_string, scm_print_string): New public functions. The plan is to move encoding to ports.c and out of print.c. * libguile/ports.c (UTF8_BUFFER_SIZE, ESCAPE_BUFFER_SIZE): New internal defines. (update_port_position): Take a position instead of a port. Update callers. (utf8_to_codepoint): Allow lengths that are larger than necessary. (port_clear_stream_start_for_bom_write): Require that io_mode be BOM_IO_TEXT to write a BOM. (scm_fill_input): Add a related comment about BOM handling. (scm_i_write): use BOM_IO_TEXT, at least for now. (encode_escape_sequence, codepoint_to_utf8, utf8_to_codepoint) (put_utf8_chars_to_iconv_port, put_latin1_chars_to_utf8_port) (put_latin1_chars_to_iconv_port, put_utf32_chars_to_latin1_port) (put_utf32_chars_to_utf8_port, put_utf32_chars_to_iconv_port): New helpers. (scm_putc, scm_puts): Use scm_c_put_char and scm_put_latin1_chars. Andy Wingo2016-05-302-31/+480
* Add port-line-buffered?•••* libguile/ports.c (scm_port_line_buffered_p): New function. * module/ice-9/ports.scm: Plump port-line-buffered? and port-auxiliary-write-buffer through to the internals module Andy Wingo2016-05-252-0/+15
* port_clear_stream_start_for_bom_write refactor•••* libguile/ports.c (port_clear_stream_start_for_bom_write): Rework to be friendly to Scheme write implementations. Andy Wingo2016-05-251-13/+48
* Speed up scm_c_write / scm_lfwrite•••* libguile/ports-internal.h (scm_t_port): Add write_buf_aux field. * libguile/ports.h (scm_port_auxiliary_write_buffer): New internal decl. * libguile/ports.c (AUXILIARY_WRITE_BUFFER_SIZE): New constant. (initialize_port_buffers): Init aux write buf. (scm_port_auxiliary_write_buffer): Lazily allocate an aux write buffer. (scm_c_write): Arrange to write through an aux buffer if the port is unbuffered. Andy Wingo2016-05-243-3/+49
* Speed golf on Scheme put-u8, put-bytevector•••* module/ice-9/sports.scm (put-u8, put-bytevector): Speed hack. Andy Wingo2016-05-241-4/+4
* Add put-u8 implementation in Scheme•••* module/ice-9/sports.scm (put-u8): Add implementation. (port-bindings): Add put-u8. Andy Wingo2016-05-241-1/+16
* `put-bytevector' in Scheme•••* module/ice-9/sports.scm (flush-input): New helper. (put-bytevector): New function. (port-bindings): Add put-bytevector. Andy Wingo2016-05-241-4/+52
* Wire up non-blocking support in sport writes•••* module/ice-9/sports.scm (write-bytes): Support non-blocking writes. (force-output, flush-output): Rearrange placement. Andy Wingo2016-05-241-35/+40
* close-port implementation in sports•••* module/ice-9/sports.scm (close-port): New function. (port-bindings): Add close-port. Andy Wingo2016-05-241-2/+12
* Add force-output to sports•••* module/ice-9/sports.scm (force-output): New implementation. (port-bindings): Add force-output. Andy Wingo2016-05-241-2/+8
* Thread-safety fixes for iconv and ports•••* libguile/ports-internal.h (scm_t_port): Rework to store iconv descriptors inline, so that the port finalizer doesn't race with the iconv descriptor finalizer. Access is serialized through a lock. Fixes a bug whereby if the port finalizer and the descriptor finalizer run on different threads, the close-port run by the port finalizer could try to free the iconv descriptors at the same time as the descriptor finalizer. * libguile/ports.c (iconv_lock): New static variable. (scm_c_make_port_with_encoding): Initialize iconv-related fields. (scm_close_port): Lock while frobbing iconv descriptors. (prepare_iconv_descriptors): Adapt. (scm_specialize_port_encoding_x, scm_i_set_port_encoding_x): Lock while preparing iconv descriptors. (scm_port_acquire_iconv_descriptors) (scm_port_release_iconv_descriptors): New functions, which replace scm_i_port_iconv_descriptors. (scm_port_decode_char): Lock around iconv operations. (port_clear_stream_start_for_bom_write): Acquire iconv descriptors before checking precise_encoding, to make sure precise_encoding is initialized. * libguile/print.c (display_string_using_iconv): Adapt to use the new interface to get iconv descriptors from a port. Andy Wingo2016-05-233-130/+128
* get-bytevector-n in Scheme.•••* module/ice-9/sports.scm (fill-input): Add io-mode optional arg. (get-bytevector-n): New implementation. (port-bindings): Add get-bytevector-n. * test-suite/tests/sports.test: Add r6rs-ports tests. Andy Wingo2016-05-222-3/+51
* Fix range checking in new Scheme-to-C port code•••* libguile/ports.c (trampoline_to_c_read, trampoline_to_c_write): Fix bugs checking ranges of start and count parameters. Andy Wingo2016-05-221-4/+6
* More thorough ice-9 sports testing•••* module/ice-9/sports.scm: Export read-line, %read-line, and read-delimited. Add these latest three to install-sports!, and fix install-sports! if the current module isn't (ice-9 sports). * test-suite/tests/sports.test: Use install-sports! instead of lexical bindings, to allow us to nicely frob bindings in rdelim. Include rdelim tests. Andy Wingo2016-05-222-13/+23
* Merge from stable-2.0•••This cherry-picks changes from stable-2.0, starting from acd2c8e36a25d77e9e9c9b6782780b23a1764973 and ending in 461b62efc90135d3ca8719ba0f3b6ced4ad13754, inclusively. I did not cherry-pick patches that were already on master and did not cherry-pick ones that don't make sense on master (for example because of the port re-write). I did pick all tests though. I also did not cherry-pick the "Revert foreign objects" patch from ff98cbb643d43c9f8c6ee0e0b4e1bad72aced62e; further discussion necessary. Andy Wingo2016-05-2249-886/+2209
|\
| * doc: Fix typo in Web documentation.•••* doc/ref/web.texi (Http Headers): Fixed typo. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Luribert2016-05-221-2/+2
| * http: Accept date strings with a leading space for hours.•••Fixes <http://bugs.gnu.org/23421>. Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>. * module/web/http.scm (parse-rfc-822-date): Add two clauses for hours with a leading space. * test-suite/tests/web-http.test ("general headers"): Add two tests. Ludovic Courtès2016-05-222-0/+30
| * Bump user-visible copyright years to 2016.•••* doc/ref/guile.texi: Add 2016 to user-visible copyright notice. * module/ice-9/command-line.scm (version-etc): Bump 'copyright-year' to 2016. * module/system/repl/common.scm (*version*): Add 2016 to the range of copyright years. Mark H Weaver2016-05-223-6/+5
| * SRFI-19: Update the table of leap seconds.•••* module/srfi/srfi-19.scm (leap-second-table): Update to include the most recent leap second. Mark H Weaver2016-05-221-3/+4
| * http: Use 'read-header-line' instead of 'read-line*'.•••* module/web/http.scm (read-line*): Remove. (read-continuation-line, read-header, read-request-line): Use 'read-header-line' instead of 'read-line*'. Ludovic Courtès2016-05-221-19/+3
| * http: Accept empty reason phrases.•••Fixes <http://bugs.gnu.org/22273>. Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>. * module/web/http.scm (read-header-line): New procedure. (read-response-line): Use it instead of 'read-line*'. * test-suite/tests/web-http.test ("read-response-line"): Add test. Ludovic Courtès2016-05-222-6/+25
| * http: Test that responses lacking CR/LF are rejected.•••* test-suite/tests/web-http.test ("read-response-line")["missing CR/LF"]: New test. Ludovic Courtès2016-05-221-0/+5
| * Bump user-visible copyright years to 2015.•••* module/ice-9/command-line.scm (version-etc): Bump 'copyright-year' to 2015. * module/system/repl/common.scm (*version*): Add 2015 to the range of copyright years. Mark H Weaver2016-05-222-2/+2
| * Fix getsockopt/setsockopt handling of SO_SNDBUF/SO_RCVBUF options.•••Reported by Park SungMin <byulparan_eng@icloud.com> in <https://lists.gnu.org/archive/html/guile-user/2015-11/msg00026.html>. * libguile/socket.c (scm_getsockopt, scm_setsockopt): Remove code that incorrectly assumed that the argument for SO_SNDBUF and SO_RCVBUF options was of type 'size_t'. Both the Linux and POSIX documentation indicates that the argument is of type 'int', as is the case for most options. Mark H Weaver2016-05-221-28/+2
| * Regenerate SRFI-14 character set data.•••Suggested by Mike Gran <spk121@yahoo.com>. * libguile/srfi-14.i.c: Regenerate for Unicode 8.0.0, <ftp://unicode.org/Public/UNIDATA/UnicodeData.txt> with SHA256 38b17e1118206489a7e0ab5d29d7932212d38838df7d3ec025ecb58e8798ec20. Ludovic Courtès2016-05-221-387/+1279
| * build: Add SCM_T_OFF_MAX and SCM_T_OFF_MIN to scmconfig.h.•••* libguile/gen-scmconfig.c (main): Add SCM_T_OFF_MAX and SCM_T_OFF_MIN to the generated 'scmconfig.h' file. Mark H Weaver2016-05-221-0/+6
| * doc: Mention a known-good Flex version number.•••Suggested by Jamil Egdemir <unclejamil@gmail.com>. * HACKING: Mention a Flex version number. Ludovic Courtès2016-05-221-2/+3
| * Thank David and Kouhei.Ludovic Courtès2016-05-221-0/+2
| * build: Remove libguile/mkstemp.c, redundant with Gnulib.•••Fixes <http://bugs.gnu.org/21425>. Reported by Kouhei Sutou <kou@cozmixng.org>. * configure.ac: Remove 'AC_REPLACE_FUNCS' for 'mkstemp'. * libguile/Makefile.am (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): Remove mkstemp.c. * libguile/mkstemp.c: Remove. Ludovic Courtès2016-05-223-131/+2
| * Remove SIGEV constant definitions.•••* libguile/Makefile.am (chknew-E chknew-SIG): Anchor the end of the signal/error name pattern to only match alphanumeric symbols. * libguile/cpp-SIG.syms (SIGEV_MAX_SIZE, SIGEV_NONE): Remove. (SIGEV_PAD_SIZE, SIGEV_SIGNAL, SIGEV_THREAD): Likewise. (SIGEV_THREAD_ID): Likewise. Signed-off-by: Ludovic Courtès <ludo@gnu.org> David Michael2016-05-222-7/+1