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

4577 commits

Author SHA1 Message Date
Andy Wingo
52272fc764 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.
2010-04-27 23:04:39 +02:00
Andy Wingo
d2b7b761e5 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.
2010-04-27 22:57:54 +02:00
Andy Wingo
4e48b4950e 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.
2010-04-24 17:43:59 +02:00
Andy Wingo
69928c8a32 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.
2010-04-24 17:43:52 +02:00
Andy Wingo
993dae8623 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.
2010-04-24 17:42:01 +02:00
Andy Wingo
81fc66cfb6 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.
2010-04-24 17:42:01 +02:00
Andy Wingo
f6a5308b03 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.
2010-04-24 17:42:01 +02:00
Andy Wingo
f905381d31 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.
2010-04-24 17:42:00 +02:00
Andy Wingo
9b023f3c63 use nested-ref-module in (system xref)
* module/system/xref.scm (program-callee-rev-vars): Use
  nested-ref-module instead of nested-ref.
2010-04-24 17:42:00 +02:00
Andy Wingo
28b8c785e7 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..
2010-04-24 17:42:00 +02:00
Andy Wingo
635a8b36b1 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.
2010-04-24 17:42:00 +02:00
Andy Wingo
d58ccc669c 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.
2010-04-24 17:42:00 +02:00
Andy Wingo
9e0bfdbaa3 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!.
2010-04-24 17:42:00 +02:00
Andy Wingo
b910c4ac4e nested-ref et al use module-ref-submodule; add -module nested variants
* module/ice-9/boot-9.scm: Update comments above nested-ref to include
  ref-module and define-module!.
  (nested-ref, nested-set!, nested-define!, nested-remove!): Use
  module-ref-submodule to traverse the module hierarchy.
  (nested-ref-module, nested-define-module!): New functions, like
  nested-ref and nested-define!, but operate on namespaces instead of
  values.
  (local-ref-module, local-define-module): New analogs of local-ref and
  local-define, but for namespaces.
2010-04-24 17:41:47 +02:00
Andy Wingo
0f27ab8a9e add module-ref-submodule, module-define-submodule!
* module/ice-9/boot-9.scm (module-ref-submodule):
  (module-define-submodule!): New stubs, will be used to separate
  traversing the module tree from accessing values.
2010-04-23 16:14:31 +02:00
Andy Wingo
51b22dbb48 tweak to resolve-module
* module/ice-9/boot-9.scm (resolve-module): If we found a module but it
  didn't have a public interface and we're not autoloading, just return
  the module directly instead of dispatching to make-modules-in.
2010-04-23 16:14:31 +02:00
Andy Wingo
aa26a6d2b1 fix (app modules) usage in (ice-9 session)
* module/ice-9/session.scm (root-modules): Fix '(app modules) usage.
2010-04-23 16:14:31 +02:00
Andy Wingo
cb67c838f5 deprecate %app
* module/ice-9/boot-9.scm (module-name): Don't rely on (%app modules),
  use other tricks to name anonymous modules.
  (resolve-module): Instead of relying on %app, close over the root of
  the module hierarchy -- the module that was '(%app modules).

* module/ice-9/deprecated.scm (%app): Provide a compatible %app shim.
2010-04-22 15:37:04 +02:00
Andy Wingo
bbd1d13333 refactorings for the module boot process
* module/ice-9/boot-9.scm (%app): Bind %app and (%app modules) within
  the nested hierarchy before making (guile).
  (the-root-module): Define to '(%app modules guile) together with
  the-root-module's definition.
  (resolve-module): Define a "phase 2" resolve-module that only works on the
  root module.
  (try-module-autoload): No need for stub definition, as modules.c does
  not reference this binding.
  (resolve-module): Redefine, after modules have been loaded, to
  actually do its job, without any hacks for the pre-boot phase.

  Move up the boot code before the definition of resolve-module's
  helpers.
