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

11 years agoImprove error messages for invalid record definitions.
Mark H Weaver [Fri, 9 Nov 2012 08:22:40 +0000 (03:22 -0500)]
Improve error messages for invalid record definitions.

* module/srfi/srfi-9.scm (%define-record-type): Accept additional 'form'
  parameter which contains the original form of 'define-record-type' or
  'define-immutable-record-type'.  Add elaborate pattern guard which
  raises descriptive syntax errors for specific errors, and a fallback
  pattern to catch anything else.
  (define-record-type): Pass 'form' parameter to %define-record-type.

* module/srfi/srfi-9/gnu.scm (define-immutable-record-type): Pass 'form'
  parameter to %define-record-type.

* test-suite/tests/srfi-9.test: Add tests.

11 years agoFix non-toplevel srfi-9 compile-time error tests to actually be non-toplevel.
Mark H Weaver [Sat, 10 Nov 2012 04:02:44 +0000 (23:02 -0500)]
Fix non-toplevel srfi-9 compile-time error tests to actually be non-toplevel.

* test-suite/tests/srfi-9.test: Move non-toplevel record definitions to be
  within the expression passed to 'compile'.

11 years agoUse 'pass-if-equal' to check syntax-error exceptions in srfi-9.test.
Mark H Weaver [Sat, 10 Nov 2012 03:23:46 +0000 (22:23 -0500)]
Use 'pass-if-equal' to check syntax-error exceptions in srfi-9.test.

* test-suite/tests/srfi-9.test: Convert detailed syntax-error exception
  tests to use 'pass-if-equal'.

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

11 years agoFix record constructor in getopt-long.
Mark H Weaver [Fri, 9 Nov 2012 02:53:36 +0000 (21:53 -0500)]
Fix record constructor in getopt-long.

* module/ice-9/getopt-long.scm (%make-option-spec): Fix the formal
  argument list to match the actual fields present.
  (make-option-spec): Update to match the fixed %make-option-spec.

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

11 years agoImplement functional record setters.
Mark H Weaver [Wed, 7 Nov 2012 17:21:44 +0000 (12:21 -0500)]
Implement functional record setters.

Written in collaboration with Ludovic Courtès <ludo@gnu.org>

* module/srfi/srfi-9.scm: Internally, rename 'accessor' to 'getter'
  and 'modifier' to 'setter'.

  (define-tagged-inlinable, getter-type, getter-index, getter-copier,
  %%on-error, %%set-fields): New macros.

  (%define-record-type): New macro for creating both mutable and
  immutable records, and containing a substantially rewritten version of
  the code formerly in 'define-record-type'.

  (define-record-type): Now just a wrapper for '%define-record-type'.

  (throw-bad-struct, make-copier-id): New procedures.

* module/srfi/srfi-9/gnu.scm (define-immutable-record-type, set-field,
  and set-fields): New exported macros.

  (collate-set-field-specs): New procedure.

  (%set-fields-unknown-getter, %set-fields): New macros.

* test-suite/tests/srfi-9.test: Add tests.  Rename getters and setters
  in existing tests to make the functional setters look better.

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

Conflicts:
libguile/validate.h

11 years agoFix invalid assertion about mutex ownership in threads.c.
Ludovic Courtès [Mon, 5 Nov 2012 20:43:13 +0000 (21:43 +0100)]
Fix invalid assertion about mutex ownership in threads.c.

* libguile/threads.c (do_thread_exit): Don't assert m->owner == t->handle
  since that is not the case when MUTEX was abandoned by T.  Reported by Mark
  Weaver and others.

11 years agoHave `SCM_NUM2FLOAT' and `SCM_NUM2DOUBLE' use `scm_to_double'.
Ludovic Courtès [Mon, 5 Nov 2012 18:04:13 +0000 (19:04 +0100)]
Have `SCM_NUM2FLOAT' and `SCM_NUM2DOUBLE' use `scm_to_double'.

