bpt/guile.git
11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Mon, 1 Apr 2013 09:42:31 +0000 (05:42 -0400)]
Merge remote-tracking branch 'origin/stable-2.0'

Conflicts:
libguile/r6rs-ports.c

11 years agoscm_string_join: properly sequence operations in ADD_TO_APPEND_LIST
Mark H Weaver [Mon, 1 Apr 2013 09:31:08 +0000 (05:31 -0400)]
scm_string_join: properly sequence operations in ADD_TO_APPEND_LIST

* libguile/srfi-13.c (scm_string_join): Properly sequence operations in
  ADD_TO_APPEND_LIST macro.

11 years agoOptimize 'string-join'.
Mark H Weaver [Mon, 1 Apr 2013 07:47:29 +0000 (03:47 -0400)]
Optimize 'string-join'.

* libguile/srfi-13.c (string-join): Rewrite to call 'scm_string_append'
  only once.

11 years agoMake 'string-append' more efficient and robust.
Mark H Weaver [Mon, 1 Apr 2013 07:37:36 +0000 (03:37 -0400)]
Make 'string-append' more efficient and robust.

* libguile/strings.c (scm_string_append): Check for numerical overflow
  while computing the length of the result.  Double-check that we don't
  overflow the result string, and that it is the correct length in the
  end (in case another thread changed the list).  When copying a narrow
  string to a wide result, avoid calling 'scm_i_string_length' and
  'scm_i_string_chars' on each character.

11 years agoFix typos in 'string-join' docs: 'string-infix' -> 'strict-infix'.
Mark H Weaver [Mon, 1 Apr 2013 05:21:30 +0000 (01:21 -0400)]
Fix typos in 'string-join' docs: 'string-infix' -> 'strict-infix'.

* doc/ref/api-data.texi (String Constructors): In definition of
  'string-join', change 'string-infix' -> 'strict-infix'.

* libguile/srfi-13.c (scm_string_join): In docstring, change
  'string-infix' -> 'strict-infix'.

11 years agoAvoid unnecessary peeks for EOF in r6rs-ports.
Mark H Weaver [Mon, 1 Apr 2013 01:12:31 +0000 (21:12 -0400)]
Avoid unnecessary peeks for EOF in r6rs-ports.

* libguile/r6rs-ports.c (scm_get_bytevector_n, scm_get_bytevector_n_x,
  scm_get_bytevector_some, scm_get_bytevector_all): Avoid peeking for
  EOF when we already know.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Sun, 31 Mar 2013 02:56:27 +0000 (22:56 -0400)]
Merge remote-tracking branch 'origin/stable-2.0'

11 years agoAdd -C command-line option to adjust %load-compiled-path.
Mark H Weaver [Fri, 29 Mar 2013 16:28:49 +0000 (12:28 -0400)]
Add -C command-line option to adjust %load-compiled-path.

* module/ice-9/command-line.scm (compile-shell-switches):
  Implement -C option.
  (*usage*): Add -C option.

* doc/ref/guile-invoke.texi (Command-line Options): Add docs.

11 years agoAugment `.gitignore'.
Ludovic Courtès [Fri, 29 Mar 2013 18:19:51 +0000 (19:19 +0100)]
Augment `.gitignore'.

11 years agobuild: Build and check (ice-9 popen) only when --enable-posix and HAVE_FORK.
Ludovic Courtès [Fri, 29 Mar 2013 18:04:56 +0000 (19:04 +0100)]
build: Build and check (ice-9 popen) only when --enable-posix and HAVE_FORK.

Fixes <http://bugs.gnu.org/13848>.
Reported by Jan Schukat <shookie@email.de>.

* configure.ac: Rename `HAVE_FORK' conditional to `BUILD_ICE_9_POPEN'.
  Set it when both $enable_posix and $ac_cv_func_fork are true.
* libguile/posix.c (scm_init_posix): Add the `fork' feature.
* doc/ref/api-options.texi (Common Feature Symbols): Add `fork'.
* doc/ref/posix.texi (Pipes): Add footnote mentioning the `fork'
  feature.
* module/Makefile.am (SCRIPTS_SOURCES): Make `scripts/autofrisk.scm' and
  `scripts/scan-api.scm' conditional on `BUILD_ICE_9_POPEN'.
* test-suite/tests/popen.test (if-supported): New macro.
  Wrap body in `if-supported'.

11 years agobuild: Remove redundant check for `struct timespec'.
Ludovic Courtès [Fri, 29 Mar 2013 17:44:18 +0000 (18:44 +0100)]
build: Remove redundant check for `struct timespec'.

* m4/gnulib-cache.m4: Add `time'.
* lib/Makefile.am: Update, still from v0.0-7865-ga828bb2.
* configure.ac: Remove check for `struct timespec', which was redundant
  with Gnulib, and conflicted with pthread-win32's <pthread.h>:
  <http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00096.html>.

11 years agodoc: Use '@defvr' to introduce 'stream-null'.
Mark H Weaver [Fri, 29 Mar 2013 15:35:20 +0000 (11:35 -0400)]
doc: Use '@defvr' to introduce 'stream-null'.

* doc/ref/srfi-modules.texi (SRFI-41): Use @defvr to introduce
  'stream-null'.

11 years agoRevert "doc: Consider `stream-null' as a variable."
Mark H Weaver [Fri, 29 Mar 2013 15:33:59 +0000 (11:33 -0400)]
Revert "doc: Consider `stream-null' as a variable."

This reverts commit 4a0821a8d5cfff50fef8c119a0d76355b6126009.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Fri, 29 Mar 2013 02:24:00 +0000 (22:24 -0400)]
Merge remote-tracking branch 'origin/stable-2.0'

