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

182 commits

Author SHA1 Message Date
Robin Templeton
e3d13813aa use standard evaluator
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/compile-tree-il.scm: Remove import of
  "(language tree-il eval)".
  (defmacro): Use standard "eval".
* module/language/elisp/runtime.scm: Remove import of "(language tree-il eval)".
2016-03-25 12:00:14 -07:00
Robin Templeton
03dfb00880 guile-backtrace function
* module/language/elisp/boot.el (guile-backtrace): New function
  extracted from `backtrace'.
  (backtrace): Use it.
2016-03-25 12:00:13 -07:00
Robin Templeton
02bb985c98 use guile eval for elisp tree-il
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/boot.el (eval): Update with simplified definition.
* module/language/elisp/compile-tree-il.scm: Import "(language tree-il eval)".
  (eval-when-compile): Use eval-elisp.
  (defmacro): Use eval-tree-il.
* module/language/elisp/runtime.scm: Import "(language tree-il eval)".
  (eval-elisp): Use "eval" to evaluate compiled form within current-module.
2016-03-25 12:00:13 -07:00
Robin Templeton
7bfd2ba132 deprecated eval-when situations
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/compile-tree-il.scm (eval-when): Update.
2016-03-25 12:00:13 -07:00
Robin Templeton
4455381dc7 execute top level require forms
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/boot.el (require): New compiler macro.
2016-03-25 12:00:13 -07:00
Robin Templeton
b5701278c9 top level fixes
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/compile-tree-il.scm (compile-pair): Use
  compile-expr-1 instead of compile-expr.
2016-03-25 12:00:13 -07:00
Robin Templeton
93b8b53c65 only evaluate top-level macro definitions
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/compile-tree-il.scm (defmacro): Check to see
  whether toplevel? is true before compiling a macro.
2016-03-25 12:00:13 -07:00
Robin Templeton
4c6ef2b4cb degenerate let forms
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/compile-tree-il.scm (let): Conditionally invoke
  make-body within make-dynlet or just on its own depending on whether
  or not dynamic? is null?.
2016-03-25 12:00:13 -07:00
Robin Templeton
d9284d3bcd eval-when
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/compile-tree-il.scm (progn): Use compile-expr-1
  instead of compile-expr.
  (toplevel?, compile-time-too?): New fluids.
  (eval-when): New special form.
  (compile-expr, compile-expr-1): compile-expr is renamed to
  compile-expr-1, and compile-expr  is now a procedure which, if
  fulid-ref of toplevel? is true, will call compile-expr-1 with
  toplevel? fulid bound to #f.  Otherwise, continue with compile-expr-1.
  (compile-tree-il): Set toplevel? and compile-time-too? fluids to #t
  during evaluation.
2016-03-25 12:00:13 -07:00
Robin Templeton
3587fb1a9e fset macro
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/boot.el (fset): Update to handle macros.
2016-03-25 12:00:12 -07:00
Robin Templeton
9f316dd753 use defsubst
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/boot.el (null, consp, listp, car, cdr): Update
  to use defsubst.
  (atom): New variable, using defsubst.
2016-03-25 12:00:12 -07:00
Robin Templeton
69b80315b5 defsubst
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/boot.el (defsubst): New macro.
2016-03-25 12:00:12 -07:00
Robin Templeton
bf142ba6af compiler macros
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/boot.el (%define-compiler-macro): New macro.
* module/language/elisp/compile-tree-il.scm: New function.
  (compile-pair): Update to handle %compiler-macro condition.
2016-03-25 12:00:12 -07:00
Robin Templeton
bfc3ffe7d5 defconst, defvar: proclaim special at compile-time
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/compile-tree-il.scm (defconst, defvar): Use
  proclaim-special!.
2016-03-25 12:00:12 -07:00
Robin Templeton
1d2aa4a9cf elisp @@ macro
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/boot.el (@@): New macro.
2016-03-25 12:00:12 -07:00
Robin Templeton
cd809c8937 compile-elisp fn
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/runtime.scm (compile-elisp): New procedure.
2016-03-25 12:00:12 -07:00
Robin Templeton
31afd07744 fix symbol-function
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/runtime.scm (symbol-function): Adjust function.
2016-03-25 12:00:12 -07:00
Robin Templeton
ee48df0ec1 restore special operator handling
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/boot.el
  (progn, eval-when-compile, if, defconst, defvar, setq, let, flet)
  (labels, let*, function, defmacro, quote): Removed.

* module/language/elisp/compile-tree-il.scm (special-operators): Removed.
  (compound-pair): Use find-operator to check if a 'special-operator
  rather than checking the now removed special-operators table.

* module/language/elisp/runtime.scm (defspecial): Update to use
  set-symbol-function!
2016-03-25 12:00:11 -07:00
Robin Templeton
54eec21dda define-module for elisp special modules
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/runtime.scm (value-slot-module)
  (function-slot-module, plist-slot-module): Update to set #:pure to #t.
2016-03-25 12:00:11 -07:00
Robin Templeton
efc4163b56 defvar affects default value
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/compile-tree-il.scm (defvar): Refactor appropriately.
2016-03-25 12:00:11 -07:00
Robin Templeton
f162edd28d symbol default value procedures
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/runtime.scm:
  (symbol-default-bound?, symbol-default-value, set-symbol-default-value!):
  New procedure aliases.  Export their symbols.
  (emacs!): Update to accept new parameters dref, dset, dboundp.
2016-03-25 12:00:11 -07:00
Robin Templeton
e4464967f7 read nil/t as #nil/#t
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/lexer.scm (lex): Update to handle #nil / #t.
2016-03-25 12:00:11 -07:00
Robin Templeton
707376055c elisp updates
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/bindings.scm (get-lexical-binding)
  (get-function-binding): Use cadr instead of fluid-ref on slot.
  (with-fluids**): New procedure.
  (with-symbol-bindings, with-function-bindings): Use with-fluids**.
  Also stop using "make-fluid", use "(list #f #f)" instead as default
  lexical-bindings hashtable value.
  (with-lexical-bindings): Drop the error checking for invalid targets.

* module/language/elisp/boot.el (defun, save-excursion)
  (save-current-buffer, save-restriction, track-mouse, setq-default)
  (catch, condition-case): New macros.
  (omega, eval, gensym, interactive, autoload-do-load, fset, prin1)
  (backtrace-frame, backtrace, %set-eager-macroexpansion-mode): New functions.
  (null, consp, listp, car, cdr, make-symbol, signal): Wrap in eval-and-compile.
  (prog1, cond, or, while): Update to make use of gensym.
  (unwind-protect): Switch from funcall to %funcall.
  (%functionp): Rename from functionp.
  (%indirect-function): Update to use %functionp instead of functionp.
  Add check for if object is null, signaling void-function.  Instead of
  calling symbol-function directly, call via %funcall from the module
  "(language elisp runtime)".
  (fset): Significant additions and refactoring.
  (gload): Renamed from fload.
  (defvaralias, nthcdr, nth, eq): Move functions to a different location.
  (eq): Also stop using null.
  (dolist): Remove quasiquoting, build list manually.
  (random): Fix indentation.
  (progn, eval-when-compile, if, defconst, defvar, setq, let, flet)
  (labels, let*, function, defmacro, quote): Protect as special
  operators by raising error if invoked as a function.

* module/language/elisp/compile-tree-il.scm: Import "(ice-9 format)".
  Export compile-%function.
  (lexical-binding, handle-var-def, defun, valid-symbol-list-arg?)
  (process-options!): Remove.
  (reference-variable): Adjust functions passed to access-variable.
  (global?): Drop module parameter, use value-slot instead.
  (ensure-globals!, set-variable!, parse-body-1, parse-lambda-list)
  (compile-lambda, defconst, defvar, let, let*, compile-pair): Refactor.
  (reference-function): Use '(elisp-functions) instead of function-slot.
  (bind-lexically?): Drop module parameter, simplify.
  (make-dynlet): Switch from using make-primcall to make-call.
  (find-operator): Switch from using resolve-interface/resolve-module
  to using function-slot.
  (if, defconst, defvar, let, let*, flet, labels, guile-ref)
  (guile-private-ref, guile-primitive, defmacro, `, quote, %funcall)
  (%set-lexical-binding-mode): Add error checking.
  (setq): Pass in args to report-error.
  (function): Simplified, now calling %function.
  (%function): New function, based on prior "function".  Refactor, including
  adding support for matching against a closure.
  (%set-lexical-binding-mode): Switch from using fluid-set! to
  set-lexical-binding-mode.
  (special-operators): New variable.  Build from following for-each
  statement.
  (compile-tree-il): Drop call to "process-options!"