* libguile/validate.h (SCM_NUM2FLOAT, SCM_NUM2DOUBLE): Use
  `scm_to_double' instead of the deprecated functions.  Reported by
  Aleix Conchillo Flaqué <aconchillo@gmail.com>.

11 years agoFix copyright years in `futures.scm'.
Ludovic Courtès [Mon, 5 Nov 2012 17:59:14 +0000 (18:59 +0100)]
Fix copyright years in `futures.scm'.

* module/ice-9/futures.scm: Update copyright years.

11 years agoPreserve additional R6RS library name components after srfi :n
Mark H Weaver [Sun, 4 Nov 2012 05:01:06 +0000 (01:01 -0400)]
Preserve additional R6RS library name components after srfi :n

* module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface):
  (srfi :n ...) -> (srfi srfi-n ...) instead of (srfi srfi-n).

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

11 years agofutures: Have workers work when futures are available.
Ludovic Courtès [Sat, 3 Nov 2012 00:05:19 +0000 (01:05 +0100)]
futures: Have workers work when futures are available.

Reported by David Pirotte.

* module/ice-9/futures.scm (process-futures): Wait on %FUTURES-AVAILABLE
  only when %FUTURES is empty.

  The problem was obvious when running (begin (use-modules (ice-9
  threads)) (par-map 1+ (iota 400000))) : eventually, only the main
  thread would do the work, while the others would remain idle, waiting
  on %FUTURES-AVAILABLE.

11 years agoFix `generalized-vector->list' indexing bug with shared arrays.
Ludovic Courtès [Fri, 2 Nov 2012 23:20:23 +0000 (00:20 +0100)]
Fix `generalized-vector->list' indexing bug with shared arrays.

Fixes <http://bugs.gnu.org/12465>.
Reported by Daniel Llorens <daniel.llorens@bluewin.ch>.

* libguile/generalized-vectors.c (scm_generalized_vector_to_list): Fix
  initial value of POS; pass the `h.base + pos', not just `pos' as the
  `vref' argument.

* test-suite/tests/arrays.test ("array->list")["http://bugs.gnu.org/12465
  - ok", "http://bugs.gnu.org/12465 - bad]: New tests.
  ("generalized-vector->list"): New test prefix.

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

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

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

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

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

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

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

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

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

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Mark H Weaver [Wed, 31 Oct 2012 03:46:31 +0000 (23:46 -0400)]
Merge remote-tracking branch 'origin/stable-2.0'

Moved scm_i_struct_hash from struct.c to hash.c and made it static.

The port's alist is now a field of 'scm_t_port'.

Conflicts:
libguile/arrays.c
libguile/hash.c
libguile/ports.c
libguile/print.h
libguile/read.c

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

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

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

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

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

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

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

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

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

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

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

  (set_port_square_brackets_p, set_port_curly_infix_p): New functions.

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

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

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

  (scm_read_sexp): Handle curly infix lists.

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

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

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

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

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

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

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

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

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

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

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

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

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

  (sym_port_read_options): New variable.

  (set_port_read_option): New function.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This reverts commit 3e3d32dd9b2d71ffb0703dedc4d47387e981c9b5.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

11 years ago`define-public' is no a longer curried definition by default.
Ian Price [Tue, 4 Sep 2012 12:18:58 +0000 (13:18 +0100)]
`define-public' is no a longer curried definition by default.

* module/ice-9/boot-9.scm (define-public): Remove currying functionality.
* module/ice-9/curried-definitions.scm (define-public): New export.

11 years agobuild: Fix race between installing `guild' and the `guile-tools' symlink.
Ludovic Courtès [Mon, 3 Sep 2012 20:40:46 +0000 (22:40 +0200)]
build: Fix race between installing `guild' and the `guile-tools' symlink.

Fixes <http://bugs.gnu.org/12015>.
Report and patch by Song.Li <Song.Li@windriver.com>.

* meta/Makefile.am (install-data-hook): Rename to...
  (install-exec-hook): ... this.

11 years agodoc: Use scm_{to,from}_double instead of old API in example.
Ludovic Courtès [Mon, 3 Sep 2012 20:35:33 +0000 (22:35 +0200)]
doc: Use scm_{to,from}_double instead of old API in example.

Fixed <http://bugs.gnu.org/12241>.
Reported by Kurt W. Gochko <kgochko@comcast.net>.

* doc/ref/tour.texi (Writing Guile Extensions): Change example to use
  scm_{to,from}_double instead of the pre-1.8 API.

