bpt/guile.git
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 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 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 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 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 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 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 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 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'.

11 years agoscandir: Use `lstat' instead of `stat'.
Ludovic Courtès [Wed, 31 Oct 2012 23:47:41 +0000 (00:47 +0100)]
scandir: Use `lstat' instead of `stat'.

* module/ice-9/ftw.scm (scandir): Use `lstat', not `stat'.

* test-suite/tests/ftw.test ("scandir")["symlink to directory"]: New
  test.

11 years agotest-suite: Use `pass-if-equal' in `ftw.test'.
Ludovic Courtès [Wed, 31 Oct 2012 23:43:58 +0000 (00:43 +0100)]
test-suite: Use `pass-if-equal' in `ftw.test'.

* test-suite/tests/ftw.test ("file-system-fold")["test-suite (never
  enter)", "test-suite/lib.scm (flat file)"]: Use `pass-if-equal'
  instead of `pass-if'.

11 years agotest-suite: Add `pass-if-equal'.
Ludovic Courtès [Wed, 31 Oct 2012 23:42:37 +0000 (00:42 +0100)]
test-suite: Add `pass-if-equal'.

* test-suite/test-suite/lib.scm (pass-if-equal): New macro.
  (run-test): Upon `fail', pass ARGS to REPORT.

11 years agoFix formatting of comments in scm_read_array.
Mark H Weaver [Wed, 31 Oct 2012 02:58:19 +0000 (22:58 -0400)]
Fix formatting of comments in scm_read_array.

* libguile/read.c (scm_read_array): Fix formatting of comments.

11 years agoscm_read_shebang: handle non-ascii characters properly.
Mark H Weaver [Wed, 31 Oct 2012 02:53:22 +0000 (22:53 -0400)]
scm_read_shebang: handle non-ascii characters properly.

* libguile/read.c (scm_read_shebang): Abort scan for reader directive
  if a character other than [-a-z0-9] is encountered.

11 years agoTest number-theoretic division by -0.0.
Mark H Weaver [Tue, 30 Oct 2012 06:23:07 +0000 (02:23 -0400)]
Test number-theoretic division by -0.0.

* test-suite/tests/numbers.test ("Number-theoretic division"): Fix typo
  so that we actually test for division by -0.0.

11 years agoMinor tweaks to srfi-105.test
Mark H Weaver [Mon, 29 Oct 2012 23:37:56 +0000 (19:37 -0400)]
Minor tweaks to srfi-105.test

* test-suite/tests/srfi-105.test ("curly-infix"): Minor tweaks.

11 years agoImplement SRFI-105 curly infix expressions.
Mark H Weaver [Fri, 26 Oct 2012 21:20:16 +0000 (17:20 -0400)]
Implement SRFI-105 curly infix expressions.

* libguile/private-options.h: Add SCM_CURLY_INFIX_P macro, and increment
  SCM_N_READ_OPTIONS.

* libguile/read.c (sym_nfx, sym_bracket_list, sym_bracket_apply): New
  variables.
  (scm_read_opts): Add curly-infix reader option.  Reformat to comply
  with GNU coding standards.
  (scm_t_read_opts): Add curly_infix_p and neoteric_p fields.
  (init_read_options): Initialize new fields.
  (CHAR_IS_DELIMITER): Add '{', '}', '[', and ']' as delimiters if
  curly_infix_p is set.

  (set_port_square_brackets_p, set_port_curly_infix_p): New functions.

  (read_inner_expression): New function which contains the code that was
  previously in 'scm_read_expression'.  Handle curly braces when
  curly_infix_p is set.  If curly_infix_p is set and square_brackets_p
  is unset, follow the Kawa convention: [...] => ($bracket-list$ ...)

  (scm_read_expression): New function body to handle neoteric
  expressions where appropriate.

  (scm_read_shebang): Handle the new reader directives: '#!curly-infix'
  and the non-standard '#!curly-infix-and-bracket-lists'.

  (scm_read_sexp): Handle curly infix lists.

* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-105 feature
  identifier.

* doc/ref/srfi-modules.texi (SRFI-105): Add stub doc for SRFI-105.

* doc/ref/api-evaluation.texi (Scheme Read): Add documentation for the
  'curly-infix' read option, and the '#!curly-infix' and
  '#!curly-infix-and-bracket-lists' reader directives.

* doc/ref/api-options.texi (Runtime Options): Add 'curly-infix' to the
  list of read options.

* test-suite/Makefile.am: Add tests/srfi-105.test.

* test-suite/tests/srfi-105.test: New file.

11 years agoImplement #!fold-case and #!no-fold-case reader directives.
Mark H Weaver [Wed, 24 Oct 2012 18:37:36 +0000 (14:37 -0400)]
Implement #!fold-case and #!no-fold-case reader directives.

* libguile/read.c (set_port_case_insensitive_p): New function.

  (scm_read_shebang): Handle #!fold-case and #!no-fold-case.

* doc/ref/api-evaluation.texi (Case Sensitivity, Scheme Read): Document
  the #!fold-case and #!no-fold-case reader directives.

* test-suite/tests/reader.test ("per-port-read-options"): Add tests.

11 years agoImplement per-port read options.
Mark H Weaver [Tue, 23 Oct 2012 21:28:43 +0000 (17:28 -0400)]
Implement per-port read options.

* libguile/read.c (scm_t_read_opts): Update comment to mention the
  per-port read options.

  (sym_port_read_options): New variable.

  (set_port_read_option): New function.

  (init_read_options): Add new 'port' parameter, and consult the
  per-port read option overrides when initializing the 'scm_t_read_opts'
  struct.  Move to bottom of file.

  (scm_read): Pass 'port' parameter to init_read_options.

11 years agoRepurpose scm_i_port_weak_hash to associate an alist with each port.
Mark H Weaver [Tue, 23 Oct 2012 04:36:12 +0000 (00:36 -0400)]
Repurpose scm_i_port_weak_hash to associate an alist with each port.

* libguile/ports.c (scm_i_port_weak_hash): Document that the values in
  this hash table will now be alists.  Previously the value slots were
  unused.

  (scm_new_port_table_entry): Change the initial value of the entry in
  scm_i_port_weak_hash from SCM_BOOL_F to SCM_EOL.

11 years agoGeneralize scm_read_shebang to handle other reader directives.
Mark H Weaver [Tue, 23 Oct 2012 04:29:07 +0000 (00:29 -0400)]
Generalize scm_read_shebang to handle other reader directives.

* libguile/read.c (READER_DIRECTIVE_NAME_MAX_SIZE): New C macro.
  (scm_read_shebang): Rewrite to handle arbitrary reader directives.

11 years agoAdd source properties to more datum types in scm_read_sharp_extension.
Mark H Weaver [Tue, 23 Oct 2012 04:21:12 +0000 (00:21 -0400)]
Add source properties to more datum types in scm_read_sharp_extension.

* libguile/read.c (scm_read_sharp_extension): Attach source properties
  to the result of a custom token reader if the returned datum is not
  immediate.  Previously, source properties were added to pairs only.

11 years agoChange reader to pass read options to helpers via explicit parameter.
Mark H Weaver [Tue, 23 Oct 2012 21:11:41 +0000 (17:11 -0400)]
Change reader to pass read options to helpers via explicit parameter.

