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

11 years agosilence mingw32 warning in i18n.c
Andy Wingo [Sat, 9 Mar 2013 21:34:06 +0000 (22:34 +0100)]
silence mingw32 warning in i18n.c

* libguile/i18n.c (scm_make_locale): Silence a warning.

11 years agofports uses gnulib's select
Andy Wingo [Sat, 9 Mar 2013 21:33:24 +0000 (22:33 +0100)]
fports uses gnulib's select

* libguile/fports.c: Reorder includes to put system includes first;
  fixes windows/winsock2 include error problem.  Rely on Gnulib's
  select module.
  (fport_input_waiting): Use select instead of scm_std_select.

11 years agosimplify filesys.c via gnulib's select and fstat modules
Andy Wingo [Sat, 9 Mar 2013 21:30:26 +0000 (22:30 +0100)]
simplify filesys.c via gnulib's select and fstat modules

* libguile/filesys.c: Instead of using scm_std_select, just use select,
  relying on gnulib to provide it to us.  Likewise, rely on fstat.

11 years agoif we have threads on windows, we have pthreads; inform bdw-gc of that
Andy Wingo [Sat, 9 Mar 2013 21:27:59 +0000 (22:27 +0100)]
if we have threads on windows, we have pthreads; inform bdw-gc of that

* libguile/bdw-gc.h: If we have threads enabled on mingw32, explicitly
  mark GC_WIN32_PTHREADS.  See
  http://thread.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/5564
  for more info.

11 years agoremove init.c iselect include
Andy Wingo [Sat, 9 Mar 2013 21:26:16 +0000 (22:26 +0100)]
remove init.c iselect include

* libguile/init.c: Remove iselect include.

11 years agoportability simplification with scmsigs.c and alarm
Andy Wingo [Sat, 9 Mar 2013 21:25:35 +0000 (22:25 +0100)]
portability simplification with scmsigs.c and alarm

* configure.ac (alarm): Check for decl.
* libguile/scmsigs.c: Reorder includes to put system includes first.
  Fixes include order on mingw.  Remove #define for alarm, as we will
  use HAVE_DECL_ALARM.  Remove #defines for sleep and usleep, as they
  are not used.
  (scm_alarm): Only define if HAVE_DECL_ALARM.

11 years agoadd gnulib fstat module explicitly
Andy Wingo [Sat, 9 Mar 2013 20:06:07 +0000 (21:06 +0100)]
add gnulib fstat module explicitly

* lib/Makefile.am:
* m4/gnulib-cache.m4: Explicitly add fstat module.

11 years agoImport `pipe-posix' module from gnulib.
Andy Wingo [Sat, 9 Mar 2013 18:08:51 +0000 (19:08 +0100)]
Import `pipe-posix' module from gnulib.

* lib/Makefile.am:
* lib/pipe.c:
* m4/gnulib-cache.m4:
* m4/gnulib-comp.m4:
* m4/pipe.m4: Add pipe-posix module.

11 years agosquish remove some mingw-specific code that is covered by gnulib
Andy Wingo [Sat, 9 Mar 2013 15:39:47 +0000 (16:39 +0100)]
squish remove some mingw-specific code that is covered by gnulib

* libguile/socket.c (scm_init_socket): Remove mingw-specific code.

* libguile/fports.c: Remove ftruncate redefine; mingw is fine.
  (scm_i_fdes_to_port): If we have no F_GETFL, just do an fstat.  The
  right place for an F_GETFL replacement would be in gnulib.
  (fport_input_waiting): Remove an outdated comment.

* libguile/error.c (SCM_I_STRERROR, SCM_I_ERRNO): Remove, replacing uses
  with strerror and errno.

* libguile/win32-socket.c:
* libguile/win32-socket.h: Remove.  Mingw has suitable replacements.