11 years agobuild: Use Automake's `color-tests'.
Ludovic Courtès [Mon, 3 Sep 2012 20:33:45 +0000 (22:33 +0200)]
build: Use Automake's `color-tests'.

* configure.ac: Use Automake's `color-tests'.

11 years agoISO 8601 time format specifies zero padding for hours, not blank padding.
Ian Price [Tue, 21 Aug 2012 11:13:25 +0000 (12:13 +0100)]
ISO 8601 time format specifies zero padding for hours, not blank padding.

* doc/ref/srfi-modules.texi ("SRFI-19 Date to string"): Fix iso 8601 format strings.
* module/srfi/srfi-19.scm (directives): Fix iso 8601 format strings.

11 years agodoc: Fix description of regexp/locale encoding interaction.
Ludovic Courtès [Sun, 26 Aug 2012 22:09:30 +0000 (00:09 +0200)]
doc: Fix description of regexp/locale encoding interaction.

* doc/ref/api-regex.texi (Regexp Functions): Update paragraph that
  mentions locale encoding and strings-as-bytes.

* test-suite/tests/regexp.test ("nonascii locales")["match structures
  refer to char offsets, non-ASCII pattern"]: New test.

11 years agoUpdate `texinfo.test' to match latest change.
Ludovic Courtès [Sun, 26 Aug 2012 21:42:09 +0000 (23:42 +0200)]
Update `texinfo.test' to match latest change.

* test-suite/tests/texinfo.test ("test-texinfo->stexinfo")["@url{arg}"]:
  Update test as a follow-up to
  dc7a9cefbf5434b6e7e503fe83faa07b24a1a6cd ("more robust texinfo alias
  handling").

11 years agoFix uri-encoding for strings with no unreserved chars
Ian Price [Mon, 20 Aug 2012 22:12:23 +0000 (23:12 +0100)]
Fix uri-encoding for strings with no unreserved chars

* module/web/uri.scm (uri-encode): Change test to check for unreserved
  chars instead of reserved chars.
* test-suite/tests/web-uri.test ("encode"): Add test.

11 years agoFix uri-encoding for octets 0-15
Ian Price [Mon, 20 Aug 2012 22:03:38 +0000 (23:03 +0100)]
Fix uri-encoding for octets 0-15

* module/web/uri.scm (uri-encode): All encoded octets should be of the
  form % HEXDIGIT HEXDIGIT.
* test-suite/tests/web-uri.test ("encode"): Add test.

11 years agomore robust texinfo alias handling
Andy Wingo [Sat, 25 Aug 2012 09:52:44 +0000 (11:52 +0200)]
more robust texinfo alias handling

* module/texinfo.scm (command-spec): Resolve aliases here.
  (complete-start-command, make-command-parser):
  (make-dom-parser, parse-environment-args): Reload command after
  resolving spec, so we get the alias target.

11 years agoMicro-optimize (ice-9 format).
Ludovic Courtès [Mon, 20 Aug 2012 22:36:50 +0000 (00:36 +0200)]
Micro-optimize (ice-9 format).

* module/ice-9/format.scm (format): Use `call-with-output-string'
  instead of `with-output-to-string'.

11 years agoOptimize `scm_lfwrite_substr', used by `scm_simple_format'.
Ludovic Courtès [Mon, 20 Aug 2012 21:38:21 +0000 (23:38 +0200)]
Optimize `scm_lfwrite_substr', used by `scm_simple_format'.

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

* libguile/print.c (scm_i_display_substring): New function.
* libguile/print.h (scm_i_display_substring): New internal declaration.
* libguile/ports.c (scm_lfwrite_substr): Use it instead of `scm_display'
  + `scm_c_substring'.

11 years agoreinstate type check to scm_to_utf8_stringn
Andy Wingo [Fri, 17 Aug 2012 14:41:27 +0000 (16:41 +0200)]
reinstate type check to scm_to_utf8_stringn

* libguile/strings.c (scm_to_utf8_stringn): Re-add missing type check,
  inadvertantly removed in e3d4597469a543d97c4997b128509c2ceb13ca2b.

11 years agoRevert "Add tests for 'exp' and 'expt' that should produce complex NaNs"
Mark H Weaver [Tue, 7 Aug 2012 22:14:32 +0000 (18:14 -0400)]
Revert "Add tests for 'exp' and 'expt' that should produce complex NaNs"

This reverts commit cc26b9de1d3c21cb4be49cc61c4b5872b8f607c5.

11 years agoRevert "Avoid cexp, whose C standard definition is mathematically incorrect"
Mark H Weaver [Tue, 7 Aug 2012 22:13:48 +0000 (18:13 -0400)]
Revert "Avoid cexp, whose C standard definition is mathematically incorrect"

This reverts commit ecbded71bb423a6055c541d6272796aefd1486f9.

11 years agoAvoid cexp, whose C standard definition is mathematically incorrect
Mark H Weaver [Wed, 1 Aug 2012 02:52:17 +0000 (22:52 -0400)]
Avoid cexp, whose C standard definition is mathematically incorrect

* libguile/numbers.c (scm_exp): Do not use cexp.

11 years agoAdd tests for 'exp' and 'expt' that should produce complex NaNs
Mark H Weaver [Sat, 28 Jul 2012 17:07:38 +0000 (13:07 -0400)]
Add tests for 'exp' and 'expt' that should produce complex NaNs

* test-suite/tests/numbers.test (exp, expt): Add tests that should
  produce complex NaNs, but apparently don't on all systems.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Sat, 28 Jul 2012 11:22:57 +0000 (13:22 +0200)]
Merge remote-tracking branch 'origin/stable-2.0'

Conflicts:
libguile/struct.c
libguile/struct.h

11 years agoset struct names for <standard-vtable>, etc
Andy Wingo [Sat, 28 Jul 2012 10:28:21 +0000 (12:28 +0200)]
set struct names for <standard-vtable>, etc

* libguile/struct.c (scm_init_struct): Set the struct names for
  <standard-vtable>, <applicable-struct-vtable>, and
  <applicable-struct-with-setter-vtable>.

11 years agoupdate tests after vtable-vtable deprecation
Andy Wingo [Sat, 28 Jul 2012 10:58:46 +0000 (12:58 +0200)]
update tests after vtable-vtable deprecation

* test-suite/tests/goops.test ("classes for built-in types"): Use a
  vtable instead of a vtable-vtable.

* test-suite/tests/structs.test (ball-root)
  ("low-level struct procedures", "make-struct"): Rework to use normal
  vtables instead of making new vtable-vtable.

11 years agodeprecate make-vtable-vtable
Andy Wingo [Fri, 18 Nov 2011 10:50:50 +0000 (11:50 +0100)]
deprecate make-vtable-vtable

* libguile/struct.h:
* libguile/struct.c (scm_make_vtable_vtable): Deprecate, as you can
  handle most of the use cases with make-vtable, and we don't want to
  promote the creation of new roots to the type hierarchy.
  (scm_i_make_vtable_vtable): The internal replacement.

11 years agoimprove documentation for structs
Andy Wingo [Sat, 28 Jul 2012 10:43:46 +0000 (12:43 +0200)]
improve documentation for structs

* doc/ref/api-compound.texi (Structures): Update to describe
  <standard-vtable>, to remove documentation for make-vtable-vtable, to
  describe meta-vtables, and to add a long example.

11 years agoupdate structure documentation
Andy Wingo [Tue, 24 Jul 2012 21:18:33 +0000 (23:18 +0200)]
update structure documentation

* doc/ref/api-compound.texi (Records): Add a link to SRFI-9 records.
  (Structures): Add a link to Records.  Describe tail arrays as
  deprecated, and add a rationale and some details.

11 years ago1;3202;0cMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Sat, 28 Jul 2012 10:44:36 +0000 (12:44 +0200)]
1;3202;0cMerge remote-tracking branch 'origin/stable-2.0'

11 years agoimprove documentation for structs
Andy Wingo [Sat, 28 Jul 2012 10:43:46 +0000 (12:43 +0200)]
improve documentation for structs

* doc/ref/api-compound.texi (Structures): Update to describe
  <standard-vtable>, to remove documentation for make-vtable-vtable, to
  describe meta-vtables, and to add a long example.

11 years agoset struct names for <standard-vtable>, etc
Andy Wingo [Sat, 28 Jul 2012 10:28:21 +0000 (12:28 +0200)]
set struct names for <standard-vtable>, etc

* libguile/struct.c (scm_init_struct): Set the struct names for
  <standard-vtable>, <applicable-struct-vtable>, and
  <applicable-struct-with-setter-vtable>.

11 years agoAngle of -0.0 is pi, not zero
Mark H Weaver [Sat, 28 Jul 2012 06:45:05 +0000 (02:45 -0400)]
Angle of -0.0 is pi, not zero

* libguile/numbers.c (scm_angle): Check the sign of an inexact real
  zero, to ensure that (angle -0.0) => pi and (angle 0.0) => 0.0.

* test-suite/tests/numbers.test (angle): Add tests, and increase
  precision of tests where the angle should be pi.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Tue, 24 Jul 2012 21:22:41 +0000 (23:22 +0200)]