* libguile/read.c (enum t_keyword_style, struct t_read_opts,
  scm_t_read_opts): New types.
  (init_read_options): New function.

  (CHAR_IS_DELIMITER): Look up square-brackets option via local 'opts'.

  (scm_read): Call 'init_read_options', and pass 'opts' to helpers.

  (flush_ws, maybe_annotate_source, read_complete_token, read_token,
  scm_read_bytevector, scm_read_character,
  scm_read_commented_expression, scm_read_expression,
  scm_read_guile_bit_vector, scm_read_keyword,
  scm_read_mixed_case_symbol, scm_read_nil, scm_read_number,
  scm_read_number_and_radix, scm_read_quote, scm_read_sexp,
  scm_read_sharp, scm_read_sharp_extension, scm_read_shebang,
  scm_read_srfi4_vector, scm_read_string, scm_read_syntax,
  scm_read_vector, scm_read_array): Add 'opts' as an additional
  parameter, and use it to look up read options.  Previously the global
  read options were consulted directly.

11 years agoMinor tweaks to delimiter handling in read.c
Mark H Weaver [Tue, 23 Oct 2012 03:28:56 +0000 (23:28 -0400)]
Minor tweaks to delimiter handling in read.c

* libguile/read.c (CHAR_IS_R5RS_DELIMITER, CHAR_IS_DELIMITER): Move the
  '[' and ']' delimiters from CHAR_IS_R5RS_DELIMITER to
  CHAR_IS_DELIMITER.  Parenthesize all references to the macro
  parameter.  Don't check the global square-brackets read option until
  after we know the character is '[' or ']'.
  (scm_read_sexp): Don't check the global square-brackets read option
  until after we know the character is ']'.

11 years agoMove array reader from arrays.c to read.c
Mark H Weaver [Tue, 23 Oct 2012 03:23:45 +0000 (23:23 -0400)]
Move array reader from arrays.c to read.c

* libguile/arrays.c (read_decimal_integer): Move to read.c.
  (scm_i_read_array): Remove.  Incorporate the code into the
  'scm_read_array' static function in read.c.

* libguile/arrays.h (scm_i_read_array): Remove prototype.

* libguile/read.c (read_decimal_integer): Move here from read.c.
  (scm_read_array): Incorporate the code from 'scm_i_read_array'.  Call
  'scm_read_vector' and 'scm_read_sexp' instead of 'scm_read'.

11 years agoFix typo in scheme-using.texi
Ian Price [Wed, 19 Sep 2012 16:40:17 +0000 (17:40 +0100)]
Fix typo in scheme-using.texi

* doc/ref/scheme-using.texi (System Commands): Fix typo.

11 years agoFix @@ usage in --listen option
Ian Price [Wed, 19 Sep 2012 16:33:29 +0000 (17:33 +0100)]
Fix @@ usage in --listen option

* module/ice-9/command-line.scm (compile-shell-switches): Fix usage of
  @@, which no longer supports arbitrary expressions, only identifiers.

11 years agoRemove prototype for scm_read_token, which does not exist.
Mark H Weaver [Sun, 14 Oct 2012 00:41:45 +0000 (20:41 -0400)]
Remove prototype for scm_read_token, which does not exist.

* libguile/read.h: Remove prototype for scm_read_token.

11 years agoImprove formatting of options help given long option names
Mark H Weaver [Sun, 14 Oct 2012 00:28:27 +0000 (20:28 -0400)]
Improve formatting of options help given long option names

