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

22 commits

Author SHA1 Message Date
BT Templeton
5ddd9645c9 Merge branch 'bt/elisp'
Conflicts:
	am/guilec
	libguile/_scm.h
	libguile/vm-i-scheme.c
	module/language/elisp/compile-tree-il.scm
	module/language/elisp/runtime.scm
	module/language/elisp/runtime/macros.scm
	module/language/tree-il/compile-glil.scm
	module/language/tree-il/primitives.scm
2012-03-05 16:52:05 -05:00
BT Templeton
35724ee1dc remove dynamic function binding
* module/language/elisp/compile-tree-il.scm (find-operator): Assume that
  `name' is lexically bound.
* module/language/elisp/runtime.scm (symbol-fbound?, fmakunbound!):
  Assume that `symbol' is lexically bound.
  (defspecial): Bind special operators lexically.
2012-02-03 18:53:49 -05:00
BT Templeton
5bdd388cf0 remove unused code
* module/language/elisp/compile-tree-il.scm (runtime-error): Remove.
* module/language/elisp/runtime.scm (macro-error, runtime-error,
  elisp-bool, prim): Remove.
2012-02-03 18:53:49 -05:00
BT Templeton
85bc6238bf simplify elisp symbol accessors
* module/language/elisp/boot.el (fset, symbol-value, symbol-function)
  (set, makunbound, fmakunbound, boundp, fboundp): Use procedures in
  `(language elisp runtime)'.
  (symbolp): New function.

* module/language/elisp/compile-tree-il.scm (set-variable!): Use
  `set-symbol-function!'.

* module/language/elisp/runtime.scm (reference-variable, set-variable!):
  Remove.
  (symbol-fluid, set-symbol-fluid!): New procedure.
  (symbol-value, set-symbol-value!, symbol-function)
  (set-symbol-function!, symbol-bound?, symbol-fbound?, makunbound!)
  (fmakunbound!): Moved from `(language elisp subrs)' and updated to
  avoid using `reference-variable' and `set-variable!'.

* module/language/elisp/runtime/subrs.scm (symbol-value)
  (symbol-function, set, fset, makunbound, fmakunbound, boundp)
  (fboundp): Move to `(language elisp runtime)'.
  (apply): Use `symbol-function'.
2012-02-03 18:53:49 -05:00
BT Templeton
b652e2b93f rewrite elisp macros in elisp
* module/language/elisp/runtime/macros.scm: Remove.
  (macro-lambda, macro-prog1, macro-prog2, macro-cond, macro-and,
  macro-or, macro-catch, macro-unwind-protect): Rewrite in Elisp and
  move to...
* module/language/elisp/boot.el (lambda, prog1, prog2, cond, and, or,
  catch, unwind-protect): ...here.
  (eval-and-compile): New macro.
  (funcall, fset, null, consp, listp, car, cdr, make-symbol-signal):
  Wrap definitions in an `eval-and-compile' form so that they can be
  used by the rewritten macros.
* module/language/elisp/runtime.scm: Remove `built-in-macro'.
* module/language/elisp/Makefile.am: Remove
  module/language/elisp/runtime/macros.scm from `ELISP_LANG_SOURCES'.
2012-02-03 18:53:48 -05:00
BT Templeton
9b15703d79 rewrite elisp subrs in elisp
* module/language/elisp/runtime/subrs.scm (%, *, +, -, /=, 1+, 1-, <)
  (<=, =, >, >=, abs, append, atom, car, car-safe, cdr, cdr-safe, cons)
  (consp, eq, equal, fceiling, ffloor, float, floatp, fround, ftruncate)
  (funcall, integerp, length, list, listp, make-list, max, min, nlistp)
  (nth, nthcdr, null, numberp, reverse, setcar, setcdr, wholenump)
  (zerop): Rewrite in Elisp and move to...
* module/language/elisp/boot.el: ...here. Some functions have stricter
  type checking, and `elisp-bool' is not currently used (so some
  predicate functions now return `#f' instead of `#nil').
  (boundp, eval, fboundp, fmakunbound, fset, load, makunbound, set)
  (symbol-function, symbol-value, throw): New functions; they call their
  existing implementations in subrs.scm.
  (@): New macro.
* module/language/elisp/runtime.scm (built-in-func): Remove. All uses
  changed.
* module/language/elisp/runtime/function-slot.scm: Update module
  definition.
2012-02-03 18:53:48 -05:00
Andy Wingo
9447207f0c Use default value for make-fluid in Scheme files
* module/ice-9/boot-9.scm (%exception-handler)
  (%running-exception-handlers, read-eval?, *repl-stack*)
  (make-mutable-parameter):
* module/ice-9/getopt-long.scm (%program-name):
* module/language/elisp/runtime.scm (built-in-macro, defspecial):
* module/srfi/srfi-39.scm (make-parameter/helper):
* module/system/base/language.scm (*current-language*):
* module/system/base/message.scm (*current-warning-port*):
  (*current-warning-prefix*):
