+2004-02-23 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * gcc-3.4 snapshot: 3.4.0 20040215 (prerelease) compile fixes, and
+ stray style cleanups:
+
+ * stepmake/stepmake/c++-vars.make (EXTRA_CXXFLAGS): Remove
+ -Wmissing-prototypes.
+
+ * flower/include/killing-cons.tcc (Killing_cons): Add template
+ specifier for car_.
+
+ * flower/include/parray.hh (binsearchs): Add template specifier
+ for maxkey.
+
+ * flower/include/interval.hh: Declare elem () with template specfier.
+
2004-02-23 Heikki Junes <hjunes@cc.hut.fi>
* elisp/lilypond-indent.el (get-buffer-size): add customization
2004-02-22 Heikki Junes <hjunes@cc.hut.fi>
* elisp/lilypond-mode.el (get-buffer-size): define new function,
- for Emacs >= 20 (Laurent Martelli).
+ for Emacs <= 20 (Laurent Martelli).
2004-02-21 Han-Wen Nienhuys <hanwen@xs4all.nl>
{
assert (d==1 || d== -1);
return array_[ (d+1)/2];
-
}
T &operator[] (Direction d)
{
return elem (d);
}
Drul_array ()
- {}
+ {
+ }
Drul_array (T t1, T t2)
{
array_[0] = t1;
#include "real.hh"
#include "drul-array.hh"
-/** a T interval. this represents the closed interval [left,right].
- No invariants. T must be a totally ordered ring (with division, anyway ..)
- At instantiation, the function infinity () has to be defined explicitely.
-
- */
+/* A T interval. This represents the closed interval [left,right].
+ No invariants. T must be a totally ordered ring (with division, anyway ..)
+ At instantiation, the function infinity () has to be defined explicitely. */
template<class T>
-struct Interval_t : public Drul_array<T> {
+struct Interval_t : public Drul_array<T>
+{
+ Drul_array<T>::elem;
- /* ************** */
-
- static T infinity () ;
+ static T infinity ();
static String T_to_string (T arg);
- T center () const {
+ T center () const
+ {
assert (!is_empty ());
return (elem (LEFT) + elem (RIGHT)) / T (2);
}
*/
void unite (Interval_t<T> h);
void intersect (Interval_t<T> h);
- void add_point (T p) {
+ void add_point (T p)
+ {
elem(LEFT) = elem (LEFT) <? p;
elem(RIGHT) = elem (RIGHT) >? p;
}
T length () const;
T delta () const;
- void set_empty () ;
+ void set_empty ();
void set_full ();
/*
TODO: strip hungarian suffix.
*/
- bool is_empty () const { return elem (LEFT) > elem (RIGHT); }
+ bool is_empty () const
+ {
+ return elem (LEFT) > elem (RIGHT);
+ }
bool superset (Interval_t<T> const&) const;
- Interval_t () {
+ Interval_t ()
+ {
set_empty ();
}
Interval_t (T m, T M) : Drul_array<T> (m,M)
return *this;
}
- Real linear_combination (Real x) const {
- Drul_array<Real> da (elem (LEFT),
- elem (RIGHT));
+ Real linear_combination (Real x) const
+ {
+ Drul_array<Real> da (elem (LEFT), elem (RIGHT));
return ::linear_combination (da, x);
}
- String to_string () const;
+ String to_string () const;
bool contains (T r);
- void negate () {
+ void negate ()
+ {
T r = -elem (LEFT);
T l = -elem (RIGHT);
elem (LEFT) = l;
elem (RIGHT) =r;
}
-
+
void swap ()
{
T t = elem (LEFT);
if (elem (RIGHT) <= elem (LEFT))
return 0;
else
- return elem (RIGHT)-elem (LEFT);
+ return elem (RIGHT) - elem (LEFT);
}
template<class T>
return elem (RIGHT) - elem (LEFT);
}
-/**
- smallest Interval which includes *this and #h#
- */
+/* smallest Interval which includes *this and #h# */
template<class T>
void
Interval_t<T>::unite (Interval_t<T> h)
{
elem (LEFT) = h.elem (LEFT) <? elem (LEFT);
- elem (RIGHT) = h.elem (RIGHT) >?elem (RIGHT);
-
-#if 0
- if (h.elem (LEFT)<elem (LEFT))
- elem (LEFT) = h.elem (LEFT);
- if (h.elem (RIGHT)>elem (RIGHT))
- elem (RIGHT) = h.elem (RIGHT);
-#endif
+ elem (RIGHT) = h.elem (RIGHT) >? elem (RIGHT);
}
-
template<class T>
void
Interval_t<T>::intersect (Interval_t<T> h)
{
-#if defined (__GNUG__) && ! defined (__STRICT_ANSI__)
+#if defined (__GNUG__) && !defined (__STRICT_ANSI__)
elem (LEFT) = h.elem (LEFT) >? elem (LEFT);
- elem (RIGHT) = h.elem (RIGHT) <?elem (RIGHT);
+ elem (RIGHT) = h.elem (RIGHT) <? elem (RIGHT);
#else
elem (LEFT) = max (h.elem (LEFT), elem (LEFT));
elem (RIGHT) = min (h.elem (RIGHT), elem (RIGHT));
return "[empty]";
String s ("[");
- return s + T_to_string (elem (LEFT)) + String ("," ) + T_to_string (elem (RIGHT) ) + String ("]" );
+ return (s + T_to_string (elem (LEFT)) + String ("," )
+ + T_to_string (elem (RIGHT) ) + String ("]" ));
}
template<class T>
return r >= elem (LEFT) && r <= elem (RIGHT);
}
-
#define INTERVAL__INSTANTIATE(T) struct Interval_t<T>;\
-template int Interval__compare (const Interval_t<T>&,Interval_t<T> const&)
+template int Interval__compare (const Interval_t<T>&,Interval_t<T> const&)
#endif // INTERVAL_TCC
template<class T>
Killing_cons<T>::~Killing_cons ()
{
- delete car_;
+ delete Cons<T>::car_;
}
template<class T>
int cmp;
int result;
lo = 0;
- hi = maxkey;
+ hi = Array<T>::maxkey;
/* binary search */
do
const char *
demangle_classname (std::type_info const &);
-/**
+/* Virtual copy constructor. Make up for C++'s lack of a standard
+ factory or clone () function. Uses a typeof hack. Usage:
- Virtual copy constructor. Make up for C++'s lack of a standard
- clone () function. Uses a typeof hack. Usage:
+ class Foo : Baseclass
+ {
+ VIRTUAL_COPY_CONSTRUCTOR (Baseclass, Foo);
+ }; */
- class Foo : Baseclass {
- VIRTUAL_COPY_CONS (Baseclass);
- };
-
- */
-
-/*
- fix constness: gcc-2.95 is correct in defining
-
- typeof (*this)
-
- in a const member function to be const
-*/
-#define VIRTUAL_COPY_CONS(base) \
+#define VIRTUAL_COPY_CONSTRUCTOR(base, name) \
+ /* Hack to fix constness: gcc >= 2.95 is correct in defining \
+ typeof (*this) in a const member function to be const. */ \
virtual base* clone_const_helper () \
{ \
- return new typeof (*this) (*this); \
+ return new name (*this); \
} \
- virtual base* clone () const \
+ virtual base *clone () const \
{ \
- base* urg = (base*)this; \
+ /* return new name (*this); */ \
+ base *urg = (base*) this; \
return urg->clone_const_helper (); \
}
-
#endif /* VIRTUAL_METHODS_HH */
#include "duration.hh"
#include "pitch.hh"
-/** An atom of musical information. This is an abstract class for any
- piece of music that does not contain other Music.
-
-
- */
-class Event : public Music {
+/* An atom of musical information. This is an abstract class for any
+ piece of music that does not contain other Music. */
+class Event : public Music
+{
public:
Event ();
- VIRTUAL_COPY_CONS (Music);
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Event);
virtual void compress (Moment);
virtual void transpose (Pitch);
virtual Moment get_length () const;
SCM pitch_alist ();
protected:
- VIRTUAL_COPY_CONS (Music);
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Key_change_ev);
void transpose (Pitch d);
};
class Grace_music : public Music_wrapper
{
public:
- VIRTUAL_COPY_CONS (Music);
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Grace_music);
Grace_music ();
protected:
virtual Moment get_length () const;
typedef void (Grob::*Grob_method_pointer) (void);
-/*
- Basic output object.
-*/
-class Grob {
+/* Basic G[raphical output] O[bject]. */
+class Grob
+{
protected:
SCM immutable_property_alist_;
SCM mutable_property_alist_;
friend class Spanner;
void substitute_mutable_properties(SCM,SCM);
+
public:
Grob *original_;
Grob (SCM basic_props);
Grob (Grob const&);
+ VIRTUAL_COPY_CONSTRUCTOR (Grob, Grob);
+
String name () const;
/*
void add_dependency (Grob*);
virtual System * get_system () const;
- VIRTUAL_COPY_CONS (Grob);
-
/**
Recursively track all dependencies of this Grob. The
status_ field is used as a mark-field. It is marked with
Drul_array<Item*> broken_to_drul_;
public:
- VIRTUAL_COPY_CONS (Grob);
Item (SCM);
Item (Item const &);
+ VIRTUAL_COPY_CONSTRUCTOR (Grob, Item);
static bool is_breakable (Grob *);
bool is_broken () const;
#ifndef LYRIC_COMBINE_MUSIC_HH
#define LYRIC_COMBINE_MUSIC_HH
-#include "music.hh"
+#include "music.hh"
class Lyric_combine_music : public Music
{
public:
- Music * get_music () const;
- Music * get_lyrics () const;
-
Lyric_combine_music ();
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Lyric_combine_music);
- VIRTUAL_COPY_CONS (Music);
+ Music *get_music () const;
+ Music *get_lyrics () const;
virtual Moment get_length () const;
};
-#endif /* LYRIC_COMBINE_MUSIC_HH */
+#endif /* LYRIC_COMBINE_MUSIC_HH */
/**
definitions for midi output. Rather empty
*/
-class Midi_def : public Music_output_def {
+class Midi_def : public Music_output_def
+{
static int score_count_;
public:
- VIRTUAL_COPY_CONS (Music_output_def);
-
Midi_def ();
+ VIRTUAL_COPY_CONSTRUCTOR (Music_output_def, Midi_def);
int get_tempo (Moment moment);
void set_tempo (Moment moment, int count_per_minute_i);
};
-#endif // MIDI_DEF_HH
+#endif /* MIDI_DEF_HH */
/*
- music-list.hh -- declare Music_sequence,
- Simultaneous_music and Sequential_music
+ music-list.hh -- declare Simultaneous_music, Sequential_music, Event_chord
source file of the GNU LilyPond music typesetter
*/
-#ifndef Music_sequence_HH
-#define Music_sequence_HH
+#ifndef MUSIC_LIST_HH
+#define MUSIC_LIST_HH
#include "music-sequence.hh"
class Simultaneous_music : public Music_sequence
{
public:
- VIRTUAL_COPY_CONS (Music);
+ Simultaneous_music ();
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Simultaneous_music);
+
virtual Pitch to_relative_octave (Pitch);
virtual Moment get_length () const;
virtual Moment start_mom () const;
- Simultaneous_music ();
};
/*
class Event_chord : public Simultaneous_music
{
public:
- VIRTUAL_COPY_CONS (Music);
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Event_chord);
virtual Pitch to_relative_octave (Pitch);
};
class Sequential_music : public Music_sequence
{
public:
- VIRTUAL_COPY_CONS (Music);
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Sequential_music);
virtual Moment get_length () const;
virtual Moment start_mom () const;
Sequential_music ();
};
-#endif // Music_sequence_HH
+#endif /* MUSIC_LIST_HH */
SCM scope_;
SCM scaled_fonts_;
- VIRTUAL_COPY_CONS (Music_output_def);
Music_output_def (Music_output_def const&);
Music_output_def ();
+ VIRTUAL_COPY_CONSTRUCTOR (Music_output_def, Music_output_def);
Context *get_group_translator (String type) const;
void assign_translator (SCM transdef);
SCM find_context_def (SCM name) const;
String outname_string () ;
SCM get_scmvar (String id)const;
- SCM lookup_variable (SCM sym) const;
- void set_variable (SCM, SCM sym);
+ SCM lookup_variable (SCM sym) const;
+ void set_variable (SCM, SCM sym);
DECLARE_SMOBS (Music_output_def,);
};
public:
Music_sequence (SCM h);
Music_sequence ();
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Music_sequence);
+
SCM music_list () const;
void append_music (Music *);
- VIRTUAL_COPY_CONS (Music);
Pitch do_relative_octave (Pitch p, bool b);
{
public:
Music_wrapper ();
- Music * element () const;
-
- VIRTUAL_COPY_CONS (Music);
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Music_wrapper);
+
+ Music *element () const;
virtual Moment get_length () const;
virtual Moment start_mom () const;
};
-
-
-
#endif /* MUSIC_WRAPPER_HH */
TODO: make a equalp function for general music.
*/
-class Music {
+class Music
+{
public:
+ Music ();
+ Music (Music const &m);
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Music);
+
Input *origin () const;
void set_spot (Input);
bool internal_is_music_type (SCM) const;
virtual Pitch to_relative_octave (Pitch);
- String name ()const;
+ String name () const;
/// The duration of this piece of music
virtual Moment get_length () const;
virtual Moment start_mom () const;
/// Scale the music in time by #factor#.
virtual void compress (Moment factor);
- VIRTUAL_COPY_CONS (Music);
- Music ();
- Music (Music const &m);
+
protected:
DECLARE_SMOBS (Music,);
SCM immutable_property_alist_;
class Paper_column : public Item
{
public:
- VIRTUAL_COPY_CONS (Grob);
+ int rank_;
+ /// if lines are broken then this column is in #line#
+ System *system_;
+
+ Paper_column (SCM);
+ VIRTUAL_COPY_CONSTRUCTOR (Grob, Paper_column);
static bool has_interface (Grob*);
- int rank_;
virtual void do_break_processing ();
virtual Paper_column *get_column () const;
virtual System *get_system () const;
- /// if lines are broken then this column is in #line#
- System *system_;
-
static int get_rank (Grob*);
- DECLARE_SCHEME_CALLBACK(print, (SCM));
- DECLARE_SCHEME_CALLBACK(before_line_breaking, (SCM));
+ DECLARE_SCHEME_CALLBACK (print, (SCM));
+ DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
- Paper_column (SCM);
static bool is_musical (Grob *);
static Moment when_mom (Grob*);
class Paper_def : public Music_output_def
{
protected:
- VIRTUAL_COPY_CONS (Music_output_def);
+ VIRTUAL_COPY_CONSTRUCTOR (Music_output_def, Paper_def);
public:
Paper_outputter* get_paper_outputter (String) const;
#include "grob-info.hh"
#include "translator.hh"
-/**
- Convert a music definition into a audio representation.
- A baseclass
- */
+/* Convert a music definition into a audio representation.
+ A baseclass. */
class Performer : public virtual Translator
{
public:
- VIRTUAL_COPY_CONS (Translator);
+ VIRTUAL_COPY_CONSTRUCTOR (Translator, Performer);
friend class Performer_group_performer;
Performer_group_performer* get_daddy_performer () const;
};
-#endif // PERFORMER_HH
+#endif /* PERFORMER_HH */
{
public:
Relative_octave_music ();
-
- VIRTUAL_COPY_CONS (Music);
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Relative_octave_music);
+
virtual Pitch to_relative_octave (Pitch);
};
class Relative_octave_check : public Music
{
public:
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Relative_octave_check);
+
virtual Pitch to_relative_octave (Pitch);
};
-
-#endif /* RELATIVE_MUSIC_HH */
+#endif /* RELATIVE_OCTAVE_CHECK_HH */
*/
-#ifndef RepEATED_MUSIC_HH
-#define RepEATED_MUSIC_HH
+#ifndef REPEATED_MUSIC_HH
+#define REPEATED_MUSIC_HH
#include "music.hh"
class Repeated_music : public Music
{
public:
- Music * body () const;
+ Repeated_music ();
+ Repeated_music (SCM);
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Repeated_music);
+
+ Music *body () const;
SCM alternatives () const;
- /// how often do we repeat?
- int repeat_count ( ) const;
+ /* How often do we repeat? */
+ int repeat_count () const;
virtual Pitch to_relative_octave (Pitch);
Moment body_get_length () const;
DECLARE_SCHEME_CALLBACK (folded_music_length, (SCM));
DECLARE_SCHEME_CALLBACK (minimum_start, (SCM));
DECLARE_SCHEME_CALLBACK (first_start, (SCM));
-
- VIRTUAL_COPY_CONS (Music);
- Repeated_music ();
- Repeated_music (SCM);
};
-#endif /* RepEATED_MUSIC_HH */
+#endif /* REPEATED_MUSIC_HH */
virtual SCM do_derived_mark () const;
static bool has_interface (Grob*);
virtual System *get_system () const;
+
protected:
void set_my_columns ();
- VIRTUAL_COPY_CONS (Grob);
+ VIRTUAL_COPY_CONSTRUCTOR (Grob, Spanner);
virtual void do_break_processing ();
};
void output_stencil (SCM, Offset);
void output_scheme (SCM);
void pre_processing ();
+
protected:
- VIRTUAL_COPY_CONS (Grob);
+ VIRTUAL_COPY_CONSTRUCTOR (Grob, System);
};
#endif /* SYSTEM_HH */
/*
- compressed-music.hh -- declare Time_scaled_music
+ time-scaled-music.hh -- declare Time_scaled_music
source file of the GNU LilyPond music typesetter
*/
-#ifndef Time_scaled_music_HH
-#define Time_scaled_music_HH
+#ifndef TIME_SCALED_MUSIC_HH
+#define TIME_SCALED_MUSIC_HH
#include "music-wrapper.hh"
/**
class Time_scaled_music : public Music_wrapper
{
public:
- Time_scaled_music (SCM);
Time_scaled_music ();
-
- VIRTUAL_COPY_CONS (Music);
+ Time_scaled_music (SCM);
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Time_scaled_music);
};
-#endif /* Time_scaled_music_HH */
+#endif /* TIME_SCALED_MUSIC_HH */
typedef void (Translator::*Translator_method) (void);
-class Translator_group : public virtual Translator {
-protected:
-
-public:
- VIRTUAL_COPY_CONS (Translator);
-
+class Translator_group : public virtual Translator
+{
public:
+ VIRTUAL_COPY_CONSTRUCTOR (Translator, Translator_group);
virtual Translator_group* get_daddy_translator ()const;
virtual SCM get_simple_trans_list ();
virtual bool try_music (Music* req);
#define TRANSLATOR_DECLARATIONS(NAME) \
public: \
- NAME();\
- VIRTUAL_COPY_CONS (Translator); \
+ NAME (); \
+ VIRTUAL_COPY_CONSTRUCTOR (Translator, NAME); \
static SCM static_description_; \
virtual SCM static_translator_description () const; \
virtual SCM translator_description () const;
public:
DECLARE_SMOBS (Translator, dummy);
+
protected: // should be private.
SCM simple_trans_list_;
friend class Context_def;
+
public:
Score_context * get_score_context () const;
Global_context * get_global_context () const;
#ifndef TRANSPOSED_MUSIC_HH
#define TRANSPOSED_MUSIC_HH
-
#include "music-wrapper.hh"
class Transposed_music : public Music_wrapper
{
public:
- Transposed_music (SCM);
Transposed_music ();
-
-
- VIRTUAL_COPY_CONS (Music);
+ Transposed_music (SCM);
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Transposed_music);
+
virtual Pitch to_relative_octave (Pitch);
};
/*
- un-relativable-music.hh -- declare
+ un-relativable-music.hh -- declare Un_relativable_music
source file of the GNU LilyPond music typesetter
{
public:
Un_relativable_music ();
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Un_relativable_music);
+
Pitch to_relative_octave (Pitch);
- VIRTUAL_COPY_CONS(Music);
};
-
#endif /* UN_RELATIVABLE_MUSIC_HH */
-
/*
-untransposable-music.hh -- declare
+ untransposable-music.hh -- declare Untransposable_music
-source file of the GNU LilyPond music typesetter
+ source file of the GNU LilyPond music typesetter
-(c) 2001--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 2001--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef UNTRANSPOSABLE_MUSIC_HH
#define UNTRANSPOSABLE_MUSIC_HH
+
#include "music-wrapper.hh"
class Untransposable_music : public Music_wrapper
{
public:
Untransposable_music ();
+ VIRTUAL_COPY_CONSTRUCTOR (Music, Untransposable_music);
+
virtual Pitch to_relative_octave (Pitch);
virtual void transpose (Pitch);
- VIRTUAL_COPY_CONS(Music);
};
# added two warnings that are treated by cygwin32's gcc 2.7.2 as errors.
# huh, but still, no warnings even provoced with linux's gcc 2.7.2.1?
-# -pipe makes it go faster, but is not supported on all platforms.
+# -pipe makes it go faster, but is not supported on all platforms.
+# how much faster -- would this warrant configure check?
# EXTRA_CXXFLAGS= -Wall -Winline -W -Wmissing-prototypes -Wmissing-declarations -Wconversion
-EXTRA_CXXFLAGS= -Wall -W -Wmissing-prototypes -Wconversion
+EXTRA_CXXFLAGS= -W -Wall -Wconversion
ALL_CXXFLAGS = $(CXXFLAGS) $(ICFLAGS) $(DEFINES) $(addprefix -I,$(INCLUDES)) $(USER_CFLAGS) $(EXTRA_CFLAGS) $(MODULE_CFLAGS) $($(PACKAGE)_CFLAGS) $($(PACKAGE)_CXXFLAGS) $(USER_CXXFLAGS) $(EXTRA_CXXFLAGS) $(MODULE_CXXFLAGS)