* configure.ac:
* libguile/Makefile.am (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
  (noinst_HEADERS): Update for win32-socket removal.

11 years agoremove mingw32 implementations of {get,end,set}{serv,proto}ent
Andy Wingo [Sat, 9 Mar 2013 14:56:30 +0000 (15:56 +0100)]
remove mingw32 implementations of {get,end,set}{serv,proto}ent

* libguile/win32-socket.h:
* libguile/win32-socket.c (getservent, endservent, setservent)
  (getprotoent, endprotoent, setprotoent): Remove mingw32 wrappers.
  Their place is in gnulib, if anywhere.

11 years agoadd check for struct pollfd
Andy Wingo [Sat, 9 Mar 2013 10:56:46 +0000 (11:56 +0100)]
add check for struct pollfd

* configure.ac: Add check for struct pollfd.

* libguile/fports.c (fport_input_waiting):
* libguile/poll.c (scm_primitive_poll): Require struct pollfd.  Fixes
  bug 13903.

11 years agoallow case-lambda expressions with no clauses
Andy Wingo [Sat, 2 Mar 2013 18:04:47 +0000 (19:04 +0100)]
allow case-lambda expressions with no clauses

* module/ice-9/psyntax-pp.scm:
* module/ice-9/psyntax.scm (case-lambda, case-lambda*): Allow 0
  clauses.

* module/language/scheme/decompile-tree-il.scm (do-decompile):
  (choose-output-names):
* module/language/tree-il.scm (unparse-tree-il):
  (tree-il-fold, post-order!, pre-order!):
* module/language/tree-il/effects.scm (make-effects-analyzer):
* module/language/tree-il/cse.scm (cse):
* module/language/tree-il/debug.scm (verify-tree-il):
* module/language/tree-il/peval.scm (peval): Allow for lambda-body to be
  #f.

* libguile/memoize.c (memoize):
* module/language/tree-il/canonicalize.scm (canonicalize!): Give a body
  to empty case-lambda before evaluating it or compiling it,
  respectively.

* test-suite/tests/optargs.test ("case-lambda", "case-lambda*"): Add
  tests.

11 years agofix in-tree guile reference
Andy Wingo [Sat, 9 Mar 2013 09:29:57 +0000 (10:29 +0100)]
fix in-tree guile reference

* meta/guile.in (GUILE): Add @EXEEXT@ for libguile/guile reference, for
  MinGW compiles.

11 years agoImprove standards conformance of string->number.
Mark H Weaver [Wed, 6 Mar 2013 17:52:39 +0000 (12:52 -0500)]
Improve standards conformance of string->number.

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

* libguile/numbers.c (mem2ureal): New argument 'allow_inf_or_nan'.
  Accept infinities and NaNs only if 'allow_inf_or_nan' is true and "#e"
  is not present.  Check for "inf.0" or "nan." case-insensitively.  Do
  not accept rationals with zero divisors.

  (mem2complex): Pass new 'allow_inf_or_nan' argument to 'mem2ureal',
  which is set if and only if a explicit sign was present.

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

11 years agoadd GUILE_STACK_SIZE environment variable
Stefan Israelsson Tampe [Wed, 12 Dec 2012 16:37:44 +0000 (17:37 +0100)]
add GUILE_STACK_SIZE environment variable

* libguile/vm.c (initialize_default_stack_size): New helper.
  (scm_bootstrap_vm): Call initialize_default_stack_size.

* doc/ref/guile-invoke.texi (Environment Variables): Add docs.

Based on a patch by Stefan Israelsson Tampe.

11 years agosupport calls and tail-calls with more than 255 formals
Andy Wingo [Thu, 7 Mar 2013 12:59:18 +0000 (13:59 +0100)]
support calls and tail-calls with more than 255 formals

* module/language/tree-il/compile-glil.scm (flatten-lambda-case):
  Support calls and tail-calls with more than 255 formals.

* test-suite/tests/tree-il.test ("many args"): Add a test.

11 years ago,option evaluates its right-hand-side
Andy Wingo [Thu, 7 Mar 2013 10:29:01 +0000 (11:29 +0100)]
,option evaluates its right-hand-side

* doc/ref/scheme-using.texi (System Commands): Better documentation for
  ,option.

* module/system/repl/command.scm (option): Evaluate the RHS when setting
  an option.  Fixes bug 13076.

11 years agoGUILE_INSTALL_LOCALE=1 during build
Andy Wingo [Thu, 7 Mar 2013 10:02:33 +0000 (11:02 +0100)]
GUILE_INSTALL_LOCALE=1 during build

* doc/ref/Makefile.am (autoconf-macros.texi):
* libguile/Makefile.am (snarf2checkedtexi):
* module/Makefile.am (ice-9/psyntax-pp.scm.gen, ice-9/psyntax-pp.go):
* test-suite/Makefile.am (GUILE_AUTO_COMPILE):
* test-suite/standalone/Makefile.am (GUILE_INSTALL_LOCALE):
* test-suite/vm/Makefile.am (TESTS_ENVIRONMENT):
* am/guilec (.scm.go): Set GUILE_INSTALL_LOCALE to 1 during the build.
  Fixes bug 12887.

11 years agoInstall the current locale if GUILE_INSTALL_LOCALE is nonzero.
Ludovic Courtès [Tue, 22 Nov 2011 11:11:48 +0000 (12:11 +0100)]
Install the current locale if GUILE_INSTALL_LOCALE is nonzero.

* libguile/guile.c (get_integer_from_environment)
  (should_install_locale): New functions.
  (main): Add `setlocale' call.

* doc/ref/guile-invoke.texi (Environment Variables): Add documentation.

11 years agostructs with tail arrays are not simple
Andy Wingo [Tue, 5 Mar 2013 17:22:11 +0000 (18:22 +0100)]
structs with tail arrays are not simple

* libguile/struct.h (SCM_VTABLE_FLAG_SIMPLE, SCM_VTABLE_FLAG_SIMPLE_RW):
* libguile/struct.c (set_vtable_layout_flags): Vtable whose layouts
  include a tail array are not simple.  Fixes bug 12808.

11 years agofix compilation under mingw
Andy Wingo [Tue, 5 Mar 2013 13:42:32 +0000 (14:42 +0100)]
fix compilation under mingw

* libguile/load.c (is_absolute_file_name, search_path): Fix compilation
  under mingw.

11 years agoMake `SCM_LONG_BIT' usable in preprocessor conditionals.
Ludovic Courtès [Wed, 6 Mar 2013 23:05:23 +0000 (00:05 +0100)]
Make `SCM_LONG_BIT' usable in preprocessor conditionals.

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

* libguile/__scm.h (SCM_LONG_BIT)[!defined LONG_BIT]: Use
  SCM_SIZEOF_LONG since `sizeof' cannot be used in #if directives as
  found in numbers.c.

11 years agoUse `scm_is_eq' in load.c.
Ludovic Courtès [Wed, 6 Mar 2013 23:03:36 +0000 (00:03 +0100)]
Use `scm_is_eq' in load.c.

* libguile/load.c (is_file_name_separator): Use `scm_is_eq' instead of `=='.

11 years agodoc: Allow compilation of r5rs.texi with Texinfo 5.0.
Ludovic Courtès [Mon, 4 Mar 2013 20:24:52 +0000 (21:24 +0100)]
doc: Allow compilation of r5rs.texi with Texinfo 5.0.

* doc/r5rs/r5rs.texi: Remove extraneous @author.  Change @unnumbered to
  @majorheading within @titlepage.

11 years agoVerify that FLT_RADIX is 2.
Mark H Weaver [Mon, 4 Mar 2013 23:37:23 +0000 (18:37 -0500)]
Verify that FLT_RADIX is 2.

* libguile/numbers.c: Trigger a compilation error if FLT_RADIX is not 2.
  This has long been assumed by code in numbers.c.

11 years agoImprove code in scm_gcd for inum/inum case
Mark H Weaver [Sun, 3 Mar 2013 09:34:17 +0000 (04:34 -0500)]
Improve code in scm_gcd for inum/inum case

* libguile/numbers.c (scm_gcd): Improve implementation of inum/inum case
  to be more clear and efficient.