[mcclim-cvs] CVS mcclim/ESA
thenriksen
thenriksen at common-lisp.net
Tue Jan 1 18:43:36 UTC 2008
Update of /project/mcclim/cvsroot/mcclim/ESA
In directory clnet:/tmp/cvs-serv13721/ESA
Modified Files:
packages.lisp utils.lisp
Log Message:
Added new redisplay engine for Drei. Used by default. Does not yet
talk to the syntax, so there is no syntax highlighting, but other
syntax facilities work just fine. It is significantly faster than the
old engine, but not yet Emacs-style fast. It supports variable-width
fonts, lines of varying height (though lines are topline-adjusted at
the moment) and even arbitrary buffer objects with reasonable
performance.
--- /project/mcclim/cvsroot/mcclim/ESA/packages.lisp 2007/12/28 10:08:52 1.8
+++ /project/mcclim/cvsroot/mcclim/ESA/packages.lisp 2008/01/01 18:43:36 1.9
@@ -43,6 +43,7 @@
#:maptree
#:subtype-compatible-p
#:capitalize
+ #:ensure-array-size
#:observable-mixin
#:add-observer #:remove-observer
#:observer-notified #:notify-observers
--- /project/mcclim/cvsroot/mcclim/ESA/utils.lisp 2007/12/28 10:08:52 1.5
+++ /project/mcclim/cvsroot/mcclim/ESA/utils.lisp 2008/01/01 18:43:36 1.6
@@ -219,6 +219,20 @@
(setf (elt string 0) (char-upcase (elt string 0)))
string)
+(defun ensure-array-size (array min-size new-elem-fn)
+ "Ensure that `array' is at least of size `min-size'. If `array'
+needs to be resized, call `new-elem-fn' with no arguments to
+generate the elements of the new cells in the array. Returns
+`array'. Currently, this function only works when `array' is a
+vector."
+ (when (< (length array) min-size)
+ (let ((old-length (length array)))
+ (setf array (adjust-array array
+ (max (* old-length 2) min-size)))
+ (loop for i from old-length below (length array)
+ do (setf (elt array i) (funcall new-elem-fn)))))
+ array)
+
(defclass observable-mixin ()
((%observers :accessor observers
:initform '()))
More information about the Mcclim-cvs
mailing list