* module/rnrs/bytevectors/gnu.scm: New file.
* am/bootstrap.am (SOURCES): Add it.
* libguile/bytevectors.c (scm_bytevector_slice): New function.
* libguile/bytevectors.h (scm_bytevector_slice): New declaration.
* test-suite/tests/bytevectors.test ("bytevector-slice"): New tests.
* doc/ref/api-data.texi (Bytevector Slices): New node.
* module/rnrs/io/ports.scm (call-with-port): Remove local definition.
* module/system/repl/server.scm (system): Call-with-port is imported
via (ice-9 ports).
* module/ice-9/exceptions.scm (guard): Add guard definition that
re-propagates from original continuation, runs consequents in tail
position in guard continuation, and doesn't rewind the stack.
* module/srfi/srfi-34.scm:
* module/rnrs/exceptions.scm (guard): Re-export from (ice-9
exceptions).
* module/ice-9/exceptions.scm: New file, derived from (rnrs
conditions). Perhaps unadvisedly, in this file I've renamed a number
of the identifiers. I have never found that the R6RS identifiers made
sense to me. For now this is an internal module that R6RS and SRFI-35
will be based on.
* module/Makefile.am (SOURCES): Add the new file.
* module/rnrs/conditions.scm (rnrs): Export renamed identifiers
from (ice-9 exceptions).
* module/rnrs/conditions.scm: Use core record facilities to define the
base condition types, define-condition-type, and the standard
condition hierarchy.
(simple-condition?): Rename from condition-internal?.
* module/rnrs/exceptions.scm: Move `raise' definition here, out from the
procedural records layer.
(format-simple-condition): Reimplement in a simpler way, hopefully
producing the same output.
* module/rnrs/records/procedural.scm:
* module/rnrs/records/inspection.scm: Import the exceptions and
conditions modules, and use the normal raise function.
* module/ice-9/boot-9.scm (record-type-uid): New accessor.
(make-record-type): Record UID in record type properties.
* module/rnrs/conditions.scm (define-condition-type): Fix invalid
invocation of make-record-type.
* module/rnrs/records/inspection.scm: Rewrite to use core record
inspection facilities.
* module/rnrs/records/procedural.scm: Rewrite to use core
make-record-type. Incidentally the result is that instances of
derived R6RS record types are now flat instead of nested.
* test-suite/tests/r6rs-records-procedural.test
("make-record-type-descriptor"): Relax a couple condition type checks,
while we redo the exception system.
* module/ice-9/boot-9.scm (else, =>, ..., _): New definitions. These
are specified by the r6rs and the r7rs.
* module/ice-9/sandbox.scm (core-bindings): Include the aux syntax
definitions.
* module/rnrs/base.scm:
* module/rnrs.scm: Re-export aux syntax.
* doc/ref/r6rs.texi (rnrs io ports): Improve the descriptions of
'binary-port?' and 'textual-port?'.
* module/rnrs/io/ports.scm (binary-port?, textual-port?): Update the
docstrings.
Fixes <https://bugs.gnu.org/32329>.
Reported and diagnosed by Göran Weinholt <goran@weinholt.se>.
* module/rnrs/io/simple.scm (call-with-input-file)
(call-with-output-file): Use 'open-{input,output}-file' to open the port
in textual mode. Previously 'open-file-{input,output}-port' was used,
which opened the port in binary mode.
Fixes <https://bugs.gnu.org/32329>.
Reported and diagnosed by Göran Weinholt <goran@weinholt.se>.
* module/rnrs/io/simple.scm (call-with-input-file)
(call-with-output-file): Use 'open-{input,output}-file' to open the port
in textual mode. Previously 'open-file-{input,output}-port' was used,
which opened the port in binary mode.
* libguile/struct.h (SCM_VTABLE_BASE_LAYOUT): Layout is a "pr" field.
* module/ice-9/boot-9.scm (record-type-vtable): Record vtable fields are
writable.
(<parameter>): "pw" fields.
* module/oop/goops.scm (<class>, %compute-layout): <read-only> fields
are "pw" underneath.
* module/rnrs/records/procedural.scm (record-type-vtable)
(record-constructor-vtable, make-record-type-descriptor): Use "pw"
fields in vtables.
* module/srfi/srfi-35.scm (%condition-type-vtable)
(struct-layout-for-condition): "pw" fields in vtables.
* test-suite/tests/goops.test:
* test-suite/tests/structs.test: Use "pw" fields only.
* benchmark-suite/benchmarks/structs.bm: Update for make-struct/no-tail,
to use pw fields, and also to remove useless tests that the compiler
would optimize away.
* doc/ref/api-data.texi (Vtables): Add a note about the now-vestigial
permissions character and update documentation.
(Structure Basics, Meta-Vtables): Update examples.
* libguile/hash.c (scm_i_struct_hash): Remove code that would handle
opaque/self fields.
* libguile/print.h (SCM_PRINT_STATE_LAYOUT): Use "pw" fields.
* libguile/struct.c (scm_struct_init): Simplify check for hidden
fields.
* libguile/values.c (scm_init_values): Field is "pw".
* libguile/struct.h (SCM_VTABLE_BASE_LAYOUT, scm_vtable_index_self):
Remove "self" field. Renumber the other fields.
* module/oop/goops.scm (<self-slot>): Remove.
(fold-class-slots): Adapt for "self" slot removal. Adapt all users.
(class-redefinition): Now that there is no "self" slot to update, use
%modify-instance instead of %modify-class.
* libguile/goops.c (class_self): Remove.
(scm_sys_modify_class): Remove.
* libguile/goops.h (scm_sys_modify_class): Remove.
* module/rnrs/records/procedural.scm: Import vtable-offset-user.
Renumber rtd indexes using vtable-offset-user.
* module/srfi/srfi-35.scm (%condition-type-vtable): Remove mention of
vtable fields.
* module/system/base/types.scm (address->inferior-struct): Adapt for
different vtable field layout.
* module/rnrs/io/ports.scm (open-string-output-port): Calling the
get-string proc should flush the buffer and reset the file position.
* test-suite/tests/r6rs-ports.test ("8.2.10 Output ports"): Add tests.
Thanks to Freja Nordsiek for the report.
* module/rnrs/io/ports.scm (&i/o-decoding, &i/o-encoding): Rename from
&i/o-decoding-error and &i/o-encoding-error, to conform to R6RS.
* module/rnrs.scm (rnrs): Export &i/o-decoding, &i/o-encoding, their
accessors and constructors.
Also pinging this thread with a (very slightly) updated patch. :-)
[2. text/x-diff; 0001-Hashtable-hash-function-returns-f-on-eq-and-eqv-tabl.patch]
From 17599f6ce7ba0beb100e80455ff99af07333d871 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
<taylanbayirli@gmail.com>
Date: Tue, 21 Jun 2016 00:23:29 +0200
Subject: [PATCH] Hashtable-hash-function returns #f on eq and eqv tables.
* module/rnrs/hashtables.scm (r6rs:hashtable)[type]: New field.
(r6rs:hashtable-type): New procedure.
* test-suite/tests/r6rs-hashtables.test: Add related tests.
* module/rnrs/arithmetic/fixnums.scm (fxcopy-bit, fxbit-field)
(fxcopy-bit-field, fxarithmetic-shift)
(fxarithmetic-shift-left, fx-arithmetic-shift-right)
(fxrotate-bit-field, fxreverse-bit-field): Enforce range on amount by
which to shift. Fixes#14917.
* test-suite/tests/r6rs-arithmetic-fixnums.test ("fxarithmetic-shift-left"):
Update test to not shift left by a negative amount.
Fixes <http://bugs.gnu.org/17044>.
Reported and diagnosed by Xin Wang <dram.wang@gmail.com>.
* module/rnrs/io/simple.scm (open-input-file, open-output-file): Pass
missing buffer-mode argument to open-file-{input,output}-port.
Previously, (native-transcoder) was incorrectly passed as the
buffer-mode argument, so no transcoder was provided, thus creating a
binary port.
* module/rnrs/exceptions.scm (&guile): New condition type.
(guile-condition-converters): New variable.
(convert-guile-condition, default-guile-condition-converter,
set-guile-condition-converter!, guile-common-conditions,
guile-lexical-violation-converter, guile-syntax-violation-converter,
guile-assertion-violation-converter, guile-system-error-converter,
guile-undefined-violation-converter, guile-error-converter,
guile-implementation-restriction-converter): New procedures.
(with-exception-handler): Catch all exceptions, not just R6RS
exceptions. Convert native Guile exceptions to R6RS conditions,
preserving the original Guile exception information in the &guile
condition object.
(raise): If the condition includes a &guile condition, use 'throw' to
throw the original native guile exception instead of raising an R6RS
exception.
* test-suite/tests/r6rs-exceptions.test ("guile condition conversions"):
Add tests.
* libguile/numbers.c (scm_numerator, scm_denominator): Handle signed
zeroes and infinities in accordance with the corresponding R6RS flonum
procedures.
* module/rnrs/arithmetic/flonums.scm (flnumerator, fldenominator):
Remove special handling of infinities.
* test-suite/tests/numbers.test (numerator, denominator): Add tests.
Convert existing tests to use 'pass-if-equal'.
* test-suite/tests/r6rs-arithmetic-flonums.test (flnumerator): Fix
broken test of (flnumerator -0.0).
* libguile/strports.c (scm_mkstrport): Use UTF-8; ignore
%default-port-encoding. Rename 'str_len' and 'c_pos' to
'num_bytes' and 'c_byte_pos'. Interpret 'pos' argument
as a character index instead of a byte index.
* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-6 to the
list of core features.
* module/srfi/srfi-6.scm (open-input-string, open-output-string): Simply
re-export these, since the core versions are now compliant.
* doc/ref/api-io.texi (String Ports): Remove text that describes
non-compliant behavior of string ports with regard to encoding.
* doc/ref/srfi-modules.texi (SRFI-0): Add srfi-6 to the list of
core features.
(SRFI-6): Remove text that mentions non-compliant behavior of
core string ports.
* module/ice-9/format.scm (format):
* module/ice-9/pretty-print.scm (truncated-print):
* module/rnrs/io/ports.scm (open-string-input-port,
open-string-output-port):
* test-suite/test-suite/lib.scm (format-test-name):
* test-suite/tests/chars.test ("combining accent is pretty-printed",
"combining X is pretty-printed"):
* test-suite/tests/ecmascript.test (eread, eread/1):
* test-suite/tests/rdelim.test:
* test-suite/tests/reader.test (read-string):
* test-suite/tests/regexp.test:
* test-suite/tests/srfi-105.test (read-string): Don't set
%default-port-encoding before creating string ports.
* benchmark-suite/benchmarks/ports.bm (%latin1-port): Use
'set-port-encoding!' to set the string port encoding.
(%utf8/ascii-port, %utf8/wide-port, "rdelim"): Don't set
%default-port-encoding before creating string ports.
* test-suite/tests/r6rs-ports.test ("lookahead-u8 non-ASCII"): Don't set
%default-port-encoding before creating string ports.
("put-bytevector with UTF-16 string port", "put-bytevector with
wrong-encoding string port"): Use 'set-port-encoding!' to set the
string port encoding.
* test-suite/tests/print.test (tprint): Use 'set-port-encoding!' to set
the string port encoding.
("truncated-print"): Use 'pass-if-equal'.
* test-suite/tests/ports.test ("encoding failure leads to exception",
"%default-port-encoding is honored", "peek-char [latin-1]", "peek-char
[utf-8]", "peek-char [utf-16]"): Remove tests.
("%default-port-encoding is ignored", "peek-char"): Add tests.
("suitable encoding [latin-1]", "suitable encoding [latin-3]",
"wrong encoding, error", "wrong encoding, substitute",
"wrong encoding, escape"): Use 'set-port-encoding!' to set the
string port encoding.
("%default-port-encoding, wrong encoding"): Rewrite to use
a file port instead of a string port.
* module/rnrs/arithmetic/bitwise.scm (bitwise-if, bitwise-length,
bitwise-first-bit-set, bitwise-bit-field, bitwise-reverse-bit-field):
Replace these with aliases to the identical SRFI-60 operators
'bitwise-if', 'integer-length', 'first-set-bit', 'bit-field', and
'reverse-bit-field'.
(bitwise-copy-bit, bitwise-copy-bit-field, bitwise-rotate-bit-field):
Reimplement these based upon the similar SRFI-60 operators 'copy-bit',
'copy-bit-field', and 'rotate-bit-field'.
* test-suite/tests/r6rs-arithmetic-bitwise.test (bitwise-copy-bit): Fix
test to conform to the specification, which requires the third
argument to be either 0 or 1.
* test-suite/tests/r6rs-arithmetic-fixnums.test (fxcopy-bit): Fix test
to conform to the specification, which requires the third argument to
be either 0 or 1.
Reported by Göran Weinholt <goran@weinholt.se>.
* module/rnrs/arithmetic/fixnums.scm (fxbit-count): If the argument is
negative, return the 'bitwise-not' of the result of 'logcount', as per
R6RS. Previously, 'fxbit-count' was identical to 'logcount'.
* test-suite/tests/r6rs-arithmetic-fixnums.test (fxbit-count): Add test.
Fixes <http://bugs.gnu.org/14868>.
Reported by Göran Weinholt <goran@weinholt.se>.
* module/rnrs/arithmetic/flonums.scm (flfinite?): If the argument is a
NaN, return false.
* test-suite/tests/r6rs-arithmetic-flonums.test (flfinite?): Add test.
Fixes <http://bugs.gnu.org/14864>.
Reported by Göran Weinholt <goran@weinholt.se>.
* module/rnrs/arithmetic/bitwise.scm (bitwise-bit-count): If the
argument is negative, return the 'bitwise-not' of the result of
'logcount', as per R6RS. Previously, 'bitwise-bit-count' was
identical to 'logcount'.