bpt/guile.git
11 years agoBump version number for 2.0.8.
Ludovic Courtès [Tue, 9 Apr 2013 20:51:48 +0000 (22:51 +0200)]
Bump version number for 2.0.8.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
  (LIBGUILE_INTERFACE_CURRENT): Increment, to account for new C
  functions `scm_c_bind_keyword_arguments' et al.
  (LIBGUILE_INTERFACE_AGE): Increment.

11 years agotests: Skip FFI tests involving `scm_is_pair' when `dynamic-func' fails.
Ludovic Courtès [Tue, 9 Apr 2013 20:37:06 +0000 (22:37 +0200)]
tests: Skip FFI tests involving `scm_is_pair' when `dynamic-func' fails.

* test-suite/tests/foreign.test ("make-pointer")["equal? modulo
  finalizer", "equal? modulo finalizer (set-pointer-finalizer!)"]: Wrap
  `dynamic-func' in `false-if-exception' (static builds on NetBSD 5.1
  raise "Symbol not found" here.)

11 years agodoc: Cosmetic change for `release.org'.
Ludovic Courtès [Tue, 9 Apr 2013 19:48:58 +0000 (21:48 +0200)]
doc: Cosmetic change for `release.org'.

* doc/release.org: Add #+STARTUP.

11 years agoUpdate `THANKS'.
Ludovic Courtès [Tue, 9 Apr 2013 19:48:04 +0000 (21:48 +0200)]
Update `THANKS'.

11 years agoupdate NEWS
Andy Wingo [Tue, 9 Apr 2013 20:45:35 +0000 (22:45 +0200)]
update NEWS

* NEWS: Updates.

11 years agofix stime patch for HAVE_TIMES removal
Andy Wingo [Tue, 9 Apr 2013 20:12:28 +0000 (22:12 +0200)]
fix stime patch for HAVE_TIMES removal

* libguile/stime.c (scm_init_stime): Fix previous patch.  At this point
  in the source, we definitely have a run-time function, but don't
  necessarily have a real-time function.

11 years agosimplify configure checks for functionality provided by gnulib
Andy Wingo [Tue, 9 Apr 2013 19:58:30 +0000 (21:58 +0200)]
simplify configure checks for functionality provided by gnulib

* configure.ac: Remove checks for pipe, stftime, times, and select, as
  our Gnulib modules already ensure they are provided.

* libguile/stime.c: Rely on gnulib providing `times'.

11 years agoMinor 'THANKS' fix.
Mark H Weaver [Tue, 9 Apr 2013 19:24:18 +0000 (15:24 -0400)]
Minor 'THANKS' fix.

11 years agoFix alignment in 'THANKS'.
Mark H Weaver [Tue, 9 Apr 2013 19:23:20 +0000 (15:23 -0400)]
Fix alignment in 'THANKS'.

11 years agoUpdate bug report section of 'THANKS'.
Mark H Weaver [Tue, 9 Apr 2013 19:21:12 +0000 (15:21 -0400)]
Update bug report section of 'THANKS'.

11 years agoUpdate 'THANKS'.
Mark H Weaver [Tue, 9 Apr 2013 18:07:14 +0000 (14:07 -0400)]
Update 'THANKS'.

11 years agoManual: Don't promise to signal an error for an illegal 'letrec'.
Mark H Weaver [Tue, 9 Apr 2013 17:54:39 +0000 (13:54 -0400)]
Manual: Don't promise to signal an error for an illegal 'letrec'.

Reported by Nikita Karetnikov <nikita@karetnikov.org>.

* doc/ref/api-binding.texi (Local Bindings): Remove the incorrect claim
  that improperly accessing a letrec-bound variable during evaluation of
  its initializers will necessarily cause an error to be signalled.

11 years agotests: Skip IPv6 socket tests when OS support is missing.
Ludovic Courtès [Tue, 9 Apr 2013 06:49:06 +0000 (08:49 +0200)]
tests: Skip IPv6 socket tests when OS support is missing.

Reported by Samuel Thibault <samuel.thibault@gnu.org>
and Peter Simons <simons@cryp.to>.

* test-suite/tests/00-socket.test ("AF_INET6/SOCK_STREAM"): Throw
  `unresolved' when `bind' throws EADDRNOTAVAIL.

11 years agoUpdate 'NEWS'.
Mark H Weaver [Mon, 8 Apr 2013 14:15:12 +0000 (10:15 -0400)]
Update 'NEWS'.

11 years agoUpdate 'NEWS'.
Mark H Weaver [Mon, 8 Apr 2013 12:58:00 +0000 (08:58 -0400)]
Update 'NEWS'.

