From: fred Date: Sun, 24 Mar 2002 19:38:25 +0000 (+0000) Subject: lilypond-0.0.49 X-Git-Tag: release/1.5.59~5008 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f7de554a4d6e5366e7ef16290a2cd55fa3e24223;p=lilypond.git lilypond-0.0.49 --- diff --git a/flower/include/pointer.hh b/flower/include/pointer.hh new file mode 100644 index 0000000000..e29a298ace --- /dev/null +++ b/flower/include/pointer.hh @@ -0,0 +1,49 @@ +/* + pointer.hh -- declare P + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef POINTER_HH +#define POINTER_HH + +/** P 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 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 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 index 0000000000..d595f2bcfe --- /dev/null +++ b/flower/include/pointer.tcc @@ -0,0 +1,88 @@ +/* + pointer.tcc -- implement P + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef POINTER_TCC +#define POINTER_TCC + +template +inline +T * +P::copy_p()const +{ + return t_p? new T(*t_p) : 0; +} + +template +inline +void +P::copy(T *l) +{ + t_p = l ? new T(*l) : 0; +} + +template +inline +void +P::junk() +{ + delete t_p; + t_p =0; +} + +template +inline +P::P(P const &s) +{ + t_p = s.copy_p(); +} + +template +inline +P & +P::operator =(P const&s) +{ + junk(); + copy(s.t_p); + return *this; +} + +template +inline +P::~P() { + junk(); +} + +template +inline +void +P::set_p(T * np) +{ + if (np == t_p) + return; + delete t_p; + + t_p = np; +} + + +template +inline +void +P::set_l(T * l) +{ + if (t_p == l) + return; + + junk(); + copy(l); +} + + + +#endif // POINTER_TCC diff --git a/lily/note.cc b/lily/note.cc index 0d43d53234..0dc31417e4 100644 --- a/lily/note.cc +++ b/lily/note.cc @@ -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 &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 i_arr) { Measure_grouping_req * mr_p = new Measure_grouping_req; for (int i=0; i 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 index 0000000000..b8753929a9 --- /dev/null +++ b/lily/notename-table.cc @@ -0,0 +1,28 @@ +/* + notename-table.cc -- implement Notename_table + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "notename-table.hh" +#include "pointer.tcc" +#include "musical-request.hh" + +template class P; + +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); +} + diff --git a/mi2mu/midi-lexer.l b/mi2mu/midi-lexer.l index f61d2b4656..691955d574 100644 --- a/mi2mu/midi-lexer.l +++ b/mi2mu/midi-lexer.l @@ -373,8 +373,9 @@ SSME [\0x7f][\x03] } {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 );