1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 04:10:18 +02:00
Commit graph

1263 commits

Author SHA1 Message Date
Andy Wingo
625b43acc7 fix `format' with %f and exact rationals
* module/ice-9/format.scm (format:parse-float): Accept a number, and
  when stringifying the number, first convert to inexact.

* test-suite/tests/format.test ("~f fixed-point"): Add exact rational
  test.
2010-06-06 13:46:53 +02:00
Andy Wingo
9846796b6a fix module-hygiene corner case by relying more on syntax objects
* module/ice-9/psyntax.scm (chi-macro): Instead of assuming that output
  of a macro should be scoped relative to the module that was current
  when the macro was defined, allow the module information associated
  with the syntax object itself to pass through unmolested. Fixes bug
  29860.
  (datum->syntax): Propagate the module of the identifier through to the
  new syntax object, so that datum->syntax preserves module hygiene in
  addition to lexical hygiene.
  (include, include-from-path): Refactor to plumb though the hygiene
  information from the filename instead of the `include', allowing
  hygiene from the original caller of include-from-path to propagate
  through.

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

* test-suite/tests/syncase.test ("macro-generating macro"): Add test for
  bug 29860.
2010-06-06 13:00:59 +02:00
Andy Wingo
07d22c0259 rename (rnrs bytevector) to (rnrs bytevectors)
* module/rnrs/bytevectors.scm: Rename to (rnrs bytevectors), from (rnrs
  bytevector), to match the name from the R6RS.

* benchmark-suite/benchmarks/bytevectors.bm:
* doc/ref/api-data.texi:
* doc/ref/api-foreign.texi:
* libguile/bytevectors.c:
* module/6/rnrs.scm:
* module/language/assembly.scm:
* module/language/assembly/compile-bytecode.scm:
* module/language/assembly/decompile-bytecode.scm:
* module/language/glil/compile-assembly.scm:
* module/language/tree-il/primitives.scm:
* module/srfi/srfi-4.scm:
* module/srfi/srfi-4/gnu.scm:
* module/system/foreign.scm:
* test-suite/standalone/test-ffi:
* test-suite/tests/asm-to-bytecode.test:
* test-suite/tests/bytevectors.test:
* test-suite/tests/foreign.test:
* test-suite/tests/r6rs-ports.test: Update all referrers.
2010-06-01 13:26:11 +02:00
Ludovic Courtès
fd449a2690 Relax the `(version)' test.
* test-suite/tests/version.test ("version reporting works"): Test
  whether `(version)' contains MAJOR.MINOR.MICRO, rather than being
  equal to it.
2010-05-30 22:39:23 +02:00
Julian Graham
04186f2006 Ignore explicit phase specification for imports in `library' form.
* module/ice-9/r6rs-libraries.scm (library): Unwrap the `for' sub-form
  during export resolution the same way that `import' does.
* test-suite/tests/rnrs-libraries.test ("implicit phasing"): New test
  prefix and tests.
2010-05-27 21:32:39 -04:00
Julian Graham
911b03b20c Support for the #!r6rs lexeme.
* libguile/read.c (scm_read_shebang): New function;
  (scm_read_sharp): Call scm_read_shebang on '!', which delegates to
  scm_read_scsh_block_comment as necessary.
* test-suite/tests/reader.test ("R6RS lexeme comment", "partial R6RS
  lexeme comment"): New tests.
2010-05-27 09:21:18 -04:00
Ludovic Courtès
f1046e6b78 Raise an exception upon VM stack overflows (fixes bug #29574).
* libguile/vm-engine.c (VM_NAME)[vm_error_stack_overflow]: Increase
  `vp->stack_limit' when possible.

* libguile/vm.c (VM_STACK_RESERVE_SIZE): New macro.

* test-suite/lib.scm (exception:vm-error): New variable.