11 years agoConsume a peeked EOF at the REPL.
Mark H Weaver [Mon, 8 Apr 2013 12:44:02 +0000 (08:44 -0400)]
Consume a peeked EOF at the REPL.

* module/system/repl/repl.scm (meta-reader): Consume peeked EOF.

11 years agoMiscellaneous 'sendfile' fixes and improved tests.
Mark H Weaver [Mon, 8 Apr 2013 04:36:00 +0000 (00:36 -0400)]
Miscellaneous 'sendfile' fixes and improved tests.

* libguile/filesys.c (scm_sendfile): In Linux-style sendfile(2) code, if
  EINTR or EAGAIN occurs, set result to 1 (not 0) so that we actually
  keep going.  In non-sendfile(2) code, deal gracefully with short reads
  due to EOF.

* test-suite/tests/filesys.test ("sendfile"): Use 'let*' to guarantee
  the needed order of operations: write (test-file) and then read it.
  Add code to check the written data (not just the returned length) in
  all tests, including the cases that hit EOF prematurely.

11 years agoUpdate 'NEWS'.
Mark H Weaver [Sun, 7 Apr 2013 21:47:44 +0000 (17:47 -0400)]
Update 'NEWS'.

11 years agoChange `sendfile' to loop until everything has been sent.
Ludovic Courtès [Sun, 7 Apr 2013 21:43:21 +0000 (23:43 +0200)]
Change `sendfile' to loop until everything has been sent.

* libguile/filesys.c (scm_sendfile)[HAVE_SYS_SENDFILE_H &&
  HAVE_SENDFILE]: Compare RESULT with C_COUNT.  Loop until C_COUNT bytes
  have been sent.
* doc/ref/posix.texi (File System): Update the description.  Explain the
  new semantics.
