1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 13:00:26 +02:00
Commit graph

2036 commits

Author SHA1 Message Date
Andy Wingo
d61517239d 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.
2010-05-03 17:02:50 +02:00
Andy Wingo
4e3328ce69 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
2010-05-03 17:02:45 +02:00
Andy Wingo
074e036ee2 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.
2010-05-03 17:02:45 +02:00
Andy Wingo
a40e1c9078 remove duplicate quasisyntax.scm EXTRA_DIST
* module/Makefile.am (EXTRA_DIST): Remove quasisyntax.scm, as the
  NOCOMP_SOURCES handles that case.
2010-05-03 17:02:45 +02:00
Andy Wingo
de45d8eef9 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.
2010-05-02 13:41:31 +02:00
Andy Wingo
93f63467e6 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.
2010-05-02 11:22:23 +02:00
Andy Wingo
915aca30ba fix a comment about environments and the scheme compiler
* module/language/scheme/compile-tree-il.scm: Fix a comment about the
  format of environments.
2010-05-02 11:19:46 +02:00
Andy Wingo
246ea9e16a 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").
2010-05-02 11:19:13 +02:00
Andy Wingo
9a974fd384 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.
2010-05-01 00:31:18 +02:00
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