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.
Neil Jerram [Mon, 26 Apr 2010 03:27:01 +0000 (04:27 +0100)]
Assorted minor manual changes
* doc/ref/guile.texi (Programming in Scheme): Remove "awful" and add
"as opposed to having to dive into C code", to explain what we
really mean here. Remove incorrect para about the `Hello Scheme!'
material.
* doc/ref/intro.texi (Interactive Programming): Change "allows" to "is
designed for" - sounds less accidental!
* doc/ref/scheme-ideas.texi (Hello Scheme!): Remove unnecessary
"reference", and inappropriate "randomness".
Neil Jerram [Mon, 26 Apr 2010 01:43:54 +0000 (02:43 +0100)]
More `Guile and the GNU Project' text
* doc/ref/intro.texi (Guile and the GNU Project): More text about
extensibility and software freedom.
Neil Jerram [Sun, 25 Apr 2010 17:53:40 +0000 (18:53 +0100)]
Move description of manual organisation from Preface to Introduction
This material isn't "meta-" enough to be in the Preface, and it
supports (by its structure) some of the points that the Introduction
makes about Guile, so I think it belongs here.
* doc/ref/intro.texi (Introduction): Add `Organisation of this Manual'
menu item and material to here...
* doc/ref/preface.texi (Preface): ...from here.
Neil Jerram [Sun, 25 Apr 2010 17:28:19 +0000 (18:28 +0100)]
Remove weird instruction
* doc/ref/intro.texi: Remove `Do not confuse the two.' (Or else
what?)
Neil Jerram [Sun, 25 Apr 2010 17:12:01 +0000 (18:12 +0100)]
Fix typo
* doc/ref/compiler.texi (Bytecode and Objcode): Remove extraneous
comma.
Neil Jerram [Sun, 25 Apr 2010 16:56:56 +0000 (17:56 +0100)]
Move `Reporting Bugs' section out of Introduction
I think it's too detailed, when compared with the other Introduction
sections. It probably also refers to concepts that haven't been
mentioned yet, but are mentioned in the following quick tour chapter;
so let's move it there.
* doc/ref/guile.texi: Move @raisesections and @lowersections for
tour.texi material from here to inside tour.texi.
* doc/ref/intro.texi (Introduction): Don't mention reporting problems
in first para. Move menu item and material for `Reporting Bugs'
from here...
* doc/ref/tour.texi (Hello Guile!): ...to here. Also mention
reporting problems in the introductory para.
Neil Jerram [Sun, 25 Apr 2010 16:01:01 +0000 (17:01 +0100)]
Move whirlwind tour material to its own chapter
* doc/ref/guile.texi (Top): New top level `Hello Guile!' menu item;
include new file tour.texi.
* doc/ref/intro.texi (Introduction): Remove whirlwind tour menu item
and material from here...
* doc/ref/tour.texi: ...to new file here.
Neil Jerram [Sun, 25 Apr 2010 12:20:17 +0000 (13:20 +0100)]
Move Scheme introduction (Guile-independent) to its own chapter
This magically fixes all the internal wordings that say "chapter"
rather than "section", and separates Guile-independent and skippable
material from material that is Guile-specific and
probably-not-skippable - which I think is helpful.
* doc/ref/guile.texi (Top): New `Hello Scheme!' menu item, and removed
`Basic Ideas' item. Move include of scheme-ideas.texi before
`Programming in Scheme' chapter, using @raisesections and
@lowersections. Also move scheme-reading.texi to same place.
* doc/ref/scheme-ideas.texi: Change name from `Basic Ideas' (which is
a bit boring) to `Hello Scheme!'. Move `Further Reading' menu item
here.
Andy Wingo [Fri, 23 Apr 2010 15:16:56 +0000 (17:16 +0200)]
module-public-interface is a field in the module record
* module/ice-9/boot-9.scm (module-public-interface)
(set-module-public-interface!): Instead of using
'%module-public-interface, use a field in the module instead.
(make-module, make-autoload-interface): Adapt.
* module/ice-9/deprecated.scm (module-public-interface):
(set-module-public-interface!): Add shims so that manually munging
%module-public-interface should continue to work.
Andy Wingo [Fri, 23 Apr 2010 15:22:00 +0000 (17:22 +0200)]
fix some uses of %module-public-interface
* module/ice-9/r5rs.scm:
* module/ice-9/safe-r5rs.scm:
* module/oop/goops/save.scm:
* module/oop/goops/simple.scm:
* module/oop/goops/stklos.scm: Fix some uses of
%module-public-interface.
Andy Wingo [Fri, 23 Apr 2010 15:03:34 +0000 (17:03 +0200)]
module-public-interface in Scheme
* libguile/modules.c: Consolidate all variables to the top of the file.
(scm_module_public_interface): Dispatch to Scheme.
(scm_post_boot_init_modules): Resolve module-public-interface.
* module/ice-9/boot-9.scm (module-public-interface): Implement in
Scheme.
Andy Wingo [Fri, 23 Apr 2010 14:31:09 +0000 (16:31 +0200)]
add submodule binders
* module/ice-9/boot-9.scm (module-submodule-binder)
(set-module-submodule-binder!): New field on modules.
(make-module, make-autoload-interface): Adapt.
(module-ref-submodule): If we miss the submodules table, call the
submodules binder, if any.
* module/ice-9/deprecated.scm (module-ref-submodule): Check the
submodule binder before the deprecated look into the obarray.
Andy Wingo [Fri, 23 Apr 2010 14:13:06 +0000 (16:13 +0200)]
module-{ref,define}-submodule use the submodules table
* module/ice-9/boot-9.scm (module-ref-submodule)
(module-define-submodule!): Implement in terms of the
module-submodules table, instead of looking for bindings in the value
namespace.
* module/ice-9/deprecated.scm (module-ref-submodule):
(module-define-submodule!): Define deprecated versions of these that
duplicate the submodules table in the normal values namespace, for
back compatibility.
Andy Wingo [Thu, 22 Apr 2010 12:12:05 +0000 (14:12 +0200)]
add submodules field to modules
* module/ice-9/boot-9.scm (module-type, module-constructor): Add a field
to modules, a table that will hold submodules.
(make-module, make-autoload-interface): Adapt.
Andy Wingo [Fri, 23 Apr 2010 14:08:01 +0000 (16:08 +0200)]
use nested-ref-module in (system xref)
* module/system/xref.scm (program-callee-rev-vars): Use
nested-ref-module instead of nested-ref.
Andy Wingo [Fri, 23 Apr 2010 14:03:23 +0000 (16:03 +0200)]
nested module fixen to (ice-9 ls)
* module/ice-9/ls.scm (local-definitions-in, definitions-in): Use nested
module procedures, as appropriate.
(recursive-local-define): Fix attempt to treat null as false. Whoops..
Andy Wingo [Fri, 23 Apr 2010 13:58:08 +0000 (15:58 +0200)]
deprecated %app shims use module-define-submodule!
* module/ice-9/deprecated.scm (%app, app, modules): Don't use the module
interface to provide %app shims, use module-define-submodule! directly
to side-effect the root module.
Andy Wingo [Fri, 23 Apr 2010 13:55:32 +0000 (15:55 +0200)]
resolve-module uses -module variants
* module/ice-9/boot-9.scm (resolve-module): Use module-define-submodule!
when binding the root, and nested-ref-module for the hot lookup, which
is guaranteed to return a module or #f.
Andy Wingo [Fri, 23 Apr 2010 13:44:31 +0000 (15:44 +0200)]
use the define-module variants in module-name and make-modules-in
* module/ice-9/boot-9.scm (module-name): Use module-define-submodule!
instead of nested-define!.
(make-modules-in): Rewrite in terms of nested-define-module!.