* test-suite/tests/eval.test ("stack overflow"): New test prefix.
2010-05-26 23:41:23 +02:00
Ludovic Courtès
01fded8c77 sxml-match: Handle multiple-value returns.
* module/sxml/sxml-match.ss (sxml-match1): Invoke ESCAPE via
  `call-with-values'.

* test-suite/tests/sxml-match-tests.ss ("test multiple value returns"):
  New test.

* module/sxml/match.scm: Mention the modification.
2010-05-26 23:41:23 +02:00
Ludovic Courtès
400a5dcb8b Add (sxml match).
* module/Makefile.am (LIB_SOURCES): Add `sxml/match.scm'.
  (NOCOMP_SOURCES): Add `sxml/sxml-match.ss'.

* module/sxml/match.scm, module/sxml/sxml-match.ss: New files.

* test-suite/Makefile.am (SCM_TESTS): Add `tests/sxml.match.test'.
  (EXTRA_DIST): Add `tests/sxml-match-tests.ss'.

* test-suite/tests/sxml-match-tests.ss,
  test-suite/tests/sxml.match.test: New files.

* doc/ref/guile.texi (Guile Modules): Include `sxml-match.texi'.

* doc/ref/sxml-match.texi: New file.

* doc/ref/Makefile.am (guile_TEXINFOS): Add `sxml-match.texi'.
2010-05-25 23:31:36 +02:00
Julian Graham
8794d769bd Test suite and fixes for R6RS (rnrs arithmetic fixnums).
* module/rnrs/arithmetic/6/fixnums.scm: Fix missing imports;
  (fixnum-width, greatest-fixnum, least-fixnum): Redefine these as
  zero-argument procedures; Fix argument mismatches in several functions.
* test-suite/Makefile.am: Add tests/r6rs-arithmetic-fixnums.test to
  SCM_TESTS.
* test-suite/tests/r6rs-arithmetic-fixnums.test: New file.
2010-05-20 21:18:04 -04:00
Julian Graham
d3094cf2fa Fix typo in license comment.
* test-suite/tests/r6rs-eval.test: Lice6nse => License.
2010-05-20 21:18:04 -04:00
Julian Graham
b01818d752 Implementation and test cases for the R6RS (rnrs arithmetic flonums)
library.

* module/Makefile.am: Add rnrs/arithmetic/6/fixnums.scm and
  rnrs/arithmetic/6/flonums.scm to RNRS_SOURCES.
* module/rnrs/6/base.scm: (div-and-mod, div0, mod0, div0-and-mod0): New
  functions; this `div' implementation is not quite right, but we'll come
  back to it later.
* module/rnrs/arithmetic/6/fixnums.scm: New file.
* module/rnrs/arithmetic/6/flonums.scm: New file.
* test-suite/Makefile.am: Add tests/r6rs-arithmetic-flonums.test to
  SCM_TESTS.
* test-suite/tests/r6rs-arithmetic-flonums.test: New file.
2010-05-20 21:18:03 -04:00
Julian Graham
15ce5cafbc Implementation and test case for R6RS (rnrs eval) library.
* module/Makefile.am: Add rnrs/6/eval.scm to RNRS_SOURCES.
* module/rnrs/6/eval.scm: New file
* test-suite/Makefile.am: Add tests/r6rs-eval.test to SCM_TESTS.
* test-suite/tests/r6rs-eval.test: New file.
2010-05-20 21:18:03 -04:00
Julian Graham
ace75ab775 Implementation and test cases for the R6RS (rnrs enums) library.
* module/Makefile.am: Add rnrs/6/enums.scm to RNRS_SOURCES.
* module/rnrs/6/conditions.scm: Fix define-condition-type binding for
  syntax-violation? predicate.
* module/rnrs/6/enums.scm: New file.
* test-suite/Makefile.am: Add tests/r6rs-enums.test to SCM_TESTS.
* test-suite/tests/r6rs-enums.test: New file.
2010-05-20 21:18:03 -04:00
Julian Graham
2359a9a49e Test suite and fixes for R6RS (rnrs conditions) and
(rnrs records procedural).

* module/rnrs/6/conditions.scm: Fix export of
  make-implementation-restriction-violation; remove dependency on
  (rnrs syntax-case); remove redundant function
  compound-condition-components; rewrite define-condition-type using
  syntax-rules instead of syntax-case.
* module/rnrs/records/6/procedural.scm: Remove serious-condition?,
  violation? and assertion-violation? predicates, since they're not true
  condition predicates.