Merge remote-tracking branch 'origin/stable-2.0'

Conflicts:
GUILE-VERSION

11 years agoupdate structure documentation
Andy Wingo [Tue, 24 Jul 2012 21:18:33 +0000 (23:18 +0200)]
update structure documentation

* doc/ref/api-compound.texi (Records): Add a link to SRFI-9 records.
  (Structures): Add a link to Records.  Describe tail arrays as
  deprecated, and add a rationale and some details.

11 years agoDocument (ice-9 and-let-star)
Noah Lavine [Sat, 30 Jun 2012 12:42:44 +0000 (08:42 -0400)]
Document (ice-9 and-let-star)

* doc/ref/srfi-modules.texi: note that (srfi srfi-2) is the same as
  (ice-9 and-let-star).

11 years agobuild: Use `AM_PROG_AR'.
Ludovic Courtès [Sat, 7 Jul 2012 09:41:39 +0000 (11:41 +0200)]
build: Use `AM_PROG_AR'.

* configure.ac: Use `AM_PROG_AR', as suggested by Automake
  1.12.1 ("warning: 'libguilereadline-v-@LIBGUILEREADLINE_MAJOR@.la':
  linking libtool libraries using a non-POSIX archiver requires
  'AM_PROG_AR' in 'configure.ac'").

11 years agoFix typos in `NEWS'.
Ludovic Courtès [Sat, 7 Jul 2012 09:32:38 +0000 (11:32 +0200)]
Fix typos in `NEWS'.

* NEWS: Fix typos.

11 years agoBump version number for 2.0.6.
Ludovic Courtès [Sat, 7 Jul 2012 09:29:38 +0000 (11:29 +0200)]
Bump version number for 2.0.6.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
  (LIBGUILE_INTERFACE_CURRENT): Increment, to account for new C
  functions like `scm_c_nvalues', `scm_to_pointer', etc.
  (LIBGUILE_INTERFACE_AGE): Increment.

