* module/ice-9/local-eval.scm: New module (ice-9 local-eval) which
exports `the-environment', `local-eval', and `local-compile'.
* libguile/debug.c (scm_local_eval): New C function that calls the
Scheme implementation of `local-eval' in (ice-9 local-eval).
* libguile/debug.h (scm_local_eval): Add prototype.
* doc/ref/api-evaluation.texi (Local Evaluation): Add documentation.
* test-suite/tests/eval.test (local evaluation): Add tests.
* test-suite/standalone/test-loose-ends.c (test_scm_local_eval):
Add test.
* module/Makefile.am: Add ice-9/local-eval.scm.
Based on a patch by Mark H Weaver <mhw@netris.org>.
* module/language/tree-il/analyze.scm
(format-analysis)[check-simple-format-args]: New procedure. Use it.
Add support for applications of <module-ref>.
* module/system/base/message.scm (%warning-types): Handle the `format
simple-format' warning.
* module/language/scheme/spec.scm (scheme)[make-default-environment]:
Use `simple-format' as the default `format'.
* test-suite/tests/tree-il.test ("warnings")["format"]: Explicitly use
(@ (ice-9 format) format) where needed.
("simple-format"): New test prefix.
* test-suite/tests/gc.test ("gc"): Fix "lexical vars are collectable"
test. (Previously, the binding was getting inlined, so we weren't
testing what we meant to test. Besides that, the value was a
constant, not a closure, so it wasn't collectable in the first place!)
* module/language/tree-il/compile-glil.scm (flatten-lambda-case): Fix
miscompilation of `values' in a push context with RA.
* test-suite/tests/tree-il.test: Add low-level test for this
miscompilation.
This is a followup to 690a0112e5 ("Remove
the "has finalizer?" bit from pointer objects.")
* libguile/foreign.c (scm_set_pointer_finalizer_x): Leave the type cell
unchanged. Before, `equal?' would break on pointers on which
`set-pointer-finalizer!' had been called.
* test-suite/tests/foreign.test ("make-pointer")["equal? modulo
finalizer (set-pointer-finalizer!)"]: New test.
* libguile/hashtab.c (scm_i_hashtable_print): Use `SCM_UNPACK', not
`SCM2PTR'.
* test-suite/tests/hash.test: Adjust tests that rely on the output of
the printer to just check for the suffix of the hash table's external
representation.
* test-suite/tests/asm-to-bytecode.test (native-cpu, native-word-size):
New procedures.
(test-target): When the target is the native CPU, use the native word
size instead of WORD-SIZE.
* test-suite/tests/statprof.test ("statistical sample counts within
expected range"): Throw unresolved when one of A-DATA, B-DATA, and
C-DATA is #f, which means samples were not collected for this one.
* test-suite/tests/regexp.test (with-unicode): New macro.
("regexp-quote"): Wrap all `regexp-quote' calls in it. This fixes
tests on machines where the default port encoding is US-ASCII.
* libguile/load.c (scm_primitive_load): Return the values yielded from
evaluating the last expression in the file.
* test-suite/tests/load.test ("return value of `load'"): Add tests.
* module/ice-9/ftw.scm (errno-if-exception): New macro.
(file-system-fold): Add an `error' parameter. Wrap `opendir' and STAT
calls in `errno-if-exception' and call ERROR when appropriate.
(file-system-tree): Provide an `error' procedure. Return #f when
FILE-NAME is unreadable.
(scandir): Provide an `error' procedure.
* test-suite/tests/ftw.test (%top-builddir): New variable.
(make-file-tree, delete-file-tree): New procedures.
(with-file-tree): New macro.
("file-system-fold"): Update tests to add an `error' procedure.
["ENOENT", "EACCES", "dangling symlink and lstat", "dangling symlink
and stat"]: New tests.
("file-system-tree")["ENOENT"]: New test.
("scandir")["EACCES"]: New test.
* doc/ref/misc-modules.texi (File Tree Walk): Update `file-system-fold'
documentation.
* libguile/procprop.c
(scm_set_procedure_properties_x)[SCM_ENABLE_DEPRECATED == 1]: Pass arguments
to `scm_assq' in the right order, and check its return value with
`scm_is_true'. Reported by Mike Gran <spk121@yahoo.com>.
* module/ice-9/psyntax.scm (define-expansion-constructors)[begin-form]:
Emit a syntax-violation error for empty sequences when
--disable-deprecated.
* test-suite/tests/syntax.test (pass-if-syntax-error): Fix typo in error
message.
The failure path for the c-api.test had been to call the undefined function
'fail', instead of logging the error like the other tests.
* test-suite/tests/c-api.test: modified
* ramap.test: New tests.
- array-map! with noncompact arrays and more than one argument.
- array-for-each with noncompact arrays and more than two arguments.
* libguile/generalized-vectors.c (scm_c_generalized_vector_ref):
(scm_c_generalized_vector_set_x): Fix for the case in which base was
not 1, lbnd was not 0, or inc was not 1.
* test-suite/tests/arrays.test (array): Add a test. Thanks to Daniel
Llorens for the report.
* module/web/http.scm ("Cache-Control"): Write string values using the
default val writer, to get quoting correct.
* test-suite/tests/web-http.test (pass-if-round-trip): New helper.
("general headers"): Check that cache-extensions round trip properly.
* module/web/http.scm ("Cache-Control"): Value for `max-stale' is
optional. Strict validation for value-less directives (`no-store',
etc.). String values optional for "cache-extension" directives.
* test-suite/tests/web-http.test: Value for `max-stale' is optional.
* doc/ref/api-control.texi (begin): Update to distinguish between
splicing begin and sequencing begin.
* module/ice-9/psyntax.scm (expand-expr): Add a back-compatibility shim
for `(begin)'.
* module/ice-9/psyntax-pp.scm: Regenerate.
* test-suite/tests/syntax.test: Update to run illegal (begin) test only
if we are not including deprecated features.
* module/ice-9/ftw.scm (scandir)[leaf]: Only add NAME when RESULT is a
pair.
[down]: Ignore RESULT.
Start with #f instead of the empty list.
* test-suite/tests/ftw.test ("scandir")["flat file"]: New test.
* doc/ref/misc-modules.texi (File Tree Walk): Update `scandir'
documentation accordingly.
Suggested by Nala Ginrut <nalaginrut@gmail.com>.
* module/ice-9/ftw.scm (scandir): New procedure.
* test-suite/tests/ftw.test ("scandir"): New test prefix.
* doc/ref/misc-modules.texi (File Tree Walk): Document `scandir'.
* module/ice-9/ftw.scm (file-system-fold, file-system-tree): New
procedures.
* test-suite/tests/ftw.test (%top-srcdir, %test-dir): New variables.
("file-system-fold", "file-system-tree"): New test prefixes.
* doc/ref/misc-modules.texi (File Tree Walk): Document
`file-system-tree' and `file-system-fold'.
* libguile/ports.c (scm_init_ports): Export the port fluids to Scheme,
temporarily.
* module/ice-9/boot-9.scm (fluid->parameter): Turn `current-input-port'
et al into srfi-39 parameters, backed by the exported fluids, then
remove the fluids from the guile module.
(%cond-expand-features): Add srfi-39.
* module/srfi/srfi-39.scm: Re-export features from boot-9.
* test-suite/tests/parameters.test: Add tests.
Reported by Cédric Cellier <rixed@happyleptic.org>.
* module/language/tree-il/peval.scm (truncate-values): New procedure.
(make-operand): Call `truncate-values' SOURCE.
* test-suite/tests/tree-il.test ("partial evaluation"): New tests for
multiple value truncation.
* test-suite/tests/asm-to-bytecode.test (%objcode-cookie-size)
(test-target): The objcode version embedded in the cookie is not an
effective version, so elide it from the test.
* module/web/uri.scm (parse-authority): Allow empty authorities, so that
we accept URIs of the form, file:///etc/hosts.
* test-suite/tests/web-uri.test ("string->uri"): Add tests.
* module/ice-9/boot-9.scm (<parameter>, make-parameter, parameter?)
(parameter-fluid, parameter-converter, parameterize): New top-level
bindings, implementing SRFI-39 parameters. Currently,
current-input-port and similar procedures are not yet parameters.
* test-suite/Makefile.am:
* test-suite/tests/parameters.test: Add tests, taken from srfi-39
tests.
* libguile/foreign.c (scm_procedure_to_pointer): Keep a weak reference
to PROC.
* test-suite/tests/foreign.test ("procedure->pointer")["procedure is
retained"]: New test.
* module/system/base/target.scm (%target-endianness, %target-word-size):
New fluids.
(%native-word-size): New variable.
(with-target): Set these fluids.
(cpu-endianness, cpu-word-size, triplet-cpu, triplet-vendor,
triplet-os): New procedures.
(target-cpu, target-vendor, target-os): Use them.
(target-endianness, target-word-size): Refer to the corresponding
fluid.
* libguile/objcodes.c (target_endianness_var, target_word_size_var): New
global variables.
(NATIVE_ENDIANNESS): New macro.
(target_endianness, target_word_size, to_native_order): New functions.
(make_objcode_from_file): Use `scm_bytecode_to_native_objcode' instead
of `scm_bytecode_to_objcode'.
(bytecode_to_objcode): New function, based on `scm_bytecode_to_objcode',
with the addition of an `endianness' and `word_size' parameters.
(scm_bytecode_to_objcode): Use it.
(scm_bytecode_to_native_objcode): New function.
(scm_write_objcode): Use `target_word_size' and `target_endianness'.
Convert OBJCODE's len and meta-len to native byte order.
(scm_init_objcodes): Initialize `target_endianness_var' and
`target_word_size_var'.
* libguile/objcodes.h (scm_bytecode_to_native_objcode): New declaration.
* libguile/vm.c (really_make_boot_program): Use
`scm_bytecode_to_native_objcode' instead of `scm_bytecode_to_objcode'.
* test-suite/tests/asm-to-bytecode.test (%objcode-cookie-size): New
variable.
(test-target): New procedure.
("cross-compilation"): Add `test-target' calls and the "unknown
target" test.
* module/system/base/target.scm (validate-target): Accept any tuple with
at least 3 parts.
* test-suite/tests/asm-to-bytecode.test (test-triplet): New procedure.
("cross-compilation"): New test prefix.
Reported by Dmitry Chestnykh <dmitry@codingrobots.com>.
Fixes <http://debbugs.gnu.org/10070>.
* libguile/bytevectors.c (scm_bytevector_copy_x): Use `memmove', not
`memcpy'.
* test-suite/tests/bytevectors.test ("2.2 General
Operations")["bytevector-copy! overlapping"]: New test.
* doc/ref/api-data.texi (Bytevector Manipulation): Mention possible
overlapping.
* test-suite/tests/eval.test ("stacks"): Enable another test, fix to use
with-throw-handler, and remove a duplicate test, now that there is no
difference between subrs and gsubrs.
These tests had been disabled as part of
b7742c6b71 ("new evaluator, y'all").
* test-suite/tests/eval.test ("define set procedure-name")["closure"]:
Change to `pass-if' since it now works, as a result of
ee15aa46e3 ("set names of functions
defined at the toplevel from `eval'").
("stacks")["arguments of a gsubr stack frame"]: Remove (throw
'unresolved).