* test-suite/Makefile.am: Add tests/r6rs-conditions.test to SCM_TESTS.
* test-suite/tests/r6rs-conditions.test: New file.
2010-05-20 21:18:03 -04:00
Julian Graham
d1c83d388a Add `guard' form and test cases to R6RS (rnrs exceptions) library.
* module/rnrs/6/exceptions.scm: (guard0, guard): New syntax.
* module/rnrs/records/6/procedural.scm: (r6rs-raise-continuable): Can't
  use `raise' here because it's exported by (rnrs exceptions); use plain
  old `throw' instead.
* test-suite/Makefile.am: Add tests/r6rs-exceptions.test to SCM_TESTS.
* test-suite/tests/r6rs-exceptions.test: New file.
2010-05-20 21:18:03 -04:00
Julian Graham
a7ada16187 Fix test suite title in comment
* test-suite/tests/r6rs-records-procedural.test: `(rnrs control)' =>
  `(rnrs records procedural)'
2010-05-20 21:18:03 -04:00
Julian Graham
0113507eee Implementation and test cases for R6RS (rnrs files) library.
* module/Makefile.am: Add rnrs/6/files.scm to RNRS_SOURCES.
* module/rnrs/6/conditions.scm (define-condition-type): Use specified
  accessor name to create accessor binding.  Add internally-visible
  &i/o-* condition types.
* module/rnrs/6/files.scm: New file.
* module/rnrs/io/6/simple.scm: Export &i/o-* condition types clandestinely
  imported from (rnrs conditions).
* test-suite/Makefile.am: Add tests/r6rs-files.test to SCM_TESTS.
* test-suite/test/r6rs-files.test: New file.
2010-05-20 21:18:03 -04:00
Julian Graham
949532501a Implementation and test cases for the R6RS (rnrs unicode) library.
* module/Makefile.am: Add rnrs/6/unicode.scm to RNRS_SOURCES.
* module/rnrs/6/unicode.scm: New file.
* test-suite/Makefile.am: Add tests/r6rs-unicode.test to SCM_TESTS.
* test-suite/tests/r6rs-unicode.test
2010-05-20 21:18:03 -04:00
Julian Graham
2b95784c8d Fixes and test cases for R6RS (rnrs hashtables) library.
* module/rnrs/6/hashtables.scm: Assorted bugfixes, esp. for wrapping
  single-argument hash functions.
* test-suite/Makefile.am: Add tests/r6rs-hashtables.test to SCM_TESTS.
* test-suite/tests/r6rs-hashtables.test: New file.
2010-05-20 21:18:03 -04:00
Julian Graham
04ba959921 Add test cases for record constructor protocols and parent protocol
delegation.

* test-suite/tests/r6rs-records-procedural.test ("simple protocol",
  "protocol delegates to parent with protocol"): New tests.
2010-05-20 21:18:03 -04:00
Julian Graham
f797da47f8 Implementation for the R6RS (rnrs hashtables) library;
Implementation and test cases for the R6RS (rnrs record syntactic) library.

* module/Makefile.am: Add rnrs/6/hashtables.scm to RNRS_SOURCES.
* module/rnrs/6/hashtables.scm: New file.
* module/rnrs/records/6/inspection.scm: (record-type-generative?) Record
  types are generative iff they have no uid, not vice-versa.
* module/rnrs/records/6/syntactic.scm: Finish `define-record-type'
  implementation; add `record-type-descriptor' and
  `record-constructor-descriptor' forms.
* test-suite/Makefile.am: Add tests/r6rs-records-syntactic.test to
  SCM_TESTS.