11 years agotests: Skip `test-pthread-create-secondary' except on Linux-based systems.
Ludovic Courtès [Thu, 28 Mar 2013 22:33:44 +0000 (23:33 +0100)]
tests: Skip `test-pthread-create-secondary' except on Linux-based systems.

* test-suite/standalone/test-pthread-create-secondary.c: Skip on
  non-Linux-based systems.

11 years agobuild: Require GMP >= 4.2.
Ludovic Courtès [Thu, 28 Mar 2013 21:53:59 +0000 (22:53 +0100)]
build: Require GMP >= 4.2.

* NEWS, README: Update.

11 years agotests: Fix file name canonicalization tests for when $srcdir contains symlinks.
Ludovic Courtès [Thu, 28 Mar 2013 21:42:24 +0000 (22:42 +0100)]
tests: Fix file name canonicalization tests for when $srcdir contains symlinks.

* test-suite/tests/ports.test ("%file-port-name-canonicalization"): Use
  `pass-if-equal' instead of `pass-if'.
  ["relative canonicalization from ice-9"]: Throw to `unresolved' when
  %LOAD-PATH is not canonical.
  ["absolute canonicalization from ice-9"]: Canonicalize the result.

11 years agoAdd Gnulib commit ID in `NEWS'.
Ludovic Courtès [Thu, 28 Mar 2013 21:16:24 +0000 (22:16 +0100)]
Add Gnulib commit ID in `NEWS'.

11 years agoAllow compilation with GMP < 5.0.0.
Ludovic Courtès [Thu, 28 Mar 2013 21:16:07 +0000 (22:16 +0100)]
Allow compilation with GMP < 5.0.0.

* libguile/numbers.c (VARARG_MPZ_ITERATOR)[!HAVE_DECL_MPZ_INITS]: New
  macro.
  (mpz_inits, mpz_clears)[!HAVE_DECL_MPZ_INITS]: New functions.
* configure.ac: Check for the declaration of `mpz_inits'.

11 years agoFix erroneous `FUNC_NAME' for `scm_array_length'.
Ludovic Courtès [Thu, 28 Mar 2013 20:01:51 +0000 (21:01 +0100)]
Fix erroneous `FUNC_NAME' for `scm_array_length'.

* libguile/generalized-arrays.c (scm_array_length): Fix `FUNC_NAME'.

11 years agodoc: Consider `stream-null' as a variable.
Ludovic Courtès [Wed, 27 Mar 2013 21:32:46 +0000 (22:32 +0100)]
doc: Consider `stream-null' as a variable.

* doc/ref/srfi-modules.texi (SRFI-41): Use @var{stream-null}, not
  @code{stream-null}.  Use @defvr to introduce `stream-null'.

11 years agoDocument (system repl server)
Ian Price [Mon, 18 Mar 2013 18:55:18 +0000 (18:55 +0000)]
Document (system repl server)

* doc/ref/api-evaluation.texi (REPL Servers): New Subsection.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Thu, 28 Mar 2013 09:09:53 +0000 (05:09 -0400)]
Merge remote-tracking branch 'origin/stable-2.0'

Conflicts:
configure.ac
libguile/deprecated.c
libguile/deprecated.h
libguile/filesys.h
libguile/fluids.c
libguile/fports.c
libguile/gc.c
libguile/guile.c
libguile/numbers.c
libguile/objcodes.c
libguile/r6rs-ports.c
libguile/smob.c
libguile/socket.c
libguile/threads.h
module/language/scheme/decompile-tree-il.scm
module/language/tree-il/peval.scm
test-suite/tests/syncase.test

11 years agoSRFI-41 stream-null is a Scheme Variable, not a Constant.
Mark H Weaver [Thu, 28 Mar 2013 01:11:06 +0000 (21:11 -0400)]
SRFI-41 stream-null is a Scheme Variable, not a Constant.

Suggested by Ludovic Courtès <ludo@gnu.org>.

* doc/ref/srfi-modules.texi (SRFI-41 Stream Primitives):
  Label 'stream-null' as a Scheme Variable, not a Constant.

11 years agoUse BT Templeton's preferred name.
Chris K. Jester-Young [Wed, 27 Mar 2013 19:30:26 +0000 (15:30 -0400)]
Use BT Templeton's preferred name.

* THANKS: Use BT Templeton's preferred name.

11 years agoThanks Chris K. Jester-Young.
Mark H Weaver [Wed, 27 Mar 2013 17:39:47 +0000 (13:39 -0400)]
Thanks Chris K. Jester-Young.

* THANKS: Add Chris K Jester-Young to the list of contributors.

11 years agoAdd full documentation for SRFI-41.
Mark H Weaver [Wed, 27 Mar 2013 01:03:42 +0000 (21:03 -0400)]
Add full documentation for SRFI-41.

* doc/ref/misc-modules.texi (Streams): Add cross-reference to SRFI-41.

* doc/ref/srfi-modules.texi (SRFI-41): Replace stub with full
  documentation.
  (SRFI-41 Stream Fundamentals, SRFI-41 Stream Primitives,
  SRFI-41 Stream Library): New subsubsections.

11 years agoAdd SRFI-41.
Chris K. Jester-Young [Wed, 27 Mar 2013 02:15:31 +0000 (22:15 -0400)]
Add SRFI-41.

Incorporates suggestions from Mark H Weaver <mhw@netris.org>
and Ian Price <ianprice90@googlemail.com>.

* module/srfi/srfi-41.scm: New file.

* module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-41.scm.

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

* test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-41.test.

* doc/ref/srfi-modules.texi (SRFI Support): Add SRFI-41.
  (SRFI-41): New node which refers the reader to
  <http://srfi.schemers.org/srfi-41/srfi-41.html>.

11 years agoUpdate `NEWS'.
Ludovic Courtès [Wed, 27 Mar 2013 17:05:45 +0000 (18:05 +0100)]
Update `NEWS'.

