Andy Wingo [Mon, 21 Jan 2013 21:13:16 +0000 (22:13 +0100)]
Fix http-get* deprecation note
* module/web/client.scm (http-get*): Fix deprecation warning. Thanks to
Daniel Hartwig for the report.
Andy Wingo [Mon, 21 Jan 2013 21:10:28 +0000 (22:10 +0100)]
add dynl.x dep on libpath.h
* libguile/Makefile.am (dynl.x): Add dep on libpath.h. Thanks to Bogdan
Marinescu for the report.
Andy Wingo [Mon, 21 Jan 2013 18:07:19 +0000 (19:07 +0100)]
read-and-compile closes input file after seeing EOF
* module/system/base/compile.scm (read-and-compile): Close the input
port after we read all of its data. Perhaps this cleans up some NFS
ghosts that David Pirotte was seeing.
Andy Wingo [Sun, 20 Jan 2013 18:33:42 +0000 (19:33 +0100)]
fix try-module-autoload, which did not detect failure to find the file
* libguile/load.c (scm_primitive_load_path): If the second argument is a
procedure, call it like a thunk.
* doc/ref/api-evaluation.texi (Load Paths): Update docs.
* module/ice-9/boot-9.scm (resolve-interface): Use `unless'.
(try-module-autoload): Use the new primitive-load-path to detect
failure to find an appropriate file. Fixes a bug reported by Diogo
F. S. Ramos. Thanks to Noah Lavine for tracking it down.
Andy Wingo [Sun, 20 Jan 2013 12:28:31 +0000 (13:28 +0100)]
Fix attempt to get handle of weak table in (oop goops save)
* module/oop/goops/save.scm (readable?): Fix. Thanks to Andrew Gaylard
for the report.
Andy Wingo [Thu, 17 Jan 2013 11:38:56 +0000 (12:38 +0100)]
warn on multithreaded fork
* libguile/posix.c (scm_fork): Issue a warning on a multithreaded fork.
* doc/ref/posix.texi (Processes): Add note about multithreaded fork.
* test-suite/tests/00-socket.test: Moved here, from socket.test, so as
to run before any threads are created.
* test-suite/Makefile.am: Adapt.
Andy Wingo [Wed, 16 Jan 2013 12:20:54 +0000 (13:20 +0100)]
trace: limit length of "| | | "... prefix
* module/system/vm/trace.scm (build-prefix): New helper.
(print-application, print-return): Use the helper.
(trace-calls-to-procedure, trace-calls-in-procedure):
(trace-instructions-in-procedure, call-with-trace): Add #:max-indent
argument, defaulting to the terminal width less 40 characters.
* doc/ref/scheme-using.texi: Update `trace' docs.
Based on a patch by Nala Ginrut.
Andy Wingo [Wed, 16 Jan 2013 12:27:55 +0000 (13:27 +0100)]
peval-introduced gensyms infix " "
* module/language/tree-il/peval.scm (peval): Gensyms use whitespace as
an infix, not a dash. Helps gensym?-like procedures like those in the
unused lexical analysis.
Andy Wingo [Wed, 16 Jan 2013 09:03:44 +0000 (10:03 +0100)]
an end to the generated-documentation experiment
* doc/ref/statprof.texi:
* doc/ref/sxml.texi:
* doc/ref/texinfo.texi: New files, containing the documentation that was
previously generated from source and rendered into
standard-library.texi. The documentation is still horrible, but at
least now it is user-editable.
Greg Benison [Sat, 24 Dec 2011 19:27:12 +0000 (11:27 -0800)]
doc/ref/hierarchy.png: conform to hierarchy.txt and manual
hierarchy.png (and .pdf, .eps) were changed to add one node
to the graph, getting them in sync with hierarchy.txt
(and the GOOPS section of the manual).
Also added hierarchy.dot, a file to generate said figure
using graphviz.
Andy Wingo [Tue, 15 Jan 2013 14:08:20 +0000 (15:08 +0100)]
fix string->bytevector for utf-8 and non-error conversion strategies
* module/ice-9/iconv.scm (call-with-encoded-output-string):
(string->bytevector, bytevector->string): Only call string->utf8 and
utf8->string if the conversion strategy is `error'.
Andy Wingo [Mon, 14 Jan 2013 10:38:09 +0000 (11:38 +0100)]
case-lambda* clauses fail to match if too many positionals
* doc/ref/api-procedures.texi (Case-lambda): Expand case-lambda*
documentation.
* module/ice-9/eval.scm (primitive-eval):
* libguile/eval.c (prepare_boot_closure_env_for_apply): Dispatch to the
next case-lambda clause if there are too many positionals.
* doc/ref/vm.texi (Function Prologue Instructions):
* libguile/vm-i-system.c (bind-optionals/shuffle-or-br): New
instruction, like bind-optionals/shuffle but can dispatch to the next
clause if there are too many positionals.
* module/language/assembly/disassemble.scm (code-annotation):
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
* module/language/assembly/compile-bytecode.scm (compile-bytecode): Add
case for bind-optionals/shuffle-or-br.
* module/language/glil/compile-assembly.scm (glil->assembly): If there
is an alternate, use bind-optionals/shuffle-or-br instead of
bind-optionals/shuffle.
* test-suite/tests/optargs.test ("case-lambda*"): Add tests.
Andy Wingo [Fri, 11 Jan 2013 20:28:51 +0000 (21:28 +0100)]
Docstrings in (ice-9 iconv)
* module/ice-9/iconv.scm: Add docstrings.
Andy Wingo [Fri, 11 Jan 2013 20:15:28 +0000 (21:15 +0100)]
Change iconv procedures to take optional instead of keyword arg
* module/ice-9/iconv.scm (call-with-encoded-output-string):
(string->bytevector, bytevector->string): Take an optional instead of
a keyword argument.
* doc/ref/api-data.texi (Representing Strings as Bytes): Adapt docs to
change, and fix a number of errors. Thanks to Ludovic Courtès for the
pointers.
* test-suite/tests/iconv.test ("wide non-ascii string"): Add a test for
the 'substitute path.
Andy Wingo [Fri, 11 Jan 2013 10:15:28 +0000 (11:15 +0100)]
Add http-post, http-put, et cetera
* module/web/client.scm (ensure-uri): New helper.
(open-socket-for-uri): Accept a URI as a string or as a URI object.
(extend-request, sanitize-request): New helpers, like the
corresponding functions in (web server).
(decode-response-body): Add a reference to the HTTP/1.1 spec, and
use (ice-9 iconv).
(request): New helper, factoring all aspects of sending an HTTP
request and getting a response.
(http-get): Redefine in terms of http-get. Deprecate the
#:extra-headers argument in favor of #:headers. Allow a body. Add a
#:streaming? argument, subsuming the functionality of http-get*.
(http-get*): Deprecate.
(http-head, http-post, http-put, http-delete, http-trace)
(http-options): Define interfaces for all HTTP verbs.
* test-suite/tests/web-client.test: Add tests.
* doc/ref/web.texi: Update documentation.
Thanks to Gregory Benison for the initial patch.
Andy Wingo [Fri, 11 Jan 2013 10:30:29 +0000 (11:30 +0100)]
read-response-body always returns bytevector or #f
* module/web/response.scm (read-response-body): Fix to always return
either a bytevector or #f. Previously, reading a 0-length body could
return the EOF object.
Andy Wingo [Fri, 11 Jan 2013 10:10:43 +0000 (11:10 +0100)]
remove (web http) TODO list
* module/web/http.scm: Remove outdated TODO list.
Andy Wingo [Fri, 11 Jan 2013 10:10:24 +0000 (11:10 +0100)]
(web server) uses (ice-9 iconv)
* module/web/server.scm (sanitize-response): Use the procedures
from (ice-9 iconv) to encode the response.
Andy Wingo [Thu, 10 Jan 2013 21:50:27 +0000 (22:50 +0100)]
add bytevector->string and string->bytevector in new (ice-9 iconv) module
* module/Makefile.am:
* module/ice-9/iconv.scm: New module implementing procedures to encode
and decode representations of strings as bytes.
* test-suite/Makefile.am:
* test-suite/tests/iconv.test: Add tests.
* doc/ref/api-data.texi: Add docs.
Andy Wingo [Thu, 10 Jan 2013 16:30:38 +0000 (17:30 +0100)]
fix ice-9/slib
* module/ice-9/slib.scm: Change to just load up slib.init directly. The
recently submitted patch to slib-discuss and guile-user should make
this work correctly.
Andy Wingo [Thu, 10 Jan 2013 15:01:06 +0000 (16:01 +0100)]
deprecate SCM_CHAR_CODE_LIMIT and char-code-limit
* libguile/__scm.h:
* libguile/deprecated.h (SCM_CHAR_CODE_LIMIT): Move declaration here
from __scm.h.
* libguile/feature.c:
* module/ice-9/deprecated.scm (char-code-limit): Move definition here.
* test-suite/tests/regexp.test: Update to not use char-code-limit.
Andy Wingo [Tue, 8 Jan 2013 11:58:05 +0000 (12:58 +0100)]
slight open-pipe* / open-process refactor
* libguile/posix.c (scm_open_process): Return the ports as values
instead of calling out to Scheme again to make-rw-port. This
function is private to (ice-9 popen).
* module/ice-9/popen.scm (open-pipe*): Adapt to change.
Andy Wingo [Mon, 7 Jan 2013 22:21:16 +0000 (23:21 +0100)]
http-get: don't shutdown write end of socket
* module/web/http.scm ("Connection"): Write the "close" token in
lower-case.
* module/web/client.scm (http-get): Don't shutdown the writing side of
the pipe if we are not doing a keepalive, as this may prevent the
request from being sent at all. Prevented http://friendfeed.com/ from
being correctly fetched.
Andy Wingo [Mon, 7 Jan 2013 22:19:10 +0000 (23:19 +0100)]
Fix partial commit of documentation update
* doc/ref/api-procedures.texi (Compiled Procedures): Fix
partially-committed doc update.
Andy Wingo [Mon, 7 Jan 2013 21:02:26 +0000 (22:02 +0100)]
More procedure-arguments-alist documentation and a bugfix
* doc/ref/api-procedures.texi (Compiled Procedures): Expand
program-arguments-alist and program-lambda-list documentation.
* module/system/vm/program.scm (arity->arguments-alist): Fix the rest
arg if there are also keyword args, a bug found while documenting!
* test-suite/tests/session.test ("procedure-arguments"): Update.
Cedric Cellier [Wed, 11 Jan 2012 16:12:48 +0000 (17:12 +0100)]
document program-arguments-alist and program-lambda-list
Andy Wingo [Mon, 7 Jan 2013 19:36:41 +0000 (20:36 +0100)]
minor cleanup in values.c
* libguile/values.c (scm_c_value_ref): Use scm_from_size_t to assimilate
a size_t.
Ludovic Courtès [Wed, 19 Dec 2012 22:31:05 +0000 (23:31 +0100)]
tests: Remove leftover `pk'.
* test-suite/tests/posix.test ("system*"): Remove `pk'.
Ludovic Courtès [Wed, 19 Dec 2012 22:15:45 +0000 (23:15 +0100)]
Change `system*' to not leave dangling processes behind.
Fixes <http://bugs.gnu.org/13166>.
* libguile/simpos.c (scm_system_star): In the child, call `_exit'
instead of `SCM_SYSERROR' when `execvp' fails.
* test-suite/tests/posix.test ("system*"): New test prefix.
Ludovic Courtès [Sun, 16 Dec 2012 23:27:00 +0000 (00:27 +0100)]
web: Correctly detect "No route to host" conditions.
* module/web/client.scm (open-socket-for-uri): Delete addrinfos
with the same address. Always open SOCK_STREAM/IPPROTO_IP sockets.
Fix the error handler's condition to determine what to do.
Reported by Nikita Karetnikov <nikita.karetnikov@gmail.com> at
<http://lists.gnu.org/archive/html/bug-guix/2012-12/msg00150.html>.
Ludovic Courtès [Mon, 10 Dec 2012 22:38:48 +0000 (23:38 +0100)]
build: Require Automake 1.11.2 or later.
* configure.ac: Require Automake 1.11.2 or later.
Reported by Sjoerd van Leent Privé <svanleent@gmail.com>
in <http://bugs.gnu.org/13117>.
Daniel Hartwig [Tue, 4 Dec 2012 03:41:35 +0000 (11:41 +0800)]
repl: add repl-option for customized print
Closes <http://bugs.gnu.org/13077>.
* module/system/repl/common.scm (repl-default-options)
(repl-print): Add option to use customized print procedure.
* doc/ref/scheme-using.texi (REPL Commands): Update.
Ludovic Courtès [Mon, 10 Dec 2012 22:16:13 +0000 (23:16 +0100)]
test-suite: Skip `EACCES' test of `file-system-fold' when run as root.
* test-suite/tests/ftw.test ("file-system-fold")["EACCES"]: Use
`pass-if-equal'. Throw `unresolved' when run as root.
Reported by Andreas Enge <andreas@enge.fr> at
<http://lists.gnu.org/archive/html/bug-guix/2012-12/msg00073.html>.
Ludovic Courtès [Mon, 10 Dec 2012 22:14:10 +0000 (23:14 +0100)]
Verify the value of `SHUT_RD' and related constants.
* libguile/socket.c: Add `verify' clauses for the values of `SHUT_RD',
`SHUT_WR', and `SHUT_RDWR'.
Ludovic Courtès [Mon, 10 Dec 2012 22:12:07 +0000 (23:12 +0100)]
doc: Update `release.org'.
* doc/release.org (Use porter boxes): Mention Snakebite.
Mark H Weaver [Fri, 7 Dec 2012 17:03:49 +0000 (12:03 -0500)]
Thanks Jozef Chraplewski.
* THANKS: Jozef Chraplewski.
Mark H Weaver [Fri, 7 Dec 2012 16:53:00 +0000 (11:53 -0500)]
Avoid signed integer overflow in scm_product
* libguile/numbers.c (scm_product): Avoid signed integer overflow, which
modern C compilers are allowed to assume will never happen, thus
allowing them to optimize out our overflow checks.
* test-suite/tests/numbers.test (*): Add tests.
Daniel Hartwig [Fri, 30 Nov 2012 01:40:36 +0000 (09:40 +0800)]
doc: remove more references to hash-tables-as-vectors
* doc/ref/api-compound.texi (Hash Tables): Update.
Ludovic Courtès [Fri, 30 Nov 2012 20:22:45 +0000 (21:22 +0100)]
doc: Update `release.org'.
* doc/release.org: Fix typos, and update.
Ludovic Courtès [Thu, 29 Nov 2012 23:48:53 +0000 (00:48 +0100)]
NEWS: Add "R6RS SRFI support" text.
* NEWS: Add proper text for "R6RS SRFI support", by Ian Price and
Mark Weaver.
Ludovic Courtès [Thu, 29 Nov 2012 23:06:26 +0000 (00:06 +0100)]
Bump version number for 2.0.7.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
(LIBGUILE_INTERFACE_CURRENT): Increment, to account for new C
function `scm_make_vtable_vtable'.
(LIBGUILE_INTERFACE_AGE): Increment.
Mark H Weaver [Thu, 29 Nov 2012 22:57:49 +0000 (17:57 -0500)]
NEWS: Add entry for new GUILE_LOAD_PATH (et al) ellipsis handling.
* NEWS: Add entry for new GUILE_LOAD_PATH (et al) ellipsis handling.
Mark H Weaver [Thu, 29 Nov 2012 22:50:56 +0000 (17:50 -0500)]
NEWS: Mention par-for-each, alongside par-map, being fixed to use all cores
* NEWS: Mention par-for-each, alongside par-map, being fixed to use all
cores.
Mark H Weaver [Thu, 29 Nov 2012 22:25:21 +0000 (17:25 -0500)]
Minor fixes in NEWS
* NEWS: Minor fixes to the descriptions.
Ludovic Courtès [Thu, 29 Nov 2012 21:38:23 +0000 (22:38 +0100)]
Update `NEWS'.
* NEWS: Add news for 2.0.7.
Ludovic Courtès [Thu, 29 Nov 2012 20:52:43 +0000 (21:52 +0100)]
futures: Remove circular dependency with (ice-9 threads).
* module/ice-9/futures.scm: Remove now-useless import of (ice-9 threads)
introduced in commit
be05b336.
Ludovic Courtès [Thu, 29 Nov 2012 20:49:49 +0000 (21:49 +0100)]
doc: Document nested futures.
* doc/ref/api-scheduling.texi (Futures): Mention nested futures.
Explain what happens upon `touch'.
Ludovic Courtès [Thu, 29 Nov 2012 20:13:00 +0000 (21:13 +0100)]
doc: Remove example use of vectors as hash tables.
Fixes <http://bugs.gnu.org/13022>.
Reported by Daniel Hartwig <mandyke@gmail.com>.
* doc/ref/api-compound.texi (Hash Table Examples): Remove example use of
vectors as hash tables.
Mark H Weaver [Wed, 28 Nov 2012 23:01:35 +0000 (18:01 -0500)]
Add parse-path-with-ellipsis, and use it for GUILE_LOAD_PATH et al.
* libguile/load.c (scm_ellipsis): New Variable.
(scm_parse_path_with_ellipsis): New procedure.
(scm_init_load): Initialize 'scm_ellipsis'.
(scm_init_load_path): Use 'scm_parse_path_with_ellipsis' to
handle GUILE_LOAD_PATH and GUILE_LOAD_COMPILED_PATH.
* libguile/load.h (scm_parse_path_with_ellipsis): Add prototype.
* doc/ref/guile-invoke.texi (Environment Variables):
doc/ref/api-evaluation.texi (Load Paths): Add documentation.
Correct description of default load path to reflect reality.
Remove 'GUILE_LOAD_PATH' from the concept index; it is already
in the variable index. Add cross references between these two
sections of the manual.
Ludovic Courtès [Wed, 28 Nov 2012 21:55:08 +0000 (22:55 +0100)]
Remove definition of the `SHARED_LIBRARY_PATH_VARIABLE' C macro.
This is a follow-up to
fc32c44.
* configure.ac: Remove definition of `SHARED_LIBRARY_PATH_VARIABLE',
which was added in
e66ff09a.
Ludovic Courtès [Wed, 28 Nov 2012 21:50:26 +0000 (22:50 +0100)]
web: Add `http-get*'.
* module/web/client.scm (http-get*): New procedure.
* doc/ref/web.texi (Web Client): Document it.
Ludovic Courtès [Wed, 28 Nov 2012 21:26:44 +0000 (22:26 +0100)]
web: Add `response-body-port'.
* module/web/response.scm (make-delimited-input-port,
response-body-port): New procedures.
(read-response-body): Use `response-body-port'.
* test-suite/tests/web-response.test ("example-1")["response-body-port"]:
New test.
("example-2")["response-body-port"]: New test.
Ludovic Courtès [Wed, 28 Nov 2012 21:12:59 +0000 (22:12 +0100)]
web: Export `text-content-type?'.
* module/web/client.scm (text-type?): Remove.
(decode-response-body): Use `text-content-type?'.
* module/web/response.scm (text-content-type?): New procedure.
* doc/ref/web.texi (Responses): Document it.
Ludovic Courtès [Wed, 28 Nov 2012 20:25:07 +0000 (21:25 +0100)]
tests: Use `pass-if-equal' in `web-response.test'.
* test-suite/tests/web-response.test: Cleanup whitespace. Use
`pass-if-equal' when appropriate.
Ludovic Courtès [Wed, 28 Nov 2012 15:42:49 +0000 (16:42 +0100)]
eval: Store docstrings for lambdas.
Fixes <http://bugs.gnu.org/12173>.
Reported by Ian Price <ianprice90@googlemail.com>.
* libguile/memoize.c (MAKMEMO_LAMBDA): New `docstring' parameter. Add
it as the second argument of `SCM_M_LAMBDA'. Update caller.
(memoize)[SCM_M_LAMBDA]: Extract docstring from EXP; when `memoize'
returns, add the docstring to the lambda's arguments.
(unmemoize)[SCM_M_LAMBDA]: Adjust to new argument layout of
`SCM_M_LAMBDA'.
* libguile/eval.c (BOOT_CLOSURE_NUM_REQUIRED_ARGS,
BOOT_CLOSURE_HAS_REST_ARGS, BOOT_CLOSURE_IS_REST,
BOOT_CLOSURE_PARSE_FULL): Adjust to new argument layout of
`SCM_M_LAMBDA'.
* module/ice-9/eval.scm (primitive-eval)[make-general-closure]:
Likewise.
[eval]: When EXP is a lambda, match its docstring; when the docstring
is not #f, add it to the closures procedure properties.
* test-suite/tests/eval.test ("docstrings"): New test prefix.
* libguile/procs.c (sym_documentation): Rename to...
(scm_sym_documentation): ... this. Make it global.
* libguile/procs.h (scm_sym_documentation): New declaration.
Mark H Weaver [Tue, 27 Nov 2012 22:44:38 +0000 (17:44 -0500)]
Fix library search order and don't change LD_LIBRARY_PATH
* libguile/dynl.c (system_extensions_path): New static variable.
(sysdep_dynl_link): If 'lt_dlopenext' fails, manually search
in 'system_extensions_path'.
(augment_env): Remove.
(sysdep_dynl_init): Don't change LD_LIBRARY_PATH, and don't use
lt_dladdsearchdir if GUILE_SYSTEM_EXTENSIONS_PATH is set. Instead,
initialize 'system_extensions_path' from GUILE_SYSTEM_EXTENSIONS_PATH
(or if it's unset: <SCM_LIB_DIR>:<SCM_EXTENSIONS_DIR>), and rely on
sysdep_dynl_link to search those directories manually.
Ludovic Courtès [Tue, 27 Nov 2012 22:02:15 +0000 (23:02 +0100)]
vlist: Remove Texinfo markup from docstrings.
* module/ice-9/vlist.scm: Remove Texinfo markup from docstrings with
sed -e"s/@var{\([a-z0-9?!-]\+\)}/\U\1/g ; s/@code{\([^}]\+\)}/‘\1’/g".
Daniel Hartwig [Tue, 27 Nov 2012 08:48:41 +0000 (16:48 +0800)]
web client: correctly handle uri-query, etc. in relative URI headers
* module/web/uri.scm (uri-pat): Make scheme part optional.
(string->uri*): New private procedure to also parse relative URIs.
* module/web/http.scm (declare-relative-uri-header!): Use that.
Ludovic Courtès [Mon, 26 Nov 2012 23:10:09 +0000 (00:10 +0100)]
web client: Support relative URIs in some headers.
Fixes <http://bugs.gnu.org/12827>.
* module/web/http.scm (declare-relative-uri-header!): New procedure.
("Content-Location", "Referer"): Use it.
Based on discussions with Daniel Hartwig <mandyke@gmail.com>.
Ludovic Courtès [Mon, 26 Nov 2012 22:51:20 +0000 (23:51 +0100)]
Have `load-in-vicinity' look for `.go' files in %LOAD-COMPILED-PATH.
Fixes <http://bugs.gnu.org/12519>.
* module/ice-9/boot-9.scm (load-in-vicinity)[fresh-compiled-file-name]:
New `scmstat' parameter; use it.
[sans-extension]: New procedure.
[load-absolute]: Call (stat ABS-PATH) from here. Search a `.go' file
from %LOAD-COMPILED-PATH before searching %COMPILE-FALLBACK-PATH.
Ludovic Courtès [Mon, 26 Nov 2012 21:41:23 +0000 (22:41 +0100)]
Split `load-in-vicinity' into small procedures.
* module/ice-9/boot-9.scm (load-in-vicinity)[compiled-extension]: New
variable.
[compiled-file-name]: Rename to...
[fallback-file-name]: ... this; update caller. Use COMPILED-EXTENSION.
[more-recent?, compile, warn-about-exception]: New procedures.
[fresh-compiled-file-name]: Use them.
Ian Price [Mon, 26 Nov 2012 21:04:03 +0000 (21:04 +0000)]
Update thanks
* THANKS: Add Sjoerd Van Leent
Ian Price [Mon, 26 Nov 2012 01:24:51 +0000 (01:24 +0000)]
Fix docs for `hashtable-copy'
* doc/ref/r6rs.texi (rnrs hashtables): a true mutable argument means a
mutable copy.
Ian Price [Sun, 25 Nov 2012 12:28:41 +0000 (12:28 +0000)]
R6RS srfi library names should ignore first identifier after the :n
* module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface):
(srfi :n name ids ...) -> (srfi srfi-n ids ...)
* test-suite/tests/rnrs-libraries.test ("srfi"): Add test.
Daniel Hartwig [Sat, 24 Nov 2012 14:53:34 +0000 (15:53 +0100)]
(web uri): document that uri-port is an integer
* doc/ref/web.texi (URIs):
* module/web/uri.scm (build-uri): Document that uri-port is an integer.
Daniel Hartwig [Sat, 24 Nov 2012 06:10:12 +0000 (14:10 +0800)]
syncronize web module docstrings with manual
* doc/ref/web.texi: Fix spacing. Update with a few missing function
descriptions.
* module/web/client.scm:
* module/web/http.scm:
* module/web/request.scm:
* module/web/server.scm:
* module/web/uri.scm: Update docstrings from manual (reworked by Ludovic
Courtès).
Ludovic Courtès [Fri, 23 Nov 2012 23:22:20 +0000 (00:22 +0100)]
Augment `.dir-locals.el'.
* .dir-locals.el: Add more `scheme-indent-function' rules.
Ludovic Courtès [Fri, 23 Nov 2012 23:16:14 +0000 (00:16 +0100)]
Turn on the `case' warnings in auto-compilation.
* module/ice-9/boot-9.scm (%auto-compilation-options): Add
`duplicate-case-datum' and `bad-case-datum'.
Ludovic Courtès [Fri, 23 Nov 2012 22:56:01 +0000 (23:56 +0100)]
Add tests for `-Wduplicate-case-datum' and `-Wbad-case-datum'.
* test-suite/tests/tree-il.test (%opts-w-duplicate-case-datum,
%opts-w-bad-case-datum): New variables.
("warnings")["duplicate-case-datum", "bad-case-datum"]: New tests.
Ludovic Courtès [Fri, 23 Nov 2012 22:41:32 +0000 (23:41 +0100)]
doc: Mention the `duplicate-case-datum' and `bad-case-datum' warnings.
* doc/ref/api-evaluation.texi (Compilation): List the
`duplicate-case-datum' and `bad-case-datum' warnings.
Ludovic Courtès [Fri, 23 Nov 2012 22:37:29 +0000 (23:37 +0100)]
Remove reference to `scm_init_popen' when `fork' is unavailable.
Fixes <http://bugs.gnu.org/12477>.
Reported by lin ray <lin.wei.ray@gmail.com>.
* configure.ac: Define the `HAVE_FORK' Automake conditional.
* module/Makefile.am (ICE_9_SOURCES): Add `ice-9/popen.scm' only when
HAVE_FORK.
* libguile/posix.c (scm_init_posix): Register `scm_init_popen' only when
HAVE_FORK.
Ian Price [Thu, 22 Nov 2012 09:45:12 +0000 (09:45 +0000)]
R6RS `string-for-each' should accept multiple string arguments
* module/rnrs/base.scm (string-for-each): Rewrite.
* test-suite/tests/r6rs-base.test ("string-for-each"): Add tests.
Ludovic Courtès [Wed, 21 Nov 2012 22:51:16 +0000 (23:51 +0100)]
cse: Fix out-of-bounds access to the database.
Fixes <http://bugs.gnu.org/12883>.
* module/language/tree-il/cse.scm (cse)[find-dominating-lexical]: Fix
computation of the last argument passed to `unroll'.
Patch by Stefan Israelsson Tampe <stefan.itampe@gmail.com>.
* test-suite/tests/cse.test ("cse")["http://bugs.gnu.org/12883"]: New
test.
Ludovic Courtès [Fri, 16 Nov 2012 23:11:23 +0000 (00:11 +0100)]
Update `par-map' to use nested futures.
This allows it to actually use all CPU cores, instead of having the main
thread stuck on a `wait-condition-variable'.
* module/ice-9/threads.scm (par-mapper): Add a `cons' argument; update
callers accordingly. Rewrite using nested futures.
Ludovic Courtès [Fri, 16 Nov 2012 23:20:21 +0000 (00:20 +0100)]
futures: Allow nested futures; put the main thread to work.
* module/ice-9/futures.scm (%futures-waiting, %within-future?,
%future-prompt): New variables.
(let/ec): New macro.
(process-future!): Run FUTURE's thunk in a prompt; capture FUTURE's
continuation when it aborts, and add it to %FUTURES-WAITING. Set
%WITHIN-FUTURE? in the dynamic extent of the call FUTURE's thunk.
(process-futures): Move loop body to...
(process-one-future): ... here. New procedure.
(notify-completion): New procedure.
(touch)[work, loop]: New procedures.
When %WITHIN-FUTURE? and FUTURE is started, abort; if not
%WITHIN-FUTURE, call `work' while waiting.
When FUTURE is queued, call `work' too.
* test-suite/tests/future.test ("nested futures"): New tests.
Ludovic Courtès [Fri, 16 Nov 2012 22:51:59 +0000 (23:51 +0100)]
futures: Add a record printer.
* module/ice-9/futures.scm: Add a record printer for <future>.
Ludovic Courtès [Wed, 7 Nov 2012 14:16:03 +0000 (15:16 +0100)]
futures: Keep futures unlocked while they are processing.
* module/ice-9/futures.scm (<future>)[completion]: New field.
[done?]: Rename to...
[state]: ... this. Change `set-future-done?!' to
`set-future-state!', and `future-done?' to `future-state'.
(make-future): Initialize the `completion' field to 'queued.
(with-mutex): New macro.
(process-future!): Remove `set-future-done?!' call.
(process-futures): Check `future-state'. Unlock FUTURE's mutex before
processing it. Broadcast FUTURE's `completion' cond. var. when done.
(touch): Likewise.
Ludovic Courtès [Sat, 17 Nov 2012 15:20:52 +0000 (16:20 +0100)]
Update Gnulib to
v0.0-7695-g26c0590.
* gnulib-local/m4/canonicalize.m4.diff: Remove.
* Makefile.am (EXTRA_DIST): Adjust accordingly.
Ludovic Courtès [Sat, 17 Nov 2012 15:07:00 +0000 (16:07 +0100)]
doc: Strengthen the case for pattern matching.
* doc/ref/api-compound.texi (Pairs): Warn against `cadr' & co., and add
a link to "Pattern Matching".
* doc/ref/match.texi (Pattern Matching): Add example with nested lists.
Add paragraph comparing `match' expressions and hand-written code.
Ludovic Courtès [Sat, 17 Nov 2012 14:34:49 +0000 (15:34 +0100)]
doc: Fix typo in `set-record-type-printer!' doc.
* module/srfi/srfi-9/gnu.scm (set-record-type-printer!): Change the
parameter name to `proc'.
* doc/ref/api-compound.texi (SRFI-9 Records): Update accordingly.
Andreas Rottmann [Mon, 12 Nov 2012 19:47:57 +0000 (20:47 +0100)]
Add missing R6RS `open-file-input/output-port' procedure
* module/rnrs/io/port.scm (r6rs-open): New internal helper procedure for
opening files.
(open-file-input-port, open-file-output-port): Make use of
`r6rs-open'.
(open-file-input/output-port): Implement in terms of `r6rs-open',
add to exported identifiers list.
* module/rnrs.scm (open-file-input/output-port): Add to exported
identifiers.
* test-suite/tests/r6rs-ports.test (test-input-file-opener): New
procedure, collects several tests for opening file input ports.
("7.2.7 Input Ports"): Use `test-input-file-opener' for checking
`open-file-input-port'.
(test-output-file-opener): New procedure, collects several tests for
opening file output ports.
("8.2.10 Output ports"): Use `test-output-file-opener' for checking
`open-file-output-port'.
("8.2.13 Input/output ports"): New test prefix, making use of both
`test-input-file-opener' and `test-output-file-opener' to check
`open-file-input/output-port'.
Ludovic Courtès [Sun, 11 Nov 2012 14:31:51 +0000 (15:31 +0100)]
doc: Update argument order of SRFI-9 `set-field'.
* doc/ref/api-compound.texi (SRFI-9 Records): Change argument order for
`set-field'.
Mark H Weaver [Sun, 11 Nov 2012 00:14:08 +0000 (19:14 -0500)]
srfi-9.test: avoid symbols of the form ':bar' for more robust checking.
* test-suite/tests/srfi-9.test ("incompatible field paths"): Rename
':bar' to 'bar' to avoid the possibility of the symbol name being
printed with #{...}# notation.
Ludovic Courtès [Sat, 10 Nov 2012 16:27:14 +0000 (17:27 +0100)]
doc: Document SRFI-9 functional setters.
* doc/ref/api-compound.texi (Functional ``Setters''): New section.
Ludovic Courtès [Sat, 10 Nov 2012 15:02:35 +0000 (16:02 +0100)]
doc: Move SRFI-9 records under "Compound Data Types".
Suggested by Mark Weaver.
* doc/ref/srfi-modules.texi (SRFI-9): Keep the node, but move contents
to...
* doc/ref/api-compound.texi (SRFI-9 Records): ...here.
(Record Overview): New section.
Mark H Weaver [Sat, 10 Nov 2012 21:05:24 +0000 (16:05 -0500)]
Change the argument order of 'set-fields' to match that of 'set-fields'.
* module/srfi/srfi-9/gnu.scm (set-fields): Swap order of first two
arguments.
* test-suite/tests/srfi-9.test: Update tests.
Mark H Weaver [Sat, 10 Nov 2012 19:35:49 +0000 (14:35 -0500)]
Add system/base/ck.scm to SYSTEM_BASE_SOURCES in module/Makefile.am.
* module/Makefile.am (SYSTEM_BASE_SOURCES): Add system/base/ck.scm.
Mark H Weaver [Wed, 7 Nov 2012 13:39:42 +0000 (08:39 -0500)]
Futures: Avoid creating the worker pool more than once.
* module/ice-9/futures.scm (%create-workers!): Use 'with-mutex' in case
an exception is thrown. Within the critical section, check to make
sure the worker pool hasn't already been created by another thread.
Mark H Weaver [Fri, 9 Nov 2012 10:04:13 +0000 (05:04 -0500)]
Improve error for set-fields paths leading to different types.
* module/system/base/ck.scm: New module.
* module/srfi/srfi-9.scm: Import (system base ck).
(getter-type, getter-index, getter-copier): Convert incoming argument
convention to CK form.
(define-tagged-inlinable): Convert return value convention for key
lookup to CK form.
* module/srfi/srfi-9/gnu.scm: Import (system base ck).
Rename '%set-fields-unknown-getter' to 'unknown-getter'.
(c-list, c-same-type-check): New macros.
(%set-fields): Using the CK abstract machine, arrange to check (at
macro expansion time) that all of the getters in head position
correspond to the same record type.
* test-suite/tests/srfi-9.test: Add test.
Mark H Weaver [Fri, 9 Nov 2012 08:22:40 +0000 (03:22 -0500)]
Improve error messages for invalid record definitions.
* module/srfi/srfi-9.scm (%define-record-type): Accept additional 'form'
parameter which contains the original form of 'define-record-type' or
'define-immutable-record-type'. Add elaborate pattern guard which
raises descriptive syntax errors for specific errors, and a fallback
pattern to catch anything else.
(define-record-type): Pass 'form' parameter to %define-record-type.
* module/srfi/srfi-9/gnu.scm (define-immutable-record-type): Pass 'form'
parameter to %define-record-type.
* test-suite/tests/srfi-9.test: Add tests.
Mark H Weaver [Sat, 10 Nov 2012 04:02:44 +0000 (23:02 -0500)]
Fix non-toplevel srfi-9 compile-time error tests to actually be non-toplevel.
* test-suite/tests/srfi-9.test: Move non-toplevel record definitions to be
within the expression passed to 'compile'.
Mark H Weaver [Sat, 10 Nov 2012 03:23:46 +0000 (22:23 -0500)]
Use 'pass-if-equal' to check syntax-error exceptions in srfi-9.test.
* test-suite/tests/srfi-9.test: Convert detailed syntax-error exception
tests to use 'pass-if-equal'.
Mark H Weaver [Fri, 9 Nov 2012 02:53:36 +0000 (21:53 -0500)]
Fix record constructor in getopt-long.
* module/ice-9/getopt-long.scm (%make-option-spec): Fix the formal
argument list to match the actual fields present.
(make-option-spec): Update to match the fixed %make-option-spec.
Mark H Weaver [Wed, 7 Nov 2012 17:21:44 +0000 (12:21 -0500)]
Implement functional record setters.
Written in collaboration with Ludovic Courtès <ludo@gnu.org>
* module/srfi/srfi-9.scm: Internally, rename 'accessor' to 'getter'
and 'modifier' to 'setter'.
(define-tagged-inlinable, getter-type, getter-index, getter-copier,
%%on-error, %%set-fields): New macros.
(%define-record-type): New macro for creating both mutable and
immutable records, and containing a substantially rewritten version of
the code formerly in 'define-record-type'.
(define-record-type): Now just a wrapper for '%define-record-type'.
(throw-bad-struct, make-copier-id): New procedures.
* module/srfi/srfi-9/gnu.scm (define-immutable-record-type, set-field,
and set-fields): New exported macros.
(collate-set-field-specs): New procedure.
(%set-fields-unknown-getter, %set-fields): New macros.
* test-suite/tests/srfi-9.test: Add tests. Rename getters and setters
in existing tests to make the functional setters look better.
Ludovic Courtès [Mon, 5 Nov 2012 20:43:13 +0000 (21:43 +0100)]
Fix invalid assertion about mutex ownership in threads.c.
* libguile/threads.c (do_thread_exit): Don't assert m->owner == t->handle
since that is not the case when MUTEX was abandoned by T. Reported by Mark
Weaver and others.
Ludovic Courtès [Mon, 5 Nov 2012 18:04:13 +0000 (19:04 +0100)]
Have `SCM_NUM2FLOAT' and `SCM_NUM2DOUBLE' use `scm_to_double'.
* libguile/validate.h (SCM_NUM2FLOAT, SCM_NUM2DOUBLE): Use
`scm_to_double' instead of the deprecated functions. Reported by
Aleix Conchillo Flaqué <aconchillo@gmail.com>.
Ludovic Courtès [Mon, 5 Nov 2012 17:59:14 +0000 (18:59 +0100)]
Fix copyright years in `futures.scm'.
* module/ice-9/futures.scm: Update copyright years.
Mark H Weaver [Sun, 4 Nov 2012 05:01:06 +0000 (01:01 -0400)]
Preserve additional R6RS library name components after srfi :n
* module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface):
(srfi :n ...) -> (srfi srfi-n ...) instead of (srfi srfi-n).
Ludovic Courtès [Sat, 3 Nov 2012 00:05:19 +0000 (01:05 +0100)]
futures: Have workers work when futures are available.
Reported by David Pirotte.
* module/ice-9/futures.scm (process-futures): Wait on %FUTURES-AVAILABLE
only when %FUTURES is empty.
The problem was obvious when running (begin (use-modules (ice-9
threads)) (par-map 1+ (iota 400000))) : eventually, only the main
thread would do the work, while the others would remain idle, waiting
on %FUTURES-AVAILABLE.
Ludovic Courtès [Fri, 2 Nov 2012 23:20:23 +0000 (00:20 +0100)]
Fix `generalized-vector->list' indexing bug with shared arrays.
Fixes <http://bugs.gnu.org/12465>.
Reported by Daniel Llorens <daniel.llorens@bluewin.ch>.
* libguile/generalized-vectors.c (scm_generalized_vector_to_list): Fix
initial value of POS; pass the `h.base + pos', not just `pos' as the
`vref' argument.
* test-suite/tests/arrays.test ("array->list")["http://bugs.gnu.org/12465
- ok", "http://bugs.gnu.org/12465 - bad]: New tests.
("generalized-vector->list"): New test prefix.