aboutsummaryrefslogtreecommitdiff
path: root/src/guile/skribilo/evaluator.scm
diff options
context:
space:
mode:
authorLudovic Court`es2007-04-03 13:45:57 +0000
committerLudovic Court`es2007-04-03 13:45:57 +0000
commita5795533336152ba0e8534ea0fcef220ce04ccf5 (patch)
tree87ac50eeb02cec3963152c9a9b7b6e2bc07798e6 /src/guile/skribilo/evaluator.scm
parent1d230301e1f70d39b6e5d96e12934546f1b126dd (diff)
downloadskribilo-a5795533336152ba0e8534ea0fcef220ce04ccf5.tar.gz
skribilo-a5795533336152ba0e8534ea0fcef220ce04ccf5.tar.lz
skribilo-a5795533336152ba0e8534ea0fcef220ce04ccf5.zip
Reduced reliance on the debugging evaluator (improves performance).
* src/guile/skribilo.scm (skribilo): Do not impose use of the debugging evaluator, allowing for significant performance improvements. * src/guile/skribilo/evaluator.scm (%evaluate): Use the debugging evaluator when evaluating EXPR. * src/guile/skribilo/location.scm (invocation-location): Return `#f' when the debugging evaluator is not being used. git-archimport-id: lcourtes@laas.fr--2006-libre/skribilo--devo--1.2--patch-41
Diffstat (limited to 'src/guile/skribilo/evaluator.scm')
-rw-r--r--src/guile/skribilo/evaluator.scm22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/guile/skribilo/evaluator.scm b/src/guile/skribilo/evaluator.scm
index 0598c86..3e984fc 100644
--- a/src/guile/skribilo/evaluator.scm
+++ b/src/guile/skribilo/evaluator.scm
@@ -62,16 +62,18 @@
;; Evaluate EXPR in the current module. EXPR is an arbitrary S-expression
;; that may contain calls to the markup functions defined in a markup
;; package such as `(skribilo package base)', e.g., `(bold "hello")'.
- (let ((result (eval expr module)))
- (if (ast? result)
- (let ((file (source-property expr 'filename))
- (line (source-property expr 'line))
- (column (source-property expr 'column)))
- (slot-set! result 'loc
- (make <location>
- :file file :line line :pos column))))
-
- result))
+ (let ((opts (debug-options)))
+ (dynamic-wind
+ (lambda ()
+ ;; Force use of the debugging evaluator so that we can track source
+ ;; location.
+ (debug-enable 'debug)
+ (debug-enable 'backtrace))
+ (lambda ()
+ (eval expr module))
+ (lambda ()
+ ;; Restore previous evaluator options.
+ (debug-options opts)))))
;;;