--- /dev/null
+/*
+ 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
+
+
--- /dev/null
+/*
+ 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
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)
{
{
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;
}
--- /dev/null
+/*
+ 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);
+}
+
}
<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 );