From 8505a32a6de5511f6658e41f6e889b431039fbe3 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 5 Nov 1996 14:18:46 +0000 Subject: [PATCH] lilypond-0.0.9 --- hdr/identifier.hh | 36 ++++++++++++++++++++++++++++++++ hdr/voice.hh | 53 +++++++++++++++++++++++++++++++++++++++++++++++ src/misc.cc | 14 +++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 hdr/identifier.hh create mode 100644 hdr/voice.hh create mode 100644 src/misc.cc diff --git a/hdr/identifier.hh b/hdr/identifier.hh new file mode 100644 index 0000000000..9cb80386c0 --- /dev/null +++ b/hdr/identifier.hh @@ -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 index 0000000000..7180ece99e --- /dev/null +++ b/hdr/voice.hh @@ -0,0 +1,53 @@ +#ifndef VOICE_HH +#define VOICE_HH + + +#include "plist.hh" +#include "request.hh" + +/// class for horizontal stuff. +struct Voice { + PointerList 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 reqs; + + List granted_items; + List 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 index 0000000000..54746fd836 --- /dev/null +++ b/src/misc.cc @@ -0,0 +1,14 @@ +#include "misc.hh" +#include "glob.hh" + +#include + +int intlog2(int d) { + int i=0; + while (!(d&1)) { + d/= 2; i++; + } + assert(!(d/2)); + return i; +} + -- 2.39.5