11 years agoStore the `git-version-gen' patch.
Ludovic Courtès [Sat, 7 Jul 2012 09:10:49 +0000 (11:10 +0200)]
Store the `git-version-gen' patch.

* gnulib-local/build-aux/git-version-gen.diff: New file.
* Makefile.am (EXTRA_DIST): Add it.

11 years agoWork around `gl_CANONICALIZE_LGPL' bug when cross-compiling to GNU/Hurd.
Ludovic Courtès [Fri, 6 Jul 2012 23:52:45 +0000 (01:52 +0200)]
Work around `gl_CANONICALIZE_LGPL' bug when cross-compiling to GNU/Hurd.

* gnulib-local/m4/canonicalize.m4.diff: New file.
* Makefile.am (EXTRA_DIST): Add it.

11 years agoWork around `gl_CANONICALIZE_LGPL' bug when cross-compiling.
Ludovic Courtès [Fri, 6 Jul 2012 23:36:08 +0000 (01:36 +0200)]
Work around `gl_CANONICALIZE_LGPL' bug when cross-compiling.

* gnulib-local/m4/canonicalize.m4.diff: New file.
* Makefile.am (EXTRA_DIST): Add it.

11 years agoAdd missing `m4/clock_time.m4'.
Ludovic Courtès [Fri, 6 Jul 2012 22:20:20 +0000 (00:20 +0200)]
Add missing `m4/clock_time.m4'.

