Mark H Weaver [Sat, 11 Jan 2014 15:18:40 +0000 (10:18 -0500)]
Fix hashing of vectors to run in bounded time.
* libguile/hash.c (SCM_MIN): New macro.
(scm_hasher): In vector case, do nothing if d is 0. Make sure to
recurse with a reduced d. Move the loop out of the 'if'.
Mark H Weaver [Thu, 19 Dec 2013 18:22:50 +0000 (13:22 -0500)]
Implement R7RS 'syntax-error'.
* module/ice-9/psyntax.scm (syntax-error): New macro.
(syntax-rules): Handle 'syntax-error' templates specially
for improved error reporting.
* module/ice-9/psyntax-pp.scm: Regenerate.
* doc/ref/api-macros.texi (Syntax Rules): Add new subsection "Reporting
Syntax Errors in Macros".
* test-suite/tests/syntax.test: Add tests.
Mark H Weaver [Wed, 18 Dec 2013 23:49:37 +0000 (18:49 -0500)]
psyntax: custom ellipses using 'with-ellipsis' or R7RS syntax-rules.
* module/ice-9/psyntax.scm (binding-type): Update the header comment
to mention the new 'ellipsis' binding type.
(macros-only-env): Preserve ellipsis bindings.
(ellipsis?): Add 'r' and 'mod' as arguments. Search the lexical
environment for an ellipsis binding, and use it.
(gen-syntax): Adapt to the additional arguments of 'ellipsis?'.
(with-ellipsis): New core syntax.
(convert-pattern): Add unary 'ellipsis?' procedure as an argument.
(gen-clause): Adapt to the additional arguments of 'ellipsis?'.
Pass unary 'ellipsis?' procedure to 'convert-pattern'.
(syntax-case): Adapt to the additional arguments of 'ellipsis?'.
(syntax-local-binding): Support new 'ellipsis' binding type.
(syntax-rules): Add support for a custom ellipsis identifier as
the first operand, as per R7RS. Collect common code within new
local procedure 'expand-syntax-rules'.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/local-eval.scm (analyze-identifiers): Add support for
'ellipsis' binding type.
* doc/ref/api-macros.texi (Syntax Rules): Add docs for R7RS custom
ellipsis syntax. Use @dots{}.
(Syntax Case): Add docs for 'with-ellipsis'. Use @dots{}.
(Syntax Transformer Helpers): Update to include new 'ellipsis'
binding type.
* test-suite/tests/syntax.test: Add tests.
Mark H Weaver [Tue, 24 Dec 2013 11:42:51 +0000 (06:42 -0500)]
psyntax: toplevel variable definitions discard previous syntactic binding.
* module/ice-9/psyntax.scm (expand-top-sequence): When defining a
toplevel variable, use the value of the same-named imported
_variable_, if any. Do _not_ use an existing syntactic binding.
* module/ice-9/psyntax-pp.scm: Regenerate.
Ian Price [Thu, 24 Oct 2013 04:51:47 +0000 (05:51 +0100)]
Fix trap handlers to handle applicable structs.
Reported by Jordy Dickinson <jordy.dickinson@gmail.com>.
Fixes <http://bugs.gnu.org/15691>.
* module/system/vm/traps.scm (frame-matcher): Extract procedure when
proc is an applicable struct.
Mark H Weaver [Wed, 25 Dec 2013 10:10:19 +0000 (05:10 -0500)]
Fix 'string-copy!' to work properly with overlapping src/dest.
* libguile/srfi-13.c (scm_string_copy_x): Fix to work properly with
overlapping src/dest.
* test-suite/tests/srfi-13.test ("string-copy!"): Add tests.
Mark H Weaver [Fri, 20 Dec 2013 23:12:37 +0000 (18:12 -0500)]
Implement 'exact-integer?' and 'scm_is_exact_integer'.
* libguile/numbers.c (scm_exact_integer_p, scm_is_exact_integer):
New procedures.
(scm_integer_p): Improve docstring.
* libguile/numbers.h (scm_exact_integer_p, scm_is_exact_integer):
New prototypes.
* doc/ref/api-data.texi (Integers): Add docs.
* test-suite/tests/numbers.test ("exact-integer?"): Add tests.
Mark H Weaver [Thu, 9 Jan 2014 02:39:55 +0000 (21:39 -0500)]
Fix doc that incorrectly claimed (integer? +inf.0) => #t.
Fixes <http://bugs.gnu.org/16356>.
Reported by Zefram <zefram@fysh.org>.
* doc/ref/api-data.texi (Integers): Add docs. Fix outdated example
that incorrectly showed (integer? +inf.0) => #t.
Mark H Weaver [Tue, 24 Dec 2013 11:48:44 +0000 (06:48 -0500)]
scm_primitive_load: Simplify code using 'scm_open_file_with_encoding'.
* libguile/load.c (scm_primitive_load): Use
'scm_open_file_with_encoding'.
Mark H Weaver [Tue, 24 Dec 2013 12:40:40 +0000 (07:40 -0500)]
boot-9: add comment about autoload thread-unsafety.
* module/ice-9/boot-9.scm: Add comment about lack of thread-safety in
handling of autoloads.
Mark H Weaver [Tue, 24 Dec 2013 13:00:51 +0000 (08:00 -0500)]
read: Avoid signed integer overflow in 'read_decimal_integer'.
* libguile/read.c (read_decimal_integer): Avoid overflow.
Mark H Weaver [Tue, 24 Dec 2013 19:39:44 +0000 (14:39 -0500)]
Increment SCM_N_READ_OPTIONS for 'curly-infix' option.
* libguile/private-options.h (SCM_N_READ_OPTIONS): Increment to 8.
This should have been done when the 'curly-infix' was added.
Ian Price [Wed, 23 Oct 2013 10:14:26 +0000 (11:14 +0100)]
Fix inlining of tail list to apply.
Fixes <http://bugs.gnu.org/15533>.
* module/language/tree-il/peval.scm (peval): Final list argument to
`apply' should not be inlined if it is mutable.
* test-suite/tests/peval.test ("partial evaluation"): Add test.
Ludovic Courtès [Sat, 21 Dec 2013 21:01:38 +0000 (22:01 +0100)]
Thank Aleix.
Aleix Conchillo Flaque [Thu, 3 Oct 2013 22:49:07 +0000 (15:49 -0700)]
allow specifying a required version in GUILE_PROGS
* meta/guile.m4: GUILE_PROGS now takes an optional argument to specify a
required Guile version. By default, it requires Guile >= 2.0. A micro
version can also be specified (e.g. GUILE_PROGS([2.0.10])).
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Mark H Weaver [Tue, 17 Dec 2013 03:55:25 +0000 (22:55 -0500)]
Revert "Fix bound-identifier=? to compare binding names, not just symbolic names."
This reverts commit
70c74b847680d3b239e591afa2e99c51a712980c.
Mark H Weaver [Mon, 16 Dec 2013 00:04:59 +0000 (19:04 -0500)]
Fix bound-identifier=? to compare binding names, not just symbolic names.
Fixes <http://bugs.gnu.org/16158>.
* module/ice-9/psyntax.scm (bound-id=?): Use 'id-var-name' to compare
binding names (gensyms), not just symbolic names.
* module/ice-9/psyntax-pp.scm: Regenerate.
* test-suite/tests/syntax.test: Add test.
Ludovic Courtès [Sun, 15 Dec 2013 21:48:41 +0000 (22:48 +0100)]
Hide EINTR returns from 'accept'.
* libguile/socket.c (scm_accept): Wrap 'accept' call in 'SCM_SYSCALL'.
Mark H Weaver [Fri, 13 Dec 2013 17:53:24 +0000 (12:53 -0500)]
syntax-case: fix error reporting for misplaced ellipses.
Reported by taylanbayirli@gmail.com (Taylan Ulrich B.).
* module/ice-9/psyntax.scm (cvt*): Use 'syntax-case' to destructure
the pattern tail, instead of 'pair?', 'car', and 'cdr'.
(gen-clause): When checking for errors, check for misplaced ellipsis
before duplicate pattern variables, to improve the error message in
case of multiple misplaced ellipses.
* module/ice-9/psyntax-pp.scm: Regenerate.
* test-suite/tests/syntax.test: Add tests.
Mark H Weaver [Fri, 13 Dec 2013 05:34:40 +0000 (00:34 -0500)]
THANKS Tom Tromey.
* THANKS: Add Tom Tromey to fixes section.
Tom Tromey [Tue, 10 Dec 2013 14:43:35 +0000 (07:43 -0700)]
Add missing FUNC_NAME defines for pair accessors.
* libguile/pairs.c (scm_car, scm_cdr, scm_caar, scm_cadr, scm_cdar,
scm_cddr, scm_caaar, scm_caadr, scm_cadar, scm_caddr, scm_cdaar,
scm_cdadr, scm_cddar, scm_cdddr, scm_caaaar, scm_caaadr, scm_caadar,
scm_caaddr, scm_cadaar, scm_cadadr, scm_caddar, scm_cadddr,
scm_cdaaar, scm_cdaadr, scm_cdadar, scm_cdaddr, scm_cddaar,
scm_cddadr, scm_cdddar, scm_cddddr): Add missing FUNC_NAME defines.
Tom Tromey [Tue, 10 Dec 2013 14:43:34 +0000 (07:43 -0700)]
Fix computation of LIBLOBJS.
Fixes <http://bugs.gnu.org/14193>.
* configure.ac (LIBLOBJS): Add prefix to computed .lo file name so
dependencies work properly.
Ludovic Courtès [Thu, 5 Dec 2013 21:18:02 +0000 (22:18 +0100)]
vm: Gracefully handle stack overflows.
Fixes <http://lists.gnu.org/archive/html/guile-user/2013-12/msg00017.html>.
Reported by rvclayton@verizon.net (R. Clayton).
* libguile/vm.c (reinstate_stack_reserve): New function.
(vm_error_stack_overflow): Install it as an unwind handler.
* test-suite/tests/control.test ("the-vm")["stack overflow reinstates
stack reserve"]: New test.
Andy Wingo [Mon, 2 Dec 2013 18:02:05 +0000 (19:02 +0100)]
Fix brainfuck comment
* module/language/brainfuck/parse.scm: Fix outdated comment.
Andy Wingo [Mon, 2 Dec 2013 18:00:57 +0000 (19:00 +0100)]
Fix brainfuck->scheme compiler.
* module/language/brainfuck/compile-scheme.scm (compile-scheme): Fix
brainfuck compiler.
Mark H Weaver [Sun, 1 Dec 2013 23:35:37 +0000 (18:35 -0500)]
GOOPS doc fix: #:dsupers is the init keyword for the dsupers slot.
* doc/ref/goops.texi (Metaclasses): #:dsupers is the initialization
keyword for the dsupers slot, not #:supers.
Andy Wingo [Thu, 28 Nov 2013 15:20:42 +0000 (16:20 +0100)]
Critical sections in guardians do not need to block asyncs
* libguile/guardians.c: Critical sections here cannot cause an
async_tick, so they do not need to block asyncs.
Andy Wingo [Thu, 28 Nov 2013 13:40:58 +0000 (14:40 +0100)]
Deprecate gc-live-object-stats
* libguile/gc.h:
* libguile/gc.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_gc_live_object_stats): Deprecate; it hasn't
worked in the whole 2.0 series.
Mark H Weaver [Sun, 17 Nov 2013 07:54:31 +0000 (02:54 -0500)]
Make (ice-9 popen) thread-safe.
Fixes <http://bugs.gnu.org/15683>.
Reported by David Pirotte <david@altosw.be>.
* module/ice-9/popen.scm: Import (ice-9 threads) and (srfi srfi-9).
(<pipe-info>): New record type.
(port/pid-table): Mark as deprecated in comment.
(port/pid-table-mutex): New variable.
(open-pipe*): Store the pid in the pipe-info record, and store the
pipe-info as a port property. Guard the pipe-info instead of the
port. Lock 'port/pid-table-mutex' while mutating 'port/pid-table'.
(fetch-pid): Removed.
(fetch-pipe-info): New procedure.
(close-process-quietly): Removed.
(close-pipe): Use 'fetch-pipe-info' instead of 'fetch-pid'. Clear
the pid from the pipe-info. Improve error messages.
(reap-pipes): Adapt to the fact that the pipe-info is now guarded
instead of the port. Incorporate the 'waitpid' code that was
previously in 'close-process-quietly', but let the port finalizer
close the port. Clear the pid from the pipe-info.
Mark H Weaver [Sun, 17 Nov 2013 07:46:08 +0000 (02:46 -0500)]
Stylistic improvements for (ice-9 popen).
* module/ice-9/popen.scm (close-process, close-process-quietly): Accept
'port' and 'pid' as separate arguments. Improve style.
(close-pipe, read-pipes): Improve style.
Mark H Weaver [Sun, 17 Nov 2013 06:11:57 +0000 (01:11 -0500)]
Make port properties accessible from Scheme.
* libguile/ports.c (scm_i_port_alist, scm_i_set_port_alist_x): Removed.
(scm_i_port_property, scm_i_set_port_property_x): New procedures,
available from Scheme as '%port-property' and '%set-port-property!'.
* libguile/ports.h (scm_i_port_alist, scm_i_set_port_alist_x): Removed.
(scm_i_port_property, scm_i_set_port_property_x): New prototypes.
* libguile/read.c (set_port_read_option, init_read_options): Adapt to
use scm_i_port_property and scm_i_set_port_property_x.
Mark H Weaver [Sun, 17 Nov 2013 08:35:09 +0000 (03:35 -0500)]
Make guardians thread-safe.
* libguile/guardians.c (t_guardian): Add mutex.
(finalize_guarded, scm_i_guard, scm_i_get_one_zombie): Lock mutex and
block system asyncs during critical sections.
(scm_make_guardian): Initialize mutex.
Mark H Weaver [Sun, 17 Nov 2013 08:19:32 +0000 (03:19 -0500)]
Block system asyncs while 'overrides_lock' is held.
* libguile/procprop.c (scm_set_procedure_property_x): Block system
asyncs while overrides_lock is held. Use dynwind block in case
an exception is thrown.
Mark H Weaver [Sun, 17 Nov 2013 09:00:29 +0000 (04:00 -0500)]
Add mutex locking functions that also block asyncs.
* libguile/async.h (scm_i_pthread_mutex_lock_block_asyncs,
scm_i_pthread_mutex_unlock_unblock_asyncs): New macros.
* libguile/threads.c (do_unlock_with_asyncs): New static helper.
(scm_i_dynwind_pthread_mutex_lock_block_asyncs): New function.
* libguile/threads.h (scm_i_dynwind_pthread_mutex_lock_block_asyncs):
Add prototype.
Chris K. Jester-Young [Sun, 27 Oct 2013 21:31:38 +0000 (17:31 -0400)]
Convert test-suite/tests/exceptions.test to use hygienic macros.
* test-suite/tests/exceptions.test (push): New syntax parameter.
(throw-test): Convert to a syntax-rules macro, using syntax parameters
to support the otherwise-unhygienic use of "push".
Mark H Weaver [Mon, 18 Nov 2013 05:44:17 +0000 (00:44 -0500)]
Web: accept "UTC" as the zone offset in date headers.
Fixes <http://bugs.gnu.org/14128>.
Reported by Aleix Conchillo Flaqué <aconchillo@gmail.com>.
* module/web/http.scm (parse-zone-offset): Accept "UTC".
Mark H Weaver [Tue, 19 Nov 2013 04:04:18 +0000 (23:04 -0500)]
THANKS David Thompson
* THANKS: Add David Thompson to list of contributors.
David Thompson [Sun, 20 Oct 2013 02:43:37 +0000 (22:43 -0400)]
Add procedures to convert alists into hash tables.
* module/ice-9/hash-table.scm: New module.
* test-suite/tests/hash.test ("alist conversion"): Add tests.
* doc/ref/api-compound.texi (Hash Table Reference): Add docs.
Mark H Weaver [Fri, 9 Aug 2013 22:27:20 +0000 (18:27 -0400)]
Convert guile exceptions to R6RS conditions in R6RS exception handlers.
* module/rnrs/exceptions.scm (&guile): New condition type.
(guile-condition-converters): New variable.
(convert-guile-condition, default-guile-condition-converter,
set-guile-condition-converter!, guile-common-conditions,
guile-lexical-violation-converter, guile-syntax-violation-converter,
guile-assertion-violation-converter, guile-system-error-converter,
guile-undefined-violation-converter, guile-error-converter,
guile-implementation-restriction-converter): New procedures.
(with-exception-handler): Catch all exceptions, not just R6RS
exceptions. Convert native Guile exceptions to R6RS conditions,
preserving the original Guile exception information in the &guile
condition object.
(raise): If the condition includes a &guile condition, use 'throw' to
throw the original native guile exception instead of raising an R6RS
exception.
* test-suite/tests/r6rs-exceptions.test ("guile condition conversions"):
Add tests.
Mark H Weaver [Sun, 17 Nov 2013 04:24:42 +0000 (23:24 -0500)]
Improve error when 'include' form with relative path is not in a file.
Reported by Nala Ginrut <nalaginrut@gmail.com>.
* module/ice-9/psyntax.scm (include): Give a proper error message when
given a relative file name, and when the form is not in a file.
* module/ice-9/psyntax-pp.scm: Regenerate.
Mark H Weaver [Sun, 17 Nov 2013 05:35:26 +0000 (00:35 -0500)]
Add more entries to .gitignore
* .gitignore: Add /lib/poll.h, /lib/sys/select.h, /lib/sys/times.h,
and /test-suite/standalone/test-scm-c-bind-keyword-arguments.
Ludovic Courtès [Wed, 13 Nov 2013 13:24:42 +0000 (14:24 +0100)]
i18n: Fix null pointer dereference when locale info is missing.
* libguile/i18n.c (scm_nl_langinfo): Check whether C_RESULT is NULL
before calling 'strdup'.
Mark H Weaver [Tue, 5 Nov 2013 00:41:52 +0000 (19:41 -0500)]
Don't use the identifier 'noreturn'.
Fixes <http://bugs.gnu.org/15798>.
Reported by Matt Sicker <boards@gmail.com>.
* libguile/__scm.h (SCM_NORETURN): Use ((__noreturn__)) instead of
((noreturn)).
* libguile/throw.h (scm_ithrow): Rename formal parameter from 'noreturn'
to 'no_return'.
* libguile/throw.c (scm_ithrow): Rename formal parameter from 'noreturn'
to 'no_return'.
Ian Price [Sun, 20 Oct 2013 19:16:09 +0000 (20:16 +0100)]
Fix optional end argument in `uniform-vector-read!'.
Fixes <http://bugs.gnu.org/15370>.
Reported by Thien-Thi Nguyen <ttn@gnu.org>.
* libguile/deprecated.c (scm_uniform_vector_read_x): Only multiply by
width when argument supplied.
Ian Price [Sat, 19 Oct 2013 21:59:46 +0000 (22:59 +0100)]
Doc: 'unfold-right' takes a tail not a tail generator.
Reported by David Kastrup <dak@gnu.org>.
* doc/ref/srfi-modules.texi (SRFI-1 Fold and Map): Change argument
name, and default value.
Ian Price [Wed, 9 Oct 2013 21:48:16 +0000 (22:48 +0100)]
Doc: mention vectors are self-quoting
Reported by Dmitry Bogatov <KAction@gnu.org>.
* doc/ref/api-compound.texi (Vector Syntax, Vector Creation): Mention
that vectors are self-quoting. Remove examples with quote signs.
Ludovic Courtès [Mon, 14 Oct 2013 20:58:35 +0000 (22:58 +0200)]
doc: Update the section on SMOBs and memory management.
* doc/ref/libguile-smobs.texi (Describing a New Type): Only list 'print'
and 'equalp' as compulsory. Explain why 'mark' and 'free' are
optional.
(Creating Smob Instances): Remove paragraphs about allocations that
might fail etc. Use 'scm_gc_malloc_pointerless' for the pixel
buffer.
(Garbage Collecting Smobs): Explain when the 'mark' and 'free'
functions are needed.
(Garbage Collecting Simple Smobs): Remove.
Ludovic Courtès [Mon, 14 Oct 2013 20:24:48 +0000 (22:24 +0200)]
'scm_c_read' goes through the fast path with ISO-8859-1 unbuffered ports.
Discussed in <http://bugs.gnu.org/15368>.
* libguile/ports.c (scm_c_read): Enter the 'swap_buffer' case when
pt->encoding is "ISO-8859-1".
Mark H Weaver [Thu, 3 Oct 2013 18:25:51 +0000 (14:25 -0400)]
Fix edge case in 'ash'.
* libguile/numbers.c (left_shift_exact_integer): Fix edge case where
N is -1 and count is SCM_I_FIXNUM_BIT-1 to return the most negative
fixnum. Previously this result was returned as a bignum.
* test-suite/tests/numbers.test (ash): Add tests.
Mark H Weaver [Thu, 3 Oct 2013 22:49:31 +0000 (18:49 -0400)]
Revert "Fix edge case in 'ash'."
This reverts commit
8df68898b9f6ba15171244f1f3549688f13d605f.
Andy Wingo [Thu, 3 Oct 2013 17:45:41 +0000 (19:45 +0200)]
Deprecate scm_c_program_source, as it has no internal users.
* libguile/programs.c:
* libguile/programs.h:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_c_program_source): Deprecate.
Mark H Weaver [Thu, 3 Oct 2013 18:25:51 +0000 (14:25 -0400)]
Fix edge case in 'ash'.
* libguile/numbers.c (scm_ash): Fix (ash -1 SCM_I_FIXNUM_BIT-1) to
return a fixnum instead of a bignum.
* test-suite/tests/numbers.test (ash): Add tests.
Mark H Weaver [Mon, 30 Sep 2013 16:46:01 +0000 (12:46 -0400)]
Fix minor mistakes in documentation.
Fixes <http://bugs.gnu.org/15487>.
Reported by Josep Portella Florit <jpf@primfilat.com>.
* doc/ref/api-i18n.texi (i18n Introduction, Text Collation,
Internationalization, Internationalization):
LC_MESSAGE --> LC_MESSAGES.
* doc/ref/api-procedures.texi (Compiled Procedures):
program-lambda-alist --> program-lambda-list.
* THANKS: Fix alignment of Josep Portella Florit.
Mark H Weaver [Fri, 13 Sep 2013 03:58:32 +0000 (23:58 -0400)]
Fix truncated documentation for 'put-char'.
Fixes <http://bugs.gnu.org/15152>.
Reported by Josep Portella Florit <jpf@primfilat.com>.
* doc/ref/api-io.texi (R6RS Textual Output): Fix truncated docs
for 'put-char'.
* THANKS: Add Josep Portella Florit to fixes section.
Mark H Weaver [Thu, 12 Sep 2013 22:45:13 +0000 (18:45 -0400)]
Web: Use functional setters in extend-request and extend-response.
* module/web/client.scm (extend-request):
* module/web/server.scm (extend-response): Reimplement using
functional setters.
Mark H Weaver [Thu, 12 Sep 2013 22:34:39 +0000 (18:34 -0400)]
Web client+server: Add Content-Length header for empty bodies.
* module/web/client.scm (sanitize-request): Add a Content-Length
header if a body if given, even if the body is empty.
* module/web/server.scm (sanitize-response): Add a Content-Length
header if a body if given, even if the body is empty.
Mark H Weaver [Thu, 12 Sep 2013 22:14:54 +0000 (18:14 -0400)]
Adapt srfi-9.test to error reporting improvements; update copyright dates.
* module/srfi/srfi-9.scm: Add 2013 copyright date.
* test-suite/tests/srfi-9.test: Adapt to recent error reporting
improvements to procedures defined by 'define-tagged-inlinable'.
Mark H Weaver [Thu, 12 Sep 2013 22:04:08 +0000 (18:04 -0400)]
Improve error reporting of procedures defined by define-inlinable.
* module/ice-9/boot-9.scm (define-inlinable): Improve error reporting
when procedures defined using 'define-inlinable' are applied to the
wrong number of arguments.
* module/srfi/srfi-9.scm (define-tagged-inlinable): Improve error
reporting when procedures defined using 'define-tagged-inlinable' are
applied to the wrong number of arguments.
Mark H Weaver [Tue, 10 Sep 2013 06:05:26 +0000 (02:05 -0400)]
THANKS Alexandru Cojocaru
* THANKS: Add Alexandru Cojocaru to fixes section.
Mark H Weaver [Tue, 10 Sep 2013 05:39:52 +0000 (01:39 -0400)]
web client: HTTP methods are symbols, not strings.
* module/web/client.scm (request, http-get, http-head, http-post,
http-put, http-delete, http-trace, http-options): HTTP methods are
symbols.
Alexandru Cojocaru [Tue, 27 Aug 2013 13:59:39 +0000 (15:59 +0200)]
Fix extend-request to preserve method and meta.
* module/web/client.scm (extend-request): Preserve method and meta.
Mark H Weaver [Tue, 10 Sep 2013 02:42:36 +0000 (22:42 -0400)]
psyntax: cite the paper that psyntax is based on.
* module/ice-9/psyntax.scm: cite the paper.
Mark H Weaver [Tue, 10 Sep 2013 02:20:09 +0000 (22:20 -0400)]
Minor stylistic improvement to 'and-let*' macro.
* module/ice-9/and-let-star.scm (%and-let*): Use 'and' instead of
'if'. Suggested by Chris K. Jester-Young <cky944@gmail.com>.
Mark H Weaver [Mon, 9 Sep 2013 23:37:49 +0000 (19:37 -0400)]
Rewrite SRFI-2 'and-let*' using syntax-case.
* module/ice-9/and-let-star.scm (%and-let*): Helper macro.
(and-let*): Reimplement using syntax-case.
Mark H Weaver [Fri, 23 Aug 2013 05:57:50 +0000 (01:57 -0400)]
Fix 'define-public' from (ice-9 curried-definitions).
* module/ice-9/curried-definitions.scm (cdefine, cdefine*): Simplify,
and improve error reporting by making the patterns more strict.
(define-public): Fix bug in generated 'export' form.
Mark H Weaver [Mon, 19 Aug 2013 23:30:42 +0000 (19:30 -0400)]
Improve error checking in 'define-public' and 'module-add!'.
* module/ice-9/boot-9.scm (module-add!): Check that the symbol argument
is actually a symbol.
(define-public): Expand into 'define' in such a way that curried
definitions will immediately fail.
Ian Price [Mon, 19 Aug 2013 21:25:41 +0000 (22:25 +0100)]
doc: `get-string-all' takes only one argument.
* doc/ref/api-io.texi (R6RS Textual Input): Remove `count' argument.
Ian Price [Mon, 19 Aug 2013 02:43:48 +0000 (03:43 +0100)]
`write-request-line' always prints a path component.
* module/web/http.scm (write-request-line): Always write "/" when path
is empty, regardless of query.
* test-suite/tests/web-http.test ("write-request-line"): Add test.
Mark H Weaver [Sat, 17 Aug 2013 02:54:39 +0000 (22:54 -0400)]
Improved error checking in bytevector->uint-list and bytevector->sint-list.
Partially fixes <http://bugs.gnu.org/15100>.
Reported by Göran Weinholt <goran@weinholt.se>.
* libguile/bytevectors.c (INTEGERS_TO_LIST): Make sure SIZE isn't 0.
Allow SIZE to be greater than the bytevector length, for consistency
with allowing extra bytes at the end when the bytevector length is
non-zero. Use scm_from_size_t instead of scm_from_uint.
* test-suite/tests/bytevectors.test: Add tests. Remove a test that
checks for an exception when SIZE is greater than the bytevector
length.
Mark H Weaver [Thu, 15 Aug 2013 07:59:15 +0000 (03:59 -0400)]
Improve run-time error reporting in (ice-9 match).
* module/Makefile.am: match.go depends on match.upstream.scm.
* module/ice-9/match.scm (error): Accept any number of arguments.
* module/ice-9/match.upstream.scm (match-next): Call 'error' in non-tail
context, and include the value that failed to match in the call.
Mark H Weaver [Wed, 14 Aug 2013 00:33:18 +0000 (20:33 -0400)]
Manual: clarify that 'append!' and 'reverse!' might not mutate.
* doc/ref/api-compound.texi (Append/Reverse): Clarify that 'append!' and
'reverse!' are not required to modify anything.
Mark H Weaver [Tue, 13 Aug 2013 23:52:48 +0000 (19:52 -0400)]
Manual: don't promise that 'append!' will modify the existing lists.
* doc/ref/api-compound.texi (Append/Reverse): Say that 'append!' *may*
modify the given lists, but don't promise that it will.
Mark H Weaver [Mon, 12 Aug 2013 23:40:32 +0000 (19:40 -0400)]
Common numeric operations are left-to-right associative.
* module/language/tree-il/primitives.scm (define-primitive-expander):
Use 'match-lambda*' instead of 'case-lambda' for pattern matching.
(*primitive-expand-table*): In primitive expanders for '+', '*', '-',
'/', 'logior', and 'logand', assume conventional left-to-right
associativity.
Mark H Weaver [Mon, 12 Aug 2013 22:08:59 +0000 (18:08 -0400)]
Numerical comparisons are not negatable.
* module/language/tree-il/primitives.scm (*negatable-primitives*):
Remove (< <= > >=) from the list of negatable primitives.
Mark H Weaver [Mon, 12 Aug 2013 02:38:49 +0000 (22:38 -0400)]
Broken Turkish UTF-8 locale still unresolved in FreeBSD 9.1.
* test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved):
Disable tests of Turkish UTF-8 locale in FreeBSD 9.1.
Mark H Weaver [Sat, 10 Aug 2013 15:47:54 +0000 (11:47 -0400)]
Fix inappropriate uses of scm_syserror in numbers.c.
* libguile/numbers.c (mem2ureal, left_shift_exact_integer,
floor_right_shift_exact_integer, round_right_shift_exact_integer):
Use 'assert' instead of 'scm_syserror' to indicate a case that should
never happen.
Mark H Weaver [Fri, 9 Aug 2013 22:23:56 +0000 (18:23 -0400)]
dereference-pointer: check for null pointer.
* libguile/foreign.c (scm_dereference_pointer): Check for attempts to
dereference a null pointer.
* test-suite/tests/foreign.test ("null pointer"): Add test.
Mark H Weaver [Fri, 9 Aug 2013 09:32:23 +0000 (05:32 -0400)]
Fix numerator and denominator handling of signed zeroes and infinities.
* libguile/numbers.c (scm_numerator, scm_denominator): Handle signed
zeroes and infinities in accordance with the corresponding R6RS flonum
procedures.
* module/rnrs/arithmetic/flonums.scm (flnumerator, fldenominator):
Remove special handling of infinities.
* test-suite/tests/numbers.test (numerator, denominator): Add tests.
Convert existing tests to use 'pass-if-equal'.
* test-suite/tests/r6rs-arithmetic-flonums.test (flnumerator): Fix
broken test of (flnumerator -0.0).
Mark H Weaver [Wed, 7 Aug 2013 09:54:15 +0000 (05:54 -0400)]
Decompiler: fix handling of empty 'case-lambda' expressions.
* module/language/scheme/decompile-tree-il.scm (choose-output-names):
A <lambda> with no <lambda-case> decompiles into a 'case-lambda'
primitive. Ensure that 'case-lambda' is not shadowed by a lexical.
David Kastrup [Tue, 6 Aug 2013 22:01:54 +0000 (18:01 -0400)]
Fix display of symbols containing backslashes.
Fixes <http://bugs.gnu.org/15033>.
* libguile/print.c (print_extended_symbol): Double print backslashes.
Signed-off-by: Mark H Weaver <mhw@netris.org>
Mark H Weaver [Tue, 6 Aug 2013 21:16:04 +0000 (17:16 -0400)]
Add files from 'copysign' and 'isfinite' Gnulib modules.
* lib/copysign.c:
* lib/isfinite.c:
* lib/isnanf-nolibm.h:
* lib/isnanl-nolibm.h:
* lib/signbitd.c:
* lib/signbitf.c:
* lib/signbitl.c:
* m4/copysign.m4:
* m4/isfinite.m4:
* m4/signbit.m4: New files.
Mark H Weaver [Tue, 6 Aug 2013 20:38:32 +0000 (16:38 -0400)]
VM: ash: Use SCM_SRS and handle large right shift in fast path.
* libguile/vm-i-scheme.c (ash): Use SCM_SRS. Handle inum right shift by
more than SCM_I_FIXNUM_BIT-1 bits in fast path.
Mark H Weaver [Tue, 6 Aug 2013 20:26:46 +0000 (16:26 -0400)]
Use Gnulib's 'isfinite' in numbers.c.
* libguile/numbers.c (DOUBLE_IS_FINITE, DOUBLE_IS_POSITIVE_INFINITY,
DOUBLE_IS_NEGATIVE_INFINITY): Remove.
(scm_odd_p, scm_even_p, scm_finite_p, icmplx2str, scm_rational_p,
scm_inexact_to_exact): Use 'isfinite' instead of 'DOUBLE_IS_FINITE'.
Mark H Weaver [Tue, 6 Aug 2013 20:21:26 +0000 (16:21 -0400)]
Use Gnulib's 'copysign' in numbers.c.
* libguile/numbers.c (double_is_non_negative_zero): Remove.
(idbl2str, scm_max, scm_min, scm_angle, log_of_shifted_double,
scm_log10): Use 'copysign' to check signs of zeroes,
instead of 'double_is_non_negative_zero'.
Mark H Weaver [Tue, 6 Aug 2013 19:56:32 +0000 (15:56 -0400)]
Import 'copysign' and 'isfinite' modules from Gnulib.
* lib/Makefile.am:
* m4/gnulib-cache.m4:
* m4/gnulib-comp.m4: Add 'copysign' and 'isfinite' Gnulib modules.
Mark H Weaver [Sun, 4 Aug 2013 23:39:43 +0000 (19:39 -0400)]
VM: ASM_ADD and ASM_SUB for x86: clobber _CX not "rcx".
* libguile/vm-i-scheme.c (ASM_ADD, ASM_SUB): Clobber _CX not "rcx".
Mark H Weaver [Sun, 4 Aug 2013 22:01:52 +0000 (18:01 -0400)]
VM: Define ASM_MUL on ARM only if SMULL instruction is supported.
* libguile/vm-i-scheme.c (ASM_MUL): Define only if the target
architecture is known to implement the SMULL instruction.
Mark H Weaver [Fri, 2 Aug 2013 00:31:21 +0000 (20:31 -0400)]
VM: Implement ASM_ADD, ASM_SUB, and ASM_MUL for ARM processors.
* libguile/vm-i-scheme.c (ASM_ADD, ASM_SUB, ASM_MUL): Implement for ARM.
Mark H Weaver [Thu, 1 Aug 2013 19:31:39 +0000 (15:31 -0400)]
VM: Avoid untagging inums in 'logand' and 'logior'.
* libguile/vm-i-scheme.c (logand, logior): Avoid untagging.
Mark H Weaver [Sat, 3 Aug 2013 19:05:59 +0000 (15:05 -0400)]
VM: Add ASM_MUL for x86.
* libguile/vm-i-scheme.c (ASM_MUL): New macro.
(mul): Use ASM_MUL if available.
Mark H Weaver [Sat, 3 Aug 2013 18:58:28 +0000 (14:58 -0400)]
VM: Support 32-bit x86 in ASM_ADD and ASM_SUB.
* libguile/vm-i-scheme.c (_CX): New macro.
(ASM_ADD, ASM_SUB): Replace references to "rcx" with _CX.
Mark H Weaver [Sat, 3 Aug 2013 18:59:54 +0000 (14:59 -0400)]
VM: Add "cc" to the clobber list of ASM_ADD and ASM_SUB.
* libguile/vm-i-scheme.c (ASM_ADD, ASM_SUB): Add "cc" to the clobber
list. Suggested by Göran Weinholt <goran@weinholt.se>.
Mark H Weaver [Sat, 3 Aug 2013 18:51:07 +0000 (14:51 -0400)]
VM: Avoid overflow in ASM_ADD when the result is most-positive-fixnum.
* libguile/vm-i-scheme.c (ASM_ADD): Remove the tag from one of the
operands before adding, to avoid overflow when the result is the most
positive fixnum.
Mark H Weaver [Sat, 3 Aug 2013 18:46:40 +0000 (14:46 -0400)]
VM: Avoid signed overflows in 'add1' and 'sub1'.
* libguile/vm-i-scheme.c (INUM_STEP): New macro.
(add1, sub1): Avoid signed overflows, and use INUM_STEP.
Mark H Weaver [Thu, 1 Aug 2013 18:01:58 +0000 (14:01 -0400)]
VM: Redefine INUM_MIN and INUM_MAX without assumptions.
* libguile/vm-i-scheme.c (INUM_MIN, INUM_MAX): Redefine to avoid
assumptions about the representation of inums.
Mark H Weaver [Thu, 1 Aug 2013 17:50:41 +0000 (13:50 -0400)]
Add 'scm_i_from_double' and use it.
* libguile/numbers.c (scm_i_from_double): New static function.
(scm_from_double): Just call 'scm_i_from_double'.
(scm_inf, scm_nan, scm_abs, scm_i_inexact_floor_quotient,
scm_i_inexact_floor_remainder, scm_i_inexact_floor_divide,
scm_i_inexact_ceiling_quotient, scm_i_inexact_ceiling_remainder,
scm_i_inexact_ceiling_divide, scm_i_inexact_truncate_quotient,
scm_i_inexact_truncate_remainder, scm_i_inexact_truncate_divide,
scm_i_inexact_centered_quotient, scm_i_inexact_centered_remainder,
scm_i_inexact_centered_divide, scm_i_inexact_round_quotient,
scm_i_inexact_round_remainder, scm_i_inexact_round_divide,
scm_max, scm_min, scm_sum, scm_difference, scm_product,
scm_divide, scm_truncate_number, scm_round_number, scm_floor,
scm_ceiling, scm_expt, scm_sin, scm_cos, scm_tan, scm_sinh,
scm_cosh, scm_tanh, scm_asin, scm_acos, scm_atan, scm_sys_asinh,
scm_sys_acosh, scm_sys_atanh, scm_real_part, scm_imag_part,
scm_magnitude, scm_angle, scm_exact_to_inexact, log_of_shifted_double,
log_of_fraction, scm_log10, scm_exp, scm_sqrt, scm_init_numbers):
Use 'scm_i_from_double' instead of 'scm_from_double'.
Mark H Weaver [Sun, 21 Jul 2013 14:00:48 +0000 (10:00 -0400)]
Optimize R6RS bitwise operators.
* module/rnrs/arithmetic/bitwise.scm (bitwise-if, bitwise-length,
bitwise-first-bit-set, bitwise-bit-field, bitwise-reverse-bit-field):
Replace these with aliases to the identical SRFI-60 operators
'bitwise-if', 'integer-length', 'first-set-bit', 'bit-field', and
'reverse-bit-field'.
(bitwise-copy-bit, bitwise-copy-bit-field, bitwise-rotate-bit-field):
Reimplement these based upon the similar SRFI-60 operators 'copy-bit',
'copy-bit-field', and 'rotate-bit-field'.
* test-suite/tests/r6rs-arithmetic-bitwise.test (bitwise-copy-bit): Fix
test to conform to the specification, which requires the third
argument to be either 0 or 1.
* test-suite/tests/r6rs-arithmetic-fixnums.test (fxcopy-bit): Fix test
to conform to the specification, which requires the third argument to
be either 0 or 1.
Mark H Weaver [Sun, 21 Jul 2013 12:09:46 +0000 (08:09 -0400)]
Fix incorrect rationalize tests.
* test-suite/tests/fractions.test (fractions): Fix rationalize tests.
Mark H Weaver [Sun, 21 Jul 2013 11:20:03 +0000 (07:20 -0400)]
Fix minor formatting error in 'rationalize'.
* libguile/numbers.c (scm_rationalize): Fix formatting.
Mark H Weaver [Sat, 20 Jul 2013 16:29:02 +0000 (12:29 -0400)]
Rewrite 'rationalize' to fix bugs and improve efficiency.
Fixes <http://bugs.gnu.org/14905>.
Reported by Göran Weinholt <goran@weinholt.se>.
* libguile/numbers.c (scm_rationalize): Rewrite. Previously an
incorrect algorithm was used which failed in many cases.
* test-suite/tests/numbers.test (rationalize): Add tests.