* test-suite/tests/filesys.test ("sendfile"): Rewrite using
  `pass-if-equal'.  Check the return value for all the tests.
  ["file with offset past the end", "file with offset near the end"]:
  New tests.

11 years agoRemove outdated and misplaced "Included Guile Modules" node from manual.
Mark H Weaver [Sun, 7 Apr 2013 19:45:38 +0000 (15:45 -0400)]
Remove outdated and misplaced "Included Guile Modules" node from manual.

* doc/ref/api-modules.texi (Included Guile Modules): Remove.
  (Using Guile Modules): Fix cross reference.

11 years agoClarify 'file-encoding' docs: heuristics may be improved later.
Mark H Weaver [Sun, 7 Apr 2013 16:07:33 +0000 (12:07 -0400)]
Clarify 'file-encoding' docs: heuristics may be improved later.

* doc/ref/api-evaluation.texi (Character Encoding of Source Files):
  Mention UTF-8 as another common encoding used for Scheme source files,
  and that it is used by default.  Change the description to leave open
  the possibility of adding additional heuristics in the future.
  Mention that if the coding declaration is in a #!-style block comment,
  it must be the first such comment in the file.  Mention the
  '#:guess-encoding' keyword argument.

11 years agoAdd keyword arguments to file opening procedures.
Mark H Weaver [Sun, 7 Apr 2013 03:19:55 +0000 (23:19 -0400)]
Add keyword arguments to file opening procedures.

* libguile/fports.c (scm_open_file_with_encoding): New API function,
  containing the code previously found in 'scm_open_file', but modified
  to accept the new 'guess_encoding' and 'encoding' arguments.

  (scm_open_file): Now just a simple wrapper that calls
  'scm_open_file_with_encoding'.

  (scm_i_open_file): New implementation of 'open-file' that accepts
  keyword arguments '#:guess-encoding' and '#:encoding', and calls
  'scm_open_file_with_encoding'.

  (scm_init_fports_keywords): New initialization function that gets
  called after keywords are initialized.

* libguile/fports.h (scm_open_file_with_encoding,
  scm_init_fports_keywords): Add prototypes.

* libguile/init.c (scm_i_init_guile): Call 'scm_init_fports_keywords'.

* module/ice-9/boot-9.scm: Add enhanced versions of 'open-input-file',
  'open-output-file', 'call-with-input-file', 'call-with-output-file',
  'with-input-from-file', 'with-output-to-file', and
  'with-error-to-file', that accept keyword arguments '#:binary',
  '#:encoding', and (for input port constructors) '#:guess-encoding'.

* doc/ref/api-io.texi (File Ports): Update documentation.

* test-suite/tests/ports.test ("keyword arguments for file openers"):
  Add tests.

11 years agoAdd record type printer for srfi-41.
Chris K. Jester-Young [Sun, 7 Apr 2013 16:44:18 +0000 (12:44 -0400)]
Add record type printer for srfi-41.

* module/srfi/srfi-41.scm: Add record type printer for streams.
  (stream-promise-visit): New helper for visiting stream promises.

11 years agoAdd record type printer for srfi-45.
Chris K. Jester-Young [Sun, 7 Apr 2013 16:43:17 +0000 (12:43 -0400)]
Add record type printer for srfi-45.

* module/srfi/srfi-45.scm: Add record type printer for promises.
  (promise-visit): New helper for visiting lazy promises.

11 years agoImplement efficient 'scm_unget_bytes' and 'unget-bytevector'.
Mark H Weaver [Sat, 6 Apr 2013 05:42:45 +0000 (01:42 -0400)]
Implement efficient 'scm_unget_bytes' and 'unget-bytevector'.

* libguile/ports.c (scm_i_unget_bytes): New static function.
  (scm_unget_bytes): New API function.
  (scm_unget_byte): Rewrite to simply call 'scm_i_unget_bytes'.
  (scm_ungetc, scm_peek_char, looking_at_bytes): Use 'scm_i_unget_bytes'.

* libguile/ports.h: Add prototype for 'scm_unget_bytes'.

* libguile/fports.c (scm_setvbuf): Use 'scm_unget_bytes'.

* libguile/r6rs-ports.c (scm_unget_bytevector): New procedure.

* module/ice-9/binary-ports.scm (unget-bytevector): New export.

* doc/ref/api-io.texi (R6RS Binary Input): Add documentation.
  (R6RS I/O Ports): Update brief description of (ice-9 binary-ports) to
  reflect the new reality: it is no longer a subset of (rnrs io ports).

* test-suite/tests/ports.test ("unget-bytevector"): Add test.

11 years agoRemove byte-order mark check from 'scm_i_scan_for_encoding'.
Mark H Weaver [Fri, 5 Apr 2013 21:33:03 +0000 (17:33 -0400)]
Remove byte-order mark check from 'scm_i_scan_for_encoding'.

* libguile/read.c (scm_i_scan_for_encoding): Remove byte-order mark
  check.

11 years agoDo not scan for coding declarations in open-file.
Mark H Weaver [Wed, 30 Jan 2013 19:45:28 +0000 (14:45 -0500)]
Do not scan for coding declarations in open-file.

* libguile/fports.c (scm_open_file): Do not scan for coding
  declarations.  Replace 'use_encoding' local variable with
  'binary'.  Update documentation string.

* module/ice-9/psyntax.scm (include): Add the same file-encoding
  logic that's used in compile-file and scm_primitive_load.

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

* doc/ref/api-io.texi (File Ports): Update docs.

* test-suite/tests/ports.test: Change "open-file HONORS file coding
  declarations" test to "open-file IGNORES file coding declaration".

* test-suite/tests/coding.test (scan-coding): Use 'file-encoding' to
  scan for the encoding, since 'open-input-file' no longer does so.

11 years agodoc: Link exceptions and escape continuations.
Ludovic Courtès [Sun, 7 Apr 2013 09:51:26 +0000 (11:51 +0200)]
doc: Link exceptions and escape continuations.

* doc/ref/api-control.texi (Prompt Primitives): Mention exceptions.
  (Exception Terminology): Link to `call/ec'.

11 years agodoc: Warn against misuses of `file-name-separator-string'.
Ludovic Courtès [Sun, 7 Apr 2013 09:49:52 +0000 (11:49 +0200)]
doc: Warn against misuses of `file-name-separator-string'.

