ViewVC logotype

Contents of /gsharp/sequence-dico.lisp

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.1 - (show annotations)
Fri Jul 23 16:51:16 2004 UTC (9 years, 8 months ago) by rstrandh
Branch: MAIN
CVS Tags: works-with-0_9_4, works-with-0_9_3, HEAD
These current modifications are not in a good state yet.  Some of them
are terribly kludgy, but I do not think anything is broken.

New files:

  modes.lisp containing key bindings
  sequence-dico.lisp: a dictionary that searches for objects
                      associated with sequences (lists really).


  Added some horribly kludgy Unicode support.


  New types: lyrics-staff, melody-element, lyrics-element, melody-bar,
             lyrics-bar, melody-layer, lyrics-layer

  Layers are no longer ordered.


  Removed functionality that used layer ordering.


  Removed commands that used layer ordering.
  Added new commands to navigate, insert, and delete layers.
  Factored out and improved command processing.
  Some menus in menu bar work better.
  Added new presentation methods and types.
  Still no support for typing lyrics, but you can see them if they
  are already in a .gsh file.

Input state:

  It no longer contains the staff.  Instead the current staff is the first
  in the list of staves in the current layer.


  We can now draw lyrics.

Score pane:

  Now has a lyrics-staff presentation type.
1 (in-package :sequence-dico)
3 ;;; Store an object associated with the sequence in the sequence dictionary.
4 ;;; If a prefix of sequence already names an object in the dictionary
5 ;;; the existing object is removed.
7 (defgeneric (setf dico-object) (object sequence-dico sequence))
9 ;;; Search for a sequence in a sequence dictionary.
10 ;;; This function returns three values: The first value
11 ;;; is the object associated with the sequence, or nil
12 ;;; if no such object exists. The second value is a boolean
13 ;;; which is t if the first value is the object associated with
14 ;;; the sequence and nil otherwise. The third value is t
15 ;;; if the sequence is a (not necessarily proper) prefix of a sequence
16 ;;; that has an associated object and nil otherwise.
18 (defgeneric dico-object (sequence-dico sequence))
20 (defclass sequence-dico () ())
22 (defclass standard-sequence-dico (sequence-dico)
23 ((table :initarg :table :reader table)))
25 (defun make-sequence-dico (&key (test #'eql))
26 (make-instance 'standard-sequence-dico
27 :table (make-hash-table :test test)))
29 (defmethod (setf dico-object) (object (sequence-dico standard-sequence-dico) sequence)
30 (assert (not (null sequence)))
31 (loop for subseq on sequence
32 for elem in sequence
33 and table = (table sequence-dico) then (gethash elem table)
34 do (unless (hash-table-p (gethash elem table))
35 (setf (gethash elem table)
36 (make-hash-table :test (hash-table-test (table sequence-dico)))))
37 finally (setf (gethash elem table) object)))
39 (defmethod dico-object (sequence-dico sequence)
40 (assert (not (null sequence)))
41 (loop for subseq on sequence
42 for elem in sequence
43 for table-or-obj = (gethash elem (table sequence-dico))
44 then (gethash elem table-or-obj)
45 while (hash-table-p table-or-obj)
46 finally (cond ((null table-or-obj) (return (values nil nil nil)))
47 ((hash-table-p table-or-obj) (return (values nil nil t)))
48 ((null (cdr subseq)) (return (values table-or-obj t t)))
49 (t (return (values nil nil nil))))))

  ViewVC Help
Powered by ViewVC 1.1.5