* test-suite/tests/r6rs-records-inspection.test: Update tests for
  `record-type-generative?' to reflect corrected behavior.
* test-suite/tests/r6rs-records-syntactic.test: New file.
2010-05-20 21:18:02 -04:00
Julian Graham
55684b5e3b Implementation and test cases for the R6RS (rnrs records inspection)
library.

* module/Makefile.am: Add module/rnrs/records/6/inspection.scm to RNRS_SOURCES.
* module/rnrs/records/6/inspection.scm: New file.
* module/rnrs/records/6/procedural.scm: Assorted refactoring:
    Create index constants for record, rtd, and rcd field indexes;
    record-type-vtable, record-constructor-vtable: More informative display
    names;
    (make-record-type-descriptor): fold left, not right when creating vtable;
      store field names as vector, not list;
      detect opaque parents
* test-suite/Makefile.am: Add test-suite/tests/r6rs-records-inspection.test to
  SCM_TESTS.
* test-suite/tests/r6rs-records-inspection.test: New file.
2010-05-20 21:18:02 -04:00
Julian Graham
ce543a9f70 Implementation and test cases for the R6RS (rnrs records procedural) library,
along with its dependencies.

* module/Makefile.am: Add new R6RS libraries below to RNRS_SOURCES.
* module/rnrs/6/conditions.scm, exceptions.scm, syntax-case.scm: New files.
* module/rnrs/io/6/simple.scm: New file.
* module/rnrs/records/6/procedural.scm, syntactic.scm: New files.
* test-suite/Makefile.am: Add tests/r6rs-records-procedural.test to SCM_TESTS.
* test-suite/tests/r6rs-records-procedural.test: New file.
2010-05-20 21:18:02 -04:00
Julian Graham
bf745816f2 Implementation and test cases for the R6RS (rnrs control) library.
* module/Makefile.am: Add rnrs/6/base.scm and rnrs/6/control.scm to
  RNRS_SOURCES.
* module/rnrs/6/base.scm, control.scm: New files.
* test-suite/Makefile.am: Add tests/r6rs-control.test to SCM_TESTS.
* test-suite/tests/r6rs-control.test: New file.
2010-05-20 21:18:02 -04:00
Julian Graham
2a435f1f91 Implementation and test cases for the R6RS (rnrs arithmetic bitwise)
library.

* module/rnrs/arithmetic/6/bitwise.scm: New file.
* test-suite/tests/r6rs-arithmetic-bitwise.test: New file.
2010-05-20 21:18:02 -04:00
Andy Wingo
a310a1d12e primitive-eval takes expanded, not memoized, source
* module/ice-9/eval.scm (primitive-eval):
* libguile/eval.c (scm_c_primitive_eval): Don't expect a memoized
  expression -- expect either raw source or an *expanded* expression. We
  handle memoization ourselves.

* libguile/expand.c (scm_macroexpand): Settle down into its proper name,
  "macroexpand", even as we comment that it is but a fleeting boot
  expander.
  (scm_macroexpanded_p): New predicate for expanded code.

* libguile/expand.h: Add scm_macroexpanded_p.

* libguile/memoize.c (scm_memoize_expression): Require that the
  expression be expanded.
  (scm_init_memoize): Don't alias memoize-expression to macroexpand.

* module/ice-9/psyntax-pp.scm:
* module/ice-9/psyntax.scm: Always produce macroexpanded expressions,
  and hand them to primitive-eval. No more calls to memoize-expression
  here.

* test-suite/tests/optargs.test: Remove some tests, as unfortunately we
  have no way to invoke the boot expander after boot.
2010-05-20 12:25:52 +02:00
Andy Wingo
d8a071fc4e primitive support for lambda*
* libguile/memoize.c (scm_m_lambda_star): Define lambda* in the
  pre-psyntax env, and make it memoize lambda* expressions.

* libguile/eval.c (BOOT_CLOSURE_PARSE_FULL): New helper.
  (error_invalid_keyword, error_unrecognized_keyword): New helpers.
  (prepare_boot_closure_env_for_apply): Flesh out application of boot
  closures with "full" arity.
  (prepare_boot_closure_env_for_eval): Punt to
  prepare_boot_closure_env_for_eval for the full-arity case.

* module/ice-9/eval.scm (make-fixed-closure): Rename from `closure', and
  just handle fixed arities, where there is no rest argument..
  (make-general-closure): New helper, a procedure, that returns a
  closure that can take rest, optional, and keyword arguments.
  (eval): Adapt to call make-fixed-closure or make-general-closure as
  appropriate.

* test-suite/tests/optargs.test ("lambda* inits"): Test the memoizer as
  well.