11 years agofutures: Limit the number of nested futures on the same stack.
Ludovic Courtès [Wed, 27 Mar 2013 17:03:47 +0000 (18:03 +0100)]
futures: Limit the number of nested futures on the same stack.

Fixes <http://bugs.gnu.org/13188>.
Reported by Nala Ginrut <nalaginrut@gmail.com>.

* module/ice-9/futures.scm (%nesting-level): Rename to...
  (%nesting-level): ... this.  Default to 0 instead of #f.  Update
  users.
  (%max-nesting-level): New variable.
  (touch): When FUTURE is queued and (%nesting-level) is above
  %MAX-NESTING-LEVEL, abort to %FUTURE-PROMPT.
* test-suite/tests/future.test ("nested futures")["loop"]: Remove
  `compile' call.
* test-suite/tests/threads.test ("par-map")["long list"]: New test.
* doc/ref/api-scheduling.texi (Futures): Add a paragraph about stack
  consumption.

11 years agoDocument `and=>'.
Ludovic Courtès [Wed, 27 Mar 2013 15:45:54 +0000 (16:45 +0100)]
Document `and=>'.

* module/ice-9/boot-9.scm (and=>): Add docstring.
* doc/ref/api-procedures.texi (Higher-Order Functions): Add `and=>'.

11 years agoweb http: parse numeric time zones in headers
Daniel Hartwig [Fri, 15 Mar 2013 14:25:10 +0000 (22:25 +0800)]
web http: parse numeric time zones in headers

* module/web/http.scm (parse-zone-offset, normalize-date): New
  procedures.
  (parse-rfc-822-date, parse-rfc-850-date, parse-date): Update.
* test-suite/tests/web-http.test ("general headers"): Add test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
11 years agodoc: Use a preferred naming convention in SRFI-9 examples.
Ludovic Courtès [Tue, 26 Mar 2013 21:11:30 +0000 (22:11 +0100)]
doc: Use a preferred naming convention in SRFI-9 examples.

* doc/ref/api-compound.texi (SRFI-9 Records): Use "Scheme Syntax"
  instead of "library syntax".  Remove `get-' from getter names, and add
  an exclamation mark in setter names.  Change `employee-type' to
  `<employee>'.

11 years agoManual: xref SRFI-45 from core Delayed Evaluation section.
Mark H Weaver [Wed, 27 Mar 2013 01:25:12 +0000 (21:25 -0400)]
Manual: xref SRFI-45 from core Delayed Evaluation section.

* doc/ref/api-evaluation.texi (Delayed Evaluation): Add cross-reference
  to SRFI-45.

11 years agoSRFI-45: add promise? predicate.
Mark H Weaver [Wed, 27 Mar 2013 01:22:11 +0000 (21:22 -0400)]
SRFI-45: add promise? predicate.

* module/srfi/srfi-45.scm (promise?): Export.

* doc/ref/srfi-modules.texi (SRFI-45): Update docs.

* test-suite/tests/srfi-45.test: Add test.  Add FSF copyright for 2010
  and 2013.  Add missing year to André van Tonder's copyright notice.

11 years agoRevert "SRFI-45: Support multiple values; add promise? predicate."
Mark H Weaver [Wed, 27 Mar 2013 01:16:26 +0000 (21:16 -0400)]
Revert "SRFI-45: Support multiple values; add promise? predicate."

This reverts commit 1d64b4edb9da4011ad06c0fab1c6225ec20b0876.

11 years agoSRFI-37: Fix infinite loop when processing short option with no required arg.
Ludovic Courtès [Mon, 25 Mar 2013 22:25:57 +0000 (23:25 +0100)]
SRFI-37: Fix infinite loop when processing short option with no required arg.

Fixes <http://bugs.gnu.org/13176>.

* module/srfi/srfi-37.scm (args-fold)[short-option-argument]: When ARGS
  is a pair, always set it to its cdr.
* test-suite/tests/srfi-37.test ("SRFI-37")["short option with optional
  argument omitted", "short option with optional argument provided"]:
  New tests.

11 years agogetaddrinfo: Document the missing errno value for EAI_SYSTEM.
Ludovic Courtès [Mon, 25 Mar 2013 21:46:53 +0000 (22:46 +0100)]
getaddrinfo: Document the missing errno value for EAI_SYSTEM.

In response to <http://bugs.gnu.org/13958>.
Reported by Lluís Batlle i Rossell <viric@viric.name>.

* doc/ref/posix.texi (Network Databases): Document the missing errno
  value for EAI_SYSTEM.
* libguile/net_db.c (scm_getaddrinfo): Likewise.

11 years agobuild: Use portable sed constructs.
Ludovic Courtès [Mon, 25 Mar 2013 21:27:37 +0000 (22:27 +0100)]
build: Use portable sed constructs.

Partly fixes <http://bugs.gnu.org/14042>.
Reported by Marc Girod <marc.girod@gmail.com>.

* meta/Makefile.am (guile-config): Use separate "s" expressions to
  accommodate Solaris sed.

11 years agosendfile: Make sure we have a Linux-style `sendfile'.
Ludovic Courtès [Mon, 25 Mar 2013 12:51:57 +0000 (13:51 +0100)]
sendfile: Make sure we have a Linux-style `sendfile'.

* libguile/filesys.c (scm_sendfile): Change conditional to
  HAVE_SYS_SENDFILE_H && HAVE_SENDFILE.

11 years agosendfile: Check return value of `lseek'.
Ludovic Courtès [Mon, 25 Mar 2013 12:28:42 +0000 (13:28 +0100)]
sendfile: Check return value of `lseek'.

* libguile/filesys.c (scm_sendfile): Check return value of
  `lseek_or_lseek64', and use `SCM_SYSERROR' upon error.