* module/ice-9/boot-9.scm (define-option-interface): When printing
  options help, e.g. for (read-options 'help), expand the width of the
  first column by another tab stop, to accommodate option names of up to
  23 characters.

11 years agoweb: Fix possible file descriptor leak in `open-socket-for-uri'.
Ludovic Courtès [Sat, 13 Oct 2012 19:13:10 +0000 (21:13 +0200)]
web: Fix possible file descriptor leak in `open-socket-for-uri'.

* module/web/client.scm (open-socket-for-uri): Always close S in the
  `system-error' handler.

11 years agoweb: Pass `AI_NUMERICSERV' when given a port number.
Ludovic Courtès [Fri, 12 Oct 2012 21:09:44 +0000 (23:09 +0200)]
web: Pass `AI_NUMERICSERV' when given a port number.

* module/web/client.scm (open-socket-for-uri)[addresses]: Pass
  AI_NUMERICSERV as the `getaddrinfo' hint when (uri-port URI) is true.

11 years agoweb: Change `http-get' to try all the addresses for the given URI.
Ludovic Courtès [Fri, 12 Oct 2012 21:05:22 +0000 (23:05 +0200)]
web: Change `http-get' to try all the addresses for the given URI.

* module/web/client.scm (open-socket-for-uri): Try all the addresses
  returned by `getaddrinfo' until one succeeds.

11 years agoImplement `hash' for structs.
Ludovic Courtès [Fri, 12 Oct 2012 21:03:39 +0000 (23:03 +0200)]
Implement `hash' for structs.

* libguile/hash.c (scm_hasher): Call `scm_i_struct_hash' upon
  `scm_tcs_struct'.
* libguile/struct.c (scm_i_struct_hash): New function.
* libguile/struct.h (scm_i_struct_hash): New declaration.

* test-suite/tests/structs.test ("hash"): New test prefix.

11 years agoThanks Daniel Hartwig.
Mark H Weaver [Fri, 12 Oct 2012 12:26:34 +0000 (08:26 -0400)]
Thanks Daniel Hartwig.

* THANKS (Contributors since the last release): Add Daniel Hartwig.

11 years agoIn string-split, add support for character sets and predicates.
Daniel Hartwig [Mon, 8 Oct 2012 10:35:00 +0000 (18:35 +0800)]
In string-split, add support for character sets and predicates.

* libguile/srfi-13.c (string-split): Add support for splitting on
  character sets and predicates, like string-index and others.
* test-suite/tests/strings.test (string-split): Add tests covering
  the new argument types.
* doc/ref/api-data.texi (string-split): Update.

Signed-off-by: Mark H Weaver <mhw@netris.org>
11 years agoRevert "Preserve keyword identifier in 'syntax-rules' and 'define-syntax-rule'"
Mark H Weaver [Wed, 10 Oct 2012 17:13:19 +0000 (13:13 -0400)]
Revert "Preserve keyword identifier in 'syntax-rules' and 'define-syntax-rule'"

This reverts commit 3e3d32dd9b2d71ffb0703dedc4d47387e981c9b5.

11 years agoPreserve keyword identifier in 'syntax-rules' and 'define-syntax-rule'
Mark H Weaver [Mon, 8 Oct 2012 18:08:43 +0000 (14:08 -0400)]
Preserve keyword identifier in 'syntax-rules' and 'define-syntax-rule'

* module/ice-9/psyntax-pp.scm (syntax-rule, define-syntax-rule):
  Preserve the keyword identifier.

* module/ice-9/psyntax-pp.scm: Regenerate.

11 years agoSimplify calls to 'eqv?' when one argument is an immediate constant.
Mark H Weaver [Mon, 8 Oct 2012 15:56:10 +0000 (11:56 -0400)]
Simplify calls to 'eqv?' when one argument is an immediate constant.

* module/language/tree-il/primitives.scm (maybe-simplify-to-eq): New
  helper procedure shared by expanders for 'eqv?' and 'equal?'.
  (*primitive-expand-table*): Add expansion rule for 'eqv?'.

* test-suite/tests/tree-il.test ("primitives"): Add tests.

11 years agoDon't simplify 'equal?' to 'not' or 'null?'.
Mark H Weaver [Mon, 8 Oct 2012 04:37:09 +0000 (00:37 -0400)]
Don't simplify 'equal?' to 'not' or 'null?'.

* module/language/tree-il/primitives.scm (*primitive-expand-table*):
  Don't simplify 'equal?' to 'not' or 'null?', but only to 'eq?'.

* test-suite/tests/tree-il.test ("primitives"): Adjust tests.

11 years agoDon't simplify 'equal?' to 'eq?' when constant is an *inexact* small integer.
Mark H Weaver [Mon, 8 Oct 2012 03:57:13 +0000 (23:57 -0400)]
Don't simplify 'equal?' to 'eq?' when constant is an *inexact* small integer.

* module/language/tree-il/primitives.scm (*primitive-expand-table*):
  Refine test for fixnums to verify that the small integer is exact.

* test-suite/tests/tree-il.test ("primitives"): Add test.

11 years agoSimplify calls to `equal?' when one argument is a constant.
Ludovic Courtès [Fri, 5 Oct 2012 23:24:46 +0000 (01:24 +0200)]
Simplify calls to `equal?' when one argument is a constant.

* module/language/tree-il/primitives.scm (*primitive-expand-table*): Add
  expansion rules for `equal?', when called with one constant and
  another argument.

* test-suite/tests/tree-il.test (pass-if-primitives-resolved): New
  macro.
  ("primitives"): New test prefix.

11 years agoImprove error reporting in 'append!'
Mark H Weaver [Sat, 6 Oct 2012 10:04:29 +0000 (06:04 -0400)]
Improve error reporting in 'append!'

* libguile/list.c (scm_append_x): Report correct argument number when
  validating arguments.  Validate that the last cdr of each argument is
  null or nil.  Rename formal rest argument from 'lists' to 'args'.

* test-suite/tests/list.test (append!): Update tests to expect correct
  handling of improper lists.

11 years agoChange inappropriate uses of expect-fail X to pass-if not X in chars.test
Mark H Weaver [Thu, 4 Oct 2012 11:57:27 +0000 (07:57 -0400)]
Change inappropriate uses of expect-fail X to pass-if not X in chars.test

* test-suite/tests/chars.test (basic char handling): Change
  inappropriate uses of 'expect-fail' to 'pass-if' with 'not' applied to
  the test.

11 years agoIn fold-matches, set regexp/notbol unless matching string start.
Chris K. Jester-Young [Sun, 16 Sep 2012 06:27:19 +0000 (02:27 -0400)]
In fold-matches, set regexp/notbol unless matching string start.

* module/ice-9/regex.scm (fold-matches): Set regexp/notbol if the
  starting position is nonzero.
* test-suite/tests/regexp.test (fold-matches): Check that when
  matching /^foo/ against "foofoofoofoo", only one match results.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
11 years agoDon't stat(2) and access(2) the .go location before using it.
Ludovic Courtès [Tue, 11 Sep 2012 21:44:59 +0000 (23:44 +0200)]
Don't stat(2) and access(2) the .go location before using it.

* module/system/base/compile.scm (ensure-directory): Rename to...
  (ensure-directory): ... this.  Update callers.  When ERRNO is EEXIST,
  assume DIR is a writable directory instead of calling `stat' and
  `access?' again.  Fixes UID/EUID mismatches for setuid binaries.
  Reported by rixed@happyleptic.org at
  <http://lists.gnu.org/archive/html/guile-user/2012-06/msg00023.html>.

11 years agoRewrite SRFI-31 in terms of `syntax-rules'.
Ludovic Courtès [Tue, 11 Sep 2012 21:39:32 +0000 (23:39 +0200)]
Rewrite SRFI-31 in terms of `syntax-rules'.

* module/srfi/srfi-31.scm: Use `#:export' instead of `#:export-syntax'.
  (rec): Rewrite using `syntax-rules'.

* test-suite/tests/srfi-31.test ("rec special form"): Change exception
  type to EXCEPTION:SYNTAX-PATTERN-UNMATCHED.

11 years agoDocument (ice-9 curried definitions)
Ian Price [Thu, 6 Sep 2012 20:21:47 +0000 (21:21 +0100)]
Document (ice-9 curried definitions)

* doc/ref/Makefile.am (guile_TEXINFOS): Add curried.texi to list
* doc/ref/curried.texi: New file.
* doc/ref/guile.texi (Guile Modules): Add "Curried Definitions" to menu.
* doc/ref/scheme-ideas.texi (Lambda Alternatives): Refer to "Curried Definitions"
  from the `define' section.