* doc/ref/posix.texi (File System): Warn against misuses of
  `file-name-separator-string'.

11 years agoDon't use scm_generalized_vector_get_handle() in array-map.c
Daniel Llorens [Sat, 6 Apr 2013 22:04:35 +0000 (00:04 +0200)]
Don't use scm_generalized_vector_get_handle() in array-map.c

* libguile/array-map.c: (rafill, racp, ramap, rafe): use
  scm_array_get_handle() instead of scm_generalized_get_vector_handle().

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
11 years agoFix the recommendations for conversion of C string constants.
Mark H Weaver [Sat, 6 Apr 2013 22:29:15 +0000 (18:29 -0400)]
Fix the recommendations for conversion of C string constants.

* doc/ref/api-data.texi (Conversion to/from C, Symbol Primitives,
  Keyword Procedures): Fix the recommendations for conversion of C
  string constants.  The encoding of the source code is irrelevant in
  modern compilers.  What is relevant is the execution character set.
  Both GCC and clang use UTF-8 by default, so recommend the
  'scm_from_utf8_*' functions when the argument is a C string constant.

  Also fix the broken texinfo markup for 'scm_from_*_symbol' that
  prevented them from being listed in the index.

11 years agoFix indentation in test-scm-c-bind-keyword-arguments.c.
Mark H Weaver [Sat, 6 Apr 2013 22:13:04 +0000 (18:13 -0400)]
Fix indentation in test-scm-c-bind-keyword-arguments.c.

* test-suite/standalone/test-scm-c-bind-keyword-arguments.c
  (test_invalid_keyword): Fix indentation.

11 years agoImplement 'scm_c_bind_keyword_arguments'.
Mark H Weaver [Sat, 6 Apr 2013 17:36:24 +0000 (13:36 -0400)]
Implement 'scm_c_bind_keyword_arguments'.

* libguile/keywords.c (scm_keyword_argument_error): New variable.
  (scm_c_bind_keyword_arguments): New API function.

* libguile/keywords.h (enum scm_keyword_arguments_flags): New enum.
  (scm_t_keyword_arguments_flags): New typedef.
  (scm_c_bind_keyword_arguments): New prototype.

* doc/ref/api-data.texi (Coding With Keywords, Keyword Procedures): Add
  documentation.

* test-suite/standalone/test-scm-c-bind-keyword-arguments.c: New file.

* test-suite/standalone/Makefile.am: Add
  test-scm-c-bind-keyword-arguments test.

11 years agoNEWS tweaks
Andy Wingo [Sat, 6 Apr 2013 20:51:44 +0000 (22:51 +0200)]
NEWS tweaks

* NEWS: Correct some errors.

11 years agoBump 'copyright-year' to 2013.
Mark H Weaver [Sat, 6 Apr 2013 19:49:25 +0000 (15:49 -0400)]
Bump 'copyright-year' to 2013.

* module/ice-9/command-line.scm (version-etc): Bump 'copyright-year' to
  2013.

11 years agoRemove duplicate definitions of `call/ec' and `let/ec'.
Ian Price [Sat, 6 Apr 2013 02:06:25 +0000 (03:06 +0100)]
Remove duplicate definitions of `call/ec' and `let/ec'.

* module/language/tree-il/peval.scm (let/ec): Remove. Import
  (ice-9 control).
* module/sxml/match.scm (%call/ec-prompt, call/ec, let/ec):
  Remove. Import (ice-9 control).

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
11 years agoUpdate `NEWS'.
Ludovic Courtès [Sat, 6 Apr 2013 11:06:52 +0000 (13:06 +0200)]
Update `NEWS'.

11 years agodoc: Document `--language'.
Ludovic Courtès [Sat, 6 Apr 2013 11:06:36 +0000 (13:06 +0200)]
doc: Document `--language'.

* doc/ref/guile-invoke.texi (Command-line Options): Document `--language'.

11 years agodoc: Document file name separator procedures.
Ludovic Courtès [Sat, 6 Apr 2013 10:41:26 +0000 (12:41 +0200)]
doc: Document file name separator procedures.

* doc/ref/posix.texi (File System): Document
  `system-file-name-convention', `file-name-separator?',
  `absolute-file-name?', and `file-name-separator-string'.

11 years agoUse a fresh cons for %stream-null.
Chris K. Jester-Young [Sat, 6 Apr 2013 07:06:37 +0000 (03:06 -0400)]
Use a fresh cons for %stream-null.

* module/srfi/srfi-41.scm (%stream-null): Use a fresh cons rather than
  a literal cons. You never know what peval constant-folding could do
  with the latter, either now or in the future.

11 years agoUpdate `NEWS'.
Ludovic Courtès [Fri, 5 Apr 2013 20:54:02 +0000 (22:54 +0200)]
Update `NEWS'.

11 years agoDeprecate scm_array_fill_int()
Daniel Llorens [Wed, 3 Apr 2013 20:52:21 +0000 (22:52 +0200)]
Deprecate scm_array_fill_int()

* libguile/array-map.h, libgule/array-map.c: move scm_array_fill_int
  to the deprecated section.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
11 years agoRemove double indirection in array-fill!
Daniel Llorens [Wed, 3 Apr 2013 20:40:40 +0000 (22:40 +0200)]
Remove double indirection in array-fill!

* libguile/array-map.c: new function rafill, like scm_array_fill_int,
  but factors GVSET out of the loop. Use it in scm_array_fill_x instead of
  scm_array_fill_int.
* test-suite/tests/arrays.test: add test for array-fill! with stride != 1.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
11 years agoTests for array-copy!
Daniel Llorens [Wed, 3 Apr 2013 20:31:47 +0000 (22:31 +0200)]
Tests for array-copy!

* test-suite/tests/arrays.test: tests for arguments of rank 0, 1 and 2.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
11 years agoAdd `call/ec' and `let/ec'.
Ludovic Courtès [Thu, 4 Apr 2013 06:14:25 +0000 (14:14 +0800)]
Add `call/ec' and `let/ec'.

