bpt/guile.git
11 years agofix bug where scm_from_utf8_stringn would not detect bad utf-8
Andy Wingo [Tue, 15 Jan 2013 10:01:10 +0000 (11:01 +0100)]
fix bug where scm_from_utf8_stringn would not detect bad utf-8

* libguile/strings.c (scm_from_utf8_stringn):
* libguile/symbols.c (utf8_string_equals_wide_string): The "bad UTF8"
  return from u8_mbtouc is a 0xfffd character, not a negative byte
  length.  Fixes a bug in which invalid UTF-8 would not be caught.

* libguile/bytevectors.c (scm_utf8_to_string): Use scm_from_utf8_stringn
  directly.  Just a little cleanup.

* test-suite/tests/iconv.test ("narrow non-ascii string"): Add test for
  parsing bad utf-8 with substitution.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Tue, 15 Jan 2013 09:45:39 +0000 (10:45 +0100)]
Merge remote-tracking branch 'origin/stable-2.0'

There is a failing test due to a scm_from_utf8_stringn bug brought out
by the iconv test that will be fixed in the next commit.

Conflicts:
libguile/deprecated.h
module/ice-9/deprecated.scm

11 years agoDocstrings in (ice-9 iconv)
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.

11 years agoChange iconv procedures to take optional instead of keyword arg
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.

11 years agoAdd http-post, http-put, et cetera
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.

11 years agoread-response-body always returns bytevector or #f
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.

11 years agoremove (web http) TODO list
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.

11 years ago(web server) uses (ice-9 iconv)
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.

11 years agoadd bytevector->string and string->bytevector in new (ice-9 iconv) module
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.

11 years agofix ice-9/slib
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.

11 years agodeprecate SCM_CHAR_CODE_LIMIT and char-code-limit
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.

11 years agoslight open-pipe* / open-process refactor
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.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Mon, 7 Jan 2013 22:23:26 +0000 (17:23 -0500)]
Merge remote-tracking branch 'origin/stable-2.0'

Conflicts:
GUILE-VERSION
libguile/posix.c
module/ice-9/eval.scm
test-suite/tests/cse.test

11 years agohttp-get: don't shutdown write end of socket
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.

11 years agoFix partial commit of documentation update
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.

11 years agoMore procedure-arguments-alist documentation and a bugfix
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.

11 years agodocument program-arguments-alist and program-lambda-list
Cedric Cellier [Wed, 11 Jan 2012 16:12:48 +0000 (17:12 +0100)]
document program-arguments-alist and program-lambda-list

11 years agominor cleanup in values.c
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.

11 years agotests: Remove leftover `pk'.
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'.

11 years agoChange `system*' to not leave dangling processes behind.
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.

11 years agoweb: Correctly detect "No route to host" conditions.
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>.

11 years agobuild: Require Automake 1.11.2 or later.
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>.

11 years agorepl: add repl-option for customized print
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.

11 years agotest-suite: Skip `EACCES' test of `file-system-fold' when run as root.
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>.

11 years agoVerify the value of `SHUT_RD' and related constants.
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'.

11 years agodoc: Update `release.org'.
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.

11 years agoThanks Jozef Chraplewski.
Mark H Weaver [Fri, 7 Dec 2012 17:03:49 +0000 (12:03 -0500)]
Thanks Jozef Chraplewski.

* THANKS: Jozef Chraplewski.

11 years agoAvoid signed integer overflow in scm_product
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.

11 years agodoc: remove more references to hash-tables-as-vectors
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.

11 years agodoc: Update `release.org'.
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.

11 years agoNEWS: Add "R6RS SRFI support" text.
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.

11 years agoBump version number for 2.0.7.
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.

11 years agoNEWS: Add entry for new GUILE_LOAD_PATH (et al) ellipsis handling.
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.

11 years agoNEWS: Mention par-for-each, alongside par-map, being fixed to use all cores
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.

11 years agoMinor fixes in NEWS
Mark H Weaver [Thu, 29 Nov 2012 22:25:21 +0000 (17:25 -0500)]
Minor fixes in NEWS

* NEWS: Minor fixes to the descriptions.

11 years agoUpdate `NEWS'.
Ludovic Courtès [Thu, 29 Nov 2012 21:38:23 +0000 (22:38 +0100)]
Update `NEWS'.

* NEWS: Add news for 2.0.7.

11 years agofutures: Remove circular dependency with (ice-9 threads).
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.

11 years agodoc: Document nested futures.
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'.

11 years agodoc: Remove example use of vectors as hash tables.
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.

11 years agoAdd parse-path-with-ellipsis, and use it for GUILE_LOAD_PATH et al.
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.

11 years agoRemove definition of the `SHARED_LIBRARY_PATH_VARIABLE' C macro.
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.

11 years agoweb: Add `http-get*'.
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.

11 years agoweb: Add `response-body-port'.
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.

11 years agoweb: Export `text-content-type?'.
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.

11 years agotests: Use `pass-if-equal' in `web-response.test'.
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.

11 years agoeval: Store docstrings for lambdas.
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.

11 years agoFix library search order and don't change LD_LIBRARY_PATH
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.

