Julian Graham [Fri, 21 May 2010 01:46:12 +0000 (21:46 -0400)]
Explicitly import `*unspecified*' to support R6RS library purification
enhancements.
* module/rnrs/6/hashtables.scm: Add explicit import for `*unspecified*'.
Julian Graham [Thu, 20 May 2010 13:33:39 +0000 (09:33 -0400)]
Explicitly import `@@' to support R6RS library purification enhancements
on `master'.
* module/rnrs/6/conditions.scm:
* module/rnrs/6/exceptions.scm:
* module/rnrs/6/files.scm:
* module/rnrs/6/hashtables.scm:
* module/rnrs/io/6/simple.scm:
* module/rnrs/records/6/inspection.scm: Add explicit import for `@@'.
Julian Graham [Fri, 14 May 2010 01:41:38 +0000 (21:41 -0400)]
Fix broken imports in `(rnrs r5rs)'.
* module/rnrs/6/r5rs.scm (imports): Import `null-environment' from
`(ice-9 safe-r5rs)'; import `scheme-report-environment' from
`(ice-9 r5rs)'.
Julian Graham [Sat, 10 Apr 2010 05:01:46 +0000 (01:01 -0400)]
Fix incorrect export names in `(rnrs io simple)'.
* module/rnrs/io/6/simple.scm: with-input-file => with-input-from-file,
with-output-file => with-output-to-file.
Julian Graham [Fri, 9 Apr 2010 04:23:28 +0000 (00:23 -0400)]
Implementation for R6RS (rnrs) composite library. (Can't be loaded yet
because of conflict between `syntax-case' transformer binding and
`(rnrs syntax-case)' hierarchical namespace module binding.)
* module/6/rnrs.scm: New file.
* module/Makefile.am: Add 6/rnrs.scm to RNRS_SOURCES.
Julian Graham [Sun, 4 Apr 2010 18:53:06 +0000 (14:53 -0400)]
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.
Julian Graham [Sun, 4 Apr 2010 03:05:46 +0000 (23:05 -0400)]
Fix typo in license comment.
* test-suite/tests/r6rs-eval.test: Lice6nse => License.
Julian Graham [Sun, 4 Apr 2010 03:04:24 +0000 (23:04 -0400)]
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.
Julian Graham [Tue, 30 Mar 2010 18:38:27 +0000 (14:38 -0400)]
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.
Julian Graham [Tue, 30 Mar 2010 18:27:00 +0000 (14:27 -0400)]
Fix syntax and consolidate imports for (rnrs lists).
* module/rnrs/6/lists.scm: Import syntax is
`(only (import-set) id-1 ...)', not `(only (import-set) (id-1 ...))';
use `rename' form as wrapper instead of creating separate custom
interface on SRFI-1.
Julian Graham [Mon, 29 Mar 2010 02:31:45 +0000 (22:31 -0400)]
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.
Julian Graham [Sun, 28 Mar 2010 23:40:16 +0000 (19:40 -0400)]
Add R6RS `syntax-violation' to (rnrs syntax-case).
* module/rnrs/6/exceptions.scm: Remove dependency on (rnrs syntax-case);
rewrite guard and guard0 in using syntax-rules in terms of syntax-case.
* module/rnrs/6/syntax-case.scm: Add syntax-violation implementation.
Julian Graham [Sun, 28 Mar 2010 23:31:49 +0000 (19:31 -0400)]
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.
Julian Graham [Sat, 27 Mar 2010 19:28:24 +0000 (15:28 -0400)]
Implementation for the (rnrs mutable-pairs) and (rnrs mutable-strings)
libraries.
* module/Makefile.am: Add rnrs/6/mutable-pairs.scm and
rnrs/6/mutable-strings.scm to RNRS_SOURCES.
* module/rnrs/6/mutable-pairs.scm: New file.
* module/rnrs/6/mutable-strings.scm: New file.
Julian Graham [Sat, 27 Mar 2010 15:39:28 +0000 (11:39 -0400)]
Implementation for the R6RS (rnrs r5rs) library.
* module/Makefile.am: Add rnrs/6/r5rs.scm to RNRS_SOURCES.
* module/rnrs/6/r5rs.scm: New file.
Julian Graham [Sat, 27 Mar 2010 00:57:52 +0000 (20:57 -0400)]
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.
Julian Graham [Sat, 27 Mar 2010 00:47:39 +0000 (20:47 -0400)]
Fix test suite title in comment
* test-suite/tests/r6rs-records-procedural.test: `(rnrs control)' =>
`(rnrs records procedural)'
Julian Graham [Sun, 21 Mar 2010 23:26:48 +0000 (19:26 -0400)]
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.
Julian Graham [Sun, 21 Mar 2010 21:12:38 +0000 (17:12 -0400)]
Implementation for the R6RS (rnrs sorting) library.
* module/Makefile.am: Add rnrs/6/sorting.scm to RNRS_SOURCES.
* module/rnrs/6/sorting.scm: New file.
Julian Graham [Sun, 21 Mar 2010 21:03:35 +0000 (17:03 -0400)]
Implementation for the R6RS (rnrs programs) library.
* module/Makefile.am: Add rnrs/6/programs.scm to RNRS_SOURCES.
* module/rnrs/6/programs.scm: New file.
Julian Graham [Sun, 21 Mar 2010 20:19:06 +0000 (16:19 -0400)]
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
Julian Graham [Sun, 21 Mar 2010 00:51:37 +0000 (20:51 -0400)]
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.
Julian Graham [Sat, 20 Mar 2010 19:14:46 +0000 (15:14 -0400)]
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.
Julian Graham [Sat, 20 Mar 2010 19:10:11 +0000 (15:10 -0400)]
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.
Julian Graham [Sat, 20 Mar 2010 18:57:49 +0000 (14:57 -0400)]
(rnrs conditions) should not depend on (rnrs records syntactic).
* module/rnrs/6/conditions.scm: (define-condition-type) Re-implement
`define-condition-type' in terms of (rnrs records procedural).
Julian Graham [Sat, 20 Mar 2010 12:36:17 +0000 (08:36 -0400)]
Fix missing export of string->symbol in (rnrs base).
* module/rnrs/6/base.scm: Add string->symbol to library exports.
Julian Graham [Sat, 20 Mar 2010 00:03:46 +0000 (20:03 -0400)]
Implementation for the R6RS (rnrs lists) library.
* module/Makefile.am: Add module/rnrs/6/lists.scm to RNRS_SOURCES.
* module/rnrs/6/lists.scm: New file.
Julian Graham [Wed, 10 Mar 2010 06:36:15 +0000 (01:36 -0500)]
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.
Julian Graham [Wed, 10 Mar 2010 06:26:12 +0000 (01:26 -0500)]
Remove needless import of (rnrs io simple).
* module/rnrs/6/conditions.scm: Remove (rnrs io simple (6)) from imports.
Julian Graham [Mon, 8 Mar 2010 14:00:42 +0000 (09:00 -0500)]
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.
Julian Graham [Sat, 6 Mar 2010 07:04:25 +0000 (02:04 -0500)]
Fix missing imports for `(rnrs arithmetic bitwise)'.
* module/Makefile.am: Add module/rnrs/arithmetic/6/bitwise.scm to
RNRS_SOURCES.
* module/rnrs/arithmetic/6/bitwise.scm: Import `(rnrs control)' and `modulo'
from `(guile)'.
* test-suite/Makefile.am: Add r6rs-arithmetic-bitwise.test to SCM_TESTS.
Julian Graham [Sat, 6 Mar 2010 06:28:46 +0000 (01:28 -0500)]
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.
Julian Graham [Mon, 8 Feb 2010 14:45:54 +0000 (09:45 -0500)]
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.
Julian Graham [Sat, 8 May 2010 21:15:52 +0000 (17:15 -0400)]
Documentation for the R6RS `library' and `import' forms.
* doc/ref/api-modules.texi (R6RS Libraries): New section, documents
`library' and `import'.
Andy Wingo [Thu, 20 May 2010 15:52:44 +0000 (17:52 +0200)]
eval-when expand for use-modules and export
* module/ice-9/boot-9.scm (use-modules, use-syntax)
(export, re-export): Add `expand' to the eval-when list, as we did for
R6RS.
Andy Wingo [Thu, 20 May 2010 11:59:34 +0000 (13:59 +0200)]
pure r6rs modules
* module/ice-9/r6rs-libraries.scm (library): Make pure modules.
(import): Also process imports at expand time, for the `eval' case.
Andy Wingo [Thu, 20 May 2010 11:47:49 +0000 (13:47 +0200)]
macroexpanded pretty-printer
* module/language/tree-il.scm (print-tree-il):
(borrow-core-vtables, <tree-il>): When tree-il loads, override the
printers for macroexpanded structures.
Andy Wingo [Thu, 20 May 2010 11:28:25 +0000 (13:28 +0200)]
lambda* usage in psyntax.scm
* module/ice-9/psyntax.scm (macroexpand): Use lambda*.
* module/ice-9/psyntax-pp.scm: Regenerated.
Andy Wingo [Thu, 20 May 2010 11:27:49 +0000 (13:27 +0200)]
tree-il->scheme for lambda* et al
* module/language/tree-il.scm (tree-il->scheme): Fix lambda* /
case-lambda / case-lambda* transformation.
Andy Wingo [Thu, 20 May 2010 10:54:47 +0000 (12:54 +0200)]
remove *mode* fluid from psyntax
* module/ice-9/psyntax.scm: Remove the *mode* fluid. Whee :)
(macroexpand): No need to bind aa *mode* fluid.
* module/ice-9/psyntax-pp.scm: Regenerated.
Andy Wingo [Thu, 20 May 2010 10:53:21 +0000 (12:53 +0200)]
iron out inconsistency between eval and compile expansion
* libguile/expand.c (expand_lambda_star_case): Harmonize with tree-il,
expanding keywords to (aok? (kw name gensym) ...), not
(aok? (kw . index) ...).
* libguile/memoize.c (memoize): Process the (kw name gensym) format into
(kw . index).
* module/ice-9/psyntax.scm (build-lambda-case): Remove a
compile-versus-eval special case.
* module/ice-9/psyntax-pp.scm: Regenerate.
Andy Wingo [Thu, 20 May 2010 10:25:52 +0000 (12:25 +0200)]
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.
Andy Wingo [Wed, 19 May 2010 23:00:37 +0000 (01:00 +0200)]
%null-pointer properly aligned
* libguile/foreign.c: Allocate %null-pointer on the heap, to assure
proper alignment.
Andy Wingo [Wed, 19 May 2010 21:56:00 +0000 (23:56 +0200)]
psyntax produces "expanded" structures directly
* module/ice-9/psyntax.scm: Remove a number of eval-versus-compile
cases, instead producing "expanded" structures directly, which happen
to coincide with tree-il.
* module/ice-9/psyntax-pp.scm: Regenerate.
Andy Wingo [Wed, 19 May 2010 21:37:27 +0000 (23:37 +0200)]
expanded type constructors in psyntax
* module/ice-9/psyntax.scm (define-expansion-constructors): Define
constructors for expanded types.
* module/ice-9/psyntax-pp.scm: Regenerated.
Andy Wingo [Wed, 19 May 2010 21:27:14 +0000 (23:27 +0200)]
tree-il on expanded-vtables
* module/language/tree-il.scm: In a somewhat daring move, inherit
the "core" tree-il constructs from %expanded-vtables.
Andy Wingo [Wed, 19 May 2010 21:25:50 +0000 (23:25 +0200)]
fix a couple expander naming bugs
* libguile/expand.h:
* libguile/memoize.c: Fix a couple bugs: it's application-args, not
application-exps, and public?, not public.
Andy Wingo [Wed, 19 May 2010 20:57:52 +0000 (22:57 +0200)]
%expanded-vtables is a vector
* libguile/expand.c (scm_init_expand): %expanded-vtables is a vector.
Andy Wingo [Wed, 19 May 2010 20:51:31 +0000 (22:51 +0200)]
separate boot expansion from memoization
* libguile/Makefile.am:
* libguile/init.c:
* libguile/expand.c:
* libguile/expand.h: Add new expander. The idea is that macroexpansion
is one thing, and whether to compile or interpret the result of that
is another thing.
* libguile/memoize.c: Adapt to expand as necessary, and then memoize
expanded source without worrying about syntax errors.
* module/ice-9/eval.scm (make-general-closure): Allow alt clauses to not
possess the full make-general-closure arity.
Andy Wingo [Tue, 18 May 2010 20:30:58 +0000 (22:30 +0200)]
remove the new scm_memoize_begin, etc
* libguile/memoize.h:
* libguile/memoize.c: Remove the recently-added scm_memoize_begin,
scm_memoize_lambda, et al. We'll take a different tack.
Andy Wingo [Sun, 16 May 2010 10:21:27 +0000 (12:21 +0200)]
scm_memoize_lambda update
* libguile/memoize.h:
* libguile/memoize.c (scm_memoize_lambda): Update to memoize
"full-arity" lambdas.
Andy Wingo [Thu, 13 May 2010 21:27:00 +0000 (23:27 +0200)]
psyntax builds case-lambda expressions
* module/ice-9/psyntax.scm (build-case-lambda, build-lambda-case):
Actually build case-lambda expressions, knowing that the memoizer will
do the right thing.
* module/ice-9/psyntax-pp.scm: Regenerated.
Andy Wingo [Thu, 13 May 2010 19:43:35 +0000 (21:43 +0200)]
evaluator support for case-lambda
* libguile/memoize.c (patch_case_lambda, scm_m_case_lambda)
(scm_m_case_lambda_star): Add memoizers for case-lambda and
case-lambda*.
(unmemoize): Unmemoize lambdas with multiple arities.
* libguile/eval.c (prepare_boot_closure_env_for_apply):
(prepare_boot_closure_env_for_eval): Adapt to return both body and
env, so that case-lambda clauses can be selected appropriately.
(eval, boot_closure_apply): Adapt callers.
* module/ice-9/eval.scm (make-general-closure): Support multiple
arities.
Andy Wingo [Thu, 13 May 2010 15:15:10 +0000 (17:15 +0200)]
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.
Andy Wingo [Thu, 13 May 2010 14:56:31 +0000 (16:56 +0200)]
tweak to lambda* memoization format
* libguile/memoize.c (FULL_ARITY): Change the form to more closely
approximate <lambda-case>.
(unmemoize): Unmemoize lambda* expressions.
Andy Wingo [Wed, 12 May 2010 10:17:18 +0000 (12:17 +0200)]
change to format of memoization lambda expressions
* libguile/memoize.c (scm_m_lambda, memoize_named_let)
(scm_memoize_lambda, unmemoize)
* libguile/eval.c (eval, prepare_boot_closure_env_for_apply)
(prepare_boot_closure_env_for_eval, boot_closure_apply):
* module/ice-9/eval.scm (primitive-eval): Change the format for memoized
lambda expressions, so as to allow, in the future, case-lambda* to be
supported by the evaluator.
Andy Wingo [Wed, 12 May 2010 10:02:09 +0000 (12:02 +0200)]
scm_badargsp is deprecated
* libguile/eval.h:
* libguile/eval.c:
* libguile/deprecated.h
* libguile/deprecated.c (scm_badargsp): Deprecate scm_badargsp.
Ludovic Courtès [Tue, 11 May 2010 20:54:14 +0000 (22:54 +0200)]
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.
Andy Wingo [Fri, 7 May 2010 21:12:34 +0000 (23:12 +0200)]
add memoize-begin, memoize-let, etc functions
* libguile/memoize.h:
* libguile/memoize.c (scm_memoize_begin, scm_memoize_if,
scm_memoize_lambda, scm_memoize_let, scm_memoize_quote,
scm_memoize_define, scm_memoize_with_fluids, scm_memoize_call,
scm_memoize_lexical_ref, scm_memoize_lexical_set,
scm_memoize_toplevel_ref, scm_memoize_toplevel_set,
scm_memoize_module_ref, scm_memoize_module_set): New functions, public
to Scheme but private to C. For use by psyntax, in the future.
Andy Wingo [Fri, 7 May 2010 20:19:36 +0000 (22:19 +0200)]
add "memoizer" data type
* libguile/memoize.h:
* libguile/memoize.c (MAKMEMO_APPLY): Take the proc and args separately.
(scm_tc16_memoizer, SCM_MEMOIZER_P, SCM_MEMOIZER): New smob type, for
"syntax" like @apply that have normal evaluation order.
(memoize_env_ref_macro, memoize): Refactor to handle "memoizers"
generically.
Reorganize the list of SCM_SYNTAX forms.
Move @apply, @dynamic-wind, @call-with-current-continuation,
@call-with-values, @prompt handling down to be generic "memoizer" data
types.
(scm_memoizer_p, scm_memoizer): New functions, exposed to Scheme. Will
be used by psyntax.
Andy Wingo [Fri, 7 May 2010 08:51:28 +0000 (10:51 +0200)]
macro expanders return memoized expressions
* libguile/eval.c (scm_c_primitive_eval):
* module/ice-9/eval.scm (primitive-eval): Rely on the expander to
produce a memoized expression. If the expression is already memoized,
just pass it through (the equivalent of the old "noexpand" hack).
* libguile/memoize.c (scm_init_memoize): Initialize `memoize-expression'
as the initial binding of `macroexpand'.
* libguile/modules.c (scm_module_transformer): Before modules are
booted, look for `macroexpand', not `%pre-modules-transformer'.
* module/ice-9/boot-9.scm: No more %pre-modules-transformer. Loading
psyntax extends `macroexpand'.
(make-module): `macroexpand' is the default transformer.
* module/ice-9/psyntax.scm: No more `noexpand'.
(top-level-eval-hook, local-eval-hook): Instead of annotating with
noexpand, memoize the expression before handing it to primitive-eval.
(macroexpand): No more noexpand hack -- in its place we have another
hack, to memoize the result when running in eval mode.
* module/ice-9/psyntax-pp.scm: Regenerated.
Ludovic Courtès [Fri, 7 May 2010 13:59:50 +0000 (15:59 +0200)]
Attempt to guarantee 8-byte alignment of on-stack frame objects.
* libguile/vm.c (vm_dispatch_hook): Make FRAME a union with a `double'
member.
Ludovic Courtès [Sun, 2 May 2010 12:17:41 +0000 (14:17 +0200)]
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.
Ludovic Courtès [Tue, 20 Apr 2010 23:05:42 +0000 (01:05 +0200)]
Allocate frame objects on the stack when invoking VM hooks.
* libguile/vm.c (vm_dispatch_hook): Don't call `scm_c_make_frame ()'.
Instead, allocate FRAME on the stack.
Ludovic Courtès [Wed, 21 Apr 2010 21:30:48 +0000 (23:30 +0200)]
Add `program-free-variables' to `(system vm program)'.
* module/system/vm/program.scm (program-free-variables): New procedure.
* module/language/objcode/spec.scm (program-free-variables): Remove.
Ludovic Courtès [Sun, 18 Apr 2010 22:27:47 +0000 (00:27 +0200)]
Fix the type tag produced by `SCM_STATIC_PROGRAM'.
* libguile/snarf.h (SCM_STATIC_PROGRAM): Fix typo.
Ludovic Courtès [Wed, 14 Apr 2010 21:46:41 +0000 (23:46 +0200)]
When printing a VM, show the type of engine being used.
* libguile/vm.c (scm_i_vm_print): Print the engine type.
Andy Wingo [Thu, 6 May 2010 20:34:36 +0000 (22:34 +0200)]
fix macros that expand into (begin (define-module ...) ...)
* module/ice-9/boot-9.scm (define-module): Add `expand' to the
situations, so that we ensure the current module changes at expand
time.
* module/ice-9/r6rs-libraries.scm (library): Expand the body within @@
expressions.
Andy Wingo [Thu, 6 May 2010 20:32:50 +0000 (22:32 +0200)]
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 @@.
Andy Wingo [Thu, 6 May 2010 19:12:09 +0000 (21:12 +0200)]
@@ generalized to arbitrary expressions.
* module/ice-9/psyntax.scm (@@): The RHS of an @@ is no longer
restricted to be an identifier, it can be an arbitrary expression.
* module/ice-9/psyntax-pp.scm: Regenerated.
Andy Wingo [Wed, 5 May 2010 22:15:06 +0000 (00:15 +0200)]
change form of @ and @@ psyntax handlers
* module/ice-9/psyntax.scm (@, @@): Take r and w args, and also return
r, w, and s. Adapt callers.
Andy Wingo [Wed, 5 May 2010 20:59:32 +0000 (22:59 +0200)]
add `expand' eval-when situation
* module/ice-9/psyntax.scm (chi-when-list, chi-top): Add an undocumented
`expand' situation to eval-when, which will trigger at expand-time for
toplevel expressions. Useful when you are expanding for eval, but need
to do some side effect to affect the expander -- like defining a
module.
* module/ice-9/psyntax-pp.scm: Regenerate.
Andy Wingo [Tue, 4 May 2010 21:47:22 +0000 (23:47 +0200)]
add explanatory comment to chi-macro
* module/ice-9/psyntax.scm (chi-macro): Add comment.
Andy Wingo [Tue, 4 May 2010 21:20:12 +0000 (23:20 +0200)]
check layout when making vtables
* libguile/struct.c (scm_is_valid_vtable_layout): New private layout
validating function.
(scm_i_struct_inherit_vtable_magic): Do a more proper layout
validation, and don't abort.
Andy Wingo [Mon, 3 May 2010 17:09:35 +0000 (19:09 +0200)]
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.
Julian Graham [Sat, 6 Feb 2010 17:33:20 +0000 (12:33 -0500)]
add support for r6rs libraries
* module/ice-9/boot-9.scm: Include ice-9/r6rs-libraries.scm.
* module/ice-9/r6rs-libraries.scm: New file.
* module/Makefile.am (NOCOMP_SOURCES): Add r6rs-libraries.scm.
Andy Wingo [Mon, 3 May 2010 20:06:44 +0000 (22:06 +0200)]
only ensure local vars for definitions during expansion when compiling
* module/ice-9/psyntax.scm (chi-top): Only modify the compile-time
environment to indicate that there is a local binding if we are
running in compile mode. Otherwise some eval-when things might not
have gotten executed, and our current-module could be wrong.
* module/ice-9/psyntax-pp.scm: Regenerate.
Andy Wingo [Mon, 3 May 2010 14:34:12 +0000 (16:34 +0200)]
export, re-export etc as syntax-rules macros
* module/ice-9/boot-9.scm (export, re-export, export-syntax)
(re-export-syntax): Rewrite as syntax-rules macros.
Andy Wingo [Mon, 3 May 2010 14:31:32 +0000 (16:31 +0200)]
rewrite use-modules and use-syntax using syntax-case
* module/ice-9/boot-9.scm (use-modules): Rewrite as a syntax-case macro.
(use-syntax): Likewise.
(compile-interface-spec): Remove unused function
Andy Wingo [Mon, 3 May 2010 13:38:29 +0000 (15:38 +0200)]
rewrite define-module as a syntax-case macro
* module/ice-9/boot-9.scm (define-module): Rewrite as a syntax-case
macro, so that the expansion has proper module hygiene. Otherwise
process-define-module isn't properly resolved against the root module
-- a bytecode file that starts with a define-module would just try to
look up process-define-module from the current module.
(compile-define-module-args): Remove. Internal, and no one else used
it.
Andy Wingo [Sun, 2 May 2010 17:08:26 +0000 (19:08 +0200)]
remove duplicate quasisyntax.scm EXTRA_DIST
* module/Makefile.am (EXTRA_DIST): Remove quasisyntax.scm, as the
NOCOMP_SOURCES handles that case.
Julian Graham [Sun, 2 May 2010 18:58:15 +0000 (14:58 -0400)]
Test cases for `version-matches?'.
* test-suite/tests/modules.test ("module versions"): New tests for
`version-matches?'.
Andy Wingo [Sun, 2 May 2010 12:27:46 +0000 (14:27 +0200)]
add tour.texi to guile_TEXINFOS
* doc/ref/Makefile.am (guile_TEXINFOS): Add tour.texi.
Andy Wingo [Sun, 2 May 2010 12:18:58 +0000 (14:18 +0200)]
Update example disassemblies
* doc/ref/compiler.texi:
* doc/ref/vm.texi: Update example disassemblies for current compiler,
which uses assert-nargs-ee/locals.
Andy Wingo [Sun, 2 May 2010 11:41:31 +0000 (13:41 +0200)]
add assert-nargs-ee/locals instruction
* libguile/vm-i-system.c (assert-nargs-ee/locals): New instruction, a
combination of assert-nargs-ee and reserve-locals in the case in which
nreq and nlocs can both be represented in 8 bits.
* module/language/glil/compile-assembly.scm (glil->assembly): Add
compiler case.
* doc/ref/vm.texi (Function Prologue Instructions): Update docs.
Andy Wingo [Sun, 2 May 2010 11:15:22 +0000 (13:15 +0200)]
add underflow check in make-array
* libguile/vm-i-scheme.c (make-array): Check for underflow before making
the array.
Andy Wingo [Sun, 2 May 2010 11:14:58 +0000 (13:14 +0200)]
add SCM_UNLIKELY to CHECK_UNDERFLOW
* libguile/vm-engine.h (CHECK_OVERFLOW, CHECK_UNDERFLOW): Add
SCM_UNLIKELY blocks. Fix off-by-one error in CHECK_UNDERFLOW.
(PRE_CHECK_UNDERFLOW): New macro, for checking underflow before
accessing the current sp.
(POP): Use PRE_CHECK_UNDERFLOW.
Andy Wingo [Sun, 2 May 2010 10:46:50 +0000 (12:46 +0200)]
update compiler.texi
* doc/ref/compiler.texi (Compiler Tower): Update for removal of version
from <language>, and add joiner and make-default-environment fields.
Update examples.
(The Scheme Compiler): Update for `macroexpand' instead of
`sc-expand', and that the environment must be a module.
(Tree-IL): Update for new Tree-IL, and change from "vars" to
"gensyms".
(GLIL): Update for new GLIL, including preludes and prompts.
(Assembly): Update for current output (which seems quite verbose).
(Bytecode and Objcode): Update for current output, and some procedure
name changes.
Andy Wingo [Sun, 2 May 2010 09:22:23 +0000 (11:22 +0200)]
rename `vars' field in tree-il binding constructs to `gensyms'
* module/language/tree-il.scm (<tree-il>): Rename `vars' fields of
<let>, <letrec>, <fix>, and <lambda-case> to `gensyms'. For clarity,
and to match <lexical-ref>.
* module/language/tree-il.scm:
* module/language/tree-il/analyze.scm:
* module/language/tree-il/compile-glil.scm:
* module/language/tree-il/fix-letrec.scm:
* module/language/tree-il/inline.scm: Update all callers.
Andy Wingo [Sun, 2 May 2010 09:19:46 +0000 (11:19 +0200)]
fix a comment about environments and the scheme compiler
* module/language/scheme/compile-tree-il.scm: Fix a comment about the
format of environments.
Andy Wingo [Sun, 2 May 2010 09:19:13 +0000 (11:19 +0200)]
remove `version' field from <language>
* module/system/base/language.scm (<language>): Remove the `version'
field from languages. It just wasn't useful.
* module/language/assembly/spec.scm:
* module/language/brainfuck/spec.scm:
* module/language/bytecode/spec.scm:
* module/language/ecmascript/spec.scm:
* module/language/elisp/spec.scm:
* module/language/glil/spec.scm:
* module/language/objcode/spec.scm:
* module/language/scheme/spec.scm:
* module/language/tree-il/spec.scm:
* module/language/value/spec.scm: Remove #:version from all language
definitions. Shorten some language names (e.g. "Guile Scheme" ->
"Scheme").
Andy Wingo [Sat, 1 May 2010 15:02:39 +0000 (17:02 +0200)]
update documentation for vm instructions
* doc/ref/vm.texi: Update with documentation for new-ish instructions,
and reorganize the sections a bit.
* doc/ref/compiler.texi (GLIL): Fix up a couple xrefs.
Andy Wingo [Fri, 30 Apr 2010 22:49:06 +0000 (00:49 +0200)]
simplify make-struct
* libguile/vm-i-scheme.c: Use DROPN idiom.
Andy Wingo [Fri, 30 Apr 2010 22:31:18 +0000 (00:31 +0200)]
optimize and bugfix make-struct VM opcode
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump for make-struct
change.
* libguile/struct.c (scm_i_alloc_struct): Use scm_words instead of
scm_gc_malloc to simplify the code and inline the call to GC_MALLOC.
* module/language/tree-il/compile-glil.scm (*primcall-ops*): Compile
make-struct/no-tail to make-struct.
* module/language/tree-il/primitives.scm (define-primitive-expander):
Allow a conditional branch of #f to aboirt inlining.
(make-struct): Expand into make-struct/no-tail in the case that
tail-size is 0.
* libguile/vm-i-scheme.c (make-struct): Adapt to always assume tail-size
is 0. Inline allocation if possible. Don't decrement the SP past live
objects on the stack, which could cause GC to miss references. Use the
NULLSTACK macro.
Andy Wingo [Tue, 27 Apr 2010 21:04:39 +0000 (23:04 +0200)]
fix bug in compile-glil.scm for return opcode-hack
* module/language/tree-il/compile-glil.scm (*primcall-ops*): Fix entry
for `return'. Thanks to Jon Herron for the report.
Andy Wingo [Tue, 27 Apr 2010 20:57:54 +0000 (22:57 +0200)]
add module-export-all!
* module/ice-9/boot-9.scm (module-export-all!): New function, exports
all current and future local variables from a module.
Andy Wingo [Tue, 27 Apr 2010 20:04:33 +0000 (22:04 +0200)]
Merge branch 'wip-module-namespaces'
Andy Wingo [Tue, 27 Apr 2010 20:04:24 +0000 (22:04 +0200)]
comment some global variables in modules.c
* libguile/modules.c: Comment some global variables.
Neil Jerram [Mon, 26 Apr 2010 21:09:20 +0000 (22:09 +0100)]
Fix inconsistent sectioning, causing make to fail
* doc/ref/guile.texi (Top): Remove @raisesections and @lowersections
around scheme-ideas.texi.
* doc/ref/scheme-ideas.texi (About Data, ...): Instead remove one
"sub" from every node here apart from the chapter node.
* doc/ref/scheme-ideas.texi (Evaluating, Eval Variable, Eval
Procedure, Eval Special, Lexical Scope, Scoping Example): Turn
subheadings back into subsubsections, and reinstate corresponding
menus. (These had to become headings, rather than (sub)*sections, when
the top level item in scheme-ideas.texi was a section. Now it's a
chapter again, they can go back to being (sub)*sections.)
Neil Jerram [Mon, 26 Apr 2010 04:24:24 +0000 (05:24 +0100)]
Bring the manual organisation section a little closer to reality
FWIW I'm not sure I like this bullety presentation - but for now this
just aligns the descriptions a bit closer to the actual chapters and
chapter contents.
* doc/ref/intro.texi (Organisation of this Manual): Cover `Hello
Guile!' and `Hello Scheme!' chapters. Thin out text for
`Programming in Scheme'. Renumber other chapters.