[gsharp-cvs] CVS update: gsharp/gui.lisp gsharp/numbering.lisp gsharp/packages.lisp
Robert Strandh
rstrandh at common-lisp.net
Mon Nov 7 05:24:00 UTC 2005
Update of /project/gsharp/cvsroot/gsharp
In directory common-lisp.net:/tmp/cvs-serv25048
Modified Files:
gui.lisp numbering.lisp packages.lisp
Log Message:
remove the numbering stuff in favor of just calling POSITION
each time.
We are likely going to change the representation of sequences from
lists to something more elaborate anyway (where it matters), so the
numbering will not be relevant in the future.
Date: Mon Nov 7 06:23:58 2005
Author: rstrandh
Index: gsharp/gui.lisp
diff -u gsharp/gui.lisp:1.38 gsharp/gui.lisp:1.39
--- gsharp/gui.lisp:1.38 Wed Nov 2 20:28:09 2005
+++ gsharp/gui.lisp Mon Nov 7 06:23:57 2005
@@ -317,7 +317,6 @@
(setf (buffer *application-frame*) buffer
(input-state *application-frame*) input-state
(cursor *application-frame*) cursor)
- (number-all (buffer *application-frame*))
(select-layer cursor (car (layers (segment (cursor *application-frame*)))))))
(define-gsharp-command (com-save-buffer-as :name t) ()
Index: gsharp/numbering.lisp
diff -u gsharp/numbering.lisp:1.5 gsharp/numbering.lisp:1.6
--- gsharp/numbering.lisp:1.5 Thu Nov 3 04:40:13 2005
+++ gsharp/numbering.lisp Mon Nov 7 06:23:57 2005
@@ -1,123 +1,20 @@
(in-package :gsharp-numbering)
-(defmacro defnclass (name base slots)
- `(progn
- (define-added-mixin ,name ,() ,base
- ((number :accessor number)
- , at slots))))
+(defmethod number ((element element))
+ (position element (elements (bar element))))
-(defun number-elements (list)
- (loop for elem in list
- and i from 0
- do (setf (number elem) i)))
+(defmethod number ((bar bar))
+ (position bar (bars (slice bar))))
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;
-;;; Element
+(defmethod number ((slice slice))
+ (let ((layer (layer slice)))
+ (cond ((eq slice (head layer)) 0)
+ ((eq slice (body layer)) 1)
+ ((eq slice (tail layer)) 2))))
-(defnclass nelement element
- ())
+(defmethod number ((layer layer))
+ (position layer (layers (segment layer))))
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;
-;;; Bar
+(defmethod number ((segment segment))
+ (position segment (segments (buffer segment))))
-(defnclass nbar bar
- ())
-
-(defmethod add-element :after ((element nelement) (bar bar) position)
- (declare (ignore position))
- (number-elements (elements bar)))
-
-(defmethod remove-element :around ((element nelement))
- (let ((bar (bar element)))
- (call-next-method)
- (number-elements (elements bar))))
-
-(defmethod number-all ((bar bar))
- (number-elements (elements bar)))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;
-;;; Slice
-
-(defnclass nslice slice
- ())
-
-(defmethod add-bar :after ((bar nbar) (slice slice) position)
- (declare (ignore position))
- (number-elements (bars slice)))
-
-(defmethod remove-bar :around ((bar nbar))
- (let ((slice (slice bar)))
- (call-next-method)
- (number-elements (bars slice))))
-
-(defmethod number-all ((slice slice))
- (number-elements (bars slice))
- (mapc #'number-all (bars slice)))
-
-(defmethod initialize-instance :after ((slice nslice) &rest args)
- (declare (ignore args))
- (number-elements (bars slice)))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;
-;;; Layer
-
-(defnclass nlayer layer
- ())
-
-(defmethod initialize-instance :after ((layer nlayer) &rest args)
- (declare (ignore args))
- (setf (number (head layer)) 0
- (number (body layer)) 1
- (number (tail layer)) 2))
-
-(defmethod number-all ((layer layer))
- (number-all (head layer))
- (number-all (body layer))
- (number-all (tail layer)))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;
-;;; Segment
-
-(defnclass nsegment segment
- ())
-
-(defmethod add-layer :after ((layer nlayer) (segment segment))
- (number-elements (layers segment)))
-
-(defmethod remove-layer :around ((layer nlayer))
- (let ((segment (segment layer)))
- (call-next-method)
- (number-elements (layers segment))))
-
-(defmethod number-all ((segment segment))
- (number-elements (layers segment))
- (mapc #'number-all (layers segment)))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;
-;;; Buffer
-
-(defnclass nbuffer buffer
- ())
-
-(defmethod initialize-instance :after ((buffer nbuffer) &rest args)
- (declare (ignore args))
- (number-elements (segments buffer)))
-
-(defmethod add-segment :after ((segment nsegment) (buffer buffer) position)
- (declare (ignore position))
- (number-elements (segments buffer)))
-
-(defmethod remove-segment :around ((segment nsegment))
- (let ((buffer (buffer segment)))
- (call-next-method)
- (number-elements (segments buffer))))
-
-(defmethod number-all ((buffer buffer))
- (number-elements (segments buffer))
- (mapc #'number-all (segments buffer)))
Index: gsharp/packages.lisp
diff -u gsharp/packages.lisp:1.24 gsharp/packages.lisp:1.25
--- gsharp/packages.lisp:1.24 Wed Nov 2 20:28:09 2005
+++ gsharp/packages.lisp Mon Nov 7 06:23:57 2005
@@ -77,7 +77,7 @@
(:use :gsharp-utilities :gsharp-buffer :clim-lisp)
(:shadowing-import-from :gsharp-buffer #:rest)
(:shadow #:number)
- (:export #:number #:number-all))
+ (:export #:number))
(defpackage :obseq
(:use :common-lisp)
More information about the Gsharp-cvs
mailing list