* module/language/elisp/lexer.scm: Import "(language elisp runtime)".
  (lex): Switch from using "list->string" to "make-lisp-string".

* module/language/elisp/runtime.scm: Use modules "(ice-9 format)",
  "(system base compile)".
  Remove from export list list, removing ensure-fluid!, symbol-fluid!,
  set-symbol-fluid!.  Add to export list ensure-dynamic!, symbol-name,
  symbol-plist, set-symbol-plist!, bind-symbol, symbol-desc, proclaim-symbol!
  special? emacs! unbound, lexical-binding?, set-lexical-binding-mode,
  log!, eval-elisp, local-eval-elisp, make-lisp-string, lisp-string?
  (make-list-string, lisp-string?) New function aliases.
  (value-slot-module, function-slot-module): Adjust module resolution.
  (nil_, t_): New variables.
  (ensure-fluid!, symbol-fluid, set-symbol-fluid!): Removed.
  (lexical-binding, unbound): New variables.
  (lexical-binding?, set-lexical-binding-mode, unbound, dynamic?)
  (make-dynamic, dynamic-ref, dynamic-set!, dynamic-unset!)
  (dynamic-bound?, dynamic-bind, ensure-present!, ensure-desc!)
  (schemify, symbol-name, symbol-desc, ensure-dynamic!, symbol-dynamic)
  (set-symbol-plist!, special?, proclaim-special!, emacs!, eval-elisp)
  (make-string): New procedures.
  (symbol-value): Use dynamic-ref! instead of fluid-ref!.
  (set-symbol-value!): Use dynamic-set! instead of fluid-set!.
  (symbol-function, set-symbol-function!, symbol-bound?)
  (symbol-fbound?, makunbound!, fmakunbound!): Refactor, including
  adjusting how module resolution is being done.