11 years agoUse `clock-time' directly from Gnulib, but with a local patch.
Ludovic Courtès [Fri, 6 Jul 2012 21:56:05 +0000 (23:56 +0200)]
Use `clock-time' directly from Gnulib, but with a local patch.

This is equivalent to the previous situation, but more easily
maintainable.

* acinclude.m4 (gl_CLOCK_TIME): Remove.

* configure.ac: Remove explicit use of `gl_CLOCK_TIME'.

* m4/gnulib-cache.m4 (gl_MODULES): Add `clock-time'.

* gnulib-local/m4/clock_time.m4.diff: New file.
* Makefile.am (EXTRA_DIST): Add it.

11 years agoUpdate Gnulib to v0.0-7509-g98a2286.
Ludovic Courtès [Fri, 6 Jul 2012 21:25:57 +0000 (23:25 +0200)]
Update Gnulib to v0.0-7509-g98a2286.

* Makefile.am (EXTRA_DIST): Add `m4/gnulib-cache.m4'.
* build-aux/git-version-gen: Keep unchanged.

11 years agoadd http/1.1 transfer codings to the NEWS
Andy Wingo [Fri, 6 Jul 2012 20:24:25 +0000 (22:24 +0200)]
add http/1.1 transfer codings to the NEWS

* doc/ref/web.texi (Transfer Codings): Add a note about modules.
* NEWS: Add NEWS for transfer codings.

11 years agoDocument and export `declare-opaque-header!'
Ian Price [Mon, 7 May 2012 23:18:59 +0000 (00:18 +0100)]
Document and export `declare-opaque-header!'

* module/web/http.scm (declare-opaque-header!): Add docstring. New export.
* doc/ref/web.texi (HTTP): Add documentation.

11 years agoAdd HTTP Chunked Encoding support to web modules.
Ian Price [Mon, 7 May 2012 23:06:01 +0000 (00:06 +0100)]
Add HTTP Chunked Encoding support to web modules.

* doc/ref/web.texi(Transfer Codings): New subsection for transfer codings.
* module/web/http.scm(make-chunked-input-port,
  make-chunked-output-port): New procedures.
* module/web/response.scm (read-response-body): Handle chunked responses.
* test-suite/tests/web-response.test: Add test.
* test-suite/tests/web-http.test: Add tests.

afd

11 years agoFix @ and @@ to not capture lexicals; new @@ @@ form for R6RS libraries
Mark H Weaver [Thu, 8 Mar 2012 06:24:25 +0000 (01:24 -0500)]
Fix @ and @@ to not capture lexicals; new @@ @@ form for R6RS libraries

* module/ice-9/psyntax.scm (@): Return top-wrap instead of the wrap
  applied to the '@' form, so that the symbol will be interpreted as a
  top-level identifier and never refer to any lexical variable.

  (@@): Change the syntax used to support R6RS 'library' forms to:
  (@@ @@ (mod ...) body).  Change the behavior of the documented
  (@@ (mod ...) id) form to be the same as that of @, except for the use
  of 'private' instead of 'public' in the psyntax mod: use syntax->datum
  on the identifier, and return top-wrap instead of the wrap applied to
  the '@@' form.

  This fixes <http://bugs.gnu.org/10756> reported by Ludovic Courtès.

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

* module/ice-9/r6rs-libraries.scm (library): Use '@@ @@' syntax instead
  of the older '@@' syntax.

* test-suite/tests/syncase.test (changes to expansion environment): Use
  '@@ @@' syntax.

* module/Makefile.am: Add explicit dependencies for boot-9.go on the
  files that it includes: quasisyntax.scm and r6rs-libraries.scm.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Fri, 6 Jul 2012 17:28:06 +0000 (19:28 +0200)]
Merge remote-tracking branch 'origin/stable-2.0'

This anticipates deprecation of make-vtable-vtable in stable-2.0, which
hasn't happened yet.

Conflicts:
libguile/deprecated.c
libguile/deprecated.h
libguile/print.c
libguile/struct.c