From fe61a7cce9e8d3c1102e9d7a430ae5251cff78e0 Mon Sep 17 00:00:00 2001 From: Jan Moringen Date: Sat, 27 Jul 2024 04:11:48 +0200 Subject: [PATCH] Change order of top-level forms in cache.lisp --- code/cache.lisp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/code/cache.lisp b/code/cache.lisp index 4247098..d927d22 100644 --- a/code/cache.lisp +++ b/code/cache.lisp @@ -84,6 +84,25 @@ (length prefix) (list prefix) (length suffix) (list suffix)))) +(defun gap-start (cache) + (let ((prefix (prefix cache))) + (if (null prefix) + 0 + (1+ (end-line (first prefix)))))) + +(defun gap-end (cache) + (let ((suffix (suffix cache))) + (1- (if (null suffix) + (line-count cache) + (start-line (first suffix)))))) + +(defun total-width (cache) + (let ((prefix-width (prefix-width cache)) + (suffix-width (suffix-width cache))) + (max (if (null prefix-width) 0 (first prefix-width)) + (max-line-length cache (gap-start cache) (gap-end cache)) + (if (null suffix-width) 0 (first suffix-width))))) + ;;; Given a cache and an interval of lines, return the maxium length ;;; of any lines in the interval. (defun max-line-length (cache first-line-number last-line-number) @@ -170,25 +189,6 @@ (:method ((cache cache)) (push-to-suffix cache (pop-from-prefix cache)))) -(defun gap-start (cache) - (let ((prefix (prefix cache))) - (if (null prefix) - 0 - (1+ (end-line (first prefix)))))) - -(defun gap-end (cache) - (let ((suffix (suffix cache))) - (1- (if (null suffix) - (line-count cache) - (start-line (first suffix)))))) - -(defun total-width (cache) - (let ((prefix-width (prefix-width cache)) - (suffix-width (suffix-width cache))) - (max (if (null prefix-width) 0 (first prefix-width)) - (max-line-length cache (gap-start cache) (gap-end cache)) - (if (null suffix-width) 0 (first suffix-width))))) - (defun pop-from-worklist (cache) (pop (worklist cache)))