* module/language/elisp/spec.scm: Import module "(system vm vm)".
  Setup elisp-symbols, elisp-functions, elisp-plists.
  Use "set-default-vm-engine!" and "set-vm-engine!" to be set to
  'debug.
  (elisp): Comment out joiner.
2016-03-25 12:00:11 -07:00
BT Templeton
d3dabad7e9 guile-private-ref
* module/language/elisp/compile-tree-il.scm (compile-guile-private-ref):
  New special operator.
2016-03-25 12:00:10 -07:00
Andy Wingo
14b9aa95e6 Fix order of evaluation in elisp lexer
* module/language/elisp/lexer.scm (lex): Use let*, to ensure that the
  port position is read before reading the next char.
2013-11-01 18:23:51 +01:00
Andy Wingo
72bb47ae4c compile-file adds #:to-disk? #t to opts
* module/system/base/compile.scm (compile-file): Pass #:to-disk? as an
  option to indicate that the result will be being loaded from disk.
  Perhaps a linker might want to page-align in that case.

* module/language/elisp/compile-tree-il.scm (process-options!): Accept
  and ignore the #:to-file compiler option.
2013-08-24 15:27:57 +02:00
Andy Wingo
c32b7c4cef Remove with-fluids; replaced by with-fluid* and inlined push-fluid primops
* libguile/vm-i-system.c (push-fluid, pop-fluid):
* doc/ref/vm.texi (Dynamic Environment Instructions): Rename wind-fluids
  to push-fluid, and unwind-fluids to pop-fluid.  They now only work on
  one fluid binding at a time.

* module/ice-9/boot-9.scm (with-fluid*): Implement in Scheme in terms of
  primcalls to push-fluid and pop-fluid.
  (custom-throw-handler, catch, with-throw-handler): Use with-fluid*
  instead of with-fluids, as with-fluids is no longer available before
  psyntax is loaded.
  (with-fluids): Define in Scheme in terms of with-fluid*.

