]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.9
authorfred <fred>
Tue, 5 Nov 1996 14:18:46 +0000 (14:18 +0000)
committerfred <fred>
Tue, 5 Nov 1996 14:18:46 +0000 (14:18 +0000)
hdr/identifier.hh [new file with mode: 0644]
hdr/voice.hh [new file with mode: 0644]
src/misc.cc [new file with mode: 0644]

diff --git a/hdr/identifier.hh b/hdr/identifier.hh
new file mode 100644 (file)
index 0000000..9cb8038
--- /dev/null
@@ -0,0 +1,36 @@
+
+/*
+  identifier.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef IDENTIFIER_HH
+#define IDENTIFIER_HH
+#include "proto.hh"
+#include "string.hh"
+
+struct Identifier
+{
+    void *data;
+    String name;
+    
+    Identifier(String n) ;
+    virtual ~Identifier();
+    virtual Staff * staff() { assert(false); }
+    virtual Voice * voice() { assert(false); }
+};
+
+struct Staff_id : Identifier {
+    Staff_id(String s, Staff*st):Identifier(s) { data = st; }
+    virtual Staff* staff() { return (Staff*) data; }
+    ~Staff_id();
+};
+
+struct Voice_id : Identifier {
+    Voice_id(String s, Voice*st):Identifier(s) { data = st; }
+    virtual Voice * voice() { return (Voice*)data; }
+    ~Voice_id();
+};
+#endif // IDENTIFIER_HH
+
diff --git a/hdr/voice.hh b/hdr/voice.hh
new file mode 100644 (file)
index 0000000..7180ece
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef VOICE_HH
+#define VOICE_HH
+
+
+#include "plist.hh"
+#include "request.hh"
+
+/// class for  horizontal stuff.
+struct Voice {
+    PointerList<Voice_element *> elts;
+    Real start;
+
+    /****************/
+    Real when(const Voice_element*)const;
+    Real last() const;
+    Voice();
+    Voice(Voice const&);
+    void add(Voice_element*);
+    void print() const;
+};
+/**
+
+    Voice is a ordered row of Voice_elements. It is strictly horizontal:
+    you cannot have two rhythmic elements running parallel in a Voice
+
+    */
+
+struct Voicegroup {
+    /// don't know how to identify these.
+};
+
+/// one horizontal bit. 
+struct Voice_element {
+    Real duration;
+    const Voicegroup *group;
+    const Voice *voice;
+    PointerList<Request*> reqs;
+
+    List<const Item *> granted_items;
+    List<const Spanner *> granted_spanners;
+
+    /****************/
+    
+    void add(Request*);
+    Voice_element();
+    Voice_element(Voice_element const & src );
+    void print ()const;
+};
+/** Apart from being a container for the requests, Voice_element is
+    glue between related items and spanners, between requests and
+    (voice)groups
+    */
+#endif
diff --git a/src/misc.cc b/src/misc.cc
new file mode 100644 (file)
index 0000000..54746fd
--- /dev/null
@@ -0,0 +1,14 @@
+#include "misc.hh"
+#include "glob.hh"
+
+#include <math.h>
+
+int intlog2(int d) {
+    int i=0;
+    while (!(d&1)) {
+       d/= 2; i++;
+    }
+    assert(!(d/2));
+    return i;
+}
+