11 years agoSkip relevant `sendfile' tests when thread support is lacking.
Ludovic Courtès [Mon, 25 Mar 2013 12:26:52 +0000 (13:26 +0100)]
Skip relevant `sendfile' tests when thread support is lacking.

* test-suite/tests/filesys.test ("sendfile")["pipe", "pipe with
  offset"]: Throw to `unresolved' when not (provided? 'threads).

11 years agotests: Add more `maybe-gc-flakiness'.
Ludovic Courtès [Fri, 22 Mar 2013 21:24:27 +0000 (22:24 +0100)]
tests: Add more `maybe-gc-flakiness'.

Fixes <http://bugs.gnu.org/14001>.
Reported by Dennis Clarke <dclarke@blastwave.org>.

* test-suite/tests/gc.test ("gc")["Lexical vars are collectable"]: Wrap
  in `maybe-gc-flakiness'.

11 years agoAdd bindings for `sendfile'.
Ludovic Courtès [Wed, 20 Mar 2013 22:04:11 +0000 (23:04 +0100)]
Add bindings for `sendfile'.

* configure.ac: Check for <sys/sendfile.h> and `sendfile'.
* libguile/filesys.c (scm_sendfile): New function.
* libguile/filesys.h (scm_sendfile): New declaration.
* test-suite/tests/filesys.test ("sendfile"): New test prefix.
* doc/ref/posix.texi (File System): Document `sendfile'.

11 years agotexinfo plain-text: Use `match' for `stexi->plain-text'.
Ludovic Courtès [Fri, 22 Mar 2013 21:09:05 +0000 (22:09 +0100)]
texinfo plain-text: Use `match' for `stexi->plain-text'.

* module/texinfo/plain-text.scm (def)[list/spaces]: Remove.
  (stexi->plain-text): Use `match' instead of `cond'.

11 years agotexinfo: Add whitespace after periods.
Ludovic Courtès [Fri, 22 Mar 2013 21:05:23 +0000 (22:05 +0100)]
texinfo: Add whitespace after periods.

* module/texinfo/string-utils.scm (end-of-sentence?): New procedure.
  (make-text-wrapper): Append an extra space after LINE when it matches
  `end-of-sentence?' and COLLAPSE-WHITESPACE? is false.
* test-suite/tests/texinfo.serialize.test ("test-serialize"): Adjust
  accordingly.
* test-suite/tests/texinfo.string-utils.test ("text wrapping")["two
  spaces after end of sentence"]: New test prefix.

11 years agobuild: Adjust makefiles for `guile-procedures.txt'.
Ludovic Courtès [Thu, 21 Mar 2013 23:52:16 +0000 (00:52 +0100)]
build: Adjust makefiles for `guile-procedures.txt'.

* libguile/Makefile.am (all-local): New target.
* Makefile.am (libguile/guile-procedures.txt): Output to $@.tmp first.
  (CLEANFILES): New variable.

11 years agoBuild `guile-procedures.txt' using (texinfo) instead of `makeinfo'.
Ludovic Courtès [Thu, 21 Mar 2013 18:17:13 +0000 (19:17 +0100)]
Build `guile-procedures.txt' using (texinfo) instead of `makeinfo'.

* Makefile.am (schemelibdir, schemelib_DATA): New variables.
  (libguile/guile-procedures.txt): New target.
  (EXTRA_DIST): Add libguile/texi-fragments-to-docstrings.
* libguile/Makefile.am (guile-procedures.txt): Remove target.
  (schemelibdir, schemelib_DATA): Remove.
* libguile/texi-fragments-to-docstrings: New file.

11 years agotexinfo plain-text: Properly render @dots{}.
Ludovic Courtès [Thu, 21 Mar 2013 22:22:08 +0000 (23:22 +0100)]
texinfo plain-text: Properly render @dots{}.

* module/texinfo/plain-text.scm (tag-handlers): Add `dot' handler.

11 years agotest suite: Fix typo in `texinfo.test'.
Ludovic Courtès [Thu, 21 Mar 2013 18:17:56 +0000 (19:17 +0100)]
test suite: Fix typo in `texinfo.test'.

* test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add missing
  quote.

11 years agotexinfo: Recognize `@:'.
Ludovic Courtès [Thu, 21 Mar 2013 15:42:54 +0000 (16:42 +0100)]
texinfo: Recognize `@:'.

* module/texinfo.scm (read-command-token): Recognize @:.
* test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add test.

11 years agotexinfo: Allow markup in the arguments of `@pxref'.
Ludovic Courtès [Thu, 21 Mar 2013 15:37:48 +0000 (16:37 +0100)]
texinfo: Allow markup in the arguments of `@pxref'.

* module/texinfo.scm (texi-command-specs)[pxref]: Change to
  `INLINE-TEXT-ARGS'.
* test-suite/tests/texinfo.test ("test-texinfo->stexinfo")["@pxref{Locales,
  @code{setlocale}}"]: New test.

11 years agotest suite: Use `pass-if-equal' in texinfo.test.
Ludovic Courtès [Thu, 21 Mar 2013 15:36:24 +0000 (16:36 +0100)]
test suite: Use `pass-if-equal' in texinfo.test.

* test-suite/tests/texinfo.test: Replace occurrences of
  `(pass-if (equal? ...))' by `pass-if-equal'.

11 years agoDocument quit and exit
Mike Gran [Thu, 21 Mar 2013 16:20:31 +0000 (09:20 -0700)]
Document quit and exit

* doc/ref/posix.texi (Processes): document `quit' and `exit'
* doc/ref/r6rs.texi (rnrs programs): xref exit

11 years agoAdd missing 'cond-expand' feature identifiers; remove srfi-6 from core list.
Mark H Weaver [Thu, 21 Mar 2013 15:51:18 +0000 (11:51 -0400)]
Add missing 'cond-expand' feature identifiers; remove srfi-6 from core list.

* module/ice-9/boot-9.scm (%cond-expand-features): Remove redundant list
  of feature identifiers in the comment.  Explain more clearly what
  belongs in this list.  Remove srfi-6.

* module/srfi/srfi-4.scm, module/srfi/srfi-27.scm,
  module/srfi/srfi-31.scm, module/srfi/srfi-38.scm,
  module/srfi/srfi-39.scm, module/srfi/srfi-42.scm,
  module/srfi/srfi-45.scm, module/srfi/srfi-67.scm: Add missing
  'cond-expand-provide'.

* module/srfi/srfi-69.scm: Fix erroneous 'cond-expand-provide'.

* doc/ref/srfi-modules.texi (SRFI-0): Update the list of features in
  Guile core.

11 years agoMention the non-conformance of the core SRFI-6 procedures in the manual.
Mark H Weaver [Thu, 21 Mar 2013 16:41:05 +0000 (12:41 -0400)]
Mention the non-conformance of the core SRFI-6 procedures in the manual.

* doc/ref/srfi-modules.texi (About SRFI Usage): Use SRFI-13 as an
  example of a module which is included in core Guile, instead of
  SRFI-6.

  (SRFI-6): Mention the non-conformance of the core 'open-input-string'
  and 'open-output-string' procedures.  Remove the claim that importing
  this module does nothing.  Recommend that users import the module.

11 years agoImprove sqrt handling of large integers and large and small rationals.
Mark H Weaver [Wed, 20 Mar 2013 10:15:32 +0000 (06:15 -0400)]
Improve sqrt handling of large integers and large and small rationals.

* libguile/numbers.c (exact_integer_is_perfect_square,
  exact_integer_floor_square_root): New static functions.

  (scm_sqrt): Use SCM_LIKELY.  Add 'scm_t_inum' variable in inum case to
  reduce the number of uses of SCM_I_INUM.  Rename 'mpz_t' variable.
  Remove unneeded sign check.  Handle bignums too large to fit in a
  double.  Handle fractions too large or too small to fit in a
  normalized double.

* test-suite/tests/numbers.test ("sqrt"): Add tests.

11 years agoOptimize inum case of exact-integer-sqrt.
Mark H Weaver [Wed, 20 Mar 2013 06:27:10 +0000 (02:27 -0400)]
Optimize inum case of exact-integer-sqrt.

* libguile/numbers.c (scm_exact_integer_sqrt): Use GMP for inum
  case.  It is faster than what we had before.

11 years agoSqrt returns exact results when possible.
Mark H Weaver [Tue, 19 Mar 2013 22:48:56 +0000 (18:48 -0400)]
Sqrt returns exact results when possible.

* libguile/numbers.c (scm_sqrt): Handle exact integers and rationals in
  such a way that exact results are returned whenever possible.

* test-suite/tests/numbers.test ("sqrt"): Add tests.

11 years agoOptimize scm_i_divide2double for integers less than 2^DBL_MANT_DIG.
Mark H Weaver [Wed, 20 Mar 2013 02:38:45 +0000 (22:38 -0400)]
Optimize scm_i_divide2double for integers less than 2^DBL_MANT_DIG.

* libguile/numbers.c (scm_i_divide2double): Optimize for common case
  when both operands are less than 2^DBL_MANT_DIG (normally 2^53).

11 years agoSRFI-45: Support multiple values; add promise? predicate.
Mark H Weaver [Tue, 19 Mar 2013 00:01:12 +0000 (20:01 -0400)]
SRFI-45: Support multiple values; add promise? predicate.

* module/srfi/srfi-45.scm (eager): Accept any number of arguments.
  Store the list of arguments in the value record.  Previously, only one
  argument was accepted, and that value was stored in the value record.
  (delay): Support expressions that return any number of arguments.
  (force): Return the list of values stored in the value record.
  (promise?): Export.

* doc/ref/srfi-modules.texi (SRFI-45): Update docs.  Remove typing
  for simplicity in discussing multiple values.

* test-suite/tests/srfi-45.test: Add tests.  Add FSF copyright for 2010
  and 2013.  Add missing year to André van Tonder's copyright notice.

11 years agoUse scientific notation only if there are enough trailing zeroes.
Mark H Weaver [Tue, 19 Mar 2013 07:25:59 +0000 (03:25 -0400)]
Use scientific notation only if there are enough trailing zeroes.

* libguile/numbers.c (idbl2str): Print large numbers in scientific
  notation only if the exponent is >= 7 and the least significant
  non-zero digit has value >= radix^4.

* test-suite/tests/numbers.test ("number->string"): Add tests.

11 years agoAvoid rebuild of `guile.info' at the user's site.
Ludovic Courtès [Mon, 18 Mar 2013 21:28:23 +0000 (22:28 +0100)]
Avoid rebuild of `guile.info' at the user's site.

* configure.ac: Remove `doc/ref/effective-version.texi' from the
  `AC_CONFIG_FILES'.
* doc/ref/Makefile.am ($(srcdir)/effective-version.texi): New target.

11 years agoUse byte-oriented functions in `get-bytevector*'.
Ludovic Courtès [Mon, 18 Mar 2013 20:31:50 +0000 (21:31 +0100)]
Use byte-oriented functions in `get-bytevector*'.

* libguile/r6rs-ports.c (scm_get_bytevector_some, scm_get_bytevector_n,
  scm_get_bytevector_n_x, scm_get_bytevector_all): Use
  `scm_get_byte_or_eof' and `scm_peek_byte_or_eof' instead of their
  `char' counterparts.
  Reported by Chris K. Jester-Young.

11 years agoDefine the new Linux-specific `SO_REUSEPORT'.
Ludovic Courtès [Mon, 18 Mar 2013 20:28:05 +0000 (21:28 +0100)]
Define the new Linux-specific `SO_REUSEPORT'.

* libguile/socket.c (scm_init_socket)[SO_REUSEPORT]: Define
  `SO_REUSEPORT'.
  (scm_setsockopt, scm_getsockopt): Update docstring.
* doc/ref/posix.texi (Network Sockets and Communication): List
  `SO_REUSEPORT'.

11 years agoReimplement idbl2str number printer.
Mark H Weaver [Tue, 5 Mar 2013 10:47:56 +0000 (05:47 -0500)]
Reimplement idbl2str number printer.

Fixes <http://bugs.gnu.org/13757>.

* libguile/numbers.c (idbl2str): Reimplement.
  (mem2decimal_from_point): Accept negative exponents larger than
  SCM_MAXEXP that produce subnormals.
  (SCM_MAX_DBL_PREC): Removed preprocessor macro.
  (scm_dblprec, fx_per_radix): Removed static variables.
  (init_dblprec, init_fx_radix): Removed static functions.
  (scm_init_numbers): Remove initialization code for 'scm_dblprec'
  and 'fx_per_radix'.

* test-suite/tests/numbers.test ("number->string"): Restore tests that
  previously failed.  Remove comments about problems in the number
  printer that are now fixed.

11 years agoImprove inexact division of exact integers.
Mark H Weaver [Mon, 4 Mar 2013 23:46:33 +0000 (18:46 -0500)]
Improve inexact division of exact integers.

* libguile/numbers.c (scm_i_divide2double): New function.
  (scm_i_divide2double_lo2b): New variable.
  (scm_i_fraction2double, log_of_fraction): Use 'scm_i_divide2double'.
  (do_divide): Removed.  Its code is now in 'scm_divide'.
  (scm_divide2real): Removed.  Superceded by 'scm_i_divide2double'.
  (scm_divide): Inherit code from 'do_divide', but without support for
  forcing a 'double' result (that functionality is now implemented by
  'scm_i_divide2double').  Add FIXME comments in cases where divisions
  might not be as precise as they should be.
  (scm_init_numbers): Initialize 'scm_i_divide2double_lo2b'.

* test-suite/tests/numbers.test (dbl-epsilon-exact, dbl-max-exp): New
  variables.
  ("exact->inexact"): Add tests.
  ("inexact->exact"): Add test for largest finite inexact.

11 years agohttp: support IP-literal (IPv6 address) in Host header
Daniel Hartwig [Sat, 16 Mar 2013 11:53:07 +0000 (19:53 +0800)]
http: support IP-literal (IPv6 address) in Host header

* module/web/http.scm ("Host"): Parse and write IP-literals treating
  escapes as uri module does: remove brackets on parse, replace them on
  write.
* test-suite/tests/web-http.test ("request headers"): Add tests.

11 years agoadd tests for read-request-line, etc.
Daniel Hartwig [Sat, 23 Feb 2013 07:15:33 +0000 (15:15 +0800)]
add tests for read-request-line, etc.

* test-suite/web/web-http.test ("read-request-line"):
  ("write-request-line", "read-response-line", "write-response-line"):
  Add.

11 years agominor tweaks to web documentation
Daniel Hartwig [Sat, 16 Mar 2013 09:53:53 +0000 (17:53 +0800)]
minor tweaks to web documentation

* doc/ref/web.texi: Say `World Wide Web'; the hyphenated form is almost
  never used (c.f. w3.org).

  General predicate arguments are named `obj'.  Fill in arguments
  omitted from some procedure definitions (e.g. `request-method').

  Minor tweaks, such as using en-dash and missing markup as appropriate.
  Wrap very long deffn lines.

* module/web/*.scm: Expand texinfo markup in doc strings.  Synchronize
  with changes in web.texi.

11 years agomore NEWS
Andy Wingo [Fri, 15 Mar 2013 21:21:34 +0000 (22:21 +0100)]
more NEWS

* NEWS: Update.

11 years agoincremental NEWS work
Andy Wingo [Fri, 15 Mar 2013 20:13:27 +0000 (21:13 +0100)]
incremental NEWS work

* NEWS: Checkpoint.

11 years agofix doc build
Andy Wingo [Fri, 15 Mar 2013 18:22:18 +0000 (19:22 +0100)]
fix doc build

* doc/ref/api-data.texi (Bitwise Operations): Don't use @-commands in
  @math.  Fixes doc build.
* doc/ref/api-macros.texi (Syntax Rules): Fix example result.

11 years agovery beginnings of NEWS
Andy Wingo [Wed, 13 Mar 2013 22:22:34 +0000 (23:22 +0100)]
very beginnings of NEWS

* NEWS: A very very very rough start at 2.0.8 news

11 years agoadd #:resolve-syntax-parameters? kwarg to syntax-local-binding
Andy Wingo [Wed, 13 Mar 2013 10:41:01 +0000 (11:41 +0100)]
add #:resolve-syntax-parameters? kwarg to syntax-local-binding

* doc/ref/api-macros.texi (Syntax Transformer Helpers): Document.

* module/ice-9/psyntax.scm (syntax-local-binding): Add
  #:resolve-syntax-parameters? kwarg.  Fixes bug 10991.
* module/ice-9/psyntax-pp.scm: Regenerate.

* test-suite/tests/syncase.test ("syntax-local-binding"): Add test.

11 years agoallow for spurious wakeups from pthread_cond_wait
Andy Wingo [Wed, 13 Mar 2013 10:01:38 +0000 (11:01 +0100)]
allow for spurious wakeups from pthread_cond_wait

* libguile/threads.c (scm_call_with_new_thread, scm_spawn_thread): Allow
  for spurious wakeups while waiting on cond variables.  Should fix bug
  10641.

11 years agofailing to load module in psyntax indicates an identifier is not macro
Andy Wingo [Tue, 12 Mar 2013 21:07:50 +0000 (22:07 +0100)]
failing to load module in psyntax indicates an identifier is not macro

* module/ice-9/boot-9.scm (false-if-exception): Add optional #:warning
  TEMPLATE ARG... tail, which indicates that we should print a warning
  on failure.
  (load-in-vicinity): Use the new #:warning.
  (make-autoload-interface): Surround the bits that load modules with a
  false-if-exception with #:warning.  Fixes
  http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12202.

* test-suite/tests/syncase.test ("missing autoloads do not foil
  psyntax"): Add a test.

11 years agoReimplement 'inexact->exact' to avoid mpq functions.
Mark H Weaver [Mon, 4 Mar 2013 23:42:27 +0000 (18:42 -0500)]
Reimplement 'inexact->exact' to avoid mpq functions.

* libguile/numbers.c (scm_inexact_to_exact): Implement conversion of a
  double to an exact rational without using the mpq functions.

* test-suite/tests/numbers.test (dbl-mant-dig): Simplify initializer.
  (dbl-epsilon, dbl-min-exp): New variables.
  ("inexact->exact"): Add tests.  Fix broken "2.0**i to exact and back"
  test, and change it to "2.0**i to exact", to avoid use of
  'exact->inexact'.

11 years agoOptimize logarithms using scm_i_big2dbl_2exp
Mark H Weaver [Sun, 3 Mar 2013 10:02:53 +0000 (05:02 -0500)]
Optimize logarithms using scm_i_big2dbl_2exp

* libguile/numbers.c (log_of_exact_integer_with_size): Removed.

  (log_of_exact_integer): Handle bignums too large to fit in a double
  using 'scm_i_big2dbl_2exp' instead of 'scm_integer_length' and
  'scm_ash'.

  (log_of_fraction): Use 'log_of_exact_integer' instead of
  'log_of_exact_integer_with_size'.

11 years agoSimplify and improve scm_i_big2dbl, and add scm_i_big2dbl_2exp
Mark H Weaver [Sun, 3 Mar 2013 09:58:55 +0000 (04:58 -0500)]
Simplify and improve scm_i_big2dbl, and add scm_i_big2dbl_2exp

* libguile/numbers.c (scm_i_big2dbl_2exp): New static function.
  (scm_i_big2dbl): Reimplement in terms of 'scm_i_big2dbl_2exp',
  with proper rounding.

* test-suite/tests/numbers.test ("exact->inexact"): Add tests.

11 years agoAdd 'round-ash', a rounding arithmetic shift operator
Mark H Weaver [Sun, 3 Mar 2013 09:35:09 +0000 (04:35 -0500)]
Add 'round-ash', a rounding arithmetic shift operator

* libguile/numbers.c (left_shift_exact_integer,
  floor_right_shift_exact_integer, round_right_shift_exact_integer): New
  static functions.

  (scm_round_ash): New procedure.

  (scm_ash): Reimplement in terms of 'left_shift_exact_integer' and
  'floor_right_shift_exact_integer'.

* libguile/numbers.h: Add prototype for scm_round_ash.  Rename the
  second argument of 'scm_ash' from 'cnt' to 'count'.

* test-suite/tests/numbers.test (round-ash, ash): Add new unified
  testing framework for 'ash' and 'round-ash'.  Previously, the tests
  for 'ash' were not very comprehensive; for example, they did not
  include a single test where the number to be shifted was a bignum.

* doc/ref/api-data.texi (Bitwise Operations): Add documentation for
  'round-ash'.  Improve documentation for `ash'.

11 years agoOptimize and simplify fractions code.
Mark H Weaver [Sun, 3 Mar 2013 09:34:50 +0000 (04:34 -0500)]
Optimize and simplify fractions code.

* libguile/numbers.c (scm_exact_integer_quotient,
  scm_i_make_ratio_already_reduced): New static functions.

  (scm_i_make_ratio): Rewrite in terms of
  'scm_i_make_ratio_already_reduced'.

  (scm_integer_expt): Optimize fraction case.

  (scm_abs, scm_magnitude, scm_difference, do_divide): Use
  'scm_i_make_ratio_already_reduced'.

* test-suite/tests/numbers.test (expt, integer-expt): Add tests.

11 years agoAdd standalone test for smob marking
Mike Gran [Mon, 11 Mar 2013 02:43:38 +0000 (19:43 -0700)]
Add standalone test for smob marking

* test-suite/standalone/Makefile.am (TESTS, check_PROGRAMS): add test-smob-mark
  (test_smob_mark_SOURCES, test_smob_mark_CFLAGS, test_smob_mark_LDADD): new variables
* test-suite/standalone/test-smob-mark.c: new file

11 years agorely on gnulib for `poll'
Jason Earl [Sun, 10 Mar 2013 22:44:23 +0000 (23:44 +0100)]
rely on gnulib for `poll'

* configure.ac:
* libguile/fports.c (fport_input_waiting):
* libguile/poll.c (scm_primitive_poll): Rely on gnulib to provide poll
  for us.

11 years agoimport `poll' from gnulib
Jason Earl [Sun, 10 Mar 2013 22:40:13 +0000 (23:40 +0100)]
import `poll' from gnulib

* lib/Makefile.am:
* lib/poll.c:
* lib/poll.in.h:
* m4/gnulib-cache.m4:
* m4/gnulib-comp.m4:
* m4/poll.m4:
* m4/poll_h.m4: Add poll gnulib module.

11 years agoguile.m4 allows selection of guile 2.0, 1.8, etc.
Andy Wingo [Fri, 30 Mar 2012 18:04:16 +0000 (20:04 +0200)]
guile.m4 allows selection of guile 2.0, 1.8, etc.

* meta/guile.m4 (GUILE_PKG): New macro, chooses a version of Guile
  against which to compile.
  (GUILE_FLAGS, GUILE_PROGS): Rewrite to call GUILE_PKG as necessary, to
  respect any previous call to GUILE_PKG, and to not require
  guile-tools.

11 years agoadd %site-ccache-dir
Jason Earl [Sun, 10 Mar 2013 22:20:22 +0000 (23:20 +0100)]
add %site-ccache-dir

* libguile/load.h:
* libguile/load.c (scm_sys_site_ccache_dir): New procedure.

* doc/ref/scheme-using.texi (Installing Site Packages):
* doc/ref/api-options.texi (Build Config): Add docs.

Fixes bug 10326.

11 years agoexcise use of "iff" in the manual
Jason Earl [Sun, 10 Mar 2013 21:29:18 +0000 (22:29 +0100)]
excise use of "iff" in the manual

* doc/ref/api-compound.texi:
* doc/ref/api-control.texi:
* doc/ref/api-data.texi:
* doc/ref/api-macros.texi:
* doc/ref/api-modules.texi:
* doc/ref/api-procedures.texi:
* doc/ref/api-scheduling.texi:
* doc/ref/api-smobs.texi:
* doc/ref/api-undocumented.texi:
* doc/ref/api-utility.texi:
* doc/ref/compiler.texi:
* doc/ref/intro.texi:
* doc/ref/scheme-using.texi:
* doc/ref/sxml.texi:
* doc/ref/web.texi: Change uses of "iff" to "if, otherwise".  Fixes bug
  10302.

11 years agofix AC_CHECK_DECLS for `alarm'
Jason Earl [Sun, 10 Mar 2013 19:20:49 +0000 (20:20 +0100)]
fix AC_CHECK_DECLS for `alarm'

* configure.ac: Fix decl check for `alarm'.

11 years agouse chmod portably in (system base compile)
Jason Earl [Sun, 10 Mar 2013 19:12:05 +0000 (20:12 +0100)]
use chmod portably in (system base compile)

* module/system/base/compile.scm (call-with-output-file/atomic): Call
  chmod with the file name instead of the port.

11 years agofix response-body-port for responses without content-length
Jason Earl [Sun, 10 Mar 2013 18:23:31 +0000 (19:23 +0100)]
fix response-body-port for responses without content-length

* module/web/response.scm (response-body-port): Correctly handle cases
  in which EOF terminates the body.

11 years agoprovide getlogin declaration if needed.
Andy Wingo [Sat, 9 Mar 2013 22:55:01 +0000 (23:55 +0100)]
provide getlogin declaration if needed.

* configure.ac: Check for getlogin decl.
* libguile/posix.c: Declare getlogin if needed.

11 years agofix mingw issues with posix.c
Andy Wingo [Sat, 9 Mar 2013 22:12:51 +0000 (23:12 +0100)]
fix mingw issues with posix.c

* libguile/posix.c (scm_execl, scm_execlp, scm_execle)
  (scm_open_process): Remove casts for ancient mingw.
  (scm_utime): If we fall back to utime, assert that flags is 0.
  (scm_getlogin): Rely on gnulib.

11 years agoadd getlogin from gnulib
Andy Wingo [Sat, 9 Mar 2013 22:09:36 +0000 (23:09 +0100)]
add getlogin from gnulib

* lib/Makefile.am:
* lib/getlogin.c:
* m4/getlogin.m4:
* m4/gnulib-cache.m4: Add getlogin module.

11 years agodon't provide scm_std_select on mingw and similar platforms
Andy Wingo [Sat, 9 Mar 2013 21:45:33 +0000 (22:45 +0100)]
don't provide scm_std_select on mingw and similar platforms

* libguile/iselect.h: If we do not have sys/select.h, don't provide
  scm_std_select, SELECT_TYPE, FD_SET, FD_ZERO, FD_ISSET, or FD_CLR.
  Guile should not be setting these macros in public API.  This is an
  incompatible change on mingw, but oh well.

* libguile/threads.c: Rely on gnulib's select, and use that to implement
  scm_std_select.

* libguile/deprecated.h:
* libguile/deprecated.c: Only provide scm_internal_select if we have
  sys/select.h.

11 years agosimplify posix.c
Andy Wingo [Sat, 9 Mar 2013 21:42:17 +0000 (22:42 +0100)]
simplify posix.c

* libguile/posix.c: Reorder includes to fix mingw include-order
  problem.  Remove ttyname shims; gnulib is the place to fix that.
  Remove winsock2 include, as gnulib seems to handle that OK.  Rely on
  the new pipe-posix gnulib module.  Don't bother shimming getlogin, etc
  on mingw; gnulib is the place for shims.

11 years agosimplify readline.c
Andy Wingo [Sat, 9 Mar 2013 21:40:18 +0000 (22:40 +0100)]
simplify readline.c

* guile-readline/readline.c: Remove all mingw special-casing, relying
  instead on mingw / gnulib doing the right thing.

11 years agosimplify stime back-compat shims for tzname
Andy Wingo [Sat, 9 Mar 2013 21:39:27 +0000 (22:39 +0100)]
simplify stime back-compat shims for tzname

* libguile/stime.c: Remove tzname declarations for ancient mingw and SGI
  RS6000.

11 years agomingw include order for socket.c
Andy Wingo [Sat, 9 Mar 2013 21:38:21 +0000 (22:38 +0100)]
mingw include order for socket.c

* libguile/socket.c: Reorder includes to fix include order on mingw.

11 years agofix include-order problem in net_db.c for mingw
Andy Wingo [Sat, 9 Mar 2013 21:37:29 +0000 (22:37 +0100)]
fix include-order problem in net_db.c for mingw

* libguile/net_db.c: Reorder includes to avoid include-order problem on
  mingw.