Mark H Weaver [Fri, 5 Apr 2013 17:28:38 +0000 (13:28 -0400)]
Import 'c-strcase' from Gnulib.
* lib/Makefile.am:
* m4/gnulib-cache.m4: Add 'c-strcase' Gnulib module.
Chris K. Jester-Young [Fri, 5 Apr 2013 17:31:12 +0000 (13:31 -0400)]
Revert "Add record type printers for srfi-41 and srfi-45."
This reverts commit
4a1cdc9d5d643d05fa7a18febc7c12070f3ef6d9, which was
prematurely pushed.
Chris K. Jester-Young [Fri, 5 Apr 2013 02:18:40 +0000 (22:18 -0400)]
Add record type printers for srfi-41 and srfi-45.
* module/srfi/srfi-41.scm: Add record type printer for streams.
* module/srfi/srfi-45.scm: Add record type printer for promises.
Mark H Weaver [Wed, 3 Apr 2013 08:22:04 +0000 (04:22 -0400)]
Improve handling of Unicode byte-order marks (BOMs).
* libguile/ports-internal.h (struct scm_port_internal): Add new members
'at_stream_start_for_bom_read' and 'at_stream_start_for_bom_write'.
(SCM_UNICODE_BOM): New macro.
(scm_i_port_iconv_descriptors): Add 'mode' parameter to prototype.
* libguile/ports.c (scm_new_port_table_entry): Initialize
'at_stream_start_for_bom_read' and 'at_stream_start_for_bom_write'.
(get_iconv_codepoint): Pass new 'mode' parameter to
'scm_i_port_iconv_descriptors'.
(get_codepoint): After reading a codepoint at stream start, record
that we're no longer at stream start, and consume a BOM where
appropriate.
(scm_seek): Set the stream start flags according to the new position.
(looking_at_bytes): New static function.
(scm_utf8_bom, scm_utf16be_bom, scm_utf16le_bom, scm_utf32be_bom,
scm_utf32le_bom): New static const arrays.
(decide_utf16_encoding, decide_utf32_encoding): New static functions.
(scm_i_port_iconv_descriptors): Add new 'mode' parameter. If the
specified encoding is UTF-16 or UTF-32, make that precise by deciding
what byte order to use, and construct iconv descriptors based on the
precise encoding.
(scm_i_set_port_encoding_x): Record that we are now at stream start.
Do not open the new iconv descriptors immediately; let them be
initialized lazily.
* libguile/print.c (display_string_using_iconv): Record that we're no
longer at stream start. Write a BOM if appropriate.
* doc/ref/api-io.texi (BOM Handling): New node.
* test-suite/tests/ports.test ("set-port-encoding!, wrong encoding"):
Adapt test to cope with the fact that 'set-port-encoding!' does not
immediately open the iconv descriptors.
(bv-read-test): New procedure.
("unicode byte-order marks (BOMs)"): New test prefix.
Mark H Weaver [Sun, 31 Mar 2013 23:06:51 +0000 (19:06 -0400)]
Peeks do not consume EOFs.
Fixes <http://bugs.gnu.org/12216>.
* libguile/ports-internal.h (struct scm_port_internal): Add
'pending_eof' flag.
* libguile/ports.c (scm_i_set_pending_eof, scm_i_clear_pending_eof): New
static functions.
(scm_new_port_table_entry): Initialize 'pending_eof'.
(scm_i_fill_input): Check for 'pending_eof'.
(scm_i_peek_byte_or_eof): Set 'pending_eof' flag before returning EOF.
(scm_end_input, scm_unget_byte, scm_seek, scm_truncate): Clear
'pending_eof'.
(scm_peek_char): Set 'pending_eof' flag before returning EOF.
* test-suite/tests/ports.test ("pending EOF behavior"): Add tests.
Mark H Weaver [Thu, 4 Apr 2013 19:22:18 +0000 (15:22 -0400)]
Nicer docstring syntax for case-lambda.
* module/ice-9/psyntax.scm (case-lambda, case-lambda*): Allow a
docstring to be placed immediately after the 'case-lambda' or
'case-lambda*'.
* module/ice-9/psyntax-pp.scm: Regenerate.
* doc/ref/api-procedures.texi (Case-lambda): Update docs.
* test-suite/tests/optargs.test ("case-lambda", "case-lambda*"):
Add tests.
Mark H Weaver [Thu, 4 Apr 2013 07:16:42 +0000 (03:16 -0400)]
Cross reference 'SRFI-9 Records' directly instead of 'SRFI-9'.
* doc/ref/api-compound.texi (Record Overview, Records):
doc/ref/api-modules.texi (Included Guile Modules):
doc/ref/r6rs.texi (R6RS Records): Cross reference 'SRFI-9 Records'
directly instead of 'SRFI-9'.
Mark H Weaver [Wed, 3 Apr 2013 20:00:12 +0000 (16:00 -0400)]
Preserve the case of the user-specified port encoding string.
* libguile/ports.c (scm_i_set_port_encoding_x): Always copy the
user-provided port encoding string, so that its case will be preserved
and returned exactly by subsequent calls to 'port-encoding'.
Daniel Llorens [Tue, 2 Apr 2013 14:43:37 +0000 (16:43 +0200)]
Remove double indirection for 1st arg of array-for-each
* libguile/array-map.c: (rafe): factor GVREF out of rank-1 loop for ra0.
Ludovic Courtès [Wed, 3 Apr 2013 19:34:31 +0000 (21:34 +0200)]
tests: Add `array-for-each' tests for one-dimensional traversals.
* test-suite/tests/ramap.test ("array-for-each")["1 source"]: New test
prefix.
Ludovic Courtès [Wed, 3 Apr 2013 17:13:23 +0000 (19:13 +0200)]
tests: Use `pass-if-equal' in ramap.test.
* test-suite/tests/ramap.test ("array-for-each"): Use `pass-if-equal'
instead of `(pass-if ... (equal? ...))'.
Daniel Llorens [Tue, 2 Apr 2013 13:53:22 +0000 (15:53 +0200)]
Remove double indirection in array-map! with <2 args
* libguile/array-map.c: (ramap): factor GVSET/GVREF out of rank-1 loop
for ra0 and the first element of ras.
Daniel Llorens [Tue, 2 Apr 2013 13:23:55 +0000 (15:23 +0200)]
Avoid per-element cons for 1-arg case of array-map!
* libguile/array-map.c: (ramap): special case when ras is a 1-element list.
Daniel Llorens [Wed, 3 Apr 2013 13:40:48 +0000 (15:40 +0200)]
Deprecate dead code in array-map.c
* libguile/array-map.c, libguile/array-map.h: deprecate scm_ra_eqp,
scm_ra_lessp, scm_ra_leqp, scm_ra_grp, scm_ra_greqp, scm_ra_sum,
scm_ra_product, scm_ra_difference, scm_ra_divide, scm_array_identity.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Mark H Weaver [Wed, 3 Apr 2013 17:26:01 +0000 (13:26 -0400)]
Use 'strcasecmp' to compare encoding names.
Reported by Ludovic Courtès <ludo@gnu.org>.
* libguile/ports.c (scm_new_port_table_entry,
scm_i_set_default_port_encoding, scm_i_set_port_encoding_x):
libguile/read.c (scm_i_scan_for_encoding): Use 'strcasecmp' to compare
encoding names.
Daniel Llorens [Mon, 1 Apr 2013 16:43:58 +0000 (18:43 +0200)]
Remove double indirection in element access in array-copy!
* libguile/array-map.c: (racp): factor scm_generalized_vector_ref,
scm_generalized_vector_set_x out of the rank-1 loop.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Mark H Weaver [Wed, 3 Apr 2013 00:47:30 +0000 (20:47 -0400)]
Remove BOM tests that depend on GNU iconv behavior.
* test-suite/tests/ports.test ("unicode byte-order marks (BOMs)"):
Remove tests that depend on GNU iconv behavior. We will add them back
when we have portable BOM support.
Mark H Weaver [Tue, 2 Apr 2013 23:35:43 +0000 (19:35 -0400)]
Rename 'scm_i_get_byte_or_eof' et al; mark them as SCM_API.
* libguile/ports.c (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof):
Rename to 'scm_slow_get_byte_or_eof' and 'scm_slow_peek_byte_or_eof',
respectively.
* libguile/ports.h (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof):
Rename to 'scm_slow_get_byte_or_eof' and 'scm_slow_peek_byte_or_eof',
respectively, and mark them as SCM_API.
* libguile/inline.h (scm_get_byte_or_eof, scm_peek_byte_or_eof): Adjust
to use the new names.
Mark H Weaver [Tue, 2 Apr 2013 22:02:56 +0000 (18:02 -0400)]
Remove uses of GC_PTR in 'finalize_iconv_descriptors'.
* libguile/ports.c (finalize_iconv_descriptors): Change GC_PTR to
(void *) in parameter types.
Mark H Weaver [Tue, 2 Apr 2013 21:26:37 +0000 (17:26 -0400)]
Rewrite get_iconv_codepoint to fix a bug involving byte-order marks.
* libguile/ports.c (get_iconv_codepoint): Rewrite to fix a bug and
improve efficiency and clarity. Previously, it incorrectly assumed
that iconv would never consume input without producing output, which
led to a buffer overrun and subsequent assertion failure. This
happens when a byte-order mark is consumed by iconv at the beginning
of the stream when using the UTF-16 or UTF-32 encodings.
* test-suite/tests/ports.test (unicode byte-order marks (BOMs)):
Add tests.
Mark H Weaver [Tue, 2 Apr 2013 09:33:24 +0000 (05:33 -0400)]
Move slow path out of 'scm_get_byte_or_eof' et al.
Suggested by Andy Wingo.
* libguile/inline.h (scm_get_byte_or_eof, scm_peek_byte_or_eof): Keep
only the fast path here, with fallback to 'scm_i_get_byte_or_eof' and
'scm_i_peek_byte_or_eof'.
* libguile/ports.c (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof):
New internal functions.
* libguile/ports.h (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof): Add
prototypes.
Mark H Weaver [Tue, 2 Apr 2013 17:33:14 +0000 (13:33 -0400)]
Add a static version of 'scm_fill_input' to ports.c.
* libguile/ports.c (scm_i_fill_input): New static function, containing
the code that was previously in 'scm_fill_input'.
(scm_fill_input): Simply call 'scm_i_fill_input'.
(scm_c_read): Use 'scm_i_fill_input'.
Mark H Weaver [Sun, 31 Mar 2013 23:52:31 +0000 (19:52 -0400)]
Move the port alist from the hash table to the internal port structure.
* libguile/ports-internal.h (struct scm_port_internal): Add 'alist'
member.
* libguile/ports.c (scm_i_port_alist, scm_i_set_port_alist_x): New
internal functions.
(scm_i_port_weak_hash): Update comment: the hash table is no longer
used to store the port's alist.
(scm_new_port_table_entry): Initialize 'alist'. Store SCM_BOOL_F in
the port weak hash, not SCM_EOL.
* libguile/ports.h (scm_i_port_alist, scm_i_set_port_alist_x): Add
protoypes.
* libguile/read.c (set_port_read_option, init_read_options): Access the
port's alist via 'scm_i_port_alist' and 'scm_i_set_port_alist_x'.
Mark H Weaver [Mon, 1 Apr 2013 01:21:14 +0000 (21:21 -0400)]
Optimize 'get-bytevector-some'; it may now read less than possible.
* libguile/r6rs-ports.c (scm_get_bytevector_some): Rewrite to
efficiently take the contents of the read/putback buffers. In the
docstring, clarify that it might not return all available bytes.
* doc/ref/api-io.texi (R6RS Binary Input): Clarify that
'get-bytevector-some' might not return all available bytes.
* test-suite/tests/r6rs-ports.test ("get-bytevector-some [only-some]"):
Remove bogus test, which requires more than the R6RS requires.
Mark H Weaver [Sun, 31 Mar 2013 19:23:32 +0000 (15:23 -0400)]
Refactor port encoding modes: utf-8 and iconv
Based on
6c98257f2ead0855f218369ea7f9a823cdb9727e by Andy Wingo.
* libguile/ports-internal.h (struct scm_port_internal): Add a flag
for the port encoding mode: UTF8 or iconv. The iconv descriptors
are now in a separate structure so that we can avoid attaching
finalizers to the ports themselves in the future.
(enum scm_port_encoding_mode): New enum.
(struct scm_iconv_descriptors): New struct.
(scm_i_port_iconv_descriptors): Add prototype.
* libguile/ports.c (finalize_port): Don't close iconv descriptors here.
(scm_new_port_table_entry): Adapt to the iconv descriptors being
moved. Initialize 'encoding_mode'.
(scm_i_remove_port): Adapt to call 'close_iconv_descriptors'.
(close_iconv_descriptors): New static function.
(get_iconv_codepoint): Use 'scm_i_port_iconv_descriptors'.
(get_codepoint): Check the port 'encoding_mode'.
(finalize_iconv_descriptors, open_iconv_descriptors,
close_iconv_descriptors, scm_i_port_iconv_descriptors): New static
functions.
(scm_i_set_port_encoding_x): Adapt to iconv descriptors being moved
to separate structure, to set the 'encoding_mode' flag, and to use
'open_iconv_descriptors' and 'close_iconv_descriptors'.
* libguile/print.c (display_string_using_iconv): Use
'scm_i_port_iconv_descriptors'.
(display_string): Use 'encoding_mode' flag.
Mark H Weaver [Sun, 31 Mar 2013 02:34:56 +0000 (22:34 -0400)]
Add internal-only port structure and move iconv descriptors there.
* libguile/ports-internal.h: New file.
* libguile/Makefile.am (noinst_HEADERS): Add ports-internal.h.
* libguile/ports.h (scm_t_port): Add a comment mentioning that the
'input_cd' and 'output_cd' fields of the public structure are no
longer what they seem to be.
* libguile/ports.c: Include ports-internal.h.
(finalize_port, scm_i_remove_port, get_iconv_codepoint, get_codepoint,
scm_i_set_port_encoding_x): Access 'input_cd' and 'output_cd' via the
new internal port structure.
(scm_new_port_table_entry): Allocate and initialize the internal port
structure.
* libguile/print.c: Include ports-internal.h.
(display_string_using_iconv, display_string): Access 'input_cd' and
'output_cd' via 'internal' pointer.
Mark H Weaver [Sun, 31 Mar 2013 03:09:01 +0000 (23:09 -0400)]
Add 'scm_gc_typed_calloc' macro.
* libguile/gc.h (scm_gc_typed_calloc): New macro.
Mark H Weaver [Mon, 1 Apr 2013 16:28:25 +0000 (12:28 -0400)]
Fix broken texinfo markup in (ice-9 iconv) docs.
* doc/ref/api-data.texi (Representing Strings as Bytes): Fix broken
@deffn syntax.
Mark H Weaver [Mon, 1 Apr 2013 09:31:08 +0000 (05:31 -0400)]
scm_string_join: properly sequence operations in ADD_TO_APPEND_LIST
* libguile/srfi-13.c (scm_string_join): Properly sequence operations in
ADD_TO_APPEND_LIST macro.
Mark H Weaver [Mon, 1 Apr 2013 07:47:29 +0000 (03:47 -0400)]
Optimize 'string-join'.
* libguile/srfi-13.c (string-join): Rewrite to call 'scm_string_append'
only once.
Mark H Weaver [Mon, 1 Apr 2013 07:37:36 +0000 (03:37 -0400)]
Make 'string-append' more efficient and robust.
* libguile/strings.c (scm_string_append): Check for numerical overflow
while computing the length of the result. Double-check that we don't
overflow the result string, and that it is the correct length in the
end (in case another thread changed the list). When copying a narrow
string to a wide result, avoid calling 'scm_i_string_length' and
'scm_i_string_chars' on each character.
Mark H Weaver [Mon, 1 Apr 2013 05:21:30 +0000 (01:21 -0400)]
Fix typos in 'string-join' docs: 'string-infix' -> 'strict-infix'.
* doc/ref/api-data.texi (String Constructors): In definition of
'string-join', change 'string-infix' -> 'strict-infix'.
* libguile/srfi-13.c (scm_string_join): In docstring, change
'string-infix' -> 'strict-infix'.
Mark H Weaver [Mon, 1 Apr 2013 01:12:31 +0000 (21:12 -0400)]
Avoid unnecessary peeks for EOF in r6rs-ports.
* libguile/r6rs-ports.c (scm_get_bytevector_n, scm_get_bytevector_n_x,
scm_get_bytevector_some, scm_get_bytevector_all): Avoid peeking for
EOF when we already know.
Mark H Weaver [Fri, 29 Mar 2013 16:28:49 +0000 (12:28 -0400)]
Add -C command-line option to adjust %load-compiled-path.
* module/ice-9/command-line.scm (compile-shell-switches):
Implement -C option.
(*usage*): Add -C option.
* doc/ref/guile-invoke.texi (Command-line Options): Add docs.
Ludovic Courtès [Fri, 29 Mar 2013 18:19:51 +0000 (19:19 +0100)]
Augment `.gitignore'.
Ludovic Courtès [Fri, 29 Mar 2013 18:04:56 +0000 (19:04 +0100)]
build: Build and check (ice-9 popen) only when --enable-posix and HAVE_FORK.
Fixes <http://bugs.gnu.org/13848>.
Reported by Jan Schukat <shookie@email.de>.
* configure.ac: Rename `HAVE_FORK' conditional to `BUILD_ICE_9_POPEN'.
Set it when both $enable_posix and $ac_cv_func_fork are true.
* libguile/posix.c (scm_init_posix): Add the `fork' feature.
* doc/ref/api-options.texi (Common Feature Symbols): Add `fork'.
* doc/ref/posix.texi (Pipes): Add footnote mentioning the `fork'
feature.
* module/Makefile.am (SCRIPTS_SOURCES): Make `scripts/autofrisk.scm' and
`scripts/scan-api.scm' conditional on `BUILD_ICE_9_POPEN'.
* test-suite/tests/popen.test (if-supported): New macro.
Wrap body in `if-supported'.
Ludovic Courtès [Fri, 29 Mar 2013 17:44:18 +0000 (18:44 +0100)]
build: Remove redundant check for `struct timespec'.
* m4/gnulib-cache.m4: Add `time'.
* lib/Makefile.am: Update, still from
v0.0-7865-ga828bb2.
* configure.ac: Remove check for `struct timespec', which was redundant
with Gnulib, and conflicted with pthread-win32's <pthread.h>:
<http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00096.html>.
Mark H Weaver [Fri, 29 Mar 2013 15:35:20 +0000 (11:35 -0400)]
doc: Use '@defvr' to introduce 'stream-null'.
* doc/ref/srfi-modules.texi (SRFI-41): Use @defvr to introduce
'stream-null'.
Mark H Weaver [Fri, 29 Mar 2013 15:33:59 +0000 (11:33 -0400)]
Revert "doc: Consider `stream-null' as a variable."
This reverts commit
4a0821a8d5cfff50fef8c119a0d76355b6126009.
Ludovic Courtès [Thu, 28 Mar 2013 22:33:44 +0000 (23:33 +0100)]
tests: Skip `test-pthread-create-secondary' except on Linux-based systems.
* test-suite/standalone/test-pthread-create-secondary.c: Skip on
non-Linux-based systems.
Ludovic Courtès [Thu, 28 Mar 2013 21:53:59 +0000 (22:53 +0100)]
build: Require GMP >= 4.2.
* NEWS, README: Update.
Ludovic Courtès [Thu, 28 Mar 2013 21:42:24 +0000 (22:42 +0100)]
tests: Fix file name canonicalization tests for when $srcdir contains symlinks.
* test-suite/tests/ports.test ("%file-port-name-canonicalization"): Use
`pass-if-equal' instead of `pass-if'.
["relative canonicalization from ice-9"]: Throw to `unresolved' when
%LOAD-PATH is not canonical.
["absolute canonicalization from ice-9"]: Canonicalize the result.
Ludovic Courtès [Thu, 28 Mar 2013 21:16:24 +0000 (22:16 +0100)]
Add Gnulib commit ID in `NEWS'.
Ludovic Courtès [Thu, 28 Mar 2013 21:16:07 +0000 (22:16 +0100)]
Allow compilation with GMP < 5.0.0.
* libguile/numbers.c (VARARG_MPZ_ITERATOR)[!HAVE_DECL_MPZ_INITS]: New
macro.
(mpz_inits, mpz_clears)[!HAVE_DECL_MPZ_INITS]: New functions.
* configure.ac: Check for the declaration of `mpz_inits'.
Ludovic Courtès [Thu, 28 Mar 2013 20:01:51 +0000 (21:01 +0100)]
Fix erroneous `FUNC_NAME' for `scm_array_length'.
* libguile/generalized-arrays.c (scm_array_length): Fix `FUNC_NAME'.
Ludovic Courtès [Wed, 27 Mar 2013 21:32:46 +0000 (22:32 +0100)]
doc: Consider `stream-null' as a variable.
* doc/ref/srfi-modules.texi (SRFI-41): Use @var{stream-null}, not
@code{stream-null}. Use @defvr to introduce `stream-null'.
Ian Price [Mon, 18 Mar 2013 18:55:18 +0000 (18:55 +0000)]
Document (system repl server)
* doc/ref/api-evaluation.texi (REPL Servers): New Subsection.
Mark H Weaver [Thu, 28 Mar 2013 01:11:06 +0000 (21:11 -0400)]
SRFI-41 stream-null is a Scheme Variable, not a Constant.
Suggested by Ludovic Courtès <ludo@gnu.org>.
* doc/ref/srfi-modules.texi (SRFI-41 Stream Primitives):
Label 'stream-null' as a Scheme Variable, not a Constant.
Chris K. Jester-Young [Wed, 27 Mar 2013 19:30:26 +0000 (15:30 -0400)]
Use BT Templeton's preferred name.
* THANKS: Use BT Templeton's preferred name.
Mark H Weaver [Wed, 27 Mar 2013 17:39:47 +0000 (13:39 -0400)]
Thanks Chris K. Jester-Young.
* THANKS: Add Chris K Jester-Young to the list of contributors.
Mark H Weaver [Wed, 27 Mar 2013 01:03:42 +0000 (21:03 -0400)]
Add full documentation for SRFI-41.
* doc/ref/misc-modules.texi (Streams): Add cross-reference to SRFI-41.
* doc/ref/srfi-modules.texi (SRFI-41): Replace stub with full
documentation.
(SRFI-41 Stream Fundamentals, SRFI-41 Stream Primitives,
SRFI-41 Stream Library): New subsubsections.
Chris K. Jester-Young [Wed, 27 Mar 2013 02:15:31 +0000 (22:15 -0400)]
Add SRFI-41.
Incorporates suggestions from Mark H Weaver <mhw@netris.org>
and Ian Price <ianprice90@googlemail.com>.
* module/srfi/srfi-41.scm: New file.
* module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-41.scm.
* test-suite/tests/srfi-41.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-41.test.
* doc/ref/srfi-modules.texi (SRFI Support): Add SRFI-41.
(SRFI-41): New node which refers the reader to
<http://srfi.schemers.org/srfi-41/srfi-41.html>.
Ludovic Courtès [Wed, 27 Mar 2013 17:05:45 +0000 (18:05 +0100)]
Update `NEWS'.
Ludovic Courtès [Wed, 27 Mar 2013 17:03:47 +0000 (18:03 +0100)]
futures: Limit the number of nested futures on the same stack.
Fixes <http://bugs.gnu.org/13188>.
Reported by Nala Ginrut <nalaginrut@gmail.com>.
* module/ice-9/futures.scm (%nesting-level): Rename to...
(%nesting-level): ... this. Default to 0 instead of #f. Update
users.
(%max-nesting-level): New variable.
(touch): When FUTURE is queued and (%nesting-level) is above
%MAX-NESTING-LEVEL, abort to %FUTURE-PROMPT.
* test-suite/tests/future.test ("nested futures")["loop"]: Remove
`compile' call.
* test-suite/tests/threads.test ("par-map")["long list"]: New test.
* doc/ref/api-scheduling.texi (Futures): Add a paragraph about stack
consumption.
Ludovic Courtès [Wed, 27 Mar 2013 15:45:54 +0000 (16:45 +0100)]
Document `and=>'.
* module/ice-9/boot-9.scm (and=>): Add docstring.
* doc/ref/api-procedures.texi (Higher-Order Functions): Add `and=>'.
Daniel Hartwig [Fri, 15 Mar 2013 14:25:10 +0000 (22:25 +0800)]
web http: parse numeric time zones in headers
* module/web/http.scm (parse-zone-offset, normalize-date): New
procedures.
(parse-rfc-822-date, parse-rfc-850-date, parse-date): Update.
* test-suite/tests/web-http.test ("general headers"): Add test.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Ludovic Courtès [Tue, 26 Mar 2013 21:11:30 +0000 (22:11 +0100)]
doc: Use a preferred naming convention in SRFI-9 examples.
* doc/ref/api-compound.texi (SRFI-9 Records): Use "Scheme Syntax"
instead of "library syntax". Remove `get-' from getter names, and add
an exclamation mark in setter names. Change `employee-type' to
`<employee>'.
Mark H Weaver [Wed, 27 Mar 2013 01:25:12 +0000 (21:25 -0400)]
Manual: xref SRFI-45 from core Delayed Evaluation section.
* doc/ref/api-evaluation.texi (Delayed Evaluation): Add cross-reference
to SRFI-45.
Mark H Weaver [Wed, 27 Mar 2013 01:22:11 +0000 (21:22 -0400)]
SRFI-45: add promise? predicate.
* module/srfi/srfi-45.scm (promise?): Export.
* doc/ref/srfi-modules.texi (SRFI-45): Update docs.
* test-suite/tests/srfi-45.test: Add test. Add FSF copyright for 2010
and 2013. Add missing year to André van Tonder's copyright notice.
Mark H Weaver [Wed, 27 Mar 2013 01:16:26 +0000 (21:16 -0400)]
Revert "SRFI-45: Support multiple values; add promise? predicate."
This reverts commit
1d64b4edb9da4011ad06c0fab1c6225ec20b0876.
Ludovic Courtès [Mon, 25 Mar 2013 22:25:57 +0000 (23:25 +0100)]
SRFI-37: Fix infinite loop when processing short option with no required arg.
Fixes <http://bugs.gnu.org/13176>.
* module/srfi/srfi-37.scm (args-fold)[short-option-argument]: When ARGS
is a pair, always set it to its cdr.
* test-suite/tests/srfi-37.test ("SRFI-37")["short option with optional
argument omitted", "short option with optional argument provided"]:
New tests.
Ludovic Courtès [Mon, 25 Mar 2013 21:46:53 +0000 (22:46 +0100)]
getaddrinfo: Document the missing errno value for EAI_SYSTEM.
In response to <http://bugs.gnu.org/13958>.
Reported by Lluís Batlle i Rossell <viric@viric.name>.
* doc/ref/posix.texi (Network Databases): Document the missing errno
value for EAI_SYSTEM.
* libguile/net_db.c (scm_getaddrinfo): Likewise.
Ludovic Courtès [Mon, 25 Mar 2013 21:27:37 +0000 (22:27 +0100)]
build: Use portable sed constructs.
Partly fixes <http://bugs.gnu.org/14042>.
Reported by Marc Girod <marc.girod@gmail.com>.
* meta/Makefile.am (guile-config): Use separate "s" expressions to
accommodate Solaris sed.
Ludovic Courtès [Mon, 25 Mar 2013 12:51:57 +0000 (13:51 +0100)]
sendfile: Make sure we have a Linux-style `sendfile'.
* libguile/filesys.c (scm_sendfile): Change conditional to
HAVE_SYS_SENDFILE_H && HAVE_SENDFILE.
Ludovic Courtès [Mon, 25 Mar 2013 12:28:42 +0000 (13:28 +0100)]
sendfile: Check return value of `lseek'.
* libguile/filesys.c (scm_sendfile): Check return value of
`lseek_or_lseek64', and use `SCM_SYSERROR' upon error.
Ludovic Courtès [Mon, 25 Mar 2013 12:26:52 +0000 (13:26 +0100)]
Skip relevant `sendfile' tests when thread support is lacking.
* test-suite/tests/filesys.test ("sendfile")["pipe", "pipe with
offset"]: Throw to `unresolved' when not (provided? 'threads).
Ludovic Courtès [Fri, 22 Mar 2013 21:24:27 +0000 (22:24 +0100)]
tests: Add more `maybe-gc-flakiness'.
Fixes <http://bugs.gnu.org/14001>.
Reported by Dennis Clarke <dclarke@blastwave.org>.
* test-suite/tests/gc.test ("gc")["Lexical vars are collectable"]: Wrap
in `maybe-gc-flakiness'.
Ludovic Courtès [Wed, 20 Mar 2013 22:04:11 +0000 (23:04 +0100)]
Add bindings for `sendfile'.
* configure.ac: Check for <sys/sendfile.h> and `sendfile'.
* libguile/filesys.c (scm_sendfile): New function.
* libguile/filesys.h (scm_sendfile): New declaration.
* test-suite/tests/filesys.test ("sendfile"): New test prefix.
* doc/ref/posix.texi (File System): Document `sendfile'.
Ludovic Courtès [Fri, 22 Mar 2013 21:09:05 +0000 (22:09 +0100)]
texinfo plain-text: Use `match' for `stexi->plain-text'.
* module/texinfo/plain-text.scm (def)[list/spaces]: Remove.
(stexi->plain-text): Use `match' instead of `cond'.
Ludovic Courtès [Fri, 22 Mar 2013 21:05:23 +0000 (22:05 +0100)]
texinfo: Add whitespace after periods.
* module/texinfo/string-utils.scm (end-of-sentence?): New procedure.
(make-text-wrapper): Append an extra space after LINE when it matches
`end-of-sentence?' and COLLAPSE-WHITESPACE? is false.
* test-suite/tests/texinfo.serialize.test ("test-serialize"): Adjust
accordingly.
* test-suite/tests/texinfo.string-utils.test ("text wrapping")["two
spaces after end of sentence"]: New test prefix.
Ludovic Courtès [Thu, 21 Mar 2013 23:52:16 +0000 (00:52 +0100)]
build: Adjust makefiles for `guile-procedures.txt'.
* libguile/Makefile.am (all-local): New target.
* Makefile.am (libguile/guile-procedures.txt): Output to $@.tmp first.
(CLEANFILES): New variable.
Ludovic Courtès [Thu, 21 Mar 2013 18:17:13 +0000 (19:17 +0100)]
Build `guile-procedures.txt' using (texinfo) instead of `makeinfo'.
* Makefile.am (schemelibdir, schemelib_DATA): New variables.
(libguile/guile-procedures.txt): New target.
(EXTRA_DIST): Add libguile/texi-fragments-to-docstrings.
* libguile/Makefile.am (guile-procedures.txt): Remove target.
(schemelibdir, schemelib_DATA): Remove.
* libguile/texi-fragments-to-docstrings: New file.
Ludovic Courtès [Thu, 21 Mar 2013 22:22:08 +0000 (23:22 +0100)]
texinfo plain-text: Properly render @dots{}.
* module/texinfo/plain-text.scm (tag-handlers): Add `dot' handler.
Ludovic Courtès [Thu, 21 Mar 2013 18:17:56 +0000 (19:17 +0100)]
test suite: Fix typo in `texinfo.test'.
* test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add missing
quote.
Ludovic Courtès [Thu, 21 Mar 2013 15:42:54 +0000 (16:42 +0100)]
texinfo: Recognize `@:'.
* module/texinfo.scm (read-command-token): Recognize @:.
* test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add test.
Ludovic Courtès [Thu, 21 Mar 2013 15:37:48 +0000 (16:37 +0100)]
texinfo: Allow markup in the arguments of `@pxref'.
* module/texinfo.scm (texi-command-specs)[pxref]: Change to
`INLINE-TEXT-ARGS'.
* test-suite/tests/texinfo.test ("test-texinfo->stexinfo")["@pxref{Locales,
@code{setlocale}}"]: New test.
Ludovic Courtès [Thu, 21 Mar 2013 15:36:24 +0000 (16:36 +0100)]
test suite: Use `pass-if-equal' in texinfo.test.
* test-suite/tests/texinfo.test: Replace occurrences of
`(pass-if (equal? ...))' by `pass-if-equal'.
Mike Gran [Thu, 21 Mar 2013 16:20:31 +0000 (09:20 -0700)]
Document quit and exit
* doc/ref/posix.texi (Processes): document `quit' and `exit'
* doc/ref/r6rs.texi (rnrs programs): xref exit
Mark H Weaver [Thu, 21 Mar 2013 15:51:18 +0000 (11:51 -0400)]
Add missing 'cond-expand' feature identifiers; remove srfi-6 from core list.
* module/ice-9/boot-9.scm (%cond-expand-features): Remove redundant list
of feature identifiers in the comment. Explain more clearly what
belongs in this list. Remove srfi-6.
* module/srfi/srfi-4.scm, module/srfi/srfi-27.scm,
module/srfi/srfi-31.scm, module/srfi/srfi-38.scm,
module/srfi/srfi-39.scm, module/srfi/srfi-42.scm,
module/srfi/srfi-45.scm, module/srfi/srfi-67.scm: Add missing
'cond-expand-provide'.
* module/srfi/srfi-69.scm: Fix erroneous 'cond-expand-provide'.
* doc/ref/srfi-modules.texi (SRFI-0): Update the list of features in
Guile core.
Mark H Weaver [Thu, 21 Mar 2013 16:41:05 +0000 (12:41 -0400)]
Mention the non-conformance of the core SRFI-6 procedures in the manual.
* doc/ref/srfi-modules.texi (About SRFI Usage): Use SRFI-13 as an
example of a module which is included in core Guile, instead of
SRFI-6.
(SRFI-6): Mention the non-conformance of the core 'open-input-string'
and 'open-output-string' procedures. Remove the claim that importing
this module does nothing. Recommend that users import the module.
Mark H Weaver [Wed, 20 Mar 2013 10:15:32 +0000 (06:15 -0400)]
Improve sqrt handling of large integers and large and small rationals.
* libguile/numbers.c (exact_integer_is_perfect_square,
exact_integer_floor_square_root): New static functions.
(scm_sqrt): Use SCM_LIKELY. Add 'scm_t_inum' variable in inum case to
reduce the number of uses of SCM_I_INUM. Rename 'mpz_t' variable.
Remove unneeded sign check. Handle bignums too large to fit in a
double. Handle fractions too large or too small to fit in a
normalized double.
* test-suite/tests/numbers.test ("sqrt"): Add tests.
Mark H Weaver [Wed, 20 Mar 2013 06:27:10 +0000 (02:27 -0400)]
Optimize inum case of exact-integer-sqrt.
* libguile/numbers.c (scm_exact_integer_sqrt): Use GMP for inum
case. It is faster than what we had before.
Mark H Weaver [Tue, 19 Mar 2013 22:48:56 +0000 (18:48 -0400)]
Sqrt returns exact results when possible.
* libguile/numbers.c (scm_sqrt): Handle exact integers and rationals in
such a way that exact results are returned whenever possible.
* test-suite/tests/numbers.test ("sqrt"): Add tests.
Mark H Weaver [Wed, 20 Mar 2013 02:38:45 +0000 (22:38 -0400)]
Optimize scm_i_divide2double for integers less than 2^DBL_MANT_DIG.
* libguile/numbers.c (scm_i_divide2double): Optimize for common case
when both operands are less than 2^DBL_MANT_DIG (normally 2^53).
Mark H Weaver [Tue, 19 Mar 2013 00:01:12 +0000 (20:01 -0400)]
SRFI-45: Support multiple values; add promise? predicate.
* module/srfi/srfi-45.scm (eager): Accept any number of arguments.
Store the list of arguments in the value record. Previously, only one
argument was accepted, and that value was stored in the value record.
(delay): Support expressions that return any number of arguments.
(force): Return the list of values stored in the value record.
(promise?): Export.
* doc/ref/srfi-modules.texi (SRFI-45): Update docs. Remove typing
for simplicity in discussing multiple values.
* test-suite/tests/srfi-45.test: Add tests. Add FSF copyright for 2010
and 2013. Add missing year to André van Tonder's copyright notice.
Mark H Weaver [Tue, 19 Mar 2013 07:25:59 +0000 (03:25 -0400)]
Use scientific notation only if there are enough trailing zeroes.
* libguile/numbers.c (idbl2str): Print large numbers in scientific
notation only if the exponent is >= 7 and the least significant
non-zero digit has value >= radix^4.
* test-suite/tests/numbers.test ("number->string"): Add tests.
Ludovic Courtès [Mon, 18 Mar 2013 21:28:23 +0000 (22:28 +0100)]
Avoid rebuild of `guile.info' at the user's site.
* configure.ac: Remove `doc/ref/effective-version.texi' from the
`AC_CONFIG_FILES'.
* doc/ref/Makefile.am ($(srcdir)/effective-version.texi): New target.
Ludovic Courtès [Mon, 18 Mar 2013 20:31:50 +0000 (21:31 +0100)]
Use byte-oriented functions in `get-bytevector*'.
* libguile/r6rs-ports.c (scm_get_bytevector_some, scm_get_bytevector_n,
scm_get_bytevector_n_x, scm_get_bytevector_all): Use
`scm_get_byte_or_eof' and `scm_peek_byte_or_eof' instead of their
`char' counterparts.
Reported by Chris K. Jester-Young.
Ludovic Courtès [Mon, 18 Mar 2013 20:28:05 +0000 (21:28 +0100)]
Define the new Linux-specific `SO_REUSEPORT'.
* libguile/socket.c (scm_init_socket)[SO_REUSEPORT]: Define
`SO_REUSEPORT'.
(scm_setsockopt, scm_getsockopt): Update docstring.
* doc/ref/posix.texi (Network Sockets and Communication): List
`SO_REUSEPORT'.
Mark H Weaver [Tue, 5 Mar 2013 10:47:56 +0000 (05:47 -0500)]
Reimplement idbl2str number printer.
Fixes <http://bugs.gnu.org/13757>.
* libguile/numbers.c (idbl2str): Reimplement.
(mem2decimal_from_point): Accept negative exponents larger than
SCM_MAXEXP that produce subnormals.
(SCM_MAX_DBL_PREC): Removed preprocessor macro.
(scm_dblprec, fx_per_radix): Removed static variables.
(init_dblprec, init_fx_radix): Removed static functions.
(scm_init_numbers): Remove initialization code for 'scm_dblprec'
and 'fx_per_radix'.
* test-suite/tests/numbers.test ("number->string"): Restore tests that
previously failed. Remove comments about problems in the number
printer that are now fixed.
Mark H Weaver [Mon, 4 Mar 2013 23:46:33 +0000 (18:46 -0500)]
Improve inexact division of exact integers.
* libguile/numbers.c (scm_i_divide2double): New function.
(scm_i_divide2double_lo2b): New variable.
(scm_i_fraction2double, log_of_fraction): Use 'scm_i_divide2double'.
(do_divide): Removed. Its code is now in 'scm_divide'.
(scm_divide2real): Removed. Superceded by 'scm_i_divide2double'.
(scm_divide): Inherit code from 'do_divide', but without support for
forcing a 'double' result (that functionality is now implemented by
'scm_i_divide2double'). Add FIXME comments in cases where divisions
might not be as precise as they should be.
(scm_init_numbers): Initialize 'scm_i_divide2double_lo2b'.
* test-suite/tests/numbers.test (dbl-epsilon-exact, dbl-max-exp): New
variables.
("exact->inexact"): Add tests.
("inexact->exact"): Add test for largest finite inexact.
Daniel Hartwig [Sat, 16 Mar 2013 11:53:07 +0000 (19:53 +0800)]
http: support IP-literal (IPv6 address) in Host header
* module/web/http.scm ("Host"): Parse and write IP-literals treating
escapes as uri module does: remove brackets on parse, replace them on
write.
* test-suite/tests/web-http.test ("request headers"): Add tests.
Daniel Hartwig [Sat, 23 Feb 2013 07:15:33 +0000 (15:15 +0800)]
add tests for read-request-line, etc.
* test-suite/web/web-http.test ("read-request-line"):
("write-request-line", "read-response-line", "write-response-line"):
Add.
Daniel Hartwig [Sat, 16 Mar 2013 09:53:53 +0000 (17:53 +0800)]
minor tweaks to web documentation
* doc/ref/web.texi: Say `World Wide Web'; the hyphenated form is almost
never used (c.f. w3.org).
General predicate arguments are named `obj'. Fill in arguments
omitted from some procedure definitions (e.g. `request-method').
Minor tweaks, such as using en-dash and missing markup as appropriate.
Wrap very long deffn lines.
* module/web/*.scm: Expand texinfo markup in doc strings. Synchronize
with changes in web.texi.
Andy Wingo [Fri, 15 Mar 2013 21:21:34 +0000 (22:21 +0100)]
more NEWS
* NEWS: Update.
Andy Wingo [Fri, 15 Mar 2013 20:13:27 +0000 (21:13 +0100)]
incremental NEWS work
* NEWS: Checkpoint.
Andy Wingo [Fri, 15 Mar 2013 18:22:18 +0000 (19:22 +0100)]
fix doc build
* doc/ref/api-data.texi (Bitwise Operations): Don't use @-commands in
@math. Fixes doc build.
* doc/ref/api-macros.texi (Syntax Rules): Fix example result.
Andy Wingo [Wed, 13 Mar 2013 22:22:34 +0000 (23:22 +0100)]
very beginnings of NEWS
* NEWS: A very very very rough start at 2.0.8 news
Andy Wingo [Wed, 13 Mar 2013 10:01:38 +0000 (11:01 +0100)]
allow for spurious wakeups from pthread_cond_wait
* libguile/threads.c (scm_call_with_new_thread, scm_spawn_thread): Allow
for spurious wakeups while waiting on cond variables. Should fix bug
10641.
Andy Wingo [Tue, 12 Mar 2013 21:07:50 +0000 (22:07 +0100)]
failing to load module in psyntax indicates an identifier is not macro
* module/ice-9/boot-9.scm (false-if-exception): Add optional #:warning
TEMPLATE ARG... tail, which indicates that we should print a warning
on failure.
(load-in-vicinity): Use the new #:warning.
(make-autoload-interface): Surround the bits that load modules with a
false-if-exception with #:warning. Fixes
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12202.
* test-suite/tests/syncase.test ("missing autoloads do not foil
psyntax"): Add a test.