* module/system/base/target.scm (%target-type, %target-endianness)
  (%target-word-size):
* module/texinfo/plain-text.scm (*indent*, *itemizer*):
* benchmark-suite/lib.scm (prefix-fluid):
* test-suite/lib.scm (prefix-fluid): Give fluids a useful default
  value.
2011-11-23 12:54:09 +01:00
Andy Wingo
e01163b5f1 rename make-undefined-fluid to make-unbound-fluid
* libguile/fluids.c (scm_make_unbound_fluid): Rename from
  scm_make_undefined_fluid.

* libguile/fluids.h:
* module/language/elisp/runtime.scm: Update referrers.
2010-12-17 13:10:03 +01:00
Brian Templeton
c6920dc8ba lexical function binding for elisp
* module/language/elisp/compile-tree-il.scm (access-variable)
  (reference-variable, set-variable!): Handle globally-bound non-special
  variables.

  (bind-lexically?): Create lexical bindings for flet and flet*.

* module/language/elisp/runtime.scm (reference-variable, set-variable!):
  Handle globally-bound non-special variables.

  (built-in-func): Set the variable directly instead of storing the
  function in a fluid.

* module/language/elisp/runtime/subrs.scm (funcall): Call apply
  directly.

* test-suite/tests/elisp-compiler.test ("Function Definitions")["flet
  and flet*"]:

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:03 +01:00
Brian Templeton
3f70b2dc5c use unbound fluids instead of `void' sentinel value
* module/language/elisp/compile-tree-il.scm (reference-with-check)
  (compile-without-void-checks, want-void-check?): Remove.

  (compile-function, compile-pair): Use `reference-variable' instead of
  `reference-with-check'.

  (compile-defvar): Only set `sym' if `sym' is not bound to a bound
  fluid, rather than requiring that its value be `void'.

  (process-options!): Remove `#:disable-void-check' option handling.

* module/language/elisp/runtime.scm (void)
  (reference-variable-with-check): Remove.

  (ensure-fluid!): Use an undefined fluid as the initial value for
  global variables.

* module/language/elisp/runtime/function-slot.scm (without-void-checks):
  Don't import or re-export.

* module/language/elisp/runtime/macros.scm (prog1, cond, or, dolist):
  Don't use `without-void-checks'.

* module/language/elisp/runtime/subrs.scm (symbol-value)
  (symbol-function, apply): Use `reference-variable' instead of
  `reference-variable-with-check'.

  (makunbound, fmakunbound, boundp, fboundp): Unset the variable's fluid
  (or the variable itself, if it isn't bound to a fluid).

* test-suite/tests/elisp-compiler.test ("Variable
  Setting/Referencing")["disabled void check (all)", "disabled void
  check (symbol list)", "without-void-checks"]: Remove.

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:03 +01:00
Brian Templeton
44ae163d2c store special operators in the function slot
If the function slot of a symbol contains a pair with `special-operator'
in the car and a procedure in the cdr, the procedure is called to
compile the form to Tree-IL. This is similar to other Emacs Lisp
implementations, in which special operators are subrs.

* module/language/elisp/compile-tree-il.scm: Restructured to store
  special operator definitions in the function slot. Import `(language
  elisp runtime)' for `defspecial'. Export special operators so that
  `(language elisp runtime function-slot)' can re-export them.

  (backquote?): Removed; the backquote symbol is defined as a special
  operator, so it's no longer used in `compile-pair'.

  (is-macro?, get-macro): Replaced by `find-operator'.
  (find-operator): New procedure.

  (compile-progn, compile-if, compile-defconst, compile-defvar,
  compile-setq, compile-let, compile-lexical-let, compile-flet,
  compile-let*, compile-lexical-let*, compile-flet*,
  compile-without-void-checks, compile-with-always-lexical,
  compile-guile-ref, compile-guile-primitive, compile-while,
  compile-function, compile-defmacro, compile-defun, #{compile-`}#,
  compile-quote): New special operators with definitions taken from the
  pmatch form in `compile-pair'. There is no special operator `lambda';
  it is now a macro, as in other Elisp implementations.

  (compile-pair): Instead of directly compiling special forms, check for
  a special operator object in the function slot.

* module/language/elisp/runtime.scm: Export `defspecial'.
  (make-id): New function.
  (built-in-macro): Prefix macros with `macro-'.
  (defspecial): New syntax.

* module/language/elisp/runtime/function-slot.scm: Import and re-export
  special operators. Rename imported special operators and macros to
  remove prefixes. Re-export new macro `lambda'.

* module/language/elisp/runtime/macros.scm (macro-lambda): New Elisp
  macro.
2010-12-07 13:21:02 +01:00
Brian Templeton
8295b7c4e5 store macro definitions in the function slot
Guile Emacs Lisp previously kept macros in a separate macro slot; now
macros are stored as macro objects in the function slot for
compatibility with other implementations.

* module/language/elisp/compile-tree-il.scm (macro-slot): Remove.
  (is-macro?): Check that the argument is a symbol. Now-unnecessary
  check removed in `compile-tree-il'.
  (macro?, define-macro!, get-macro): Store macro definitions in the
  function slot, not in a separate macro slot.
* module/language/elisp/runtime.scm (built-in-macro): Wrap the macro
  function in a macro object (i.e., cons the symbol `macro' onto it).
* module/language/elisp/runtime/function-slot.scm: Move contents to
  "subrs.scm". Re-export function and macro definitions instead of
  defining functions directly in this module.
* module/language/elisp/runtime/macro-slot.scm: Move contents to
  "macros.scm" and remove.
* module/language/elisp/runtime/macros.scm: New file containing macro
  definitions from "macro-slot.scm".
* module/language/elisp/runtime/subrs.scm: New file containing function
  definitions from "function-slot.scm".

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:02 +01:00
Brian Templeton
f4e5e4114d reindent
* module/language/elisp/bindings.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/elisp/lexer.scm:
* module/language/elisp/parser.scm:
* module/language/elisp/runtime.scm:
* module/language/elisp/runtime/function-slot.scm:
* module/language/elisp/runtime/macro-slot.scm:
* module/language/elisp/spec.scm: Reindent.

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:01 +01:00
Brian Templeton
c983a199d8 reformat comments
* module/language/elisp/bindings.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/elisp/lexer.scm:
* module/language/elisp/parser.scm:
* module/language/elisp/runtime.scm:
* module/language/elisp/runtime/function-slot.scm:
* module/language/elisp/runtime/macro-slot.scm:
* module/language/elisp/runtime/value-slot.scm: Reformat comments.

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:01 +01:00
Brian Templeton
abcf4a9e1d whitespace changes
* module/language/elisp/bindings.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/elisp/lexer.scm:
* module/language/elisp/parser.scm:
* module/language/elisp/runtime.scm:
* module/language/elisp/runtime/function-slot.scm:
* module/language/elisp/runtime/macro-slot.scm: Ensure that all
  top-level forms and comments are separated by exactly one newline.
  Remove blank lines in most procedure bodies. Delete trailing
  whitespace.

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:01 +01: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
Ludovic Courtès
eb80072df0 Change the Elisp compiler from GPLv2+ to LGPLv3+.
* module/language/elisp/bindings.scm, module/language/elisp/lexer.scm,
  module/language/elisp/parser.scm, module/language/elisp/runtime.scm,
  module/language/elisp/runtime/function-slot.scm,
  module/language/elisp/runtime/macro-slot.scm,
  module/language/elisp/runtime/value-slot.scm: Switch from GPLv2+ to
  LGPLv3+; fix copyright year.
2009-12-15 19:10:48 +01:00
Daniel Kraft
3709984696 Implemented dynamic symbol access built-ins (set, fset, symbol-value, makunbound...)
* module/language/elisp/README: Document it.
* module/language/elisp/compile-tree-il.scm: Moved ensure-fluid! to runtime function.
* module/language/elisp/runtime.scm: Runtime functions to support dynamic value access.
* module/language/elisp/runtime/function-slot.scm: Defined the built-ins.
* test-suite/tests/elisp-compiler.test: Test them.
2009-07-23 14:09:55 +02:00
Daniel Kraft
f614ca12cd Implemented some important list built-ins.
* module/language/elisp/runtime.scm: Updated/added convenience macros.
* module/language/elisp/runtime/function-slot.scm: Implement list built-ins.
* module/language/elisp/runtime/macro-slot.scm: Implement list built-ins.
* test-suite/tests/elisp-compiler.test: Test the implemented built-ins.
2009-07-18 20:10:24 +02:00
Daniel Kraft
7d1a978289 Implemented unless, when and dotimes using built-in macros.
* module/language/elisp/README: Document that.
* module/language/elisp/runtime.scm: Defined built-in-macro macro.
* module/language/elisp/runtime/macro-slot.scm: Implement unless, when, dotimes.
* test-suite/tests/elisp-compiler.test: Test for those constructs.
2009-07-18 18:38:42 +02:00
Daniel Kraft
1e018f6c67 Some bug fixes on the way and mainly implemented some built-ins (arithmetic).
* module/language/elisp/README: Document changes.
* module/language/elisp/compile-tree-il.scm: Bug fixes to fluid-creation.
* module/language/elisp/runtime.scm: Some helping definitions for built-ins.
* module/language/elisp/runtime/function-slot.scm: Defined artihmetic built-ins.
2009-07-13 18:35:57 +02:00
Daniel Kraft
344927c3f8 Implemented fluid-based variable references and setting using setq.
* module/language/elisp/README: Document this.
* module/language/elisp/compile-tree-il.scm: Implement variable references, setq
* module/language/elisp/runtime.scm: New file for runtime definitions.
* module/language/elisp/runtime/function-slot.scm: Ditto.
* module/language/elisp/runtime/value-slot.scm: Ditto.
2009-07-03 23:00:12 +02:00