]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.49
authorfred <fred>
Sun, 24 Mar 2002 19:38:25 +0000 (19:38 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:38:25 +0000 (19:38 +0000)
flower/include/pointer.hh [new file with mode: 0644]
flower/include/pointer.tcc [new file with mode: 0644]
lily/note.cc
lily/notename-table.cc [new file with mode: 0644]
mi2mu/midi-lexer.l

diff --git a/flower/include/pointer.hh b/flower/include/pointer.hh
new file mode 100644 (file)
index 0000000..e29a298
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+  pointer.hh -- declare P
+
+  source file of the Flower Library
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef POINTER_HH
+#define POINTER_HH
+
+/** P<T> is a handy template to use iso T*. It inits to 0, deletes on
+  destruction, deep copies upon copying
+
+  It is probably not feasible to use P<T> as template argument, since
+  a lot of auto conversion wouldn't work. new T would be called too
+  much anyway.
+  
+  Sorry for the silly naming */
+template <class T>
+class P {
+    
+    void copy(T*);
+    T* t_p;
+    void junk();
+public:
+    
+    P(P const &src);
+    
+    T *get_p() { T*p = t_p; t_p=0; return p; }
+    T *get_l() { return t_p; }
+    T *copy_p() const;
+    void set_p (T *new_p); 
+    void set_l (T *t_l); 
+    
+    P &operator =(P const &);
+    ~P();
+    P() { t_p = 0; }
+    //P(T *p) { t_p = p; }
+    
+    T *operator ->() { return t_p; }
+    operator T * () {  return t_p; }
+    const T *operator ->() const { return t_p ; }
+    operator const T *() const { return t_p; }
+};
+#endif // POINTER_HH
+
+    
diff --git a/flower/include/pointer.tcc b/flower/include/pointer.tcc
new file mode 100644 (file)
index 0000000..d595f2b
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+  pointer.tcc -- implement P
+
+  source file of the Flower Library
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef POINTER_TCC
+#define POINTER_TCC
+
+template<class T>
+inline
+T *
+P<T>::copy_p()const
+{
+    return t_p? new T(*t_p) : 0;
+}
+
+template<class T>
+inline
+void
+P<T>::copy(T *l)
+{
+    t_p = l ? new T(*l) : 0;
+}
+
+template<class T>
+inline
+void
+P<T>::junk()
+{
+    delete t_p;
+    t_p =0;
+}
+
+template<class T>
+inline
+P<T>::P(P<T> const &s) 
+{
+    t_p = s.copy_p();
+}
+
+template<class T>
+inline
+P<T> &
+P<T>::operator =(P const&s)
+{
+    junk();
+    copy(s.t_p);
+    return *this;
+}
+
+template<class T>
+inline
+P<T>::~P() {
+    junk();
+}
+
+template<class T>
+inline
+void
+P<T>::set_p(T * np) 
+{
+    if (np == t_p)
+       return;
+    delete t_p;
+    
+    t_p = np;
+}
+
+
+template<class T>
+inline
+void
+P<T>::set_l(T * l) 
+{
+    if (t_p == l)
+       return;
+    
+    junk();
+    copy(l);
+}
+
+
+
+#endif // POINTER_TCC
index 0d43d5323499bae079c814ec1b74584d91340c28..0dc31417e42ddc50beec2181f778b07311a055fb 100644 (file)
@@ -28,15 +28,6 @@ get_plet_request( char c, int dur_i, int type_i )
     return plet_req_p;
 }
 
-
-void
-add_requests(Voice_element *v, Array<Request*> &req)
-{
-    for (int i = 0; i < req.size(); i++) {
-       v->add(req[i]);
-    }
-    req.set_size(0);
-}
 String *
 get_scriptdef(char c)
 {
@@ -89,8 +80,8 @@ get_grouping_req(Array<int> i_arr)
 {
     Measure_grouping_req * mr_p = new Measure_grouping_req;
     for (int i=0; i <i_arr.size(); ) {
-       mr_p->beat_i_arr_.push(i_arr[i++]);
        mr_p->elt_length_arr_.push(Moment(1, i_arr[i++]));
+       mr_p->beat_i_arr_.push(i_arr[i++]);
     }
     return mr_p;
 }
diff --git a/lily/notename-table.cc b/lily/notename-table.cc
new file mode 100644 (file)
index 0000000..b875392
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+  notename-table.cc -- implement Notename_table
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "notename-table.hh"
+#include "pointer.tcc"
+#include "musical-request.hh"
+
+template class P<Melodic_req>;
+
+void
+Notename_table::add(String s, Melodic_req *m_p)
+{
+    elem(s).set_p(m_p);
+}
+
+Melodic_req*
+Notename_table::get_l(String s)
+{
+    if (! elt_b(s))
+       return 0;
+    return elem(s);
+}
+    
index f61d2b4656dc9a1a464cf8cb98daacab61f416bb..691955d5748bf6213743aea68368ae66d896f966 100644 (file)
@@ -373,8 +373,9 @@ SSME                [\0x7f][\x03]
 }
 <meta_event>{U8} {
        warning( String( "meta_event: unimplemented event: " )
-               + String_convert::bin2hex_str( String( *YYText() ) ),
-               this->here_ch_C() );
+               + String_convert::bin2hex_str( String( *YYText() ) )
+//,            this->here_ch_C() 
+       );
        yy_pop_state();
        yy_pop_state();
        yy_push_state( u8 );