2010-04-22 15:36:42 +02:00
Andy Wingo
dbbbc2a1d0 add comments to resolve-module
* module/ice-9/boot-9.scm (resolve-module): Add comments.
2010-04-22 15:31:02 +02:00
Andy Wingo
c9904ab040 formally deprecate `app'
* module/ice-9/deprecated.scm (app): Deprecate.
* module/ice-9/boot-9.scm: Remove app definition.
2010-04-22 15:31:02 +02:00
Andy Wingo
30ce621c5a (app modules) -> (%app modules)
* module/ice-9/debugging/breakpoints.scm (module-if-already-loaded):
  (all-loaded-modules):
* module/oop/goops/stklos.scm: Fix instances of (app modules) to be
  (%app modules).
2010-04-22 15:31:02 +02:00
Andy Wingo
53ab624703 fix comment about "local-define" and "local-remove".
* module/ice-9/boot-9.scm: Fix comment about "local-define!", whereas
  it's "local-define". Same for "local-remove".
2010-04-20 12:43:15 +02:00
Andy Wingo
31ac29b621 module-type defined programmatically
* module/ice-9/boot-9.scm (make-record-type): Add an explanatory
  comment.
  (%print-module): Remove a hacky comment about redefinitions being
  difficult, because now the module-printer is called by name from
  module-type's printer.
  (module-type): Define the module type, its constructor, predicate, and
  accessors programmatically, at expansion time. Should reduce any
  errors in transcription, between adding fields and adding accessors.

* libguile/modules.c (scm_lookup_closure_module): Move an explanatory
  comment here from boot-9.scm.
2010-04-20 12:34:05 +02:00
Andy Wingo
e31f22ebf0 avoid primitive-eval in record-constructor
* module/ice-9/boot-9.scm (record-type-vtable): Add a third field, a
  precomputed constructor. There is an unfortunate circularity here,
  though.
  (make-record-type): If the record has fewer than 20 fields,
  return a constructor pre-generated to suit. Otherwise just check the
  length, and dispatch to `apply' and not `primitive-eval'. FWIW the
  current module record has something like 12 fields.
  (record-constructor): If we're asking for the standard constructor,
  return the precomputed constructor.
2010-04-19 20:19:24 +02: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
b9e67767ae compile-file gets #:canonicalization arg, defaults to 'relative
* module/system/base/compile.scm (compile-file, compile-and-load): Add a
  keyword arg #:canonicalization, which defaults to 'relative. In this
  way, one might compile "../module/ice-9/boot-9.scm", but the path that
  gets residualized into the .go is "ice-9/boot-9.scm".