* libguile/fluids.c (scm_with_fluid): Rename from scm_with_fluids, and
  don't expose to Scheme.

* libguile/eval.c (eval): Remove SCM_M_WITH_FLUIDS case.
* libguile/expand.c (expand_with_fluids): Remove with-fluids syntax.
  (DYNLET): Remove, no longer defining dynlet in the %expanded-vtables.
* libguile/expand.h: Remove dynlet definitions.
* module/ice-9/eval.scm (primitive-eval): Remove with-fluids case.
* libguile/memoize.c (do_push_fluid, do_pop_fluid): New primitive
  helpers, like wind and unwind.
  (memoize): Memoize wind and unwind primcalls.  Don't memoize dynlet to
  with-fluids.
  (scm_init_memoize): Initialize push_fluid and pop_fluid here.
* libguile/memoize.h (SCM_M_WITH_FLUIDS): Remove definition.

* module/ice-9/psyntax.scm (build-dynlet): Remove; this just supported
  with-fluids, which is now defined in boot-9.
* module/ice-9/psyntax-pp.scm: Regenerate.

* doc/ref/compiler.texi (Tree-IL):
* module/language/tree-il.scm:
* module/language/tree-il/analyze.scm:
* module/language/tree-il/canonicalize.scm:
* module/language/tree-il/compile-glil.scm:
* module/language/tree-il/cse.scm:
* module/language/tree-il/debug.scm:
* module/language/tree-il/effects.scm: Remove <dynlet>.  Add cases for
  primcalls to push-fluid and pop-fluid in compile-glil.scm and
  effects.scm.

* module/language/tree-il/peval.scm (peval): Factor out
  with-temporaries; probably a bad idea, but works for now.  Factor out
  make-begin0 (a better idea).  Inline primcalls to with-fluid*, and
  remove dynlet cases.

* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
  Add with-fluid*.
2013-06-28 19:52:09 +02:00
BT Templeton
ebc30e3fde length's argument is a sequence
* module/language/elisp/boot.el (length): Use `length' if the argument
  is a list or `generalized-vector-length' otherwise.
2012-04-01 15:59:42 -04:00
BT Templeton
52d2472441 elisp rng
* module/language/elisp/boot.el (random): New function.
2012-03-08 17:08:30 -05:00
BT Templeton
43ff6804d6 elisp i/o
* module/language/elisp/boot.el (send-string-to-terminal)
  (read-from-minibuffer, prin1-to-string): New functions.
2012-03-08 17:08:30 -05:00
BT Templeton
5c65ee510f elisp: symbol-name, intern
* module/language/elisp/boot.el (symbol-name, intern): New functions.
2012-03-08 17:08:30 -05:00
BT Templeton
c0652730bc elisp: when, unless
* module/language/elisp/boot.el (when, unless): New macros.
2012-03-08 17:08:30 -05:00
BT Templeton
12c00a0453 elisp sequence functions
* module/language/elisp/boot.el (nreverse, assoc, assq, rplaca, rplacd)
  (caar, cadr, cdar, cddr, dolist, stringp, string-equal, string=)
  (substring, upcase, downcase, string-match, make-vector, mapc, aref)
  (aset, concat): New functions.
2012-03-08 17:08:30 -05:00
BT Templeton
fc45b7e8e8 integerp, wholenump return nil for non-numbers
* module/language/elisp/boot.el (integerp, wholenump): Call `integer?'
  before `exact?' so that these predicates return nil for non-numbers
  instead of signalling an error.
2012-03-08 17:08:30 -05:00
BT Templeton
663c5875f5 use #nil as default for elisp rest parameters
* module/langauge/elisp/compile-tree-il.scm (compile-lambda): Bind the
  rest parameter to `#nil' instead of `()' by default.