2010-05-14 00:28:32 +02:00
Ludovic Courtès
df3f1090e8 Have sxml->xml' handle *TOP*' nodes (bug #29260).
* module/sxml/simple.scm (universal-sxslt-rules): Add handler for
  `*TOP*'.  Suggested by Stefan Israelsson Tampe at
  <https://savannah.gnu.org/bugs/index.php?29260>.

* test-suite/Makefile.am (SCM_TESTS): Add `sxml.simple.test'.

* test-suite/tests/sxml.simple.test: New file.

* THANKS: Add Stefan.
2010-05-11 23:46:05 +02:00
Ludovic Courtès
36b5e39407 Add (system vm coverage).
* module/system/vm/coverage.scm: New file.

* module/Makefile.am (SYSTEM_SOURCES): Add `system/vm/coverage.scm'.

* test-suite/guile-test (main): Use (system vm coverage).  Handle
  `--coverage' and `-c'.

* test-suite/tests/coverage.test: New file.

* test-suite/Makefile.am (SCM_TESTS): Add `tests/coverage.test'.

* doc/ref/Makefile.am (guile_TEXINFOS): Add `api-coverage.texi'.

* doc/ref/api-coverage.texi: New file.

* doc/ref/guile.texi (API Reference): Include it.
2010-05-07 13:47:53 +02:00
Andy Wingo
f2d126801c psyntax no longer attempts to track (current-module)
* module/ice-9/psyntax.scm: Revert tracking of the current module while
  expanding toplevel sequences. Better to preserve lexical scoping
  (relative to the module of the original expression) and allow for @@
  to override it.

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

* test-suite/tests/syncase.test: Test module-changing with @@.
2010-05-06 22:42:44 +02:00
Andy Wingo
42a710680d add rnrs libraries test suite
* test-suite/Makefile.am:
* test-suite/tests/rnrs-libraries.test:
* test-suite/tests/rnrs-test-a.scm: Add rnrs libraries test suite.
2010-05-03 22:11:15 +02:00
Julian Graham
e96bac4523 Test cases for `version-matches?'.
* test-suite/tests/modules.test ("module versions"): New tests for
  `version-matches?'.
2010-05-02 14:58:15 -04:00
Andy Wingo
51797cec09 make-record-type slight refactor
* test-suite/tests/records.test ("records"): Add tests for printers.

* module/ice-9/boot-9.scm (make-record-type): Refactor the code that
  makes the default printer.
2010-04-19 19:33:57 +02:00
Andy Wingo
0abc210944 deprecate @bind
* module/ice-9/boot-9.scm:
* module/ice-9/deprecated.scm (@bind): Deprecate @bind, which was a
  thread-unsafe dynamic scoping mechanism, used in the old elisp
  support. Fluids are more correct, and are probably faster, given the
  VM support for with-fluids.

* test-suite/tests/dynamic-scope.test: Remove.
* test-suite/tests/fluids.test: Move relevant tests from
  dynamic-scope.test here, recast in terms of with-fluids.
2010-04-19 14:00:23 +02:00
Andy Wingo
4597cd2027 use procedure-minimum-arity in tests
* test-suite/tests/procprop.test ("procedure-arity"): Fix tests to use
  procedure-minimum-arity.
2010-04-19 12:05:27 +02:00
Andy Wingo
96ec2c9c65 elisp.test cleanups
* test-suite/tests/elisp.test: Use quote and #nil instead of quasiquote
  and ,#nil.
2010-04-09 22:33:46 +02:00
Andy Wingo
2860ff4675 re-enable elisp test
* test-suite/tests/elisp.test: Rework for #nil, to actually be enabled,
  to always run, and to use the new compiler. Comment out some failing tests, to
  be dealt with in the future.
2010-04-09 21:06:29 +02:00
Andy Wingo
92a61010bd change remaining %nil -> #nil
* doc/ref/vm.texi:
* libguile/boolean.h:
* libguile/pairs.h:
* module/language/elisp/README:
* test-suite/tests/elisp-compiler.test:
* test-suite/tests/load.test: Change remaining mentions of %nil to #nil.
2010-04-09 21:06:29 +02:00
Ludovic Courtès
01ad5a7ba9 Raise an error when attempting to modify the value of `%null-pointer'.
* libguile/foreign.c (sym_null_pointer_error): New variable.
  (null_pointer_error): New function.
  (scm_foreign_set_x): Raise an error if attempting to modify
  NULL_POINTER.
  (scm_foreign_to_bytevector): Use `null_pointer_error ()' instead of
  `scm_misc_error ()'.

* test-suite/tests/foreign.test: New file.

* test-suite/Makefile.am (SCM_TESTS): Add tests/foreign.test.

* test-suite/lib.scm (exception:null-pointer-error): New variable.
2010-04-09 00:32:15 +02:00
Ludovic Courtès
1606312f9a Fix `module-reverse-lookup'.
* libguile/modules.c (scm_module_reverse_lookup): Type-check VARIABLE.
  Don't traverse the `uses' list when MODULE is #f.

* test-suite/tests/modules.test ("foundations")["module-reverse-lookup
  [pre-module-obarray]", "module-reverse-lookup [wrong-type-arg]"]: New
  tests.
2010-04-09 00:32:14 +02:00
Ludovic Courtès
6c76da4c32 Remove `fold' from (sxml fold).
* module/sxml/fold.scm: Use (srfi srfi-1).
  (fold): Remove.
  (fold-values): Update docstring accordingly.

* test-suite/tests/sxml.fold.test: Use (srfi srfi-1).
2010-04-09 00:32:14 +02:00
Andy Wingo
e39d0b7668 fix curried definitions for value defines
* module/ice-9/curried-definitions.scm: Allow definitions of values with
  define and define*.
* test-suite/tests/curried-definitions.test: Add tests.
2010-04-08 21:01:52 +02:00
Andy Wingo
9225df3c55 add (ice-9 curried definitions)
* module/Makefile.am:
* module/ice-9/curried-definitions.scm: New module, implementing
  SICM-style currying.

* test-suite/Makefile.am:
* test-suite/tests/curried-definitions.test: A test.
2010-04-08 00:36:53 +02:00
Andy Wingo
de9df04a0c update licenses on tests imported from guile-lib
* test-suite/tests/sxml.fold.test:
* test-suite/tests/sxml.ssax.test:
* test-suite/tests/sxml.transform.test:
* test-suite/tests/sxml.xpath.test:
* test-suite/tests/texinfo.docbook.test:
* test-suite/tests/texinfo.serialize.test:
* test-suite/tests/texinfo.string-utils.test:
* test-suite/tests/texinfo.test: Update licenses to GPL or LGPL 3+, and
  update copyright holders to be FSF (where that is the case). Copyright
  holders who are not FSF have their code in GPL/LGPL-compatible
  licesnse.
2010-04-07 21:37:50 +02:00
Andy Wingo
e48a2f8705 add docs and tests for array->list
* libguile/generalized-arrays.c (scm_array_to_list): Add docs.
* test-suite/tests/arrays.test ("array->list"): Add tests.
2010-04-07 21:04:37 +02:00
Michael Gran
dcc69bab8c copyright dates
* libguile/unidata_to_charset.pl: change copyright date
* test-suite/tests/srfi-14.test: change copyright date
2010-04-03 06:46:23 -07:00
Michael Gran
6d30df5dbd Unicode data parsing script incorrect for char-set:ascii
char-set:ascii is the only char-set consisting of a single contiguous
range, and there was an off-by-one error for that case.

* libguile/unidata_to_charset.pl (compute): fix off-by-one
2010-04-02 21:08:42 -07:00
Andy Wingo
a587d6a973 more fixes to equal? for arrays
* libguile/array-map.c (array_compare, scm_array_equal_p): Rewrite as
  something that operates on the generic array handle infrastructure.
  Based on array->list.
  (scm_i_array_equal_p): Change the docs, as array-equal? is now the same
  as equal?, except that it typechecks its args.

* doc/ref/api-compound.texi (Array Procedures): Update array-equal?
  docs.

* libguile/deprecated.h:
* libguile/deprecated.c (scm_raequal): Deprecate.

* libguile/bytevectors.c (scm_bytevector_eq_p): Bugfix: bytevectors are
  bytevector=? only if their element type is the same.

* libguile/eq.c (scm_equal_p): Only dispatch to scm_array_equal_p if
  both args are arrays (generically).

* test-suite/tests/arrays.test ("equal?"): Add some more tests.
2010-04-01 00:25:06 +02:00
Andy Wingo
8ecd1943ef fix bug in ash opcode
* libguile/vm-i-scheme.c (ash): Fix embarrassing bug in (ash 1 32).
* test-suite/tests/bit-operations.test ("bitshifts on word boundaries"):
  Add tests.
2010-03-31 22:29:29 +02:00