* module/ice-9/futures.scm (<future>)[completion]: New field.
[done?]: Rename to...
[state]: ... this. Change `set-future-done?!' to
`set-future-state!', and `future-done?' to `future-state'.
(make-future): Initialize the `completion' field to 'queued.
(with-mutex): New macro.
(process-future!): Remove `set-future-done?!' call.
(process-futures): Check `future-state'. Unlock FUTURE's mutex before
processing it. Broadcast FUTURE's `completion' cond. var. when done.
(touch): Likewise.
* module/srfi/srfi-9/gnu.scm (set-record-type-printer!): Change the
parameter name to `proc'.
* doc/ref/api-compound.texi (SRFI-9 Records): Update accordingly.
* module/rnrs/io/port.scm (r6rs-open): New internal helper procedure for
opening files.
(open-file-input-port, open-file-output-port): Make use of
`r6rs-open'.
(open-file-input/output-port): Implement in terms of `r6rs-open',
add to exported identifiers list.
* module/rnrs.scm (open-file-input/output-port): Add to exported
identifiers.
* test-suite/tests/r6rs-ports.test (test-input-file-opener): New
procedure, collects several tests for opening file input ports.
("7.2.7 Input Ports"): Use `test-input-file-opener' for checking
`open-file-input-port'.
(test-output-file-opener): New procedure, collects several tests for
opening file output ports.
("8.2.10 Output ports"): Use `test-output-file-opener' for checking
`open-file-output-port'.
("8.2.13 Input/output ports"): New test prefix, making use of both
`test-input-file-opener' and `test-output-file-opener' to check
`open-file-input/output-port'.
* module/ice-9/futures.scm (%create-workers!): Use 'with-mutex' in case
an exception is thrown. Within the critical section, check to make
sure the worker pool hasn't already been created by another thread.
* module/system/base/ck.scm: New module.
* module/srfi/srfi-9.scm: Import (system base ck).
(getter-type, getter-index, getter-copier): Convert incoming argument
convention to CK form.
(define-tagged-inlinable): Convert return value convention for key
lookup to CK form.
* module/srfi/srfi-9/gnu.scm: Import (system base ck).
Rename '%set-fields-unknown-getter' to 'unknown-getter'.
(c-list, c-same-type-check): New macros.
(%set-fields): Using the CK abstract machine, arrange to check (at
macro expansion time) that all of the getters in head position
correspond to the same record type.
* test-suite/tests/srfi-9.test: Add test.
* 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.
* 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.
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.
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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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>
* 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>.
* 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.
* 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.
* 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.
* 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.
* 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.
* module/web/uri.scm (ipv6-regexp): IPv6 numeric addresses do not have
brackets. It's only in URIs that they have them.
(ipv6-host-pat, authority-regexp, parse-authority): Refactor ipv6
detection to fix a bug with |, and to extract IPv6 hosts from their
brackets. This way we can pass the uri-host directly to inet-pton.
(uri->string): If the host contains a `:', assume it is ipv6 and add
brackets.
* test-suite/tests/web-uri.test ("build-uri"): Adapt tests to assume
that the address returned by uri-host and passed to build-uri #:host
does not have brackets.
* module/web/uri.scm (valid-host?): Support dotted-quad notation
in IPv6 addresses.
(parse-authority): Support IPv6 literals.
* test-suite/tests/web-uri.test: Add and fix tests.
* module/web/uri.scm (valid-host?): Fix regexp to support
domain names starting with numbers.
* test-suite/tests/web-uri.scm: Add tests for above and
IP literals.
* module/ice-9/session.scm (procedure-arguments): Arrange to interpret
numbers in the "req" and "opt" positions of an 'arglist as N arguments
with unknown name.
* module/ice-9/eval.scm (primitive-eval): Set 'arglist on "complex"
procedures. Fixes http://bugs.gnu.org/10922.
* test-suite/tests/session.test ("procedure-arguments"): Add a test.
* module/language/glil/compile-assembly.scm (dump-constants): Only use
the `vector' instruction for vectors whose length can fit in 16 bits.
Fixes http://bugs.gnu.org/11087.
* module/language/tree-il/fix-letrec.scm: Use effects.scm for effects
analysis, instead of primitives.scm.
(simple-expression?, partition-vars): Adapt.
* module/language/tree-il/peval.scm (<operand>): Instead of having a
`residualize?' field, have it be a use count.
(peval): Adapt to <operand> change. Add function to kill uses of an
operand. Use it in the <prompt> inliner. Add another kind of
degenerate prompt to elide. We should really switch to CPS though, as
that will allow us to contify more aggressively.
* test-suite/tests/peval.test ("partial evaluation"): Adapt (while #t
#t) test, which was sensitive to how far the recursive inlining got.
Add a test for the degenerate prompt elision.
* module/language/tree-il/effects.scm (make-effects-analyzer): Be more
precise regarding the effects of the so-called
effect+exception-free-primitives: now we check their arities.
* test-suite/tests/cse.test ("cse"): Add a test that we don't
elide (cons 1 2 3) in effect context.