2012-03-05 18:10:29 -05:00
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
eaeda0d550 function binding fixes
* module/language/elisp/bindings.scm (bindings): Add `function-bindings'
  field.
  (make-bindings): Initialize the `function-bindings' field.
  (get-function-binding, with-function-bindings): New functions.

  (access-variable, reference-variable, set-variable!): Remove the
  `module' argument and only handle references to the value cell. All
  callers changed. Callers passing `function-slot' as the module changed
  to use the corresponding functions for the function cell instead.

  (access-function, reference-function, set-function!): New procedures.

  (compile-flet, compile-labels): Use `with-function-bindings' instead
  of `with-lexical-bindings'.
2012-02-03 18:53:51 -05:00
BT Templeton
5199c059e8 sharpsign-colon for uninterned symbols
* module/language/elisp/lexer.sm (lex): Add support for `#:' syntax for
  uninterned symbols.
2012-02-03 18:53:51 -05:00
BT Templeton
39864d2014 elisp I/O
* module/language/elisp/boot.el (princ, print, terpri, format*): New
  functions.
2012-02-03 18:53:50 -05:00
BT Templeton
66be42cb38 improve management of global special variables
* module/language/elisp/bindings.scm (bindings): Remove `globals'
  field. (global?, mark-global!, map-globals): Remove. All callers
  changed.

* module/language/elisp/compile-tree-il.scm (generate-ensure-global,
  ensuring-globals): Remove. All callers changed.

  (global?, ensure-globals!): New procedures.

  (bind-lexically?): Use new `global?'.

  (compile-lambda, compile-let, compile-let*): Use `ensure-globals!'.
2012-02-03 18:53:50 -05:00
BT Templeton
b07a74497a more lexical declarations
* module/language/elisp/boot.el (condition-case, catch): Add `lexical'
  declarations in macro expansions.
2012-02-03 18:53:50 -05:00
BT Templeton
85b3dd6cc2 signal an error for uncaught throws
* module/language/elisp/boot.el (%catch): New variable.

  (catch): Bind `%catch' to `t' during the evaluation of `body'. Call
  `throw' instead of signalling an exception directly.

  (throw): Signal a `no-catch' error if there is no `catch' to throw to.
2012-02-03 18:53:50 -05:00
BT Templeton
8fb678718c catch' in terms of condition-case'
* module/language/elisp/boot.el (throw): Define an `error-conditions'
  property for this symbol.

  (catch): Define in terms of `condition-case' instead of using Guile
  exceptions directly.

  (throw): Signal a `throw' condition instead of throwing a Guile
  exception directly.
2012-02-03 18:53:50 -05:00
BT Templeton
ce9b7cc22c standard error symbols
* module/language/elisp/boot.el (error, wrong-type-argument, no-catch,
  invalid-function): Define `error-conditions' properties for these
  standard error symbols.
2012-02-03 18:53:50 -05:00
BT Templeton
76c50ec52e `%plist-member' fix
* module/language/elisp/boot.el (%plist-member): Use recursion to avoid
  using `catch' and `throw'.
2012-02-03 18:53:50 -05:00
BT Templeton
5950f674bf condition-case
* module/language/elisp/boot.el (signal): Accept only two arguments, and
  throw an `elisp-condition' exception instead of an `elisp-error'
  exception.
  (condition-case): New macro.
2012-02-03 18:53:50 -05:00
BT Templeton
df9cd3b447 elisp `member' subrs
* module/language/elisp/boot.el (%member, member, memql, memq): New
  functions.
2012-02-03 18:53:50 -05:00
BT Templeton
c7e0d2f81c use `dynlet' for dynamic binding
* module/language/elisp/compile-tree-il.scm (let-dynamic): Remove. All
  callers changed to use `dynlet' instead.
2012-02-03 18:53:50 -05:00
BT Templeton
c64c51ebb0 inline generate-let' and generate-let*'
* module/language/elisp/compile-tree-il.scm (generate-let, compile-let):
  Inline the former into the latter.
  (generate-let*, compile-let*): Likewise.
2012-02-03 18:53:50 -05:00
BT Templeton
6bb004c435 define `flet' directly
* module/language/elisp/compile-tree-il.scm (compile-flet): Compile
  `flet' directly instead of using `generate-let'.
2012-02-03 18:53:50 -05:00