summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtes2006-02-28 23:19:41 +0000
committerLudovic Courtes2006-02-28 23:19:41 +0000
commit81050ef1358acd03630f3d7a4e9245f5d82084b6 (patch)
treef22905d7e16b7a76624e1def45e7491ba708d969
parent22ad7aedd2d325150f4e54d7e8cf123fbc4a32b1 (diff)
parentbc9090d69ebe3c2612efd830b859d4c1c896aae0 (diff)
downloadskribilo-81050ef1358acd03630f3d7a4e9245f5d82084b6.tar.gz
skribilo-81050ef1358acd03630f3d7a4e9245f5d82084b6.tar.lz
skribilo-81050ef1358acd03630f3d7a4e9245f5d82084b6.zip
Slightly optimized the resolution process (added `ast-resolved?').
Patches applied: * skribilo--devel--1.2 (patch 36-37) - Merge from lcourtes@laas.fr--2004-libre - Slightly optimized the resolution process (added `ast-resolved?'). git-archimport-id: lcourtes@laas.fr--2004-libre/skribilo--devel--1.2--patch-60
-rw-r--r--ChangeLog55
-rw-r--r--src/guile/skribilo/ast.scm13
-rw-r--r--src/guile/skribilo/resolve.scm41
3 files changed, 90 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 083fff6..2ba8d09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,61 @@
# arch-tag: automatic-ChangeLog--lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2
#
+2006-02-28 21:40:26 GMT Ludovic Courtes <ludovic.courtes@laas.fr> patch-37
+
+ Summary:
+ Slightly optimized the resolution process (added `ast-resolved?').
+ Revision:
+ skribilo--devel--1.2--patch-37
+
+ * src/guile/skribilo/ast.scm (<ast>): Added a `resolved?' slot, with
+ accessor `ast-resolved?'.
+
+ * src/guile/skribilo/resolve.scm (do-resolve!)[<node>]: Check whether
+ `ast-resolved?' is true and set it once it's resolved.
+
+ modified files:
+ ChangeLog src/guile/skribilo/ast.scm
+ src/guile/skribilo/resolve.scm
+
+
+2006-02-28 20:08:45 GMT Ludovic Courtes <ludovic.courtes@laas.fr> patch-36
+
+ Summary:
+ Merge from lcourtes@laas.fr--2004-libre
+ Revision:
+ skribilo--devel--1.2--patch-36
+
+ Patches applied:
+
+ * lcourtes@laas.fr--2004-libre/skribilo--devel--1.2 (patch 55-59)
+
+ - Made `make-string-replace' faster.
+ - `eq': Implemented the text-based markup writers.
+ - `eq': Added the `:renderer' option to `eq'. Support `lout'.
+ - Changed the way `slide' implementations are loaded. Doc is buildable now.
+ - Doc: Added a chapter (stub) about the `eq' package.
+
+ new files:
+ doc/user/eq.skb doc/user/src/.arch-ids/eq1.skb.id
+ doc/user/src/.arch-ids/eq2.skb.id doc/user/src/eq1.skb
+ doc/user/src/eq2.skb
+
+ modified files:
+ ChangeLog doc/user/user.skb src/guile/skribilo/package/eq.scm
+ src/guile/skribilo/package/slide.scm
+ src/guile/skribilo/package/slide/html.scm
+ src/guile/skribilo/package/slide/latex.scm
+ src/guile/skribilo/package/slide/lout.scm
+
+ new patches:
+ lcourtes@laas.fr--2004-libre/skribilo--devel--1.2--patch-55
+ lcourtes@laas.fr--2004-libre/skribilo--devel--1.2--patch-56
+ lcourtes@laas.fr--2004-libre/skribilo--devel--1.2--patch-57
+ lcourtes@laas.fr--2004-libre/skribilo--devel--1.2--patch-58
+ lcourtes@laas.fr--2004-libre/skribilo--devel--1.2--patch-59
+
+
2006-02-25 13:02:20 GMT Ludovic Courtes <ludovic.courtes@laas.fr> patch-35
Summary:
diff --git a/src/guile/skribilo/ast.scm b/src/guile/skribilo/ast.scm
index 1856389..3968b18 100644
--- a/src/guile/skribilo/ast.scm
+++ b/src/guile/skribilo/ast.scm
@@ -25,6 +25,7 @@
:use-module (skribilo utils syntax)
:export (<ast> ast? ast-loc ast-loc-set!
ast-parent ast->string ast->file-location
+ ast-resolved?
<command> command? command-fmt command-body
<unresolved> unresolved? unresolved-proc
@@ -71,8 +72,16 @@
;;; ======================================================================
;;FIXME: set! location in <ast>
(define-class <ast> ()
- (parent :accessor ast-parent :init-keyword :parent :init-value 'unspecified)
- (loc :init-value #f))
+ ;; Parent of this guy.
+ (parent :accessor ast-parent :init-keyword :parent :init-value 'unspecified)
+
+ ;; Its source location.
+ (loc :init-value #f)
+
+ ;; This slot is used as an optimization when resolving an AST: sub-parts of
+ ;; the tree are marked as resolved as soon as they are and don't need to be
+ ;; traversed again.
+ (resolved? :accessor ast-resolved? :init-value #f))
(define (ast? obj) (is-a? obj <ast>))
diff --git a/src/guile/skribilo/resolve.scm b/src/guile/skribilo/resolve.scm
index cbb939d..34d6bde 100644
--- a/src/guile/skribilo/resolve.scm
+++ b/src/guile/skribilo/resolve.scm
@@ -85,24 +85,31 @@
(define-method (do-resolve! (node <node>) engine env)
- (let ((body (slot-ref node 'body))
- (options (slot-ref node 'options))
- (parent (slot-ref node 'parent)))
- (with-debug 5 'do-resolve<body>
- (debug-item "body=" body)
- (when (eq? parent 'unspecified)
- (let ((p (assq 'parent env)))
- (slot-set! node 'parent (and (pair? p) (pair? (cdr p)) (cadr p)))
- (when (pair? options)
- (debug-item "unresolved options=" options)
- (for-each (lambda (o)
- (set-car! (cdr o)
- (do-resolve! (cadr o) engine env)))
- options)
- (debug-item "resolved options=" options))))
- (slot-set! node 'body (do-resolve! body engine env))
- node)))
+ (if (ast-resolved? node)
+ node
+ (let ((body (slot-ref node 'body))
+ (options (slot-ref node 'options))
+ (parent (slot-ref node 'parent))
+ (unresolved? (*unresolved*)))
+ (with-debug 5 'do-resolve<body>
+ (debug-item "body=" body)
+ (parameterize ((*unresolved* #f))
+ (when (eq? parent 'unspecified)
+ (let ((p (assq 'parent env)))
+ (slot-set! node 'parent
+ (and (pair? p) (pair? (cdr p)) (cadr p)))
+ (when (pair? options)
+ (debug-item "unresolved options=" options)
+ (for-each (lambda (o)
+ (set-car! (cdr o)
+ (do-resolve! (cadr o) engine env)))
+ options)
+ (debug-item "resolved options=" options))))
+ (slot-set! node 'body (do-resolve! body engine env))
+ (slot-set! node 'resolved? (not (*unresolved*))))
+ (*unresolved* (or unresolved? (not (ast-resolved? node))))
+ node))))
(define-method (do-resolve! (node <container>) engine env0)