11 years agovlist: Remove Texinfo markup from docstrings.
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".

11 years agoweb client: correctly handle uri-query, etc. in relative URI headers
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.

11 years agoweb client: Support relative URIs in some headers.
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>.

11 years agoHave `load-in-vicinity' look for `.go' files in %LOAD-COMPILED-PATH.
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.

11 years agoSplit `load-in-vicinity' into small procedures.
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.

11 years agoUpdate thanks
Ian Price [Mon, 26 Nov 2012 21:04:03 +0000 (21:04 +0000)]
Update thanks

* THANKS: Add Sjoerd Van Leent

11 years agoFix docs for `hashtable-copy'
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.

11 years agoR6RS srfi library names should ignore first identifier after the :n
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.

11 years ago(web uri): document that uri-port is an integer
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.

11 years agosyncronize web module docstrings with manual
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).

11 years agoAugment `.dir-locals.el'.
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.

11 years agoTurn on the `case' warnings in auto-compilation.
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'.

11 years agoAdd tests for `-Wduplicate-case-datum' and `-Wbad-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.

11 years agodoc: Mention the `duplicate-case-datum' and `bad-case-datum' warnings.
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.

11 years agoRemove reference to `scm_init_popen' when `fork' is unavailable.
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.

11 years agoR6RS `string-for-each' should accept multiple string arguments
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.

11 years agocse: Fix out-of-bounds access to the database.
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.

11 years agoUpdate `par-map' to use nested futures.
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.

11 years agofutures: Allow nested futures; put the main thread to work.
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.

11 years agofutures: Add a record printer.
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>.

11 years agofutures: Keep futures unlocked while they are processing.
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.

11 years agoUpdate Gnulib to v0.0-7695-g26c0590.
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.

11 years agodoc: Strengthen the case for pattern matching.
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.

11 years agodoc: Fix typo in `set-record-type-printer!' doc.
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.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Thu, 15 Nov 2012 10:31:18 +0000 (05:31 -0500)]
Merge remote-tracking branch 'origin/stable-2.0'

11 years agoAdd missing R6RS `open-file-input/output-port' procedure
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'.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Mon, 12 Nov 2012 09:42:09 +0000 (04:42 -0500)]
Merge remote-tracking branch 'origin/stable-2.0'

11 years agodoc: Update argument order of SRFI-9 `set-field'.
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'.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Sun, 11 Nov 2012 00:17:30 +0000 (19:17 -0500)]
Merge remote-tracking branch 'origin/stable-2.0'

11 years agosrfi-9.test: avoid symbols of the form ':bar' for more robust checking.
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.

11 years agodoc: Document SRFI-9 functional setters.
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.

11 years agodoc: Move SRFI-9 records under "Compound Data Types".
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.

11 years agoChange the argument order of 'set-fields' to match that of 'set-fields'.
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.

11 years agoAdd system/base/ck.scm to SYSTEM_BASE_SOURCES in module/Makefile.am.
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.

11 years agoFutures: Avoid creating the worker pool more than once.
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.

11 years agoImprove error for set-fields paths leading to different types.
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.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Sat, 10 Nov 2012 04:09:38 +0000 (23:09 -0500)]
Merge remote-tracking branch 'origin/stable-2.0'

11 years agoImprove error messages for invalid record definitions.
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.

11 years agoFix non-toplevel srfi-9 compile-time error tests to actually be non-toplevel.
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'.

11 years agoUse 'pass-if-equal' to check syntax-error exceptions in srfi-9.test.
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'.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Fri, 9 Nov 2012 02:57:33 +0000 (21:57 -0500)]
Merge remote-tracking branch 'origin/stable-2.0'

11 years agoFix record constructor in getopt-long.
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.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Fri, 9 Nov 2012 00:29:56 +0000 (19:29 -0500)]
Merge remote-tracking branch 'origin/stable-2.0'

11 years agoImplement functional record setters.
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.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Mon, 5 Nov 2012 20:57:03 +0000 (15:57 -0500)]
Merge remote-tracking branch 'origin/stable-2.0'

Conflicts:
libguile/validate.h

11 years agoFix invalid assertion about mutex ownership in threads.c.
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.

11 years agoHave `SCM_NUM2FLOAT' and `SCM_NUM2DOUBLE' use `scm_to_double'.
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>.

11 years agoFix copyright years in `futures.scm'.
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.

11 years agoPreserve additional R6RS library name components after srfi :n
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).

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Sat, 3 Nov 2012 07:35:14 +0000 (03:35 -0400)]
Merge remote-tracking branch 'origin/stable-2.0'

11 years agofutures: Have workers work when futures are available.
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.

11 years agoFix `generalized-vector->list' indexing bug with shared arrays.
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.

11 years agotest-suite: Add a nameless form of `pass-if-equal'.
Ludovic Courtès [Fri, 2 Nov 2012 22:29:43 +0000 (23:29 +0100)]
test-suite: Add a nameless form of `pass-if-equal'.

* test-suite/test-suite/lib.scm (pass-if-equal): Add a nameless pattern.
* test-suite/tests/arrays.test ("array->list"): Use `pass-if-equal'.