Based on a patch by Nala Ginrut <nalaginrut@gmail.com>,
with suggestions from Mark H. Weaver.

* module/ice-9/control.scm (call-with-escape-continuation, call/ec): New
  procedures.
  (let-escape-continuation, let/ec): New macros.
* module/ice-9/futures.scm (let/ec): Remove.
* test-suite/tests/control.test ("escape-only continuations")["call/ec",
  "let/ec"]: New tests.
* doc/ref/api-control.texi (Prompt Primitives): Document `call/ec',
  `let/ec', and their long names.

11 years agotests: Add `pass-if-equal' support in `c&e'.
Ludovic Courtès [Fri, 5 Apr 2013 20:28:25 +0000 (22:28 +0200)]
tests: Add `pass-if-equal' support in `c&e'.

* test-suite/test-suite/lib.scm (c&e): Add case for `pass-if-equal'.

11 years agoUse 'c_strcasecmp' instead of 'strcasecmp'.
Mark H Weaver [Fri, 5 Apr 2013 18:04:53 +0000 (14:04 -0400)]
Use 'c_strcasecmp' instead of 'strcasecmp'.

* libguile/ports.c (scm_new_port_table_entry, get_codepoint,
  scm_i_set_default_port_encoding, scm_i_port_iconv_descriptors,
  scm_i_set_port_encoding_x):
* libguile/print.c (display_string_using_iconv):
* libguile/read.c (scm_i_scan_for_encoding): Use 'c_strcasecmp'.

11 years agoImport 'c-strcase' from Gnulib.
Mark H Weaver [Fri, 5 Apr 2013 17:28:38 +0000 (13:28 -0400)]
Import 'c-strcase' from Gnulib.

* lib/Makefile.am:
* m4/gnulib-cache.m4: Add 'c-strcase' Gnulib module.

11 years agoRevert "Add record type printers for srfi-41 and srfi-45."
Chris K. Jester-Young [Fri, 5 Apr 2013 17:31:12 +0000 (13:31 -0400)]
Revert "Add record type printers for srfi-41 and srfi-45."

This reverts commit 4a1cdc9d5d643d05fa7a18febc7c12070f3ef6d9, which was
prematurely pushed.

11 years agoAdd record type printers for srfi-41 and srfi-45.
Chris K. Jester-Young [Fri, 5 Apr 2013 02:18:40 +0000 (22:18 -0400)]
Add record type printers for srfi-41 and srfi-45.

* module/srfi/srfi-41.scm: Add record type printer for streams.
* module/srfi/srfi-45.scm: Add record type printer for promises.

11 years agoImprove handling of Unicode byte-order marks (BOMs).
Mark H Weaver [Wed, 3 Apr 2013 08:22:04 +0000 (04:22 -0400)]
Improve handling of Unicode byte-order marks (BOMs).

* libguile/ports-internal.h (struct scm_port_internal): Add new members
  'at_stream_start_for_bom_read' and 'at_stream_start_for_bom_write'.
  (SCM_UNICODE_BOM): New macro.
  (scm_i_port_iconv_descriptors): Add 'mode' parameter to prototype.

* libguile/ports.c (scm_new_port_table_entry): Initialize
  'at_stream_start_for_bom_read' and 'at_stream_start_for_bom_write'.
  (get_iconv_codepoint): Pass new 'mode' parameter to
  'scm_i_port_iconv_descriptors'.
  (get_codepoint): After reading a codepoint at stream start, record
  that we're no longer at stream start, and consume a BOM where
  appropriate.
  (scm_seek): Set the stream start flags according to the new position.
  (looking_at_bytes): New static function.
  (scm_utf8_bom, scm_utf16be_bom, scm_utf16le_bom, scm_utf32be_bom,
  scm_utf32le_bom): New static const arrays.
  (decide_utf16_encoding, decide_utf32_encoding): New static functions.
  (scm_i_port_iconv_descriptors): Add new 'mode' parameter.  If the
  specified encoding is UTF-16 or UTF-32, make that precise by deciding
  what byte order to use, and construct iconv descriptors based on the
  precise encoding.
  (scm_i_set_port_encoding_x): Record that we are now at stream start.
  Do not open the new iconv descriptors immediately; let them be
  initialized lazily.

* libguile/print.c (display_string_using_iconv): Record that we're no
  longer at stream start.  Write a BOM if appropriate.

* doc/ref/api-io.texi (BOM Handling): New node.

* test-suite/tests/ports.test ("set-port-encoding!, wrong encoding"):
  Adapt test to cope with the fact that 'set-port-encoding!' does not
  immediately open the iconv descriptors.
  (bv-read-test): New procedure.
  ("unicode byte-order marks (BOMs)"): New test prefix.

11 years agoPeeks do not consume EOFs.
Mark H Weaver [Sun, 31 Mar 2013 23:06:51 +0000 (19:06 -0400)]
Peeks do not consume EOFs.

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

* libguile/ports-internal.h (struct scm_port_internal): Add
  'pending_eof' flag.

* libguile/ports.c (scm_i_set_pending_eof, scm_i_clear_pending_eof): New
  static functions.
  (scm_new_port_table_entry): Initialize 'pending_eof'.
  (scm_i_fill_input): Check for 'pending_eof'.
  (scm_i_peek_byte_or_eof): Set 'pending_eof' flag before returning EOF.
  (scm_end_input, scm_unget_byte, scm_seek, scm_truncate): Clear
  'pending_eof'.
  (scm_peek_char): Set 'pending_eof' flag before returning EOF.

* test-suite/tests/ports.test ("pending EOF behavior"): Add tests.

11 years agoNicer docstring syntax for case-lambda.
Mark H Weaver [Thu, 4 Apr 2013 19:22:18 +0000 (15:22 -0400)]
Nicer docstring syntax for case-lambda.

* module/ice-9/psyntax.scm (case-lambda, case-lambda*): Allow a
  docstring to be placed immediately after the 'case-lambda' or
  'case-lambda*'.

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

* doc/ref/api-procedures.texi (Case-lambda): Update docs.

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

11 years agoCross reference 'SRFI-9 Records' directly instead of 'SRFI-9'.
Mark H Weaver [Thu, 4 Apr 2013 07:16:42 +0000 (03:16 -0400)]
Cross reference 'SRFI-9 Records' directly instead of 'SRFI-9'.

* doc/ref/api-compound.texi (Record Overview, Records):
  doc/ref/api-modules.texi (Included Guile Modules):
  doc/ref/r6rs.texi (R6RS Records): Cross reference 'SRFI-9 Records'
  directly instead of 'SRFI-9'.

11 years agoPreserve the case of the user-specified port encoding string.
Mark H Weaver [Wed, 3 Apr 2013 20:00:12 +0000 (16:00 -0400)]
Preserve the case of the user-specified port encoding string.

* libguile/ports.c (scm_i_set_port_encoding_x): Always copy the
  user-provided port encoding string, so that its case will be preserved
  and returned exactly by subsequent calls to 'port-encoding'.

11 years agoRemove double indirection for 1st arg of array-for-each
Daniel Llorens [Tue, 2 Apr 2013 14:43:37 +0000 (16:43 +0200)]
Remove double indirection for 1st arg of array-for-each

* libguile/array-map.c: (rafe): factor GVREF out of rank-1 loop for ra0.

11 years agotests: Add `array-for-each' tests for one-dimensional traversals.
Ludovic Courtès [Wed, 3 Apr 2013 19:34:31 +0000 (21:34 +0200)]
tests: Add `array-for-each' tests for one-dimensional traversals.

* test-suite/tests/ramap.test ("array-for-each")["1 source"]: New test
  prefix.

11 years agotests: Use `pass-if-equal' in ramap.test.
Ludovic Courtès [Wed, 3 Apr 2013 17:13:23 +0000 (19:13 +0200)]
tests: Use `pass-if-equal' in ramap.test.

* test-suite/tests/ramap.test ("array-for-each"): Use `pass-if-equal'
  instead of `(pass-if ... (equal? ...))'.

11 years agoRemove double indirection in array-map! with <2 args
Daniel Llorens [Tue, 2 Apr 2013 13:53:22 +0000 (15:53 +0200)]
Remove double indirection in array-map! with <2 args

* libguile/array-map.c: (ramap): factor GVSET/GVREF out of rank-1 loop
  for ra0 and the first element of ras.

11 years agoAvoid per-element cons for 1-arg case of array-map!
Daniel Llorens [Tue, 2 Apr 2013 13:23:55 +0000 (15:23 +0200)]
Avoid per-element cons for 1-arg case of array-map!

* libguile/array-map.c: (ramap): special case when ras is a 1-element list.

11 years agoDeprecate dead code in array-map.c
Daniel Llorens [Wed, 3 Apr 2013 13:40:48 +0000 (15:40 +0200)]
Deprecate dead code in array-map.c

* libguile/array-map.c, libguile/array-map.h: deprecate scm_ra_eqp,
  scm_ra_lessp, scm_ra_leqp, scm_ra_grp, scm_ra_greqp, scm_ra_sum,
  scm_ra_product, scm_ra_difference, scm_ra_divide, scm_array_identity.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
11 years agoUse 'strcasecmp' to compare encoding names.
Mark H Weaver [Wed, 3 Apr 2013 17:26:01 +0000 (13:26 -0400)]
Use 'strcasecmp' to compare encoding names.

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

* libguile/ports.c (scm_new_port_table_entry,
  scm_i_set_default_port_encoding, scm_i_set_port_encoding_x):
  libguile/read.c (scm_i_scan_for_encoding): Use 'strcasecmp' to compare
  encoding names.

11 years agoRemove double indirection in element access in array-copy!
Daniel Llorens [Mon, 1 Apr 2013 16:43:58 +0000 (18:43 +0200)]
Remove double indirection in element access in array-copy!

* libguile/array-map.c: (racp): factor scm_generalized_vector_ref,
  scm_generalized_vector_set_x out of the rank-1 loop.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
11 years agoRemove BOM tests that depend on GNU iconv behavior.
Mark H Weaver [Wed, 3 Apr 2013 00:47:30 +0000 (20:47 -0400)]
Remove BOM tests that depend on GNU iconv behavior.

* test-suite/tests/ports.test ("unicode byte-order marks (BOMs)"):
  Remove tests that depend on GNU iconv behavior.  We will add them back
  when we have portable BOM support.

11 years agoRename 'scm_i_get_byte_or_eof' et al; mark them as SCM_API.
Mark H Weaver [Tue, 2 Apr 2013 23:35:43 +0000 (19:35 -0400)]
Rename 'scm_i_get_byte_or_eof' et al; mark them as SCM_API.

* libguile/ports.c (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof):
  Rename to 'scm_slow_get_byte_or_eof' and 'scm_slow_peek_byte_or_eof',
  respectively.

* libguile/ports.h (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof):
  Rename to 'scm_slow_get_byte_or_eof' and 'scm_slow_peek_byte_or_eof',
  respectively, and mark them as SCM_API.

* libguile/inline.h (scm_get_byte_or_eof, scm_peek_byte_or_eof): Adjust
  to use the new names.

11 years agoRemove uses of GC_PTR in 'finalize_iconv_descriptors'.
Mark H Weaver [Tue, 2 Apr 2013 22:02:56 +0000 (18:02 -0400)]
Remove uses of GC_PTR in 'finalize_iconv_descriptors'.

* libguile/ports.c (finalize_iconv_descriptors): Change GC_PTR to
  (void *) in parameter types.

11 years agoRewrite get_iconv_codepoint to fix a bug involving byte-order marks.
Mark H Weaver [Tue, 2 Apr 2013 21:26:37 +0000 (17:26 -0400)]
Rewrite get_iconv_codepoint to fix a bug involving byte-order marks.

* libguile/ports.c (get_iconv_codepoint): Rewrite to fix a bug and
  improve efficiency and clarity.  Previously, it incorrectly assumed
  that iconv would never consume input without producing output, which
  led to a buffer overrun and subsequent assertion failure.  This
  happens when a byte-order mark is consumed by iconv at the beginning
  of the stream when using the UTF-16 or UTF-32 encodings.

* test-suite/tests/ports.test (unicode byte-order marks (BOMs)):
  Add tests.

11 years agoMove slow path out of 'scm_get_byte_or_eof' et al.
Mark H Weaver [Tue, 2 Apr 2013 09:33:24 +0000 (05:33 -0400)]
Move slow path out of 'scm_get_byte_or_eof' et al.

Suggested by Andy Wingo.

* libguile/inline.h (scm_get_byte_or_eof, scm_peek_byte_or_eof): Keep
  only the fast path here, with fallback to 'scm_i_get_byte_or_eof' and
  'scm_i_peek_byte_or_eof'.

* libguile/ports.c (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof):
  New internal functions.

* libguile/ports.h (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof): Add
  prototypes.

11 years agoAdd a static version of 'scm_fill_input' to ports.c.
Mark H Weaver [Tue, 2 Apr 2013 17:33:14 +0000 (13:33 -0400)]
Add a static version of 'scm_fill_input' to ports.c.

* libguile/ports.c (scm_i_fill_input): New static function, containing
  the code that was previously in 'scm_fill_input'.
  (scm_fill_input): Simply call 'scm_i_fill_input'.
  (scm_c_read): Use 'scm_i_fill_input'.

11 years agoMove the port alist from the hash table to the internal port structure.
Mark H Weaver [Sun, 31 Mar 2013 23:52:31 +0000 (19:52 -0400)]
Move the port alist from the hash table to the internal port structure.

* libguile/ports-internal.h (struct scm_port_internal): Add 'alist'
  member.

* libguile/ports.c (scm_i_port_alist, scm_i_set_port_alist_x): New
  internal functions.
  (scm_i_port_weak_hash): Update comment: the hash table is no longer
  used to store the port's alist.
  (scm_new_port_table_entry): Initialize 'alist'.  Store SCM_BOOL_F in
  the port weak hash, not SCM_EOL.

* libguile/ports.h (scm_i_port_alist, scm_i_set_port_alist_x): Add
  protoypes.

* libguile/read.c (set_port_read_option, init_read_options): Access the
  port's alist via 'scm_i_port_alist' and 'scm_i_set_port_alist_x'.

11 years agoOptimize 'get-bytevector-some'; it may now read less than possible.
Mark H Weaver [Mon, 1 Apr 2013 01:21:14 +0000 (21:21 -0400)]
Optimize 'get-bytevector-some'; it may now read less than possible.

* libguile/r6rs-ports.c (scm_get_bytevector_some): Rewrite to
  efficiently take the contents of the read/putback buffers.  In the
  docstring, clarify that it might not return all available bytes.

* doc/ref/api-io.texi (R6RS Binary Input): Clarify that
  'get-bytevector-some' might not return all available bytes.

* test-suite/tests/r6rs-ports.test ("get-bytevector-some [only-some]"):
  Remove bogus test, which requires more than the R6RS requires.

11 years agoRefactor port encoding modes: utf-8 and iconv
Mark H Weaver [Sun, 31 Mar 2013 19:23:32 +0000 (15:23 -0400)]
Refactor port encoding modes: utf-8 and iconv

Based on 6c98257f2ead0855f218369ea7f9a823cdb9727e by Andy Wingo.

* libguile/ports-internal.h (struct scm_port_internal): Add a flag
  for the port encoding mode: UTF8 or iconv.  The iconv descriptors
  are now in a separate structure so that we can avoid attaching
  finalizers to the ports themselves in the future.
  (enum scm_port_encoding_mode): New enum.
  (struct scm_iconv_descriptors): New struct.
  (scm_i_port_iconv_descriptors): Add prototype.

* libguile/ports.c (finalize_port): Don't close iconv descriptors here.
  (scm_new_port_table_entry): Adapt to the iconv descriptors being
  moved.  Initialize 'encoding_mode'.
  (scm_i_remove_port): Adapt to call 'close_iconv_descriptors'.
  (close_iconv_descriptors): New static function.
  (get_iconv_codepoint): Use 'scm_i_port_iconv_descriptors'.
  (get_codepoint): Check the port 'encoding_mode'.
  (finalize_iconv_descriptors, open_iconv_descriptors,
  close_iconv_descriptors, scm_i_port_iconv_descriptors): New static
  functions.
  (scm_i_set_port_encoding_x): Adapt to iconv descriptors being moved
  to separate structure, to set the 'encoding_mode' flag, and to use
  'open_iconv_descriptors' and 'close_iconv_descriptors'.

* libguile/print.c (display_string_using_iconv): Use
  'scm_i_port_iconv_descriptors'.
  (display_string): Use 'encoding_mode' flag.

11 years agoAdd internal-only port structure and move iconv descriptors there.
Mark H Weaver [Sun, 31 Mar 2013 02:34:56 +0000 (22:34 -0400)]
Add internal-only port structure and move iconv descriptors there.

* libguile/ports-internal.h: New file.

* libguile/Makefile.am (noinst_HEADERS): Add ports-internal.h.

* libguile/ports.h (scm_t_port): Add a comment mentioning that the
  'input_cd' and 'output_cd' fields of the public structure are no
  longer what they seem to be.

* libguile/ports.c: Include ports-internal.h.

  (finalize_port, scm_i_remove_port, get_iconv_codepoint, get_codepoint,
  scm_i_set_port_encoding_x): Access 'input_cd' and 'output_cd' via the
  new internal port structure.

  (scm_new_port_table_entry): Allocate and initialize the internal port
  structure.

* libguile/print.c: Include ports-internal.h.

  (display_string_using_iconv, display_string): Access 'input_cd' and
  'output_cd' via 'internal' pointer.

11 years agoAdd 'scm_gc_typed_calloc' macro.
Mark H Weaver [Sun, 31 Mar 2013 03:09:01 +0000 (23:09 -0400)]
Add 'scm_gc_typed_calloc' macro.

* libguile/gc.h (scm_gc_typed_calloc): New macro.

11 years agoFix broken texinfo markup in (ice-9 iconv) docs.
Mark H Weaver [Mon, 1 Apr 2013 16:28:25 +0000 (12:28 -0400)]
Fix broken texinfo markup in (ice-9 iconv) docs.

* doc/ref/api-data.texi (Representing Strings as Bytes): Fix broken
  @deffn syntax.

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 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 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 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'.