2010-04-19 13:34:29 +02:00
Andy Wingo
3fc7e2c123 deprecate arity access via (procedure-properties proc 'arity)
* libguile/procprop.h (scm_sym_arity): Deprecate. I didn't move it to
  deprecated.h though, because that might have some boot implications --
  though I didn't check.

* libguile/procprop.c (scm_procedure_properties)
  (scm_set_procedure_properties_x, scm_procedure_property)
  (scm_set_procedure_property_x): Deprecate access to a procedure's
  arity via procedure-properties. Users should use
  procedure-minimum-arity.

* module/ice-9/channel.scm (eval):
* module/ice-9/session.scm (arity):
* module/language/tree-il/analyze.scm (validate-arity): Fix up instances
  of (procedure-property x 'arity) to use procedure-minimum-arity.
2010-04-17 16:28:52 +02:00
Andy Wingo
1e23b461ec remove program-name, program-documentation
* libguile/programs.h:
* libguile/programs.c (scm_program_name): Remove. procedure-name is
  sufficient.

* module/system/vm/program.scm (program-name): Remove from exports list.
  (program-documentation): Remove; procedure-documentation is
  sufficient.

* libguile/debug.c (scm_procedure_name): Remove special case for
  programs.

* module/language/tree-il/analyze.scm (validate-arity): Use
  procedure-name.

* module/ice-9/documentation.scm (object-documentation): Just use
  procedure-documentation, without special cases for programs.
2010-04-17 15:21:08 +02:00
Andy Wingo
07e424b753 scm_i_program_properties is internal; just use procedure-properties
* libguile/programs.h:
* libguile/programs.c (scm_i_program_properties): Make internal.
  (scm_program_name): Use scm_i_program_properties.

* libguile/procprop.c (scm_procedure_properties): Use
  scm_i_program_properties, for programs.

* libguile/procs.c (scm_procedure_documentation): Use procedure-property
  to get to 'documentation, not program-property.

* module/system/vm/program.scm (program-properties, program-property):
  Remove from the exports list.
  (program-documentation): Use procedure-property.

* module/texinfo/reflection.scm (macro-arguments)
  (macro-additional-stexi)
  (object-stexi-documentation): Use procedure-property, not
  program-property.
2010-04-17 15:21:08 +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
Andy Wingo
474060a23c elisp fixes for nil, and, or
* module/language/elisp/runtime/macro-slot.scm (or, and): Fix one-arg
  case to return the arg as-is.

* module/language/elisp/runtime.scm (nil-value): Fix to be #nil.
2010-04-09 21:06:29 +02:00
Andy Wingo
cd038da546 remove libguile/lang.h, deprecate %nil (in favor of #nil)
* libguile/Makefile.am:
* libguile/init.c:
* libguile/lang.c:
* libguile/lang.h: Remove lang.c and lang.h.

* libguile/pairs.h (SCM_NIL_P, SCM_NULL_OR_NIL_P): Moved here.

* module/ice-9/deprecated.scm (%nil): %nil definition moved here.

* libguile/alist.c:
* libguile/async.c:
* libguile/backtrace.c:
* libguile/boolean.c:
* libguile/dynl.c:
* libguile/eval.c:
* libguile/filesys.c:
* libguile/fluids.c:
* libguile/list.c:
* libguile/load.c:
* libguile/options.c:
* libguile/posix.c:
* libguile/print.c:
* libguile/promises.c:
* libguile/sort.c:
* libguile/throw.c:
* libguile/trees.c:
* libguile/vectors.c:
* libguile/vm.c:
* libguile/weaks.c:
* srfi/srfi-1.c: <libguile/lang.h> references removed.
2010-04-09 14:26:31 +02:00
Andy Wingo
54e53aa430 %nil -> #nil
* module/language/assembly.scm (object->assembly, assembly->object):
* module/language/elisp/compile-tree-il.scm (compile-pair):
* module/language/glil/decompile-assembly.scm (decompile-load-program):
  Change instances of %nil to #nil.
2010-04-09 14:17:04 +02:00
Andy Wingo
92e19ec06d add debugging input and output ports
* module/system/vm/debug.scm (*debug-input-port*):
  (*debug-output-port*): New public fluids.
  (run-debugger): Add some kwargs for input and output ports, defaulting
  to the debug input and output ports.
  (debug-pre-unwind-handler): Print to debug output port.
  (debug): Untabify.
2010-04-09 13:41:31 +02:00
Andy Wingo
0becb8f316 repl-reader only prompts if no input is available
* module/ice-9/boot-9.scm (repl-reader): For the default (non-readline)
  repl reader, only display the prompt if input isn't already available.
  Fixes spurious prompts in the debugger.
2010-04-09 13:33:20 +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
8f44138ac6 fix bug when importing bindings that were already imported and used
* module/ice-9/boot-9.scm (module-use!, module-use-interfaces!): When
  adding the module or interface to the use list, clear the cached
  imports obarray.

  The test case is coming next.
2010-04-08 00:29:52 +02:00
Andy Wingo
4d75554d0a very important fix to (system repl command)
* module/system/repl/command.scm (language): s/Have fun/Happy hacking/.
  Heh.
2010-04-07 00:09:53 +02:00
Andy Wingo
d53e5a7edb deprecated sc-expand in deprecated (ice-9 syncase)
* module/ice-9/syncase.scm: Export sc-expand as macroexpand.
2010-04-07 00:05:34 +02:00
Andy Wingo
92d33877d9 fix array bugs in ecmascript
* module/language/ecmascript/array.scm (pput, *array-prototype*): Fix
  bugs in ecmascript array runtime.
2010-03-31 22:31:11 +02:00
Ludovic Courtès
0ecd70a271 Adapt ECMAScript parser and lexer to `(system base lalr)'.
* module/language/ecmascript/tokenize.scm: Use `make-lexical-token' and
  related procedures instead of pairs as tokens passed to the parser.
  Pass source location information in the form of `source-location'
  objects.

* module/language/ecmascript/parse.scm (read-ecmascript,
  read-ecmascript/1): Instantiate a new parser at each call.
  (parse-ecmascript): Rename to...
  (make-parser): ... this.  Change `->' to `:' in the grammar syntax.

* module/language/ecmascript/parse-lalr.scm: Remove.

* module/Makefile.am (ECMASCRIPT_LANG_SOURCES): Remove
  `language/ecmascript/parse-lalr.scm'.
2010-03-31 00:42:01 +02:00
Ludovic Courtès
1b10152215 Add Boucher's lalr-scm' as the (system base lalr)' module.
Taken from r51 of <http://lalr-scm.googlecode.com/svn/trunk>.

* module/Makefile.am (SYSTEM_BASE_SOURCES): Add `system/base/lalr.scm'.
  (NOCOMP_SOURCES): Add `system/base/lalr.upstream.scm'.

* module/system/base/lalr.scm, module/system/base/lalr.upstream.scm: New
  files.

* test-suite/Makefile.am (LALR_TESTS, LALR_EXTRA, TESTS,
  TESTS_ENVIRONMENT): New variables.
  (EXTRA_DIST): Add $(LALR_EXTRA).

* test-suite/lalr/common-test.scm,
  test-suite/lalr/glr-test.scm,
  test-suite/lalr/test-glr-associativity.scm,
  test-suite/lalr/test-glr-basics-01.scm,
  test-suite/lalr/test-glr-basics-02.scm,
  test-suite/lalr/test-glr-basics-03.scm,
  test-suite/lalr/test-glr-basics-04.scm,
  test-suite/lalr/test-glr-basics-05.scm,
  test-suite/lalr/test-glr-script-expression.scm,
  test-suite/lalr/test-glr-single-expressions.scm,
  test-suite/lalr/test-lr-associativity-01.scm,
  test-suite/lalr/test-lr-associativity-02.scm,
  test-suite/lalr/test-lr-associativity-03.scm,
  test-suite/lalr/test-lr-associativity-04.scm,
  test-suite/lalr/test-lr-basics-01.scm,
  test-suite/lalr/test-lr-basics-02.scm,
  test-suite/lalr/test-lr-basics-03.scm,
  test-suite/lalr/test-lr-basics-04.scm,
  test-suite/lalr/test-lr-basics-05.scm,
  test-suite/lalr/test-lr-error-recovery-01.scm,
  test-suite/lalr/test-lr-error-recovery-02.scm,
  test-suite/lalr/test-lr-no-clause.scm,
  test-suite/lalr/test-lr-script-expression.scm,
  test-suite/lalr/test-lr-single-expressions.scm: New files.
2010-03-31 00:41:59 +02:00
Andy Wingo
4f08d0b50f (texinfo reflection) parses out macro metadata
* module/texinfo/reflection.scm (macro-arguments):
  (macro-additional-stexi, object-stexi-documentation): Parse out the
  metadata in macros, if it is available, so we can show defmacros'
  arguments, syntax-rules' patterns, etc.
2010-03-29 18:12:37 +02:00
Andy Wingo
a5e95abe9b metadata for syntax-rules, identifier-syntax, and define-macro macros
* module/ice-9/psyntax.scm (syntax-rules, identifier-syntax):
* module/ice-9/boot-9.scm (define-macro): Embed metadata into the macro
  transformer for use by documentation tools and the like.

* module/ice-9/psyntax-pp.scm: Regenerated.
2010-03-29 18:01:34 +02:00
Andy Wingo
98dcf051e0 Fix inlining of lambda-apply-lambda.
* module/language/tree-il/inline.scm (inline!): Only inline (lambda args
  (apply (lambda ...) args)) if the outer lambda has rest args. Thanks
  to Mark Weaver for the note.
2010-03-28 14:31:57 +02:00
Andy Wingo
1f51e2757c vectors of pairs in docstring position are metadata
* module/ice-9/psyntax.scm (chi-lambda-case, lambda): If we find a
  vector of pairs in the docstring position, interpret those pairs as
  additional metadata.

* module/ice-9/psytntax-pp.scm: Regenerated.
2010-03-25 14:19:25 +01:00