String
axis_name_str (Axis a)
{
- return to_str (char(a + 'x'));
+ return to_str (char (a + 'x'));
}
/*
TODO inline these.
*/
Axis
-post_incr(Axis &a)
+post_incr (Axis &a)
{
- assert(a < NO_AXES);
+ assert (a < NO_AXES);
Axis b= a;
- a = Axis(int(a) + 1);
+ a = Axis (int (a) + 1);
return b;
}
Axis
-incr(Axis &a)
+incr (Axis &a)
{
- assert(a < NO_AXES);
- a = Axis(int(a) + 1);
+ assert (a < NO_AXES);
+ a = Axis (int (a) + 1);
return a;
}
U8
Binary_source_file::get_U8 ()
{
- return *(U8*)forward_ch_C (1);
+ return * (U8*)forward_ch_C (1);
}
U32
-Binary_source_file::get_U32()
+Binary_source_file::get_U32 ()
{
U32 b;
#ifdef CLK_TCK
#define CLOCKS_PER_SEC CLK_TCK
#elif defined _SC_CLK_TCK
-#define CLOCKS_PER_SEC sysconf(_SC_CLK_TCK)
+#define CLOCKS_PER_SEC sysconf (_SC_CLK_TCK)
#else
#error cannot determine CLOCKS_PER_SEC
#endif
Cpu_timer::read ()
{
clock_t stop = clock ();
- return (stop-start_clock_)/Real(CLOCKS_PER_SEC);
+ return (stop-start_clock_)/Real (CLOCKS_PER_SEC);
}
#include "data-file.hh"
void
-Data_file::gobble_white()
+Data_file::gobble_white ()
{
char c;
- while ((c=data_get()) == ' ' ||c == '\t')
- if (eof_b())
+ while ((c=data_get ()) == ' ' ||c == '\t')
+ if (eof_b ())
return;
data_unget (c);
}
String
-Data_file::get_word()
+Data_file::get_word ()
{// should handle escape seq's
String s;
while (1)
{
- char c = data_get();
+ char c = data_get ();
- if (eof_b ())
+ if (eof_b ())
break;
if (isspace (c))
{
rawmode= true;
- while ((c = data_get()) != '\"')
+ while ((c = data_get ()) != '\"')
if (eof_b ())
error (_ ("EOF in a string"));
else
}
char
-Data_file::data_get()
+Data_file::data_get ()
{
- char c = get();
+ char c = get ();
if (!rawmode && c == '#') // gobble comment
{
- while (!eof_b () && (c = get()) != '\n')
+ while (!eof_b () && (c = get ()) != '\n')
;
return '\n';
}
}
String
-Data_file::get_line()
+Data_file::get_line ()
{
char c;
String s;
- while (!eof_b () && (c = data_get()) != '\n')
+ while (!eof_b () && (c = data_get ()) != '\n')
s += to_str (c);
return s;
}
void
-Data_file::gobble_leading_white()
+Data_file::gobble_leading_white ()
{
// eat blank lines.
while (!eof_b ())
{
- char c = data_get();
+ char c = data_get ();
if (!isspace (c))
{
data_unget (c);
Data_file::Data_file (String s)
: Text_stream (s)
{
- //*mlog << "(" << s << flush;
+ //*mlog << " (" << s << flush;
rawmode= false;
}
String
direction_str (Direction d, Axis a)
{
- String s("center");
+ String s ("center");
if (a == Y_AXIS)
{
- s =( d == UP ? "up" : "down");
+ s = ( d == UP ? "up" : "down");
}
else if (a == X_AXIS)
{
idx = cl;
else
{
- (*silent_dict_p_)[idx] = default_silence_b_;
+ (*silent_dict_p_)[idx] = default_silence_b_;
}
local_silence_b_ = (*silent_dict_p_)[idx];
if (current_classname_str_ != idx && !local_silence_b_)
{
current_classname_str_=idx;
- if (!(*silent_dict_p_)["Dstream"])
+ if (! (*silent_dict_p_)["Dstream"])
*os_l_ << "[" << current_classname_str_ << ":]"; // messy.
}
return *this;
}
Dstream &
-Dstream::operator<<(void const *v_l)
+Dstream::operator<< (void const *v_l)
{
output (String_convert::pointer_str (v_l));
return *this;
}
Dstream &
-Dstream::operator <<(String s)
+Dstream::operator << (String s)
{
output (s);
return *this;
}
Dstream &
-Dstream::operator <<(const char * s)
+Dstream::operator << (const char * s)
{
output (String (s));
return *this;
}
Dstream &
-Dstream::operator <<(char c)
+Dstream::operator << (char c)
{
output (to_str (c));
return *this;
Dstream&
Dstream::operator << (Real r)
{
- output (to_str (r));
+ output (to_str (r));
return *this;
}
Dstream &
-Dstream::operator <<(Rational c)
+Dstream::operator << (Rational c)
{
output (c.str ());
return *this;
}
Dstream &
-Dstream::operator <<(int i)
+Dstream::operator << (int i)
{
- output (to_str(i));
+ output (to_str (i));
return *this;
}
indent_level_i_ -= INDTAB;
*os_l_ << *cp ;
- assert (indent_level_i_>=0) ;
+ assert (indent_level_i_>=0) ;
break;
case '\n':
Text_db cfg (fn);
while (!cfg.eof_b ()){
Text_record r (cfg++);
- if (r.size() != 2)
+ if (r.size () != 2)
{
r.message (_ ("not enough fields in Dstream init"));
continue;
}
- (*silent_dict_p_)[r[0]] = r[1] == "1";
+ (*silent_dict_p_)[r[0]] = r[1] == "1";
}
if ((*silent_dict_p_).elem_b ("Dstream_default_silence"))
}
-Dstream::~Dstream()
+Dstream::~Dstream ()
{
delete silent_dict_p_;
assert (!indent_level_i_) ;
}
void
-Dstream::clear_silence()
+Dstream::clear_silence ()
{
delete silent_dict_p_;
silent_dict_p_ = 0;
{
int l;
- while ( (l = p.length_i ()) )
+ while ((l = p.length_i ()) )
{
- int i = p.index_i(PATHSEP);
+ int i = p.index_i (PATHSEP);
if (i <0)
i = l;
- add (p.left_str(i));
+ add (p.left_str (i));
p = p.right_str (l- i - 1);
}
}
File_path::find (String nm) const
{
DEBUG_OUT << "looking for" << nm << ": ";
- if (!nm.length_i() || (nm == "-") )
+ if (!nm.length_i () || (nm == "-") )
return nm;
- for (int i=0; i < size(); i++)
+ for (int i=0; i < size (); i++)
{
- String path = elem(i);
+ String path = elem (i);
String sep = to_str (DIRSEP);
- String right(path.right_str (1));
+ String right (path.right_str (1));
if (path.length_i () && right != sep)
path += to_str (DIRSEP);
Check if directory. TODO: encapsulate for autoconf
*/
struct stat sbuf;
- if (stat (path.ch_C(), &sbuf) == ENOENT)
+ if (stat (path.ch_C (), &sbuf) == ENOENT)
continue;
- if (!(sbuf.st_mode & __S_IFREG))
+ if (! (sbuf.st_mode & __S_IFREG))
continue;
#endif
#if !STAT_MACROS_BROKEN
continue;
#endif
- FILE *f = fopen (path.ch_C(), "r"); // ugh!
+ FILE *f = fopen (path.ch_C (), "r"); // ugh!
if (f)
{
DEBUG_OUT << "found\n";
{
if (s == "")
s = ".";
- FILE * f = fopen (s.ch_C(), "r");
+ FILE * f = fopen (s.ch_C (), "r");
if (!f)
return false;
fclose (f);
#endif
long
-Getopt_long::argument_to_i()
+Getopt_long::argument_to_i ()
{
long l;
if (!optional_argument_ch_C_
}
const Long_option_init *
-Getopt_long::parselong()
+Getopt_long::parselong ()
{
char const *optnm = arg_value_ch_a_a_[array_index_i_] + 2 ;
assert (*optnm);
}
const Long_option_init *
-Getopt_long::parseshort()
+Getopt_long::parseshort ()
{
char c=arg_value_ch_a_a_[array_index_i_][argument_index_i_];
found_option_l_=0;
}
const Long_option_init *
-Getopt_long::operator()()
+Getopt_long::operator () ()
{
- if (!ok())
+ if (!ok ())
return 0;
- next();
+ next ();
if (!ok ())
return 0;
if (argument_index_i_)
- return parseshort();
+ return parseshort ();
const char * argument_C = arg_value_ch_a_a_[array_index_i_];
if (argument_C[1] == '-') {// what to do with "command -- bla"
if (argument_C[2])
- return parselong();
+ return parselong ();
else
return 0;
}
if (argument_C[ 1 ])
{
argument_index_i_ = 1;
- return parseshort();
+ return parseshort ();
}
else
{
}
bool
-Getopt_long::ok() const
+Getopt_long::ok () const
{
return array_index_i_ < argument_count_i_;
}
void
-Getopt_long::next()
+Getopt_long::next ()
{
error_ = E_NOERROR;
while (array_index_i_ < argument_count_i_
}
char const *
-Getopt_long::current_arg()
+Getopt_long::current_arg ()
{
if (array_index_i_ >= argument_count_i_)
return 0;
}
char const *
-Getopt_long::get_next_arg()
+Getopt_long::get_next_arg ()
{
- char const * a = current_arg();
+ char const * a = current_arg ();
if (a)
{
array_index_i_ ++;
public:
/// check invariants
- void OK() const ;
+ void OK () const ;
/** report the size_.
@see
{setsize_}
*/
- int size() const
+ int size () const
{
return size_;
}
- /// POST: size() == 0
- void clear()
+ /// POST: size () == 0
+ void clear ()
{
size_ = 0;
}
arrcpy (array_p_, tp, n);
}
- Array()
+ Array ()
{ array_p_ = 0; max_ =0; size_ =0; }
// ugh, get around gcc 2.8.1 ice; see bezier.cc
/** set the size_ to #s#.
- POST: size() == s.
+ POST: size () == s.
Warning: contents are unspecified */
void set_size (int s)
{
size_ = s;
}
- ~Array()
+ ~Array ()
{ delete[] array_p_; }
/// return a "new"ed copy of array
- T* copy_array() const
+ T* copy_array () const
{
T* Tarray = new T[size_];
arrcpy (Tarray, array_p_, size_);
{
return array_p_;
}
- void operator=(Array const & src)
+ void operator= (Array const & src)
{
set_size (src.size_);
arrcpy (array_p_,src.array_p_, size_);
}
Array (Array const & src)
{
- array_p_ = src.copy_array();
+ array_p_ = src.copy_array ();
max_ = size_ = src.size_;
}
/// tighten array size_.
- void tighten_maxsize() {
+ void tighten_maxsize () {
remax (size_);
}
if (size_ == max_)
remax (2*max_ + 1);
- // T::operator=(T &) is called here. Safe to use with automatic
+ // T::operator= (T &) is called here. Safe to use with automatic
// vars
array_p_[size_++] = x;
}
/// remove and return last entry
- T pop()
+ T pop ()
{
- assert (!empty());
+ assert (!empty ());
T l = top (0);
- set_size (size()-1);
+ set_size (size ()-1);
return l;
}
/// access last entry
void swap (int i,int j)
{
T t ((*this)[i]);
- (*this)[i]=(*this)[j];
- (*this)[j]=t;
+ (*this)[i]= (*this)[j];
+ (*this)[j]=t;
}
bool empty () const
{ return !size_; }
}
void unordered_del (int i)
{
- elem_ref (i) = top();
- set_size (size() -1);
+ elem_ref (i) = top ();
+ set_size (size () -1);
}
void del (int i)
{
size_--;
}
// quicksort.
- void sort (int (*compare)(T const&,T const&),
+ void sort (int (*compare) (T const&,T const&),
int lower = -1, int upper = -1);
void concat (Array<T> const &src)
{
arrcpy (array_p_+s,src.array_p_, src.size_);
}
Array<T> slice (int lower, int upper) const;
- void reverse();
+ void reverse ();
};
#include "array.icc"
}
template<class T> INLINE void
-Array<T>::sort (int (*compare)(T const&,T const&),
+Array<T>::sort (int (*compare) (T const&,T const&),
int lower = -1, int upper = -1)
{
if (lower < 0)
template<class T> INLINE
void
-Array<T>::OK() const
+Array<T>::OK () const
{
assert (max_ >= size_ && size_ >=0);
if (max_) assert (array_p_);
/**
the operator ++ for Axis.
*/
-Axis post_incr(Axis &);
-Axis incr(Axis &);
-//Axis operator++(Axis);
+Axis post_incr (Axis &);
+Axis incr (Axis &);
+//Axis operator++ (Axis);
#if defined (__GNUG__) && ! defined (__STRICT_ANSI__)
#define GPP_MINMAX(type, prefix)\
- prefix GPP_MINMAX_OPERATOR(type, <?, <)\
- prefix GPP_MINMAX_OPERATOR(type, >?, >)
+ prefix GPP_MINMAX_OPERATOR (type, <?, <)\
+ prefix GPP_MINMAX_OPERATOR (type, >?, >)
#else
#define GPP_MINMAX(type, prefix)
#endif
Please fill a & in the type argument if necessary.
*/
#define TEMPLATE_INSTANTIATE_COMPARE(type, function, prefix) \
-prefix ONE_OPERATOR(type, function, >)\
-prefix ONE_OPERATOR(type, function, >=)\
-prefix ONE_OPERATOR(type, function, ==)\
-prefix ONE_OPERATOR(type, function, !=)\
-prefix ONE_OPERATOR(type, function, <)\
-prefix ONE_OPERATOR(type, function, <=)\
-GPP_MINMAX(type, prefix)\
+prefix ONE_OPERATOR (type, function, >)\
+prefix ONE_OPERATOR (type, function, >=)\
+prefix ONE_OPERATOR (type, function, ==)\
+prefix ONE_OPERATOR (type, function, !=)\
+prefix ONE_OPERATOR (type, function, <)\
+prefix ONE_OPERATOR (type, function, <=)\
+GPP_MINMAX (type, prefix)\
prefix inline type max (type t1, type t2) { return (t1 > t2)? t1 : t2; }\
prefix inline type min (type t1, type t2) { return (t1 < t2)? t1 : t2; }\
\
-prefix bool operator<(type t1, type t2) /* stupid fix to allow ; */
+prefix bool operator< (type t1, type t2) /* stupid fix to allow ; */
-#define INSTANTIATE_COMPARE(type, func) TEMPLATE_INSTANTIATE_COMPARE(type,func,)
+#define INSTANTIATE_COMPARE(type, func) TEMPLATE_INSTANTIATE_COMPARE (type,func,)
{
public:
Killing_cons (T *t, Cons<T> *p)
- : Cons<T>( t,p)
+ : Cons<T> ( t,p)
{
}
virtual ~Killing_cons ();
template<class T> int cons_list_size_i (Cons<T> *l)
{
int i=0;
- while (l)
+ while (l)
{
l = l->next_;
i++;
Invariants:
- (*tail_) is either the head_ pointer, or a next_ pointer from the list.
+ (*tail_) is either the head_ pointer, or a next_ pointer from the list.
**tail_ == NULL
*/
assert (!c->next_);
*nil_pointer_address_ = c;
while (*nil_pointer_address_)
- nil_pointer_address_ = &(*nil_pointer_address_)->next_;
+ nil_pointer_address_ = & (*nil_pointer_address_)->next_;
}
/**
PRE: *pp should either be the head_ pointer, or the next_ pointer
*/
Cons<T> *remove_cons (Cons<T> **pp)
{
- if (&(*pp)->next_ == nil_pointer_address_)
+ if (& (*pp)->next_ == nil_pointer_address_)
nil_pointer_address_ = pp;
return ::remove_cons (pp);
void truncate (int i)
{
Cons<T> **p = &head_;
- for (; *p && i; p = &((*p)->next_))
+ for (; *p && i; p = & ((*p)->next_))
{
i--;
}
Get a char.
Only class member who uses text_file::get
*/
- char data_get();
+ char data_get ();
void data_unget (char c) {
unget (c);
}
/// read line, eat #\n#
- String get_line();
+ String get_line ();
/// read a word till next space, leave space. Also does quotes
- String get_word();
+ String get_word ();
/// gobble horizontal white stuff.
- void gobble_white();
+ void gobble_white ();
/// gobble empty stuff before first field.
- void gobble_leading_white();
+ void gobble_leading_white ();
Data_file (String);
- ~Data_file();
+ ~Data_file ();
/**
eat complete file
@post
unsigned int string_hash (String);
-
template<class V>
struct Dict_initialiser
{
{
hash_func_ = string_hash;
for (Dict_initialiser<V> *q = p; q->key_; q++)
- (*this) [q->key_] = q->value_;
+ (*this) [q->key_] = q->value_;
}
bool elem_b (String s)
inline Direction
other_dir (Direction const d)
{
- return (Direction)(-d);
+ return (Direction) (-d);
}
inline Direction
T &elem (Direction d)
{
assert (d==1 || d== -1);
- return array_[(d+1)/2];
+ return array_[ (d+1)/2];
}
T &operator[] (Direction d)
T elem (Direction d) const
{
assert (d==1 || d== -1);
- return array_[(d+1)/2];
+ return array_[ (d+1)/2];
}
- T operator[] (Direction d) const
+ T operator[] (Direction d) const
{
return elem (d);
}
/** Debug stream.
a class for providing debug output of nested structures,
- with indents according to \{\}()[].
+ with indents according to \{\} ()[].
One can turn on and off specific messages using the Assoc silent.
This can be done automatically:
Dictionary<bool> *silent_dict_p_;
public:
- void clear_silence();
+ void clear_silence ();
bool silent_b (String) const;
/**
if rcfile == 0, then do not read any rc file.
*/
Dstream (ostream *r, char const * rcfile);
- virtual ~Dstream();
+ virtual ~Dstream ();
Dstream &identify_as (String s);
#define FPROTO_HH
-char const * flower_version_sz();
+char const * flower_version_sz ();
template<class T> struct Link_array;
template<class T> struct Array;
public:
/// get ready for processing next error.
- void next();
- const Long_option_init *parselong();
- const Long_option_init *parseshort();
- void OK() const;
- bool ok() const;
+ void next ();
+ const Long_option_init *parselong ();
+ const Long_option_init *parseshort ();
+ void OK () const;
+ bool ok () const;
/// report an error and abort
void report (Errorcod c);
/// return an integer (with err. detect)
- long argument_to_i();
+ long argument_to_i ();
/**
@return pointer to next option found.
0 if error occurred, or next argument is no option.
*/
- const Long_option_init *operator()();
+ const Long_option_init *operator () ();
- char const *current_arg();
- char const * get_next_arg();
+ char const *current_arg ();
+ char const * get_next_arg ();
};
#endif // GETOPT_LONG_HH
Hash_table<K,V> *dict_l_;
int i;
public:
- Hash_table_iter(Hash_table<K,V> const &dict)
+ Hash_table_iter (Hash_table<K,V> const &dict)
{
i = 0;
- dict_l_ =(Hash_table<K,V> *) & dict;
+ dict_l_ = (Hash_table<K,V> *) & dict;
next_used ();
}
i ++;
}
}
- void operator ++(int)
+ void operator ++ (int)
{
i++;
next_used ();
V value_;
bool free_b_;
- Hash_table_entry() {
+ Hash_table_entry () {
free_b_ = true;
}
Hash_table_entry (K s, V v)
Fixed_size_hash_table (int size_idx)
{
size_idx_ = size_idx;
- int sz = prime_list(size_idx_);
+ int sz = prime_list (size_idx_);
dict_arr_.set_size (sz);
}
/// find #s#, or find first empty entry corresponding to #s#
- int lookup (K s, unsigned int initial_hash)
+ int lookup (K s, unsigned int initial_hash)
{
int sz =dict_arr_.size ();
initial_hash = initial_hash % sz;
{
Fixed_size_hash_table<K,V> *f = new Fixed_size_hash_table<K,V> (fixed_p_->size_idx_ +1);
- for (int i=0; i < fixed_p_->dict_arr_.size(); i++)
+ for (int i=0; i < fixed_p_->dict_arr_.size (); i++)
{
if (fixed_p_->dict_arr_[i].free_b_)
continue;
K nm (fixed_p_->dict_arr_[i].key_);
- unsigned int h = (*hash_func_)(nm);
+ unsigned int h = (*hash_func_) (nm);
int nl = f->lookup (nm, h);
f->dict_arr_[nl] = Hash_table_entry<K,V> (nm, fixed_p_->dict_arr_[i].value_);
}
bool elem_b (K s) const
{
- int l = fixed_p_->lookup (s, (*hash_func_)(s));
+ int l = fixed_p_->lookup (s, (*hash_func_) (s));
return (l >= 0 && !fixed_p_->dict_arr_[l].free_b_) ;
}
V& elem (K s)
{
int l;
- unsigned int h = (*hash_func_)(s);
+ unsigned int h = (*hash_func_) (s);
while ((l= fixed_p_->lookup (s,h)) <0)
{
enlarge ();
}
bool try_retrieve (K k, V *v)
{
- int l = fixed_p_->lookup (k, (*hash_func_)(k));
+ int l = fixed_p_->lookup (k, (*hash_func_) (k));
if (l < 0 || fixed_p_->dict_arr_[l].free_b_)
return false;
else
V remove (K s)
{
- return fixed_p_->remove (s, (*hash_func_)(s));
+ return fixed_p_->remove (s, (*hash_func_) (s));
}
friend class Hash_table_iter<K,V>;
public:
- unsigned int (*hash_func_)(K);
+ unsigned int (*hash_func_) (K);
};
/** 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.
+ At instantiation, the function infinity () has to be defined explicitely.
*/
template<class T>
/* ************** */
- static T infinity() ;
+ static T infinity () ;
static String T_to_str (T arg);
- T center() { return (elem (LEFT) + elem (RIGHT)) / T(2);}
+ T center () { return (elem (LEFT) + elem (RIGHT)) / T (2);}
void translate (T t)
{
elem (LEFT) += t;
void unite (Interval_t<T> h);
void intersect (Interval_t<T> h);
- T length() const;
- void set_empty() ;
- bool empty_b() const { return elem (LEFT) > elem (RIGHT); }
+ T length () const;
+ void set_empty () ;
+ bool empty_b () const { return elem (LEFT) > elem (RIGHT); }
bool contains_b (Interval_t<T> const&) const;
- Interval_t() {
- set_empty();
+ Interval_t () {
+ set_empty ();
}
Interval_t (T m, T M) : Drul_array<T> (m,M)
{}
elem (RIGHT) +=r;
return *this;
}
- Interval_t<T> &operator *=(T r) {
+ Interval_t<T> &operator *= (T r) {
if (!empty_b ())
{
elem (LEFT) *= r;
elem (RIGHT) *= r;
- if (r < T(0)) {
+ if (r < T (0)) {
T t = elem (LEFT);
elem (LEFT) = elem (RIGHT);
elem (RIGHT) = t;
}
Real linear_combination (Real x) const {
- return ((1.0 - x) * Real (elem (LEFT)) + (x + 1.0) * Real (elem(RIGHT))) * 0.5;
+ return ((1.0 - x) * Real (elem (LEFT)) + (x + 1.0) * Real (elem (RIGHT))) * 0.5;
}
- String str() const;
+ String str () const;
void print () const;
bool elem_b (T r);
void negate () {
#include "compare.hh"
-TEMPLATE_INSTANTIATE_COMPARE(Interval_t<T>&, Interval__compare, template<class T>);
+TEMPLATE_INSTANTIATE_COMPARE (Interval_t<T>&, Interval__compare, template<class T>);
template<class T>
template<class T>
inline
-Interval_t<T> operator +(T a,Interval_t<T> i)
+Interval_t<T> operator + (T a,Interval_t<T> i)
{
i += a;
return i;
template<class T>
inline
-Interval_t<T> operator +(Interval_t<T> i,T a){
+Interval_t<T> operator + (Interval_t<T> i,T a){
return a+i;
}
template<class T>
inline
-Interval_t<T> operator *(T a,Interval_t<T> i)
+Interval_t<T> operator * (T a,Interval_t<T> i)
{
i *= a;
return i;
template<class T>
inline
-Interval_t<T> operator *(Interval_t<T> i,T a){
+Interval_t<T> operator * (Interval_t<T> i,T a){
return a*i;
}
template<class T>
void
-Interval_t<T>::set_empty()
+Interval_t<T>::set_empty ()
{
- elem (LEFT) = (T) infinity();
- elem (RIGHT) = (T) -infinity();
+ elem (LEFT) = (T) infinity ();
+ elem (RIGHT) = (T) -infinity ();
}
template<class T>
T
-Interval_t<T>::length() const
+Interval_t<T>::length () const
{
if (elem (RIGHT) < elem (LEFT))
return 0;
template<class T>
String
-Interval_t<T>::str() const
+Interval_t<T>::str () const
{
- if (empty_b())
+ if (empty_b ())
return "[empty]";
String s ("[");
#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
{
for (; src; src = src->next_)
{
- T *t = new T(*src->car_);
+ T *t = new T (*src->car_);
dest.append ( new Killing_cons<T> (t, 0));
}
}
public:
Real coordinate_a_[NO_AXES];
- Real &operator[](Axis i) {
+ Real &operator[] (Axis i) {
return coordinate_a_[i];
}
- Real operator[](Axis i) const{
+ Real operator[] (Axis i) const{
return coordinate_a_[i];
}
- Offset& operator+=(Offset o) {
- (*this)[X_AXIS] += o[X_AXIS];
- (*this)[Y_AXIS] += o[Y_AXIS];
+ Offset& operator+= (Offset o) {
+ (*this)[X_AXIS] += o[X_AXIS];
+ (*this)[Y_AXIS] += o[Y_AXIS];
return *this;
}
Offset operator - () const {
o[Y_AXIS] = - o[Y_AXIS];
return o;
}
- Offset& operator-=(Offset o) {
- (*this)[X_AXIS] -= o[X_AXIS];
- (*this)[Y_AXIS] -= o[Y_AXIS];
+ Offset& operator-= (Offset o) {
+ (*this)[X_AXIS] -= o[X_AXIS];
+ (*this)[Y_AXIS] -= o[Y_AXIS];
return *this;
}
Offset &scale (Offset o) {
- (*this)[X_AXIS] *= o[X_AXIS];
- (*this)[Y_AXIS] *= o[Y_AXIS];
+ (*this)[X_AXIS] *= o[X_AXIS];
+ (*this)[Y_AXIS] *= o[Y_AXIS];
return *this;
}
- Offset &operator *=(Real a) {
- (*this)[X_AXIS] *= a;
- (*this)[Y_AXIS] *= a;
+ Offset &operator *= (Real a) {
+ (*this)[X_AXIS] *= a;
+ (*this)[Y_AXIS] *= a;
return *this;
}
coordinate_a_[X_AXIS] =ix;
coordinate_a_[Y_AXIS] =iy;
}
- Offset() {
+ Offset () {
coordinate_a_[X_AXIS]=
coordinate_a_[Y_AXIS]=
0.0;
void mirror (Axis);
Real arg () const;
Real length () const;
- Offset operator *=(Offset z2) {
+ Offset operator *= (Offset z2) {
*this = complex_multiply (*this,z2);
return *this;
}
};
-IMPLEMENT_ARITHMETIC_OPERATOR(Offset, +);
-IMPLEMENT_ARITHMETIC_OPERATOR(Offset, -);
-IMPLEMENT_ARITHMETIC_OPERATOR(Offset, *);
+IMPLEMENT_ARITHMETIC_OPERATOR (Offset, +);
+IMPLEMENT_ARITHMETIC_OPERATOR (Offset, -);
+IMPLEMENT_ARITHMETIC_OPERATOR (Offset, *);
inline Offset
operator* (Real o1, Offset o2)
{
}
public:
- Link_array()
+ Link_array ()
{}
- Link_array(T * const *tp, int n)
+ Link_array (T * const *tp, int n)
: Array<void*> ((void **)tp, n)
{
}
{
return elem_ref (i);
}
- T *&elem_ref (int i) const
+ T *&elem_ref (int i) const
{
return (T*&) Array<void*>::elem_ref (i);
}
}
}
- void default_sort() {
+ void default_sort () {
sort (default_compare);
}
// quicksort.
- void sort (int (*compare)(T *const&,T *const&),
+ void sort (int (*compare) (T *const&,T *const&),
int lower = -1, int upper = -1);
- void uniq() {
+ void uniq () {
Link_array<T> l_arr;
- for (int i=0; i < size(); i++)
+ for (int i=0; i < size (); i++)
if (!i || elem (i-1) != elem (i))
l_arr.push (elem (i));
*this = l_arr;
T ** access_array () const
{
- return (T**) Array<void*>::access_array();
+ return (T**) Array<void*>::access_array ();
}
T * get (int i)
{
return (T*) Array<void*>::get (i);
}
Link_array<T>
- slice(int l,int u)
+ slice (int l,int u)
{
return Array<void*>::slice (l,u);
}
Array<void*>::concat (a2);
}
int find_i (T const * t) const {
- for (int i=0; i < size(); i++)
+ for (int i=0; i < size (); i++)
if (elem (i) == t)
return i;
return -1;
template<class T> inline void
-Link_array<T>::sort (int (*compare)(T *const&,T *const&),
+Link_array<T>::sort (int (*compare) (T *const&,T *const&),
int lower = -1, int upper = -1)
{
if (lower < 0)
swap (lower, (lower+upper)/2);
int last = lower;
for (int i= lower +1; i <= upper; i++)
- if (compare (elem (i), elem(lower)) < 0)
+ if (compare (elem (i), elem (lower)) < 0)
swap (++last,i);
swap (lower, last);
sort (compare, lower, last-1);
*/
template<class T>
int
-binsearch_array (Array<T> const &arr, T t, int (*compare)(T const&,T const&))
+binsearch_array (Array<T> const &arr, T t, int (*compare) (T const&,T const&))
{
int lo;
int hi;
template<class T>
int
binsearch_link_array (Link_array<T> const &arr, T *t,
- int (*compare)(T *const&,T *const&))
+ int (*compare) (T *const&,T *const&))
{
int lo;
int hi;
int cmp;
int result;
lo = 0;
- hi = arr.size();
+ hi = arr.size ();
if (hi == 0)
return -1;
/* Commonly used flags
*/
-#define P_GW (P_G | P_W)
-#define P_GM (P_G | P_M)
-#define P_GMP (P_G | P_M | P_P)
-#define P_GMK (P_G | P_M | P_P | P_T)
-#define P_GALL (P_G | P_M | P_P | P_T | P_C)
-
+#define P_GW\
+ (P_G | P_W)
+#define P_GM\
+ (P_G | P_M)
+#define P_GMP\
+ (P_G | P_M | P_P)
+#define P_GMK\
+ (P_G | P_M | P_P | P_T)
+#define P_GALL\
+ (P_G | P_M | P_P | P_T | P_C)
/* Possible return codes from the parseFile procedure.
* "fp" should be a valid file pointer to an AFM file.
*
* "fi" is a pointer to a pointer to a FontInfo record sturcture
- * (defined above). Storage for the FontInfo structure will be
+ * (defined above). Storage for the FontInfo structure will be
* allocated in parseFile and the structure will be filled in
* with the requested data from the AFM File.
*
/**
junk contents and set to 0
*/
- void junk();
+ void junk ();
public:
- P(P const &src);
+ P (P const &src);
/**
Remove the pointer, and return it.
*/
- T *get_p() { T*p = t_p; t_p=0; return p; }
+ T *get_p () { T*p = t_p; t_p=0; return p; }
/**
return the pointer
*/
- T *get_l() { return t_p; }
+ T *get_l () { return t_p; }
- T const *get_C() const { return t_p; }
+ T const *get_C () const { return t_p; }
/**
copy the contents of pointer, and return it
*/
- T *copy_p() const;
+ T *copy_p () const;
/**
swallow new_p, and set contents t new_p
*/
*/
void set_l (T const *t_C);
- P &operator =(P const &);
- ~P();
- P() { t_p = 0; }
- //P(T *p) { t_p = p; }
+ 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 ; }
- T &operator *() { return *t_p; }
- T const &operator *() const { return *t_p; }
- operator const T *() const { return t_p; }
+ T *operator -> () { return t_p; }
+ operator T * () { return t_p; }
+ const T *operator -> () const { return t_p ; }
+ T &operator * () { return *t_p; }
+ T const &operator * () const { return *t_p; }
+ operator const T * () const { return t_p; }
};
#endif // POINTER_HH
template<class T>
inline
T *
-P<T>::copy_p() const
+P<T>::copy_p () const
{
- return t_p? new T(*t_p) : 0;
+ return t_p? new T (*t_p) : 0;
}
template<class T>
void
P<T>::copy (T const *l_C)
{
- t_p = l_C ? new T(*l_C) : 0;
+ t_p = l_C ? new T (*l_C) : 0;
}
template<class T>
inline
void
-P<T>::junk()
+P<T>::junk ()
{
delete t_p;
t_p =0;
template<class T>
inline
-P<T>::P(P<T> const &s)
+P<T>::P (P<T> const &s)
{
- t_p = s.copy_p();
+ t_p = s.copy_p ();
}
template<class T>
inline
P<T> &
-P<T>::operator =(P const&s)
+P<T>::operator = (P const&s)
{
- junk();
+ junk ();
copy (s.t_p);
return *this;
}
template<class T>
inline
-P<T>::~P() {
- junk();
+P<T>::~P () {
+ junk ();
}
template<class T>
if (t_p == l_C)
return;
- junk();
+ junk ();
copy (l_C);
}
Array<Real> coefs_;
// leading coef
- Real &lc();
+ Real &lc ();
// leading coef
- Real lc() const;
- void print() const ;
- Real eval(Real) const ;
- void print_sols(Array<Real>) const ;
- void check_sols(Array<Real>) const ;
- void check_sol(Real x) const;
- static Polynomial multiply(const Polynomial & p1, const Polynomial & p2);
- static Polynomial power(int exponent, const Polynomial & src);
+ Real lc () const;
+ void print () const ;
+ Real eval (Real) const ;
+ void print_sols (Array<Real>) const ;
+ void check_sols (Array<Real>) const ;
+ void check_sol (Real x) const;
+ static Polynomial multiply (const Polynomial & p1, const Polynomial & p2);
+ static Polynomial power (int exponent, const Polynomial & src);
/// chop low coefficients
- void clean();
+ void clean ();
/// eliminate #x# close to zero
- void real_clean();
- static Polynomial add(const Polynomial & p1, const Polynomial & p2);
- void scalarmultiply(Real fact);
- void operator *= (Real f) { scalarmultiply(f); }
- void operator /= (Real f) { scalarmultiply(1/f); }
+ void real_clean ();
+ static Polynomial add (const Polynomial & p1, const Polynomial & p2);
+ void scalarmultiply (Real fact);
+ void operator *= (Real f) { scalarmultiply (f); }
+ void operator /= (Real f) { scalarmultiply (1/f); }
void operator += (Polynomial const &p2);
void operator *= (Polynomial const &p2);
void operator -= (Polynomial const &p2);
Polynomial (Real a, Real b =0.0);
Polynomial (){}
- static Polynomial subtract(const Polynomial & p1, const Polynomial & p2);
- void set_negate(const Polynomial & src);
+ static Polynomial subtract (const Polynomial & p1, const Polynomial & p2);
+ void set_negate (const Polynomial & src);
/// take the derivative
- void differentiate();
- int set_mod(const Polynomial &u, const Polynomial &v);
+ void differentiate ();
+ int set_mod (const Polynomial &u, const Polynomial &v);
- void debug_clean();
+ void debug_clean ();
- Array<Real> solve_quadric()const;
- Array<Real> solve_cubic()const;
- Array<Real> solve_linear()const;
+ Array<Real> solve_quadric ()const;
+ Array<Real> solve_cubic ()const;
+ Array<Real> solve_linear ()const;
Array<Real> solve () const;
};
-IMPLEMENT_ARITHMETIC_OPERATOR(Polynomial, - );
-IMPLEMENT_ARITHMETIC_OPERATOR(Polynomial, + );
-IMPLEMENT_ARITHMETIC_OPERATOR(Polynomial, * );
+IMPLEMENT_ARITHMETIC_OPERATOR (Polynomial, - );
+IMPLEMENT_ARITHMETIC_OPERATOR (Polynomial, + );
+IMPLEMENT_ARITHMETIC_OPERATOR (Polynomial, * );
inline Polynomial
operator * (Polynomial p, Real a)
Hungarian postfix pq
TODO: add increase/decrease operations,
- add max() operation
+ add max () operation
*/
template<class T>
class PQueue {
/** acces an heap element. Careful with this, as changing the
priority might fuck up the invariants
- @param 1 <= i < size() */
- T& operator[](int i) { return heap_arr_[i]; }
- T operator[](int i) const { return heap_arr_[i]; }
- void OK() const
+ @param 1 <= i < size () */
+ T& operator[] (int i) { return heap_arr_[i]; }
+ T operator[] (int i) const { return heap_arr_[i]; }
+ void OK () const
{
#ifndef NDEBUG
- for (int i =2; i <= size(); i++)
+ for (int i =2; i <= size (); i++)
assert (compare (elt (i/2), elt (i)) <= 0);
#endif
}
- T front() const { return elt (1); }
- int size() const { return heap_arr_.size (); }
+ T front () const { return elt (1); }
+ int size () const { return heap_arr_.size (); }
void insert (T v) {
heap_arr_.push (v);
- int i = heap_arr_.size();
+ int i = heap_arr_.size ();
int j = i / 2 ;
while (j) {
if (compare (elt (j), v) > 0) {
}
}
elt (i) = v;
- OK();
+ OK ();
}
- T max() const {
- //int first_leaf_i = size();
+ T max () const {
+ //int first_leaf_i = size ();
T max_t;
return max_t;
}
- void delmin() {
- assert (size());
- T last = heap_arr_.top();
+ void delmin () {
+ assert (size ());
+ T last = heap_arr_.top ();
int mini=2;
int lasti=1;
- while (mini < size()) {
+ while (mini < size ()) {
if (compare (elt (mini + 1), elt (mini)) <0)
mini++;
if (compare (last,elt (mini)) < 0)
mini *= 2;
}
elt (lasti) = last;
- heap_arr_.pop();
- OK();
+ heap_arr_.pop ();
+ OK ();
}
- T get() {
- T t = front();
- delmin();
+ T get () {
+ T t = front ();
+ delmin ();
return t;
}
};
void set_infinite (int sign);
bool infty_b () const;
void invert ();
- int num () const { return sign_ * num_; }
- int den () const { return den_; }
- int num_i () const { return sign_ * num_; }
- int den_i () const { return den_; }
+ int num () const { return sign_ * num_; }
+ int den () const { return den_; }
+ int num_i () const { return sign_ * num_; }
+ int den_i () const { return den_; }
Rational trunc_rat () const;
Rational div_rat (Rational) const;
Rational mod_rat (Rational) const;
template<class T> inline int sign (T x)
{
if (x)
- return x > T(0) ? 1 : -1;
+ return x > T (0) ? 1 : -1;
return 0;
}
Sources (Sources const&) {}
public:
Sources ();
- ~Sources();
+ ~Sources ();
Source_file * get_file_l (String &filename );
Source_file* sourcefile_l (char const* ch_C );
/** The functor String_convert handles all conversions to/from String
- (some time, anyway). The class is quite empty from data view. */
+ (some time, anyway). The class is quite empty from data view. */
class String_convert {
static int hex2bin_i (String hex_str, String& bin_str_r);
static int hex2nibble_i (Byte byte);
int references;
/// init to ""
- String_data();
+ String_data ();
/// init from src. Conservative allocation.
String_data (String_data const &src);
- ~String_data();
+ ~String_data ();
/** POST: maxlen >= j.
@param j, maximum stringlength_i_.
void remax (int j);
/// check if writeable.
- void OKW();
+ void OKW ();
/// check state.
- void OK();
+ void OK ();
/// reduce memory usage.
- void tighten();
+ void tighten ();
// assignment.
void set (Byte const* byte_C, int length_i);
void operator += (char const* ch_C);
- char const* ch_C() const;
+ char const* ch_C () const;
- char* ch_l();
+ char* ch_l ();
- Byte const* byte_C() const;
+ Byte const* byte_C () const;
// idem, non const
- Byte* byte_l();
+ Byte* byte_l ();
void trunc (int j);
/** access element. not really safe. Can alter length_i_ without
#String_data# knowing it. */
- Byte &operator [](int j);
- Byte operator [](int j) const;
- bool is_binary_bo() const;
+ Byte &operator [] (int j);
+ Byte operator [] (int j) const;
+ bool is_binary_bo () const;
};
#include <sys/types.h>
INLINE void
-String_data::OKW()
+String_data::OKW ()
{
assert (references == 1);
}
INLINE void
-String_data::OK()
+String_data::OK ()
{
assert (maxlen >= length_i_);
assert (bool (data_byte_p_));
INLINE
-String_data::String_data()
+String_data::String_data ()
{
references=0;
maxlen = INITIALMAX;
}
INLINE
-String_data::~String_data()
+String_data::~String_data ()
{
assert (references == 0);
delete[] data_byte_p_;
INLINE void
String_data::setmax (int j)
{
- OKW();
+ OKW ();
if (j > maxlen)
{
delete data_byte_p_;
INLINE void
String_data::remax (int j)
{
- OKW();
+ OKW ();
if (j > maxlen)
{
Byte *p = new Byte[j + 1];
}
INLINE void
-String_data::tighten()
+String_data::tighten ()
{ // should be dec'd const
maxlen = length_i_;
Byte *p = new Byte[maxlen + 1];
INLINE void
String_data::set (Byte const* byte_C, int length_i)
{
- OKW();
+ OKW ();
assert (byte_C && byte_C != data_byte_p_);
INLINE void
String_data::append (Byte const* byte_C, int length_i)
{
- OK();
- OKW();
+ OK ();
+ OKW ();
int old_i = length_i_;
length_i_ += length_i;
INLINE
char const*
-String_data::ch_C() const
+String_data::ch_C () const
{
return (char const*)data_byte_p_;
}
INLINE char*
-String_data::ch_l()
+String_data::ch_l ()
{
return (char*)data_byte_p_;
}
INLINE Byte const*
-String_data::byte_C() const
+String_data::byte_C () const
{
return data_byte_p_;
}
INLINE Byte*
-String_data::byte_l()
+String_data::byte_l ()
{
- OKW();
+ OKW ();
return data_byte_p_;
}
void
String_data::trunc (int j)
{
- OKW();
+ OKW ();
assert (j >= 0 && j <= length_i_);
data_byte_p_[j] = 0;
length_i_ = j;
}
INLINE bool
-String_data::is_binary_bo() const
+String_data::is_binary_bo () const
{
// return !memchr (data_byte_p_, length_i_, 0);
return ((int)strlen ((char const*)data_byte_p_) != length_i_ );
}
INLINE Byte&
-String_data::operator [](int j)
+String_data::operator [] (int j)
{
assert (j >= 0 && j <= length_i_);
return data_byte_p_[j] ;
}
INLINE Byte
-String_data::operator [](int j) const
+String_data::operator [] (int j) const
{
assert (j >= 0 && j <= length_i_);
return data_byte_p_[j];
String_data* data;
/// decrease ref count. Named kind of like a Tanenbaum semafore
- void down();
+ void down ();
/// increase ref count
void up (String_data *d);
/** make sure data has only one reference.
POST: data->references == 1
*/
- void copy();
+ void copy ();
public:
- String_handle();
- ~String_handle();
+ String_handle ();
+ ~String_handle ();
String_handle (String_handle const & src);
- Byte const* byte_C() const;
- char const* ch_C() const;
- Byte* byte_l();
- char* ch_l();
- bool is_binary_bo() const;
- void operator =(String_handle const &src);
+ Byte const* byte_C () const;
+ char const* ch_C () const;
+ Byte* byte_l ();
+ char* ch_l ();
+ bool is_binary_bo () const;
+ void operator = (String_handle const &src);
void operator += (char const *s);
- Byte operator[](int j) const;
+ Byte operator[] (int j) const;
/** Access elements. WARNING: NOT SAFE
- don't use this for loops. Use byte_C()
+ don't use this for loops. Use byte_C ()
*/
- Byte &operator[](int j);
+ Byte &operator[] (int j);
void append (Byte const* byte_C, int length_i);
void set (Byte const* byte_C, int length_i);
void operator = (char const *p);
void trunc (int j);
- int length_i() const;
+ int length_i () const;
};
#ifdef STRING_UTILS_INLINED
#include "string-handle.hh"
INLINE void
-String_handle::down()
+String_handle::down ()
{
- if (!(--data->references)) delete data; data = 0;
+ if (! (--data->references)) delete data; data = 0;
}
/// increase ref count
}
INLINE void
-String_handle::copy()
+String_handle::copy ()
{
if (data->references !=1)
{
String_data *newdata = new String_data (*data);
- down();
+ down ();
up (newdata);
}
}
INLINE
-String_handle::String_handle()
+String_handle::String_handle ()
{
up (new String_data);
}
INLINE
-String_handle::~String_handle()
+String_handle::~String_handle ()
{
- down();
+ down ();
}
INLINE
}
INLINE Byte*
-String_handle::byte_l()
+String_handle::byte_l ()
{
- copy();
- return data->byte_l();
+ copy ();
+ return data->byte_l ();
}
INLINE char*
-String_handle::ch_l()
+String_handle::ch_l ()
{
- copy();
- return (char*)data->byte_l();
+ copy ();
+ return (char*)data->byte_l ();
}
INLINE Byte
-const* String_handle::byte_C() const
+const* String_handle::byte_C () const
{
- return data->byte_C();
+ return data->byte_C ();
}
INLINE char const*
-String_handle::ch_C() const
+String_handle::ch_C () const
{
- return (char const*)data->byte_C();
+ return (char const*)data->byte_C ();
}
INLINE void
-String_handle::operator =(String_handle const &src)
+String_handle::operator = (String_handle const &src)
{
if (this == &src)
return;
- down();
+ down ();
up (src.data);
}
INLINE void
String_handle::operator += (char const *s)
{
- copy();
+ copy ();
*data += s;
}
INLINE Byte
-String_handle::operator[](int j) const
+String_handle::operator[] (int j) const
{
return (*data)[j];
}
// !NOT SAFE!
-// don't use this for loops. Use byte_C()
+// don't use this for loops. Use byte_C ()
INLINE Byte &
-String_handle::operator[](int j)
+String_handle::operator[] (int j)
{
- copy(); // hmm. Not efficient
- return data->byte_l()[j];
+ copy (); // hmm. Not efficient
+ return data->byte_l ()[j];
}
INLINE void
String_handle::append (Byte const* byte_C, int length_i)
{
- copy();
+ copy ();
data->append (byte_C, length_i);
}
INLINE void
String_handle::set (Byte const* byte_C, int length_i)
{
- copy();
+ copy ();
data->set (byte_C, length_i);
}
INLINE void
String_handle::operator = (char const *p)
{
- copy();
+ copy ();
data->set (p);
}
INLINE void
String_handle::trunc (int j)
{
- copy(); data->trunc (j);
+ copy (); data->trunc (j);
}
INLINE int
-String_handle::length_i() const
+String_handle::length_i () const
{
return data->length_i_;
}
INLINE bool
-String_handle::is_binary_bo() const {
- return data->is_binary_bo();
+String_handle::is_binary_bo () const {
+ return data->is_binary_bo ();
}
#endif
/** init to empty string. This is needed because other
constructors are provided.*/
- String ();
+ String ();
/// String s = "abc";
String (char const* source);
/// return "new"-ed copy of contents
Byte* copy_byte_p () const;
- char* copy_ch_p() const;
+ char* copy_ch_p () const;
char const* ch_C () const;
Byte const* byte_C () const;
char* ch_l ();
Byte* byte_l ();
- String &operator =(String const & source);
+ String &operator = (String const & source);
/// concatenate s
void operator += (char const* s) { strh_ += s; }
void operator += (String s);
- bool empty_b () const;
+ bool empty_b () const;
void append (String);
void prepend (String);
/**
Return a char. UNSAFE because it may change strlen () result
*/
- char &operator [](int n);
- char operator [](int n) const;
+ char &operator [] (int n);
+ char operator [] (int n) const;
/// return n leftmost chars
String left_str (int n) const;
/// index of rightmost c
int index_last_i (char c) const;
- /// index of rightmost element of string (???)
+ /// index of rightmost element of string (???)
int index_last_i (char const* string) const;
int index_i (char c) const;
#include "compare.hh"
-INSTANTIATE_COMPARE(String const &, String::compare_i);
+INSTANTIATE_COMPARE (String const &, String::compare_i);
#ifdef STRING_UTILS_INLINED
#ifndef INLINE
// because char const* also has an operator ==, this is for safety:
-inline bool operator==(String s1, char const* s2)
+inline bool operator== (String s1, char const* s2)
{
return s1 == String (s2);
}
-inline bool operator==(char const* s1, String s2)
+inline bool operator== (char const* s1, String s2)
{
return String (s1)==s2;
}
-inline bool operator!=(String s1, char const* s2 ) {
+inline bool operator!= (String s1, char const* s2 ) {
return s1!=String (s2);
}
-inline bool operator!=(char const* s1,String s2) {
+inline bool operator!= (char const* s1,String s2) {
return String (s2) !=s1;
}
INLINE
char &
-String::operator [](int n)
+String::operator [] (int n)
{
return (char &) strh_[n];
}
INLINE
char
-String::operator [](int n) const
+String::operator [] (int n) const
{
return strh_[n];
}
String filename;
public:
- Text_record() { } // needed because of other ctor
+ Text_record () { } // needed because of other ctor
/// report an error in this line.
void message (String s);
- String operator[](int j) {
- return Array<String>::operator[](j);
+ String operator[] (int j) {
+ return Array<String>::operator[] (j);
}
- Text_record (Array<String> s, String fn, int j) : Array<String>(s) {
+ Text_record (Array<String> s, String fn, int j) : Array<String> (s) {
filename = fn; line_no = j;
}
Array<String>::size;
class Text_db : private Data_file
{
- void gobble_leading_white();
+ void gobble_leading_white ();
public:
/// get a line with records
- Text_record get_record();
+ Text_record get_record ();
Text_db (String fn):Data_file (fn) { }
Data_file::error;
bool eof_b ();
/// get next line.
- Text_record operator++(int) {
- return get_record();
+ Text_record operator++ (int) {
+ return get_record ();
}
/// are we done yet?
- operator bool() {
+ operator bool () {
return !eof_b ();
}
};
/**
line counting input stream.
a stream for textfiles. linecounting. Thin interface getchar and
- ungetchar. (ungetc is unlimited)
+ ungetchar. (ungetc is unlimited)
should protect get and unget against improper use
*/
public:
Text_stream (String fn);
- String get_name() { return name; }
- bool eof_b();
- char get() {
+ String get_name () { return name; }
+ bool eof_b ();
+ char get () {
char c;
- if (pushback.empty())
+ if (pushback.empty ())
c = getc (f);
else
- c = pushback.pop();
+ c = pushback.pop ();
if (c =='\n')
line_no++;
line_no--;
pushback.push (c);
}
- char peek() {
+ char peek () {
if (eof_b ())
return (char)-1;
- char c = get();
+ char c = get ();
unget (c);
return c;
}
- bool eol() {
- return (peek() == '\n');
+ bool eol () {
+ return (peek () == '\n');
}
- int line(){
+ int line (){
return line_no;
}
- ~Text_stream();
+ ~Text_stream ();
/// GNU format message.
#include <typeinfo>
-#define classname(class_ptr) demangle_classname(typeid(*(class_ptr)))
+#define classname(class_ptr) demangle_classname (typeid (* (class_ptr)))
const char *
demangle_classname (type_info const &);
/**
Virtual copy constructor. Make up for C++'s lack of a standard
- clone() function. Uses a typeof hack. Usage:
+ clone () function. Uses a typeof hack. Usage:
class Foo : Baseclass {
- VIRTUAL_COPY_CONS(Baseclass);
+ VIRTUAL_COPY_CONS (Baseclass);
};
*/
#define VIRTUAL_COPY_CONS(base) \
virtual base *clone () const \
{ \
- return new typeof(*this) (*this); \
+ return new typeof (*this) (*this); \
}
#else
#define VIRTUAL_COPY_CONS(base) \
source file of the LilyPond music typesetter
- (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <iostream.h>
#include "flower-proto.hh"
/*
Produce GNU-compliant error message. Correcting mudela is such a
- breeze if you('re edidor) know(s) the error column too
+ breeze if you ('re edidor) know (s) the error column too
Format:
if (source_file_l_)
return source_file_l_->file_line_column_str (defined_ch_C_);
else
- return "(" + _ ("position unknown") + ")";
+ return " (" + _ ("position unknown") + ")";
}
String
Offset::str () const
{
String s;
- s = String("(") + to_str (coordinate_a_[X_AXIS]) + ", "
+ s = String (" (") + to_str (coordinate_a_[X_AXIS]) + ", "
+ to_str (coordinate_a_[Y_AXIS]) + ")";
return s;
}
complex_multiply (Offset z1, Offset z2)
{
Offset z;
- if(!isinf_b(z2[Y_AXIS]))
+ if (!isinf_b (z2[Y_AXIS]))
{
z[X_AXIS] = z1[X_AXIS] * z2[X_AXIS] - z1[Y_AXIS]*z2[Y_AXIS];
z[Y_AXIS] = z1[X_AXIS] * z2[Y_AXIS] + z1[Y_AXIS] * z2[X_AXIS];
Real r = exp (o[X_AXIS]);
- return Offset(r*c, r*s);
+ return Offset (r*c, r*s);
}
Real
* - fixed bug of not allocating extra byte for string duplication
* - fixed typos
* modified: DSM Tue Apr 3 11:18:34 PDT 1990
- * - added free(ident) at end of parseFile routine
+ * - added free (ident) at end of parseFile routine
* modified: DSM Tue Jun 19 10:16:29 PDT 1990
* - changed (width == 250) to (width = 250) in initializeArray
*/
#define False "false" /* used in string comparison to check the value of */
/* boolean keys (e.g. IsFixedPitch) */
-#define MATCH(A,B) (strncmp((A),(B), MAX_NAME) == 0)
+#define MATCH(A,B) (strncmp ((A), (B), MAX_NAME) == 0)
* reads all tokens until the next end-of-line.
*/
-static char *token(FILE *stream)
+static char *token (FILE *stream)
{
int ch, idx;
/* skip over white space */
- while ((ch = fgetc(stream)) == ' ' || ch == lineterm ||
+ while ((ch = fgetc (stream)) == ' ' || ch == lineterm ||
ch == lineterm_alt ||
ch == ',' || ch == '\t' || ch == ';');
&& ch != '\t' && ch != ':' && ch != ';')
{
ident[idx++] = ch;
- ch = fgetc(stream);
+ ch = fgetc (stream);
} /* while */
if (ch == EOF && idx < 1) return ((char *)NULL);
- if (idx >= 1 && ch != ':' ) ungetc(ch, stream);
+ if (idx >= 1 && ch != ':' ) ungetc (ch, stream);
if (idx < 1 ) ident[idx++] = ch; /* single-character token */
ident[idx] = 0;
- return(ident); /* returns pointer to the token */
+ return (ident); /* returns pointer to the token */
} /* token */
* more than one word (like Comment lines and FullName).
*/
-static char *linetoken(FILE *stream)
+static char *linetoken (FILE *stream)
{
int ch, idx;
- while ((ch = fgetc(stream)) == ' ' || ch == '\t' );
+ while ((ch = fgetc (stream)) == ' ' || ch == '\t' );
idx = 0;
while (idx < MAX_NAME - 1 &&
ch != EOF && ch != lineterm && ch != lineterm_alt)
{
ident[idx++] = ch;
- ch = fgetc(stream);
+ ch = fgetc (stream);
} /* while */
- ungetc(ch, stream);
+ ungetc (ch, stream);
ident[idx] = 0;
- return(ident); /* returns pointer to the token */
+ return (ident); /* returns pointer to the token */
} /* linetoken */
* The algorithm is a standard Knuth binary search.
*/
-static enum parseKey recognize( register char *ident)
+static enum parseKey recognize ( register char *ident)
{
int lower = 0, upper = (int) NOPE, midpoint, cmpvalue;
BOOL found = FALSE;
{
midpoint = (lower + upper)/2;
if (keyStrings[midpoint] == NULL) break;
- cmpvalue = strncmp(ident, keyStrings[midpoint], MAX_NAME);
+ cmpvalue = strncmp (ident, keyStrings[midpoint], MAX_NAME);
if (cmpvalue == 0) found = TRUE;
else if (cmpvalue < 0) upper = midpoint - 1;
else lower = midpoint + 1;
* parseFile to determine if there is more file to parse.
*/
-static BOOL parseGlobals(FILE *fp, register AFM_GlobalFontInfo *gfi)
+static BOOL parseGlobals (FILE *fp, register AFM_GlobalFontInfo *gfi)
{
BOOL cont = TRUE, save = (gfi != NULL);
int error = AFM_ok;
while (cont)
{
- keyword = token(fp);
+ keyword = token (fp);
if (keyword == NULL)
/* Have reached an early and unexpected EOF. */
if (!save)
/* get tokens until the end of the Global Font info section */
/* without saving any of the data */
- switch (recognize(keyword))
+ switch (recognize (keyword))
{
case STARTCHARMETRICS:
cont = FALSE;
else
/* otherwise parse entire global font info section, */
/* saving the data */
- switch(recognize(keyword))
+ switch (recognize (keyword))
{
case STARTFONTMETRICS:
- keyword = token(fp);
- gfi->afmVersion = (char *) malloc(strlen(keyword) + 1);
- strcpy(gfi->afmVersion, keyword);
+ keyword = token (fp);
+ gfi->afmVersion = (char *) malloc (strlen (keyword) + 1);
+ strcpy (gfi->afmVersion, keyword);
break;
case COMMENT:
- keyword = linetoken(fp);
+ keyword = linetoken (fp);
break;
case FONTNAME:
- keyword = token(fp);
- gfi->fontName = (char *) malloc(strlen(keyword) + 1);
- strcpy(gfi->fontName, keyword);
+ keyword = token (fp);
+ gfi->fontName = (char *) malloc (strlen (keyword) + 1);
+ strcpy (gfi->fontName, keyword);
break;
case ENCODINGSCHEME:
- keyword = token(fp);
+ keyword = token (fp);
gfi->encodingScheme = (char *)
- malloc(strlen(keyword) + 1);
- strcpy(gfi->encodingScheme, keyword);
+ malloc (strlen (keyword) + 1);
+ strcpy (gfi->encodingScheme, keyword);
break;
case FULLNAME:
- keyword = linetoken(fp);
- gfi->fullName = (char *) malloc(strlen(keyword) + 1);
- strcpy(gfi->fullName, keyword);
+ keyword = linetoken (fp);
+ gfi->fullName = (char *) malloc (strlen (keyword) + 1);
+ strcpy (gfi->fullName, keyword);
break;
case FAMILYNAME:
- keyword = linetoken(fp);
- gfi->familyName = (char *) malloc(strlen(keyword) + 1);
- strcpy(gfi->familyName, keyword);
+ keyword = linetoken (fp);
+ gfi->familyName = (char *) malloc (strlen (keyword) + 1);
+ strcpy (gfi->familyName, keyword);
break;
case WEIGHT:
- keyword = token(fp);
- gfi->weight = (char *) malloc(strlen(keyword) + 1);
- strcpy(gfi->weight, keyword);
+ keyword = token (fp);
+ gfi->weight = (char *) malloc (strlen (keyword) + 1);
+ strcpy (gfi->weight, keyword);
break;
case ITALICANGLE:
- keyword = token(fp);
- gfi->italicAngle = atof(keyword);
+ keyword = token (fp);
+ gfi->italicAngle = atof (keyword);
if (errno == ERANGE) error = AFM_parseError;
break;
case ISFIXEDPITCH:
- keyword = token(fp);
- if (MATCH(keyword, False))
+ keyword = token (fp);
+ if (MATCH (keyword, False))
gfi->isFixedPitch = 0;
else
gfi->isFixedPitch = 1;
break;
case UNDERLINEPOSITION:
- keyword = token(fp);
- gfi->underlinePosition = atoi(keyword);
+ keyword = token (fp);
+ gfi->underlinePosition = atoi (keyword);
break;
case UNDERLINETHICKNESS:
- keyword = token(fp);
- gfi->underlineThickness = atoi(keyword);
+ keyword = token (fp);
+ gfi->underlineThickness = atoi (keyword);
break;
case VERSION:
- keyword = linetoken(fp);
- gfi->version = (char *) malloc(strlen(keyword) + 1);
- strcpy(gfi->version, keyword);
+ keyword = linetoken (fp);
+ gfi->version = (char *) malloc (strlen (keyword) + 1);
+ strcpy (gfi->version, keyword);
break;
case NOTICE:
- keyword = linetoken(fp);
- gfi->notice = (char *) malloc(strlen(keyword) + 1);
- strcpy(gfi->notice, keyword);
+ keyword = linetoken (fp);
+ gfi->notice = (char *) malloc (strlen (keyword) + 1);
+ strcpy (gfi->notice, keyword);
break;
case FONTBBOX:
- keyword = token(fp);
- gfi->fontBBox.llx = atoi(keyword);
- keyword = token(fp);
- gfi->fontBBox.lly = atoi(keyword);
- keyword = token(fp);
- gfi->fontBBox.urx = atoi(keyword);
- keyword = token(fp);
- gfi->fontBBox.ury = atoi(keyword);
+ keyword = token (fp);
+ gfi->fontBBox.llx = atoi (keyword);
+ keyword = token (fp);
+ gfi->fontBBox.lly = atoi (keyword);
+ keyword = token (fp);
+ gfi->fontBBox.urx = atoi (keyword);
+ keyword = token (fp);
+ gfi->fontBBox.ury = atoi (keyword);
break;
case CAPHEIGHT:
- keyword = token(fp);
- gfi->capHeight = atoi(keyword);
+ keyword = token (fp);
+ gfi->capHeight = atoi (keyword);
break;
case XHEIGHT:
- keyword = token(fp);
- gfi->xHeight = atoi(keyword);
+ keyword = token (fp);
+ gfi->xHeight = atoi (keyword);
break;
case DESCENDER:
- keyword = token(fp);
- gfi->descender = atoi(keyword);
+ keyword = token (fp);
+ gfi->descender = atoi (keyword);
break;
case ASCENDER:
- keyword = token(fp);
- gfi->ascender = atoi(keyword);
+ keyword = token (fp);
+ gfi->ascender = atoi (keyword);
break;
case STARTCHARMETRICS:
cont = FALSE;
} /* switch */
} /* while */
- return(error);
+ return (error);
} /* parseGlobals */
* file is reset to be where it was upon entering this function.
*/
-static int initializeArray(FILE *fp, register int *cwi)
+static int initializeArray (FILE *fp, register int *cwi)
{
BOOL cont = TRUE, found = FALSE;
- long opos = ftell(fp);
+ long opos = ftell (fp);
int code = 0, width = 0, i = 0, error = 0;
register char *keyword;
while (cont)
{
- keyword = token(fp);
+ keyword = token (fp);
if (keyword == NULL)
{
error = AFM_earlyEOF;
break; /* get out of loop */
}
- switch(recognize(keyword))
+ switch (recognize (keyword))
{
case COMMENT:
- keyword = linetoken(fp);
+ keyword = linetoken (fp);
break;
case CODE:
- code = atoi(token(fp));
+ code = atoi (token (fp));
break;
case XWIDTH:
- width = atoi(token(fp));
+ width = atoi (token (fp));
break;
case CHARNAME:
- keyword = token(fp);
- if (MATCH(keyword, Space))
+ keyword = token (fp);
+ if (MATCH (keyword, Space))
{
cont = FALSE;
found = TRUE;
for (i = 0; i < 256; ++i)
cwi[i] = width;
- fseek(fp, opos, 0);
+ fseek (fp, opos, 0);
- return(error);
+ return (error);
} /* initializeArray */
* parseFile to determine if there is more file to parse.
*/
-static int parseCharWidths(FILE *fp, register int *cwi)
+static int parseCharWidths (FILE *fp, register int *cwi)
{
BOOL cont = TRUE, save = (cwi != NULL);
int pos = 0, error = AFM_ok;
while (cont)
{
- keyword = token(fp);
+ keyword = token (fp);
/* Have reached an early and unexpected EOF. */
/* Set flag and stop parsing */
if (keyword == NULL)
if (!save)
/* get tokens until the end of the Char Metrics section without */
/* saving any of the data*/
- switch (recognize(keyword))
+ switch (recognize (keyword))
{
case ENDCHARMETRICS:
cont = FALSE;
else
/* otherwise parse entire char metrics section, saving */
/* only the char x-width info */
- switch(recognize(keyword))
+ switch (recognize (keyword))
{
case COMMENT:
- keyword = linetoken(fp);
+ keyword = linetoken (fp);
break;
case CODE:
- keyword = token(fp);
- pos = atoi(keyword);
+ keyword = token (fp);
+ pos = atoi (keyword);
break;
case XYWIDTH:
/* PROBLEM: Should be no Y-WIDTH when doing "quick & dirty" */
- keyword = token(fp); keyword = token(fp); /* eat values */
+ keyword = token (fp); keyword = token (fp); /* eat values */
error = AFM_parseError;
break;
case XWIDTH:
- keyword = token(fp);
+ keyword = token (fp);
if (pos >= 0) /* ignore unmapped chars */
- cwi[pos] = atoi(keyword);
+ cwi[pos] = atoi (keyword);
break;
case ENDCHARMETRICS:
cont = FALSE;
error = normalEOF;
break;
case CHARNAME: /* eat values (so doesn't cause AFM_parseError) */
- keyword = token(fp);
+ keyword = token (fp);
break;
case CHARBBOX:
- keyword = token(fp); keyword = token(fp);
- keyword = token(fp); keyword = token(fp);
+ keyword = token (fp); keyword = token (fp);
+ keyword = token (fp); keyword = token (fp);
break;
case LIGATURE:
- keyword = token(fp); keyword = token(fp);
+ keyword = token (fp); keyword = token (fp);
break;
case NOPE:
default:
} /* switch */
} /* while */
- return(error);
+ return (error);
} /* parseCharWidths */
/* This function is called by parseFile if the caller of parseFile
* requested that all character metric information be saved
- * (as opposed to only the character width information).
+ * (as opposed to only the character width information).
*
* parseCharMetrics is passed in a pointer to an array of records
* to hold information on a per character basis. This function
* parseFile to determine if there is more file to parse.
*/
-static int parseCharMetrics(FILE *fp, register AFM_Font_info *fi)
+static int parseCharMetrics (FILE *fp, register AFM_Font_info *fi)
{
BOOL cont = TRUE, firstTime = TRUE;
int error = AFM_ok, count = 0;
while (cont)
{
- keyword = token(fp);
+ keyword = token (fp);
if (keyword == NULL)
{
error = AFM_earlyEOF;
break; /* get out of loop */
}
- switch(recognize(keyword))
+ switch (recognize (keyword))
{
case COMMENT:
- keyword = linetoken(fp);
+ keyword = linetoken (fp);
break;
case CODE:
if (count < fi->numOfChars)
{
if (firstTime) firstTime = FALSE;
else temp++;
- temp->code = atoi(token(fp));
+ temp->code = atoi (token (fp));
count++;
}
else
}
break;
case XYWIDTH:
- temp->wx = atoi(token(fp));
- temp->wy = atoi(token(fp));
+ temp->wx = atoi (token (fp));
+ temp->wy = atoi (token (fp));
break;
case XWIDTH:
- temp->wx = atoi(token(fp));
+ temp->wx = atoi (token (fp));
break;
case CHARNAME:
- keyword = token(fp);
- temp->name = (char *) malloc(strlen(keyword) + 1);
- strcpy(temp->name, keyword);
+ keyword = token (fp);
+ temp->name = (char *) malloc (strlen (keyword) + 1);
+ strcpy (temp->name, keyword);
break;
case CHARBBOX:
- temp->charBBox.llx = atoi(token(fp));
- temp->charBBox.lly = atoi(token(fp));
- temp->charBBox.urx = atoi(token(fp));
- temp->charBBox.ury = atoi(token(fp));
+ temp->charBBox.llx = atoi (token (fp));
+ temp->charBBox.lly = atoi (token (fp));
+ temp->charBBox.urx = atoi (token (fp));
+ temp->charBBox.ury = atoi (token (fp));
break;
case LIGATURE: {
- AFM_Ligature **tail = &(temp->ligs);
+ AFM_Ligature **tail = & (temp->ligs);
AFM_Ligature *node = *tail;
if (*tail != NULL)
{
while (node->next != NULL)
node = node->next;
- tail = &(node->next);
+ tail = & (node->next);
}
- *tail = (AFM_Ligature *) calloc(1, sizeof(AFM_Ligature));
- keyword = token(fp);
- (*tail)->succ = (char *) malloc(strlen(keyword) + 1);
- strcpy((*tail)->succ, keyword);
- keyword = token(fp);
- (*tail)->lig = (char *) malloc(strlen(keyword) + 1);
- strcpy((*tail)->lig, keyword);
+ *tail = (AFM_Ligature *) calloc (1, sizeof (AFM_Ligature));
+ keyword = token (fp);
+ (*tail)->succ = (char *) malloc (strlen (keyword) + 1);
+ strcpy ((*tail)->succ, keyword);
+ keyword = token (fp);
+ (*tail)->lig = (char *) malloc (strlen (keyword) + 1);
+ strcpy ((*tail)->lig, keyword);
break; }
case ENDCHARMETRICS:
cont = FALSE;;
if ((error == AFM_ok) && (count != fi->numOfChars))
error = AFM_parseError;
- return(error);
+ return (error);
} /* parseCharMetrics */
* parseFile to determine if there is more file to parse.
*/
-static int parseAFM_TrackKernData(FILE *fp, register AFM_Font_info *fi)
+static int parseAFM_TrackKernData (FILE *fp, register AFM_Font_info *fi)
{
BOOL cont = TRUE, save = (fi->tkd != NULL);
int pos = 0, error = AFM_ok, tcount = 0;
while (cont)
{
- keyword = token(fp);
+ keyword = token (fp);
if (keyword == NULL)
{
if (!save)
/* get tokens until the end of the Track Kerning Data */
/* section without saving any of the data */
- switch(recognize(keyword))
+ switch (recognize (keyword))
{
case ENDTRACKKERN:
case ENDKERNDATA:
else
/* otherwise parse entire Track Kerning Data section, */
/* saving the data */
- switch(recognize(keyword))
+ switch (recognize (keyword))
{
case COMMENT:
- keyword = linetoken(fp);
+ keyword = linetoken (fp);
break;
case TRACKKERN:
if (tcount < fi->numOfTracks)
{
- keyword = token(fp);
- fi->tkd[pos].degree = atoi(keyword);
- keyword = token(fp);
- fi->tkd[pos].minPtSize = atof(keyword);
+ keyword = token (fp);
+ fi->tkd[pos].degree = atoi (keyword);
+ keyword = token (fp);
+ fi->tkd[pos].minPtSize = atof (keyword);
if (errno == ERANGE) error = AFM_parseError;
- keyword = token(fp);
- fi->tkd[pos].minKernAmt = atof(keyword);
+ keyword = token (fp);
+ fi->tkd[pos].minKernAmt = atof (keyword);
if (errno == ERANGE) error = AFM_parseError;
- keyword = token(fp);
- fi->tkd[pos].maxPtSize = atof(keyword);
+ keyword = token (fp);
+ fi->tkd[pos].maxPtSize = atof (keyword);
if (errno == ERANGE) error = AFM_parseError;
- keyword = token(fp);
- fi->tkd[pos++].maxKernAmt = atof(keyword);
+ keyword = token (fp);
+ fi->tkd[pos++].maxKernAmt = atof (keyword);
if (errno == ERANGE) error = AFM_parseError;
tcount++;
}
if (error == AFM_ok && tcount != fi->numOfTracks)
error = AFM_parseError;
- return(error);
+ return (error);
} /* parseAFM_TrackKernData */
* parseFile to determine if there is more file to parse.
*/
-static int parseAFM_PairKernData(FILE *fp, register AFM_Font_info *fi)
+static int parseAFM_PairKernData (FILE *fp, register AFM_Font_info *fi)
{
BOOL cont = TRUE, save = (fi->pkd != NULL);
int pos = 0, error = AFM_ok, pcount = 0;
while (cont)
{
- keyword = token(fp);
+ keyword = token (fp);
if (keyword == NULL)
{
if (!save)
/* get tokens until the end of the Pair Kerning Data */
/* section without saving any of the data */
- switch(recognize(keyword))
+ switch (recognize (keyword))
{
case ENDKERNPAIRS:
case ENDKERNDATA:
else
/* otherwise parse entire Pair Kerning Data section, */
/* saving the data */
- switch(recognize(keyword))
+ switch (recognize (keyword))
{
case COMMENT:
- keyword = linetoken(fp);
+ keyword = linetoken (fp);
break;
case KERNPAIR:
if (pcount < fi->numOfPairs)
{
- keyword = token(fp);
+ keyword = token (fp);
fi->pkd[pos].name1 = (char *)
- malloc(strlen(keyword) + 1);
- strcpy(fi->pkd[pos].name1, keyword);
- keyword = token(fp);
+ malloc (strlen (keyword) + 1);
+ strcpy (fi->pkd[pos].name1, keyword);
+ keyword = token (fp);
fi->pkd[pos].name2 = (char *)
- malloc(strlen(keyword) + 1);
- strcpy(fi->pkd[pos].name2, keyword);
- keyword = token(fp);
- fi->pkd[pos].xamt = atoi(keyword);
- keyword = token(fp);
- fi->pkd[pos++].yamt = atoi(keyword);
+ malloc (strlen (keyword) + 1);
+ strcpy (fi->pkd[pos].name2, keyword);
+ keyword = token (fp);
+ fi->pkd[pos].xamt = atoi (keyword);
+ keyword = token (fp);
+ fi->pkd[pos++].yamt = atoi (keyword);
pcount++;
}
else
case KERNPAIRXAMT:
if (pcount < fi->numOfPairs)
{
- keyword = token(fp);
+ keyword = token (fp);
fi->pkd[pos].name1 = (char *)
- malloc(strlen(keyword) + 1);
- strcpy(fi->pkd[pos].name1, keyword);
- keyword = token(fp);
+ malloc (strlen (keyword) + 1);
+ strcpy (fi->pkd[pos].name1, keyword);
+ keyword = token (fp);
fi->pkd[pos].name2 = (char *)
- malloc(strlen(keyword) + 1);
- strcpy(fi->pkd[pos].name2, keyword);
- keyword = token(fp);
- fi->pkd[pos++].xamt = atoi(keyword);
+ malloc (strlen (keyword) + 1);
+ strcpy (fi->pkd[pos].name2, keyword);
+ keyword = token (fp);
+ fi->pkd[pos++].xamt = atoi (keyword);
pcount++;
}
else
if (error == AFM_ok && pcount != fi->numOfPairs)
error = AFM_parseError;
- return(error);
+ return (error);
} /* parseAFM_PairKernData */
* parseFile to determine if there is more file to parse.
*/
-static int parseAFM_CompCharData(FILE *fp, register AFM_Font_info *fi)
+static int parseAFM_CompCharData (FILE *fp, register AFM_Font_info *fi)
{
BOOL cont = TRUE, firstTime = TRUE, save = (fi->ccd != NULL);
int pos = 0, j = 0, error = AFM_ok, ccount = 0, pcount = 0;
while (cont)
{
- keyword = token(fp);
+ keyword = token (fp);
if (keyword == NULL)
/* Have reached an early and unexpected EOF. */
/* Set flag and stop parsing */
if (!save)
/* get tokens until the end of the Composite Character info */
/* section without saving any of the data */
- switch(recognize(keyword))
+ switch (recognize (keyword))
{
case ENDCOMPOSITES:
cont = FALSE;
else
/* otherwise parse entire Composite Character info section, */
/* saving the data */
- switch(recognize(keyword))
+ switch (recognize (keyword))
{
case COMMENT:
- keyword = linetoken(fp);
+ keyword = linetoken (fp);
break;
case COMPCHAR:
if (ccount < fi->numOfComps)
{
- keyword = token(fp);
+ keyword = token (fp);
if (pcount != fi->ccd[pos].numOfPieces)
error = AFM_parseError;
pcount = 0;
if (firstTime) firstTime = FALSE;
else pos++;
fi->ccd[pos].ccName = (char *)
- malloc(strlen(keyword) + 1);
- strcpy(fi->ccd[pos].ccName, keyword);
- keyword = token(fp);
- fi->ccd[pos].numOfPieces = atoi(keyword);
+ malloc (strlen (keyword) + 1);
+ strcpy (fi->ccd[pos].ccName, keyword);
+ keyword = token (fp);
+ fi->ccd[pos].numOfPieces = atoi (keyword);
fi->ccd[pos].pieces = (AFM_Pcc *)
- calloc(fi->ccd[pos].numOfPieces, sizeof(AFM_Pcc));
+ calloc (fi->ccd[pos].numOfPieces, sizeof (AFM_Pcc));
j = 0;
ccount++;
}
case COMPCHARPIECE:
if (pcount < fi->ccd[pos].numOfPieces)
{
- keyword = token(fp);
+ keyword = token (fp);
fi->ccd[pos].pieces[j].AFM_PccName = (char *)
- malloc(strlen(keyword) + 1);
- strcpy(fi->ccd[pos].pieces[j].AFM_PccName, keyword);
- keyword = token(fp);
- fi->ccd[pos].pieces[j].deltax = atoi(keyword);
- keyword = token(fp);
- fi->ccd[pos].pieces[j++].deltay = atoi(keyword);
+ malloc (strlen (keyword) + 1);
+ strcpy (fi->ccd[pos].pieces[j].AFM_PccName, keyword);
+ keyword = token (fp);
+ fi->ccd[pos].pieces[j].deltax = atoi (keyword);
+ keyword = token (fp);
+ fi->ccd[pos].pieces[j++].deltay = atoi (keyword);
pcount++;
}
else
if (error == AFM_ok && ccount != fi->numOfComps)
error = AFM_parseError;
- return(error);
+ return (error);
} /* parseAFM_CompCharData */
/* storage data for the global variable ident */
if (!ident)
- ident = (char *) calloc(MAX_NAME, sizeof(char));
- if (ident == NULL) {error = AFM_storageProblem; return(error);}
+ ident = (char *) calloc (MAX_NAME, sizeof (char));
+ if (ident == NULL) {error = AFM_storageProblem; return (error);}
- (*fi) = (AFM_Font_info *) calloc(1, sizeof(AFM_Font_info));
- if ((*fi) == NULL) {error = AFM_storageProblem; return(error);}
+ (*fi) = (AFM_Font_info *) calloc (1, sizeof (AFM_Font_info));
+ if ((*fi) == NULL) {error = AFM_storageProblem; return (error);}
if (flags & P_G)
{
- (*fi)->gfi = (AFM_GlobalFontInfo *) calloc(1, sizeof(AFM_GlobalFontInfo));
- if ((*fi)->gfi == NULL) {error = AFM_storageProblem; return(error);}
+ (*fi)->gfi = (AFM_GlobalFontInfo *) calloc (1, sizeof (AFM_GlobalFontInfo));
+ if ((*fi)->gfi == NULL) {error = AFM_storageProblem; return (error);}
}
/* The AFM File begins with Global Font Information. This section */
/* will be parsed whether or not information should be saved. */
- code = parseGlobals(fp, (*fi)->gfi);
+ code = parseGlobals (fp, (*fi)->gfi);
if (code < 0) error = code;
if ((code != normalEOF) && (code != AFM_earlyEOF))
{
- (*fi)->numOfChars = atoi(token(fp));
+ (*fi)->numOfChars = atoi (token (fp));
if (flags & (P_M ^ P_W))
{
- (*fi)->cmi = (AFM_CharMetricInfo *)
- calloc((*fi)->numOfChars, sizeof(AFM_CharMetricInfo));
- if ((*fi)->cmi == NULL) {error = AFM_storageProblem; return(error);}
- code = parseCharMetrics(fp, *fi);
+ (*fi)->cmi = (AFM_CharMetricInfo *)
+ calloc ((*fi)->numOfChars, sizeof (AFM_CharMetricInfo));
+ if ((*fi)->cmi == NULL) {error = AFM_storageProblem; return (error);}
+ code = parseCharMetrics (fp, *fi);
}
else
{
if (flags & P_W)
{
- (*fi)->cwi = (int *) calloc(256, sizeof(int));
+ (*fi)->cwi = (int *) calloc (256, sizeof (int));
if ((*fi)->cwi == NULL)
{
error = AFM_storageProblem;
- return(error);
+ return (error);
}
}
/* parse section regardless */
- code = parseCharWidths(fp, (*fi)->cwi);
+ code = parseCharWidths (fp, (*fi)->cwi);
} /* else */
} /* if */
while ((code != normalEOF) && (code != AFM_earlyEOF))
{
- keyword = token(fp);
+ keyword = token (fp);
if (keyword == NULL)
/* Have reached an early and unexpected EOF. */
/* Set flag and stop parsing */
code = AFM_earlyEOF;
break; /* get out of loop */
}
- switch(recognize(keyword))
+ switch (recognize (keyword))
{
case STARTKERNDATA:
break;
case ENDKERNDATA:
break;
case STARTTRACKKERN:
- keyword = token(fp);
+ keyword = token (fp);
if (flags & P_T)
{
- (*fi)->numOfTracks = atoi(keyword);
- (*fi)->tkd = (AFM_TrackKernData *)
- calloc((*fi)->numOfTracks, sizeof(AFM_TrackKernData));
+ (*fi)->numOfTracks = atoi (keyword);
+ (*fi)->tkd = (AFM_TrackKernData *)
+ calloc ((*fi)->numOfTracks, sizeof (AFM_TrackKernData));
if ((*fi)->tkd == NULL)
{
error = AFM_storageProblem;
- return(error);
+ return (error);
}
} /* if */
- code = parseAFM_TrackKernData(fp, *fi);
+ code = parseAFM_TrackKernData (fp, *fi);
break;
case STARTKERNPAIRS:
- keyword = token(fp);
+ keyword = token (fp);
if (flags & P_P)
{
- (*fi)->numOfPairs = atoi(keyword);
- (*fi)->pkd = (AFM_PairKernData *)
- calloc((*fi)->numOfPairs, sizeof(AFM_PairKernData));
+ (*fi)->numOfPairs = atoi (keyword);
+ (*fi)->pkd = (AFM_PairKernData *)
+ calloc ((*fi)->numOfPairs, sizeof (AFM_PairKernData));
if ((*fi)->pkd == NULL)
{
error = AFM_storageProblem;
- return(error);
+ return (error);
}
} /* if */
- code = parseAFM_PairKernData(fp, *fi);
+ code = parseAFM_PairKernData (fp, *fi);
break;
case STARTCOMPOSITES:
- keyword = token(fp);
+ keyword = token (fp);
if (flags & P_C)
{
- (*fi)->numOfComps = atoi(keyword);
- (*fi)->ccd = (AFM_CompCharData *)
- calloc((*fi)->numOfComps, sizeof(AFM_CompCharData));
+ (*fi)->numOfComps = atoi (keyword);
+ (*fi)->ccd = (AFM_CompCharData *)
+ calloc ((*fi)->numOfComps, sizeof (AFM_CompCharData));
if ((*fi)->ccd == NULL)
{
error = AFM_storageProblem;
- return(error);
+ return (error);
}
} /* if */
- code = parseAFM_CompCharData(fp, *fi);
+ code = parseAFM_CompCharData (fp, *fi);
break;
case ENDFONTMETRICS:
code = normalEOF;
if ((error != AFM_earlyEOF) && (code < 0)) error = code;
- if (ident != NULL) { free(ident); ident = NULL; }
+ if (ident != NULL) { free (ident); ident = NULL; }
- return(error);
+ return (error);
} /* parseFile */
/*
poly.cc -- routines for manipulation of polynomials in one var
- (c) 1993--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1993--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <math.h>
Polynomial
-Polynomial::multiply(const Polynomial & p1, const Polynomial & p2)
+Polynomial::multiply (const Polynomial & p1, const Polynomial & p2)
{
Polynomial dest;
}
void
-Polynomial::differentiate()
+Polynomial::differentiate ()
{
for (int i = 1; i<= degree (); i++)
{
}
Polynomial
-Polynomial::power(int exponent, const Polynomial & src)
+Polynomial::power (int exponent, const Polynomial & src)
{
int e = exponent;
- Polynomial dest(1), base(src);
+ Polynomial dest (1), base (src);
/*
classic int power. invariant: src^exponent = dest * src ^ e
{
if (e % 2)
{
- dest = multiply(dest, base);
+ dest = multiply (dest, base);
e--;
} else
{
- base = multiply(base, base);
+ base = multiply (base, base);
e /= 2;
}
}
static Real const FUDGE = 1e-8;
void
-Polynomial::clean()
+Polynomial::clean ()
{
/*
We only do relative comparisons. Absolute comparisons break down in
degenerate cases. */
while (degree () > 0 &&
- (fabs (coefs_.top ()) < FUDGE * fabs (coefs_.top (1))
+ (fabs (coefs_.top ()) < FUDGE * fabs (coefs_.top (1))
|| !coefs_.top ()))
coefs_.pop ();
}
Polynomial
-Polynomial::add(const Polynomial & p1, const Polynomial & p2)
+Polynomial::add (const Polynomial & p1, const Polynomial & p2)
{
Polynomial dest;
int tempord = p2.degree () >? p1.degree ();
}
void
-Polynomial::scalarmultiply(Real fact)
+Polynomial::scalarmultiply (Real fact)
{
for (int i = 0; i <= degree (); i++)
coefs_[i] *= fact;
}
Polynomial
-Polynomial::subtract(const Polynomial & p1, const Polynomial & p2)
+Polynomial::subtract (const Polynomial & p1, const Polynomial & p2)
{
Polynomial dest;
int tempord = p2.degree () >? p1.degree ();
}
void
-Polynomial::set_negate(const Polynomial & src)
+Polynomial::set_negate (const Polynomial & src)
{
- for (int i = 0; i <= src.degree(); i++)
+ for (int i = 0; i <= src.degree (); i++)
coefs_[i] = -src.coefs_[i];
}
/// mod of #u/v#
int
-Polynomial::set_mod(const Polynomial &u, const Polynomial &v)
+Polynomial::set_mod (const Polynomial &u, const Polynomial &v)
{
- (*this) = u;
+ (*this) = u;
- if (v.lc() < 0.0) {
+ if (v.lc () < 0.0) {
for (int k = u.degree () - v.degree () - 1; k >= 0; k -= 2)
coefs_[k] = -coefs_[k];
while (k >= 0 && coefs_[k] == 0.0)
k--;
- coefs_.set_size(1+ ( (k < 0) ? 0 : k));
- return degree();
+ coefs_.set_size (1+ ((k < 0) ? 0 : k));
+ return degree ();
}
void
-Polynomial::check_sol(Real x) const
+Polynomial::check_sol (Real x) const
{
- Real f=eval(x);
- Polynomial p(*this);
- p.differentiate();
- Real d = p.eval(x);
+ Real f=eval (x);
+ Polynomial p (*this);
+ p.differentiate ();
+ Real d = p.eval (x);
- if( abs(f) > abs(d) * FUDGE)
+ if ( abs (f) > abs (d) * FUDGE)
;
/*
- warning("x=%f is not a root of polynomial\n"
- "f(x)=%f, f'(x)=%f \n", x, f, d); */
+ warning ("x=%f is not a root of polynomial\n"
+ "f (x)=%f, f' (x)=%f \n", x, f, d); */
}
void
-Polynomial::check_sols(Array<Real> roots) const
+Polynomial::check_sols (Array<Real> roots) const
{
for (int i=0; i< roots.size (); i++)
- check_sol(roots[i]);
+ check_sol (roots[i]);
}
Polynomial::Polynomial (Real a, Real b)
}
/* cubic root. */
-inline Real cubic_root(Real x)
+inline Real cubic_root (Real x)
{
if (x > 0.0)
- return pow(x, 1.0/3.0) ;
+ return pow (x, 1.0/3.0) ;
else if (x < 0.0)
- return -pow(-x, 1.0/3.0);
+ return -pow (-x, 1.0/3.0);
else
return 0.0;
}
}
Array<Real>
-Polynomial::solve_cubic()const
+Polynomial::solve_cubic ()const
{
Array<Real> sol;
Real cb_p = p * p * p;
Real D = q * q + cb_p;
- if (iszero(D)) {
- if (iszero(q)) { /* one triple solution */
+ if (iszero (D)) {
+ if (iszero (q)) { /* one triple solution */
sol.push (0);
sol.push (0);
sol.push (0);
} else { /* one single and one double solution */
- Real u = cubic_root(-q);
+ Real u = cubic_root (-q);
sol.push (2 * u);
sol.push (-u);
}
} else if (D < 0) { /* Casus irreducibilis: three real solutions */
- Real phi = 1.0 / 3 * acos(-q / sqrt(-cb_p));
- Real t = 2 * sqrt(-p);
+ Real phi = 1.0 / 3 * acos (-q / sqrt (-cb_p));
+ Real t = 2 * sqrt (-p);
- sol.push (t * cos(phi));
- sol.push (-t * cos(phi + M_PI / 3));
- sol.push ( -t * cos(phi - M_PI / 3));
+ sol.push (t * cos (phi));
+ sol.push (-t * cos (phi + M_PI / 3));
+ sol.push ( -t * cos (phi - M_PI / 3));
} else { /* one real solution */
- Real sqrt_D = sqrt(D);
- Real u = cubic_root(sqrt_D - q);
- Real v = -cubic_root(sqrt_D + q);
+ Real sqrt_D = sqrt (D);
+ Real u = cubic_root (sqrt_D - q);
+ Real v = -cubic_root (sqrt_D + q);
sol.push ( u + v);
}
Real
Polynomial::lc () const
{
- return coefs_.top();
+ return coefs_.top ();
}
Real&
all roots of quadratic eqn.
*/
Array<Real>
-Polynomial::solve_quadric()const
+Polynomial::solve_quadric ()const
{
Array<Real> sol;
/* normal form: x^2 + px + q = 0 */
Real D = p * p - q;
if (D>0) {
- D = sqrt(D);
+ D = sqrt (D);
sol.push ( D - p);
sol.push ( -D - p);
/* solve linear equation */
Array<Real>
-Polynomial::solve_linear()const
+Polynomial::solve_linear ()const
{
Array<Real> s;
if (coefs_[1])
void
Polynomial::operator += (Polynomial const &p)
{
- *this = add( *this, p);
+ *this = add ( *this, p);
}
void
Polynomial::operator -= (Polynomial const &p)
{
- *this = subtract(*this, p);
+ *this = subtract (*this, p);
}
Rational
Rational::trunc_rat () const
{
- return Rational(num_ - (num_ % den_), den_);
+ return Rational (num_ - (num_ % den_), den_);
}
Rational::Rational ()
Rational
Rational::operator - () const
{
- Rational r(*this);
+ Rational r (*this);
r.negate ();
return r;
}
else if (r.infty_b ())
return 0;
- return (r - s).sign ();
+ return (r - s).sign ();
}
int
{
int n = sign_ * num_ *r.den_ + r.sign_ * den_ * r.num_;
int d = den_ * r.den_;
- sign_ = ::sign (n) * ::sign(d);
+ sign_ = ::sign (n) * ::sign (d);
num_ = abs (n);
den_ = abs (d);
normalise ();
/*
copied from libg++ 2.8.0
*/
-Rational::Rational(double x)
+Rational::Rational (double x)
{
if (x != 0.0)
{
x *= sign_;
int expt;
- double mantissa = frexp(x, &expt);
+ double mantissa = frexp (x, &expt);
const int FACT = 1 << 20;
const char *
demangle_classname (type_info const &t)
{
- char const *s = t.name();
+ char const *s = t.name ();
while (isdigit (*s))
s++;
return s;
data_p_[len_i_] = 0;
ret = fread (data_p_, sizeof (char), len_i_, f);
- if (ret!=len_i_)
+ if (ret!=len_i_)
warning (_f ("Huh? Got %d, expected %d characters", ret, len_i_));
fclose (f);
String
Source_file::file_line_column_str (char const *context_ch_C) const
{
- if (!ch_C ())
- return "(" + _ ("position unknown") + ")";
+ if (!ch_C ())
+ return " (" + _ ("position unknown") + ")";
else
return name_str () + ":" + to_str (line_i (context_ch_C))
+ ":" + to_str (char_i (context_ch_C));
Source_file::error_str (char const* pos_ch_C) const
{
if (!in_b (pos_ch_C))
- return "(" + _ ("position unknown") + ")";
+ return " (" + _ ("position unknown") + ")";
int ch_i = char_i (pos_ch_C);
String line = line_str (pos_ch_C);
String_convert::bin2hex_str (String bin_str)
{
String str;
- Byte const* byte_C = bin_str.byte_C();
- for (int i = 0; i < bin_str.length_i(); i++)
+ Byte const* byte_C = bin_str.byte_C ();
+ for (int i = 0; i < bin_str.length_i (); i++)
{
str += to_str ((char)nibble2hex_byte (*byte_C >> 4));
str += to_str ((char)nibble2hex_byte (*byte_C++));
unsigned
String_convert::bin2_u (String bin_str)
{
- assert (bin_str.length_i() <= (int)sizeof(unsigned));
+ assert (bin_str.length_i () <= (int)sizeof (unsigned));
unsigned result_u = 0;
- for (int i = 0; i < bin_str.length_i(); i++)
+ for (int i = 0; i < bin_str.length_i (); i++)
{
result_u <<= 8;
result_u += (Byte)bin_str[ i ];
int
String_convert::dec2_i (String dec_str)
{
- if (!dec_str.length_i())
+ if (!dec_str.length_i ())
return 0;
long l = 0;
- int conv = sscanf (dec_str.ch_C(), "%ld", &l);
+ int conv = sscanf (dec_str.ch_C (), "%ld", &l);
assert (conv);
return (int)l;
{
char buffer[STRING_BUFFER_LEN];
snprintf (buffer, STRING_BUFFER_LEN,
- (fmt ? fmt : "%Ld"), i64); // assume radix 10
+ (fmt ? fmt : "%Ld"), i64); // assume radix 10
return String (buffer);
}
double
String_convert::dec2_f (String dec_str)
{
- if (!dec_str.length_i())
+ if (!dec_str.length_i ())
return 0;
double d = 0;
- int conv = sscanf (dec_str.ch_C(), "%lf", &d);
+ int conv = sscanf (dec_str.ch_C (), "%lf", &d);
assert (conv);
return d;
}
int
String_convert::hex2bin_i (String hex_str, String& bin_str_r)
{
- if (hex_str.length_i() % 2)
+ if (hex_str.length_i () % 2)
hex_str = "0" + hex_str;
bin_str_r = "";
- Byte const* byte_C= hex_str.byte_C();
+ Byte const* byte_C= hex_str.byte_C ();
int i = 0;
- while (i < hex_str.length_i())
+ while (i < hex_str.length_i ())
{
int high_i = hex2nibble_i (*byte_C++);
int low_i = hex2nibble_i (*byte_C++);
if (high_i < 0 || low_i < 0)
return 1; // illegal char
- bin_str_r += to_str ((char)(high_i << 4 | low_i), 1 );
+ bin_str_r += to_str ((char) (high_i << 4 | low_i), 1 );
i += 2;
}
return 0;
return -1;
}
-// stupido. Should use int_str()
+// stupido. Should use int_str ()
String
String_convert::i2dec_str (int i, int length_i, char ch)
{
String dec_str = to_str (i);
// ugh
- return to_str (fill_ch, length_i - dec_str.length_i()) + dec_str;
+ return to_str (fill_ch, length_i - dec_str.length_i ()) + dec_str;
}
-// stupido. Should use int_str()
+// stupido. Should use int_str ()
String
String_convert::u2hex_str (unsigned u, int length_i, char fill_ch)
{
#if 1 // both go...
while (u)
{
- str = to_str ((char)((u % 16)["0123456789abcdef"] ) ) + str;
+ str = to_str ((char) ((u % 16)["0123456789abcdef"] ) ) + str;
u /= 16;
}
#else
str += int_str (u, "%x"); // hmm. %lx vs. %x -> portability?
#endif
- str = to_str (fill_ch, length_i - str.length_i()) + str;
- while ((str.length_i() > length_i) && (str[ 0 ] == 'f' ) )
+ str = to_str (fill_ch, length_i - str.length_i ()) + str;
+ while ((str.length_i () > length_i) && (str[ 0 ] == 'f' ) )
str = str.cut_str (2, INT_MAX);
return str;
{
char buffer[STRING_BUFFER_LEN];
snprintf (buffer, STRING_BUFFER_LEN,
- (fmt ? fmt : "%d"), i); // assume radix 10
+ (fmt ? fmt : "%d"), i); // assume radix 10
return String (buffer);
}
string.cc - implement String
- (c) 1997--2000 Han-Wen Nienhuys & Jan Nieuwenhuizen
+ (c) 1997--2000 Han-Wen Nienhuys & Jan Nieuwenhuizen
*/
return -1;
char const* me = strh_.ch_C ();
- char const* p = (char const*)memrchr ( (Byte*)me, length_i (), c);
+ char const* p = (char const*)memrchr ((Byte*)me, length_i (), c);
if (p)
return p - me;
return -1;
{
char const* me = strh_.ch_C ();
- char const* p = (char const *)
+ char const* p = (char const *)
memmem (me, length_i (), searchfor.ch_C (), searchfor.length_i ());
if (p)
if (!length_i () || (index_i < 0) || (index_i >= length_i () ) || (n < 1 ) )
return String ();
- if ( (n > length_i ()) || (index_i + n > length_i () ) )
+ if ((n > length_i ()) || (index_i + n > length_i () ) )
n = length_i () - index_i;
return String (byte_C () + index_i, n);
bool
Text_db::eof_b ()
{
- Data_file::gobble_leading_white();
- return Data_file::eof_b();
+ Data_file::gobble_leading_white ();
+ return Data_file::eof_b ();
}
void
-Text_db::gobble_leading_white()
+Text_db::gobble_leading_white ()
{
while (1)
{
- Data_file::gobble_leading_white();
+ Data_file::gobble_leading_white ();
if (eof_b ())
return ;
char c;
- if ((c = data_get()) !='\n')
+ if ((c = data_get ()) !='\n')
{
data_unget (c);
return ;
Text_record
-Text_db::get_record()
+Text_db::get_record ()
{
while (1)
{
Array<String> fields;
assert (!eof_b ());
- while ((s = get_word()) != "")
+ while ((s = get_word ()) != "")
{
fields.push (s);
- gobble_white();
+ gobble_white ();
}
- if (get_line() != "")
+ if (get_line () != "")
assert (false);
- assert (fields.size());
- return Text_record (fields, get_name(), line ());
+ assert (fields.size ());
+ return Text_record (fields, get_name (), line ());
}
}
Text_stream::Text_stream (String fn)
{
- ios::sync_with_stdio();
+ ios::sync_with_stdio ();
if (fn == "")
{
name = _ ("<stdin>");
void
Text_stream::message (String s)
{
- cerr << '\n'<<get_name() << ": " << line ()<<": "<<s<<endl;
+ cerr << '\n'<<get_name () << ": " << line ()<<": "<<s<<endl;
}
bool
feof (f);
}
-Text_stream::~Text_stream()
+Text_stream::~Text_stream ()
{
- if (!eof_b())
+ if (!eof_b ())
cerr <<__FUNCTION__<< ": closing unended file";
fclose (f);
void
programming_error (String s)
{
- cerr << _("programming error: ") << s << _(" (Continuing; cross thumbs)") << '\n';
+ cerr << _ ("programming error: ") << s << _ (" (Continuing; cross thumbs)") << '\n';
}
{
Adobe_font_metric * fm = new Adobe_font_metric (fi);
fm->checksum_ = checksum;
- return fm->self_scm();
+ return fm->self_scm ();
}
return font_inf_->cmi + code;
}
}
- else if (warn )
+ else if (warn)
{
warning (_f ("can't find character number: %d", a));
}
{
if (warn)
{
- warning (_f ("can't find character called: `%s'", nm.ch_C()));
+ warning (_f ("can't find character called: `%s'", nm.ch_C ()));
}
return 0;
}
{
AFM_CharMetricInfo const
* c = find_ascii_metric (code,false);
- Box b (Interval (0,0),Interval(0,0));
+ Box b (Interval (0,0),Interval (0,0));
if (c)
b = afm_bbox_to_box (c->charBBox);
SCM
read_afm_file (String nm)
{
- FILE *f = fopen (nm.ch_C() , "r");
+ FILE *f = fopen (nm.ch_C () , "r");
char s[2048];
char *check_key = "TfmCheckSum";
fgets (s, sizeof (s), f);
return m;
}
- SCM at = (gh_list (ly_symbol2scm ("char"),
+ SCM at = (gh_list (ly_symbol2scm ("char"),
gh_int2scm (cm->code),
SCM_UNDEFINED));
This callback is set in the children of the align element. It does
not compute anything, but a side effect of a->do_side_processing ()
is that the elements are placed correctly. */
-MAKE_SCHEME_CALLBACK(Align_interface,alignment_callback,2);
+MAKE_SCHEME_CALLBACK (Align_interface,alignment_callback,2);
SCM
Align_interface::alignment_callback (SCM element_smob, SCM axis)
{
Grob * me = unsmob_grob (element_smob);
- Axis ax = (Axis )gh_scm2int (axis);
+ Axis ax = (Axis)gh_scm2int (axis);
Grob * par = me->parent_l (ax);
if (par && !to_boolean (par->get_grob_property ("alignment-done")))
{
return gh_double2scm (0.0);
}
-MAKE_SCHEME_CALLBACK(Align_interface,fixed_distance_alignment_callback,2);
+MAKE_SCHEME_CALLBACK (Align_interface,fixed_distance_alignment_callback,2);
SCM
Align_interface::fixed_distance_alignment_callback (SCM element_smob, SCM axis)
{
Grob * me = unsmob_grob (element_smob);
- Axis ax = (Axis )gh_scm2int (axis);
+ Axis ax = (Axis)gh_scm2int (axis);
Grob * par = me->parent_l (ax);
if (par && !to_boolean (par->get_grob_property ("alignment-done")))
{
SCM d = me->get_grob_property ("stacking-dir");
- Direction stacking_dir = gh_number_p(d) ? to_dir (d) : CENTER;
+ Direction stacking_dir = gh_number_p (d) ? to_dir (d) : CENTER;
if (!stacking_dir)
stacking_dir = DOWN;
}
Link_array<Grob> elems
- = Pointer_group_interface__extract_elements ( me, (Grob*) 0, "elements");
+ = Pointer_group_interface__extract_elements (me, (Grob*) 0, "elements");
Real where_f=0;
- for (int j=0 ; j < elems.size(); j++)
+ for (int j=0 ; j < elems.size (); j++)
{
where_f += stacking_dir * dy;
elems[j]->translate_axis (where_f, a);
SCM d = me->get_grob_property ("stacking-dir");
- Direction stacking_dir = gh_number_p(d) ? to_dir (d) : CENTER;
+ Direction stacking_dir = gh_number_p (d) ? to_dir (d) : CENTER;
if (!stacking_dir)
stacking_dir = DOWN;
Link_array<Grob> elems;
Link_array<Grob> all_grobs
= Pointer_group_interface__extract_elements (me, (Grob*) 0, "elements");
- for (int i=0; i < all_grobs.size(); i++)
+ for (int i=0; i < all_grobs.size (); i++)
{
- Interval y = all_grobs[i]->extent(me, a);
- if (!y.empty_b())
+ Interval y = all_grobs[i]->extent (me, a);
+ if (!y.empty_b ())
{
- Grob *e =dynamic_cast<Grob*>(all_grobs[i]);
+ Grob *e =dynamic_cast<Grob*> (all_grobs[i]);
// todo: fucks up if item both in Halign & Valign.
SCM min_dims = e->remove_grob_property ("minimum-space");
gh_number_p (gh_car (extra_dims))
&& gh_number_p (gh_cdr (extra_dims)))
{
- y[LEFT] += gh_scm2double (gh_car (extra_dims));
+ y[LEFT] += gh_scm2double (gh_car (extra_dims));
y[RIGHT] += gh_scm2double (gh_cdr (extra_dims));
}
String s ("self-alignment-");
- s += (a == X_AXIS) ? "X" : "Y";
+ s += (a == X_AXIS) ? "X" : "Y";
- SCM align (me->get_grob_property (s.ch_C()));
+ SCM align (me->get_grob_property (s.ch_C ()));
Array<Real> translates ;
Interval total;
Real where_f=0;
- for (int j=0 ; j < elems.size(); j++)
+ for (int j=0 ; j < elems.size (); j++)
{
Real dy = 0.0;
dy = - stacking_dir * dims[j][-stacking_dir];
if (j)
{
- dy = (dy >? threshold[SMALLER] )
+ dy = (dy >? threshold[SMALLER])
<? threshold[BIGGER];
}
where_f += stacking_dir * dy;
- total.unite ( dims[j] + where_f);
+ total.unite (dims[j] + where_f);
translates.push (where_f);
}
also move the grobs that were empty, to maintain spatial order.
*/
Array<Real> all_translates;
- if (translates.size ())
+ if (translates.size ())
{
int i =0;
int j =0;
j++;
}
- if (isdir_b (align))
+ if (isdir_b (align))
{
center_offset = total.linear_combination (gh_scm2double (align));
}
void
Align_interface::set_axis (Grob*me,Axis a)
{
- Axis_group_interface::set_axes (me, a,a );
+ Axis_group_interface::set_axes (me, a,a);
}
bool
virtual void finalize ();
virtual void acknowledge_grob (Grob_info);
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Align_note_column_engraver ();
};
-Align_note_column_engraver::Align_note_column_engraver()
+Align_note_column_engraver::Align_note_column_engraver ()
{
align_item_p_ =0;
now_column_l_ =0;
void
Align_note_column_engraver::acknowledge_grob (Grob_info inf)
{
- if (Note_column::has_interface(inf.elem_l_))
+ if (Note_column::has_interface (inf.elem_l_))
{
now_column_l_ =inf.elem_l_;
}
use that to space grace notes.
*/
SCM grsp = get_property ("graceAccidentalSpace") ;
- if (gh_number_p(grsp))
+ if (gh_number_p (grsp))
{
/*
ugh.
*/
- Real extra_space = gh_scm2double(grsp);
+ Real extra_space = gh_scm2double (grsp);
SCM e = gh_cons (gh_double2scm (-extra_space),
gh_double2scm (0.0));
now_column_l_->set_grob_property ("extra-space", e);
accidental_l_ =0;
}
-ADD_THIS_TRANSLATOR(Align_note_column_engraver);
+ADD_THIS_TRANSLATOR (Align_note_column_engraver);
SCM val;
- if (!afm_p_dict_->try_retrieve (sname, &val))
+ if (!afm_p_dict_->try_retrieve (sname, &val))
{
String path;
- if (path.empty_b())
+ if (path.empty_b ())
path = search_path_.find (name + ".afm");
if (path.empty_b ())
{
- char * p = ly_find_afm (name.ch_C());
+ char * p = ly_find_afm (name.ch_C ());
if (p)
path = p;
}
- if (path.empty_b())
+ if (path.empty_b ())
return 0;
if (verbose_global_b)
Adobe_font_metric *afm
- = dynamic_cast<Adobe_font_metric*> (unsmob_metrics (val) );
+ = dynamic_cast<Adobe_font_metric*> (unsmob_metrics (val));
Tex_font_metric * tfm = find_tfm (name);
if (tfm->info_.checksum != afm->checksum_)
{
String s = _f ("checksum mismatch for font file: `%s'",
path.ch_C ());
- s += " " + _f ("does not match: `%s'", tfm->path_.ch_C()); // FIXME
+ s += " " + _f ("does not match: `%s'", tfm->path_.ch_C ()); // FIXME
s += "\n";
s += " TFM: " + to_str ((int) tfm->info_.checksum);
s += " AFM: " + to_str ((int) afm->checksum_);
s += "\n";
- s += _(" Rebuild all .afm files, and remove all .pk and .tfm files. Rerun with -V to show font paths.");
+ s += _ (" Rebuild all .afm files, and remove all .pk and .tfm files. Rerun with -V to show font paths.");
error (s);
}
{
String path;
- if (path.empty_b())
+ if (path.empty_b ())
{
- char * p = ly_find_tfm (name.ch_C());
+ char * p = ly_find_tfm (name.ch_C ());
if (p)
path = p;
}
- if (path.empty_b())
+ if (path.empty_b ())
path = search_path_.find (name + ".tfm");
- if (path.empty_b())
+ if (path.empty_b ())
return 0;
vertical alignment if it is cross-staff.
This callback also adds padding.
*/
-MAKE_SCHEME_CALLBACK(Arpeggio, width_callback,2);
+MAKE_SCHEME_CALLBACK (Arpeggio, width_callback,2);
SCM
Arpeggio::width_callback (SCM smob, SCM axis)
{
}
Moment
-Audio_column::at_mom() const
+Audio_column::at_mom () const
{
return at_mom_;
}
}
-Audio_element_info::Audio_element_info()
+Audio_element_info::Audio_element_info ()
{
elem_l_ = 0;
req_l_ = 0;
grace_b_ = false;
}
-Audio_element::~Audio_element()
+Audio_element::~Audio_element ()
{
}
{
Midi_track midi_track;
midi_track.number_i_ = track_i;
- for (Midi_walker i (this, &midi_track); i.ok(); i++)
- i.process();
+ for (Midi_walker i (this, &midi_track); i.ok (); i++)
+ i.process ();
midi_stream_r << midi_track;
}
else
function = gh_list (ly_symbol2scm ("end"), SCM_UNDEFINED);
- Moment one_beat = *unsmob_moment( get_property ("beatLength"));
- int num = *unsmob_moment (get_property("measureLength")) / one_beat;
+ Moment one_beat = *unsmob_moment (get_property ("beatLength"));
+ int num = *unsmob_moment (get_property ("measureLength")) / one_beat;
int den = one_beat.den_i ();
SCM time = gh_list (gh_int2scm (num), gh_int2scm (den), SCM_UNDEFINED);
/* first guess */
/* begin beam at any position
- (and fallback for end) */
+ (and fallback for end) */
Moment moment (0);
/* end beam at end of beat */
scm_unprotect_object (beam_p->self_scm ());
return 0;
}
- Beam::add_stem (beam_p,(*stem_l_arr_p_)[i]);
+ Beam::add_stem (beam_p, (*stem_l_arr_p_)[i]);
}
announce_grob (beam_p, 0);
{
Moment now = now_mom ();
if ((extend_mom_ < now)
- || ((extend_mom_ == now) && (last_add_mom_ != now )))
+ || ((extend_mom_ == now) && (last_add_mom_ != now)))
{
end_beam ();
}
If \translator Staff = bass, then look for Staff = *
*/
- while (current && current->type_str_ != to_type)
+ while (current && current->type_str_ != to_type)
{
last = current;
current = current->daddy_trans_l_;
will confuse the autochanger, since it will not notice that the
music for OTHERSTAFF is not his.
- PRECONDITION: this->ok() holds.
+ PRECONDITION: this->ok () holds.
*/
Array<Pitch>
Auto_change_iterator::pending_pitch (Moment m) const
break;
iter->skip (m);
- if (!iter->ok())
+ if (!iter->ok ())
break;
m = iter->pending_moment ();
{
/*
first we get the pitches, then we do the real work.
- Music_wrapper_iterator::process() might process (and throw away)
+ Music_wrapper_iterator::process () might process (and throw away)
pitches we need. */
Array<Pitch> ps = pending_pitch (m);
if (ps.size ())
{
Pitch p = ps[0];
- Direction s = Direction (sign(p.steps ()));
+ Direction s = Direction (sign (p.steps ()));
if (s != where_dir_)
{
where_dir_ = s;
- String to_id = (s >= 0) ? "up" : "down";
+ String to_id = (s >= 0) ? "up" : "down";
String wh = ly_scm2string (music_l_->get_mus_property ("what"));
change_to (child_iter_p_, wh, to_id);
}
}
}
-Auto_change_iterator::Auto_change_iterator( )
+Auto_change_iterator::Auto_change_iterator ()
{
where_dir_ = CENTER;
}
-IMPLEMENT_CTOR_CALLBACK(Auto_change_iterator);
+IMPLEMENT_CTOR_CALLBACK (Auto_change_iterator);
protected:
Spanner *staffline_p_;
Link_array<Grob> elts_;
- virtual void initialize();
- virtual void finalize();
+ virtual void initialize ();
+ virtual void finalize ();
virtual void acknowledge_grob (Grob_info);
virtual void create_grobs ();
virtual Spanner* get_spanner_p () const;
virtual void add_element (Grob*) ;
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Axis_group_engraver ();
};
-ADD_THIS_TRANSLATOR(Axis_group_engraver);
+ADD_THIS_TRANSLATOR (Axis_group_engraver);
Axis_group_engraver::Axis_group_engraver ()
{
Grob * it = unsmob_grob (get_property ("currentCommandColumn"));
- staffline_p_->set_bound(LEFT,it);
+ staffline_p_->set_bound (LEFT,it);
announce_grob (staffline_p_, 0);
}
Axis_group_engraver::finalize ()
{
String type = daddy_grav_l ()->type_str_ ;
- SCM dims = get_property ((type + "VerticalExtent").ch_C());
+ SCM dims = get_property ((type + "VerticalExtent").ch_C ());
if (gh_pair_p (dims) && gh_number_p (gh_car (dims))
&& gh_number_p (gh_cdr (dims)))
staffline_p_->set_grob_property ("extent-Y", dims);
}
- dims = get_property ((type + "MinimumVerticalExtent").ch_C());
+ dims = get_property ((type + "MinimumVerticalExtent").ch_C ());
if (gh_pair_p (dims) && gh_number_p (gh_car (dims))
&& gh_number_p (gh_cdr (dims)))
staffline_p_->set_grob_property ("minimum-extent-Y", dims);
- dims = get_property ((type + "ExtraVerticalExtent").ch_C());
+ dims = get_property ((type + "ExtraVerticalExtent").ch_C ());
if (gh_pair_p (dims) && gh_number_p (gh_car (dims))
&& gh_number_p (gh_cdr (dims)))
staffline_p_->set_grob_property ("extra-extent-Y", dims);
Grob * it = unsmob_grob (get_property ("currentCommandColumn"));
- staffline_p_->set_bound(RIGHT,it);
+ staffline_p_->set_bound (RIGHT,it);
typeset_grob (staffline_p_);
staffline_p_ = 0;
virtual void acknowledge_grob (Grob_info);
virtual void add_element (Grob *e);
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
};
void
Hara_kiri_group_spanner::add_interesting_item (staffline_p_, i.elem_l_);
}
}
-ADD_THIS_TRANSLATOR(Hara_kiri_engraver);
+ADD_THIS_TRANSLATOR (Hara_kiri_engraver);
}
bool
-Axis_group_interface::axis_b (Grob*me,Axis a )
+Axis_group_interface::axis_b (Grob*me,Axis a)
{
/*
urg. FIXME, check for Hara_kiri_group_spanner shouldn't be necessary?
*/
return me->has_extent_callback_b (group_extent_callback_proc, a) ||
- (me->has_extent_callback_b (Hara_kiri_group_spanner::y_extent_proc, a));
+ (me->has_extent_callback_b (Hara_kiri_group_spanner::y_extent_proc, a));
}
Interval
return r;
}
-MAKE_SCHEME_CALLBACK(Axis_group_interface,group_extent_callback,2);
+MAKE_SCHEME_CALLBACK (Axis_group_interface,group_extent_callback,2);
SCM
Axis_group_interface::group_extent_callback (SCM element_smob, SCM scm_axis)
{
Grob *me = unsmob_grob (element_smob);
Axis a = (Axis) gh_scm2int (scm_axis);
- Grob * common =(Grob*) me;
+ Grob * common = (Grob*) me;
for (SCM s = me->get_grob_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
{
class Bar_engraver : public Engraver
{
public:
- Bar_engraver();
- VIRTUAL_COPY_CONS(Translator);
+ Bar_engraver ();
+ VIRTUAL_COPY_CONS (Translator);
void request_bar (String type_str);
protected:
virtual void finalize ();
- virtual void stop_translation_timestep();
+ virtual void stop_translation_timestep ();
virtual void create_grobs ();
private:
Item * bar_p_;
};
-Bar_engraver::Bar_engraver()
+Bar_engraver::Bar_engraver ()
{
bar_p_ =0;
}
lines may only be broken if there is a barline in all staffs
*/
void
-Bar_engraver::stop_translation_timestep()
+Bar_engraver::stop_translation_timestep ()
{
if (!bar_p_)
{
typeset_bar ();
}
-ADD_THIS_TRANSLATOR(Bar_engraver);
+ADD_THIS_TRANSLATOR (Bar_engraver);
virtual void acknowledge_grob (Grob_info);
virtual void initialize ();
virtual void create_grobs ();
- void create_items();
+ void create_items ();
public:
- VIRTUAL_COPY_CONS(Translator);
- Bar_number_engraver();
+ VIRTUAL_COPY_CONS (Translator);
+ Bar_number_engraver ();
};
void
Bar_number_engraver::create_grobs ()
{
- // todo include (&&!time->cadenza_b_ )
- SCM bn = get_property("currentBarNumber");
+ // todo include (&&!time->cadenza_b_)
+ SCM bn = get_property ("currentBarNumber");
SCM smp = get_property ("measurePosition");
- Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
+ Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
if (gh_number_p (bn) &&
!mp && now_mom () > Moment (0))
// guh.
text_p_->set_grob_property ("text",
- ly_str02scm (to_str (gh_scm2int (bn)).ch_C()));
+ ly_str02scm (to_str (gh_scm2int (bn)).ch_C ()));
}
}
-ADD_THIS_TRANSLATOR(Bar_number_engraver);
+ADD_THIS_TRANSLATOR (Bar_number_engraver);
Bar_number_engraver::Bar_number_engraver ()
{
SCM b = get_property ("BarNumber");
text_p_ = new Item (b);
- Side_position_interface::set_axis(text_p_,Y_AXIS);
+ Side_position_interface::set_axis (text_p_,Y_AXIS);
announce_grob (text_p_, 0);
}
#include "item.hh"
#include "staff-symbol-referencer.hh"
-MAKE_SCHEME_CALLBACK(Bar,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Bar,brew_molecule,1);
SCM
Bar::brew_molecule (SCM smob)
Molecule thin = simple_barline (me, hair, h);
Molecule thick = simple_barline (me, fatline, h);
- Molecule colon = Font_interface::get_default_font (me)->find_by_name ("dots-repeatcolon");
+ Molecule colon = Font_interface::get_default_font (me)->find_by_name (
+ Staff_symbol_referencer::line_count (me) & 1 == 1 ?
+ "dots-repeatcolon" : "dots-evenrepeatcolon"
+ );
Molecule m;
if (str == "")
{
- return Lookup::blank (Box (Interval(0, 0), Interval (-h/2, h/2)));
+ return Lookup::blank (Box (Interval (0, 0), Interval (-h/2, h/2)));
}
else if (str == "|")
{
Molecule
Bar::simple_barline (Grob*,Real w, Real h)
{
- return Lookup::filledbox (Box (Interval(0,w), Interval(-h/2, h/2)));
+ return Lookup::filledbox (Box (Interval (0,w), Interval (-h/2, h/2)));
}
-MAKE_SCHEME_CALLBACK(Bar,before_line_breaking ,1);
+MAKE_SCHEME_CALLBACK (Bar,before_line_breaking ,1);
SCM
-Bar::before_line_breaking (SCM smob)
+Bar::before_line_breaking (SCM smob)
{
Grob*me=unsmob_grob (smob);
Item * item = dynamic_cast<Item*> (me);
// leave y_extent for spanbar?
}
- if (! gh_equal_p (g, orig))
+ if (! gh_equal_p (g, orig))
me->set_grob_property ("glyph", g);
}
-MAKE_SCHEME_CALLBACK(Bar,get_staff_bar_size,1);
+MAKE_SCHEME_CALLBACK (Bar,get_staff_bar_size,1);
SCM
Bar::get_staff_bar_size (SCM smob)
{
Real ss = Staff_symbol_referencer::staff_space (me);
SCM size = me->get_grob_property ("bar-size");
if (gh_number_p (size))
- return gh_double2scm (gh_scm2double(size)*ss);
+ return gh_double2scm (gh_scm2double (size)*ss);
else if (Staff_symbol_referencer::staff_symbol_l (me))
{
/*
bool
Beam_engraver::try_music (Music *m)
{
- if (Span_req * c = dynamic_cast<Span_req*>(m))
+ if (Span_req * c = dynamic_cast<Span_req*> (m))
{
if (scm_equal_p (c->get_mus_property ("span-type"),
ly_str02scm ("abort")) == SCM_BOOL_T)
if (d == STOP && !beam_p_)
{
- m->origin ()->warning (_ ("can't find start of beam"));
+ m->origin ()->warning (_ ("can't find start of beam"));
return false;
}
- if(d == STOP)
+ if (d == STOP)
{
SCM m = get_property ("automaticMelismata");
- SCM b = get_property("noAutoBeaming");
- if (to_boolean (m) && to_boolean(b))
+ SCM b = get_property ("noAutoBeaming");
+ if (to_boolean (m) && to_boolean (b))
{
set_melisma (false);
}
if (reqs_drul_[STOP])
{
if (!beam_p_)
- reqs_drul_[STOP]->origin ()->warning (_("can't find start of beam"));
+ reqs_drul_[STOP]->origin ()->warning (_ ("can't find start of beam"));
prev_start_req_ =0;
finished_beam_p_ = beam_p_;
finished_beam_info_p_ = beam_info_p_;
prev_start_req_ = reqs_drul_[START];
beam_p_ = new Spanner (get_property ("Beam"));
SCM smp = get_property ("measurePosition");
- Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
+ Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
beam_start_location_ = mp;
- beam_start_mom_ = now_mom();
+ beam_start_mom_ = now_mom ();
beam_info_p_ = new Beaming_info_list;
Beam_engraver::start_translation_timestep ()
{
reqs_drul_ [START] =0;
- if(beam_p_) {
+ if (beam_p_) {
SCM m = get_property ("automaticMelismata");
- SCM b = get_property("noAutoBeaming");
- if (to_boolean (m) && to_boolean(b)) {
+ SCM b = get_property ("noAutoBeaming");
+ if (to_boolean (m) && to_boolean (b)) {
set_melisma (true);
}
}
gh_int2scm (durlog));
Moment stem_location = now_mom () - beam_start_mom_ + beam_start_location_;
beam_info_p_->add_stem (stem_location,
- (durlog- 2) >? 1);
+ (durlog- 2) >? 1);
Beam::add_stem (beam_p_, stem_l);
}
}
-ADD_THIS_TRANSLATOR(Beam_engraver);
+ADD_THIS_TRANSLATOR (Beam_engraver);
void
Beam::add_stem (Grob*me, Grob*s)
{
- Pointer_group_interface:: add_element(me, "stems", s);
+ Pointer_group_interface:: add_element (me, "stems", s);
s->add_dependency (me);
[Alternatively, stems could set its own directions, according to
their beam, during 'final-pre-processing'.]
*/
-MAKE_SCHEME_CALLBACK(Beam,before_line_breaking,1);
+MAKE_SCHEME_CALLBACK (Beam,before_line_breaking,1);
SCM
Beam::before_line_breaking (SCM smob)
{
count[d] ++;
}
- } while (flip(&d) != DOWN);
+ } while (flip (&d) != DOWN);
SCM func = me->get_grob_property ("dir-function");
SCM s = gh_call2 (func,
Beam::set_stem_directions (Grob*me)
{
Link_array<Item> stems
- =Pointer_group_interface__extract_elements (me, (Item*) 0, "stems");
+ =Pointer_group_interface__extract_elements (me, (Item*) 0, "stems");
Direction d = Directional_element_interface::get (me);
for (int i=0; i <stems.size (); i++)
grob-properties y, dy.
User may set grob-properties: y-position-hs and height-hs
- (to be fixed) that override the calculated y and dy.
+ (to be fixed) that override the calculated y and dy.
Because y and dy cannot be calculated and quanted separately, we
always calculate both, then check for user override.
me->set_grob_property ("dy", gh_double2scm (0));
/* Hmm, callbacks should be called by, a eh, callback mechanism
- somewhere(?), I guess, not by looping here. */
+ somewhere (?), I guess, not by looping here. */
SCM list = me->get_grob_property ("y-dy-callbacks");
for (SCM i = list; gh_pair_p (i); i = gh_cdr (i))
Real dx = last_visible_stem (me)->relative_coordinate (0, X_AXIS) - first_visible_stem (me)->relative_coordinate (0, X_AXIS);
Real dydx = dy && dx ? dy/dx : 0;
- if (((y - first_ideal > lengthened) && (dydx > steep))
+ if (( (y - first_ideal > lengthened) && (dydx > steep))
|| ((y + dy - last_ideal > lengthened) && (dydx < -steep)))
{
Real adjusted_y = y + dy / 2;
Link_array<Item> stems=
Pointer_group_interface__extract_elements (me, (Item*)0, "stems");
- for (int i=0; i < stems.size(); i++)
+ for (int i=0; i < stems.size (); i++)
{
Item* s = stems[i];
if (Stem::invisible_b (s))
Real q = up_y - iv[SMALLER] <= iv[BIGGER] - up_y
? iv[SMALLER] : iv[BIGGER];
if (quant_dir)
- q = iv[(Direction)quant_dir];
+ q = iv[ (Direction)quant_dir];
return q * Directional_element_interface::get (me);
}
Pointer_group_interface__extract_elements (me, (Grob*)0, "stems");
Direction d = LEFT;
- for (int i=0; i < stems.size(); i++)
+ for (int i=0; i < stems.size (); i++)
{
do
{
Beam::stem_beams (Grob*me,Item *here, Item *next, Item *prev)
{
// ugh -> use commonx
- if ((next && !(next->relative_coordinate (0, X_AXIS) > here->relative_coordinate (0, X_AXIS))) ||
- (prev && !(prev->relative_coordinate (0, X_AXIS) < here->relative_coordinate (0, X_AXIS))))
+ if ((next && ! (next->relative_coordinate (0, X_AXIS) > here->relative_coordinate (0, X_AXIS))) ||
+ (prev && ! (prev->relative_coordinate (0, X_AXIS) < here->relative_coordinate (0, X_AXIS))))
programming_error ("Beams are not left-to-right");
Real staffline_f = me->paper_l ()->get_var ("stafflinethickness");
Real w = next->relative_coordinate (0, X_AXIS) - here->relative_coordinate (0, X_AXIS);
Molecule a = Lookup::beam (dydx, w + stemdx, thick);
- a.translate_axis( - stemdx/2, X_AXIS);
+ a.translate_axis (- stemdx/2, X_AXIS);
int j = 0;
Real gap_f = 0;
SCM gap = me->get_grob_property ("gap");
if (gh_number_p (gap))
{
- int gap_i = gh_scm2int ( (gap));
+ int gap_i = gh_scm2int ((gap));
int nogap = rwholebeams - gap_i;
for (; j < nogap; j++)
return leftbeams;
}
-MAKE_SCHEME_CALLBACK(Beam,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Beam,brew_molecule,1);
SCM
Beam::brew_molecule (SCM smob)
{
else
{
x0 = stems[0]->relative_coordinate (0, X_AXIS);
- dx = stems.top()->relative_coordinate (0, X_AXIS) - x0;
+ dx = stems.top ()->relative_coordinate (0, X_AXIS) - x0;
}
Real y = gh_scm2double (me->get_grob_property ("y"));
- for (int j=0; j <stems.size (); j++)
+ for (int j=0; j <stems.size (); j++)
{
Item *i = stems[j];
Item * prev = (j > 0)? stems[j-1] : 0;
- Item * next = (j < stems.size()-1) ? stems[j+1] :0;
+ Item * next = (j < stems.size ()-1) ? stems[j+1] :0;
Molecule sb = stem_beams (me, i, next, prev);
Real x = i->relative_coordinate (0, X_AXIS)-x0;
Beam::forced_stem_count (Grob*me)
{
Link_array<Item>stems =
- Pointer_group_interface__extract_elements ( me, (Item*) 0, "stems");
+ Pointer_group_interface__extract_elements (me, (Item*) 0, "stems");
int f = 0;
for (int i=0; i < stems.size (); i++)
{
if (Stem::invisible_b (s))
continue;
- if (((int)Stem::chord_start_f (s))
- && (Stem::get_direction (s ) != Stem::get_default_dir (s )))
+ if (( (int)Stem::chord_start_f (s))
+ && (Stem::get_direction (s) != Stem::get_default_dir (s)))
f++;
}
return f;
}
Item*
-Beam::first_visible_stem(Grob*me)
+Beam::first_visible_stem (Grob*me)
{
Link_array<Item>stems =
- Pointer_group_interface__extract_elements ( me, (Item*) 0, "stems");
+ Pointer_group_interface__extract_elements (me, (Item*) 0, "stems");
for (int i = 0; i < stems.size (); i++)
{
}
Item*
-Beam::last_visible_stem(Grob*me)
+Beam::last_visible_stem (Grob*me)
{
Link_array<Item>stems =
- Pointer_group_interface__extract_elements ( me, (Item*) 0, "stems");
+ Pointer_group_interface__extract_elements (me, (Item*) 0, "stems");
for (int i = stems.size (); i--;)
{
if (!Stem::invisible_b (stems[i]))
rest -> stem -> beam -> interpolate_y_position ()
*/
-MAKE_SCHEME_CALLBACK(Beam,rest_collision_callback,2);
+MAKE_SCHEME_CALLBACK (Beam,rest_collision_callback,2);
SCM
Beam::rest_collision_callback (SCM element_smob, SCM axis)
{
beam_y = gh_scm2double (s);
// ugh -> use commonx
- Real x0 = first_visible_stem(beam)->relative_coordinate (0, X_AXIS);
- Real dx = last_visible_stem(beam)->relative_coordinate (0, X_AXIS) - x0;
+ Real x0 = first_visible_stem (beam)->relative_coordinate (0, X_AXIS);
+ Real dx = last_visible_stem (beam)->relative_coordinate (0, X_AXIS) - x0;
Real dydx = beam_dy && dx ? beam_dy/dx : 0;
Direction d = Stem::get_direction (stem);
if (discrete_dist < stafflines+1)
discrete_dist = int (ceil (discrete_dist / 2.0)* 2.0);
- return gh_double2scm (-d * discrete_dist);
+ return gh_double2scm (-d * discrete_dist);
}
#include "beaming.hh"
-Beaming_info::Beaming_info( )
+Beaming_info::Beaming_info ()
{
start_mom_ = 0;
beams_i_drul_[LEFT] = 0;
beams_i_drul_[RIGHT] = 0;
}
-Beaming_info::Beaming_info(Moment m, int i)
+Beaming_info::Beaming_info (Moment m, int i)
{
start_mom_ = m;
beams_i_drul_[LEFT] = i;
int minden = infinity_i;
int minidx = -1;
- for (int i=1; i < infos_.size ( ); i++)
+ for (int i=1; i < infos_.size (); i++)
{
if (infos_[i].start_mom_.den_i () < minden)
{
minidx = i;
- minden = infos_[i].start_mom_.den_i ();
+ minden = infos_[i].start_mom_.den_i ();
}
}
void
Beaming_info_list::add_stem (Moment m, int b)
{
- infos_.push (Beaming_info (m, b));
+ infos_.push (Beaming_info (m, b));
}
static Real
F0_1 (Real x)
{
- return 2 / M_PI * atan ( M_PI * x / 2);
+ return 2 / M_PI * atan (M_PI * x / 2);
}
Real
For small w, the height should be proportional to w, for w ->
infinity, the height should rise to a limit asymptotically.
- Hence we take F(x) such that
- F(0) = 0 , F'(0) = 1, and F(infty) = 1
+ Hence we take F (x) such that
+ F (0) = 0 , F' (0) = 1, and F (infty) = 1
and use
- h = h_infinity * F(x * r_0 / h_infinity)
+ h = h_infinity * F (x * r_0 / h_infinity)
Examples:
- * F(x) = 2/pi * atan (pi x/2)
+ * F (x) = 2/pi * atan (pi x/2)
- * F(x) 1/alpha * x^alpha / (1 + x^alpha)
+ * F (x) 1/alpha * x^alpha / (1 + x^alpha)
* (etc.)
`small' slurs to `big' slurs occurs.]
Although this might seem cand_idates to SCM-ify, it is not all clear
- which parameters (ie. h_inf, r_0, F(.)) should be candidates for
+ which parameters (ie. h_inf, r_0, F (.)) should be candidates for
this. At present h_inf and r_0 come from paper settings, but we did
no experiments for determining the best combinations of F, h_inf and
r_0.
{
for (int i = 0; i < arr_p->size (); i++)
{
- (*arr_p)[i][X_AXIS] = x* (*arr_p)[i][X_AXIS];
- (*arr_p)[i][Y_AXIS] = y* (*arr_p)[i][Y_AXIS];
+ (*arr_p)[i][X_AXIS] = x* (*arr_p)[i][X_AXIS];
+ (*arr_p)[i][Y_AXIS] = y* (*arr_p)[i][Y_AXIS];
}
}
{
Offset rot (complex_exp (Offset (0, phi)));
for (int i = 0; i < arr_p->size (); i++)
- (*arr_p)[i] = complex_multiply (rot, (*arr_p)[i]);
+ (*arr_p)[i] = complex_multiply (rot, (*arr_p)[i]);
}
void
translate (Array<Offset>* arr_p, Offset o)
{
for (int i = 0; i < arr_p->size (); i++)
- (*arr_p)[i] += o;
+ (*arr_p)[i] += o;
}
/*
Formula of the bezier 3-spline
- sum_{j=0}^3 (3 over j) z_j (1-t)^(3-j) t^j
+ sum_{j=0}^3 (3 over j) z_j (1-t)^ (3-j) t^j
*/
Real
Bezier::curve_point (Real t)const
{
Real tj = 1;
- Real one_min_tj = (1-t)*(1-t)*(1-t);
+ Real one_min_tj = (1-t)* (1-t)* (1-t);
Offset o;
for (int j=0 ; j < 4; j++)
p += control_[j][a]
* Polynomial::power (j , Polynomial (0,1))*
Polynomial::power (3 - j, Polynomial (1,-1))*
- binomial_coefficient(3, j);
+ binomial_coefficient (3, j);
}
return p;
Array<Real>
Bezier::solve_point (Axis ax, Real coordinate) const
{
- Polynomial p(polynomial (ax));
+ Polynomial p (polynomial (ax));
p.coefs_[0] -= coordinate;
Array<Real> sol (p.solve ());
void
Box::translate (Offset o)
{
- for (Axis i=X_AXIS; i < NO_AXES; incr(i))
+ for (Axis i=X_AXIS; i < NO_AXES; incr (i))
interval_a_[i] += o[i];
}
void
Box::unite (Box b)
{
- for (Axis i=X_AXIS; i < NO_AXES; incr(i))
+ for (Axis i=X_AXIS; i < NO_AXES; incr (i))
interval_a_[i].unite (b[i]);
}
/**
Initialize to empty.
*/
-Box::Box()
+Box::Box ()
{
}
Box::Box (Interval ix, Interval iy)
{
- x() = ix;
- y() = iy;
+ x () = ix;
+ y () = iy;
}
Interval &
/*
sort out how interfacing this should work;
*/
- if (line.empty_b())
+ if (line.empty_b ())
{
sp->line_len_f_ = -1;
}
Break_algorithm::set_pscore (Paper_score*s)
{
pscore_l_ = s;
- linewidth_f_ = s->paper_l_->get_var("linewidth");
+ linewidth_f_ = s->paper_l_->get_var ("linewidth");
}
Array<Column_x_positions>
Protected_scm column_alist_;
protected:
virtual void finalize ();
- virtual void acknowledge_grob(Grob_info i);
+ virtual void acknowledge_grob (Grob_info i);
virtual void stop_translation_timestep ();
void add_column (SCM);
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Break_align_engraver ();
};
-ADD_THIS_TRANSLATOR(Break_align_engraver);
+ADD_THIS_TRANSLATOR (Break_align_engraver);
void
Break_align_engraver::add_column (SCM smob)
SCM order = get_property ("breakAlignOrder");
for (; gh_pair_p (order); order = gh_cdr (order))
{
- SCM p = scm_assoc ( gh_car (order), column_alist_);
+ SCM p = scm_assoc (gh_car (order), column_alist_);
if (gh_pair_p (p))
{
add_column (gh_cdr (p));
if (s != SCM_BOOL_F)
{
- Grob *e = unsmob_grob (gh_cdr(s));
+ Grob *e = unsmob_grob (gh_cdr (s));
group = dynamic_cast<Item*> (e);
}
else
#include "group-interface.hh"
#include "align-interface.hh"
-MAKE_SCHEME_CALLBACK(Break_align_interface,before_line_breaking,1);
+MAKE_SCHEME_CALLBACK (Break_align_interface,before_line_breaking,1);
SCM
Break_align_interface::before_line_breaking (SCM smob)
do_alignment (me);
return SCM_UNSPECIFIED;
}
-MAKE_SCHEME_CALLBACK(Break_align_interface,alignment_callback,2);
+MAKE_SCHEME_CALLBACK (Break_align_interface,alignment_callback,2);
SCM
Break_align_interface::alignment_callback (SCM element_smob, SCM axis)
return gh_double2scm (0);
}
-MAKE_SCHEME_CALLBACK(Break_align_interface,self_align_callback,2);
+MAKE_SCHEME_CALLBACK (Break_align_interface,self_align_callback,2);
SCM
Break_align_interface::self_align_callback (SCM element_smob, SCM axis)
{
assert (a == X_AXIS);
Item* item = dynamic_cast<Item*> (me);
- Direction bsd = item->break_status_dir();
+ Direction bsd = item->break_status_dir ();
if (bsd == LEFT)
{
me->set_grob_property ("self-alignment-X", gh_int2scm (RIGHT));
= Pointer_group_interface__extract_elements (me, (Grob*)0,
"elements");
- for (int i=0; i < all_elems.size(); i++)
+ for (int i=0; i < all_elems.size (); i++)
{
- Interval y = all_elems[i]->extent(all_elems[i], X_AXIS);
- if (!y.empty_b())
+ Interval y = all_elems[i]->extent (all_elems[i], X_AXIS);
+ if (!y.empty_b ())
elems.push (dynamic_cast<Grob*> (all_elems[i]));
}
extra_space = scm_listify (ly_symbol2scm ("minimum-space"), gh_double2scm (0.0), SCM_UNDEFINED);
}
- SCM symbol = gh_car (extra_space);
- Real spc = gh_scm2double (gh_cadr(extra_space));
+ SCM symbol = gh_car (extra_space);
+ Real spc = gh_scm2double (gh_cadr (extra_space));
- dists.push(spc);
+ dists.push (spc);
symbol_list = gh_cons (symbol, symbol_list);
current_origin = next_origin;
}
// skip the first sym.
symbol_list = gh_cdr (scm_reverse (symbol_list));
- for (int i=0; i <elems.size()-1; i++)
+ for (int i=0; i <elems.size ()-1; i++)
{
- elems[i]->set_grob_property (gh_car (symbol_list),
+ elems[i]->set_grob_property (gh_car (symbol_list),
scm_cons (gh_double2scm (0),
gh_double2scm (dists[i+1])));
scm_set_car_x (first_pair, gh_double2scm (-dists[0]));
elems[0]->set_grob_property ("minimum-space", first_pair);
- Direction bsd = item->break_status_dir();
+ Direction bsd = item->break_status_dir ();
if (bsd == LEFT)
{
me->set_grob_property ("self-alignment-X", gh_int2scm (RIGHT));
Real stretch_distance =0.;
- if (gh_car (symbol_list) == ly_symbol2scm ("extra-space"))
+ if (gh_car (symbol_list) == ly_symbol2scm ("extra-space"))
{
spring_len += dists.top ();
stretch_distance = dists.top ();
}
- else if (gh_car (symbol_list) == ly_symbol2scm ("minimum-space"))
+ else if (gh_car (symbol_list) == ly_symbol2scm ("minimum-space"))
{
spring_len = spring_len >? dists.top ();
stretch_distance = spring_len;
This is a side effect, and there is no guarantee that this info is
computed at a "sane" moment.
- (just spent some time tracking a bug that was caused by this info
+ (just spent some time tracking a bug that was caused by this info
being written halfway:
self_alignment_callback (*)
TODO:
. Cancel any beams running through the breathing sign
- ([e8 \breathe f e f] should become [e8] \breathe [f e f])
+ ([e8 \breathe f e f] should become [e8] \breathe [f e f])
. Spacing is not yet completely pretty
*/
class Breathing_sign_engraver : public Engraver {
public:
- Breathing_sign_engraver();
- VIRTUAL_COPY_CONS(Translator);
+ Breathing_sign_engraver ();
+ VIRTUAL_COPY_CONS (Translator);
protected:
virtual bool try_music (Music *req_l);
virtual void create_grobs ();
- virtual void stop_translation_timestep();
- virtual void start_translation_timestep();
+ virtual void stop_translation_timestep ();
+ virtual void start_translation_timestep ();
private:
Breathing_sign_req * breathing_sign_req_l_;
Grob * breathing_sign_p_;
};
-Breathing_sign_engraver::Breathing_sign_engraver()
+Breathing_sign_engraver::Breathing_sign_engraver ()
{
breathing_sign_p_ = 0;
breathing_sign_req_l_ = 0;
void
Breathing_sign_engraver::create_grobs ()
{
- if(breathing_sign_req_l_ && ! breathing_sign_p_)
+ if (breathing_sign_req_l_ && ! breathing_sign_p_)
{
SCM b = get_property ("BreathingSign");
breathing_sign_p_ = new Item (b);
}
void
-Breathing_sign_engraver::stop_translation_timestep()
+Breathing_sign_engraver::stop_translation_timestep ()
{
- if(breathing_sign_p_)
+ if (breathing_sign_p_)
{
- typeset_grob(breathing_sign_p_);
+ typeset_grob (breathing_sign_p_);
breathing_sign_p_ = 0;
}
}
void
-Breathing_sign_engraver::start_translation_timestep()
+Breathing_sign_engraver::start_translation_timestep ()
{
breathing_sign_req_l_ = 0;
}
-ADD_THIS_TRANSLATOR(Breathing_sign_engraver);
+ADD_THIS_TRANSLATOR (Breathing_sign_engraver);
#include "dimensions.hh"
#include "direction.hh"
-MAKE_SCHEME_CALLBACK(Breathing_sign,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Breathing_sign,brew_molecule,1);
SCM
Breathing_sign::brew_molecule (SCM smob)
{
Real space = Staff_symbol_referencer::staff_space (me);
// todo: cfg'able.
- Interval i1(0, space / 6), i2(-space / 2, space / 2);
- Box b(i1, i2);
+ Interval i1 (0, space / 6), i2 (-space / 2, space / 2);
+ Box b (i1, i2);
- return Lookup::filledbox(b).smobbed_copy ();
+ return Lookup::filledbox (b).smobbed_copy ();
}
-MAKE_SCHEME_CALLBACK(Breathing_sign,offset_callback,2);
+MAKE_SCHEME_CALLBACK (Breathing_sign,offset_callback,2);
SCM
-Breathing_sign::offset_callback (SCM element_smob, SCM )
+Breathing_sign::offset_callback (SCM element_smob, SCM)
{
Grob *me = unsmob_grob (element_smob);
Real inter_f = Staff_symbol_referencer::staff_space (me)/2;
int sz = Staff_symbol_referencer::line_count (me)-1;
- return gh_double2scm ( inter_f * sz * d);
+ return gh_double2scm (inter_f * sz * d);
}
void
Breathing_sign::set_interface (Grob *b)
{
- Staff_symbol_referencer::set_interface (b);
+ Staff_symbol_referencer::set_interface (b);
}
If \translator Staff = bass, then look for Staff = *
*/
- while (current && current->type_str_ != to_type)
+ while (current && current->type_str_ != to_type)
{
last = current;
current = current->daddy_trans_l_;
-IMPLEMENT_CTOR_CALLBACK(Change_iterator);
+IMPLEMENT_CTOR_CALLBACK (Change_iterator);
{
void typeset_beam ();
public:
- VIRTUAL_COPY_CONS(Translator);
- Chord_tremolo_engraver();
+ VIRTUAL_COPY_CONS (Translator);
+ Chord_tremolo_engraver ();
protected:
Repeated_music * repeat_;
Spanner * finished_beam_p_;
Item * stem_tremolo_;
protected:
- virtual void finalize();
+ virtual void finalize ();
virtual bool try_music (Music*);
virtual void acknowledge_grob (Grob_info);
- virtual void stop_translation_timestep();
- virtual void start_translation_timestep();
+ virtual void stop_translation_timestep ();
+ virtual void start_translation_timestep ();
virtual void process_music ();
};
-Chord_tremolo_engraver::Chord_tremolo_engraver()
+Chord_tremolo_engraver::Chord_tremolo_engraver ()
{
beam_p_ = finished_beam_p_ = 0;
repeat_ =0;
SCM smp = get_property ("measurePosition");
Moment mp
- = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
+ = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
beam_start_location_ = mp;
announce_grob (beam_p_, repeat_);
}
else if (!sequential_body_b_ && !stem_tremolo_)
{
- int flags = intlog2(note_head_i_ * repeat_->repeat_count ()) -2;
+ int flags = intlog2 (note_head_i_ * repeat_->repeat_count ()) -2;
if (flags)
{
stem_tremolo_ = new Item (get_property ("StemTremolo"));
--hwn.
*/
SCM d = s->get_grob_property ("direction");
- if (Stem::type_i (s ) != 1)
+ if (Stem::type_i (s) != 1)
{
- int gap_i =Stem::flag_i (s ) - ((Stem::type_i (s ) >? 2) - 2);
- beam_p_->set_grob_property ("beam-gap", gh_int2scm(gap_i));
+ int gap_i =Stem::flag_i (s) - ((Stem::type_i (s) >? 2) - 2);
+ beam_p_->set_grob_property ("beam-gap", gh_int2scm (gap_i));
}
s->set_grob_property ("direction", d);
}
-ADD_THIS_TRANSLATOR(Chord_tremolo_engraver);
+ADD_THIS_TRANSLATOR (Chord_tremolo_engraver);
child_iter_p_ = get_iterator_p (rep->body ());
}
-Chord_tremolo_iterator::Chord_tremolo_iterator()
+Chord_tremolo_iterator::Chord_tremolo_iterator ()
{
factor_ = 1;
child_iter_p_ = 0;
if (yeah)
set_translator (yeah->report_to_l ());
else
- music_l_->origin ()->warning ( _("no one to print a tremolos"));
+ music_l_->origin ()->warning (_ ("no one to print a tremolos"));
}
child_iter_p_->process (factor_ * m);
bool
Chord_tremolo_iterator::ok () const
{
- return child_iter_p_ && child_iter_p_->ok();
+ return child_iter_p_ && child_iter_p_->ok ();
}
Chord_tremolo_iterator::~Chord_tremolo_iterator ()
-IMPLEMENT_CTOR_CALLBACK(Chord_tremolo_iterator);
+IMPLEMENT_CTOR_CALLBACK (Chord_tremolo_iterator);
octavate_p_ = 0;
/*
- will trigger a clef at the start since #f != '()
+ will trigger a clef at the start since #f != ' ()
*/
prev_cpos_ = prev_glyph_ = SCM_BOOL_F;
}
/*
Key_item adapts its formatting to make sure that the
accidentals stay in the upper half of the staff. It needs
- to know c0-pos for this. (?)
+ to know c0-pos for this. (?)
*/
item->set_grob_property ("c0-position", get_property ("centralCPosition"));
Staff_symbol_referencer::set_position (clef_p_,
gh_scm2int (get_property ("clefPosition")));
- SCM oct = get_property("clefOctavation");
+ SCM oct = get_property ("clefOctavation");
if (gh_number_p (oct) && gh_scm2int (oct))
{
Item * g = new Item (get_property ("OctavateEight"));
|| scm_equal_p (clefpos, prev_cpos_) == SCM_BOOL_F
|| scm_equal_p (octavation, prev_octavation_) == SCM_BOOL_F
|| to_boolean (force_clef)
- )
+)
{
- set_glyph();
+ set_glyph ();
set_central_c (glyph, clefpos, octavation);
create_clef ();
/*
FIXME: should use symbol for #'style.
*/
-MAKE_SCHEME_CALLBACK(Clef,before_line_breaking,1);
+MAKE_SCHEME_CALLBACK (Clef,before_line_breaking,1);
SCM
Clef::before_line_breaking (SCM smob)
{
String str = ly_scm2string (glyph);
if (to_boolean (s->get_grob_property ("non-default"))
- && s->break_status_dir() != RIGHT
+ && s->break_status_dir () != RIGHT
&& !to_boolean (s->get_grob_property ("full-size-change")))
{
str += "_change";
- s->set_grob_property ("glyph-name", ly_str02scm (str.ch_C()));
+ s->set_grob_property ("glyph-name", ly_str02scm (str.ch_C ()));
}
}
else
me->set_interface (ly_symbol2scm ("clef-interface"));
}
-MAKE_SCHEME_CALLBACK(Clef,brew_molecule,1)
+MAKE_SCHEME_CALLBACK (Clef,brew_molecule,1)
SCM
Clef::brew_molecule (SCM smob)
{
protected:
virtual void acknowledge_grob (Grob_info);
virtual void create_grobs ();
- virtual void stop_translation_timestep();
+ virtual void stop_translation_timestep ();
public:
- VIRTUAL_COPY_CONS(Translator);
- Collision_engraver();
+ VIRTUAL_COPY_CONS (Translator);
+ Collision_engraver ();
};
if (Note_column::has_interface (i.elem_l_))
{
/*should check Y axis? */
- if (Note_column::rest_b (i.elem_l_) || i.elem_l_->parent_l(X_AXIS))
+ if (Note_column::rest_b (i.elem_l_) || i.elem_l_->parent_l (X_AXIS))
return ;
note_column_l_arr_.push (i.elem_l_);
}
void
-Collision_engraver::stop_translation_timestep()
+Collision_engraver::stop_translation_timestep ()
{
if (col_p_)
{
note_column_l_arr_.clear ();
}
-Collision_engraver::Collision_engraver()
+Collision_engraver::Collision_engraver ()
{
col_p_ =0;
}
-ADD_THIS_TRANSLATOR(Collision_engraver);
+ADD_THIS_TRANSLATOR (Collision_engraver);
(c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+
#include "debug.hh"
#include "collision.hh"
#include "note-column.hh"
#include "item.hh"
-MAKE_SCHEME_CALLBACK(Collision,force_shift_callback,2);
+MAKE_SCHEME_CALLBACK (Collision,force_shift_callback,2);
+
SCM
Collision::force_shift_callback (SCM element_smob, SCM axis)
{
TODO: make callback of this.
*/
void
-Collision::do_shifts(Grob* me)
+Collision::do_shifts (Grob* me)
{
SCM autos (automatic_shift (me));
SCM hand (forced_shift (me));
{
for (int i=0; i < clash_groups[d].size (); i++)
{
- Slice s(Note_column::head_positions_interval (clash_groups[d][i]));
+ Slice s (Note_column::head_positions_interval (clash_groups[d][i]));
s[LEFT] --;
s[RIGHT]++;
extents[d].push (s);
Slice prev =extents[d][i-1];
prev.intersect (extents[d][i]);
if (prev.length ()> 0 ||
- (extents[-d].size () && d * (extents[d][i][-d] - extents[-d][0][d]) < 0))
+ (extents[-d].size () && d * (extents[d][i][-d] - extents[-d][0][d]) < 0))
for (int j = i; j < clash_groups[d].size (); j++)
offsets[d][j] += d * 0.5;
}
/*
TODO.
*/
- Grob * nu_l= Note_column::first_head(cu_l);
- Grob * nd_l = Note_column::first_head(cd_l);
+ Grob * nu_l= Note_column::first_head (cu_l);
+ Grob * nd_l = Note_column::first_head (cd_l);
int downpos = Note_column::head_positions_interval (cd_l)[BIGGER];
int uppos = Note_column::head_positions_interval (cu_l)[SMALLER];
/*
notes are close, but can not be merged. Shift
*/
- if (abs(uppos - downpos) < 2 && !merge)
+ if (abs (uppos - downpos) < 2 && !merge)
do
{
for (int i=0; i < clash_groups[d].size (); i++)
return tups;
}
-
-
-
void
Collision::add_column (Grob*me,Grob* ncol_l)
{
#include "real.hh"
#include "debug.hh"
-Column_x_positions::Column_x_positions()
+Column_x_positions::Column_x_positions ()
{
satisfies_constraints_b_ = false;
force_f_ = 0;
#include "debug.hh"
#include "musical-request.hh"
-
bool
Barcheck_req::do_equal_b (Request const *r) const
{
return b;
}
-
-
-
Tempo_req::Tempo_req ()
{
- set_mus_property ("duration", Duration(2,0).smobbed_copy ());
-}
-
-
-
-bool
-Tempo_req::do_equal_b (Request const *r) const
-{
- Tempo_req const *t = dynamic_cast <Tempo_req const*> (r);
-
- return t; // && t->dur_.length_mom ()== dur_.length_mom ();
- // && metronome_i_ == t->metronome_i_;
+ set_mus_property ("duration", Duration (2,0).smobbed_copy ());
}
-
-
-
-bool
-Key_change_req::do_equal_b (Request const * req) const
-{
- Key_change_req const * k = dynamic_cast<Key_change_req const*> (req);
- return k && scm_equal_p (get_mus_property ("pitch-alist"), k->get_mus_property ("pitch-alist")) == SCM_BOOL_T;
-}
-
-
void
Key_change_req::transpose (Pitch p)
{
orig.transpose (p);
- SCM key = gh_cons (gh_int2scm (orig.octave_i () ),
+ SCM key = gh_cons (gh_int2scm (orig.octave_i ()),
gh_int2scm (orig.notename_i_));
newlist = gh_cons (gh_cons (key, gh_int2scm (orig.alteration_i_)),
return other && scm_equal_p (other->get_mus_property ("mark-label"),
get_mus_property ("mark-label")) == SCM_BOOL_T;
}
+
+
+ADD_MUSIC (Articulation_req);
+ADD_MUSIC (Barcheck_req);
+ADD_MUSIC (Break_req);
+ADD_MUSIC (Breathing_sign_req);
+ADD_MUSIC (Busy_playing_req);
+ADD_MUSIC (Extender_req);
+ADD_MUSIC (Glissando_req);
+ADD_MUSIC (Hyphen_req);
+ADD_MUSIC (Key_change_req);
+ADD_MUSIC (Lyric_req);
+ADD_MUSIC (Mark_req);
+ADD_MUSIC (Melisma_playing_req);
+ADD_MUSIC (Melisma_req);
+ADD_MUSIC (Melodic_req);
+ADD_MUSIC (Note_req);
+ADD_MUSIC (Rest_req);
+ADD_MUSIC (Rhythmic_req);
+ADD_MUSIC (Script_req);
+ADD_MUSIC (Skip_req);
+ADD_MUSIC (Span_req);
+ADD_MUSIC (Tempo_req);
+ADD_MUSIC (Text_script_req);
+ADD_MUSIC (Tie_req);
+ADD_MUSIC (Tremolo_req);
*/
#include "context-specced-music.hh"
-Context_specced_music::Context_specced_music(SCM m)
- : Music_wrapper (m)
+Context_specced_music::Context_specced_music (SCM m)
+ : Music_wrapper (m)
{
set_mus_property ("type",
ly_symbol2scm ("context-specced-music"));
}
+
+Context_specced_music::Context_specced_music ()
+{
+ set_mus_property ("type",
+ ly_symbol2scm ("context-specced-music"));
+}
+
+ADD_MUSIC (Context_specced_music);
source file of the GNU LilyPond music typesetter
- (C) 2000 Juergen Reuter <reuterj@ira.uka.de>,
+ (C) 2000 Juergen Reuter <reuterj@ira.uka.de>,
Han-Wen Nienhuys <hanwen@cs.uu.nl>
class Custos_engraver : public Engraver
{
public:
- Custos_engraver();
- virtual void start_translation_timestep();
- virtual void acknowledge_grob(Grob_info);
+ Custos_engraver ();
+ virtual void start_translation_timestep ();
+ virtual void acknowledge_grob (Grob_info);
virtual void create_grobs ();
virtual void stop_translation_timestep ();
virtual void finalize ();
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
private:
- Item * create_custos();
+ Item * create_custos ();
bool custos_permitted;
Link_array<Grob> custos_arr_;
Array<Pitch> pitches_;
void
-Custos_engraver::stop_translation_timestep()
+Custos_engraver::stop_translation_timestep ()
{
/*
delay typeset until we're at the next moment, so we can silence custodes at the end of the piece.
void
Custos_engraver::acknowledge_grob (Grob_info info)
{
- Item *item = dynamic_cast <Item *>(info.elem_l_);
+ Item *item = dynamic_cast <Item *> (info.elem_l_);
if (item)
{
if (Bar::has_interface (info.elem_l_))
void
Custos_engraver::create_grobs ()
{
- if (gh_string_p (get_property( "whichBar")))
+ if (gh_string_p (get_property ("whichBar")))
custos_permitted = true;
if (custos_permitted)
}
Item*
-Custos_engraver::create_custos()
+Custos_engraver::create_custos ()
{
SCM basicProperties = get_property ("Custos");
Item* custos = new Item (basicProperties);
source file of the GNU LilyPond music typesetter
- (C) 2000 Juergen Reuter <reuterj@ira.uka.de>
+ (C) 2000 Juergen Reuter <reuterj@ira.uka.de>
*/
/* TODO:
- - merge create_ledger_line () and Note_head::create_ledger_line()
+ - merge create_ledger_line () and Note_head::create_ledger_line ()
- - rewrite create_ledger_line() to support short and thin ledger lines
+ - rewrite create_ledger_line () to support short and thin ledger lines
- do not show if a clef change immediately follows in the next line
/*
This function is a patched and hopefully much more understandable
- rewrite of Note_head::ledger_line(). It still has some
+ rewrite of Note_head::ledger_line (). It still has some
bugs/limitations:
*
- (1) The term thick/2 probably should be thick*2 (probably a bug,
+ (1) The term thick/2 probably should be thick*2 (probably a bug,
see the code below).
*
- (2) The minimal width of the resulting ledger line equals the width
+ (2) The minimal width of the resulting ledger line equals the width
of the noteheads-ledgerending symbol (a limitation):
*
- (---- left ledger ending
+ (---- left ledger ending
----) right ledger ending
- (---) resulting ledger line (just ok)
+ (---) resulting ledger line (just ok)
*
If x_extent ("xwid" in Note_head) is less than the width of the
ledger ending, the width of the total ledger line is even *greater*
than the width of a ledger ending (I would call this a bug). In
- the below code, the condition "if (x_extent.length() >
- slice_x_extent.length())" avoids outputting the left ending in such
+ the below code, the condition "if (x_extent.length () >
+ slice_x_extent.length ())" avoids outputting the left ending in such
cases (rather a silly workaround, but better than nothing).
*
- (---- left ledger ending
+ (---- left ledger ending
----) right ledger ending
- (-) desired ledger line
+ (-) desired ledger line
------- resulting ledger line (too long)
----) resulting ledger line with additional "if" (still too long)
*
The algorithm works properly only for a desired ledger line width
greater than the width of the ledger ending:
*
- (---- left ledger ending
+ (---- left ledger ending
----) right ledger ending
- (------) desired ledger line
- (------) resulting ledger line (ok)
+ (------) desired ledger line
+ (------) resulting ledger line (ok)
*
* (3) The thickness of the ledger line is fixed (limitation).
*/
{
Molecule line;
Molecule slice = Font_interface::get_default_font (me)->find_by_name ("noteheads-ledgerending");
- Interval slice_x_extent = slice.extent(X_AXIS);
- Interval slice_y_extent = slice.extent(Y_AXIS);
+ Interval slice_x_extent = slice.extent (X_AXIS);
+ Interval slice_y_extent = slice.extent (Y_AXIS);
// Create left ending of ledger line.
Molecule left_ending = slice;
left_ending.translate_axis (x_extent[LEFT] - slice_x_extent[LEFT], X_AXIS);
- if (x_extent.length() > slice_x_extent.length())
+ if (x_extent.length () > slice_x_extent.length ())
line.add_molecule (left_ending);
// Create right ending of ledger line.
// Fill out space between left and right ending of ledger line by
// lining up a series of slices in a row between them.
Molecule fill_out_slice = left_ending;
- Real thick = slice_y_extent.length();
+ Real thick = slice_y_extent.length ();
Real delta_x = slice_x_extent.length () - thick;
Real xpos = x_extent [LEFT] + 2*delta_x + thick/2; // TODO: check: thick*2?
while (xpos <= x_extent[RIGHT])
}
void
-Custos::add_streepjes(Grob* me,
+Custos::add_streepjes (Grob* me,
int pos,
int interspaces,
Molecule* custos_p_)
Real inter_f = Staff_symbol_referencer::staff_space (me)/2;
int streepjes_i = abs (pos) < interspaces
? 0
- : (abs(pos) - interspaces) /2;
+ : (abs (pos) - interspaces) /2;
if (streepjes_i)
{
Direction dir = (Direction)sign (pos);
}
}
-MAKE_SCHEME_CALLBACK(Custos,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Custos,brew_molecule,1);
SCM
Custos::brew_molecule (SCM smob)
{
idx += style;
Molecule molecule
= Font_interface::get_default_font (me)->find_by_name (idx);
- if (molecule.empty_b())
+ if (molecule.empty_b ())
{
String message = "unknown custos style: `" + style + "'";
- warning(_ (message.ch_C()));
+ warning (_ (message.ch_C ()));
return SCM_EOL;
}
else
{
- add_streepjes(me, (int)pos, interspaces, &molecule);
- return molecule.smobbed_copy();
+ add_streepjes (me, (int)pos, interspaces, &molecule);
+ return molecule.smobbed_copy ();
}
}
else
SCM
cxx_function_type_p (SCM x)
{
- return (SCM_CELL_TYPE(x) == callback_tag) ? SCM_BOOL_T : SCM_BOOL_F;
+ return (SCM_CELL_TYPE (x) == callback_tag) ? SCM_BOOL_T : SCM_BOOL_F;
}
-void init_cxx_function_smobs()
+void init_cxx_function_smobs ()
{
callback_tag = scm_make_smob_type_mfpe ("callback", 0,
mark_smob, free_smob,
{
SCM z;
- SCM_NEWCELL(z);
+ SCM_NEWCELL (z);
SCM_SETCDR (z, (SCM)cb);
SCM_SETCAR (z, (SCM)callback_tag);
unsmob_cxx_function (SCM x)
{
- if (SCM_NIMP (x) && SCM_CELL_TYPE(x) == callback_tag)
- return (Cxx_function) SCM_CELL_WORD_1(x);
+ if (SCM_NIMP (x) && SCM_CELL_TYPE (x) == callback_tag)
+ return (Cxx_function) SCM_CELL_WORD_1 (x);
else
return 0;
}
}
void
-debug_init()
+debug_init ()
{
my_monitor = new Dstream (&cout, ".dstreamrc");
signal (SIGFPE, float_handler);
Dimension_cache::Dimension_cache (Dimension_cache const &d)
{
- init();
+ init ();
dimension_ = d.dimension_;
offset_ = d.offset_;
Dimension_cache::Dimension_cache ()
{
- init();
+ init ();
}
void
-Dimension_cache::init()
+Dimension_cache::init ()
{
dimension_ = SCM_EOL;
{
Directional_element_interface::direction_sym = scm_permanent_object (ly_symbol2scm ("direction"));
}
-ADD_SCM_INIT_FUNC(Directional, init_functions);
+ADD_SCM_INIT_FUNC (Directional, init_functions);
bool
{
// return dir_;
SCM d= me->get_grob_property (direction_sym);
- if (!isdir_b(d))
+ if (!isdir_b (d))
return CENTER;
return to_dir (d);
Grob *dotcol_p_ ;
Link_array<Item> head_l_arr_;
public:
- VIRTUAL_COPY_CONS(Translator);
- Dot_column_engraver();
+ VIRTUAL_COPY_CONS (Translator);
+ Dot_column_engraver ();
protected:
virtual void acknowledge_grob (Grob_info);
{
if (!dotcol_p_)
{
- dotcol_p_ = new Item(get_property ("DotColumn"));
+ dotcol_p_ = new Item (get_property ("DotColumn"));
Dot_column::set_interface (dotcol_p_);
Side_position_interface::set_axis (dotcol_p_, X_AXIS);
}
-ADD_THIS_TRANSLATOR(Dot_column_engraver);
+ADD_THIS_TRANSLATOR (Dot_column_engraver);
*/
-MAKE_SCHEME_CALLBACK(Dot_column,force_shift_callback,2);
+MAKE_SCHEME_CALLBACK (Dot_column,force_shift_callback,2);
SCM
Dot_column::force_shift_callback (SCM element_smob, SCM axis)
{
}
taken_posns.push ((int)p);
s.unite (Slice ((int)p,
- (int)p));
+ (int)p));
}
if (!conflicts)
+1 -> off by one
*/
int pos = middle - dots.size () + 1;
- if (!(pos % 2))
+ if (! (pos % 2))
pos ++; // center () rounds down.
for (int i=0; i < dots.size (); pos += 2, i++)
#include "directional-element-interface.hh"
-MAKE_SCHEME_CALLBACK(Dots,quantised_position_callback,2);
+MAKE_SCHEME_CALLBACK (Dots,quantised_position_callback,2);
SCM
Dots::quantised_position_callback (SCM element_smob, SCM axis)
{
return gh_double2scm (Staff_symbol_referencer::staff_space (me) / 2.0 * Directional_element_interface::get (me));
}
- return gh_double2scm (0.0);
+ return gh_double2scm (0.0);
}
-MAKE_SCHEME_CALLBACK(Dots,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Dots,brew_molecule,1);
SCM
Dots::brew_molecule (SCM d)
{
mol = Lookup::blank (Box (Interval (0,0),
Interval (0,0)));
- for (int i = gh_scm2int (c); i--; )
+ for (int i = gh_scm2int (c); i--;)
{
d.translate_axis (2*dw,X_AXIS);
mol.add_at_edge (X_AXIS, RIGHT, d, dw);
}
-IMPLEMENT_TYPE_P(Duration, "duration?");
-IMPLEMENT_UNSMOB(Duration, duration);
+IMPLEMENT_TYPE_P (Duration, "duration?");
+IMPLEMENT_UNSMOB (Duration, duration);
SCM
-Duration::mark_smob (SCM )
+Duration::mark_smob (SCM)
{
return SCM_EOL;
}
-IMPLEMENT_SIMPLE_SMOBS(Duration);
+IMPLEMENT_SIMPLE_SMOBS (Duration);
int
Duration *r = (Duration *) gh_cdr (s);
scm_puts ("#<Duration ", port);
- scm_display (ly_str02scm (r->str().ch_C()), port);
+ scm_display (ly_str02scm (r->str ().ch_C ()), port);
scm_puts (" >", port);
return 1;
return eq ? SCM_BOOL_T : SCM_BOOL_F;
}
-MAKE_SCHEME_CALLBACK(Duration, less_p, 2);
+MAKE_SCHEME_CALLBACK (Duration, less_p, 2);
SCM
Duration::less_p (SCM p1, SCM p2)
{
Duration *a = unsmob_duration (p1);
Duration *b = unsmob_duration (p2);
- if (compare(*a, *b) < 0 )
+ if (compare (*a, *b) < 0)
return SCM_BOOL_T;
else
return SCM_BOOL_F;
static SCM
make_duration (SCM l, SCM d)
{
- Duration p( gh_scm2int (l), gh_scm2int (d));
+ Duration p (gh_scm2int (l), gh_scm2int (d));
return p.smobbed_copy ();
}
static void
-add_funcs()
+add_funcs ()
{
scm_make_gsubr ("make-duration", 2, 0, 0, (Scheme_function_unknown)make_duration);
}
-ADD_SCM_INIT_FUNC(duration, add_funcs);
+ADD_SCM_INIT_FUNC (duration, add_funcs);
SCM
Duration::smobbed_copy ()const
void typeset_all ();
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Dynamic_engraver ();
protected:
earlier, not-to-be-terminated stuff.
It will disappear by itself when stop_translation_timestep
- () finds that there is nothing to support anymore. */
+ () finds that there is nothing to support anymore. */
if (cresc_p_)
cresc_p_->suicide ();
else if (t == "crescendo"
|| t == "decrescendo")
{
- accepted_spanreqs_drul_[s->get_span_dir()] = s;
+ accepted_spanreqs_drul_[s->get_span_dir ()] = s;
return true;
}
}
there are no new dynamics.
*/
- if ( !cresc_p_)
+ if (!cresc_p_)
{
accepted_spanreqs_drul_[STOP]->origin ()->warning
- (_ ("can't find start of (de)crescendo"));
+ (_ ("can't find start of (de)crescendo"));
accepted_spanreqs_drul_[STOP] = 0;
}
else
if (current_cresc_req_)
{
accepted_spanreqs_drul_[START]->origin ()->warning
- (current_cresc_req_->get_span_dir() == 1
+ (current_cresc_req_->get_span_dir () == 1
? _ ("already have a crescendo")
: _ ("already have a decrescendo"));
}
/*
ugh. Use push/pop?
*/
- SCM s = get_property ((start_type + "Spanner").ch_C());
+ SCM s = get_property ((start_type + "Spanner").ch_C ());
if (!gh_symbol_p (s) || s == ly_symbol2scm ("hairpin"))
{
cresc_p_ = new Spanner (get_property ("Hairpin"));
else
{
cresc_p_ = new Spanner (get_property ("TextSpanner"));
+ cresc_p_->set_interface (ly_symbol2scm ("dynamic-interface"));
cresc_p_->set_grob_property ("type", s);
daddy_trans_l_->set_property (start_type
+ "Spanner", SCM_UNDEFINED);
- s = get_property ((start_type + "Text").ch_C());
+ s = get_property ((start_type + "Text").ch_C ());
if (gh_string_p (s))
{
cresc_p_->set_grob_property ("edge-text",
Dynamic_engraver::finalize ()
{
typeset_all ();
+
+ if (line_spanner_
+ && line_spanner_->immutable_property_alist_ == SCM_EOL)
+ line_spanner_ = 0;
if (line_spanner_)
{
finished_line_spanner_ = line_spanner_;
typeset_all ();
}
+ if (cresc_p_
+ && cresc_p_->immutable_property_alist_ == SCM_EOL)
+ cresc_p_ = 0;
if (cresc_p_)
{
current_cresc_req_->origin ()->warning (_ ("unterminated (de)crescendo"));
void
Dynamic_engraver::typeset_all ()
{
+ /*
+ remove suicided spanners,
+ ugh: we'll need this for every spanner, beam, slur
+ Hmm, how to do this, cleanly?
+ Maybe just check at typeset_grob ()?
+ */
+ if (finished_cresc_p_
+ && finished_cresc_p_->immutable_property_alist_ == SCM_EOL)
+ finished_cresc_p_ = 0;
+ if (finished_line_spanner_
+ && finished_line_spanner_->immutable_property_alist_ == SCM_EOL)
+ finished_line_spanner_ = 0;
+
if (finished_cresc_p_)
{
if (!finished_cresc_p_->get_bound (RIGHT))
}
if (finished_line_spanner_)
{
- /*
- To make sure that this works
- */
+ /* To make sure that this works */
Side_position_interface::add_staff_support (finished_line_spanner_);
+
/*
We used to have
*/
- if (!finished_line_spanner_->get_bound (RIGHT))
+ if (!finished_line_spanner_->get_bound (RIGHT)
+ && finished_line_spanner_->get_bound (LEFT))
finished_line_spanner_->set_bound (RIGHT, finished_line_spanner_->get_bound (LEFT));
typeset_grob (finished_line_spanner_);
{
if (Note_column::has_interface (i.elem_l_))
{
- if (line_spanner_)
+ if (line_spanner_
+ /* Don't refill killed spanner */
+ && line_spanner_->immutable_property_alist_ != SCM_EOL)
{
Side_position_interface::add_support (line_spanner_,i.elem_l_);
- add_bound_item (line_spanner_,dynamic_cast<Item*>(i.elem_l_));
+ add_bound_item (line_spanner_,dynamic_cast<Item*> (i.elem_l_));
}
}
}
*/
SCM s = get_property ("midiInstrument");
- if (!gh_string_p(s))
+ if (!gh_string_p (s))
s = get_property ("instrument");
- if (!gh_string_p(s))
+ if (!gh_string_p (s))
s = ly_str02scm ("piano");
{
if (!script_req_l_)
{
- if( dynamic_cast <Text_script_req*> (r)
+ if (dynamic_cast <Text_script_req*> (r)
&& r->get_mus_property ("text-type") == ly_symbol2scm ("dynamic"))
{
script_req_l_ = r;
#include "grob.hh"
-ADD_THIS_TRANSLATOR(Engraver_group_engraver);
+ADD_THIS_TRANSLATOR (Engraver_group_engraver);
void
Engraver_group_engraver::announce_grob (Grob_info info)
Engraver_group_engraver::create_grobs ()
{
- for (SCM p = simple_trans_list_; gh_pair_p (p); p = gh_cdr ( p))
+ for (SCM p = simple_trans_list_; gh_pair_p (p); p = gh_cdr (p))
{
Translator * t = unsmob_translator (gh_car (p));
Engraver * eng = dynamic_cast<Engraver*> (t);
void
Engraver_group_engraver::acknowledge_grobs ()
{
- for (int j =0; j < announce_info_arr_.size(); j++)
+ for (int j =0; j < announce_info_arr_.size (); j++)
{
Grob_info info = announce_info_arr_[j];
for (SCM p = simple_trans_list_; gh_pair_p (p); p = gh_cdr (p))
}
void
-Engraver_group_engraver::do_announces()
+Engraver_group_engraver::do_announces ()
{
- for (SCM p = trans_group_list_; gh_pair_p (p); p =gh_cdr ( p))
+ for (SCM p = trans_group_list_; gh_pair_p (p); p =gh_cdr (p))
{
Translator * t = unsmob_translator (gh_car (p));
dynamic_cast<Engraver_group_engraver*> (t)->do_announces ();
void
Engraver_group_engraver::process_music ()
{
- for (SCM p = simple_trans_list_; gh_pair_p (p); p =gh_cdr ( p))
+ for (SCM p = simple_trans_list_; gh_pair_p (p); p =gh_cdr (p))
{
Translator * t = unsmob_translator (gh_car (p));
Engraver * eng = dynamic_cast<Engraver*> (t);
if (eng)
eng->process_music ();
}
- for (SCM p = trans_group_list_; gh_pair_p (p); p =gh_cdr ( p))
+ for (SCM p = trans_group_list_; gh_pair_p (p); p =gh_cdr (p))
{
Translator * t = unsmob_translator (gh_car (p));
Engraver*eng = dynamic_cast<Engraver*> (t);
void
Engraver::announce_grob (Grob_info inf)
{
- daddy_grav_l()->announce_grob (inf);
+ daddy_grav_l ()->announce_grob (inf);
}
void
Grob_info i (e, m);
if (!i.origin_trans_l_)
i.origin_trans_l_ = this;
- daddy_grav_l()->announce_grob (i);
+ daddy_grav_l ()->announce_grob (i);
}
void
Engraver::typeset_grob (Grob*p)
{
- daddy_grav_l()->typeset_grob (p);
+ daddy_grav_l ()->typeset_grob (p);
}
Engraver_group_engraver*
Engraver::daddy_grav_l () const
{
- return (daddy_trans_l_ )
+ return (daddy_trans_l_)
? dynamic_cast<Engraver_group_engraver *> (daddy_trans_l_)
: 0;
}
protected:
virtual void acknowledge_grob (Grob_info);
- virtual void finalize();
+ virtual void finalize ();
virtual bool try_music (Music*);
- virtual void stop_translation_timestep();
+ virtual void stop_translation_timestep ();
virtual void start_translation_timestep ();
virtual void process_music ();
private:
Extender_engraver::acknowledge_grob (Grob_info i)
{
// -> text_item
- if (i.elem_l_->has_interface (ly_symbol2scm("lyric-syllable-interface")))
+ if (i.elem_l_->has_interface (ly_symbol2scm ("lyric-syllable-interface")))
{
current_lyric_l_ = i.elem_l_;
if (extender_p_
if (extender_p_)
{
req_l_->origin ()->warning (_ ("unterminated extender"));
- extender_p_->set_bound(RIGHT, unsmob_grob (get_property ("currentCommandColumn")));
+ extender_p_->set_bound (RIGHT, unsmob_grob (get_property ("currentCommandColumn")));
}
}
extender_p_ = new Spanner (get_property ("LyricExtender"));
- Lyric_extender::set_textitem (extender_p_, LEFT, last_lyric_l_);
+ Lyric_extender::set_textitem (extender_p_, LEFT, last_lyric_l_);
announce_grob (extender_p_, req_l_);
}
}
{
Repeated_music * mus = dynamic_cast<Repeated_music*> (music_l_);
main_iter_p_ = get_iterator_p (mus->body ());
- if (!main_iter_p_->ok())
+ if (!main_iter_p_->ok ())
{
leave_body ();
enter_alternative ();
{
bool success = try_music (music_l_);
if (!success)
- music_l_->origin ()->warning ( _("no one to print a repeat brace"));
+ music_l_->origin ()->warning (_ ("no one to print a repeat brace"));
}
if (main_iter_p_)
return 0;
}
-IMPLEMENT_CTOR_CALLBACK(Folded_repeat_iterator);
+IMPLEMENT_CTOR_CALLBACK (Folded_repeat_iterator);
Font_interface::font_alist_chain (Grob *me)
{
SCM defaults = gh_cdr (scm_assoc (ly_symbol2scm ("font-defaults"),
- me->paper_l ()->style_sheet_ ));
+ me->paper_l ()->style_sheet_));
SCM ch = gh_list (me->mutable_property_alist_,
me->immutable_property_alist_,
bool
-Font_interface::wild_compare(SCM field_val, SCM val)
+Font_interface::wild_compare (SCM field_val, SCM val)
{
return (val == SCM_BOOL_F || field_val == wild_sym || field_val == val);
}
-ADD_SCM_INIT_FUNC(Font_interface_syms,init_syms);
+ADD_SCM_INIT_FUNC (Font_interface_syms,init_syms);
-MAKE_SCHEME_CALLBACK(Font_interface,properties_to_font_name,2);
+MAKE_SCHEME_CALLBACK (Font_interface,properties_to_font_name,2);
SCM
Font_interface::properties_to_font_name (SCM fonts, SCM alist_chain)
{
if (name != SCM_BOOL_F)
{
- if (!wild_compare(scm_list_ref (qlist, gh_int2scm (4)), name))
+ if (!wild_compare (scm_list_ref (qlist, gh_int2scm (4)), name))
continue;
}
else
{
- if (!wild_compare(scm_list_ref (qlist, gh_int2scm (1)), series))
+ if (!wild_compare (scm_list_ref (qlist, gh_int2scm (1)), series))
continue;
- if (!wild_compare(scm_list_ref (qlist, gh_int2scm (2)), shape))
+ if (!wild_compare (scm_list_ref (qlist, gh_int2scm (2)), shape))
continue;
- if (!wild_compare(scm_list_ref (qlist, gh_int2scm (3)), family))
+ if (!wild_compare (scm_list_ref (qlist, gh_int2scm (3)), family))
continue;
}
{
// This if statement will always be true since name must
// be SCM_BOOL_F here, right? /MB
- if (!wild_compare(scm_list_ref (qlist, gh_int2scm (4)), name))
+ if (!wild_compare (scm_list_ref (qlist, gh_int2scm (4)), name))
continue;
}
else
{
- if (!wild_compare(gh_car (qlist), rel_sz))
+ if (!wild_compare (gh_car (qlist), rel_sz))
continue;
}
return qname;
}
- warning (_("couldn't find any font satisfying ") );
+ warning (_ ("couldn't find any font satisfying "));
scm_write (gh_list (name, point_sz, shape, series , family, rel_sz, SCM_UNDEFINED), scm_current_error_port ());
- scm_flush(scm_current_error_port ());
+ scm_flush (scm_current_error_port ());
return ly_str02scm ("cmr10");
(c) 1999--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
- Mats Bengtsson <matsb@s3.kth.se> (the ugly TeX parsing in text_dimension)
+ Mats Bengtsson <matsb@s3.kth.se> (the ugly TeX parsing in text_dimension)
*/
#include <math.h>
switch (text[i])
{
case '\\':
- for (i++; (i < text.length_i ()) && !isspace(text[i])
+ for (i++; (i < text.length_i ()) && !isspace (text[i])
&& text[i]!='{' && text[i]!='}'; i++)
;
// ugh.
if (ydims.empty_b ())
ydims = Interval (0,0);
- return Box(Interval (0, w), ydims);
+ return Box (Interval (0, w), ydims);
}
Box
-Font_metric::get_char (int )const
+Font_metric::get_char (int)const
{
- return Box (Interval(0,0),Interval (0,0));
+ return Box (Interval (0,0),Interval (0,0));
}
SCM
Font_metric::mark_smob (SCM s)
{
- Font_metric * m = (Font_metric*) SCM_CELL_WORD_1(s);
+ Font_metric * m = (Font_metric*) SCM_CELL_WORD_1 (s);
return m->description_;
}
int
-Font_metric::print_smob (SCM s, SCM port, scm_print_state * )
+Font_metric::print_smob (SCM s, SCM port, scm_print_state *)
{
Font_metric *m = unsmob_metrics (s);
scm_puts ("#<Font_metric ", port);
IMPLEMENT_UNSMOB (Font_metric, metrics);
IMPLEMENT_SMOBS (Font_metric);
-IMPLEMENT_DEFAULT_EQUAL_P(Font_metric);
+IMPLEMENT_DEFAULT_EQUAL_P (Font_metric);
IMPLEMENT_TYPE_P (Font_metric, "font-metric?");
Molecule
scm_make_gsubr ("ly-find-glyph-by-name", 2 , 0, 0, (Scheme_function_unknown) ly_find_glyph_by_name);
}
-ADD_SCM_INIT_FUNC(font_metric_init, font_metric_init);
+ADD_SCM_INIT_FUNC (font_metric_init, font_metric_init);
Item*
to_item (Grob* g)
{
- return dynamic_cast<Item*>(g);
+ return dynamic_cast<Item*> (g);
}
Spanner*
to_spanner (Grob*g)
{
- return dynamic_cast<Spanner*>(g);
+ return dynamic_cast<Spanner*> (g);
}
call_constructors ()
{
for (int i=0; i < ctor_global_static_arr_p_->size (); i++)
- (ctor_global_static_arr_p_->elem (i)) ();
+ (ctor_global_static_arr_p_->elem (i)) ();
}
if (m > final_mom_)
return;
- if (m < now_mom_ )
+ if (m < now_mom_)
programming_error ("Trying to freeze in time.");
- for (int i=0; i < extra_mom_pq_.size(); i++)
+ for (int i=0; i < extra_mom_pq_.size (); i++)
if (extra_mom_pq_[i] == m)
return;
extra_mom_pq_.insert (m);
Moment
Global_translator::sneaky_insert_extra_moment (Moment w)
{
- while (extra_mom_pq_.size() && extra_mom_pq_.front() <= w)
- w = extra_mom_pq_.get();
+ while (extra_mom_pq_.size () && extra_mom_pq_.front () <= w)
+ w = extra_mom_pq_.get ();
return w;
}
int
-Global_translator::moments_left_i() const
+Global_translator::moments_left_i () const
{
- return extra_mom_pq_.size();
+ return extra_mom_pq_.size ();
}
void
Music_output*
-Global_translator::get_output_p()
+Global_translator::get_output_p ()
{
return 0;
}
w.set_infinite (1);
if (iter->ok ())
{
- w = iter->pending_moment();
+ w = iter->pending_moment ();
}
}
/* do the last one */
- if (break_idx % HAPPY_DOTS_I)
+ if (break_idx % HAPPY_DOTS_I)
progress_indication (String ("[") + to_str (break_idx) + "]");
#include "paper-column.hh"
#include "paper-def.hh"
-MAKE_SCHEME_CALLBACK(Grace_align_item,before_line_breaking,1);
+MAKE_SCHEME_CALLBACK (Grace_align_item,before_line_breaking,1);
SCM
Grace_align_item::before_line_breaking (SCM smob)
{
me->set_grob_property ("threshold",
gh_cons (space,
gh_double2scm (infinity_f)));
- dynamic_cast<Item*>(me)->column_l ()->set_grob_property ("contains-grace", SCM_BOOL_T);
+ dynamic_cast<Item*> (me)->column_l ()->set_grob_property ("contains-grace", SCM_BOOL_T);
return SCM_UNSPECIFIED;
}
{
me->set_interface (ly_symbol2scm ("grace-align-interface"));
me->set_grob_property ("stacking-dir", gh_int2scm (RIGHT));
- Align_interface::set_interface(me);
+ Align_interface::set_interface (me);
Align_interface::set_axis (me,X_AXIS);
}
}
-Grace_engraver_group::Grace_engraver_group()
+Grace_engraver_group::Grace_engraver_group ()
{
calling_self_b_ = false;
}
{
calling_self_b_ = true;
process_music ();
- announces();
- pre_move_processing();
- check_removal();
+ announces ();
+ pre_move_processing ();
+ check_removal ();
calling_self_b_ = false;
}
}
-ADD_THIS_TRANSLATOR(Grace_engraver_group);
+ADD_THIS_TRANSLATOR (Grace_engraver_group);
/*
void
Grace_iterator::process (Moment)
{
- Global_translator * t = dynamic_cast<Global_translator*>(report_to_l ());
+ Global_translator * t = dynamic_cast<Global_translator*> (report_to_l ());
if (t)
{
t->start ();
}
else
{
- warning (_("no Grace context available"));
+ warning (_ ("no Grace context available"));
}
}
}
-IMPLEMENT_CTOR_CALLBACK(Grace_iterator);
+IMPLEMENT_CTOR_CALLBACK (Grace_iterator);
return 0;
}
+Grace_music::Grace_music ()
+{
+ set_mus_property ("iterator-ctor",
+ Grace_iterator::constructor_cxx_function);
+}
+
Grace_music::Grace_music (SCM p)
: Music_wrapper (p)
{
set_mus_property ("iterator-ctor",
Grace_iterator::constructor_cxx_function);
}
+
+ADD_MUSIC (Grace_music);
}
-Grace_performer_group::Grace_performer_group()
+Grace_performer_group::Grace_performer_group ()
{
calling_self_b_ = false;
}
{
calling_self_b_ = true;
// process_music ();
- announces();
- pre_move_processing();
- check_removal();
+ announces ();
+ pre_move_processing ();
+ check_removal ();
calling_self_b_ = false;
}
{
Paper_column *last_musical_col_l_;
protected:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
virtual void acknowledge_grob (Grob_info);
virtual void create_grobs ();
virtual void start_translation_timestep ();
Item*align_l_;
Link_array<Item> support_;
public:
- Grace_position_engraver();
+ Grace_position_engraver ();
};
if (last_musical_col_l_)
{
- warning (_("Unattached grace notes. Attaching to last musical column."));
+ warning (_ ("Unattached grace notes. Attaching to last musical column."));
align_l_->set_parent (0, X_AXIS);
Axis_group_interface::add_element (last_musical_col_l_, align_l_);
// tja.
}
}
- last_musical_col_l_ = dynamic_cast<Paper_column*>( unsmob_grob (get_property ("currentMusicalColumn")));
+ last_musical_col_l_ = dynamic_cast<Paper_column*> (unsmob_grob (get_property ("currentMusicalColumn")));
}
void
align_l_ =0;
}
-ADD_THIS_TRANSLATOR(Grace_position_engraver);
+ADD_THIS_TRANSLATOR (Grace_position_engraver);
}
-Grob_info::Grob_info()
+Grob_info::Grob_info ()
{
elem_l_ = 0;
req_l_ = 0;
#define INFINITY_MSG "Infinity or NaN encountered"
-Grob::Grob(SCM basicprops)
+Grob::Grob (SCM basicprops)
{
/*
fixme: default should be no callback.
Grob::Grob (Grob const&s)
: dim_cache_ (s.dim_cache_)
{
- original_l_ =(Grob*) &s;
+ original_l_ = (Grob*) &s;
immutable_property_alist_ = s.immutable_property_alist_;
mutable_property_alist_ = SCM_EOL;
smobify_self ();
}
-Grob::~Grob()
+Grob::~Grob ()
{
/*
do nothing scm-ish and no unprotecting here.
SCM
Grob::get_grob_property (SCM sym) const
{
- SCM s = scm_sloppy_assq(sym, mutable_property_alist_);
+ SCM s = scm_sloppy_assq (sym, mutable_property_alist_);
if (s != SCM_BOOL_F)
return gh_cdr (s);
/*
Puts the k, v in the immutable_property_alist_, which is convenient for
storing variables that are needed during the breaking process. (eg.
- Line_of_score::rank : int )
+ Line_of_score::rank : int)
*/
void
Grob::set_immutable_grob_property (const char*k, SCM v)
}
-MAKE_SCHEME_CALLBACK(Grob,molecule_extent,2);
+MAKE_SCHEME_CALLBACK (Grob,molecule_extent,2);
SCM
Grob::molecule_extent (SCM element_smob, SCM scm_axis)
{
Molecule *m = s->get_molecule ();
Interval e ;
if (m)
- e = m->extent(a);
- return ly_interval2scm ( e);
+ e = m->extent (a);
+ return ly_interval2scm (e);
}
-MAKE_SCHEME_CALLBACK(Grob,preset_extent,2);
+MAKE_SCHEME_CALLBACK (Grob,preset_extent,2);
SCM
Grob::preset_extent (SCM element_smob, SCM scm_axis)
return ly_interval2scm (Interval (l, r));
}
- return ly_interval2scm ( Interval ());
+ return ly_interval2scm (Interval ());
}
// ughugh.
String s = ly_symbol2string (funcname);
- SCM proc = get_grob_property (s.ch_C());
+ SCM proc = get_grob_property (s.ch_C ());
if (gh_procedure_p (proc))
gh_call1 (proc, this->self_scm ());
*/
void
-Grob::do_break_processing()
+Grob::do_break_processing ()
{
}
Line_of_score *
-Grob::line_l() const
+Grob::line_l () const
{
return 0;
}
if (i && i->break_status_dir () != d)
{
Item *br = i->find_prebroken_piece (d);
- return (br) ? br->self_scm () : SCM_UNDEFINED;
+ return (br) ? br->self_scm () : SCM_UNDEFINED;
}
}
else
}
void
-Grob::handle_broken_dependencies()
+Grob::handle_broken_dependencies ()
{
Spanner * s= dynamic_cast<Spanner*> (this);
if (original_l_ && s)
}
- Line_of_score *line = line_l();
+ Line_of_score *line = line_l ();
if (line && common_refpoint (line, X_AXIS) && common_refpoint (line, Y_AXIS))
{
do not do this for Line_of_score, since that would remove
references to the originals of score-elts, which get then GC'd
- (a bad thing.)
+ (a bad thing.)
*/
- suicide();
+ suicide ();
}
}
}
void
-Grob::handle_prebroken_dependencies()
+Grob::handle_prebroken_dependencies ()
{
}
Grob::translate_axis (Real y, Axis a)
{
if (isinf (y) || isnan (y))
- programming_error (_(INFINITY_MSG));
+ programming_error (_ (INFINITY_MSG));
else
{
dim_cache_[a].offset_ += y;
}
-MAKE_SCHEME_CALLBACK(Grob,point_dimension_callback,2);
+MAKE_SCHEME_CALLBACK (Grob,point_dimension_callback,2);
SCM
-Grob::point_dimension_callback (SCM , SCM )
+Grob::point_dimension_callback (SCM , SCM)
{
- return ly_interval2scm ( Interval (0,0));
+ return ly_interval2scm (Interval (0,0));
}
bool
Grob::empty_b (Axis a)const
{
- return ! (gh_pair_p (dim_cache_[a].dimension_ ) ||
- gh_procedure_p (dim_cache_[a].dimension_ ));
+ return ! (gh_pair_p (dim_cache_[a].dimension_) ||
+ gh_procedure_p (dim_cache_[a].dimension_));
}
/*
/*
FIXME: add doco on types, and should typecheck maybe?
*/
- d->dimension_= gh_call2 (d->dimension_, self_scm(), gh_int2scm (a));
+ d->dimension_= gh_call2 (d->dimension_, self_scm (), gh_int2scm (a));
}
else
return ext;
{
SCM meta = get_grob_property ("meta");
SCM nm = scm_assoc (ly_symbol2scm ("name"), meta);
- nm = (gh_pair_p (nm)) ? gh_cdr (nm) : SCM_EOL;
+ nm = (gh_pair_p (nm)) ? gh_cdr (nm) : SCM_EOL;
return gh_string_p (nm) ?ly_scm2string (nm) : classname (this);
}
{
if (!has_offset_callback_b (cb, a))
{
- dim_cache_[a].offset_callbacks_ = gh_cons (cb, dim_cache_[a].offset_callbacks_ );
+ dim_cache_[a].offset_callbacks_ = gh_cons (cb, dim_cache_[a].offset_callbacks_);
dim_cache_[a].offsets_left_ ++;
}
}
dim_cache_[a].parent_l_ = g;
}
-MAKE_SCHEME_CALLBACK(Grob,fixup_refpoint,1);
+MAKE_SCHEME_CALLBACK (Grob,fixup_refpoint,1);
SCM
Grob::fixup_refpoint (SCM smob)
{
if (parenti && i)
{
Direction my_dir = i->break_status_dir () ;
- if (my_dir!= parenti->break_status_dir())
+ if (my_dir!= parenti->break_status_dir ())
{
Item *newparent = parenti->find_prebroken_piece (my_dir);
me->set_parent (newparent, ax);
****************************************************/
-IMPLEMENT_UNSMOB(Grob, grob);
-IMPLEMENT_SMOBS(Grob);
-IMPLEMENT_DEFAULT_EQUAL_P(Grob);
+IMPLEMENT_UNSMOB (Grob, grob);
+IMPLEMENT_SMOBS (Grob);
+IMPLEMENT_DEFAULT_EQUAL_P (Grob);
SCM
Grob::mark_smob (SCM ses)
{
- Grob * s = (Grob*) SCM_CELL_WORD_1(ses);
+ Grob * s = (Grob*) SCM_CELL_WORD_1 (ses);
scm_gc_mark (s->immutable_property_alist_);
scm_gc_mark (s->mutable_property_alist_);
Grob *sc = (Grob *) gh_cdr (s);
scm_puts ("#<Grob ", port);
- scm_puts ((char *)sc->name ().ch_C(), port);
+ scm_puts ((char *)sc->name ().ch_C (), port);
/*
don't try to print properties, that is too much hassle.
void
-Grob::discretionary_processing()
+Grob::discretionary_processing ()
{
}
else
{
set_grob_property (interfaces_sym,
- gh_cons (k, get_grob_property (interfaces_sym)));
+ gh_cons (k, get_grob_property (interfaces_sym)));
}
}
-ADD_SCM_INIT_FUNC(scoreelt, init_functions);
-IMPLEMENT_TYPE_P(Grob, "ly-grob?");
+ADD_SCM_INIT_FUNC (scoreelt, init_functions);
+IMPLEMENT_TYPE_P (Grob, "ly-grob?");
Group_interface::add_thing (Grob*me, String name, SCM s)
{
me->set_grob_property (name.ch_C (),
- gh_cons (s, me->get_grob_property (name.ch_C())));
+ gh_cons (s, me->get_grob_property (name.ch_C ())));
}
int
Group_interface::count (Grob *me, String name)
{
- return scm_ilength (me->get_grob_property (name.ch_C()));
+ return scm_ilength (me->get_grob_property (name.ch_C ()));
}
void
Pointer_group_interface::add_element (Grob*me, String name, Grob*p)
{
- Group_interface::add_thing (me, name, p->self_scm());
+ Group_interface::add_thing (me, name, p->self_scm ());
}
Hairpin::brew_molecule (SCM smob)
{
Grob *me= unsmob_grob (smob);
- Spanner *spanner = dynamic_cast<Spanner*>(me);
+ Spanner *spanner = dynamic_cast<Spanner*> (me);
Real line = me->paper_l ()->get_var ("stafflinethickness");
- SCM s = me->get_grob_property("grow-direction");
+ SCM s = me->get_grob_property ("grow-direction");
if (!isdir_b (s))
{
me->suicide ();
#include "item.hh"
-MAKE_SCHEME_CALLBACK(Hara_kiri_group_spanner,y_extent,2);
+MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner,y_extent,2);
SCM
Hara_kiri_group_spanner::y_extent (SCM element_smob, SCM scm_axis)
{
void
-Hara_kiri_group_spanner::consider_suicide(Grob*me)
+Hara_kiri_group_spanner::consider_suicide (Grob*me)
{
SCM worth = me->get_grob_property ("items-worth-living");
if (gh_pair_p (worth))
We can't rely on offsets and dimensions of elements in a hara-kiri
group. Use a callback to make sure that hara-kiri has been done
before asking for offsets. */
-MAKE_SCHEME_CALLBACK(Hara_kiri_group_spanner,force_hara_kiri_callback,2);
+MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner,force_hara_kiri_callback,2);
SCM
Hara_kiri_group_spanner::force_hara_kiri_callback (SCM element_smob, SCM axis)
{
}
-MAKE_SCHEME_CALLBACK(Hara_kiri_group_spanner,force_hara_kiri_in_parent_callback,2);
+MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner,force_hara_kiri_in_parent_callback,2);
SCM
Hara_kiri_group_spanner::force_hara_kiri_in_parent_callback (SCM element_smob, SCM axis)
{
Axis a = (Axis) gh_scm2int (axis);
assert (a == Y_AXIS);
force_hara_kiri_callback (daughter->parent_l (a)->self_scm (), axis);
- return gh_double2scm ( 0.0);
+ return gh_double2scm (0.0);
}
void
protected:
virtual void acknowledge_grob (Grob_info);
- virtual void finalize();
+ virtual void finalize ();
virtual bool try_music (Music*);
- virtual void stop_translation_timestep();
+ virtual void stop_translation_timestep ();
virtual void start_translation_timestep ();
virtual void create_grobs ();
private:
if (hyphen_p_)
{
req_l_->origin ()->warning (_ ("unterminated hyphen"));
- hyphen_p_->set_bound(RIGHT, unsmob_grob (get_property ("currentCommandColumn")));
+ hyphen_p_->set_bound (RIGHT, unsmob_grob (get_property ("currentCommandColumn")));
}
}
hyphen_p_ = new Spanner (get_property ("LyricHyphen"));
- Hyphen_spanner (hyphen_p_).set_textitem (LEFT, last_lyric_l_);
+ Hyphen_spanner (hyphen_p_).set_textitem (LEFT, last_lyric_l_);
announce_grob (hyphen_p_, req_l_);
}
}
(c) 1999 Glen Prideaux <glenprideaux@iname.com>
- (adapted from lyric-extender)
+ (adapted from lyric-extender)
*/
#include <math.h>
#include "spanner.hh"
#include "item.hh"
-MAKE_SCHEME_CALLBACK(Hyphen_spanner,brew_molecule,1)
+MAKE_SCHEME_CALLBACK (Hyphen_spanner,brew_molecule,1)
SCM
Hyphen_spanner::brew_molecule (SCM smob)
Direction d = LEFT;
do
{
- common = common->common_refpoint( sp->get_bound (d), X_AXIS);
+ common = common->common_refpoint (sp->get_bound (d), X_AXIS);
}
while (flip (&d) != LEFT);
Interval bounds;
Real w = bounds.length ();
/* for length, use a geometric mean of the available space and some minimum
*/
- if(l < w)
- l = sqrt(l*w);
+ if (l < w)
+ l = sqrt (l*w);
else
{
/* OK, we have a problem. Usually this means that we're on the
the offset for stuff */
/* This test for being on the first column has been shamelessly
ripped from spanner.cc */
- Paper_column *sc = dynamic_cast<Paper_column*> (sp->get_bound(LEFT)->column_l());
+ Paper_column *sc = dynamic_cast<Paper_column*> (sp->get_bound (LEFT)->column_l ());
if (sc != NULL &&
sc->break_status_dir () == RIGHT)
{
l = w;
}
}
- Box b (Interval (-l/2,l/2), Interval (h,h+th));
+ Box b (Interval (-l/2,l/2), Interval (h,h+th));
Molecule mol (Lookup::filledbox (b));
mol.translate_axis (bounds.center ()
-sp->relative_coordinate (common, X_AXIS),
#endif
#ifndef YY_START
-#define YY_START ((yy_start - 1) / 2)
+#define YY_START() ((yy_start - 1) / 2)
#define YYSTATE YY_START
#endif
{
String msg = _f ("can't find file: `%s'", s);
msg += "\n";
- msg += _f ("(search path: `%s')", global_sources->path_C_->str ().ch_C());
+ msg += _f ("(search path: `%s')", global_sources->path_C_->str ().ch_C ());
msg += "\n";
LexerError (msg.ch_C ());
#include "lily-guile.hh"
struct Align_interface {
- DECLARE_SCHEME_CALLBACK(alignment_callback, (SCM element, SCM axis));
- DECLARE_SCHEME_CALLBACK(fixed_distance_alignment_callback, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (alignment_callback, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (fixed_distance_alignment_callback, (SCM element, SCM axis));
static void align_to_fixed_distance (Grob*,Axis a);
static void align_elements_to_extents (Grob*,Axis a);
static void set_axis (Grob*,Axis);
{
public:
DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
- DECLARE_SCHEME_CALLBACK(width_callback, (SCM,SCM));
+ DECLARE_SCHEME_CALLBACK (width_callback, (SCM,SCM));
static bool has_interface (Grob*);
};
Audio_column (Moment at_mom);
void add_audio_item (Audio_item* i_l);
- Moment at_mom() const;
- void print() const;
+ Moment at_mom () const;
+ void print () const;
Link_array<Audio_item> audio_item_l_arr_;
Performance * performance_l_;
Link_array<Translator> origin_trans_l_arr (Translator*) const;
Audio_element_info (Audio_element*, Music*);
- Audio_element_info();
+ Audio_element_info ();
};
private:
Audio_item (Audio_item const&);
- Audio_item& operator=( Audio_item const&);
+ Audio_item& operator= ( Audio_item const&);
};
class Audio_dynamic : public Audio_item
*/
struct Axis_group_interface
{
- DECLARE_SCHEME_CALLBACK(group_extent_callback, (SCM smob, SCM axis));
+ DECLARE_SCHEME_CALLBACK (group_extent_callback, (SCM smob, SCM axis));
static Interval relative_group_extent (Axis, Grob * common, SCM list);
static void add_element (Grob* me, Grob*);
static void set_interface (Grob*);
static Molecule compound_barline (Grob*, String, Real height) ;
static Molecule simple_barline (Grob*, Real wid, Real height) ;
- DECLARE_SCHEME_CALLBACK(get_staff_bar_size, (SCM ));
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
- DECLARE_SCHEME_CALLBACK(before_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (get_staff_bar_size, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
};
#endif // BAR_HH
static Item* first_visible_stem (Grob*);
static Item* last_visible_stem (Grob*);
static bool has_interface (Grob*);
- DECLARE_SCHEME_CALLBACK(rest_collision_callback, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (rest_collision_callback, (SCM element, SCM axis));
Beam (SCM);
static void add_stem (Grob*,Grob*);
static void set_beaming (Grob*,Beaming_info_list *);
static void set_stemlens (Grob*);
static int get_multiplicity (Grob*me);
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
- DECLARE_SCHEME_CALLBACK(before_line_breaking, (SCM ));
- DECLARE_SCHEME_CALLBACK(after_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM ));
/*
y-dy callbacks
Drul_array<int> beams_i_drul_;
Beaming_info (Moment, int);
- int count (Direction d);
+ int count (Direction d);
Beaming_info ();
};
struct Box {
Interval interval_a_[NO_AXES];
- Interval &x() {return interval_a_[X_AXIS]; }
- Interval &y(){ return interval_a_[Y_AXIS]; }
- Interval x() const{ return interval_a_[X_AXIS]; }
- Interval y() const{return interval_a_[Y_AXIS]; }
- Interval operator[](Axis a) const;
+ Interval &x () {return interval_a_[X_AXIS]; }
+ Interval &y (){ return interval_a_[Y_AXIS]; }
+ Interval x () const{ return interval_a_[X_AXIS]; }
+ Interval y () const{return interval_a_[Y_AXIS]; }
+ Interval operator[] (Axis a) const;
Interval &operator[] (Axis a);
void translate (Offset o);
void set_empty ();
void scale (Real r);
void unite (Box b);
- Box();
+ Box ();
Box (Interval ix, Interval iy);
};
Real linewidth_f_;
/// search all pcols which are breakable.
- Link_array<Grob> find_breaks() const;
+ Link_array<Grob> find_breaks () const;
- Array<int> find_break_indices() const;
+ Array<int> find_break_indices () const;
/// helper: solve for the columns in #curline#.
Simple_spacer* generate_spacing_problem (Link_array<Grob>, Interval) const;
- virtual Array<Column_x_positions> do_solve() const=0;
+ virtual Array<Column_x_positions> do_solve () const=0;
public:
- Simple_spacer* (*get_line_spacer)();
- Break_algorithm();
+ Simple_spacer* (*get_line_spacer) ();
+ Break_algorithm ();
void set_pscore (Paper_score*);
- Array<Column_x_positions> solve() const;
+ Array<Column_x_positions> solve () const;
};
#endif // BREAK_HH
class Break_align_interface
{
public:
- DECLARE_SCHEME_CALLBACK(before_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
static void do_alignment (Grob*);
static void set_interface (Grob*);
static bool has_interface (Grob*);
static void add_element (Grob*me, Grob*add);
- DECLARE_SCHEME_CALLBACK(alignment_callback, (SCM element, SCM axis));
- DECLARE_SCHEME_CALLBACK(self_align_callback, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (alignment_callback, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (self_align_callback, (SCM element, SCM axis));
};
#endif // BREAK_ALIGN_ITEM_HH
class Breathing_sign
{
public:
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
- DECLARE_SCHEME_CALLBACK(offset_callback, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (offset_callback, (SCM element, SCM axis));
static void set_interface (Grob*);
static bool has_interface (Grob*);
};
class Chord_name
{
public:
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
- DECLARE_SCHEME_CALLBACK(after_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM ));
};
#endif // CHORD_NAME_HH
protected:
virtual ~Chord_tremolo_iterator ();
virtual Moment pending_moment () const;
- virtual void construct_children () ;
+ virtual void construct_children () ;
virtual bool ok () const;
virtual void process (Moment) ;
virtual Music_iterator *try_music_in_children (Music *) const;
functions
``chord'' is encoded:
- (PITCHES . (INVERSION . BASS))
+ (PITCHES . (INVERSION . BASS))
Chord:: namespace... */
class Chord
struct Clef
{
- DECLARE_SCHEME_CALLBACK(before_line_breaking, (SCM ));
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
static bool has_interface (Grob*);
static void set_interface (Grob*);
};
public:
static SCM automatic_shift (Grob*);
static SCM forced_shift (Grob*);
- DECLARE_SCHEME_CALLBACK(force_shift_callback, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (force_shift_callback, (SCM element, SCM axis));
static void do_shifts (Grob*);
static void add_column (Grob*me,Grob*ncol_l);
};
Real force_f_;
bool satisfies_constraints_b_;
- Column_x_positions();
+ Column_x_positions ();
};
Break_req ();
protected:
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
class Mark_req : public Request {
public:
virtual bool do_equal_b (Request const*) const;
SCM mark_label ();
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
/*
class Tempo_req : public Request
{
public:
- Tempo_req();
+ Tempo_req ();
protected:
-
- VIRTUAL_COPY_CONS(Music);
- bool do_equal_b (Request const *) const;
+ VIRTUAL_COPY_CONS (Music);
};
/// check if we're at start of a measure.
class Barcheck_req : public Request {
public:
bool do_equal_b (Request const *) const;
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
class Breathing_sign_req : public Request {
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
/**
SCM pitch_alist ();
protected:
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
void transpose (Pitch d);
- bool do_equal_b (Request const * )const;
};
#endif // COMMANDREQUEST_HH
+
class Context_specced_music : public Music_wrapper
{
-public:
+public:
+ Context_specced_music ();
Context_specced_music (SCM);
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
#endif /* CONTEXT_SPECCED_MUSIC_HH */
source file of the GNU LilyPond music typesetter
- (C) 2000 Juergen Reuter <reuterj@ira.uka.de>
+ (C) 2000 Juergen Reuter <reuterj@ira.uka.de>
*/
#ifndef CUSTOS_HH
struct Custos
{
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
static bool has_interface (Grob*);
private:
- static void add_streepjes(Grob* me, int pos, int interspaces, Molecule* custos_p_);
+ static void add_streepjes (Grob* me, int pos, int interspaces, Molecule* custos_p_);
static Molecule create_ledger_line (Interval x_extent, Grob *me) ;
};
#define DIMENSION_CACHE_CALLBACK_HH
-typedef Interval (*Dim_cache_callback)(Grob *,Axis);
-typedef Real (*Offset_callback)(Grob *,Axis);
+typedef Interval (*Dim_cache_callback) (Grob *,Axis);
+typedef Real (*Offset_callback) (Grob *,Axis);
#endif /* DIMENSION_CACHE_CALLBACK_HH */
*/
Grob * parent_l_;
- Dimension_cache(Dimension_cache const&);
+ Dimension_cache (Dimension_cache const&);
Dimension_cache ();
void init ();
};
{
public:
static SCM direction_sym ;
- static void set (Grob*,Direction d);
+ static void set (Grob*,Direction d);
static Direction get (Grob*) ;
static bool has_interface (Grob*) ;
};
static void add_head (Grob * dotcol, Grob* rh );
static void set_interface (Grob*);
static bool has_interface (Grob*);
- DECLARE_SCHEME_CALLBACK(force_shift_callback, (SCM ,SCM));
+ DECLARE_SCHEME_CALLBACK (force_shift_callback, (SCM ,SCM));
static SCM do_shifts (SCM dotlist);
};
#endif // DOT_COLUMN_HH
class Dots
{
public:
- DECLARE_SCHEME_CALLBACK(quantised_position_callback, (SCM element, SCM axis));
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (quantised_position_callback, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
};
#endif // DOTS_HH
static int compare (Duration const&, Duration const&);
SCM smobbed_copy () const;
- DECLARE_SCHEME_CALLBACK(less_p, (SCM a, SCM b));
- DECLARE_SIMPLE_SMOBS(Duration,);
+ DECLARE_SCHEME_CALLBACK (less_p, (SCM a, SCM b));
+ DECLARE_SIMPLE_SMOBS (Duration,);
public:
int duration_log ()const;
};
#include "compare.hh"
-INSTANTIATE_COMPARE(Duration, Duration::compare);
-Duration*unsmob_duration(SCM);
+INSTANTIATE_COMPARE (Duration, Duration::compare);
+Duration*unsmob_duration (SCM);
// int compare (Array<Duration>*, Array<Duration>*);
#endif // DURATION_HH
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
- virtual void do_announces();
+ virtual void do_announces ();
virtual void announce_grob (Grob_info);
virtual void process_music ();
private:
virtual void announce_grob (Grob_info);
virtual void process_music ();
public:
- VIRTUAL_COPY_CONS(Translator);
- Engraver_group_engraver * daddy_grav_l() const;
+ VIRTUAL_COPY_CONS (Translator);
+ Engraver_group_engraver * daddy_grav_l () const;
/**
override other ctor
*/
static Font_metric * get_font (Grob*, SCM alist_chain);
static Font_metric * get_default_font (Grob*);
static SCM add_style (Grob*, SCM style, SCM alist_chain);
- static bool wild_compare(SCM field_val, SCM val);
- DECLARE_SCHEME_CALLBACK(properties_to_font_name, (SCM,SCM));
+ static bool wild_compare (SCM field_val, SCM val);
+ DECLARE_SCHEME_CALLBACK (properties_to_font_name, (SCM,SCM));
};
#endif /* FONT_INTERFACE_HH */
virtual Box text_dimension (String) const;
virtual Molecule find_by_name (String) const;
- DECLARE_SMOBS(Font_metric,);
+ DECLARE_SMOBS (Font_metric,);
private:
Font_metric (Font_metric const&); // no copy.
protected:
} _ ## y ## _ctor_init; \
-#define ADD_GLOBAL_CTOR(x) ADD_GLOBAL_CTOR_WITHNAME(x,x);
+#define ADD_GLOBAL_CTOR(x) ADD_GLOBAL_CTOR_WITHNAME (x,x);
typedef void (* Global_ctor ) ();
class Global_translator : public virtual Translator_group{
PQueue<Moment> extra_mom_pq_;
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Moment final_mom_;
Moment prev_mom_;
Moment now_mom_;
- Global_translator();
+ Global_translator ();
- int moments_left_i() const;
+ int moments_left_i () const;
Moment sneaky_insert_extra_moment (Moment);
void add_moment_to_process (Moment);
void run_iterator_on_me (Music_iterator*);
virtual Music_output *get_output_p ();
virtual void prepare (Moment);
virtual void one_time_step ();
- virtual void finish();
- virtual void start();
+ virtual void finish ();
+ virtual void start ();
virtual Moment now_mom () const;
*/
struct Gourlay_breaking : public Break_algorithm
{
- Array<Column_x_positions> do_solve() const;
- Gourlay_breaking();
+ Array<Column_x_positions> do_solve () const;
+ Gourlay_breaking ();
Real combine_demerits (Column_x_positions const&,Column_x_positions const&) const;
};
#endif // GOURLAY_BREAKING_HH
public:
static void set_interface (Grob*);
static bool has_interface (Grob*);
- DECLARE_SCHEME_CALLBACK(before_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
};
#endif /* GRACE_ALIGN_ITEM_HH */
bool calling_self_b_;
bool pass_to_top_b (Music *) const;
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Grace_engraver_group ();
protected:
virtual void initialize ();
class Grace_music : public Music_wrapper
{
public:
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
Grace_music (SCM);
+ Grace_music ();
protected:
virtual void compress (Moment);
virtual Moment length_mom () const;
source file of the GNU LilyPond music typesetter
- (c) 1999--2001 Jan Nieuwenhuizen <janneke@gnu.org>
+ (c) 1999--2001 Jan Nieuwenhuizen <janneke@gnu.org>
*/
Array<Audio_element_info> announce_to_top_;
bool calling_self_b_;
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Grace_performer_group ();
protected:
virtual void announce_element (Audio_element_info);
Grob_info (Grob*, Music*);
- Grob_info();
+ Grob_info ();
};
bool linked_b () const;
- VIRTUAL_COPY_CONS(Grob);
+ VIRTUAL_COPY_CONS (Grob);
/**
Recursively track all dependencies of this Grob. The
void suicide ();
- DECLARE_SCHEME_CALLBACK(preset_extent, (SCM smob, SCM axis));
- DECLARE_SCHEME_CALLBACK(point_dimension_callback, (SCM smob, SCM axis));
- DECLARE_SCHEME_CALLBACK(molecule_extent, (SCM smob, SCM axis));
+ DECLARE_SCHEME_CALLBACK (preset_extent, (SCM smob, SCM axis));
+ DECLARE_SCHEME_CALLBACK (point_dimension_callback, (SCM smob, SCM axis));
+ DECLARE_SCHEME_CALLBACK (molecule_extent, (SCM smob, SCM axis));
static SCM ly_set_grob_property (SCM, SCM,SCM);
virtual void handle_prebroken_dependencies ();
- DECLARE_SMOBS(Grob,foo);
+ DECLARE_SMOBS (Grob,foo);
void init ();
void set_parent (Grob* e, Axis);
Grob *parent_l (Axis a) const;
- DECLARE_SCHEME_CALLBACK(fixup_refpoint, (SCM));
+ DECLARE_SCHEME_CALLBACK (fixup_refpoint, (SCM));
};
Grob * unsmob_grob (SCM);
class Hara_kiri_group_spanner
{
public:
- DECLARE_SCHEME_CALLBACK(force_hara_kiri_callback, (SCM ,SCM));
- DECLARE_SCHEME_CALLBACK(y_extent, (SCM smob, SCM axis));
- DECLARE_SCHEME_CALLBACK(force_hara_kiri_in_parent_callback, (SCM ,SCM));
+ DECLARE_SCHEME_CALLBACK (force_hara_kiri_callback, (SCM ,SCM));
+ DECLARE_SCHEME_CALLBACK (y_extent, (SCM smob, SCM axis));
+ DECLARE_SCHEME_CALLBACK (force_hara_kiri_in_parent_callback, (SCM ,SCM));
static void add_element (Grob *me, Grob *e);
static void set_interface (Grob*me);
static bool has_interface (Grob*);
{
public:
Spanner* elt_l_;
- Hyphen_spanner (Spanner*);
+ Hyphen_spanner (Spanner*);
void set_textitem (Direction, Grob*);
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
};
#endif // HYPHEN_SPANNER_HH
Interpretation_context_handle* clone () const;
void set_translator (Translator_group*);
bool try_music (Music *);
- void operator =(Interpretation_context_handle const&);
+ void operator = (Interpretation_context_handle const&);
Interpretation_context_handle (Interpretation_context_handle const&);
Translator_group * report_to_l () const;
Drul_array<Item*> broken_to_drul_;
public:
- VIRTUAL_COPY_CONS(Grob);
+ VIRTUAL_COPY_CONS (Grob);
Item (SCM);
Item (Item const &);
Item * find_prebroken_piece (Direction) const;
Grob * find_broken_piece (Line_of_score*) const;
- virtual Line_of_score * line_l() const;
+ virtual Line_of_score * line_l () const;
virtual Paper_column * column_l () const;
virtual void handle_prebroken_dependencies ();
protected:
virtual void discretionary_processing ();
- void copy_breakable_items();
+ void copy_breakable_items ();
virtual SCM do_derived_mark ();
};
struct Key_item
{
- static int calculate_position(Grob*,SCM pair) ;
+ static int calculate_position (Grob*,SCM pair) ;
static void set_interface (Grob*);
static bool has_interface (Grob*);
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
};
#endif // KEYITEM_HH
source file of the GNU LilyPond music typesetter
-(c) 2000--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 2000--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
/*
snarfing.
*/
-void add_scm_init_func (void (*)());
+void add_scm_init_func (void (*) ());
-typedef SCM(*Scheme_function_unknown)();
+typedef SCM (*Scheme_function_unknown) ();
#if __GNUC_MINOR__ >= 96
-typedef SCM(*Scheme_function_0)();
-typedef SCM(*Scheme_function_1)(SCM);
-typedef SCM(*Scheme_function_2)(SCM,SCM);
+typedef SCM (*Scheme_function_0) ();
+typedef SCM (*Scheme_function_1) (SCM);
+typedef SCM (*Scheme_function_2) (SCM,SCM);
#else
-typedef SCM(*Scheme_function_0)(...);
-typedef SCM(*Scheme_function_1)(...);
-typedef SCM(*Scheme_function_2)(...);
+typedef SCM (*Scheme_function_0) (...);
+typedef SCM (*Scheme_function_1) (...);
+typedef SCM (*Scheme_function_2) (...);
#endif
#define DECLARE_SCHEME_CALLBACK(NAME,ARGS) \
TYPE ## _ ## FUNC ## _init_functions () \
{ \
TYPE :: FUNC ## _proc = gh_new_procedure ## ARGCOUNT ## _0 (#TYPE "::" #FUNC, \
- ((Scheme_function_ ## ARGCOUNT)TYPE :: FUNC)); \
+ ((Scheme_function_ ## ARGCOUNT)TYPE :: FUNC)); \
} \
\
-ADD_SCM_INIT_FUNC(TYPE ## _ ## FUNC ## _callback, TYPE ## _ ## FUNC ## _init_functions); \
+ADD_SCM_INIT_FUNC (TYPE ## _ ## FUNC ## _callback, TYPE ## _ ## FUNC ## _init_functions); \
#define ADD_SCM_INIT_FUNC(name, func)\
source file of the GNU LilyPond music typesetter
- (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef LILY_PROTO_HH
class Tie_req;
class Time_scaled_music;
class Time_scaled_music_iterator;
-class Time_signature_change_req;
class Time_signature_performer;
class Timing_engraver;
-class Timing_req;
class Timing_translator;
class Translation_property;
class Translator;
Spanner *staffline_p_;
virtual void create_line_spanner ();
- virtual void initialize();
- virtual void finalize();
+ virtual void initialize ();
+ virtual void finalize ();
virtual void typeset_grob (Grob*);
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
- Line_group_engraver_group();
+ Line_group_engraver_group ();
};
{
public:
int rank_i_;
- void post_processing(bool);
+ void post_processing (bool);
- Line_of_score(SCM);
+ Line_of_score (SCM);
/// is #c# contained in #*this#?
bool contains_b (Paper_column const *c) const;
int element_count () const;
void output_scheme (SCM);
void pre_processing ();
protected:
- VIRTUAL_COPY_CONS(Grob);
+ VIRTUAL_COPY_CONS (Grob);
};
#endif
{\
scm_make_gsubr (FUNCNAME, 1, 0, 0, (Scheme_function_unknown) CL::smob_p);\
}\
-ADD_SCM_INIT_FUNC(init_type_p_ ## CL, init_type_p_ ## CL)
+ADD_SCM_INIT_FUNC (init_type_p_ ## CL, init_type_p_ ## CL)
#ifndef SCM_CELL_TYPE
-#define SCM_CELL_TYPE(X) SCM_CAR(X)
+#define SCM_CELL_TYPE(X) SCM_CAR (X)
#endif
#ifndef SCM_CELL_WORD_1
-#define SCM_CELL_WORD_1(X) SCM_CDR(X)
+#define SCM_CELL_WORD_1(X) SCM_CDR (X)
#endif
SCM \
CL::smob_p (SCM s) \
{ \
- if (SCM_NIMP(s) && SCM_CELL_TYPE(s) == smob_tag_) \
+ if (SCM_NIMP (s) && SCM_CELL_TYPE (s) == smob_tag_) \
return SCM_BOOL_T; \
else \
return SCM_BOOL_F; \
SCM CL::smobbed_self () const \
{ \
SCM s; \
- s = gh_cons (SCM_PACK(CL::smob_tag_), SCM_PACK(this)); \
- scm_done_malloc(sizeof(CL)); \
+ s = gh_cons (SCM_PACK (CL::smob_tag_), SCM_PACK (this)); \
+ scm_done_malloc (sizeof (CL)); \
\
return s; \
} \
CL * \
CL::unsmob (SCM s) \
{ \
- if (SCM_NIMP(s) && SCM_CELL_TYPE(s) == smob_tag_) \
- return (CL*) SCM_CELL_WORD_1(s); \
+ if (SCM_NIMP (s) && SCM_CELL_TYPE (s) == smob_tag_) \
+ return (CL*) SCM_CELL_WORD_1 (s); \
else \
return 0; \
} \
scm_sizet \
CL::free_smob (SCM ses) \
{ \
- CL * s = (CL*) SCM_CDR(ses); \
+ CL * s = (CL*) SCM_CDR (ses); \
delete s; \
return sizeof (CL); \
} \
-ADD_SCM_INIT_FUNC(CL, CL::init_smobs)
+ADD_SCM_INIT_FUNC (CL, CL::init_smobs)
#define IMPLEMENT_SMOBS(CL) \
-IMPLEMENT_SIMPLE_SMOBS(CL) \
+IMPLEMENT_SIMPLE_SMOBS (CL) \
SCM \
CL::smobify_self () \
{ \
that S isn't GC-ed from under us. \
\
We don't use smobbed_self () to ensure that mark_smob () doesn't have to \
- deal half-initialized objects: scm_done_malloc( ) might trigger GC. \
+ deal half-initialized objects: scm_done_malloc ( ) might trigger GC. \
the warning in smobs.hh is just to be doubleplus goodly sure \
*/ \
SCM s; \
- SCM_NEWCELL(s); \
- SCM_SETCAR(s,CL::smob_tag_); \
- SCM_SETCDR (s, SCM_PACK(this)); \
+ SCM_NEWCELL (s); \
+ SCM_SETCAR (s,CL::smob_tag_); \
+ SCM_SETCDR (s, SCM_PACK (this)); \
self_scm_ = s; \
- scm_done_malloc(sizeof(CL)); \
+ scm_done_malloc (sizeof (CL)); \
return s; \
}
Music * music_l () const;
Music * lyrics_l () const;
+ Lyric_combine_music ();
Lyric_combine_music (SCM);
virtual void transpose (Pitch);
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
virtual Moment length_mom () const;
virtual Pitch to_relative_octave (Pitch);
virtual void compress (Moment);
{
public:
static void set_textitem (Spanner*, Direction, Grob*);
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
};
#endif // EXTENDER_SPANNER_HH
/*
* Build an engraver that catches noteheads and lyrics.
-(It needs to be in a context above Staff and Lyrics, eg. in Score
+ (It needs to be in a context above Staff and Lyrics, eg. in Score
context.)
* Determine which heads belong to which lyrics
-(eg. by looking at the names of their originating contexts, or maybe
+ (eg. by looking at the names of their originating contexts, or maybe
some \properties)
* Attach the lyrics to the appropriate heads
-(by doing lyric->set_parent (head, X_AXIS), that will fix the current
+ (by doing lyric->set_parent (head, X_AXIS), that will fix the current
noteheadwidth guessing kludge)
* Check if the lyric syllables end or start a phrase.
-(eg. check if the syllable ends with punctuation, and remember that
+ (eg. check if the syllable ends with punctuation, and remember that
fact for the next one.)
* Adjust their alignment accordingly.
-(eg. by doing lyric->add_offset_callback(centered_on_parent,X_AXIS)
+ (eg. by doing lyric->add_offset_callback (centered_on_parent,X_AXIS)
and setting self-alignment-X)
* Add a property to switch on/off the engraver (for multi stanza
class Lyric_phrasing_engraver : public Engraver
{
protected:
- virtual void acknowledge_grob(Grob_info);
+ virtual void acknowledge_grob (Grob_info);
virtual void create_grobs ();
- virtual void stop_translation_timestep();
+ virtual void stop_translation_timestep ();
virtual void finalize ();
private:
- void record_notehead(const String &context_id, Grob * notehead);
- void record_lyric(const String &context_id, Grob * lyric);
- void record_melisma(const String &context_id);
- void record_extender(const String &context_id, Grob * extender);
- Syllable_group * lookup_context_id(const String &context_id);
+ void record_notehead (const String &context_id, Grob * notehead);
+ void record_lyric (const String &context_id, Grob * lyric);
+ void record_melisma (const String &context_id);
+ void record_extender (const String &context_id, Grob * extender);
+ Syllable_group * lookup_context_id (const String &context_id);
public:
Lyric_phrasing_engraver ();
bool melisma_b_;
Real group_translation_f_;
public:
- static SCM make_entry();
- void set_first_in_phrase(bool f);
- void set_notehead(Grob * notehead);
- void add_lyric(Grob * lyric);
- void add_extender(Grob * extender);
- void set_melisma() { melisma_b_ = true; }
- bool get_melisma() { return melisma_b_; }
- int lyric_count() { return lyric_list_.size(); }
- void clear();
- bool is_empty();
- bool set_lyric_align(const char *punc, Grob *default_notehead_l);
- void adjust_melisma_align();
- int appropriate_alignment(const char *punc);
- Real amount_to_translate();
- void next_lyric();
- void copy(Syllable_group *);
+ static SCM make_entry ();
+ void set_first_in_phrase (bool f);
+ void set_notehead (Grob * notehead);
+ void add_lyric (Grob * lyric);
+ void add_extender (Grob * extender);
+ void set_melisma () { melisma_b_ = true; }
+ bool get_melisma () { return melisma_b_; }
+ int lyric_count () { return lyric_list_.size (); }
+ void clear ();
+ bool is_empty ();
+ bool set_lyric_align (const char *punc, Grob *default_notehead_l);
+ void adjust_melisma_align ();
+ int appropriate_alignment (const char *punc);
+ Real amount_to_translate ();
+ void next_lyric ();
+ void copy (Syllable_group *);
private:
- Syllable_group();
- DECLARE_SIMPLE_SMOBS(Syllable_group,);
+ Syllable_group ();
+ DECLARE_SIMPLE_SMOBS (Syllable_group,);
} ;
Syllable_group * unsmob_voice_entry (SCM);
#include "lily-proto.hh"
-void debug_init();
+void debug_init ();
void set_debug (bool);
-void do_scores();
-void clear_scores();
+void do_scores ();
+void clear_scores ();
void add_score (Score* s);
void set_default_output (String s);
String find_file (String);
static int score_count_i_;
public:
- VIRTUAL_COPY_CONS(Music_output_def);
+ VIRTUAL_COPY_CONS (Music_output_def);
- Midi_def();
+ Midi_def ();
int get_tempo_i (Moment moment);
void set_tempo (Moment moment, int count_per_minute_i);
virtual int get_next_score_count () const;
- static void reset_score_count();
+ static void reset_score_count ();
};
#endif // MIDI_DEF_HH
/// Midi outputfile
struct Midi_stream {
Midi_stream (String filename_str);
- ~Midi_stream();
+ ~Midi_stream ();
- Midi_stream& operator <<( String str);
- Midi_stream& operator <<( Midi_item const& midi_c_r);
- Midi_stream& operator <<( int i);
+ Midi_stream& operator << ( String str);
+ Midi_stream& operator << ( Midi_item const& midi_c_r);
+ Midi_stream& operator << ( int i);
- void open();
+ void open ();
ostream* os_p_;
String filename_str_;
struct Midi_note_event : PQueue_ent<Moment, Midi_note*>
{
bool ignore_b_;
- Midi_note_event();
+ Midi_note_event ();
};
int compare (Midi_note_event const& left, Midi_note_event const& right);
{
public:
Midi_walker (Audio_staff* audio_staff_l, Midi_track* midi_track_l);
- ~Midi_walker();
+ ~Midi_walker ();
- void process();
- void operator ++(int);
+ void process ();
+ void operator ++ (int);
bool ok () const;
private:
void do_start_note (Midi_note* note_p);
/*
- minmax.cc -- implement minmax()
+ minmax.cc -- implement minmax ()
source file of the GNU LilyPond music typesetter
#include "array.hh"
#include "interval.hh"
-double log_2(double x) ;
-int intlog2(int d);
+double log_2 (double x) ;
+int intlog2 (int d);
inline int
sign (int i)
Empty molecules have empty dimensions. If add_at_edge is used to
init the molecule, we assume that
- DIMENSIONS = (Interval(0,0),Interval(0,0)
+ DIMENSIONS = (Interval (0,0),Interval (0,0)
*/
class Molecule {
Box dim_;
SCM expr_;
- DECLARE_SIMPLE_SMOBS(Molecule,);
+ DECLARE_SIMPLE_SMOBS (Molecule,);
public:
Molecule (Box, SCM s);
- Molecule();
+ Molecule ();
SCM smobbed_copy () const;
SCM get_expr () const;
/**
- Set dimensions to empty, or to (Interval(0,0),Interval(0,0) */
+ Set dimensions to empty, or to (Interval (0,0),Interval (0,0) */
void set_empty (bool);
void add_at_edge (Axis a, Direction d, const Molecule &m, Real padding);
void add_molecule (Molecule const &m);
/**
align D direction in axis A.
- If D == CENTER, then move the dimension(A).center() to (0,0)
+ If D == CENTER, then move the dimension (A).center () to (0,0)
- Else, move so dimension(A)[D] == 0.0
+ Else, move so dimension (A)[D] == 0.0
*/
void align_to (Axis a, Direction d);
codify THIS into a Scheme expression.
*/
SCM create_scheme () const;
- bool empty_b() const;
+ bool empty_b () const;
static SCM ly_get_molecule_extent (SCM mol, SCM axis);
FIXME: remove self_scm_ and then remove this class */
class Moment : public Rational
{
- DECLARE_SIMPLE_SMOBS(Moment,);
+ DECLARE_SIMPLE_SMOBS (Moment,);
public:
Moment () { }
Moment (int m) : Rational (m) { }
public:
static void set_interface (Grob*);
static bool has_interface (Grob*);
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (percent, (SCM));
static void add_column (Grob*,Item*);
- DECLARE_SCHEME_CALLBACK(set_spacing_rods, (SCM ));
+ DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM ));
};
#endif /* MULTI_MEASURE_REST_HH */
--- /dev/null
+/*
+ music-constructor.hh -- declare Music_constructor
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef MUSIC_CONSTRUCTOR_HH
+#define MUSIC_CONSTRUCTOR_HH
+
+#include "lily-proto.hh"
+#include "string.hh"
+#include "global-ctor.hh"
+
+#define ADD_MUSIC(type) \
+Music * _ ## type ## _ctor ()\
+{\
+ return new type;\
+}\
+static void _ ## type ## _adder () {\
+ add_music_ctor (#type, & _ ## type ## _ctor);\
+}\
+ADD_GLOBAL_CTOR (_ ## type ## _adder);
+
+void add_music_ctor (String, Music* (*) ());
+Music*get_music (String);
+
+
+
+
+
+#endif /* MUSIC_CONSTRUCTOR_HH */
+
ok () -- events left ?
pending_mom () -- time tag of the next event to be processed.
- PRECONDITION: this->ok() holds.
+ PRECONDITION: this->ok () holds.
process (M) -- process all at M (Precondition: no events exist
- before M, this->ok() holds). Side-effects:
+ before M, this->ok () holds). Side-effects:
* This removes all events at M from the pending queue.
} \
SCM Class :: constructor_cxx_function;\
void \
-Class ## _constructor_init() \
+Class ## _constructor_init () \
{ \
SCM s = smobify_cxx_function (& Class ## _ctor); \
scm_permanent_object (s);\
gh_define (#Class "::constructor", s);\
Class :: constructor_cxx_function = s;\
}\
-ADD_SCM_INIT_FUNC(Class ## _ctor_init, Class ## _constructor_init);
+ADD_SCM_INIT_FUNC (Class ## _ctor_init, Class ## _constructor_init);
class Simultaneous_music : public Music_sequence
{
public:
- VIRTUAL_COPY_CONS(Music);
- Simultaneous_music(SCM);
+ VIRTUAL_COPY_CONS (Music);
+ Simultaneous_music (SCM);
virtual Pitch to_relative_octave (Pitch);
virtual Moment length_mom () const;
+
+ Simultaneous_music ();
};
/**
class Request_chord : public Simultaneous_music
{
public:
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
virtual Pitch to_relative_octave (Pitch);
- Request_chord(SCM list);
+ Request_chord (SCM list);
+
+ Request_chord ();
};
/**
class Sequential_music : public Music_sequence
{
public:
- VIRTUAL_COPY_CONS(Music);
- Sequential_music(SCM);
+ VIRTUAL_COPY_CONS (Music);
+ Sequential_music (SCM);
virtual Moment length_mom () const;
+
+ Sequential_music ();
};
#endif // Music_sequence_HH
SCM scaled_fonts_;
SCM style_sheet_;
- VIRTUAL_COPY_CONS(Music_output_def);
+ VIRTUAL_COPY_CONS (Music_output_def);
Music_output_def (Music_output_def const&);
Music_output_def ();
virtual int get_next_score_count () const;
SCM find_translator_l (SCM name) const;
String outname_str () ;
- DECLARE_SMOBS(Music_output_def,);
+ DECLARE_SMOBS (Music_output_def,);
};
Music_output_def* unsmob_music_output_def (SCM);
String origin_str_;
int errorlevel_i_;
- virtual void process() {}
+ virtual void process () {}
virtual ~Music_output (){}
- Music_output()
+ Music_output ()
{
errorlevel_i_ = 0;
}
{
public:
Music_sequence (SCM h);
-
+ Music_sequence ();
SCM music_list () const;
void append_music (Music *);
- VIRTUAL_COPY_CONS(Music);
-
+ VIRTUAL_COPY_CONS (Music);
+
Pitch do_relative_octave (Pitch p, bool b);
virtual void transpose (Pitch );
void truncate (int k);
Music_wrapper_iterator (Music_wrapper_iterator const&);
~Music_wrapper_iterator ();
- virtual void construct_children () ;
+ virtual void construct_children () ;
virtual Moment pending_moment () const;
virtual bool ok () const;
virtual SCM get_music (Moment)const;
{
public:
Music_wrapper (SCM);
+ Music_wrapper ();
Music * element () const;
virtual void transpose (Pitch);
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
virtual Moment length_mom () const;
virtual Pitch to_relative_octave (Pitch);
virtual void compress (Moment);
#include "lily-proto.hh"
#include "string.hh"
#include "smobs.hh"
+#include "music-constructor.hh"
+
/** Music is anything that has duration and supports both time compression and
transposition.
In Lily, everything that can be thought to have a length and a pitch
- (which has a duration which can be transposed) is considered "music",
+ (which has a duration which can be transposed) is considered "music",
Music is hierarchical:
/// The duration of this piece of music
virtual Moment length_mom () const;
- void print() const;
+ void print () const;
/// Transpose, with the interval central C to #p#
virtual void transpose (Pitch p);
/// Scale the music in time by #factor#.
virtual void compress (Moment factor);
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
Music (Music const &m);
Music (SCM);
protected:
- DECLARE_SMOBS(Music,);
+ DECLARE_SMOBS (Music,);
SCM immutable_property_alist_;
SCM mutable_property_alist_;
};
void compress (Moment);
virtual Moment length_mom () const;
static int compare (Rhythmic_req const&,Rhythmic_req const&);
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
class Skip_req : public Rhythmic_req {
public:
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
class Articulation_req : public Script_req
{
public:
- String get_articulation_str();
+ String get_articulation_str ();
protected:
virtual bool do_equal_b (Request const*) const;
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
class Text_script_req : public Script_req
virtual void transpose (Pitch delta);
virtual bool do_equal_b (Request const*) const;
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
/*
class Note_req : public Rhythmic_req, virtual public Melodic_req {
public:
- Note_req();
+ Note_req ();
protected:
bool do_equal_b (Request const*) const;
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
/**
*/
class Rest_req : public Rhythmic_req {
public:
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
/// an extender line
class Extender_req : public Request {
public:
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
/// a centred hyphen
class Hyphen_req : public Request {
public:
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
/** is anyone playing a note?
class Melisma_req : public Span_req
{
public:
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
#include "pitch.hh"
#include "protected-scm.hh"
-bool busy_parsing();
-void kill_lexer();
-void set_lexer();
+bool busy_parsing ();
+void kill_lexer ();
+void set_lexer ();
/// lexer for Lilypond
class My_lily_lexer : public Includable_lexer
void start_main_input ();
SCM lookup_identifier (String s);
- void push_note_state();
- void push_chord_state();
- void push_lyric_state();
- void pop_state();
+ void push_note_state ();
+ void push_chord_state ();
+ void push_lyric_state ();
+ void pop_state ();
void LexerError (char const *);
void set_identifier (String str, SCM);
- bool note_state_b() const;
- bool chord_state_b() const;
- bool lyric_state_b() const;
+ bool note_state_b () const;
+ bool chord_state_b () const;
+ bool lyric_state_b () const;
private:
int lookup_keyword (String);
int scan_bare_word (String);
int scan_escaped_word (String);
- char escaped_char(char) const;
+ char escaped_char (char) const;
};
#endif
{
public:
My_lily_parser (Sources * sources_l);
- ~My_lily_parser();
+ ~My_lily_parser ();
- void do_init_file();
+ void do_init_file ();
void parse_file ( String init_str, String file_str);
void set_version_check (bool ignore);
My_lily_lexer * lexer_p_;
bool ignore_version_b_;
- Input here_input() const;
- void remember_spot();
- Input pop_spot();
+ Input here_input () const;
+ void remember_spot ();
+ Input pop_spot ();
- void do_yyparse();
+ void do_yyparse ();
void parser_error (String);
void set_yydebug (bool);
- DECLARE_SCHEME_CALLBACK(paper_description, ());
+ DECLARE_SCHEME_CALLBACK (paper_description, ());
private:
Array<Input> define_spot_array_;
- char const* here_ch_C() const;
+ char const* here_ch_C () const;
Simultaneous_music * get_chord (Pitch tonic, Array<Pitch>* add_arr_p,
Array<Pitch>* sub_arr_p, Pitch* inversion_p,
#include "item.hh"
/** a struct for treating a group of noteheads (noteheads, stem
- (chord) and scripts) as a single entity.
+ (chord) and scripts) as a single entity.
UGR. Junkme. refpoint should be the notehead, dir should come from stem.
*/
static Direction dir (Grob*me);
- static Slice head_positions_interval(Grob* me);
+ static Slice head_positions_interval (Grob* me);
static Direction static_dir (Grob*);
- static void translate_rests(Grob*me,int dy);
+ static void translate_rests (Grob*me,int dy);
static Grob * first_head (Grob*me);
static void set_stem (Grob*me,Grob*);
static void set_dotcol (Grob*me,Grob*);
static bool rest_b (Grob*me);
static bool has_interface (Grob*);
static void set_interface (Grob*);
- static Item *stem_l(Grob*);
+ static Item *stem_l (Grob*);
};
#endif // NOTE_COLUMN_HH
class Note_head
{
public:
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
static Molecule ledger_line (Interval, Grob*) ;
- DECLARE_SCHEME_CALLBACK(brew_ez_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_ez_molecule, (SCM ));
static bool has_interface (Grob*);
};
class Paper_column : public Item
{
public:
- VIRTUAL_COPY_CONS(Grob);
+ VIRTUAL_COPY_CONS (Grob);
/*
Not (yet) in scm, because of messy effects when a column commits suicide.
Line_of_score *line_l_;
/// which one (left =0)
- static int rank_i(Grob*);
+ static int rank_i (Grob*);
Paper_column (SCM);
bool musical_b () const;
class Paper_def : public Music_output_def
{
protected:
- VIRTUAL_COPY_CONS(Music_output_def);
+ VIRTUAL_COPY_CONS (Music_output_def);
public:
itself.
The Paper_outputter contains a reference to an output stream
- (Paper_stream). */
+ (Paper_stream). */
class Paper_outputter
{
protected:
/* MAIN ROUTINES */
- virtual void process();
+ virtual void process ();
private:
/// before calc_breaking
- void preprocess();
- void calc_idealspacing();
+ void preprocess ();
+ void calc_idealspacing ();
/// calculate where the lines are to be broken, and use results
- Array<Column_x_positions> calc_breaking();
+ Array<Column_x_positions> calc_breaking ();
/// after calc_breaking
- void postprocess();
+ void postprocess ();
Paper_score (Paper_score const &);
};
Paper_stream (String filename);
/// delegate conversion to scalar class
- Paper_stream &operator <<(String);
+ Paper_stream &operator << (String);
/// close the file
- ~Paper_stream();
+ ~Paper_stream ();
private:
Paper_stream (Paper_stream const&);
- void break_line();
+ void break_line ();
};
class ostream;
--- /dev/null
+/*
+ percent-repeat-iterator.hh -- declare Percent_repeat_iterator
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef PERCENT_REPEAT_ITERATOR_HH
+#define PERCENT_REPEAT_ITERATOR_HH
+
+#include "music-iterator.hh"
+
+class Percent_repeat_iterator : public Music_iterator
+{
+public:
+ VIRTUAL_COPY_CONS (Music_iterator);
+ static SCM constructor_cxx_function;
+ Percent_repeat_iterator ();
+ Percent_repeat_iterator (Percent_repeat_iterator const & );
+protected:
+ virtual ~Percent_repeat_iterator ();
+ virtual Moment pending_moment () const;
+ virtual void construct_children () ;
+ virtual bool ok () const;
+ virtual void process (Moment) ;
+ virtual Music_iterator *try_music_in_children (Music *) const;
+
+private:
+ Music_iterator * child_iter_p_;
+ Moment finish_mom_;
+};
+
+
+#endif /* PERCENT_REPEAT_ITERATOR_HH */
void output (Midi_stream& midi_stream_r);
void output_header_track (Midi_stream& midi_stream_r);
- void print() const;
- void process();
+ void print () const;
+ void process ();
Link_array<Audio_staff> audio_staff_l_arr_;
class Performer_group_performer : public Performer, public virtual Translator_group {
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
- virtual void do_announces();
+ virtual void do_announces ();
virtual void announce_element (Audio_element_info);
protected:
Array<Audio_element_info> announce_info_arr_;
class Performer : public virtual Translator
{
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
friend class Performer_group_performer;
- Performer_group_performer* daddy_perf_l() const;
+ Performer_group_performer* daddy_perf_l () const;
protected:
virtual void announce_element (Audio_element_info);
virtual void acknowledge_audio_element (Audio_element_info);
virtual void create_audio_elements ();
- virtual int get_tempo_i() const;
+ virtual int get_tempo_i () const;
virtual void play_element (Audio_element * elem_p );
};
static int compare (Pitch const&,Pitch const&);
/// return large part of interval from central c
- int steps() const;
+ int steps () const;
/// return pitch from central c (in halfnotes)
- int semitone_pitch() const;
+ int semitone_pitch () const;
String str () const;
static SCM transpose (SCM p, SCM delta);
SCM smobbed_copy () const;
- DECLARE_SCHEME_CALLBACK(less_p, (SCM a, SCM b));
- DECLARE_SIMPLE_SMOBS(Pitch,);
+ DECLARE_SCHEME_CALLBACK (less_p, (SCM a, SCM b));
+ DECLARE_SIMPLE_SMOBS (Pitch,);
};
Pitch* unsmob_pitch (SCM);
#include "compare.hh"
-INSTANTIATE_COMPARE(Pitch, Pitch::compare);
+INSTANTIATE_COMPARE (Pitch, Pitch::compare);
int compare (Array<Pitch>*, Array<Pitch>*);
Protected_scm (Protected_scm const &);
~Protected_scm ();
Protected_scm &operator = (SCM);
- Protected_scm &operator =( Protected_scm const&);
+ Protected_scm &operator = ( Protected_scm const&);
operator SCM () const;
SCM to_SCM () const;
};
{
public:
Relative_octave_music (SCM l);
+ Relative_octave_music ();
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
virtual Pitch to_relative_octave (Pitch);
};
Music_sequence * alternatives () const;
/// how often do we repeat?
- int repeat_count( ) const;
+ int repeat_count ( ) const;
virtual Pitch to_relative_octave (Pitch);
Moment body_length_mom () const;
Moment alternatives_length_mom (bool fold) const;
Moment alternatives_volta_length_mom () const;
- DECLARE_SCHEME_CALLBACK(unfolded_music_length, (SCM));
- DECLARE_SCHEME_CALLBACK(volta_music_length, (SCM));
- DECLARE_SCHEME_CALLBACK(folded_music_length, (SCM));
+ DECLARE_SCHEME_CALLBACK (unfolded_music_length, (SCM));
+ DECLARE_SCHEME_CALLBACK (volta_music_length, (SCM));
+ DECLARE_SCHEME_CALLBACK (folded_music_length, (SCM));
/// Transpose, with the interval central C to #p#
virtual void transpose (Pitch p);
/// Scale the music in time by #factor#.
virtual void compress (Moment factor);
- VIRTUAL_COPY_CONS(Music);
-
+ VIRTUAL_COPY_CONS (Music);
+ Repeated_music ();
Repeated_music (SCM);
};
virtual SCM get_music (Moment) const;
protected:
virtual void process (Moment);
- virtual void construct_children();
+ virtual void construct_children ();
};
class Request : public Music {
public:
Request ();
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
bool equal_b (Request const*) const;
protected:
virtual bool do_equal_b (Request const*) const;
void set_direction (Direction d);
Direction get_direction () const;
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
Script_req ();
};
void set_span_dir (Direction d);
Direction get_span_dir () const;
- Span_req();
+ Span_req ();
protected:
virtual bool do_equal_b (Request const*) const;
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
/**
*/
class Tie_req : public Request {
public:
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
#endif
static void add_column (Grob*me,Grob*);
static void set_interface (Grob*me);
static bool has_interface (Grob*);
- DECLARE_SCHEME_CALLBACK(force_shift_callback, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (force_shift_callback, (SCM element, SCM axis));
static SCM do_shift (Grob*,SCM);
};
#endif // REST_COLLISION_HH
class Rest
{
public:
- DECLARE_SCHEME_CALLBACK(after_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM ));
static bool has_interface (Grob*);
static SCM brew_internal_molecule (SCM);
- DECLARE_SCHEME_CALLBACK(extent_callback, (SCM,SCM));
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (extent_callback, (SCM,SCM));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
};
#endif // REST_HH
static Item * stem_l (Grob*) ;
static Item * dots_l (Grob*) ;
static int dot_count (Grob*) ;
- DECLARE_SCHEME_CALLBACK(after_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM ));
static bool has_interface (Grob*);
static void set_interface (Grob*);
};
struct SCM_less
{
- bool operator () (SCM s1, SCM s2) const
+ bool operator () (SCM s1, SCM s2) const
{
- return long(s1) < long (s2);
+ return long (s1) < long (s2);
}
};
Scheme_hash_table (Scheme_hash_table const &);
SCM to_alist () const;
- DECLARE_SMOBS(Scheme_hash_table,foo);
+ DECLARE_SMOBS (Scheme_hash_table,foo);
};
#endif /* SCM_HASH_HH */
Paper_column* musical_column_l_;
void make_columns (Moment);
void set_columns (Paper_column*,Paper_column*);
- void typeset_all();
+ void typeset_all ();
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Paper_score * pscore_p_;
void forbid_breaks ();
- Score_engraver();
+ Score_engraver ();
virtual Music_output *get_output_p ();
protected:
virtual void prepare (Moment);
- virtual void finish();
- virtual void one_time_step();
- virtual int depth_i() const { return Global_translator::depth_i ();}
+ virtual void finish ();
+ virtual void one_time_step ();
+ virtual int depth_i () const { return Global_translator::depth_i ();}
protected:
/* Engraver_group_engraver interface */
virtual bool try_music (Music*);
- virtual void initialize();
- virtual void finalize();
+ virtual void initialize ();
+ virtual void finalize ();
virtual void announce_grob (Grob_info);
- virtual void do_announces();
+ virtual void do_announces ();
virtual void typeset_grob (Grob*elem_p);
- virtual void stop_translation_timestep();
+ virtual void stop_translation_timestep ();
};
public Performer_group_performer, public Global_translator
{
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
- Score_performer();
- ~Score_performer();
+ Score_performer ();
+ ~Score_performer ();
Performance *performance_p_;
protected:
- virtual void finish();
+ virtual void finish ();
virtual void prepare (Moment mom);
- virtual void one_time_step();
- virtual void start();
+ virtual void one_time_step ();
+ virtual void start ();
virtual void initialize ();
virtual void announce_element (Audio_element_info);
- virtual int get_tempo_i() const;
+ virtual int get_tempo_i () const;
virtual void play_element (Audio_element* p);
virtual Music_output *get_output_p ();
int errorlevel_i_;
/// construction
- Score();
+ Score ();
Score (Score const&);
- void process();
+ void process ();
void add_output (Music_output_def *def_p);
- DECLARE_SMOBS(Score,foo);
+ DECLARE_SMOBS (Score,foo);
private:
void run_translator (Music_output_def*);
};
{
public:
static void add_staff_sided (Grob*, Item*);
- DECLARE_SCHEME_CALLBACK(before_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
};
static Molecule get_molecule (Grob*,Direction d);
static void set_interface (Grob*);
static bool has_interface (Grob*);
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
- DECLARE_SCHEME_CALLBACK(after_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
};
#endif /* Stem_SCRIPT_HH */
public:
static void add_spacing_unit (Grob*me, Item*);
static void set_interface (Grob*);
- DECLARE_SCHEME_CALLBACK(set_spacing_rods, (SCM ));
+ DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM ));
};
#endif /* SEPARATING_GROUP_SPANNER_HH */
struct Side_position_interface
{
public:
- DECLARE_SCHEME_CALLBACK(aligned_on_support_extents, (SCM element, SCM axis));
- DECLARE_SCHEME_CALLBACK(aligned_on_support_refpoints, (SCM element, SCM axis));
- DECLARE_SCHEME_CALLBACK(aligned_on_self, (SCM element, SCM axis));
- DECLARE_SCHEME_CALLBACK(aligned_side, (SCM element, SCM axis));
- DECLARE_SCHEME_CALLBACK(quantised_position, (SCM element, SCM axis));
- DECLARE_SCHEME_CALLBACK(centered_on_parent, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (aligned_on_support_extents, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (aligned_on_support_refpoints, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (aligned_on_self, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (aligned_side, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (quantised_position, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (centered_on_parent, (SCM element, SCM axis));
static SCM general_side_position (Grob*, Axis, bool);
static void set_axis (Grob*,Axis);
DECLARE_SIMPLE_SMOBS;
static SCM make_scm (void initdata) {
Ssmob * sp = new Ssmob (initdata);
- return sp->smobbed_self();
+ return sp->smobbed_self ();
}
private:
Ssmob (initdata);
class Csmob {
DECLARE_SMOBS;
- Csmob () { smobify_self(); }
+ Csmob () { smobify_self (); }
Csmob (Csmob const & s) {
// don't copy self_scm_
smobify_self ();
WARNING:
- smobify_self() might trigger a GC, so make sure that objects are
- sane when you do smobify_self().
+ smobify_self () might trigger a GC, so make sure that objects are
+ sane when you do smobify_self ().
*/
#define DECLARE_SIMPLE_SMOBS(CL,dummy) \
static SCM equal_p (SCM a, SCM b);\
static CL * unsmob (SCM);\
static SCM smob_p (SCM);\
- static void init_smobs(); \
+ static void init_smobs (); \
private:
#define DECLARE_SMOBS(CL,dummy) \
- DECLARE_SIMPLE_SMOBS(CL,dammy) \
+ DECLARE_SIMPLE_SMOBS (CL,dammy) \
protected:\
- virtual ~CL();\
+ virtual ~CL ();\
SCM unprotected_smobify_self ();\
private: \
SCM smobify_self (); \
static void set_interface (Grob*);
static void do_measure (Grob*,Link_array<Grob>) ;
- DECLARE_SCHEME_CALLBACK(set_springs, (SCM ));
+ DECLARE_SCHEME_CALLBACK (set_springs, (SCM ));
static Real stem_dir_correction (Grob*,Grob*,Grob*) ;
static Real default_bar_spacing (Grob*,Grob*,Grob*,Moment) ;
static Real note_spacing (Grob*,Grob*,Grob*,Moment) ;
static void add_bar (Grob*,Grob*);
static void evaluate_glyph (Grob*);
static void evaluate_empty (Grob*);
- DECLARE_SCHEME_CALLBACK(width_callback, (SCM smob, SCM axis));
- DECLARE_SCHEME_CALLBACK(get_bar_size, (SCM ));
- DECLARE_SCHEME_CALLBACK(before_line_breaking, (SCM ));
- DECLARE_SCHEME_CALLBACK(center_on_spanned_callback, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (width_callback, (SCM smob, SCM axis));
+ DECLARE_SCHEME_CALLBACK (get_bar_size, (SCM ));
+ DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (center_on_spanned_callback, (SCM element, SCM axis));
};
#endif // SPAN_BAR_HH
virtual SCM do_derived_mark ();
protected:
void set_my_columns ();
- VIRTUAL_COPY_CONS(Grob);
+ VIRTUAL_COPY_CONS (Grob);
virtual void do_break_processing ();
virtual Line_of_score*line_l () const;
};
source file of the GNU LilyPond music typesetter
- (c) 1999--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1999--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
static void set_interface (Grob*);
static bool has_interface (Grob*);
static void set_position (Grob*,Real);
- DECLARE_SCHEME_CALLBACK(callback, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (callback, (SCM element, SCM axis));
/**
Leading are the lead strips between the sticks (lines) of
{
public:
static Real staff_space (Grob*) ;
- static int steps_i(Grob*) ;
+ static int steps_i (Grob*) ;
static int line_count (Grob*);
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
static bool has_interface (Grob*);
static void set_interface (Grob*);
};
class Stem
{
public:
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
static int flag_i (Grob*) ;
static int beam_count (Grob*,Direction) ;
static Direction get_direction (Grob*) ;
static int type_i (Grob *) ;
static void set_stemend (Grob *,Real);
- static Direction get_default_dir(Grob *) ;
- static int get_center_distance(Grob *,Direction) ;
+ static Direction get_default_dir (Grob *) ;
+ static int get_center_distance (Grob *,Direction) ;
static int heads_i (Grob *) ;
- static bool invisible_b(Grob *) ;
- static Interval head_positions(Grob *) ;
+ static bool invisible_b (Grob *) ;
+ static Interval head_positions (Grob *) ;
static Real get_default_stem_end_position (Grob*me) ;
- static void position_noteheads(Grob*);
+ static void position_noteheads (Grob*);
static Real stem_end_position (Grob*) ;
- DECLARE_SCHEME_CALLBACK(off_callback, (SCM element, SCM axis));
+ DECLARE_SCHEME_CALLBACK (off_callback, (SCM element, SCM axis));
static Molecule flag (Grob*);
- DECLARE_SCHEME_CALLBACK(before_line_breaking, (SCM ));
- DECLARE_SCHEME_CALLBACK(dim_callback, (SCM smob, SCM axis));
+ DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (dim_callback, (SCM smob, SCM axis));
DECLARE_SCHEME_CALLBACK (height, (SCM,SCM));
static bool has_interface (Grob*);
static void set_interface (Grob*);
class Swallow_performer : public Performer
{
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
protected:
virtual bool try_music (Music*) { return true; }
private_symbol_cache_end = private_symbol_cache + sz;
for (p = private_symbol_cache_end -1;
p != private_symbol_cache + idx; p --)
- *p = *(p - 1);
+ *p = * (p - 1);
p->key = ch;
p->val = sym;
class System_start_delimiter
{
public:
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
static void set_interface (Grob*me);
static bool has_interface (Grob*);
- DECLARE_SCHEME_CALLBACK(after_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM ));
static void try_collapse (Grob*);
static Molecule staff_bracket (Grob*,Real) ;
static Molecule staff_brace (Grob*,Real) ;
source file of the GNU LilyPond music typesetter
- (c) 1998--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1998--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
Jan Nieuwenhuizen <janneke@gnu.org>
*/
static void set_interface (Grob*me);
static bool has_interface (Grob*);
static void add_tie (Grob*me,Grob*);
- DECLARE_SCHEME_CALLBACK(after_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM ));
static void set_directions (Grob*me);
};
static bool has_interface (Grob*);
static Grob * head (Grob*,Direction) ;
static Real position_f (Grob*) ;
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
- static Direction get_default_dir(Grob*) ;
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
+ static Direction get_default_dir (Grob*) ;
static SCM get_control_points (SCM);
- DECLARE_SCHEME_CALLBACK(set_spacing_rods, (SCM ));
+ DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM ));
};
#endif // TIE_HH
{
public:
Time_scaled_music (SCM);
+ Time_scaled_music ();
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
#endif /* Time_scaled_music_HH */
{
static Molecule special_time_signature (Grob*,String,int,int) ;
static Molecule time_signature (Grob*,int, int);
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
};
#endif // METER_HH
SCM last_time_sig_;
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Timing_translator ();
Music *check_;
{
public:
Translation_property ();
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
/**
class Push_translation_property : public Music
{
public:
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
/**
class Pop_translation_property : public Music
{
public:
- VIRTUAL_COPY_CONS(Music);
+ VIRTUAL_COPY_CONS (Music);
};
void apply_property_operations (Translator_group*);
private:
- DECLARE_SMOBS(Translator_def,foo);
+ DECLARE_SMOBS (Translator_def,foo);
Translator_def ();
Translator_def (Translator_def const&);
#include "smobs.hh"
// egcs
-typedef void (Translator::*Method_pointer)(void);
+typedef void (Translator::*Method_pointer) (void);
class Scheme_hash_table;
String id_str_;
- VIRTUAL_COPY_CONS(Translator);
- Translator_group(Translator_group const &);
- Translator_group();
+ VIRTUAL_COPY_CONS (Translator);
+ Translator_group (Translator_group const &);
+ Translator_group ();
void add_group_translator (Translator *trans_p);
/// Score_register = 0, Staff_registers = 1, etc)
Translator_group* ancestor_l (int l=1);
- int depth_i() const;
+ int depth_i () const;
bool is_bottom_translator_b () const;
- bool removable_b() const;
+ bool removable_b () const;
void terminate_translator (Translator*r_l);
Translator *remove_translator_p (Translator*trans_l);
void check_removal ();
Translator_group *find_create_translator_l (String n, String id);
Link_array<Translator_group> path_to_acceptable_translator (String alias, Music_output_def*) const;
- Translator_group*get_default_interpreter();
+ Translator_group*get_default_interpreter ();
public:
bool try_music_on_nongroup_children (Music *m);
virtual void do_announces ();
virtual bool try_music (Music* req_l);
- virtual void stop_translation_timestep();
- virtual void start_translation_timestep();
- virtual void initialize();
- virtual void finalize();
+ virtual void stop_translation_timestep ();
+ virtual void start_translation_timestep ();
+ virtual void initialize ();
+ virtual void finalize ();
virtual void each (Method_pointer);
};
Music_output_def * output_def_l_;
String type_str_;
- virtual const char *name() const;
+ virtual const char *name () const;
bool is_alias_b (String) const;
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Translator (Translator const &);
Translator ();
Translator_group * daddy_trans_l_ ;
- void pre_move_processing();
- void announces();
- void post_move_processing();
- void removal_processing();
+ void pre_move_processing ();
+ void announces ();
+ void post_move_processing ();
+ void removal_processing ();
/**
ask daddy for a feature
*/
SCM definition_;
SCM properties_scm_;
- DECLARE_SMOBS(Translator, dummy);
+ DECLARE_SMOBS (Translator, dummy);
public:
/**
*/
virtual bool try_music (Music *req_l);
- virtual void stop_translation_timestep();
- virtual void start_translation_timestep();
+ virtual void stop_translation_timestep ();
+ virtual void start_translation_timestep ();
virtual void do_announces () ;
- virtual void initialize() ;
- virtual void finalize();
+ virtual void initialize () ;
+ virtual void finalize ();
};
t->type_str_ = classname (t);\
add_translator (t);\
}\
-ADD_GLOBAL_CTOR(_ ## T ## _adder);
+ADD_GLOBAL_CTOR (_ ## T ## _adder);
{
public:
Transposed_music (SCM);
+ Transposed_music ();
- VIRTUAL_COPY_CONS(Music);
+
+ VIRTUAL_COPY_CONS (Music);
virtual Pitch to_relative_octave (Pitch);
};
/*
TODO: quantise, we don't want to collide with staff lines.
- (or should we be above staff?)
+ (or should we be above staff?)
todo: handle breaking elegantly.
*/
class Tuplet_bracket
{
public:
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
static void set_interface (Grob*);
static bool has_interface (Grob*);
static void calc_dy (Grob*,Real *) ;
static void calc_position_and_height (Grob*,Real*,Real *dy);
- DECLARE_SCHEME_CALLBACK(after_line_breaking, (SCM ));
+ DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM ));
static Direction get_default_dir (Grob*);
};
#include "translator.hh"
/** eat a certain type of request.
- (Duh, it's good for your skin)
+ (Duh, it's good for your skin)
*/
class Type_swallow_translator : public virtual Translator
{
String swallow_str_;
bool try_music (Music*);
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
};
#define DECLARE_REQUEST_SWALLOWER(TYPE) \
struct TYPE ## _swallow_translator : public Type_swallow_translator {\
- TYPE ## _swallow_translator() { \
+ TYPE ## _swallow_translator () { \
swallow_str_ = #TYPE;\
}\
\
- VIRTUAL_COPY_CONS(Translator);\
+ VIRTUAL_COPY_CONS (Translator);\
};\
-ADD_THIS_TRANSLATOR(TYPE ## _swallow_translator);\
+ADD_THIS_TRANSLATOR (TYPE ## _swallow_translator);\
#endif // TYPESWALLOW_GRAV_HH
public:
static void set_interface (Grob*);
static bool has_interface (Grob*);
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
static void add_column (Grob*, Grob*col);
static void add_bar (Grob*me, Item*bar);
};
print_smob (SCM s, SCM port, scm_print_state *)
{
String str = "#<location " + unsmob_input (s)->location_str () + ">";
- scm_puts (str.ch_C(), port);
+ scm_puts (str.ch_C (), port);
return 1;
}
}
static
-void start_input_smobs()
+void start_input_smobs ()
{
input_tag
= scm_make_smob_type_mfpe ("input", 0,
Input * nip = new Input (ip);
SCM z;
- SCM_NEWCELL(z);
+ SCM_NEWCELL (z);
SCM_SETCAR (z, (SCM)input_tag);
SCM_SETCDR (z, (SCM)nip);
// fixme: done_malloc
{
if (SCM_IMP (s))
return 0;
- if ((long)SCM_CAR(s) == input_tag) // ugh.
- return (Input*) SCM_CDR(s);
+ if ((long)SCM_CAR (s) == input_tag) // ugh.
+ return (Input*) SCM_CDR (s);
else
return 0;
}
-ADD_SCM_INIT_FUNC(input, start_input_smobs);
+ADD_SCM_INIT_FUNC (input, start_input_smobs);
Input dummy_input_global;
void create_text (SCM s);
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Instrument_name_engraver ();
virtual void initialize ();
virtual void acknowledge_grob (Grob_info);
virtual void stop_translation_timestep ();
};
-ADD_THIS_TRANSLATOR(Instrument_name_engraver);
+ADD_THIS_TRANSLATOR (Instrument_name_engraver);
Instrument_name_engraver::Instrument_name_engraver ()
{
void
Instrument_name_engraver::create_text (SCM txt)
{
- if(!text_)
+ if (!text_)
{
text_ = new Item (get_property ("InstrumentName"));
return;
if (dynamic_cast<Spanner*> (i.elem_l_)
- &&((Axis_group_interface::has_interface (i.elem_l_)
+ && ((Axis_group_interface::has_interface (i.elem_l_)
&& Axis_group_interface::axis_b (i.elem_l_, Y_AXIS))
|| (Align_interface::has_interface (i.elem_l_)
- && Align_interface::axis (i.elem_l_) == Y_AXIS)))
+ && Align_interface::axis (i.elem_l_) == Y_AXIS)))
{
SCM nl = gh_cons (i.elem_l_->self_scm (),
get_property ("instrumentSupport"));
#include "interpretation-context-handle.hh"
#include "translator-group.hh"
-Interpretation_context_handle::Interpretation_context_handle()
+Interpretation_context_handle::Interpretation_context_handle ()
{
report_to_l_ =0;
}
{
report_to_l_ =0;
if (s.report_to_l_)
- up (s.report_to_l_ );
+ up (s.report_to_l_);
}
Interpretation_context_handle*
}
void
-Interpretation_context_handle::down()
+Interpretation_context_handle::down ()
{
report_to_l_->iterator_count_ --;
report_to_l_ = 0;
if (me->original_l_)
return false;
- if (!dynamic_cast<Item*>(me))
+ if (!dynamic_cast<Item*> (me))
programming_error ("only items can be breakable.");
Item * i =dynamic_cast<Item*> (me->parent_l (X_AXIS));
}
Line_of_score *
-Item::line_l() const
+Item::line_l () const
{
Grob *g = parent_l (X_AXIS);
return g ? g->line_l () : 0;
void
-Item::copy_breakable_items()
+Item::copy_breakable_items ()
{
Drul_array<Item *> new_copies;
Direction i=LEFT;
do
{
- Grob * dolly = clone();
- Item * item_p = dynamic_cast<Item*>(dolly);
+ Grob * dolly = clone ();
+ Item * item_p = dynamic_cast<Item*> (dolly);
pscore_l_->line_l_->typeset_grob (item_p);
new_copies[i] =item_p;
}
- while (flip(&i) != LEFT);
+ while (flip (&i) != LEFT);
broken_to_drul_= new_copies;
}
Generate items for begin and end-of line.
*/
void
-Item::discretionary_processing()
+Item::discretionary_processing ()
{
if (broken_b ())
return;
if (Item::breakable_b (this))
- copy_breakable_items();
+ copy_breakable_items ();
}
Grob*
Item::find_broken_piece (Line_of_score*l) const
{
- if (line_l() == l)
- return (Item*)(this);
+ if (line_l () == l)
+ return (Item*) (this);
Direction d = LEFT;
do {
*/
class Key_engraver : public Engraver
{
- void create_key(bool);
+ void create_key (bool);
void read_req (Key_change_req const * r);
public:
- Key_engraver();
+ Key_engraver ();
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Key_change_req * keyreq_l_;
Item * item_p_;
Protected_scm old_accs_; // ugh. -> property
protected:
- virtual void initialize();
+ virtual void initialize ();
virtual void finalize ();
virtual bool try_music (Music *req_l);
- virtual void stop_translation_timestep();
- virtual void start_translation_timestep();
+ virtual void stop_translation_timestep ();
+ virtual void start_translation_timestep ();
virtual void create_grobs ();
virtual void acknowledge_grob (Grob_info);
};
the thinking to other parties.
*/
int
-Key_item::calculate_position(Grob *ki, SCM pair)
+Key_item::calculate_position (Grob *ki, SCM pair)
{
int p = gh_scm2int (gh_car (pair));
int a = gh_scm2int (gh_cdr (pair));
if ((a<0 && ((p>FLAT_TOP_PITCH) || (p+c0>4)) && (p+c0>1))
||
- (a>0 && ((p>SHARP_TOP_PITCH) || (p+c0>5)) && (p+c0>2)))
+ (a>0 && ((p>SHARP_TOP_PITCH) || (p+c0>5)) && (p+c0>2)))
{
p -= 7; /* Typeset below c_position */
}
TODO
- space the `natural' signs wider
*/
-MAKE_SCHEME_CALLBACK(Key_item,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Key_item,brew_molecule,1);
SCM
Key_item::brew_molecule (SCM smob)
{
{
int a = gh_scm2int (gh_cdar (s));
Molecule m = Font_interface::get_default_font (me)->find_by_name ("accidentals-" + to_str (a));
- m.translate_axis (calculate_position(me, gh_car (s)) * inter, Y_AXIS);
+ m.translate_axis (calculate_position (me, gh_car (s)) * inter, Y_AXIS);
mol.add_at_edge (X_AXIS, LEFT, m, 0);
}
As suggested by [Ross], p.148.
*/
- Interval x(0, inter);
- Interval y(0,0);
+ Interval x (0, inter);
+ Interval y (0,0);
- mol.add_at_edge (X_AXIS, LEFT, Lookup::blank (Box(x,y)),0);
+ mol.add_at_edge (X_AXIS, LEFT, Lookup::blank (Box (x,y)),0);
for (; gh_pair_p (old); old = gh_cdr (old))
{
find correspondences in pitches
*/
for (SCM s = newas; gh_pair_p (s); s = gh_cdr (s))
- if (gh_caar(s) == gh_caar (old))
+ if (gh_caar (s) == gh_caar (old))
found = gh_car (s);
if (found == SCM_EOL || gh_cdr (found) != gh_cdar (old))
}
}
- return mol.smobbed_copy();
+ return mol.smobbed_copy ();
}
class Key_performer : public Performer
{
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
- Key_performer();
- ~Key_performer();
+ Key_performer ();
+ ~Key_performer ();
protected:
virtual bool try_music (Music* req_l);
SCM acc = gh_call1 (proc, pitchlist);
proc = scm_eval2 (ly_symbol2scm ("major-key"), SCM_EOL);
SCM major = gh_call1 (proc, pitchlist);
- audio_p_ = new Audio_key (gh_scm2int(acc), major == SCM_BOOL_T);
+ audio_p_ = new Audio_key (gh_scm2int (acc), major == SCM_BOOL_T);
Audio_element_info info (audio_p_, key_req_l_);
announce_element (info);
key_req_l_ = 0;
int
tabcmp (void const * p1, void const * p2)
{
- return strcmp (((Keyword_ent const *) p1)->name,
- ((Keyword_ent const *) p2)->name);
+ return strcmp (( (Keyword_ent const *) p1)->name,
+ ((Keyword_ent const *) p2)->name);
}
Keyword_table::Keyword_table (Keyword_ent *tab)
/*
-kpath.cc -- glue kpathsea to lily. Need some ugly kludges for gcc 2.96
+ kpath.cc -- glue kpathsea to lily. Need some ugly kludges for gcc 2.96
-source file of the GNU LilyPond music typesetter
+ source file of the GNU LilyPond music typesetter
-(c) 2000--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
+ (c) 2000--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
#include <stdio.h>
#endif
#include "kpath.hh"
-#include "version.hh"
+#include "lily-version.hh"
-char * ly_find_afm (char const * name)
+char *
+ly_find_afm (char const * name)
{
#if (KPATHSEA && HAVE_KPSE_FIND_FILE)
return kpse_find_file (name, kpse_afm_format, true);
return 0;
}
-char * ly_find_tfm (char const * name)
+char *
+ly_find_tfm (char const * name)
{
#if (KPATHSEA && HAVE_KPSE_FIND_FILE)
return kpse_find_file (name, kpse_tfm_format, true);
/*
initialize kpathsea
*/
- kpse_set_program_name(av0, NULL);
- kpse_maketex_option("tfm", TRUE);
+ kpse_set_program_name (av0, NULL);
+ kpse_maketex_option ("tfm", TRUE);
- /*
- ugh: apparently the program_args is non-functional.
- */
-#define VERSION MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL
-
-#define MY_TFMPATH "$VARTEXFONTS/tfm/lilypond/" VERSION "/"
+ String my_tfm = "$VARTEXFONTS/tfm/lilypond/";
+ my_tfm += version_str () + "/";
- char * mypath = kpse_expand (MY_TFMPATH);
+ char * mypath = kpse_expand (my_tfm.ch_C ());
String prog = "mktextfm --destdir ";
prog += mypath;
- kpse_format_info[kpse_tfm_format].program = strdup (prog.ch_C());
+ kpse_format_info[kpse_tfm_format].program = strdup (prog.ch_C ());
kpse_format_info[kpse_tfm_format].client_path = mypath;
#endif
}
Real sqx =0.0;
Real sxy = 0.0;
- for (int i=0; i < input.size();i++)
+ for (int i=0; i < input.size ();i++)
{
Real x=input[i][X_AXIS];
Real y = input[i][Y_AXIS];
sqx += sqr (x);
sxy += x*y;
}
- int N = input.size();
+ int N = input.size ();
*coef =0.0;
*offset =0.;
Real den = (N*sqx - sqr (sx));
if (!N || !den)
{
- programming_error ("minimise_least_squares(): Nothing to minimise");
+ programming_error ("minimise_least_squares (): Nothing to minimise");
*coef = 0.0;
*offset = N ? sy/N : 0.0;
}
lex.backup
contains no backup states, but only the reminder
Compressed tables always back up.
- (don-t forget to rm lex.yy.cc :-)
+ (don-t forget to rm lex.yy.cc :-)
*/
yy_push_state (quote);\
yylval.string = new String
-#define yylval (*(YYSTYPE*)lexval_l)
+#define yylval \
+ (*(YYSTYPE*)lexval_l)
#define YY_USER_ACTION add_lexed_char (YYLeng ());
/*
AN {AA}|{N}
PUNCT [?!:']
ACCENT \\[`'"^]
-NATIONAL [\001-\006\021-\027\031\036\200-\377]
+NATIONAL [\001-\006\021-\027\031\036\200-\377]
TEX {AA}|-|{PUNCT}|{ACCENT}|{NATIONAL}
WORD {A}{AN}*
ALPHAWORD {A}+
return RESTNAME;
}
<chords,notes>R {
- return MEASURES;
+ return MULTI_MEASURE_REST;
}
<INITIAL,chords,lyrics,notes>\\\${BLACK}*{WHITE} {
String s=YYText () + 2;
}
<quote>{
\\{ESCAPED} {
- *yylval.string += to_str (escaped_char(YYText()[1]));
+ *yylval.string += to_str (escaped_char (YYText ()[1]));
}
[^\\"]+ {
*yylval.string += YYText ();
/* yylval is union. Must remember STRING before setting SCM*/
String *sp = yylval.string;
- yylval.scm = ly_str02scm (sp->ch_C ());
+ yylval.scm = ly_str02scm (sp->ch_C ());
delete sp;
return STRING;
}
return yylval.i = HYPHEN;
int i = 0;
while ((i=s.index_i ("_")) != -1) // change word binding "_" to " "
- *(s.ch_l () + i) = ' ';
+ * (s.ch_l () + i) = ' ';
if ((i=s.index_i ("\\,")) != -1) // change "\," to TeX's "\c "
{
- *(s.ch_l () + i + 1) = 'c';
+ * (s.ch_l () + i + 1) = 'c';
s = s.left_str (i+2) + " " + s.right_str (s.length_i ()-i-2);
}
char c = s[s.length_i () - 1];
if (c == '{' || c == '}') // brace open is for not confusing dumb tools.
here_input ().warning (
- _("Brace found at end of lyric. Did you forget a space?"));
+ _ ("Brace found at end of lyric. Did you forget a space?"));
yylval.scm = ly_str02scm (s.ch_C ());
DEBUG_OUT << "lyric : `" << s << "'\n";
{
// use more SCM for this.
- SCM sym = ly_symbol2scm (str.ch_C());
+ SCM sym = ly_symbol2scm (str.ch_C ());
int l = lookup_keyword (str);
if (l != -1) {
String msg (_f ("unknown escaped string: `\\%s'", str));
LexerError (msg.ch_C ());
- yylval.scm = ly_str02scm(str.ch_C());
+ yylval.scm = ly_str02scm (str.ch_C ());
return STRING;
}
}
}
- yylval.scm = ly_str02scm (str.ch_C());
+ yylval.scm = ly_str02scm (str.ch_C ());
return STRING;
}
}
/*
- urg, belong to String(_convert)
+ urg, belong to String (_convert)
and should be generalised
*/
void
{
Lilypond_version current ( MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL );
Lilypond_version ver (s);
- if (!((ver >= oldest_version) && (ver <= current)))
+ if (! ((ver >= oldest_version) && (ver <= current)))
{
non_fatal_error (_f ("incorrect lilypond version: %s (%s, %s)", ver.str (), oldest_version.str (), current.str ()));
- non_fatal_error (_("Consider converting the input with the convert-ly script"));
+ non_fatal_error (_ ("Consider converting the input with the convert-ly script"));
return false;
}
return true;
/*
After parsing
- (begin (foo 1 2))
+ (begin (foo 1 2))
all seems fine, but after parsing
- (foo 1 2)
+ (foo 1 2)
read_buf has been advanced to read_pos - 1,
so that scm_ftell returns 1, instead of #parsed chars
SCM
-ly_symbol2scm(const char *s)
+ly_symbol2scm (const char *s)
{
return gh_symbol2scm ((char *)s);
}
ly_symbol2string (SCM s)
{
assert (gh_symbol_p (s));
- return String((Byte*)SCM_CHARS (s), (int) SCM_LENGTH(s));
+ return String ((Byte*)SCM_CHARS (s), (int) SCM_LENGTH (s));
}
error (e);
}
else if (verbose_global_b)
- progress_indication ("[" + s );
+ progress_indication ("[" + s);
- Simple_file_storage f(s);
- String result (f.ch_C());
+ Simple_file_storage f (s);
+ String result (f.ch_C ());
if (verbose_global_b)
progress_indication ("]");
return result;
SCM
ly_gulp_file (SCM fn)
{
- return ly_str02scm (gulp_file_to_string (ly_scm2string (fn)).ch_C());
+ return ly_str02scm (gulp_file_to_string (ly_scm2string (fn)).ch_C ());
}
void
read_lily_scm_file (String fn)
{
- gh_eval_str ((char *) gulp_file_to_string (fn).ch_C());
+ gh_eval_str ((char *) gulp_file_to_string (fn).ch_C ());
}
extern "C" {
index_cell (SCM s, Direction d)
{
assert (d);
- return (d == LEFT) ? gh_car (s) : gh_cdr (s);
+ return (d == LEFT) ? gh_car (s) : gh_cdr (s);
}
SCM
-typedef void (*Void_fptr)();
+typedef void (*Void_fptr) ();
Array<Void_fptr> *scm_init_funcs_;
-void add_scm_init_func (void (*f)())
+void add_scm_init_func (void (*f) ())
{
if (!scm_init_funcs_)
scm_init_funcs_ = new Array<Void_fptr>;
scm_init_funcs_->push (f);
}
-extern void init_cxx_function_smobs();
+extern void init_cxx_function_smobs ();
void
init_lily_guile ()
{
- init_cxx_function_smobs();
- for (int i=scm_init_funcs_->size() ; i--;)
- (scm_init_funcs_->elem (i)) ();
+ init_cxx_function_smobs ();
+ for (int i=scm_init_funcs_->size () ; i--;)
+ (scm_init_funcs_->elem (i)) ();
}
unsigned int ly_scm_hash (SCM s)
SCM
ly_offset2scm (Offset o)
{
- return gh_cons (gh_double2scm (o[X_AXIS]), gh_double2scm(o[Y_AXIS]));
+ return gh_cons (gh_double2scm (o[X_AXIS]), gh_double2scm (o[Y_AXIS]));
}
Offset
static void *
greet_sweep (void *dummy1, void *dummy2, void *dummy3)
{
- fprintf(stderr, "entering sweep\n");
+ fprintf (stderr, "entering sweep\n");
}
static void *
wave_sweep_goodbye (void *dummy1, void *dummy2, void *dummy3)
{
- fprintf(stderr, "leaving sweep\n");
+ fprintf (stderr, "leaving sweep\n");
}
#endif
SCM
ly_version ()
{
- char const* vs = "\'(" MAJOR_VERSION " " MINOR_VERSION " " PATCH_LEVEL " " MY_PATCH_LEVEL ")" ;
+ char const* vs = "\' (" MAJOR_VERSION " " MINOR_VERSION " " PATCH_LEVEL " " MY_PATCH_LEVEL ")" ;
return gh_eval_str ((char*)vs);
#endif
}
-ADD_SCM_INIT_FUNC(funcs, init_functions);
+ADD_SCM_INIT_FUNC (funcs, init_functions);
SCM
ly_deep_copy (SCM l)
#include "spanner.hh"
-Line_group_engraver_group::Line_group_engraver_group()
+Line_group_engraver_group::Line_group_engraver_group ()
{
staffline_p_ =0;
}
void
-Line_group_engraver_group::finalize()
+Line_group_engraver_group::finalize ()
{
Engraver_group_engraver::finalize ();
Grob * it
= unsmob_grob (get_property (ly_symbol2scm ("currentCommandColumn")));
- staffline_p_->set_bound(RIGHT,it);
+ staffline_p_->set_bound (RIGHT,it);
Engraver_group_engraver::typeset_grob (staffline_p_);
staffline_p_ = 0;
}
void
-Line_group_engraver_group::initialize()
+Line_group_engraver_group::initialize ()
{
create_line_spanner ();
Grob * it
= unsmob_grob (get_property (ly_symbol2scm ("currentCommandColumn")));
- staffline_p_->set_bound(LEFT,it);
+ staffline_p_->set_bound (LEFT,it);
Engraver::announce_grob (staffline_p_,0);
}
-ADD_THIS_TRANSLATOR(Line_group_engraver_group);
+ADD_THIS_TRANSLATOR (Line_group_engraver_group);
}
-Line_of_score::Line_of_score(SCM s)
+Line_of_score::Line_of_score (SCM s)
: Spanner (s)
{
rank_i_ = 0;
int
Line_of_score::element_count () const
{
- return scm_ilength ( get_grob_property ("all-elements"));
+ return scm_ilength (get_grob_property ("all-elements"));
}
void
handle_broken_dependencies ();
if (verbose_global_b)
- progress_indication ( _f("Element count %d.", count + element_count()));
+ progress_indication (_f ("Element count %d.", count + element_count ()));
for (int i=0; i < broken_into_l_arr_.size (); i++)
{
for (int i=0; i < breaking.size (); i++)
{
- Line_of_score *line_l = dynamic_cast <Line_of_score*> (clone());
+ Line_of_score *line_l = dynamic_cast <Line_of_score*> (clone ());
line_l->rank_i_ = i;
- // line_l->set_immutable_grob_property ("rank", gh_int2scm( i));
+ // line_l->set_immutable_grob_property ("rank", gh_int2scm (i));
Link_array<Grob> c (breaking[i].cols_);
pscore_l_->typeset_line (line_l);
- line_l->set_bound(LEFT,c[0]);
- line_l->set_bound(RIGHT,c.top ());
- for (int j=0; j < c.size(); j++)
+ line_l->set_bound (LEFT,c[0]);
+ line_l->set_bound (RIGHT,c.top ());
+ for (int j=0; j < c.size (); j++)
{
c[j]->translate_axis (breaking[i].config_[j],X_AXIS);
dynamic_cast<Paper_column*> (c[j])->line_l_ = line_l;
cname = ly_symbol2scm (name); \
scm_permanent_object (cname); \
} \
-ADD_SCM_INIT_FUNC(cname,cname ## _init_func);\
+ADD_SCM_INIT_FUNC (cname,cname ## _init_func);\
-GLOBAL_SYMBOL( offset_sym , "translate-molecule");
-GLOBAL_SYMBOL( placebox_sym , "placebox");
-GLOBAL_SYMBOL( combine_sym , "combine-molecule");
-GLOBAL_SYMBOL( no_origin_sym , "no-origin");
-GLOBAL_SYMBOL( define_origin_sym , "define-origin");
+GLOBAL_SYMBOL (offset_sym , "translate-molecule");
+GLOBAL_SYMBOL (placebox_sym , "placebox");
+GLOBAL_SYMBOL (combine_sym , "combine-molecule");
+GLOBAL_SYMBOL (no_origin_sym , "no-origin");
+GLOBAL_SYMBOL (define_origin_sym , "define-origin");
pscore_l_->outputter_l_->output_scheme (gh_list (define_origin_sym,
- ly_str02scm (ip->file_str ().ch_C()),
+ ly_str02scm (ip->file_str ().ch_C ()),
gh_int2scm (ip->line_number ()),
gh_int2scm (ip->column_number ()),
SCM_UNDEFINED));
for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = gh_cdr (s))
unsmob_grob (gh_car (s))->discretionary_processing ();
- if(verbose_global_b)
- progress_indication ( _f("Element count %d ", element_count ()));
+ if (verbose_global_b)
+ progress_indication (_f ("Element count %d ", element_count ()));
for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = gh_cdr (s))
sc->calculate_dependencies (PRECALCED, PRECALCING, ly_symbol2scm ("before-line-breaking-callback"));
}
- progress_indication ("\n" + _ ("Calculating column positions...") + " " );
+ progress_indication ("\n" + _ ("Calculating column positions...") + " ");
for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = gh_cdr (s))
{
Grob * e = unsmob_grob (gh_car (s));
ly_symbol2scm ("after-line-breaking-callback"));
}
- Interval i(extent(this, Y_AXIS));
- if (i.empty_b())
+ Interval i (extent (this, Y_AXIS));
+ if (i.empty_b ())
programming_error ("Huh? Empty Line_of_score?");
else
translate_axis (- i[MAX], Y_AXIS);
/*
generate all molecules to trigger all font loads.
- (ugh. This is not very memory efficient.) */
+ (ugh. This is not very memory efficient.) */
for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = gh_cdr (s))
{
unsmob_grob (gh_car (s))->get_molecule ();
/*
font defs;
*/
- SCM font_names = ly_quote_scm (paper_l()->font_descriptions ());
+ SCM font_names = ly_quote_scm (paper_l ()->font_descriptions ());
output_scheme (gh_list (ly_symbol2scm ("define-fonts"),
font_names,
SCM_UNDEFINED));
SCM s = get_grob_property ("columns");
while (gh_pair_p (s) && gh_car (s) != r->self_scm ())
- s = gh_cdr (s);
+ s = gh_cdr (s);
if (gh_pair_p (s))
s = gh_cdr (s);
while (gh_pair_p (s) && gh_car (s) != l->self_scm ())
{
- Paper_column*c = dynamic_cast<Paper_column*> ( unsmob_grob (gh_car (s)));
+ Paper_column*c = dynamic_cast<Paper_column*> (unsmob_grob (gh_car (s)));
if (Item::breakable_b (c) && !c->line_l_)
ret.push (c);
- s = gh_cdr (s);
+ s = gh_cdr (s);
}
ret.reverse ();
Link_array<Grob> acs
= Pointer_group_interface__extract_elements (this, (Grob*) 0, "columns");
bool bfound = false;
- for (int i= acs.size (); i -- ; )
+ for (int i= acs.size (); i -- ;)
{
bool brb = Item::breakable_b (acs[i]);
bfound = bfound || brb;
Y_AXIS)
};
- return Offset ( abs (bound->extent (common[X_AXIS], X_AXIS)[-dir]),
+ return Offset (abs (bound->extent (common[X_AXIS], X_AXIS)[-dir]),
bound->extent (common[Y_AXIS], Y_AXIS).center ());
}
return Offset ();
Offset me_o = get_broken_offset (me, -dir);
// Hmm, why not return me_o[X], but recalc in brew_mol?
o = Offset (0,
- (neighbour_o[Y_AXIS]*me_o[X_AXIS]
+ (neighbour_o[Y_AXIS]*me_o[X_AXIS]
- me_o[Y_AXIS]*neighbour_o[X_AXIS]) * dir /
- (me_o[X_AXIS] + neighbour_o[X_AXIS]));
+ (me_o[X_AXIS] + neighbour_o[X_AXIS]));
break;
}
}
/*
Warning: this thing is a cross-staff object, so it should have empty Y-dimensions.
- (If not, you risk that this is called from the staff-alignment
+ (If not, you risk that this is called from the staff-alignment
routine, via molecule_extent. At this point, the staffs aren't
separated yet, so it doesn't work cross-staff.
dxy[Y_AXIS] = bound[RIGHT]->extent (common[Y_AXIS], Y_AXIS).center ()
- bound[LEFT]->extent (common[Y_AXIS], Y_AXIS).center ();
- dist = sqrt(dxy[X_AXIS]*dxy[X_AXIS]+dxy[Y_AXIS]*dxy[Y_AXIS]);
- ofxy = dxy*(off/dist);
+ dist = sqrt (dxy[X_AXIS]*dxy[X_AXIS]+dxy[Y_AXIS]*dxy[Y_AXIS]);
+ ofxy = dxy* (off/dist);
dxy -= 2*ofxy;
my_off = Offset (me->relative_coordinate (common[X_AXIS], X_AXIS),
struct Local_key_engraver : Engraver {
Item *key_item_p_;
protected:
- VIRTUAL_COPY_CONS(Translator);
- virtual void process_music();
+ VIRTUAL_COPY_CONS (Translator);
+ virtual void process_music ();
virtual void acknowledge_grob (Grob_info);
- virtual void stop_translation_timestep();
+ virtual void stop_translation_timestep ();
virtual void initialize ();
virtual void create_grobs ();
virtual void finalize ();
Link_array<Grob> support_l_arr_;
Link_array<Item> forced_l_arr_;
Link_array<Grob> tie_l_arr_;
- Local_key_engraver();
+ Local_key_engraver ();
Item * grace_align_l_;
};
-Local_key_engraver::Local_key_engraver()
+Local_key_engraver::Local_key_engraver ()
{
key_item_p_ =0;
grace_align_l_ =0;
void
Local_key_engraver::create_grobs ()
{
- if (!key_item_p_ && mel_l_arr_.size())
+ if (!key_item_p_ && mel_l_arr_.size ())
{
SCM localsig = get_property ("localKeySignature");
- for (int i=0; i < mel_l_arr_.size(); i++)
+ for (int i=0; i < mel_l_arr_.size (); i++)
{
Grob * support_l = support_l_arr_[i];
Note_req * note_l = mel_l_arr_[i];
SCM prev = scm_assoc (gh_cons (gh_int2scm (o), gh_int2scm (n)), localsig);
if (prev == SCM_BOOL_F)
prev = scm_assoc (gh_int2scm (n), localsig);
- SCM prev_acc = (prev == SCM_BOOL_F) ? gh_int2scm(0) : gh_cdr (prev);
- bool different = !gh_equal_p(prev_acc , gh_int2scm(a));
- int p = gh_number_p(prev_acc) ? gh_scm2int(prev_acc) : 0;
+ SCM prev_acc = (prev == SCM_BOOL_F) ? gh_int2scm (0) : gh_cdr (prev);
+ bool different = !gh_equal_p (prev_acc , gh_int2scm (a));
+ int p = gh_number_p (prev_acc) ? gh_scm2int (prev_acc) : 0;
Grob *tie_break_reminder = 0;
bool tie_changes = false;
2. when different and not tie-changes
3. maybe when at end of a tie: we must later see if
we're after a line break */
- if (((to_boolean (note_l->get_mus_property ("force-accidental"))
+ if (( (to_boolean (note_l->get_mus_property ("force-accidental"))
|| different)
&& !tie_changes)
|| tie_break_reminder)
{
if (!key_item_p_)
{
- key_item_p_ = new Item(get_property ("Accidentals"));
+ key_item_p_ = new Item (get_property ("Accidentals"));
Local_key_item::set_interface (key_item_p_);
bool extra_natural =
sign (p) * (p - a) == 1
- && abs(p) == 2;
+ && abs (p) == 2;
Local_key_item::add_pitch (key_item_p_, *unsmob_pitch (note_l->get_mus_property ("pitch")),
to_boolean (note_l->get_mus_property ("cautionary")),
On which left, code or paper?
- (Arpeggios are engraved left of accidentals, of course.)
+ (Arpeggios are engraved left of accidentals, of course.)
*/
for (int i=0; i < arpeggios_.size (); i++)
Side_position_interface::add_support (arpeggios_[i], key_item_p_);
}
void
-Local_key_engraver::stop_translation_timestep()
+Local_key_engraver::stop_translation_timestep ()
{
if (key_item_p_)
{
- for (int i=0; i < support_l_arr_.size(); i++)
+ for (int i=0; i < support_l_arr_.size (); i++)
Side_position_interface::add_support (key_item_p_,support_l_arr_[i]);
typeset_grob (key_item_p_);
}
grace_align_l_ = 0;
- mel_l_arr_.clear();
+ mel_l_arr_.clear ();
arpeggios_.clear ();
tie_l_arr_.clear ();
- support_l_arr_.clear();
- forced_l_arr_.clear();
+ support_l_arr_.clear ();
+ forced_l_arr_.clear ();
}
void
ugh. repeated deep_copy generates lots of garbage.
*/
void
-Local_key_engraver::process_music()
+Local_key_engraver::process_music ()
{
SCM smp = get_property ("measurePosition");
- Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
+ Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
SCM sig = get_property ("keySignature");
-ADD_THIS_TRANSLATOR(Local_key_engraver);
+ADD_THIS_TRANSLATOR (Local_key_engraver);
#include "lookup.hh"
static SCM
-pitch_less (SCM p1, SCM p2)
+pitch_less (SCM p1, SCM p2)
{
return Pitch::less_p (gh_car (p1), gh_car (p2));
}
pitch_less_proc = gh_new_procedure2_0 ("pits-less", &pitch_less);
}
-ADD_SCM_INIT_FUNC(lkpitch,init_pitch_funcs);
+ADD_SCM_INIT_FUNC (lkpitch,init_pitch_funcs);
void
Local_key_item::add_pitch (Grob*me, Pitch p, bool cautionary, bool natural,
- Grob* tie_break_cautionary)
+ Grob* tie_break_reminder)
{
SCM acs = me->get_grob_property ("accidentals");
SCM pitch = p.smobbed_copy ();
opts = gh_cons (ly_symbol2scm ("cautionary"), opts);
if (natural)
opts = gh_cons (ly_symbol2scm ("natural"), opts);
- if (tie_break_cautionary)
+ if (tie_break_reminder)
{
/* Ugh, these 'options' can't have a value, faking... */
- opts = gh_cons (tie_break_cautionary->self_scm (), opts);
- opts = gh_cons (ly_symbol2scm ("tie-break-cautionary"), opts);
+ opts = gh_cons (tie_break_reminder->self_scm (), opts);
+ opts = gh_cons (ly_symbol2scm ("tie-break-reminder"), opts);
}
pitch = gh_cons (pitch, opts);
Molecule
Local_key_item::parenthesize (Grob*me, Molecule m)
{
- Molecule open = Font_interface::get_default_font (me)->find_by_name (String ("accidentals-("));
+ Molecule open = Font_interface::get_default_font (me)->find_by_name (String ("accidentals- ("));
Molecule close = Font_interface::get_default_font (me)->find_by_name (String ("accidentals-)"));
- m.add_at_edge(X_AXIS, LEFT, Molecule(open), 0);
- m.add_at_edge(X_AXIS, RIGHT, Molecule(close), 0);
+ m.add_at_edge (X_AXIS, LEFT, Molecule (open), 0);
+ m.add_at_edge (X_AXIS, RIGHT, Molecule (close), 0);
return m;
}
Grob *me = unsmob_grob (smob);
SCM accs = me->get_grob_property ("accidentals");
- for (SCM s = accs;
+ for (SCM s = accs;
gh_pair_p (s); s = gh_cdr (s))
{
SCM opts = gh_cdar (s);
accidental placement is more complicated than this.
*/
-MAKE_SCHEME_CALLBACK(Local_key_item,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Local_key_item,brew_molecule,1);
SCM
Local_key_item::brew_molecule (SCM smob)
{
int lastoct = -100;
SCM accs = me->get_grob_property ("accidentals");
- for (SCM s = accs;
+ for (SCM s = accs;
gh_pair_p (s); s = gh_cdr (s))
{
Pitch p (*unsmob_pitch (gh_caar (s)));
if (scm_memq (ly_symbol2scm ("natural"), opts) != SCM_BOOL_F)
{
Molecule prefix = Font_interface::get_default_font (me)->find_by_name (String ("accidentals-0"));
- acc.add_at_edge(X_AXIS, LEFT, Molecule(prefix), 0);
+ acc.add_at_edge (X_AXIS, LEFT, Molecule (prefix), 0);
}
if (scm_memq (ly_symbol2scm ("cautionary"), opts) != SCM_BOOL_F)
if (!gh_number_p (pads[d]))
continue;
- Box b(Interval (0, gh_scm2double (pads[d]) * note_distance),
+ Box b (Interval (0, gh_scm2double (pads[d]) * note_distance),
Interval (0,0));
Molecule m (Lookup::blank (b));
mol.add_at_edge (X_AXIS, d, m, 0);
- } while ( flip (&d)!= LEFT);
+ } while (flip (&d)!= LEFT);
}
- return mol.smobbed_copy();
+ return mol.smobbed_copy ();
}
bool
- Box b( Interval (0, width),
+ Box b (Interval (0, width),
Interval (min_y, max_y));
ly_quote_scm (l),
SCM_UNDEFINED));
- Box box (Interval(0,0),Interval( 0,0));
+ Box box (Interval (0,0),Interval (0,0));
return Molecule (box, at);
}
Molecule
-Lookup::filledbox (Box b )
+Lookup::filledbox (Box b)
{
SCM at = (gh_list (ly_symbol2scm ("filledbox"),
gh_double2scm (-b[X_AXIS][LEFT]),
gh_double2scm (b[Y_AXIS][UP]),
SCM_UNDEFINED));
- return Molecule ( b,at);
+ return Molecule (b,at);
}
Molecule
SCM scontrols[8];
for (int i=4; i--;)
- scontrols[ i ] = ly_offset2scm(back.control_[i]);
+ scontrols[ i ] = ly_offset2scm (back.control_[i]);
for (int i=4 ; i--;)
scontrols[i+4] = ly_offset2scm (curve.control_[i]);
*/
int indices[]= {5, 6, 7, 4, 1, 2, 3, 0};
SCM list = SCM_EOL;
- for (int i= 8; i--; )
+ for (int i= 8; i--;)
{
list = gh_cons (scontrols[indices[i]], list);
}
gh_double2scm (linethick),
SCM_UNDEFINED));
- Box b ( curve.extent (X_AXIS), curve.extent (Y_AXIS));
+ Box b (curve.extent (X_AXIS), curve.extent (Y_AXIS));
return Molecule (b, at);
}
Lookup::accordion (SCM s, Real staff_space, Font_metric *fm)
{
Molecule m;
- String sym = ly_scm2string(gh_car (s));
- String reg = ly_scm2string(gh_car (gh_cdr(s)));
+ String sym = ly_scm2string (gh_car (s));
+ String reg = ly_scm2string (gh_car (gh_cdr (s)));
if (sym == "Discant")
{
Molecule r = fm->find_by_name ("accordion-accDiscant");
- m.add_molecule(r);
- if (reg.left_str(1) == "F")
+ m.add_molecule (r);
+ if (reg.left_str (1) == "F")
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(staff_space * 2.5 PT, Y_AXIS);
- m.add_molecule(d);
- reg = reg.right_str(reg.length_i()-1);
+ d.translate_axis (staff_space * 2.5 PT, Y_AXIS);
+ m.add_molecule (d);
+ reg = reg.right_str (reg.length_i ()-1);
}
int eflag = 0x00;
- if (reg.left_str(3) == "EEE")
+ if (reg.left_str (3) == "EEE")
{
eflag = 0x07;
- reg = reg.right_str(reg.length_i()-3);
+ reg = reg.right_str (reg.length_i ()-3);
}
- else if (reg.left_str(2) == "EE")
+ else if (reg.left_str (2) == "EE")
{
eflag = 0x05;
- reg = reg.right_str(reg.length_i()-2);
+ reg = reg.right_str (reg.length_i ()-2);
}
- else if (reg.left_str(2) == "Eh")
+ else if (reg.left_str (2) == "Eh")
{
eflag = 0x04;
- reg = reg.right_str(reg.length_i()-2);
+ reg = reg.right_str (reg.length_i ()-2);
}
- else if (reg.left_str(1) == "E")
+ else if (reg.left_str (1) == "E")
{
eflag = 0x02;
- reg = reg.right_str(reg.length_i()-1);
+ reg = reg.right_str (reg.length_i ()-1);
}
if (eflag & 0x02)
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
- m.add_molecule(d);
+ d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
+ m.add_molecule (d);
}
if (eflag & 0x04)
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
- d.translate_axis(0.8 * staff_space PT, X_AXIS);
- m.add_molecule(d);
+ d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
+ d.translate_axis (0.8 * staff_space PT, X_AXIS);
+ m.add_molecule (d);
}
if (eflag & 0x01)
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
- d.translate_axis(-0.8 * staff_space PT, X_AXIS);
- m.add_molecule(d);
+ d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
+ d.translate_axis (-0.8 * staff_space PT, X_AXIS);
+ m.add_molecule (d);
}
- if (reg.left_str(2) == "SS")
+ if (reg.left_str (2) == "SS")
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(0.5 * staff_space PT, Y_AXIS);
- d.translate_axis(0.4 * staff_space PT, X_AXIS);
- m.add_molecule(d);
- d.translate_axis(-0.8 * staff_space PT, X_AXIS);
- m.add_molecule(d);
- reg = reg.right_str(reg.length_i()-2);
+ d.translate_axis (0.5 * staff_space PT, Y_AXIS);
+ d.translate_axis (0.4 * staff_space PT, X_AXIS);
+ m.add_molecule (d);
+ d.translate_axis (-0.8 * staff_space PT, X_AXIS);
+ m.add_molecule (d);
+ reg = reg.right_str (reg.length_i ()-2);
}
- if (reg.left_str(1) == "S")
+ if (reg.left_str (1) == "S")
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(0.5 * staff_space PT, Y_AXIS);
- m.add_molecule(d);
- reg = reg.right_str(reg.length_i()-1);
+ d.translate_axis (0.5 * staff_space PT, Y_AXIS);
+ m.add_molecule (d);
+ reg = reg.right_str (reg.length_i ()-1);
}
}
else if (sym == "Freebase")
{
Molecule r = fm->find_by_name ("accordion-accFreebase");
- m.add_molecule(r);
- if (reg.left_str(1) == "F")
+ m.add_molecule (r);
+ if (reg.left_str (1) == "F")
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
- m.add_molecule(d);
- reg = reg.right_str(reg.length_i()-1);
+ d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
+ m.add_molecule (d);
+ reg = reg.right_str (reg.length_i ()-1);
}
if (reg == "E")
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(staff_space * 0.5 PT, Y_AXIS);
- m.add_molecule(d);
+ d.translate_axis (staff_space * 0.5 PT, Y_AXIS);
+ m.add_molecule (d);
}
}
else if (sym == "Bayanbase")
{
Molecule r = fm->find_by_name ("accordion-accBayanbase");
- m.add_molecule(r);
- if (reg.left_str(1) == "T")
+ m.add_molecule (r);
+ if (reg.left_str (1) == "T")
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(staff_space * 2.5 PT, Y_AXIS);
- m.add_molecule(d);
- reg = reg.right_str(reg.length_i()-1);
+ d.translate_axis (staff_space * 2.5 PT, Y_AXIS);
+ m.add_molecule (d);
+ reg = reg.right_str (reg.length_i ()-1);
}
/* include 4' reed just for completeness. You don't want to use this. */
- if (reg.left_str(1) == "F")
+ if (reg.left_str (1) == "F")
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
- m.add_molecule(d);
- reg = reg.right_str(reg.length_i()-1);
+ d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
+ m.add_molecule (d);
+ reg = reg.right_str (reg.length_i ()-1);
}
- if (reg.left_str(2) == "EE")
+ if (reg.left_str (2) == "EE")
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(staff_space * 0.5 PT, Y_AXIS);
- d.translate_axis(0.4 * staff_space PT, X_AXIS);
- m.add_molecule(d);
- d.translate_axis(-0.8 * staff_space PT, X_AXIS);
- m.add_molecule(d);
- reg = reg.right_str(reg.length_i()-2);
+ d.translate_axis (staff_space * 0.5 PT, Y_AXIS);
+ d.translate_axis (0.4 * staff_space PT, X_AXIS);
+ m.add_molecule (d);
+ d.translate_axis (-0.8 * staff_space PT, X_AXIS);
+ m.add_molecule (d);
+ reg = reg.right_str (reg.length_i ()-2);
}
- if (reg.left_str(1) == "E")
+ if (reg.left_str (1) == "E")
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(staff_space * 0.5 PT, Y_AXIS);
- m.add_molecule(d);
- reg = reg.right_str(reg.length_i()-1);
+ d.translate_axis (staff_space * 0.5 PT, Y_AXIS);
+ m.add_molecule (d);
+ reg = reg.right_str (reg.length_i ()-1);
}
}
else if (sym == "Stdbase")
{
Molecule r = fm->find_by_name ("accordion-accStdbase");
- m.add_molecule(r);
- if (reg.left_str(1) == "T")
+ m.add_molecule (r);
+ if (reg.left_str (1) == "T")
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(staff_space * 3.5 PT, Y_AXIS);
- m.add_molecule(d);
- reg = reg.right_str(reg.length_i()-1);
+ d.translate_axis (staff_space * 3.5 PT, Y_AXIS);
+ m.add_molecule (d);
+ reg = reg.right_str (reg.length_i ()-1);
}
- if (reg.left_str(1) == "F")
+ if (reg.left_str (1) == "F")
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(staff_space * 2.5 PT, Y_AXIS);
- m.add_molecule(d);
- reg = reg.right_str(reg.length_i()-1);
+ d.translate_axis (staff_space * 2.5 PT, Y_AXIS);
+ m.add_molecule (d);
+ reg = reg.right_str (reg.length_i ()-1);
}
- if (reg.left_str(1) == "M")
+ if (reg.left_str (1) == "M")
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(staff_space * 2 PT, Y_AXIS);
- d.translate_axis(staff_space PT, X_AXIS);
- m.add_molecule(d);
- reg = reg.right_str(reg.length_i()-1);
+ d.translate_axis (staff_space * 2 PT, Y_AXIS);
+ d.translate_axis (staff_space PT, X_AXIS);
+ m.add_molecule (d);
+ reg = reg.right_str (reg.length_i ()-1);
}
- if (reg.left_str(1) == "E")
+ if (reg.left_str (1) == "E")
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
- m.add_molecule(d);
- reg = reg.right_str(reg.length_i()-1);
+ d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
+ m.add_molecule (d);
+ reg = reg.right_str (reg.length_i ()-1);
}
- if (reg.left_str(1) == "S")
+ if (reg.left_str (1) == "S")
{
Molecule d = fm->find_by_name ("accordion-accDot");
- d.translate_axis(staff_space * 0.5 PT, Y_AXIS);
- m.add_molecule(d);
- reg = reg.right_str(reg.length_i()-1);
+ d.translate_axis (staff_space * 0.5 PT, Y_AXIS);
+ m.add_molecule (d);
+ reg = reg.right_str (reg.length_i ()-1);
}
}
/* ugh maybe try to use regular font for S.B. and B.B and only use one font
else if (sym == "SB")
{
Molecule r = fm->find_by_name ("accordion-accSB");
- m.add_molecule(r);
+ m.add_molecule (r);
}
else if (sym == "BB")
{
Molecule r = fm->find_by_name ("accordion-accBB");
- m.add_molecule(r);
+ m.add_molecule (r);
}
else if (sym == "OldEE")
{
Molecule r = fm->find_by_name ("accordion-accOldEE");
- m.add_molecule(r);
+ m.add_molecule (r);
}
else if (sym == "OldEES")
{
Molecule r = fm->find_by_name ("accordion-accOldEES");
- m.add_molecule(r);
+ m.add_molecule (r);
}
return m;
}
}
-IMPLEMENT_CTOR_CALLBACK(Lyric_combine_music_iterator);
+IMPLEMENT_CTOR_CALLBACK (Lyric_combine_music_iterator);
}
Pitch
-Lyric_combine_music::to_relative_octave ( Pitch p )
+Lyric_combine_music::to_relative_octave (Pitch p)
{
p = music_l ()->to_relative_octave (p);
return lyrics_l () ->to_relative_octave (p);
{
return unsmob_music (get_mus_property ("lyrics"));
}
+
+Lyric_combine_music::Lyric_combine_music ()
+ : Music (SCM_EOL)
+{
+}
+
+ADD_MUSIC (Lyric_combine_music);
class Lyric_engraver : public Engraver
{
protected:
- virtual void stop_translation_timestep();
+ virtual void stop_translation_timestep ();
virtual bool try_music (Music *);
virtual void create_grobs ();
virtual void start_translation_timestep ();
ADD_THIS_TRANSLATOR (Lyric_engraver);
-Lyric_engraver::Lyric_engraver()
+Lyric_engraver::Lyric_engraver ()
{
text_p_ =0;
req_l_ =0;
We can't reach the notehead where we're centered from here. So
we kludge.
- (UGH UGH, pulled amount of space out of thin air)
+ (UGH UGH, pulled amount of space out of thin air)
*/
text_p_->translate_axis (0.66, X_AXIS);
}
void
-Lyric_engraver::stop_translation_timestep()
+Lyric_engraver::stop_translation_timestep ()
{
if (text_p_)
{
#include "lyric-extender.hh"
-MAKE_SCHEME_CALLBACK(Lyric_extender,brew_molecule,1)
+MAKE_SCHEME_CALLBACK (Lyric_extender,brew_molecule,1)
SCM
Lyric_extender::brew_molecule (SCM smob)
{
Real sl = sp->paper_l ()->get_var ("stafflinethickness");
Real righttrim = 0.5; // default to half a space gap on the right
- SCM righttrim_scm = sp->get_grob_property("right-trim-amount");
+ SCM righttrim_scm = sp->get_grob_property ("right-trim-amount");
if (gh_number_p (righttrim_scm)) {
righttrim = gh_scm2double (righttrim_scm);
}
}
Real w = sp->spanner_length () - leftext - righttrim;
- Real h = sl * gh_scm2double (sp->get_grob_property ("height"));
- Molecule mol (Lookup::filledbox ( Box (Interval (0,w), Interval (0,h))));
+ Real h = sl * gh_scm2double (sp->get_grob_property ("height"));
+ Molecule mol (Lookup::filledbox (Box (Interval (0,w), Interval (0,h))));
mol.translate (Offset (leftext, 0));
- return mol.smobbed_copy();
+ return mol.smobbed_copy ();
}
void
class Lyric_performer : public Performer {
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Lyric_performer ();
protected:
Audio_element_info info (audio_p_, lreq_arr_[0]);
announce_element (info);
}
- lreq_arr_.clear();
+ lreq_arr_.clear ();
}
void
play_element (audio_p_);
audio_p_ = 0;
}
- lreq_arr_.clear();
+ lreq_arr_.clear ();
}
bool
#include "spanner.hh"
-String get_context_id(Translator_group * ancestor, const char * type);
-String trim_suffix(String &id);
+String get_context_id (Translator_group * ancestor, const char * type);
+String trim_suffix (String &id);
ADD_THIS_TRANSLATOR (Lyric_phrasing_engraver);
unnecessarily convoluted.
*/
-Lyric_phrasing_engraver::Lyric_phrasing_engraver()
+Lyric_phrasing_engraver::Lyric_phrasing_engraver ()
{
voice_alist_ = SCM_EOL;
any_notehead_l_ = 0;
}
-Lyric_phrasing_engraver::~Lyric_phrasing_engraver()
+Lyric_phrasing_engraver::~Lyric_phrasing_engraver ()
{
/*
No need to delete alist_; that's what Garbage collection is for.
Syllable_group *
-Lyric_phrasing_engraver::lookup_context_id(const String &context_id)
+Lyric_phrasing_engraver::lookup_context_id (const String &context_id)
{
- SCM key = ly_str02scm(context_id.ch_C());
- if( ! gh_null_p(voice_alist_) ) {
- SCM s = scm_assoc(key, voice_alist_);
- if(! (gh_boolean_p(s) && !to_boolean(s))) {
+ SCM key = ly_str02scm (context_id.ch_C ());
+ if (! gh_null_p (voice_alist_)) {
+ SCM s = scm_assoc (key, voice_alist_);
+ if (! (gh_boolean_p (s) && !to_boolean (s))) {
/* match found */
- // ( key . ( (alist_entry . old_entry) . previous_entry) )
- if(to_boolean(gh_cdadr(s))) { // it's an old entry ... make it a new one
- SCM val = gh_cons(gh_cons(gh_caadr(s), SCM_BOOL_F), gh_cddr(s));
- voice_alist_ = scm_assoc_set_x(voice_alist_, gh_car(s), val);
- return unsmob_voice_entry (gh_caar(val));
+ // (key . ((alist_entry . old_entry) . previous_entry))
+ if (to_boolean (gh_cdadr (s))) { // it's an old entry ... make it a new one
+ SCM val = gh_cons (gh_cons (gh_caadr (s), SCM_BOOL_F), gh_cddr (s));
+ voice_alist_ = scm_assoc_set_x (voice_alist_, gh_car (s), val);
+ return unsmob_voice_entry (gh_caar (val));
}
else { // the entry is current ... return it.
- SCM entry_scm = gh_caadr(s);
- return unsmob_voice_entry(entry_scm);
+ SCM entry_scm = gh_caadr (s);
+ return unsmob_voice_entry (entry_scm);
}
}
}
- // ( ( alist_entry . old_entry ) . previous_entry )
- SCM val = gh_cons(gh_cons(Syllable_group::make_entry (), SCM_BOOL_F),
+ // ((alist_entry . old_entry) . previous_entry)
+ SCM val = gh_cons (gh_cons (Syllable_group::make_entry (), SCM_BOOL_F),
Syllable_group::make_entry ());
- voice_alist_ = scm_acons(key, val, voice_alist_);
- return unsmob_voice_entry (gh_caar(val));
+ voice_alist_ = scm_acons (key, val, voice_alist_);
+ return unsmob_voice_entry (gh_caar (val));
}
void
-Lyric_phrasing_engraver::record_notehead(const String &context_id,
+Lyric_phrasing_engraver::record_notehead (const String &context_id,
Grob * notehead)
{
- Syllable_group * v = lookup_context_id(context_id);
- v->set_notehead(notehead);
- if(!any_notehead_l_)
+ Syllable_group * v = lookup_context_id (context_id);
+ v->set_notehead (notehead);
+ if (!any_notehead_l_)
any_notehead_l_ = notehead;
}
void
-Lyric_phrasing_engraver::record_lyric(const String &context_id, Grob * lyric)
+Lyric_phrasing_engraver::record_lyric (const String &context_id, Grob * lyric)
{
- Syllable_group * v = lookup_context_id(context_id);
- v->add_lyric(lyric);
+ Syllable_group * v = lookup_context_id (context_id);
+ v->add_lyric (lyric);
}
void
-Lyric_phrasing_engraver::record_extender(const String &context_id, Grob * extender)
+Lyric_phrasing_engraver::record_extender (const String &context_id, Grob * extender)
{
- SCM key = ly_str02scm(context_id.ch_C());
- if( ! gh_null_p(voice_alist_) ) {
- SCM s = scm_assoc(key, voice_alist_);
- if(! (gh_boolean_p(s) && !to_boolean(s))) {
+ SCM key = ly_str02scm (context_id.ch_C ());
+ if (! gh_null_p (voice_alist_)) {
+ SCM s = scm_assoc (key, voice_alist_);
+ if (! (gh_boolean_p (s) && !to_boolean (s))) {
/* match found */
- // ( key . ( (alist_entry . old_entry) . previous_entry) )
- SCM previous_scm = gh_cddr(s);
- if(previous_scm != SCM_EOL) {
- Syllable_group * v = unsmob_voice_entry(previous_scm);
- v->add_extender(extender);
+ // (key . ((alist_entry . old_entry) . previous_entry))
+ SCM previous_scm = gh_cddr (s);
+ if (previous_scm != SCM_EOL) {
+ Syllable_group * v = unsmob_voice_entry (previous_scm);
+ v->add_extender (extender);
}
}
}
}
void
-Lyric_phrasing_engraver::record_melisma(const String &context_id)
+Lyric_phrasing_engraver::record_melisma (const String &context_id)
{
- Syllable_group * v = lookup_context_id(context_id);
- v->set_melisma();
+ Syllable_group * v = lookup_context_id (context_id);
+ v->set_melisma ();
}
void
-Lyric_phrasing_engraver::acknowledge_grob(Grob_info i)
+Lyric_phrasing_engraver::acknowledge_grob (Grob_info i)
{
- SCM p = get_property("automaticPhrasing");
- if(!to_boolean(p))
+ SCM p = get_property ("automaticPhrasing");
+ if (!to_boolean (p))
return;
Grob *h = i.elem_l_;
- if (Note_head::has_interface(h)) {
+ if (Note_head::has_interface (h)) {
/* caught a note head ... do something with it */
/* ... but not if it's a grace note ... */
bool grace= to_boolean (i.elem_l_->get_grob_property ("grace"));
return;
/* what's its Voice context name? */
- String voice_context_id = get_context_id(i.origin_trans_l_->daddy_trans_l_, "Voice");
- record_notehead(voice_context_id, h);
+ String voice_context_id = get_context_id (i.origin_trans_l_->daddy_trans_l_, "Voice");
+ record_notehead (voice_context_id, h);
/* is it in a melisma ? */
- if(to_boolean(i.origin_trans_l_->get_property("melismaEngraverBusy"))) {
- record_melisma(voice_context_id);
+ if (to_boolean (i.origin_trans_l_->get_property ("melismaEngraverBusy"))) {
+ record_melisma (voice_context_id);
}
return;
}
/* what's its LyricsVoice context name? */
String voice_context_id;
- SCM voice_context_scm = i.origin_trans_l_->get_property("associatedVoice");
+ SCM voice_context_scm = i.origin_trans_l_->get_property ("associatedVoice");
if (gh_string_p (voice_context_scm)) {
- voice_context_id = ly_scm2string(voice_context_scm);
+ voice_context_id = ly_scm2string (voice_context_scm);
}
else {
- voice_context_id = get_context_id(i.origin_trans_l_->daddy_trans_l_, "LyricsVoice");
- voice_context_id = trim_suffix(voice_context_id);
+ voice_context_id = get_context_id (i.origin_trans_l_->daddy_trans_l_, "LyricsVoice");
+ voice_context_id = trim_suffix (voice_context_id);
}
- record_lyric(voice_context_id, h);
+ record_lyric (voice_context_id, h);
return;
}
then ignore it and let the Extender_engraver take care of it (i.e. finish at next
lyric).
*/
- if(h->has_interface (ly_symbol2scm ("lyric-extender-interface"))) {
- String voice_context_id = get_context_id(i.origin_trans_l_->daddy_trans_l_, "LyricsVoice");
- record_extender(trim_suffix(voice_context_id), h);
+ if (h->has_interface (ly_symbol2scm ("lyric-extender-interface"))) {
+ String voice_context_id = get_context_id (i.origin_trans_l_->daddy_trans_l_, "LyricsVoice");
+ record_extender (trim_suffix (voice_context_id), h);
return;
}
}
String
-get_context_id(Translator_group * ancestor, const char *type)
+get_context_id (Translator_group * ancestor, const char *type)
{
- while(ancestor != 0 && ancestor->type_str_ != type) {
+ while (ancestor != 0 && ancestor->type_str_ != type) {
ancestor = ancestor->daddy_trans_l_;
}
- if(ancestor != 0) {
+ if (ancestor != 0) {
return ancestor->id_str_;
}
}
String
-trim_suffix(String &id)
+trim_suffix (String &id)
{
- int index = id.index_i('-');
- if(index >= 0) {
- return id.left_str(index);
+ int index = id.index_i ('-');
+ if (index >= 0) {
+ return id.left_str (index);
}
return id;
}
void Lyric_phrasing_engraver::create_grobs ()
{
/* iterate through entries in voice_alist_
- for each, call set_lyric_align(alignment). Issue a warning if this returns false.
+ for each, call set_lyric_align (alignment). Issue a warning if this returns false.
*/
String punc;
- SCM sp = get_property("phrasingPunctuation");
- punc = gh_string_p(sp) ? ly_scm2string(sp) : ".,;:?!\"";
+ SCM sp = get_property ("phrasingPunctuation");
+ punc = gh_string_p (sp) ? ly_scm2string (sp) : ".,;:?!\"";
- for(SCM v=voice_alist_; gh_pair_p(v); v = gh_cdr(v)) {
- SCM v_entry = gh_cdar(v);
+ for (SCM v=voice_alist_; gh_pair_p (v); v = gh_cdr (v)) {
+ SCM v_entry = gh_cdar (v);
// ((current . oldflag) . previous)
- if(!to_boolean(gh_cdar(v_entry))) { // not an old entry left over from a prior note ...
- Syllable_group *entry = unsmob_voice_entry(gh_caar(v_entry));
+ if (!to_boolean (gh_cdar (v_entry))) { // not an old entry left over from a prior note ...
+ Syllable_group *entry = unsmob_voice_entry (gh_caar (v_entry));
/*
TODO: give context for warning.
*/
- if(! entry->set_lyric_align(punc.ch_C(), any_notehead_l_))
+ if (! entry->set_lyric_align (punc.ch_C (), any_notehead_l_))
warning (_ ("lyrics found without any matching notehead"));
// is this note melismatic? If so adjust alignment of previous one.
- if(entry->get_melisma()) {
- if(entry->lyric_count())
+ if (entry->get_melisma ()) {
+ if (entry->lyric_count ())
warning (_ ("Huh? Melismatic note found to have associated lyrics."));
- SCM previous_scm = gh_cdr(v_entry);
- if(previous_scm != SCM_EOL) {
- Syllable_group *previous = unsmob_voice_entry(previous_scm);
- if (previous->lyric_count())
- previous->adjust_melisma_align();
+ SCM previous_scm = gh_cdr (v_entry);
+ if (previous_scm != SCM_EOL) {
+ Syllable_group *previous = unsmob_voice_entry (previous_scm);
+ if (previous->lyric_count ())
+ previous->adjust_melisma_align ();
}
}
}
void
Lyric_phrasing_engraver::stop_translation_timestep ()
{
- for(SCM v=voice_alist_; gh_pair_p(v); v = gh_cdr(v)) {
- SCM entry_scm = gh_cdar(v);
+ for (SCM v=voice_alist_; gh_pair_p (v); v = gh_cdr (v)) {
+ SCM entry_scm = gh_cdar (v);
// ((alist_entry . entry_is_old) . previous_entry)
- Syllable_group * entry = unsmob_voice_entry(gh_caar(entry_scm));
+ Syllable_group * entry = unsmob_voice_entry (gh_caar (entry_scm));
// set previous_entry, set entry_is_old, and resave it to alist_
// but only change if this current was not old.
- if(! to_boolean(gh_cdar(entry_scm))) {
- Syllable_group * previous_entry = unsmob_voice_entry(gh_cdr(entry_scm));
- previous_entry->copy(entry);
- entry_scm = gh_cons(gh_cons(gh_caar(entry_scm), SCM_BOOL_T), gh_cdr(entry_scm));
- voice_alist_ = scm_assoc_set_x(voice_alist_, gh_caar(v), entry_scm);
+ if (! to_boolean (gh_cdar (entry_scm))) {
+ Syllable_group * previous_entry = unsmob_voice_entry (gh_cdr (entry_scm));
+ previous_entry->copy (entry);
+ entry_scm = gh_cons (gh_cons (gh_caar (entry_scm), SCM_BOOL_T), gh_cdr (entry_scm));
+ voice_alist_ = scm_assoc_set_x (voice_alist_, gh_caar (v), entry_scm);
}
- entry->next_lyric();
+ entry->next_lyric ();
}
any_notehead_l_ = 0;
}
{0, "safe", 's', _i ("inhibit file output naming and exporting")},
{0, "no-timestamps", 'T', _i ("don't timestamp the output")},
{0, "version", 'v', _i ("print version number")},
- {0, "verbose", 'V', _i("verbose")},
+ {0, "verbose", 'V', _i ("verbose")},
{0, "warranty", 'w', _i ("show warranty and copyright")},
{0, "midi-debug", 'X', _i ("write midi ouput in formatted ascii")},
{0,0,0,0}
cout << _ ("Typeset music and or play MIDI from FILE");
cout << "\n\n";
cout <<
-_(
+_ (
"LilyPond is a music typesetter. It produces beautiful sheet music\n"
"using a high level description file as input. LilyPond is part of \n"
"the GNU Project.\n"
urg; what *do* we want with $LILYPONDPREFIX, DIR_DATADIR and $prefix/share
handy for multiple source-dir runs, though...
*/
- if (!prefix_directory.empty_b())
+ if (!prefix_directory.empty_b ())
{
lily_locale_dir = prefix_directory + "/share/locale";
- bindtextdomain (name.ch_C (), lily_locale_dir.ch_C());
+ bindtextdomain (name.ch_C (), lily_locale_dir.ch_C ());
}
else
bindtextdomain (name.ch_C (), DIR_LOCALEDIR);
global_path.add (p);
#if !KPATHSEA
- /* Urg: GNU make's $(word) index starts at 1 */
+ /* Urg: GNU make's $ (word) index starts at 1 */
int i = 1;
while (global_path.try_add (p + to_str (".") + to_str (i)))
i++;
ly_init_kpath (argv[0]);
- oparser_p_static = new Getopt_long(argc, argv, options_static);
- while (Long_option_init const * opt = (*oparser_p_static)())
+ oparser_p_static = new Getopt_long (argc, argv, options_static);
+ while (Long_option_init const * opt = (*oparser_p_static) ())
{
switch (opt->shortname_ch_)
{
#ifdef WINNT
gh_enter (argc, argv, main_prog);
#else
- gh_enter (argc, argv, (void(*)(int, char**))main_prog);
+ gh_enter (argc, argv, (void (*) (int, char**))main_prog);
#endif
return 0; // unreachable
source file of the GNU LilyPond music typesetter
- (c) 1998--2001 Jan Nieuwenhuizen <janneke@gnu.org>
+ (c) 1998--2001 Jan Nieuwenhuizen <janneke@gnu.org>
*/
#include <ctype.h>
class Mark_engraver : public Engraver
{
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Mark_engraver ();
protected:
Item* text_p_;
protected:
virtual void stop_translation_timestep ();
virtual void acknowledge_grob (Grob_info);
- void create_items(Request*);
+ void create_items (Request*);
virtual bool try_music (Music *req_l);
virtual void start_translation_timestep ();
virtual void initialize ();
{
if (text_p_)
{
- text_p_->set_grob_property("side-support-elements" , get_property ("staffsFound"));
+ text_p_->set_grob_property ("side-support-elements" , get_property ("staffsFound"));
typeset_grob (text_p_);
text_p_ =0;
}
c++;
next = to_str (c);
}
- m = ly_str02scm (next.ch_C());
+ m = ly_str02scm (next.ch_C ());
}
else
{
daddy_trans_l_->set_property ("rehearsalMark", m);
text_p_->set_grob_property ("text",
- ly_str02scm ( t.ch_C()));
+ ly_str02scm (t.ch_C ()));
String style = "mark";
- for (int i=0; i < t.length_i(); i++)
+ for (int i=0; i < t.length_i (); i++)
{
- if (!isdigit(t[i]))
+ if (!isdigit (t[i]))
{
style = "large";
break;
}
}
- SCM st = ly_symbol2scm (style.ch_C());
+ SCM st = ly_symbol2scm (style.ch_C ());
text_p_->set_grob_property ("font-style", st);
}
class Melisma_engraver:public Engraver
{
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
bool try_music (Music *);
};
-ADD_THIS_TRANSLATOR(Melisma_engraver);
+ADD_THIS_TRANSLATOR (Melisma_engraver);
bool
-Melisma_engraver::try_music (Music *m )
+Melisma_engraver::try_music (Music *m)
{
- if (dynamic_cast<Melisma_playing_req*>(m))
+ if (dynamic_cast<Melisma_playing_req*> (m))
{
SCM plain (get_property ("melismaBusy"));
SCM slur (get_property ("slurMelismaBusy"));
SCM tie (get_property ("tieMelismaBusy"));
SCM beam (get_property ("beamMelismaBusy"));
- if( (to_boolean (plain))
+ if ((to_boolean (plain))
|| (to_boolean (slur))
|| (to_boolean (tie))
|| (to_boolean (beam))) {
- daddy_trans_l_->set_property("melismaEngraverBusy",SCM_BOOL_T);
+ daddy_trans_l_->set_property ("melismaEngraverBusy",SCM_BOOL_T);
return true;
}
}
- daddy_trans_l_->set_property("melismaEngraverBusy",SCM_BOOL_F);
+ daddy_trans_l_->set_property ("melismaEngraverBusy",SCM_BOOL_F);
return false;
}
#include "debug.hh"
#include "scope.hh"
-Midi_def::Midi_def()
+Midi_def::Midi_def ()
{
// ugh
set_tempo (Moment (1, 4), 60);
Midi_def::get_tempo_i (Moment one_beat_mom)
{
Moment w = *unsmob_moment (scope_p_->scm_elem ("whole-in-seconds"));
- Moment wholes_per_min = Moment(60) /w;
+ Moment wholes_per_min = Moment (60) /w;
int beats_per_min = wholes_per_min / one_beat_mom;
return int (beats_per_min);
}
{
Moment beats_per_second = Moment (beats_per_minute_i) / Moment (60);
- Moment m = Moment(1)/Moment(beats_per_second * one_beat_mom);
- scope_p_->set ("whole-in-seconds", m.smobbed_copy());
+ Moment m = Moment (1)/Moment (beats_per_second * one_beat_mom);
+ scope_p_->set ("whole-in-seconds", m.smobbed_copy ());
}
Midi_item::i2varint_str (int i)
{
int buffer_i = i & 0x7f;
- while ( (i >>= 7) > 0)
+ while ((i >>= 7) > 0)
{
buffer_i <<= 8;
buffer_i |= 0x80;
*/
static Real const full_scale = 127;
- int volume = (int)(audio_l_->volume_*full_scale);
+ int volume = (int) (audio_l_->volume_*full_scale);
if (volume <= 0)
volume = 1;
if (volume > full_scale)
else if (audio_l_->type_str_ == "UnaChorda")
str += to_str ((char)0x43);
- int pedal = ((1 - audio_l_->dir_) / 2 ) * 0x7f;
+ int pedal = ((1 - audio_l_->dir_) / 2) * 0x7f;
str += to_str ((char)pedal);
return str;
}
#include "midi-stream.hh"
#include "debug.hh"
-Midi_note_event::Midi_note_event()
+Midi_note_event::Midi_note_event ()
{
ignore_b_ = false;
}
last_mom_ = 0;
}
-Midi_walker::~Midi_walker()
+Midi_walker::~Midi_walker ()
{
// ugh
do_stop_notes (last_mom_ + Moment (10, 1));
Moment stop_mom = note_p->length_mom () + ptr->audio_column_l_->at_mom ();
bool play_start = true;
- for (int i=0; i < stop_note_queue.size(); i++)
+ for (int i=0; i < stop_note_queue.size (); i++)
{
/* if this pith already in queue */
- if (stop_note_queue[i].val->pitch_i() == note_p->pitch_i ())
+ if (stop_note_queue[i].val->pitch_i () == note_p->pitch_i ())
{
if (stop_note_queue[i].key < stop_mom)
{
void
Midi_walker::do_stop_notes (Moment max_mom)
{
- while (stop_note_queue.size() && stop_note_queue.front ().key <= max_mom)
+ while (stop_note_queue.size () && stop_note_queue.front ().key <= max_mom)
{
- Midi_note_event e = stop_note_queue.get();
+ Midi_note_event e = stop_note_queue.get ();
if (e.ignore_b_)
{
delete e.val;
}
void
-Midi_walker::process()
+Midi_walker::process ()
{
Audio_item* audio_p = (*item_l_arr_l_)[index_];
do_stop_notes (audio_p->audio_column_l_->at_mom ());
if (Midi_item* midi_p = Midi_item::midi_p (audio_p))
{
midi_p->channel_i_ = track_l_->number_i_;
- if (Midi_note* note_p = dynamic_cast<Midi_note*>(midi_p))
+ if (Midi_note* note_p = dynamic_cast<Midi_note*> (midi_p))
{
if (note_p->length_mom ())
do_start_note (note_p);
}
void
-Midi_walker::operator ++(int)
+Midi_walker::operator ++ (int)
{
- assert (ok());
+ assert (ok ());
index_++;
}
Return the 2-log, rounded down
*/
int
-intlog2(int d)
+intlog2 (int d)
{
assert (d);
int i=0;
i++;
}
- assert (!(d/2));
+ assert (! (d/2));
return i;
}
double
-log_2(double x)
+log_2 (double x)
{
return log (x) /log (2.0);
}
Real period = positions.top () - positions[0];
int n = int ((x - positions[0]) / period);
- Real frac = (x - positions[0] ) - n * period;
+ Real frac = (x - positions[0]) - n * period;
while (frac < 0)
{
}
Real px = frac + positions[0];
- assert ( positions[0] <= px && px <= positions.top ());
+ assert (positions[0] <= px && px <= positions.top ());
int i=0;
for (; i < positions.size () - 1; i++)
{
SCM
Molecule::smobbed_copy () const
{
- Molecule * m = new Molecule(*this);
+ Molecule * m = new Molecule (*this);
return m->smobbed_self ();
}
Interval
-Molecule::extent(Axis a) const
+Molecule::extent (Axis a) const
{
return dim_[a];
}
dim_ = b;
}
-Molecule::Molecule()
+Molecule::Molecule ()
{
expr_ = SCM_EOL;
set_empty (true);
Axis a = X_AXIS;
while (a < NO_AXES)
{
- if (abs(o[a]) > 30 CM
+ if (abs (o[a]) > 30 CM
|| isinf (o[a]) || isnan (o[a]))
{
programming_error ("Improbable offset for translation: setting to zero");
void
Molecule::translate_axis (Real x,Axis a)
{
- Offset o(0,0);
+ Offset o (0,0);
o[a] = x;
translate (o);
}
}
else
{
- dim_[X_AXIS] = Interval(0,0);
+ dim_[X_AXIS] = Interval (0,0);
dim_[Y_AXIS] = Interval (0,0);
}
}
Molecule::align_to (Axis a, Direction d)
{
Interval i (extent (a));
- Real r = (d == CENTER) ? i.center () : i[d];
+ Real r = (d == CENTER) ? i.center () : i[d];
translate_axis (-r, a);
}
if (m && axis_p (axis) && number_pair_p (np))
{
Interval iv = ly_scm2interval (np);
- m->dim_[Axis(gh_scm2int (axis))] = ly_scm2interval (np);
+ m->dim_[Axis (gh_scm2int (axis))] = ly_scm2interval (np);
}
else
warning ("ly-set-molecule-extent!: invalid arguments");
scm_make_gsubr ("ly-set-molecule-extent!", 3 , 0, 0, (Scheme_function_unknown) Molecule::ly_set_molecule_extent_x);
scm_make_gsubr ("ly-get-molecule-extent", 2 , 0, 0, (Scheme_function_unknown) Molecule::ly_get_molecule_extent);
}
-ADD_SCM_INIT_FUNC(molecule,molecule_init);
+ADD_SCM_INIT_FUNC (molecule,molecule_init);
bool
}
SCM
-fontify_atom(Font_metric * met, SCM f)
+fontify_atom (Font_metric * met, SCM f)
{
if (f == SCM_EOL)
return f;
{
return dim_;
}
-IMPLEMENT_SIMPLE_SMOBS(Molecule);
+IMPLEMENT_SIMPLE_SMOBS (Molecule);
int
Molecule *r = (Molecule *) gh_cdr (s);
scm_puts ("#<Molecule ", port);
- /* String str(r->str());
- scm_puts ((char *)str.ch_C(), port);*/
+ /* String str (r->str ());
+ scm_puts ((char *)str.ch_C (), port);*/
scm_puts (" >", port);
return 1;
return r->expr_;
}
-IMPLEMENT_TYPE_P(Molecule, "molecule?");
-IMPLEMENT_DEFAULT_EQUAL_P(Molecule);
-IMPLEMENT_UNSMOB(Molecule, molecule);
+IMPLEMENT_TYPE_P (Molecule, "molecule?");
+IMPLEMENT_DEFAULT_EQUAL_P (Molecule);
+IMPLEMENT_UNSMOB (Molecule, molecule);
#include "warn.hh"
#include "ly-smobs.icc"
-IMPLEMENT_UNSMOB(Moment,moment);
-IMPLEMENT_SIMPLE_SMOBS(Moment);
+IMPLEMENT_UNSMOB (Moment,moment);
+IMPLEMENT_SIMPLE_SMOBS (Moment);
IMPLEMENT_TYPE_P (Moment, "moment?");
SCM
Moment::smobbed_copy () const
{
Moment * m = new Moment (*this);
- return m->smobbed_self();
+ return m->smobbed_self ();
}
Moment *r = (Moment *) gh_cdr (s);
scm_puts ("#<Mom ", port);
- String str(r->str());
- scm_puts ((char *)str.ch_C(), port);
+ String str (r->str ());
+ scm_puts ((char *)str.ch_C (), port);
scm_puts (" >", port);
return 1;
{
Moment m (1,1);
- if (SCM_INUMP (n) && SCM_INUMP(d))
+ if (SCM_INUMP (n) && SCM_INUMP (d))
{
m = Moment (gh_scm2int (n), gh_scm2int (d));
}
scm_make_gsubr ("make-moment", 2 , 0, 0, (Scheme_function_unknown) make_rational);
}
-ADD_SCM_INIT_FUNC(moms,init_moments);
+ADD_SCM_INIT_FUNC (moms,init_moments);
SCM
Moment::equal_p (SCM a, SCM b)
class Multi_measure_rest_engraver : public Engraver
{
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Multi_measure_rest_engraver ();
protected:
if (scm_equal_p (sp->get_mus_property ("span-type"),
ly_str02scm ("rest")) == SCM_BOOL_T)
{
- if (sp->get_span_dir() == STOP)
+ if (sp->get_span_dir () == STOP)
{
stop_req_l_ = sp;
}
- else if (sp->get_span_dir() == START && !new_req_l_)
+ else if (sp->get_span_dir () == START && !new_req_l_)
{
new_req_l_ = sp;
}
void
Multi_measure_rest_engraver::process_music ()
{
- if (new_req_l_ && stop_req_l_)
+ if (new_req_l_ && stop_req_l_)
stop_req_l_ = 0;
if (new_req_l_)
Multi_measure_rest_engraver::stop_translation_timestep ()
{
SCM smp = get_property ("measurePosition");
- Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
+ Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
if (mmrest_p_ && (now_mom () >= start_moment_)
&& !mp
Multi_measure_rest_engraver::start_translation_timestep ()
{
SCM smp = get_property ("measurePosition");
- Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
+ Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
if (mmrest_p_ && !mp)
{
return me->has_interface (ly_symbol2scm ("multi-measure-rest-interface"));
}
+MAKE_SCHEME_CALLBACK (Multi_measure_rest,percent,1);
+SCM
+Multi_measure_rest::percent (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ Spanner *sp = dynamic_cast<Spanner*> (me);
+
+ Font_metric *musfont = Font_interface::get_default_font (me);
+
+ Molecule r (musfont->find_by_name ("scripts-repeatsign"));
+
+ // ugh copy & paste.
+
+ Interval sp_iv;
+ Direction d = LEFT;
+ do
+ {
+ Item * col = sp->get_bound (d)->column_l ();
+
+ Interval coldim = col->extent (0, X_AXIS);
+
+ sp_iv[d] = coldim[-d] ;
+ }
+ while ((flip (&d)) != LEFT);
+ Real x_off = 0.0;
+
+ Real rx = sp->get_bound (LEFT)->relative_coordinate (0, X_AXIS);
+ /*
+ we gotta stay clear of sp_iv, so move a bit to the right if
+ needed.
+ */
+ x_off += (sp_iv[LEFT] - rx) >? 0;
+
/*
+ center between stuff.
+ */
+ x_off += sp_iv.length ()/ 2;
+
+ r.translate_axis (x_off,X_AXIS);
+
+
+ return r.smobbed_copy ();
+}
+
+
+/*
[TODO] 17
- * variable-sized multi-measure rest symbol: |====| ??
+ variable-sized multi-measure rest symbol: |====| ??
*/
-MAKE_SCHEME_CALLBACK(Multi_measure_rest,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Multi_measure_rest,brew_molecule,1);
SCM
Multi_measure_rest::brew_molecule (SCM smob)
{
Grob *me = unsmob_grob (smob);
+ if (to_boolean (me->get_grob_property ("skip-timestep")))
+ {
+ me->set_grob_property ("skip-timestep", SCM_EOL);
+ return SCM_EOL;
+ }
+
Spanner * sp = dynamic_cast<Spanner*> (me);
SCM alist_chain = Font_interface::font_alist_chain (me);
}
else
{
- String idx = ("rests-") + to_str (-4);
+ String idx = ("rests-") + to_str (-4);
s = musfont->find_by_name (idx);
}
mol.add_molecule (s);
}
mol.translate_axis (x_off, X_AXIS);
- return mol.smobbed_copy();
+ return mol.smobbed_copy ();
}
/*
Grob*me = unsmob_grob (smob);
Spanner*sp = dynamic_cast<Spanner*> (me);
- if (!(sp->get_bound (LEFT) && sp->get_bound (RIGHT)))
+ if (! (sp->get_bound (LEFT) && sp->get_bound (RIGHT)))
{
programming_error ("Multi_measure_rest::get_rods (): I am not spanned!");
return SCM_UNSPECIFIED;
--- /dev/null
+/*
+ music-constructor.cc -- implement Music_constructor
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include <map> // UGH.
+#include "music-constructor.hh"
+typedef Music* (*Music_ctor) ();
+
+static map<String,Music_ctor> *ctors_map_;
+
+void
+add_music_ctor (String s, Music_ctor c)
+{
+ if (!ctors_map_)
+ ctors_map_ = new map<String, Music_ctor>;
+
+ (*ctors_map_)[s] = c;
+}
+
+
+Music_ctor
+get_music_ctor (String s)
+{
+ if (ctors_map_->find (s) == ctors_map_->end ())
+ return 0;
+
+ return (* ctors_map_)[s];
+}
+
+Music*
+get_music (String s)
+{
+ return (*get_music_ctor (s)) ();
+}
+
}
void
-Music_iterator::skip (Moment )
+Music_iterator::skip (Moment)
{
}
Moment
-Music_iterator::music_length_mom() const
+Music_iterator::music_length_mom () const
{
return music_length_;
}
Music_iterator*
Music_iterator::try_music (Music *m) const
{
- bool b = report_to_l ()->try_music ( (Music*)m); // ugh
+ bool b = report_to_l ()->try_music ((Music*)m); // ugh
Music_iterator * it = b ? (Music_iterator*) this : 0; // ugh
if (!it)
it = try_music_in_children (m);
return 0;
}
-IMPLEMENT_CTOR_CALLBACK(Music_iterator);
+IMPLEMENT_CTOR_CALLBACK (Music_iterator);
return maximum_length ();
}
-Simultaneous_music::Simultaneous_music(SCM head)
+Simultaneous_music::Simultaneous_music (SCM head)
: Music_sequence (head)
{
set_mus_property ("iterator-ctor",
Simultaneous_music_iterator::constructor_cxx_function);
}
-Sequential_music::Sequential_music(SCM head)
+Simultaneous_music::Simultaneous_music ()
+ : Music_sequence ()
+{
+ set_mus_property ("iterator-ctor",
+ Simultaneous_music_iterator::constructor_cxx_function);
+
+}
+
+Sequential_music::Sequential_music (SCM head)
: Music_sequence (head)
{
set_mus_property ("iterator-ctor",
Sequential_music_iterator::constructor_cxx_function);
}
+Sequential_music::Sequential_music ()
+ : Music_sequence ()
+{
+ set_mus_property ("iterator-ctor",
+ Sequential_music_iterator::constructor_cxx_function);
+}
Moment
return do_relative_octave (p, true);
}
-Request_chord::Request_chord(SCM s)
+Request_chord::Request_chord (SCM s)
: Simultaneous_music (s)
{
set_mus_property ("iterator-ctor",
Request_chord_iterator::constructor_cxx_function);
}
+Request_chord::Request_chord ()
+{
+ set_mus_property ("iterator-ctor",
+ Request_chord_iterator::constructor_cxx_function);
+}
+
Pitch
Request_chord::to_relative_octave (Pitch last)
{
Pitch pit = *unsmob_pitch (m->get_mus_property ("pitch"));
pit.to_relative_octave (last);
- m->set_mus_property ("pitch", pit.smobbed_copy());
+ m->set_mus_property ("pitch", pit.smobbed_copy ());
return pit;
}
+ADD_MUSIC (Simultaneous_music);
+ADD_MUSIC (Sequential_music);
+ADD_MUSIC (Request_chord);
}
-IMPLEMENT_SMOBS(Music_output_def);
-IMPLEMENT_UNSMOB(Music_output_def,music_output_def);
-IMPLEMENT_DEFAULT_EQUAL_P(Music_output_def);
+IMPLEMENT_SMOBS (Music_output_def);
+IMPLEMENT_UNSMOB (Music_output_def,music_output_def);
+IMPLEMENT_DEFAULT_EQUAL_P (Music_output_def);
SCM
Music_output_def::mark_smob (SCM m)
{
Music_output_def * mo = (Music_output_def*) SCM_CELL_WORD_1 (m);
scm_gc_mark (mo->style_sheet_);
- scm_gc_mark (mo->translator_tab_->self_scm());
- scm_gc_mark (mo->variable_tab_->self_scm());
+ scm_gc_mark (mo->translator_tab_->self_scm ());
+ scm_gc_mark (mo->variable_tab_->self_scm ());
return mo->scaled_fonts_;
}
Music_sequence::append_music (Music *m)
{
set_mus_property ("elements",
- gh_append2( music_list(), gh_cons (m->self_scm (), SCM_EOL)));
+ gh_append2 (music_list (), gh_cons (m->self_scm (), SCM_EOL)));
scm_unprotect_object (m->self_scm ());
}
-Music_sequence::Music_sequence(SCM l)
+Music_sequence::Music_sequence (SCM l)
: Music (l)
{
}
for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s))
{
last = unsmob_music (gh_car (s))->to_relative_octave (last);
- if (!count ++ )
+ if (!count ++)
retval = last;
}
for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s))
unsmob_music (gh_car (s))->compress (m);
}
+
+ADD_MUSIC (Music_sequence);
+
+Music_sequence::Music_sequence ()
+ : Music (SCM_EOL)
+{
+
+}
return child_iter_p_->try_music (m);
}
-IMPLEMENT_CTOR_CALLBACK(Music_wrapper_iterator);
+IMPLEMENT_CTOR_CALLBACK (Music_wrapper_iterator);
}
-Music_wrapper::Music_wrapper(SCM l)
+Music_wrapper::Music_wrapper (SCM l)
: Music (l)
{
}
{
element ()->compress (m);
}
+
+ADD_MUSIC (Music_wrapper);
+
+Music_wrapper::Music_wrapper ()
+ : Music (SCM_EOL)
+{
+
+}
}
-Music::Music(SCM l)
+Music::Music (SCM l)
{
immutable_property_alist_ = l;
mutable_property_alist_ = SCM_EOL;
SCM
Music::mark_smob (SCM m)
{
- Music * mus = (Music *)SCM_CELL_WORD_1(m);
+ Music * mus = (Music *)SCM_CELL_WORD_1 (m);
scm_gc_mark (mus->immutable_property_alist_);
scm_gc_mark (mus->mutable_property_alist_);
return SCM_EOL;
{
SCM l = get_mus_property ("length");
if (unsmob_moment (l))
- return *unsmob_moment(l);
+ return *unsmob_moment (l);
else if (gh_procedure_p (l))
{
- SCM res = gh_call1(l, self_scm( ));
- return *unsmob_moment(res);
+ SCM res = gh_call1 (l, self_scm ());
+ return *unsmob_moment (res);
}
return 0;
}
int
-Music::print_smob(SCM s, SCM p, scm_print_state*)
+Music::print_smob (SCM s, SCM p, scm_print_state*)
{
scm_puts ("#<Music ", p);
Music* m = unsmob_music (s);
- scm_puts (classname(m),p);
+ scm_puts (classname (m),p);
print_alist (m->mutable_property_alist_, p);
print_alist (m->immutable_property_alist_, p);
void
-Music::transpose (Pitch )
+Music::transpose (Pitch)
{
}
-IMPLEMENT_TYPE_P(Music, "music?");
-IMPLEMENT_UNSMOB(Music,music);
-IMPLEMENT_SMOBS(Music);
-IMPLEMENT_DEFAULT_EQUAL_P(Music);
+IMPLEMENT_TYPE_P (Music, "music?");
+IMPLEMENT_UNSMOB (Music,music);
+IMPLEMENT_SMOBS (Music);
+IMPLEMENT_DEFAULT_EQUAL_P (Music);
/****************************/
SCM
Music::get_mus_property (SCM sym) const
{
- SCM s = scm_sloppy_assq(sym, mutable_property_alist_);
+ SCM s = scm_sloppy_assq (sym, mutable_property_alist_);
if (s != SCM_BOOL_F)
return gh_cdr (s);
}
else
{
- warning (_("ly_get_mus_property (): Not a Music"));
+ warning (_ ("ly_get_mus_property (): Not a Music"));
scm_write (mus, scm_current_error_port ());
}
return SCM_EOL;
if (!gh_symbol_p (sym))
{
- warning (_("ly_set_mus_property (): Not a symbol"));
+ warning (_ ("ly_set_mus_property (): Not a symbol"));
scm_write (mus, scm_current_error_port ());
return SCM_UNSPECIFIED;
}
else
{
- warning (_("ly_set_mus_property (): not of type Music"));
+ warning (_ ("ly_set_mus_property (): not of type Music"));
scm_write (mus, scm_current_error_port ());
}
return SCM_UNSPECIFIED;
}
+
+// to do property args
+SCM
+ly_make_music (SCM type)
+{
+ if (!gh_string_p (type))
+ {
+ warning (_ ("ly_make_music (): Not a string"));
+ scm_write (type, scm_current_error_port ());
+
+ return SCM_UNSPECIFIED;
+ }
+ else
+ {
+ SCM s = get_music (ly_scm2string (type))->self_scm ();
+ scm_unprotect_object (s);
+ return s;
+ }
+}
+
static void
init_functions ()
{
scm_make_gsubr ("ly-get-mus-property", 2, 0, 0, (Scheme_function_unknown)ly_get_mus_property);
scm_make_gsubr ("ly-set-mus-property", 3, 0, 0, (Scheme_function_unknown)ly_set_mus_property);
+ scm_make_gsubr ("ly-make-music", 1, 0, 0, (Scheme_function_unknown)ly_make_music);
}
-ADD_SCM_INIT_FUNC(musicscm,init_functions);
+ADD_SCM_INIT_FUNC (musicscm,init_functions);
Moment
Rhythmic_req::length_mom () const
{
- return unsmob_duration ( get_mus_property( "duration"))->length_mom ();
+ return unsmob_duration (get_mus_property ("duration"))->length_mom ();
}
void
Rhythmic_req::compress (Moment m)
{
- Duration *d = unsmob_duration (get_mus_property( "duration"));
+ Duration *d = unsmob_duration (get_mus_property ("duration"));
- set_mus_property ("duration", d ->compressed (m).smobbed_copy());
+ set_mus_property ("duration", d ->compressed (m).smobbed_copy ());
}
bool
t->get_mus_property ("text"));
}
-
bool
Articulation_req::do_equal_b (Request const* r) const
{
}
+
+
+
+
+
+
+
+
+
+
+
+
{0,0}
};
-My_lily_lexer::My_lily_lexer()
+My_lily_lexer::My_lily_lexer ()
{
keytable_p_ = new Keyword_table (the_key_tab);
toplevel_variable_tab_ = new Scheme_hash_table ;
SCM
My_lily_lexer::lookup_identifier (String s)
{
- SCM sym = ly_symbol2scm (s.ch_C());
+ SCM sym = ly_symbol2scm (s.ch_C ());
- for (int i = scope_l_arr_.size (); i--; )
+ for (int i = scope_l_arr_.size (); i--;)
{
SCM val = SCM_UNSPECIFIED;
if (scope_l_arr_[i]->try_retrieve (sym, &val))
My_lily_lexer::start_main_input ()
{
new_input (main_input_str_, source_global_l);
- allow_includes_b_ = allow_includes_b_ && !(safe_global_b);
+ allow_includes_b_ = allow_includes_b_ && ! (safe_global_b);
}
void
{
if (lookup_keyword (name_str) >= 0)
{
- warning ( _f ("Identifier name is a keyword: `%s'", name_str));
+ warning (_f ("Identifier name is a keyword: `%s'", name_str));
}
scope_l_arr_.top ()->set (name_str, s);
}
-My_lily_lexer::~My_lily_lexer()
+My_lily_lexer::~My_lily_lexer ()
{
delete keytable_p_;
scm_unprotect_object (toplevel_variable_tab_->self_scm ());
void
My_lily_lexer::LexerError (char const *s)
{
- if (include_stack_.empty())
+ if (include_stack_.empty ())
{
progress_indication (_f ("error at EOF: %s", s)+ String ("\n"));
}
else
{
errorlevel_i_ |= 1;
- Input spot (source_file_l(),here_ch_C());
+ Input spot (source_file_l (),here_ch_C ());
spot.error (s);
}
}
char
-My_lily_lexer::escaped_char(char c) const
+My_lily_lexer::escaped_char (char c) const
{
- switch(c)
+ switch (c)
{
case 'n':
return '\n';
default_header_p_ =0;
}
-My_lily_parser::~My_lily_parser()
+My_lily_parser::~My_lily_parser ()
{
delete lexer_p_;
delete default_header_p_;
}
void
-My_lily_parser::set_version_check (bool )
+My_lily_parser::set_version_check (bool)
{
}
lexer_p_->main_input_str_ = s;
- progress_indication (_("Parsing..."));
+ progress_indication (_ ("Parsing..."));
set_yydebug (flower_dstream &&!flower_dstream->silent_b ("Parser"));
lexer_p_->new_input (init, source_l_);
do_yyparse ();
- if (!define_spot_array_.empty())
+ progress_indication ("\n");
+
+ if (!define_spot_array_.empty ())
{
define_spot_array_.top ().warning (_ ("Braces don't match"));
error_level_i_ = 1;
}
void
-My_lily_parser::remember_spot()
+My_lily_parser::remember_spot ()
{
- define_spot_array_.push (here_input());
+ define_spot_array_.push (here_input ());
}
char const *
-My_lily_parser::here_ch_C() const
+My_lily_parser::here_ch_C () const
{
- return lexer_p_->here_ch_C();
+ return lexer_p_->here_ch_C ();
}
void
My_lily_parser::parser_error (String s)
{
- here_input().error (s);
+ here_input ().error (s);
error_level_i_ = 1;
exit_status_global = 1;
}
Input
-My_lily_parser::pop_spot()
+My_lily_parser::pop_spot ()
{
- return define_spot_array_.pop();
+ return define_spot_array_.pop ();
}
Input
-My_lily_parser::here_input() const
+My_lily_parser::here_input () const
{
return lexer_p_->here_input ();
}
My_lily_parser * current_parser;
-MAKE_SCHEME_CALLBACK(My_lily_parser,paper_description, 0);
+MAKE_SCHEME_CALLBACK (My_lily_parser,paper_description, 0);
SCM
My_lily_parser::paper_description ()
Note_column::stem_l (Grob*me)
{
SCM s = me->get_grob_property ("stem");
- return dynamic_cast<Item*>(unsmob_grob (s));
+ return dynamic_cast<Item*> (unsmob_grob (s));
}
Slice
-Note_column::head_positions_interval(Grob *me)
+Note_column::head_positions_interval (Grob *me)
{
Slice iv;
Molecule *e = &endings[LEFT];
endings[RIGHT] = *e;
- Real thick = e->extent (Y_AXIS).length();
+ Real thick = e->extent (Y_AXIS).length ();
Real len = e->extent (X_AXIS).length () - thick;
Molecule total;
do {
endings[d].translate_axis (xwid[d] - endings[d].extent (X_AXIS)[d], X_AXIS);
total.add_molecule (endings[d]);
- } while ((flip(&d)) != LEFT);
+ } while ((flip (&d)) != LEFT);
Real xpos = xwid [LEFT] + len;
}
-MAKE_SCHEME_CALLBACK(Note_head,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Note_head,brew_molecule,1);
SCM
Note_head::brew_molecule (SCM smob)
int p = (int) rint (Staff_symbol_referencer::position_f (me));
int streepjes_i = abs (p) < sz
? 0
- : (abs(p) - sz) /2;
+ : (abs (p) - sz) /2;
SCM style = me->get_grob_property ("style");
if (!gh_symbol_p (style))
// ugh: use gh_call ()
Molecule out = Font_interface::get_default_font (me)->find_by_name (String ("noteheads-") +
- ly_scm2string (scm_eval2 (gh_list (ly_symbol2scm("find-notehead-symbol"),
+ ly_scm2string (scm_eval2 (gh_list (ly_symbol2scm ("find-notehead-symbol"),
me->get_grob_property ("duration-log"),
- ly_quote_scm(style),
+ ly_quote_scm (style),
SCM_UNDEFINED),
SCM_EOL)));
Direction dir = (Direction)sign (p);
Interval hd = out.extent (X_AXIS);
Real hw = hd.length ()/4;
- Molecule ledger (ledger_line (Interval (hd[LEFT] - hw,
+ Molecule ledger (ledger_line (Interval (hd[LEFT] - hw,
hd[RIGHT] + hw), me));
out.add_molecule (s);
}
}
- return out.smobbed_copy();
+ return out.smobbed_copy ();
}
bool
}
-MAKE_SCHEME_CALLBACK(Note_head,brew_ez_molecule,1);
+MAKE_SCHEME_CALLBACK (Note_head,brew_ez_molecule,1);
SCM
Note_head::brew_ez_molecule (SCM smob)
Link_array<Note_req> note_req_l_arr_;
Moment note_end_mom_;
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
protected:
virtual void start_translation_timestep ();
virtual bool try_music (Music *req_l) ;
virtual void create_grobs ();
virtual void acknowledge_grob (Grob_info) ;
- virtual void stop_translation_timestep();
+ virtual void stop_translation_timestep ();
};
}
Pitch *pit =unsmob_pitch (req->get_mus_property ("pitch"));
- note_p->set_grob_property("staff-position", gh_int2scm (pit->steps ()));
+ note_p->set_grob_property ("staff-position", gh_int2scm (pit->steps ()));
if (to_boolean (get_property ("easyPlay")))
{
}
void
-Note_heads_engraver::stop_translation_timestep()
+Note_heads_engraver::stop_translation_timestep ()
{
for (int i=0; i < note_p_arr_.size (); i++)
{
{
/* TODO:make this settable?
*/
- if (note_end_mom_ > now_mom() )
+ if (note_end_mom_ > now_mom ())
{
Score_engraver * e = 0;
Translator * t = daddy_grav_l ();
-ADD_THIS_TRANSLATOR(Note_heads_engraver);
+ADD_THIS_TRANSLATOR (Note_heads_engraver);
class Note_name_engraver : public Engraver
{
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Link_array<Note_req> req_l_arr_;
Link_array<Item> texts_;
virtual bool try_music (Music*m);
s += " ";
s += unsmob_pitch (req_l_arr_[i]->get_mus_property ("pitch"))->str ();
}
- if (s.length_i())
+ if (s.length_i ())
{
Item * t = new Item (get_property ("NoteName"));
- t->set_grob_property ("text", ly_str02scm ( s.ch_C()));
+ t->set_grob_property ("text", ly_str02scm (s.ch_C ()));
announce_grob (t, req_l_arr_[0]);
texts_.push (t);
}
{
typeset_grob (texts_[i]);
}
- texts_.clear() ;
+ texts_.clear () ;
req_l_arr_.clear ();
}
-ADD_THIS_TRANSLATOR(Note_name_engraver);
+ADD_THIS_TRANSLATOR (Note_name_engraver);
*/
class Note_performer : public Performer {
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
protected:
virtual bool try_music (Music *req_l) ;
int transposing_i = 0;
//urg
SCM prop = get_property ("transposing");
- if (gh_number_p(prop))
+ if (gh_number_p (prop))
transposing_i = gh_scm2int (prop);
while (note_req_l_arr_.size ())
class Output_property_engraver : public Engraver
{
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
protected:
/*
void
Output_property_engraver::acknowledge_grob (Grob_info inf)
{
- for (int i=props_.size (); i--; )
+ for (int i=props_.size (); i--;)
{
Music * o = props_[i];
SCM pred = o->get_mus_property ("predicate");
props_.clear ();
}
-ADD_THIS_TRANSLATOR(Output_property_engraver);
+ADD_THIS_TRANSLATOR (Output_property_engraver);
skip (m);
}
-IMPLEMENT_CTOR_CALLBACK(Output_property_music_iterator);
+IMPLEMENT_CTOR_CALLBACK (Output_property_music_iterator);
void
Paper_column::do_break_processing ()
{
- Spaceable_grob::remove_interface(this);
+ Spaceable_grob::remove_interface (this);
Item::do_break_processing ();
}
int
-Paper_column::rank_i(Grob*me)
+Paper_column::rank_i (Grob*me)
{
return dynamic_cast<Paper_column*> (me)->rank_i_;
}
Line_of_score*
-Paper_column::line_l() const
+Paper_column::line_l () const
{
return line_l_;
}
Paper_column*
Paper_column::column_l () const
{
- return (Paper_column*)(this);
+ return (Paper_column*) (this);
}
Paper_column::Paper_column (SCM l)
{
s = *unsmob_moment (m);
}
- return s != Moment(0);
+ return s != Moment (0);
}
bool
-Paper_column::used_b (Grob*me )
+Paper_column::used_b (Grob*me)
{
return gh_pair_p (me->get_grob_property ("elements")) || Item::breakable_b (me)
|| gh_pair_p (me->get_grob_property ("bounded-by-me"))
Real
Paper_def::get_var (String s) const
{
- return get_realvar (ly_symbol2scm (s.ch_C()));
+ return get_realvar (ly_symbol2scm (s.ch_C ()));
}
SCM
Paper_def::get_scmvar (String s) const
{
- return scope_p_->scm_elem (ly_symbol2scm (s.ch_C()));
+ return scope_p_->scm_elem (ly_symbol2scm (s.ch_C ()));
}
Real
}
void
-Paper_def::reset_score_count()
+Paper_def::reset_score_count ()
{
score_count_i_ = 0;
}
Font_metric* f = all_fonts_global_p->find_font (ly_scm2string (fn));
SCM val = Scaled_font_metric::make_scaled_font_metric (f, m);
- scaled_fonts_ = scm_acons (key, val, scaled_fonts_ );
+ scaled_fonts_ = scm_acons (key, val, scaled_fonts_);
scm_unprotect_object (val);
SCM l = SCM_EOL;
- for (SCM s = scaled_fonts_; gh_pair_p (s); s = gh_cdr(s))
+ for (SCM s = scaled_fonts_; gh_pair_p (s); s = gh_cdr (s))
{
SCM desc = gh_caar (s);
SCM mdesc = unsmob_metrics (gh_cdar (s))->description_;
{
*stream_p_ << ""
";;; Usage: guile -s x.scm > x.tex\n"
- "(primitive-load-path 'standalone.scm)\n"
- ";(scm-tex-output)\n"
- "(scm-ps-output)\n"
- "(map (lambda (x) (display (ly-eval x))) '(\n"
+ " (primitive-load-path 'standalone.scm)\n"
+ "; (scm-tex-output)\n"
+ " (scm-ps-output)\n"
+ " (map (lambda (x) (display (ly-eval x))) ' (\n"
;
}
gh_define ("security-paranoia", SCM_BOOL_T);
}
- SCM exp = gh_list (ly_symbol2scm ((output_format_global + "-scm").ch_C()),
+ SCM exp = gh_list (ly_symbol2scm ((output_format_global + "-scm").ch_C ()),
ly_quote_scm (ly_symbol2scm ("all-definitions")),
SCM_UNDEFINED);
exp = scm_eval2 (exp, SCM_EOL);
Paper_outputter::output_comment (String str)
{
output_scheme (gh_list (ly_symbol2scm ("comment"),
- ly_str02scm ((char*)str.ch_C()),
+ ly_str02scm ((char*)str.ch_C ()),
SCM_UNDEFINED)
);
}
/*
UGH.
- Should probably change interface to do less eval ( symbol ), and more
+ Should probably change interface to do less eval (symbol), and more
apply (procedure, args)
*/
void
Paper_outputter::dump_scheme (SCM s)
{
- if (verbatim_scheme_b_)
+ if (verbatim_scheme_b_)
{
*stream_p_ << ly_scm2string (ly_write2scm (s));
}
else
id_str += String (", ") + version_str ();
- output_String_def ( "lilypondtagline", id_str);
- output_String_def ( "LilyPondVersion", version_str ());
+ output_String_def ("lilypondtagline", id_str);
+ output_String_def ("LilyPondVersion", version_str ());
}
SCM scm = gh_list (ly_symbol2scm ("lily-def"),
ly_str02scm (k.ch_l ()),
- ly_str02scm (to_str(v).ch_l ()),
+ ly_str02scm (to_str (v).ch_l ()),
SCM_UNDEFINED);
output_scheme (scm);
}
Paper_score::process ()
{
if (verbose_global_b)
- progress_indication ( _f("Element count %d ", line_l_->element_count ()));
+ progress_indication (_f ("Element count %d ", line_l_->element_count ()));
progress_indication (_ ("Preprocessing elements...") + " ");
outputter_l_->output_header ();
outputter_l_->output_version ();
+ progress_indication ("\n");
if (global_header_p)
{
progress_indication ("\n");
-
// huh?
delete outputter_l_;
outputter_l_ = 0;
If \translator Staff = bass, then look for Staff = *
*/
- while (current && current->type_str_ != to_type)
+ while (current && current->type_str_ != to_type)
{
last = current;
current = current->daddy_trans_l_;
{
Music *m = unsmob_music (gh_car (i));
if (Melodic_req *r = dynamic_cast<Melodic_req *> (m))
- *pitches = gh_cons (r->get_mus_property("pitch"), *pitches);
+ *pitches = gh_cons (r->get_mus_property ("pitch"), *pitches);
if (Rhythmic_req *r = dynamic_cast<Rhythmic_req *> (m))
- *durations = gh_cons (r->get_mus_property("duration"), *durations);
+ *durations = gh_cons (r->get_mus_property ("duration"), *durations);
}
}
}
}
if (first_pitches != SCM_EOL && second_pitches == SCM_EOL
- && !(second_until_ > now))
+ && ! (second_until_ > now))
{
state |= UNRELATED;
state &= ~UNISILENCE;
- if (!(state & ~(UNRELATED | SOLO1 | UNISILENCE)))
+ if (! (state & ~ (UNRELATED | SOLO1 | UNISILENCE)))
state |= SOLO1;
}
else
state &= ~SOLO1;
if (first_pitches == SCM_EOL && second_pitches != SCM_EOL
- && !(first_until_ > now))
+ && ! (first_until_ > now))
{
state |= UNRELATED;
state &= ~UNISILENCE;
- if (!(state & ~(UNRELATED | SOLO2 | UNISILENCE)))
+ if (! (state & ~ (UNRELATED | SOLO2 | UNISILENCE)))
state |= SOLO2;
}
else
if (gh_equal_p (first_durations, second_durations))
{
state &= ~UNISILENCE;
- if (!(state & ~(UNIRHYTHM | UNISON)))
+ if (! (state & ~ (UNIRHYTHM | UNISON)))
state |= UNIRHYTHM;
}
else
- state &= ~(UNIRHYTHM | UNISILENCE);
+ state &= ~ (UNIRHYTHM | UNISILENCE);
if (first_pitches != SCM_EOL
&& gh_equal_p (first_pitches, second_pitches))
{
state &= ~UNISILENCE;
- if (!(state & ~(UNIRHYTHM | UNISON)))
+ if (! (state & ~ (UNIRHYTHM | UNISON)))
state |= UNISON;
}
else
- state &= ~(UNISON);
+ state &= ~ (UNISON);
if (first_pitches == SCM_EOL && second_pitches == SCM_EOL)
{
- if (!(state & ~(UNIRHYTHM | UNISILENCE)))
+ if (! (state & ~ (UNIRHYTHM | UNISILENCE)))
state |= UNISILENCE;
}
else if (!state)
state |= UNRELATED;
else
- state &= ~(UNISILENCE);
+ state &= ~ (UNISILENCE);
if (gh_number_p (interval))
{
&& i >= gh_scm2int (gh_car (s))
&& i <= gh_scm2int (gh_cdr (s)))
{
- if (!(state & ~(SPLIT_INTERVAL | UNIRHYTHM | UNISON)))
+ if (! (state & ~ (SPLIT_INTERVAL | UNIRHYTHM | UNISON)))
state |= SPLIT_INTERVAL;
}
else
- state &= ~(SPLIT_INTERVAL);
+ state &= ~ (SPLIT_INTERVAL);
}
if (first && first_pitches != SCM_EOL)
bool combine_b = previously_combined_b;
- if (!(state & UNIRHYTHM)
+ if (! (state & UNIRHYTHM)
|| (state & SPLIT_INTERVAL)
|| (state & (SOLO1 | SOLO2)))
combine_b = false;
return s;
}
-IMPLEMENT_CTOR_CALLBACK(Part_combine_music_iterator);
+IMPLEMENT_CTOR_CALLBACK (Part_combine_music_iterator);
{
return unsmob_music (get_mus_property ("two"));
}
+
+
+Part_combine_music::Part_combine_music ()
+ : Music (SCM_EOL)
+{
+}
+
+ADD_MUSIC (Part_combine_music);
--- /dev/null
+/*
+ new-chord-tremolo-engraver.cc -- implement Chord_tremolo_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "engraver.hh"
+#include "repeated-music.hh"
+#include "engraver-group-engraver.hh"
+#include "global-translator.hh"
+#include "warn.hh"
+#include "misc.hh"
+#include "spanner.hh"
+#include "item.hh"
+#include "percent-repeat-iterator.hh"
+
+/**
+ This acknowledges repeated music with "percent" style. It typesets
+ a % sign.
+
+ TODO:
+
+ - BEAT case: Create items for single beat repeats, i.e. c4 / / /
+
+ - DOUBLE_MEASURE case: attach a % to an appropriate barline.
+
+*/
+class Percent_repeat_engraver : public Engraver
+{
+ void typeset_perc ();
+public:
+ VIRTUAL_COPY_CONS (Translator);
+ Percent_repeat_engraver ();
+protected:
+ Repeated_music * repeat_;
+
+ /// moment (global time) where beam started.
+ Moment start_mom_;
+ Moment stop_mom_;
+
+ /// location within measure where beam started.
+ Moment beam_start_location_;
+ Moment next_moment_;
+ Moment body_length_;
+
+ enum {
+ UNKNOWN,
+ BEAT,
+ MEASURE,
+ DOUBLE_MEASURE,
+ } repeat_sign_type_ ;
+
+ Spanner * perc_p_;
+ Spanner * finished_perc_p_;
+ Item * stem_tremolo_;
+protected:
+ virtual void finalize ();
+ virtual bool try_music (Music*);
+ virtual void acknowledge_grob (Grob_info);
+ virtual void stop_translation_timestep ();
+ virtual void start_translation_timestep ();
+ virtual void process_music ();
+};
+
+Percent_repeat_engraver::Percent_repeat_engraver ()
+{
+ perc_p_ = finished_perc_p_ = 0;
+ repeat_ =0;
+ stem_tremolo_ = 0;
+}
+
+bool
+Percent_repeat_engraver::try_music (Music * m)
+{
+ Repeated_music * rp = dynamic_cast<Repeated_music*> (m);
+ if (rp
+ && rp->get_mus_property ("iterator-ctor")
+ == Percent_repeat_iterator::constructor_cxx_function
+ && !repeat_)
+ {
+ body_length_ = rp->body_length_mom ();
+ int count = rp->repeat_count ();
+
+ Moment now = now_mom ();
+ start_mom_ = now;
+ stop_mom_ = start_mom_ + Moment (count) * body_length_;
+ next_moment_ = start_mom_ + body_length_;
+
+ SCM m = get_property ("timeSignatureFraction");
+ Moment mlen (1,
+ gh_scm2int (gh_cdr (m)));
+
+ if (mlen == body_length_)
+ repeat_sign_type_ = BEAT;
+ else
+ {
+ mlen *= gh_scm2int (gh_car (m));
+ if (mlen == body_length_)
+ repeat_sign_type_ = MEASURE;
+ else if (Moment (2)* mlen == body_length_)
+ repeat_sign_type_ = DOUBLE_MEASURE;
+
+ if (repeat_sign_type_ != MEASURE)
+ {
+ warning (_ ("Don't know yet how to handle this percent repeat."));
+ return false;
+ }
+ }
+
+ repeat_ = rp;
+
+
+ Global_translator *global_l =0;
+ Translator *t = this;
+ do
+ {
+ t = t->daddy_trans_l_ ;
+ global_l = dynamic_cast<Global_translator*> (t);
+ }
+ while (!global_l);
+
+ for (int i = 0; i < count; i++)
+ global_l->add_moment_to_process (now + Moment (1+i) * body_length_);
+
+ return true;
+ }
+
+ return false;
+}
+
+void
+Percent_repeat_engraver::process_music ()
+{
+ if (repeat_ && now_mom () == next_moment_)
+ {
+ if (repeat_sign_type_ == BEAT)
+ {
+ ;
+ }
+ else if (repeat_sign_type_ == MEASURE)
+ {
+ finished_perc_p_ = perc_p_;
+ typeset_perc ();
+ perc_p_ = new Spanner (get_property ("PercentRepeat"));
+ SCM col =get_property ("currentCommandColumn");
+ perc_p_->set_bound (LEFT, unsmob_grob (col));
+ announce_grob (perc_p_, repeat_);
+ }
+
+ next_moment_ = next_moment_ + body_length_;
+ }
+}
+void
+Percent_repeat_engraver::finalize ()
+{
+ typeset_perc ();
+ if (perc_p_)
+ {
+ repeat_->origin ()->warning (_ ("unterminated chord tremolo"));
+ perc_p_->suicide ();
+ }
+}
+
+void
+Percent_repeat_engraver::typeset_perc ()
+{
+ if (finished_perc_p_)
+ {
+ SCM col =get_property ("currentCommandColumn");
+ finished_perc_p_->set_bound (RIGHT, unsmob_grob (col));
+ typeset_grob (finished_perc_p_);
+ finished_perc_p_ = 0;
+ }
+}
+
+
+void
+Percent_repeat_engraver::acknowledge_grob (Grob_info info)
+{
+}
+
+
+void
+Percent_repeat_engraver::start_translation_timestep ()
+{
+ if (perc_p_ && stop_mom_ == now_mom ())
+ {
+ finished_perc_p_ = perc_p_;
+ typeset_perc ();
+ repeat_ = 0;
+ perc_p_ = 0;
+ repeat_sign_type_ = UNKNOWN;
+ }
+}
+
+
+void
+Percent_repeat_engraver::stop_translation_timestep ()
+{
+ typeset_perc ();
+}
+
+ADD_THIS_TRANSLATOR (Percent_repeat_engraver);
+
+
--- /dev/null
+/*
+ percent-repeat-iterator.cc -- implement Percent_repeat_iterator
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "percent-repeat-iterator.hh"
+#include "repeated-music.hh"
+#include "input.hh"
+
+IMPLEMENT_CTOR_CALLBACK (Percent_repeat_iterator);
+
+
+Percent_repeat_iterator::Percent_repeat_iterator ()
+{
+
+}
+
+Percent_repeat_iterator::Percent_repeat_iterator (Percent_repeat_iterator const & p)
+ : Music_iterator (p)
+{
+ child_iter_p_ = p.child_iter_p_ ? p.child_iter_p_->clone (): 0;
+ finish_mom_ = p.finish_mom_ ;
+}
+
+bool
+Percent_repeat_iterator::ok () const
+{
+ return child_iter_p_;
+}
+
+void
+Percent_repeat_iterator::construct_children ()
+{
+ Repeated_music * mus =dynamic_cast<Repeated_music *> (music_l_);
+ finish_mom_ = mus->length_mom ();
+ child_iter_p_ = get_iterator_p (mus->body ());
+}
+
+
+void
+Percent_repeat_iterator::process (Moment m)
+{
+ if (!m)
+ {
+ Music_iterator *yeah = try_music (music_l_);
+ if (yeah)
+ set_translator (yeah->report_to_l ());
+ else
+ music_l_->origin ()->warning ( _ ("no one to print a percent"));
+ }
+
+ if (child_iter_p_->ok ())
+ child_iter_p_->process (m);
+
+ if (finish_mom_ <= m )
+ {
+ delete child_iter_p_;
+ child_iter_p_ = 0;
+ }
+}
+
+Moment
+Percent_repeat_iterator::pending_moment ()const
+{
+ if (child_iter_p_->ok ())
+ return child_iter_p_->pending_moment ();
+ else
+ return finish_mom_ ;
+}
+
+Music_iterator*
+Percent_repeat_iterator::try_music_in_children (Music *m) const
+{
+ return child_iter_p_->try_music (m);
+}
+
+
+Percent_repeat_iterator::~Percent_repeat_iterator ()
+{
+ delete child_iter_p_;
+}
}
-Performance::~Performance()
+Performance::~Performance ()
{
delete audio_elem_p_list_;
}
void
Performance::output (Midi_stream& midi_stream)
{
- int tracks_i = audio_staff_l_arr_.size() + 1;
+ int tracks_i = audio_staff_l_arr_.size () + 1;
// ugh
int clocks_per_4_i = 384;
for (int i =0; i < audio_staff_l_arr_.size (); i++)
{
Audio_staff *s = audio_staff_l_arr_[i];
- if(verbose_global_b)
+ if (verbose_global_b)
progress_indication ("[" + to_str (i)) ;
/*
if (channel == 9)
channel++;
s->output (midi_stream, channel++);
- if(verbose_global_b)
+ if (verbose_global_b)
progress_indication ("]");
}
}
// perhaps multiple text events?
String id_str;
- String str = String (_("Creator: "));
+ String str = String (_ ("Creator: "));
if (no_timestamps_global_b)
id_str = gnu_lilypond_str ();
else
- id_str = gnu_lilypond_version_str();
+ id_str = gnu_lilypond_version_str ();
str += id_str;
str += "\n";
str += ".\n";
else
{
- str += _(", at ");
+ str += _ (", at ");
time_t t (time (0));
str += ctime (&t);
- str = str.left_str (str.length_i() - 1);
+ str = str.left_str (str.length_i () - 1);
}
/*
{
audio_staff_l_arr_.push (s);
}
- else if (Audio_column *c = dynamic_cast<Audio_column*>(p))
+ else if (Audio_column *c = dynamic_cast<Audio_column*> (p))
{
c->performance_l_ = this;
}
void
-Performance::process()
+Performance::process ()
{
String out = output_name_global;
if (out == "-")
out = p.str ();
Midi_stream midi_stream (out);
- progress_indication ( _f ("MIDI output to %s...", out));
+ progress_indication (_f ("MIDI output to %s...", out));
target_str_global_array.push (out);
output (midi_stream);
- progress_indication("\n");
+ progress_indication ("\n");
}
#include "debug.hh"
-ADD_THIS_TRANSLATOR(Performer_group_performer);
+ADD_THIS_TRANSLATOR (Performer_group_performer);
void
void
Performer_group_performer::create_audio_elements ()
{
- for (SCM p = simple_trans_list_; gh_pair_p (p); p = gh_cdr ( p))
+ for (SCM p = simple_trans_list_; gh_pair_p (p); p = gh_cdr (p))
{
Translator * t = unsmob_translator (gh_car (p));
Performer * eng = dynamic_cast<Performer*> (t);
void
Performer_group_performer::acknowledge_audio_elements ()
{
- for (int j =0; j < announce_info_arr_.size(); j++)
+ for (int j =0; j < announce_info_arr_.size (); j++)
{
Audio_element_info info = announce_info_arr_[j];
}
void
-Performer_group_performer::do_announces()
+Performer_group_performer::do_announces ()
{
- for (SCM p = trans_group_list_; gh_pair_p (p); p =gh_cdr ( p))
+ for (SCM p = trans_group_list_; gh_pair_p (p); p =gh_cdr (p))
{
Translator * t = unsmob_translator (gh_car (p));
dynamic_cast<Performer_group_performer*> (t)->do_announces ();
}
int
-Performer::get_tempo_i() const
+Performer::get_tempo_i () const
{
- return daddy_perf_l ()->get_tempo_i();
+ return daddy_perf_l ()->get_tempo_i ();
}
Performer_group_performer*
{
if (!i.origin_trans_l_)
i.origin_trans_l_= this;
- daddy_perf_l()->announce_element (i);
+ daddy_perf_l ()->announce_element (i);
}
/*
Let's not start more than one phrasing slur per moment.
*/
- if (sl->get_span_dir() == START)
+ if (sl->get_span_dir () == START)
{
if (now_mom () > last_start_)
{
{
Span_req* phrasing_slur_req_l = new_phrasing_slur_req_l_arr_[i];
// end phrasing slur: move the phrasing slur to other array
- if (phrasing_slur_req_l->get_span_dir() == STOP)
+ if (phrasing_slur_req_l->get_span_dir () == STOP)
{
if (phrasing_slur_l_stack_.empty ())
phrasing_slur_req_l->origin ()->warning (_f ("can't find start of phrasing slur"));
requests_arr_.pop ();
}
}
- else if (phrasing_slur_req_l->get_span_dir() == START)
+ else if (phrasing_slur_req_l->get_span_dir () == START)
{
// push a new phrasing_slur onto stack.
// (use temp. array to wait for all phrasing_slur STOPs)
info_list_ = 0;
}
void
-Piano_pedal_engraver::initialize()
+Piano_pedal_engraver::initialize ()
{
info_list_ = new Pedal_info[4];
Pedal_info *p = info_list_;
p++;
}
- while (*(np ++));
+ while (* (np ++));
}
-Piano_pedal_engraver::~Piano_pedal_engraver()
+Piano_pedal_engraver::~Piano_pedal_engraver ()
{
delete[] info_list_;
}
{
Side_position_interface::add_support (p->item_p_, info.elem_l_);
- if (Side_position_interface::get_axis(p->item_p_) == X_AXIS
+ if (Side_position_interface::get_axis (p->item_p_) == X_AXIS
&& !p->item_p_->parent_l (Y_AXIS))
p->item_p_->set_parent (info.elem_l_, Y_AXIS);
}
bool
Piano_pedal_engraver::try_music (Music *m)
{
- if (Span_req * s = dynamic_cast<Span_req*>(m))
+ if (Span_req * s = dynamic_cast<Span_req*> (m))
{
for (Pedal_info*p = info_list_; p->name_; p ++)
{
if (scm_equal_p (s->get_mus_property ("span-type"),
ly_str02scm (p->name_))==SCM_BOOL_T)
{
- p->req_l_drul_[s->get_span_dir()] = s;
+ p->req_l_drul_[s->get_span_dir ()] = s;
return true;
}
}
continue;
SCM s = SCM_EOL;
- SCM strings = get_property( ("pedal" + String (p->name_) + "Strings").ch_C());
- if( scm_ilength (strings) < 3)
+ SCM strings = get_property (("pedal" + String (p->name_) + "Strings").ch_C ());
+ if (scm_ilength (strings) < 3)
continue;
if (p->req_l_drul_[STOP] && p->req_l_drul_[START])
{
if (!p->start_req_l_)
{
- p->req_l_drul_[STOP]->origin ()->warning (_f ("can't find start of piano pedal: %s", p->name_ ));
+ p->req_l_drul_[STOP]->origin ()->warning (_f ("can't find start of piano pedal: %s", p->name_));
}
else
{
{
if (!p->start_req_l_)
{
- p->req_l_drul_[STOP]->origin ()->warning (_f ("can't find start of piano pedal: %s", p->name_ ));
+ p->req_l_drul_[STOP]->origin ()->warning (_f ("can't find start of piano pedal: %s", p->name_));
}
else
{
if (gh_string_p (s))
{
String propname = String (p->name_) + "Pedal";
- p->item_p_ = new Item (get_property (propname.ch_C()));
+ p->item_p_ = new Item (get_property (propname.ch_C ()));
p->item_p_->set_grob_property ("text", s);
announce_grob (p->item_p_,
info_alist_ = 0;
}
-Piano_pedal_performer::~Piano_pedal_performer()
+Piano_pedal_performer::~Piano_pedal_performer ()
{
delete[] info_alist_;
}
p++;
}
- while (*(np ++));
+ while (* (np ++));
}
void
bool
Piano_pedal_performer::try_music (Music* r)
{
- if (Span_req * s = dynamic_cast<Span_req*>(r))
+ if (Span_req * s = dynamic_cast<Span_req*> (r))
{
for (Pedal_info*p = info_alist_; p->name_; p ++)
{
if (scm_equal_p (s->get_mus_property ("span-type"),
ly_str02scm (p->name_)) == SCM_BOOL_T)
{
- p->req_l_drul_[s->get_span_dir()] = s;
+ p->req_l_drul_[s->get_span_dir ()] = s;
return true;
}
}
if (n < 0 || n >= 7 ||
a < -2 || a > 2)
{
- String s = _("Pitch arguments out of range");
+ String s = _ ("Pitch arguments out of range");
s += ": alteration = " + to_str (a);
s += ", notename = " + to_str (n);
warning (s);
Pitch::str () const
{
int n = (notename_i_ + 2) % 7;
- String s = to_str (char(n + 'a'));
+ String s = to_str (char (n + 'a'));
if (alteration_i_)
s += String (accname[alteration_i_ + 2]);
/****************************************************************/
-IMPLEMENT_TYPE_P(Pitch, "pitch?");
-IMPLEMENT_UNSMOB(Pitch, pitch);
+IMPLEMENT_TYPE_P (Pitch, "pitch?");
+IMPLEMENT_UNSMOB (Pitch, pitch);
SCM
-Pitch::mark_smob (SCM )
+Pitch::mark_smob (SCM)
{
return SCM_EOL;
}
-IMPLEMENT_SIMPLE_SMOBS(Pitch);
+IMPLEMENT_SIMPLE_SMOBS (Pitch);
int
Pitch *r = (Pitch *) gh_cdr (s);
scm_puts ("#<Pitch ", port);
- scm_display (ly_str02scm (r->str().ch_C()), port);
+ scm_display (ly_str02scm (r->str ().ch_C ()), port);
scm_puts (" >", port);
return 1;
return eq ? SCM_BOOL_T : SCM_BOOL_F;
}
-MAKE_SCHEME_CALLBACK(Pitch, less_p, 2);
+MAKE_SCHEME_CALLBACK (Pitch, less_p, 2);
SCM
Pitch::less_p (SCM p1, SCM p2)
{
Pitch *a = unsmob_pitch (p1);
Pitch *b = unsmob_pitch (p2);
- if (compare(*a, *b) < 0 )
+ if (compare (*a, *b) < 0)
return SCM_BOOL_T;
else
return SCM_BOOL_F;
if (!p)
warning ("Not a pitch");
else
- q = p->octave_i();
+ q = p->octave_i ();
return gh_int2scm (q);
}
if (!p)
warning ("Not a pitch");
else
- q = p->alteration_i();
+ q = p->alteration_i ();
return gh_int2scm (q);
}
if (!p)
warning ("Not a pitch");
else
- q = p->notename_i();
+ q = p->notename_i ();
return gh_int2scm (q);
}
if (!p)
warning ("Not a pitch");
else
- q = p->steps();
+ q = p->steps ();
return gh_int2scm (q);
}
static void
-add_funcs()
+add_funcs ()
{
- // should take list?: (make-pitch '(octave name accidental))
+ // should take list?: (make-pitch ' (octave name accidental))
scm_make_gsubr ("make-pitch", 3, 0, 0, (Scheme_function_unknown)make_pitch);
scm_make_gsubr ("pitch-octave", 1, 0, 0, (Scheme_function_unknown)pitch_octave);
scm_make_gsubr ("Pitch::transpose", 2, 0, 0, (Scheme_function_unknown) pitch_transpose);
}
-ADD_SCM_INIT_FUNC(pitch, add_funcs);
+ADD_SCM_INIT_FUNC (pitch, add_funcs);
SCM
Pitch::smobbed_copy ()const
virtual void initialize ();
virtual void finalize ();
public:
- ~Property_engraver();
- Property_engraver();
- VIRTUAL_COPY_CONS(Translator);
+ ~Property_engraver ();
+ Property_engraver ();
+ VIRTUAL_COPY_CONS (Translator);
};
-Property_engraver::Property_engraver()
+Property_engraver::Property_engraver ()
{
prop_dict_ = 0;
}
void
-Property_engraver::finalize()
+Property_engraver::finalize ()
{
}
SCM type_p = gh_cadr (entry);
SCM elt_prop_sym = gh_caddr (entry);
- SCM preset = scm_assq(elt_prop_sym, e->mutable_property_alist_);
+ SCM preset = scm_assq (elt_prop_sym, e->mutable_property_alist_);
if (preset != SCM_BOOL_F)
continue;
}
}
-ADD_THIS_TRANSLATOR(Property_engraver);
+ADD_THIS_TRANSLATOR (Property_engraver);
Property_iterator::process (Moment m)
{
SCM sym = music_l_->get_mus_property ("symbol");
- if (gh_symbol_p(sym))
+ if (gh_symbol_p (sym))
{
SCM val = music_l_->get_mus_property ("value");
bool ok= true;
SCM eprop = music_l_->get_mus_property ("grob-property");
SCM val = music_l_->get_mus_property ("grob-value");
- if (to_boolean (music_l_->get_mus_property ( "pop-first")))
+ if (to_boolean (music_l_->get_mus_property ("pop-first")))
Translator_def::apply_pushpop_property (report_to_l (),
syms, eprop, SCM_UNDEFINED);
Simple_music_iterator::process (m);
}
-IMPLEMENT_CTOR_CALLBACK(Pop_property_iterator);
-IMPLEMENT_CTOR_CALLBACK(Push_property_iterator);
-IMPLEMENT_CTOR_CALLBACK(Property_iterator);
+IMPLEMENT_CTOR_CALLBACK (Pop_property_iterator);
+IMPLEMENT_CTOR_CALLBACK (Push_property_iterator);
+IMPLEMENT_CTOR_CALLBACK (Property_iterator);
Protected_scm::Protected_scm (SCM s)
{
- object_ = SCM_NIMP(s) ? scm_protect_object (s): s;
+ object_ = SCM_NIMP (s) ? scm_protect_object (s): s;
}
Protected_scm::Protected_scm (Protected_scm const &s)
{
- object_ = SCM_NIMP(s.object_) ? scm_protect_object (s.object_) : s.object_;
+ object_ = SCM_NIMP (s.object_) ? scm_protect_object (s.object_) : s.object_;
}
Protected_scm &
-Protected_scm::operator =(SCM s)
+Protected_scm::operator = (SCM s)
{
if (object_ == s)
return *this;
if (SCM_NIMP (object_))
- scm_unprotect_object(object_);
+ scm_unprotect_object (object_);
object_ = SCM_NIMP (s) ? scm_protect_object (s): s;
return *this;
Protected_scm::~Protected_scm ()
{
- if (SCM_NIMP (object_))
+ if (SCM_NIMP (object_))
{
scm_unprotect_object (object_);
}
}
-Relative_octave_music::Relative_octave_music(SCM l)
+Relative_octave_music::Relative_octave_music (SCM l)
: Music_wrapper (l)
{
set_mus_property ("type", ly_symbol2scm ("relative-octave-music"));
}
+Relative_octave_music::Relative_octave_music ()
+{
+ set_mus_property ("type", ly_symbol2scm ("relative-octave-music"));
+}
-
+ADD_MUSIC (Relative_octave_music);
{
public:
VIRTUAL_COPY_CONS (Translator);
- Repeat_acknowledge_engraver();
+ Repeat_acknowledge_engraver ();
virtual void start_translation_timestep ();
virtual void process_music ();
}
-Repeat_acknowledge_engraver::Repeat_acknowledge_engraver()
+Repeat_acknowledge_engraver::Repeat_acknowledge_engraver ()
{
}
cs = gh_cdr (cs);
}
- if (start && end )
+ if (start && end)
s = ":|:";
else if (start)
s = "|:";
*/
if (s != "" || (volta_found && !gh_string_p (get_property ("whichBar"))))
{
- daddy_trans_l_->set_property ("whichBar", ly_str02scm(s.ch_C()));
+ daddy_trans_l_->set_property ("whichBar", ly_str02scm (s.ch_C ()));
}
}
-ADD_THIS_TRANSLATOR(Repeat_acknowledge_engraver);
+ADD_THIS_TRANSLATOR (Repeat_acknowledge_engraver);
Music_sequence*
Repeated_music::alternatives ()const
{
- return dynamic_cast<Music_sequence*> (unsmob_music (get_mus_property ("alternatives")));
+ return dynamic_cast<Music_sequence*> (unsmob_music (get_mus_property ("alternatives")));
}
-Repeated_music::Repeated_music(SCM l)
+
+Repeated_music::Repeated_music (SCM l)
: Music (l)
{
set_mus_property ("type", ly_symbol2scm ("repeated-music"));
Moment
Repeated_music::alternatives_length_mom (bool fold) const
{
- if (!alternatives () )
+ if (!alternatives ())
return 0;
- if (fold)
+ if (fold)
return alternatives ()->maximum_length ();
Moment m =0;
return m;
}
+
+/*
+ Length of the body in THIS. Disregards REPEAT-COUNT.
+ */
Moment
Repeated_music::body_length_mom () const
{
}
-MAKE_SCHEME_CALLBACK(Repeated_music,unfolded_music_length, 1);
-MAKE_SCHEME_CALLBACK(Repeated_music,folded_music_length, 1);
-MAKE_SCHEME_CALLBACK(Repeated_music,volta_music_length, 1);
+MAKE_SCHEME_CALLBACK (Repeated_music,unfolded_music_length, 1);
+MAKE_SCHEME_CALLBACK (Repeated_music,folded_music_length, 1);
+MAKE_SCHEME_CALLBACK (Repeated_music,volta_music_length, 1);
SCM
Repeated_music::unfolded_music_length (SCM m)
Moment l = r->body_length_mom () + r->alternatives_volta_length_mom ();
return l.smobbed_copy ();
}
+
+ADD_MUSIC (Repeated_music);
+
+Repeated_music::Repeated_music ()
+ : Music (SCM_EOL)
+{
+ set_mus_property ("type", ly_symbol2scm ("repeated-music"));
+}
}
void
-Request_chord_iterator::construct_children()
+Request_chord_iterator::construct_children ()
{
Simple_music_iterator::construct_children ();
- get_req_translator_l();
+ get_req_translator_l ();
}
Request_chord*
bool gotcha = try_music (mus);
if (!gotcha)
- mus->origin ()->warning (_f ("Junking request: `%s'", classname(mus)));
+ mus->origin ()->warning (_f ("Junking request: `%s'", classname (mus)));
}
}
skip (m);
}
-IMPLEMENT_CTOR_CALLBACK(Request_chord_iterator);
+IMPLEMENT_CTOR_CALLBACK (Request_chord_iterator);
protected:
virtual void acknowledge_grob (Grob_info);
virtual void create_grobs ();
- virtual void stop_translation_timestep();
+ virtual void stop_translation_timestep ();
public:
- VIRTUAL_COPY_CONS(Translator);
- Rest_collision_engraver();
+ VIRTUAL_COPY_CONS (Translator);
+ Rest_collision_engraver ();
};
-ADD_THIS_TRANSLATOR(Rest_collision_engraver);
+ADD_THIS_TRANSLATOR (Rest_collision_engraver);
-Rest_collision_engraver::Rest_collision_engraver()
+Rest_collision_engraver::Rest_collision_engraver ()
{
rest_collision_p_ =0;
}
Rest_collision::set_interface (rest_collision_p_);
announce_grob (rest_collision_p_, 0);
for (int i=0; i< note_column_l_arr_.size (); i++)
- Rest_collision::add_column ( rest_collision_p_,note_column_l_arr_[i]);
+ Rest_collision::add_column (rest_collision_p_,note_column_l_arr_[i]);
}
void
}
void
-Rest_collision_engraver::stop_translation_timestep()
+Rest_collision_engraver::stop_translation_timestep ()
{
if (rest_collision_p_)
{
#include "staff-symbol-referencer.hh"
#include "duration.hh"
-MAKE_SCHEME_CALLBACK(Rest_collision,force_shift_callback,2);
+MAKE_SCHEME_CALLBACK (Rest_collision,force_shift_callback,2);
SCM
Rest_collision::force_shift_callback (SCM element_smob, SCM axis)
{
/*
only add callback for the rests, since we don't move anything else.
- (not?)
+ (not?)
*/
- p->add_offset_callback (Rest_collision::force_shift_callback_proc, Y_AXIS);
- p->set_grob_property ("rest-collision", me->self_scm ());
+ p->add_offset_callback (Rest_collision::force_shift_callback_proc, Y_AXIS);
+ p->set_grob_property ("rest-collision", me->self_scm ());
}
if (!commony)
commony = e;
else
- commony= commony->common_refpoint (e, Y_AXIS);
+ commony= commony->common_refpoint (e, Y_AXIS);
if (unsmob_grob (e->get_grob_property ("rest")))
rests.push (e);
*/
// no rests to collide
- if (!rests.size())
+ if (!rests.size ())
return SCM_UNSPECIFIED;
// no partners to collide with
- if (rests.size() + notes.size () < 2)
+ if (rests.size () + notes.size () < 2)
return SCM_UNSPECIFIED;
// meisjes met meisjes
- if (!notes.size())
+ if (!notes.size ())
{
- SCM characteristic = head_characteristic (rests[0]);
+ SCM characteristic = head_characteristic (rests[0]);
int i = 1;
for (; i < rests.size (); i++)
{
- if (!gh_equal_p (head_characteristic (rests[i]), characteristic))
+ if (!gh_equal_p (head_characteristic (rests[i]), characteristic))
break;
}
If all durations are the same, we'll check if there are more
rests than maximum-rest-count.
Otherwise (different durations), we'll try to display them all
- (urg: all 3 of them, currently).
+ (urg: all 3 of them, currently).
*/
int display_count;
SCM s = me->get_grob_property ("maximum-rest-count");
{
if (rests.size () > 1)
{
- warning (_("too many colliding rests"));
+ warning (_ ("too many colliding rests"));
}
if (notes.size () > 1)
{
- warning (_("too many notes for rest collision"));
+ warning (_ ("too many notes for rest collision"));
}
Grob * rcol = rests[0];
assumption: ref points are the same.
*/
Interval notedim;
- for (int i = 0; i < notes.size(); i++)
+ for (int i = 0; i < notes.size (); i++)
{
Grob * stem = Note_column::stem_l (notes[i]);
Grob * head = Stem::first_head (stem);
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Rest_engraver ();
};
}
-ADD_THIS_TRANSLATOR(Rest_engraver);
+ADD_THIS_TRANSLATOR (Rest_engraver);
#include "staff-symbol-referencer.hh"
// -> offset callback
-MAKE_SCHEME_CALLBACK(Rest,after_line_breaking,1);
+MAKE_SCHEME_CALLBACK (Rest,after_line_breaking,1);
SCM
Rest::after_line_breaking (SCM smob)
{
}
-MAKE_SCHEME_CALLBACK(Rest,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Rest,brew_molecule,1);
SCM
Rest::brew_internal_molecule (SCM smob)
if (balltype == gh_int2scm (0) || balltype == gh_int2scm (1))
{
int sz = Staff_symbol_referencer::line_count (me);
- Real dif = abs(Staff_symbol_referencer::position_f (me) - (2* gh_scm2int (balltype) - 1));
+ Real dif = abs (Staff_symbol_referencer::position_f (me) - (2* gh_scm2int (balltype) - 1));
ledger_b = dif > sz;
}
style = ly_scm2string (scm_symbol_to_string (style_sym));
}
- String idx = ("rests-") + to_str (gh_scm2int (balltype))
+ String idx = ("rests-") + to_str (gh_scm2int (balltype))
+ (ledger_b ? "o" : "") + style;
- return Font_interface::get_default_font (me)->find_by_name (idx).smobbed_copy();
+ return Font_interface::get_default_font (me)->find_by_name (idx).smobbed_copy ();
}
SCM
{
return brew_internal_molecule (smob);
}
-MAKE_SCHEME_CALLBACK(Rest,extent_callback,2);
+MAKE_SCHEME_CALLBACK (Rest,extent_callback,2);
/*
We need the callback. The real molecule has ledgers depending on
Y-position. The Y-position is known only after line breaking. */
Grob *dotcol_l_;
protected:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
virtual void acknowledge_grob (Grob_info);
virtual void create_grobs ();
- virtual void stop_translation_timestep();
- virtual void start_translation_timestep();
+ virtual void stop_translation_timestep ();
+ virtual void start_translation_timestep ();
public:
- Rhythmic_column_engraver();
+ Rhythmic_column_engraver ();
};
-Rhythmic_column_engraver::Rhythmic_column_engraver()
+Rhythmic_column_engraver::Rhythmic_column_engraver ()
{
stem_l_ =0;
ncol_p_=0;
{
if (!ncol_p_)
{
- ncol_p_ = new Item (get_property("NoteColumn"));
+ ncol_p_ = new Item (get_property ("NoteColumn"));
Note_column::set_interface (ncol_p_);
announce_grob (ncol_p_, 0);
}
for (int i=0; i < rhead_l_arr_.size (); i++)
{
- if (!rhead_l_arr_[i]->parent_l(X_AXIS))
+ if (!rhead_l_arr_[i]->parent_l (X_AXIS))
Note_column::add_head (ncol_p_, rhead_l_arr_[i]);
}
rhead_l_arr_.set_size (0);
}
if (stem_l_
- && !stem_l_->parent_l(X_AXIS))
+ && !stem_l_->parent_l (X_AXIS))
{
Note_column::set_stem (ncol_p_, stem_l_);
stem_l_ = 0;
bool wegrace = to_boolean (wg);
if (!wegrace)
- for (int i=0; i < grace_slur_endings_.size(); i++)
+ for (int i=0; i < grace_slur_endings_.size (); i++)
Slur::add_column (grace_slur_endings_[i], ncol_p_);
grace_slur_endings_.clear ();
}
}
void
-Rhythmic_column_engraver::stop_translation_timestep()
+Rhythmic_column_engraver::stop_translation_timestep ()
{
if (ncol_p_)
{
}
void
-Rhythmic_column_engraver::start_translation_timestep()
+Rhythmic_column_engraver::start_translation_timestep ()
{
grace_slur_endings_.clear ();
dotcol_l_ =0;
stem_l_ =0;
}
-ADD_THIS_TRANSLATOR(Rhythmic_column_engraver);
+ADD_THIS_TRANSLATOR (Rhythmic_column_engraver);
void
Rod::add_to_cols ()
{
- columnize();
+ columnize ();
if (item_l_drul_[LEFT] != item_l_drul_[RIGHT])
Spaceable_grob::add_rod (item_l_drul_[LEFT],
item_l_drul_[RIGHT],
- distance_f_ );
+ distance_f_);
}
Molecule m = orig_l_->find_by_name (s);
Box b = m.extent_box ();
b.scale (magnification_f_);
- Molecule q(b,fontify_atom ((Font_metric*) this, m.get_expr ()));
+ Molecule q (b,fontify_atom ((Font_metric*) this, m.get_expr ()));
return q ;
}
}
void
-Scheme_hash_table::operator =(Scheme_hash_table const & src)
+Scheme_hash_table::operator = (Scheme_hash_table const & src)
{
Scm_stl_map::operator = (src);
can't typecheck naively, since GC bit lives in CAR of S
*/
- Scheme_hash_table *me = (Scheme_hash_table*) SCM_CELL_WORD_1(s);
+ Scheme_hash_table *me = (Scheme_hash_table*) SCM_CELL_WORD_1 (s);
- for (Scm_stl_map::const_iterator i= me->begin (); i != me->end(); i++)
+ for (Scm_stl_map::const_iterator i= me->begin (); i != me->end (); i++)
{
scm_gc_mark ((*i).first);
scm_gc_mark ((*i).second);
char str[1000];
sprintf (str, "#<Scheme_hash_table 0x%0x ", s);
scm_puts (str, p);
- Scheme_hash_table *me = unsmob(s);
- for (Scm_stl_map::const_iterator i = me->begin (); i != me->end(); i++)
+ Scheme_hash_table *me = unsmob (s);
+ for (Scm_stl_map::const_iterator i = me->begin (); i != me->end (); i++)
{
scm_display ((*i).first, p);
scm_puts (" = ",p);
void
Scheme_hash_table::set (SCM k, SCM v)
{
- (*this)[k] = v;
+ (*this)[k] = v;
}
// UGH.
SCM
Scheme_hash_table::get (SCM k)const
{
- return (*(Scheme_hash_table*)this)[k];
+ return (* (Scheme_hash_table*)this)[k];
}
-Scheme_hash_table::~Scheme_hash_table( )
+Scheme_hash_table::~Scheme_hash_table ()
{
}
Scheme_hash_table::to_alist () const
{
SCM l = SCM_EOL;
- for (Scm_stl_map ::const_iterator i = begin (); i != end(); i++)
+ for (Scm_stl_map ::const_iterator i = begin (); i != end (); i++)
l = gh_cons (gh_cons ((*i).first, (*i).second), l);
return l;
}
-IMPLEMENT_UNSMOB(Scheme_hash_table,scheme_hash);
-IMPLEMENT_SMOBS(Scheme_hash_table);
-IMPLEMENT_DEFAULT_EQUAL_P(Scheme_hash_table);
+IMPLEMENT_UNSMOB (Scheme_hash_table,scheme_hash);
+IMPLEMENT_SMOBS (Scheme_hash_table);
+IMPLEMENT_DEFAULT_EQUAL_P (Scheme_hash_table);
bool
Scope::elem_b (String s) const
{
- return id_dict_->elem_b (ly_symbol2scm (s.ch_C()));
+ return id_dict_->elem_b (ly_symbol2scm (s.ch_C ()));
}
bool
SCM
Scope::scm_elem (String s) const
{
- return scm_elem (ly_symbol2scm (s.ch_C()));
+ return scm_elem (ly_symbol2scm (s.ch_C ()));
}
void
Scope::set (String s, SCM id)
{
- return id_dict_->set (ly_symbol2scm (s.ch_C()), id);
+ return id_dict_->set (ly_symbol2scm (s.ch_C ()), id);
}
SCM
#include "translator-def.hh"
-Score_engraver::Score_engraver()
+Score_engraver::Score_engraver ()
{
scoreline_l_ =0;
command_column_l_ =0;
set_columns (new Paper_column (get_property (ly_symbol2scm ("NonMusicalPaperColumn"))),
new Paper_column (get_property (ly_symbol2scm ("PaperColumn"))));
- command_column_l_->set_grob_property ("when", w.smobbed_copy());
- musical_column_l_->set_grob_property ("when", w.smobbed_copy());
+ command_column_l_->set_grob_property ("when", w.smobbed_copy ());
+ musical_column_l_->set_grob_property ("when", w.smobbed_copy ());
command_column_l_->set_grob_property ("breakable", SCM_BOOL_T);
- Grob_info i1(command_column_l_, 0), i2 (musical_column_l_,0);
+ Grob_info i1 (command_column_l_, 0), i2 (musical_column_l_,0);
i1.origin_trans_l_ = this;
i2.origin_trans_l_ = this;
Global_translator::prepare (w);
make_columns (w);
- post_move_processing();
+ post_move_processing ();
}
void
-Score_engraver::finish()
+Score_engraver::finish ()
{
if ((breaks_i_%8))
- progress_indication ("[" + to_str ( breaks_i_) + "]");
+ progress_indication ("[" + to_str (breaks_i_) + "]");
- check_removal();
- removal_processing();
+ check_removal ();
+ removal_processing ();
}
/*
assert (dynamic_cast<Paper_def *> (output_def_l_));
assert (!daddy_trans_l_);
pscore_p_ = new Paper_score;
- pscore_p_->paper_l_ = dynamic_cast<Paper_def*>(output_def_l_);
+ pscore_p_->paper_l_ = dynamic_cast<Paper_def*> (output_def_l_);
SCM props = get_property (ly_symbol2scm ("LineOfScore"));
make_columns (Moment (0));
scoreline_l_ = pscore_p_->line_l_;
- scoreline_l_->set_bound(LEFT, command_column_l_);
+ scoreline_l_->set_bound (LEFT, command_column_l_);
command_column_l_->set_grob_property ("breakable", SCM_BOOL_T);
- Engraver_group_engraver::initialize();
+ Engraver_group_engraver::initialize ();
}
void
-Score_engraver::finalize()
+Score_engraver::finalize ()
{
- Engraver_group_engraver::finalize();
- scoreline_l_->set_bound(RIGHT,command_column_l_);
+ Engraver_group_engraver::finalize ();
+ scoreline_l_->set_bound (RIGHT,command_column_l_);
command_column_l_->set_grob_property ("breakable", SCM_BOOL_T);
typeset_all ();
}
void
-Score_engraver::one_time_step()
+Score_engraver::one_time_step ()
{
- process_music();
- announces();
- pre_move_processing();
- check_removal();
+ process_music ();
+ announces ();
+ pre_move_processing ();
+ check_removal ();
}
void
/* All elements are propagated to the top upon announcement. If
something was created during one run of
Engraver_group_engraver::do_announces, then
- announce_info_arr_.size() will be nonzero again
+ announce_info_arr_.size () will be nonzero again
*/
/* junkme? Done by Engraver_group_engraver::do_announces ()?
*/
void
-Score_engraver::do_announces()
+Score_engraver::do_announces ()
{
////// do
- Engraver_group_engraver::do_announces();
- //////while (announce_info_arr_.size());
+ Engraver_group_engraver::do_announces ();
+ //////while (announce_info_arr_.size ());
}
void
-Score_engraver::typeset_all()
+Score_engraver::typeset_all ()
{
- for (int i =0; i < elem_p_arr_.size(); i++)
+ for (int i =0; i < elem_p_arr_.size (); i++)
{
Grob * elem_p = elem_p_arr_[i];
do {
if (!s->get_bound (d))
{
- s->set_bound(d, command_column_l_);
- ::warning (_f ("unbound spanner `%s'", s->name().ch_C()));
+ s->set_bound (d, command_column_l_);
+ /* don't warn for empty/suicided spanners,
+ it makes real warningsinvisible.
+ maybe should be junked earlier? */
+ if (elem_p->immutable_property_alist_ == SCM_EOL)
+ ; // gdb hook
+ else
+ ::warning (_f ("unbound spanner `%s'", s->name ().ch_C ()));
}
- } while (flip(&d) != LEFT);
+ } while (flip (&d) != LEFT);
}
else
{
}
}
- if (!elem_p->parent_l(Y_AXIS))
+ if (!elem_p->parent_l (Y_AXIS))
Axis_group_interface::add_element (scoreline_l_, elem_p);
}
- elem_p_arr_.clear();
+ elem_p_arr_.clear ();
}
void
-Score_engraver::stop_translation_timestep()
+Score_engraver::stop_translation_timestep ()
{
// this generates all items.
- Engraver_group_engraver::stop_translation_timestep();
+ Engraver_group_engraver::stop_translation_timestep ();
- typeset_all();
+ typeset_all ();
if (to_boolean (command_column_l_->get_grob_property ("breakable")))
{
breaks_i_ ++;
if (! (breaks_i_%8))
- progress_indication ("[" + to_str ( breaks_i_) + "]");
+ progress_indication ("[" + to_str (breaks_i_) + "]");
}
}
gotcha = true;
- SCM pen = command_column_l_->get_grob_property ("penalty");
+ SCM pen = command_column_l_->get_grob_property ("penalty");
Real total_penalty = gh_number_p (pen)
- ? gh_scm2double(pen)
+ ? gh_scm2double (pen)
: 0.0;
SCM rpen = b->get_mus_property ("penalty");
command_column_l_->remove_grob_property ("breakable");
}
-ADD_THIS_TRANSLATOR(Score_engraver);
+ADD_THIS_TRANSLATOR (Score_engraver);
void
Score_performer::play_element (Audio_element * p)
{
- if (Audio_item * i=dynamic_cast<Audio_item *> (p))
+ if (Audio_item * i=dynamic_cast<Audio_item *> (p))
{
audio_column_l_->add_audio_item (i);
}
Score_performer::one_time_step ()
{
// fixme: put this back.
- // process_music();
+ // process_music ();
announces ();
- pre_move_processing();
- check_removal();
+ pre_move_processing ();
+ check_removal ();
}
void
-Score_performer::start()
+Score_performer::start ()
{
}
int
-Score_performer::get_tempo_i() const
+Score_performer::get_tempo_i () const
{
return performance_p_->midi_l_->get_tempo_i (Moment (1, 4));
}
void
-Score_performer::finish()
+Score_performer::finish ()
{
check_removal ();
- removal_processing();
+ removal_processing ();
}
Music_output *
unsmob_translator_def (definition_)->apply_property_operations (this);
assert (dynamic_cast<Midi_def *> (output_def_l_));
performance_p_ = new Performance;
- performance_p_->midi_l_ = dynamic_cast<Midi_def*>(output_def_l_);
+ performance_p_->midi_l_ = dynamic_cast<Midi_def*> (output_def_l_);
Translator_group::initialize ();
}
TODO: junkme.
*/
-Score::Score()
- : Input()
+Score::Score ()
+ : Input ()
{
header_p_ = 0;
music_ = SCM_EOL;
smobify_self ();
Music * m =unsmob_music (s.music_);
- music_ = m?m->clone()->self_scm () : SCM_EOL;
+ music_ = m?m->clone ()->self_scm () : SCM_EOL;
scm_unprotect_object (music_);
for (int i=0; i < s.def_p_arr_.size (); i++)
- def_p_arr_.push(s.def_p_arr_[i]->clone());
+ def_p_arr_.push (s.def_p_arr_[i]->clone ());
errorlevel_i_ = s.errorlevel_i_;
if (s.header_p_)
{
- header_p_ = (s.header_p_) ? new Scheme_hash_table (*s.header_p_): 0;
+ header_p_ = (s.header_p_) ? new Scheme_hash_table (*s.header_p_): 0;
- scm_unprotect_object(header_p_->self_scm ());
+ scm_unprotect_object (header_p_->self_scm ());
}
}
-Score::~Score()
+Score::~Score ()
{
}
Cpu_timer timer;
- Global_translator * trans_p = odef_l->get_global_translator_p();
+ Global_translator * trans_p = odef_l->get_global_translator_p ();
if (!trans_p)
{
programming_error ("no toplevel translator");
return ;
}
- progress_indication ("\n" + _("Interpreting music..."));
+ progress_indication (_ ("Interpreting music..."));
Music * music = unsmob_music (music_);
trans_p->final_mom_ = music->length_mom ();
Music_iterator * iter = Music_iterator::static_get_iterator_p (music);
- iter->init_translator(music, trans_p);
+ iter->init_translator (music, trans_p);
- iter->construct_children();
+ iter->construct_children ();
- if (! iter->ok())
+ if (! iter->ok ())
{
delete iter;
- warning (_("Need music in a score"));
+ warning (_ ("Need music in a score"));
errorlevel_i_ =1;
return ;
}
warning (_ ("Errors found/*, not processing score*/"));
}
- Music_output * output = trans_p->get_output_p();
+ Music_output * output = trans_p->get_output_p ();
scm_unprotect_object (trans_p->self_scm ());
- if(verbose_global_b)
+ if (verbose_global_b)
progress_indication (_f ("elapsed time: %.2f seconds", timer.read ()));
if (!header_p_)
header_p_ = new Scheme_hash_table; // ugh
Scope bla (header_p_);
output->header_l_ = &bla;
- output->origin_str_ = location_str();
+ output->origin_str_ = location_str ();
progress_indication ("\n");
- output->process();
+ output->process ();
delete output ;
/*
the system.
*/
- scm_gc();
+ scm_gc ();
}
void
-Score::process()
+Score::process ()
{
if (!unsmob_music (music_))
return;
for (int i=0; i < def_p_arr_.size (); i++)
{
if (no_paper_global_b
- && dynamic_cast<Paper_def*>(def_p_arr_[i]))
+ && dynamic_cast<Paper_def*> (def_p_arr_[i]))
continue;
run_translator (def_p_arr_[i]);
}
void
Score::add_output (Music_output_def *pap_p)
{
- def_p_arr_.push(pap_p);
+ def_p_arr_.push (pap_p);
}
-IMPLEMENT_SMOBS(Score);
-IMPLEMENT_DEFAULT_EQUAL_P(Score);
-IMPLEMENT_UNSMOB(Score, score);
+IMPLEMENT_SMOBS (Score);
+IMPLEMENT_DEFAULT_EQUAL_P (Score);
+IMPLEMENT_UNSMOB (Score, score);
SCM
Score::mark_smob (SCM s)
{
- Score * sc = (Score*) SCM_CELL_WORD_1(s);
+ Score * sc = (Score*) SCM_CELL_WORD_1 (s);
if (sc->header_p_)
scm_gc_mark (sc->header_p_->self_scm ());
for (int i = sc->def_p_arr_.size (); i--;)
#endif
for (int i=0; i < deps.size (); i ++)
{
- if (out.length_i() > WRAPWIDTH)
+ if (out.length_i () > WRAPWIDTH)
{
f << out << "\\\n";
out = " ";
}
void
-do_deps()
+do_deps ()
{
if (dependency_global_b)
{
void
-do_scores()
+do_scores ()
{
if (!global_header_p)
global_header_p = new Scheme_hash_table;
- for (int i=0; i < score_global_array.size(); i++)
+ for (int i=0; i < score_global_array.size (); i++)
{
Score* is_p = score_global_array[i];
if (is_p->errorlevel_i_)
{
- is_p->warning (_("Score contains errors; will not process it"));
+ is_p->warning (_ ("Score contains errors; will not process it"));
exit_status_global |= 1;
}
else
{
- is_p->process();
+ is_p->process ();
}
}
do_deps ();
{
for (int i=0; i < score_global_array.size (); i++)
scm_unprotect_object (score_global_array[i]->self_scm ());
- score_global_array.clear();
+ score_global_array.clear ();
inclusion_global_array.clear ();
if (global_header_p)
if (init_str.length_i () && global_path.find (init_str).empty_b ())
{
warning (_f ("can't find file: `%s'", init_str));
- warning (_f ("(search path: `%s')", global_path.str ().ch_C()));
+ warning (_f ("(search path: `%s')", global_path.str ().ch_C ()));
return;
}
if ((file_str != "-") && global_path.find (file_str).empty_b ())
public:
Script_column_engraver ();
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
protected:
virtual void acknowledge_grob (Grob_info);
virtual void create_grobs ();
};
-Script_column_engraver::Script_column_engraver()
+Script_column_engraver::Script_column_engraver ()
{
scol_p_ =0;
}
}
void
-Script_column_engraver::acknowledge_grob(Grob_info inf)
+Script_column_engraver::acknowledge_grob (Grob_info inf)
{
Item *thing = dynamic_cast<Item*> (inf.elem_l_);
if (thing && Side_position_interface::has_interface (inf.elem_l_)) // ugh FIXME
script_l_arr_.clear ();
}
}
-ADD_THIS_TRANSLATOR(Script_column_engraver);
+ADD_THIS_TRANSLATOR (Script_column_engraver);
return gh_scm2int (p1) - gh_scm2int (p2);
}
-MAKE_SCHEME_CALLBACK(Script_column,before_line_breaking,1);
+MAKE_SCHEME_CALLBACK (Script_column,before_line_breaking,1);
SCM
Script_column::before_line_breaking (SCM smob)
Direction d = DOWN;
do {
- Link_array<Grob> &arr(arrs[d]);
+ Link_array<Grob> &arr (arrs[d]);
arr.sort (staff_side_compare);
{
if (last)
- Side_position_interface::add_support( arr[i],last);
+ Side_position_interface::add_support (arr[i],last);
arr[i]->remove_grob_property ("script-priority");
last = arr[i];
void
Script_engraver::initialize ()
{
- script_req_l_arr_.clear();
+ script_req_l_arr_.clear ();
}
bool
{
if (Articulation_req *mr = dynamic_cast <Articulation_req *> (r_l))
{
- for (int i=0; i < script_req_l_arr_.size(); i++)
+ for (int i=0; i < script_req_l_arr_.size (); i++)
{
if (script_req_l_arr_[i]->equal_b (mr))
return true;
void
Script_engraver::process_music ()
{
- for (int i=0; i < script_req_l_arr_.size(); i++)
+ for (int i=0; i < script_req_l_arr_.size (); i++)
{
Articulation_req* l=script_req_l_arr_[i];
if (art == SCM_BOOL_F)
{
String a = ly_scm2string (l->get_mus_property ("articulation-type"));
- l->origin ()->warning (_f ("Don't know how to interpret articulation `%s'", a.ch_C()));
+ l->origin ()->warning (_f ("Don't know how to interpret articulation `%s'", a.ch_C ()));
continue;
}
p->set_grob_property ("molecule",
gh_car (art));
- art = gh_cdr(art);
+ art = gh_cdr (art);
bool follow_staff = gh_scm2bool (gh_car (art));
- art = gh_cdr(art);
+ art = gh_cdr (art);
SCM relative_stem_dir = gh_car (art);
- art = gh_cdr(art);
+ art = gh_cdr (art);
SCM force_dir = l->get_mus_property ("direction");
if (isdir_b (force_dir) && !to_dir (force_dir))
force_dir = gh_car (art);
- art = gh_cdr(art);
+ art = gh_cdr (art);
SCM priority = gh_car (art);
if (Stem::has_interface (inf.elem_l_))
{
- for (int i=0; i < script_p_arr_.size(); i++)
+ for (int i=0; i < script_p_arr_.size (); i++)
{
Grob*e = script_p_arr_[i];
}
else if (Rhythmic_head::has_interface (inf.elem_l_))
{
- for (int i=0; i < script_p_arr_.size(); i++)
+ for (int i=0; i < script_p_arr_.size (); i++)
{
Grob *e = script_p_arr_[i];
}
void
-Script_engraver::stop_translation_timestep()
+Script_engraver::stop_translation_timestep ()
{
- for (int i=0; i < script_p_arr_.size(); i++)
+ for (int i=0; i < script_p_arr_.size (); i++)
{
Grob * sc = script_p_arr_[i];
if (to_boolean (sc->get_grob_property ("staff-support")))
}
typeset_grob (sc);
}
- script_p_arr_.clear();
+ script_p_arr_.clear ();
}
void
-Script_engraver::start_translation_timestep()
+Script_engraver::start_translation_timestep ()
{
- script_req_l_arr_.clear();
+ script_req_l_arr_.clear ();
}
ADD_THIS_TRANSLATOR (Script_engraver);
#include "lookup.hh"
Molecule
-Script::get_molecule(Grob * me, Direction d)
+Script::get_molecule (Grob * me, Direction d)
{
SCM s = me->get_grob_property ("molecule");
assert (gh_pair_p (s));
- SCM key = gh_car (s);
+ SCM key = gh_car (s);
if (key == ly_symbol2scm ("feta"))
{
return Font_interface::get_default_font (me)->find_by_name ("scripts-" +
return Molecule ();
}
-MAKE_SCHEME_CALLBACK(Script,after_line_breaking,1);
+MAKE_SCHEME_CALLBACK (Script,before_line_breaking,1);
SCM
-Script::after_line_breaking (SCM smob)
+Script::before_line_breaking (SCM smob)
{
Grob * me = unsmob_grob (smob);
Direction d = Side_position_interface::get_direction (me);
+
+ if (!d)
+ {
+ /*
+ we should not have `arbitrary' directions.
+ */
+ programming_error ("Script direction not yet known!");
+ d = DOWN;
+ }
+
Side_position_interface::set_direction (me,d);
return SCM_UNSPECIFIED;
}
-MAKE_SCHEME_CALLBACK(Script,brew_molecule,1);
+
+MAKE_SCHEME_CALLBACK (Script,brew_molecule,1);
SCM
Script::brew_molecule (SCM smob)
{
Grob *me= unsmob_grob (smob);
-#if 0
- Direction dir = DOWN;
- SCM d = me->get_grob_property ("direction");
- if (isdir_b (d))
- dir = to_dir (d);
-#endif
- Direction dir = Side_position_interface::get_direction(me);
- return get_molecule (me, dir).smobbed_copy();
+
+ Direction dir = Side_position_interface::get_direction (me);
+ if (!dir)
+ {
+ programming_error ("Script direction not known, but molecule wanted.");
+ dir= DOWN;
+ }
+
+ return get_molecule (me, dir).smobbed_copy ();
}
bool
{
return me->set_interface (ly_symbol2scm ("script-interface"));
}
+
rod.add_to_cols ();
}
-MAKE_SCHEME_CALLBACK(Separating_group_spanner,set_spacing_rods,1);
+MAKE_SCHEME_CALLBACK (Separating_group_spanner,set_spacing_rods,1);
SCM
Separating_group_spanner::set_spacing_rods (SCM smob)
{
SCM next_elt = gh_car (s);
Item *l = dynamic_cast<Item*> (unsmob_grob (elt));
- Item *r = dynamic_cast<Item*> (unsmob_grob ( next_elt));
+ Item *r = dynamic_cast<Item*> (unsmob_grob (next_elt));
if (!r || !l)
continue;
Item *lb
- = dynamic_cast<Item*>(l->find_prebroken_piece (RIGHT));
+ = dynamic_cast<Item*> (l->find_prebroken_piece (RIGHT));
Item *rb
- = dynamic_cast<Item*>(r->find_prebroken_piece (LEFT));
+ = dynamic_cast<Item*> (r->find_prebroken_piece (LEFT));
- do_rod(l, r);
+ do_rod (l, r);
if (lb)
{
do_rod (lb, r);
*/
for (SCM s = me->get_grob_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
{
- Item * it =dynamic_cast<Item*>(unsmob_grob (gh_car (s)));
+ Item * it =dynamic_cast<Item*> (unsmob_grob (gh_car (s)));
if (it && it->broken_b ())
{
it->find_prebroken_piece (LEFT) ->suicide ();
return;
if (it->parent_l (X_AXIS)
&& it->parent_l (X_AXIS)->has_extent_callback_b
- (Axis_group_interface::group_extent_callback_proc, X_AXIS))
+ (Axis_group_interface::group_extent_callback_proc, X_AXIS))
return;
if (!p_ref_)
{
p_ref_ = new Item
- (get_property ("SeparationItem"));
+ (get_property ("SeparationItem"));
if (ib)
p_ref_->set_grob_property ("breakable", SCM_BOOL_T);
-ADD_THIS_TRANSLATOR(Separating_line_group_engraver);
+ADD_THIS_TRANSLATOR (Separating_line_group_engraver);
if (pc != il->column_l ())
{
/* this shouldn't happen, but let's continue anyway. */
- programming_error (_("Separation_item: I've been drinking too much"));
+ programming_error (_ ("Separation_item: I've been drinking too much"));
continue; /*UGH UGH*/
}
Interval iv (il->extent (pc, X_AXIS));
if (!iv.empty_b ())
{
- w.unite (iv);
+ w.unite (iv);
}
}
The length of musiclist from start to up to cursor_ (cursor_ not
including), is summed
- here_mom_ = sum (length (musiclist [start ... cursor> )) %)
+ here_mom_ = sum (length (musiclist [start ... cursor>)) %)
*/
iter_p_ = 0;
}
-Sequential_music_iterator::~Sequential_music_iterator()
+Sequential_music_iterator::~Sequential_music_iterator ()
{
delete iter_p_;
}
void
-Sequential_music_iterator::construct_children()
+Sequential_music_iterator::construct_children ()
{
cursor_ = dynamic_cast<Music_sequence const*> (music_l_)->music_list ();
/*
iter_p_->ok () is tautology, but what the heck.
*/
- if (iter_p_ && iter_p_->ok())
+ if (iter_p_ && iter_p_->ok ())
descend_to_child ();
}
s = gh_append2 (nm, s);
Moment m = 0;
- for (SCM i = nm; gh_pair_p(i); i = gh_cdr (i))
+ for (SCM i = nm; gh_pair_p (i); i = gh_cdr (i))
m = m >? unsmob_music (gh_car (i))->length_mom ();
if (m > Moment (0))
}
Moment
-Sequential_music_iterator::pending_moment() const
+Sequential_music_iterator::pending_moment () const
{
- return iter_p_->pending_moment() + here_mom_;
+ return iter_p_->pending_moment () + here_mom_;
}
bool
-Sequential_music_iterator::ok() const
+Sequential_music_iterator::ok () const
{
return iter_p_;
}
{
return iter_p_ ? iter_p_->try_music (m) : 0;
}
-IMPLEMENT_CTOR_CALLBACK(Sequential_music_iterator);
+IMPLEMENT_CTOR_CALLBACK (Sequential_music_iterator);
}
SCM other_elt = me->get_grob_property ("direction-source");
- Grob * e = unsmob_grob(other_elt);
+ Grob * e = unsmob_grob (other_elt);
if (e)
{
- return (Direction)(relative_dir * Directional_element_interface::get (e));
+ return (Direction) (relative_dir * Directional_element_interface::get (e));
}
return CENTER;
}
-MAKE_SCHEME_CALLBACK(Side_position_interface,aligned_on_support_extents, 2);
+MAKE_SCHEME_CALLBACK (Side_position_interface,aligned_on_support_extents, 2);
SCM
Side_position_interface::aligned_on_support_extents (SCM element_smob, SCM axis)
{
Interval dim;
for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
{
- Grob * e = unsmob_grob ( gh_car (s));
+ Grob * e = unsmob_grob (gh_car (s));
if (e)
if (use_extents)
dim.unite (e->extent (common, a));
if (dim.empty_b ())
{
- dim = Interval(0,0);
+ dim = Interval (0,0);
}
Direction dir = Side_position_interface::get_direction (me);
/*
Cut & paste (ugh.)
*/
-MAKE_SCHEME_CALLBACK(Side_position_interface,aligned_on_support_refpoints,2);
+MAKE_SCHEME_CALLBACK (Side_position_interface,aligned_on_support_refpoints,2);
SCM
Side_position_interface::aligned_on_support_refpoints (SCM smob, SCM axis)
{
/**
callback that centers the element on itself
*/
-MAKE_SCHEME_CALLBACK(Side_position_interface,aligned_on_self,2);
+MAKE_SCHEME_CALLBACK (Side_position_interface,aligned_on_self,2);
SCM
Side_position_interface::aligned_on_self (SCM element_smob, SCM axis)
{
Axis a = (Axis) gh_scm2int (axis);
String s ("self-alignment-");
- s += (a == X_AXIS) ? "X" : "Y";
+ s += (a == X_AXIS) ? "X" : "Y";
- SCM align (me->get_grob_property (s.ch_C()));
+ SCM align (me->get_grob_property (s.ch_C ()));
if (gh_number_p (align))
{
- Interval ext(me->extent (me,a));
+ Interval ext (me->extent (me,a));
if (ext.empty_b ())
{
of the elements "direction" elt property.
Only rounds when we're inside the staff, as determined by
- Staff_symbol_referencer::staff_radius() */
-MAKE_SCHEME_CALLBACK(Side_position_interface,quantised_position,2);
+ Staff_symbol_referencer::staff_radius () */
+MAKE_SCHEME_CALLBACK (Side_position_interface,quantised_position,2);
SCM
-Side_position_interface::quantised_position (SCM element_smob, SCM )
+Side_position_interface::quantised_position (SCM element_smob, SCM)
{
Grob *me = unsmob_grob (element_smob);
Real p = Staff_symbol_referencer::position_f (me);
Real rp = directed_round (p, d);
Real rad = Staff_symbol_referencer::staff_radius (me) *2 ;
- int ip = int (rp);
+ int ip = int (rp);
if (abs (ip) <= rad && Staff_symbol_referencer::on_staffline (me,ip))
{
/*
Position next to support, taking into account my own dimensions and padding.
*/
-MAKE_SCHEME_CALLBACK(Side_position_interface,aligned_side,2);
+MAKE_SCHEME_CALLBACK (Side_position_interface,aligned_side,2);
SCM
Side_position_interface::aligned_side (SCM element_smob, SCM axis)
{
Axis a = (Axis) gh_scm2int (axis);
Direction d = Side_position_interface::get_direction (me);
+
Real o = gh_scm2double (aligned_on_support_extents (element_smob,axis));
Interval iv = me->extent (me, a);
if (!iv.empty_b ())
{
+ if (!d)
+ {
+ programming_error ("Direction unknown, but aligned-side wanted.");
+ d = DOWN;
+ }
o += - iv[-d];
SCM pad = me->get_grob_property ("padding");
/*
Position centered on parent.
*/
-MAKE_SCHEME_CALLBACK(Side_position_interface,centered_on_parent,2);
+MAKE_SCHEME_CALLBACK (Side_position_interface,centered_on_parent,2);
SCM
Side_position_interface::centered_on_parent (SCM element_smob, SCM axis)
{
bool
Side_position_interface::supported_b (Grob*me)
{
- SCM s = me->get_grob_property ("side-support-elements");
- return gh_pair_p(s);
+ SCM s = me->get_grob_property ("side-support-elements");
+ return gh_pair_p (s);
}
skip (m);
}
-IMPLEMENT_CTOR_CALLBACK(Simple_music_iterator);
+IMPLEMENT_CTOR_CALLBACK (Simple_music_iterator);
if (conf < line_len_f_)
{
- force_f_ += (line_len_f_ - conf) * active_springs_stiffness ();
+ force_f_ += (line_len_f_ - conf) * active_springs_stiffness ();
break;
}
else
}
desc.block_force_f_ = - desc.hooke_f_ * desc.ideal_f_; // block at distance 0
- springs_.push (desc);
+ springs_.push (desc);
}
for (int i=0; i < cols.size () - 1; i++)
positions->config_.push (positions->config_.top () + springs_[i].length (force_f_));
}
- positions->satisfies_constraints_b_ = (line_len_f_ < 0) || active_b ();
+ positions->satisfies_constraints_b_ = (line_len_f_ < 0) || active_b ();
}
-Spring_description::Spring_description( )
+Spring_description::Spring_description ()
{
ideal_f_ =0.0;
hooke_f_ =0.0;
}
void
-Simultaneous_music_iterator::construct_children()
+Simultaneous_music_iterator::construct_children ()
{
int j = 0;
Music_sequence const *sim = dynamic_cast<Music_sequence const*> (music_l_);
SCM i = sim->music_list ();
- for (; gh_pair_p(i); i = gh_cdr(i), j++)
+ for (; gh_pair_p (i); i = gh_cdr (i), j++)
{
Music *mus = unsmob_music (gh_car (i));
Music_iterator * mi = static_get_iterator_p (mus);
number number as name */
Translator_group * t = (j && separate_contexts_b_)
- ? report_to_l ()->find_create_translator_l (report_to_l()->type_str_,
+ ? report_to_l ()->find_create_translator_l (report_to_l ()->type_str_,
to_str (j))
: report_to_l ();
mi->init_translator (mus, t);
mi->construct_children ();
- if (mi->ok())
+ if (mi->ok ())
{
children_p_list_.append (new Killing_cons<Music_iterator> (mi,0));
}
for (Cons<Music_iterator> **pp = &children_p_list_.head_; *pp;)
{
Music_iterator * i = (*pp)->car_;
- if (i->pending_moment() == until)
+ if (i->pending_moment () == until)
{
i->process (until);
}
- if (!i->ok())
+ if (!i->ok ())
delete children_p_list_.remove_cons (pp);
else
- pp = &(*pp)->next_;
+ pp = & (*pp)->next_;
}
}
for (Cons<Music_iterator> **pp = &children_p_list_.head_; *pp;)
{
Music_iterator * i = (*pp)->car_;
- if (i->pending_moment() <= until)
+ if (i->pending_moment () <= until)
{
i->skip (until);
}
- if (!i->ok())
+ if (!i->ok ())
delete children_p_list_.remove_cons (pp);
else
- pp = &(*pp)->next_;
+ pp = & (*pp)->next_;
}
}
Moment
-Simultaneous_music_iterator::pending_moment() const
+Simultaneous_music_iterator::pending_moment () const
{
Moment next;
next.set_infinite (1);
for (Cons<Music_iterator> *p = children_p_list_.head_; p; p = p->next_)
- next = next <? p->car_->pending_moment() ;
+ next = next <? p->car_->pending_moment () ;
return next;
}
bool
-Simultaneous_music_iterator::ok() const
+Simultaneous_music_iterator::ok () const
{
return children_p_list_.head_;
}
-IMPLEMENT_CTOR_CALLBACK(Simultaneous_music_iterator);
+IMPLEMENT_CTOR_CALLBACK (Simultaneous_music_iterator);
x = Interval ((encompass_[i-1][X_AXIS] + encompass_[i][X_AXIS])/2,
encompass_[i][X_AXIS]);
y = Interval (0,
- (curve_.get_other_coordinate (X_AXIS,
- (x[MIN] + x[MAX]) / 2)));
+ (curve_.get_other_coordinate (X_AXIS,
+ (x[MIN] + x[MAX]) / 2)));
}
else
{
x = Interval ((encompass_[i-1][X_AXIS] + encompass_[i][X_AXIS]) / 2,
- (encompass_[i][X_AXIS] + encompass_[i+1][X_AXIS]) / 2);
+ (encompass_[i][X_AXIS] + encompass_[i+1][X_AXIS]) / 2);
y = Interval (encompass_[i][Y_AXIS],
- (curve_.get_other_coordinate (X_AXIS, x[MIN])
+ (curve_.get_other_coordinate (X_AXIS, x[MIN])
+ curve_.get_other_coordinate (X_AXIS,
- (x[MIN] + x[MAX]) / 2)
+ (x[MIN] + x[MAX]) / 2)
+ curve_.get_other_coordinate (X_AXIS, x[MAX])) / 3);
}
/*
- max ( encompass.y / curve.y )
+ max (encompass.y / curve.y)
*/
Real
/*
Let's not start more than one slur per moment.
*/
- if (sl->get_span_dir() == START)
+ if (sl->get_span_dir () == START)
{
if (now_mom () > last_start_)
{
{
Span_req* slur_req_l = new_slur_req_l_arr_[i];
// end slur: move the slur to other array
- if (slur_req_l->get_span_dir() == STOP)
+ if (slur_req_l->get_span_dir () == STOP)
{
if (slur_l_stack_.empty ())
+ /* How to shut up this warning, when Voice_devnull_engraver has
+ eaten start request? */
slur_req_l->origin ()->warning (_f ("can't find start of slur"));
else
{
requests_arr_.pop ();
}
}
- else if (slur_req_l->get_span_dir() == START)
+ else if (slur_req_l->get_span_dir () == START)
{
// push a new slur onto stack.
// (use temp. array to wait for all slur STOPs)
* begin and end should be treated as a/acknowledge Scripts.
* smart changing of endings
* smart changing of (Y-?)offsets to avoid ugly beziers
- (along-side-stem)
+ (along-side-stem)
*/
#include "directional-element-interface.hh"
me->add_dependency (n);
}
- add_bound_item (dynamic_cast<Spanner*> (me), dynamic_cast<Item*>(n));
+ add_bound_item (dynamic_cast<Spanner*> (me), dynamic_cast<Item*> (n));
}
void
Real ff = bb->fit_factor ();
for (int i = 1; i < 3; i++)
{
- Real ind = abs (bb->curve_.control_[(i-1)*3][X_AXIS]
+ Real ind = abs (bb->curve_.control_[ (i-1)*3][X_AXIS]
- bb->curve_.control_[i][X_AXIS]) / length;
Real h = bb->curve_.control_[i][Y_AXIS] * ff / length;
{
Real staff_space = Staff_symbol_referencer::staff_space ((Grob*)me);
Direction dir = (Direction)gh_scm2int (me->get_grob_property ("direction"));
- Direction d = (Direction)(- dir * (sign (dy)));
+ Direction d = (Direction) (- dir * (sign (dy)));
SCM a = me->get_grob_property ("attachment-offset");
Drul_array<Offset> o;
o[LEFT] = ly_scm2offset (index_cell (a, LEFT));
{
Grob *col = dir == LEFT
? unsmob_grob (gh_car (scm_reverse (me->get_grob_property
- ("note-columns"))))
+ ("note-columns"))))
: unsmob_grob
- (gh_car (me->get_grob_property ("note-columns")));
+ (gh_car (me->get_grob_property ("note-columns")));
Grob *common[] =
{
int neighbour_cols = scm_ilength (neighbour->get_grob_property ("note-columns"));
int cols = scm_ilength (me->get_grob_property ("note-columns"));
o = Offset (0, (y*neighbour_cols + neighbour_y*cols) /
- (cols + neighbour_cols));
+ (cols + neighbour_cols));
break;
}
}
s = me->get_grob_property ("attachment");
}
SCM a = dir == LEFT ? gh_car (s) : gh_cdr (s);
- Spanner*sp = dynamic_cast<Spanner*>(me);
+ Spanner*sp = dynamic_cast<Spanner*> (me);
String str = ly_symbol2string (a);
Real staff_space = Staff_symbol_referencer::staff_space ((Grob*)me);
Real hs = staff_space / 2.0;
Default position is on stem X, at stem end Y
*/
o += Offset (0.5 *
- (n->extent (n,X_AXIS).length ()
+ (n->extent (n,X_AXIS).length ()
- stem->extent (stem,X_AXIS).length ())
* (1 + Stem::get_direction (stem)),
0);
int stemdir = stem ? Stem::get_direction (stem) : 1;
int slurdir = gh_scm2int (me->get_grob_property ("direction"));
SCM l = scm_assoc
- (scm_listify (a,
+ (scm_listify (a,
gh_int2scm (stemdir * dir),
gh_int2scm (slurdir * dir),
SCM_UNDEFINED), alist);
Array<Offset>
Slur::get_encompass_offset_arr (Grob *me)
{
- Spanner*sp = dynamic_cast<Spanner*>(me);
+ Spanner*sp = dynamic_cast<Spanner*> (me);
SCM eltlist = me->get_grob_property ("note-columns");
Grob *common[] = {me->common_refpoint (eltlist, X_AXIS),
me->common_refpoint (eltlist, Y_AXIS)};
}
-MAKE_SCHEME_CALLBACK(Slur,set_spacing_rods,1);
+MAKE_SCHEME_CALLBACK (Slur,set_spacing_rods,1);
SCM
Slur::set_spacing_rods (SCM smob)
{
Grob*me = unsmob_grob (smob);
Rod r;
- Spanner*sp = dynamic_cast<Spanner*>(me);
+ Spanner*sp = dynamic_cast<Spanner*> (me);
r.item_l_drul_[LEFT] = sp->get_bound (LEFT);
r.item_l_drul_[RIGHT] = sp->get_bound (RIGHT);
r.distance_f_ =
{
Axis a = (Axis)gh_scm2int (ax);
Grob * me = unsmob_grob (smob);
- assert ( a == Y_AXIS);
+ assert (a == Y_AXIS);
SCM mol = me->get_uncached_molecule ();
return ly_interval2scm (unsmob_molecule (mol)->extent (a));
else
a = Lookup::slur (one, Directional_element_interface::get (me) * thick, thick);
- return a.smobbed_copy();
+ return a.smobbed_copy ();
}
void
if (gh_number_p (ssb))
sb = gh_scm2double (ssb);
- bb.minimise_enclosed_area ( sb, details);
+ bb.minimise_enclosed_area (sb, details);
SCM sbf = scm_assq (ly_symbol2scm ("force-blowfit"), details);
Real bff = 1.0;
if (gh_pair_p (sbf) && gh_number_p (gh_cdr (sbf)))
SCM controls = SCM_EOL;
for (int i= 4; i--;)
{
- controls = gh_cons ( ly_offset2scm (b.control_[i]), controls);
+ controls = gh_cons (ly_offset2scm (b.control_[i]), controls);
/*
BRRR WHURG.
All these null control-points, where do they all come from?
if (x > x1 && x <x2)
{
Real y = b.get_other_coordinate (X_AXIS, x);
- off = off >? dir * (enc[i][Y_AXIS] - y);
+ off = off >? dir * (enc[i][Y_AXIS] - y);
}
}
b.translate (Offset (0, dir * off));
#include "warn.hh"
SCM
-Spaceable_grob::get_minimum_distances ( Grob*me)
+Spaceable_grob::get_minimum_distances (Grob*me)
{
return me->get_grob_property ("minimum-distances");
}
SCM dist = gh_car (s);
if (gh_car (dist) == p->self_scm ())
{
- programming_error("already have that spring");
+ programming_error ("already have that spring");
return ;
}
}
Rhythmic_tuple ()
{
}
- Rhythmic_tuple (Grob_info i, Moment m )
+ Rhythmic_tuple (Grob_info i, Moment m)
{
info_ = i;
end_ = m;
Spanner * spacing_p_;
protected:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
virtual void acknowledge_grob (Grob_info);
virtual void start_translation_timestep ();
virtual void stop_translation_timestep ();
Rhythmic_tuple::time_compare (Rhythmic_tuple const &h1,
Rhythmic_tuple const &h2)
{
- return (h1.end_ - h2.end_ ).sign ();
+ return (h1.end_ - h2.end_).sign ();
}
-Spacing_engraver::Spacing_engraver()
+Spacing_engraver::Spacing_engraver ()
{
spacing_p_ = 0;
}
if (to_boolean (i.elem_l_->get_grob_property ("non-rhythmic")))
return;
- if (Rhythmic_req * r = dynamic_cast<Rhythmic_req*>(i.req_l_))
+ if (Rhythmic_req * r = dynamic_cast<Rhythmic_req*> (i.req_l_))
{
- Rhythmic_tuple t(i, now_mom () + r->length_mom ());
+ Rhythmic_tuple t (i, now_mom () + r->length_mom ());
now_durations_.push (t);
}
}
Paper_column * sc
= dynamic_cast<Paper_column*> (unsmob_grob (get_property ("currentMusicalColumn")));
- SCM sh = shortest_playing.smobbed_copy( );
- SCM st = starter.smobbed_copy();
+ SCM sh = shortest_playing.smobbed_copy ();
+ SCM st = starter.smobbed_copy ();
sc->set_grob_property ("shortest-playing-duration", sh);
sc->set_grob_property ("shortest-starter-duration", st);
stopped_durations_.push (playing_durations_.get ());
}
-ADD_THIS_TRANSLATOR(Spacing_engraver);
+ADD_THIS_TRANSLATOR (Spacing_engraver);
if (dynamic_cast<Paper_column*> (cols[i])->musical_b ())
{
SCM st = cols[i]->get_grob_property ("shortest-starter-duration");
- Moment this_shortest = *unsmob_moment(st);
+ Moment this_shortest = *unsmob_moment (st);
shortest = shortest <? this_shortest;
if (!mean_shortest.infty_b ())
{
{
Item * l = dynamic_cast<Item*> (cols[i]);
Item * r = dynamic_cast<Item*> (cols[i+1]);
- Item * lb = dynamic_cast<Item*> ( l->find_prebroken_piece (RIGHT));
- Item * rb = dynamic_cast<Item*> ( r->find_prebroken_piece (LEFT));
+ Item * lb = dynamic_cast<Item*> (l->find_prebroken_piece (RIGHT));
+ Item * rb = dynamic_cast<Item*> (r->find_prebroken_piece (LEFT));
Item* combinations[4][2]={{l,r}, {lb,r}, {l,rb},{lb,rb}};
{
left_distance = gh_scm2double (gh_cdr (hint));
}
- // 2nd condition should be (i+1 < col_count()), ie. not the last column in score. FIXME
- else if (!lc->musical_b() && i+1 < cols.size ())
+ // 2nd condition should be (i+1 < col_count ()), ie. not the last column in score. FIXME
+ else if (!lc->musical_b () && i+1 < cols.size ())
{
left_distance= default_bar_spacing (me,lc,rc,shortest <? base_shortest_duration);
}
- else if (lc->musical_b())
+ else if (lc->musical_b ())
{
left_distance = note_spacing (me,lc, rc, shortest <? base_shortest_duration);
}
else
{
Interval ext (rc->extent (rc, X_AXIS));
- right_dist = ext.empty_b() ? 0.0 : - ext [LEFT];
+ right_dist = ext.empty_b () ? 0.0 : - ext [LEFT];
}
/*
if (gh_pair_p (next_stretch_hint))
// see regtest spacing-tight
- stretch_dist += - gh_scm2double (gh_car (next_stretch_hint));
+ stretch_dist += - gh_scm2double (gh_car (next_stretch_hint));
else
stretch_dist += right_dist;
if (s.distance_f_ <0)
{
- programming_error("Negative dist, setting to 1.0 PT");
+ programming_error ("Negative dist, setting to 1.0 PT");
s.distance_f_ = 1.0;
}
if (stretch_dist == 0.0)
Spacing_spanner::get_duration_space (Grob*me, Moment d, Moment shortest)
{
Real log = log_2 (shortest);
- Real k = gh_scm2double (me->get_grob_property ("arithmetic-basicspace"))
+ Real k = gh_scm2double (me->get_grob_property ("arithmetic-basicspace"))
- log;
return (log_2 (d) + k) * gh_scm2double (me->get_grob_property ("arithmetic-multiplier"));
// SCM s = lc->get_grob_property ("mean-playing-duration");
if (unsmob_moment (s))
- shortest_playing_len = *unsmob_moment(s);
+ shortest_playing_len = *unsmob_moment (s);
if (! shortest_playing_len)
{
}
Moment delta_t = Paper_column::when_mom (rc) - Paper_column::when_mom (lc);
Real dist = get_duration_space (me, shortest_playing_len, shortest);
- dist *= (double)(delta_t / shortest_playing_len);
+ dist *= (double) (delta_t / shortest_playing_len);
/*
UGH: KLUDGE!
dl = gh_car (dl);
dr = gh_car (dr);
- assert (gh_number_p (dl) && gh_number_p(dr));
+ assert (gh_number_p (dl) && gh_number_p (dr));
int d1 = gh_scm2int (dl);
int d2 = gh_scm2int (dr);
Real correction = 0.0;
- Real ssc = gh_scm2double (me->get_grob_property("stem-spacing-correction"));
+ Real ssc = gh_scm2double (me->get_grob_property ("stem-spacing-correction"));
if (d1 && d2 && d1 * d2 == -1)
{
}
-MAKE_SCHEME_CALLBACK(Spacing_spanner, set_springs,1);
+MAKE_SCHEME_CALLBACK (Spacing_spanner, set_springs,1);
SCM
Spacing_spanner::set_springs (SCM smob)
{
Link_array<Item> bar_l_arr_;
public:
- VIRTUAL_COPY_CONS(Translator);
- Span_bar_engraver();
+ VIRTUAL_COPY_CONS (Translator);
+ Span_bar_engraver ();
protected:
virtual void acknowledge_grob (Grob_info);
- virtual void stop_translation_timestep();
+ virtual void stop_translation_timestep ();
};
-Span_bar_engraver::Span_bar_engraver()
+Span_bar_engraver::Span_bar_engraver ()
{
spanbar_p_ =0;
}
void
Span_bar_engraver::acknowledge_grob (Grob_info i)
{
- int depth = i.origin_trans_l_arr (this).size();
+ int depth = i.origin_trans_l_arr (this).size ();
if (depth > 1
&& Bar::has_interface (i.elem_l_))
{
- Item * it = dynamic_cast<Item*>(i.elem_l_);
+ Item * it = dynamic_cast<Item*> (i.elem_l_);
bar_l_arr_.push (it);
- if (bar_l_arr_.size() >= 2 && !spanbar_p_)
+ if (bar_l_arr_.size () >= 2 && !spanbar_p_)
{
spanbar_p_ = new Item (get_property ("SpanBar"));
Span_bar::set_interface (spanbar_p_);
}
}
void
-Span_bar_engraver::stop_translation_timestep()
+Span_bar_engraver::stop_translation_timestep ()
{
if (spanbar_p_)
{
- for (int i=0; i < bar_l_arr_.size() ; i++)
- Span_bar::add_bar( spanbar_p_,bar_l_arr_[i]);
+ for (int i=0; i < bar_l_arr_.size () ; i++)
+ Span_bar::add_bar (spanbar_p_,bar_l_arr_[i]);
SCM vissym =ly_symbol2scm ("visibility-lambda");
SCM vis = bar_l_arr_[0]->get_grob_property (vissym);
-ADD_THIS_TRANSLATOR(Span_bar_engraver);
+ADD_THIS_TRANSLATOR (Span_bar_engraver);
me->add_dependency (b);
}
-MAKE_SCHEME_CALLBACK(Span_bar,width_callback,2);
+MAKE_SCHEME_CALLBACK (Span_bar,width_callback,2);
SCM
Span_bar::width_callback (SCM element_smob, SCM scm_axis)
{
*/
Molecule m = Bar::compound_barline (se, gl, 40 PT);
- return ly_interval2scm ( m.extent (X_AXIS));
+ return ly_interval2scm (m.extent (X_AXIS));
}
-MAKE_SCHEME_CALLBACK(Span_bar,before_line_breaking,1);
+MAKE_SCHEME_CALLBACK (Span_bar,before_line_breaking,1);
SCM
Span_bar::before_line_breaking (SCM smob)
{
/*
no need to call Bar::before_line_breaking (), because the info
- in ELEMENTS already has been procced by Bar::before_line_breaking().
+ in ELEMENTS already has been procced by Bar::before_line_breaking ().
*/
return SCM_UNSPECIFIED;
}
-MAKE_SCHEME_CALLBACK(Span_bar,center_on_spanned_callback,2);
+MAKE_SCHEME_CALLBACK (Span_bar,center_on_spanned_callback,2);
SCM
Span_bar::center_on_spanned_callback (SCM element_smob, SCM axis)
interval that we span. */
if (i.empty_b ())
{
- me->suicide();
+ me->suicide ();
return gh_double2scm (0.0);
}
/*
TODO: filter all hara-kiried out of ELEMENS list, and then
optionally do suicide. Call this cleanage function from
- center_on_spanned_callback() as well.
+ center_on_spanned_callback () as well.
*/
if (!gh_pair_p (me->get_grob_property ("elements")))
type = ".|.";
}
- gl = ly_str02scm (type.ch_C());
+ gl = ly_str02scm (type.ch_C ());
if (scm_equal_p (me->get_grob_property (glsym), gl) != SCM_BOOL_T)
me->set_grob_property (glsym, gl);
}
Interval
Span_bar::get_spanned_interval (Grob*me)
{
- return ly_scm2interval (Axis_group_interface::group_extent_callback (me->self_scm(), gh_int2scm (Y_AXIS)));
+ return ly_scm2interval (Axis_group_interface::group_extent_callback (me->self_scm (), gh_int2scm (Y_AXIS)));
}
-MAKE_SCHEME_CALLBACK(Span_bar,get_bar_size,1);
+MAKE_SCHEME_CALLBACK (Span_bar,get_bar_size,1);
SCM
Span_bar::get_bar_size (SCM smob)
{
dv = (Real)finished_dir_ * 0.2;
if (!start_volume)
start_volume = finished_dynamic_tuple_arr_.top
- ().audio_l_->volume_ - dv;
+ ().audio_l_->volume_ - dv;
}
Moment start_mom = finished_dynamic_tuple_arr_[0].mom_;
Moment dt = finished_dynamic_tuple_arr_.top ().mom_ - start_mom;
for (int i=0; i < finished_dynamic_tuple_arr_.size (); i++)
{
Audio_dynamic_tuple* a = &finished_dynamic_tuple_arr_[i];
- Real volume = start_volume + dv * (Real)(a->mom_ - start_mom)
+ Real volume = start_volume + dv * (Real) (a->mom_ - start_mom)
/ (Real)dt;
a->audio_l_->volume_ = volume;
}
bool
Span_dynamic_performer::try_music (Music* r)
{
- if (Span_req * s = dynamic_cast<Span_req*>(r))
+ if (Span_req * s = dynamic_cast<Span_req*> (r))
{
String t = ly_scm2string (s->get_mus_property ("span-type"));
if (t == "crescendo" || t == "decrescendo")
{
- span_req_l_drul_[s->get_span_dir()] = s;
+ span_req_l_drul_[s->get_span_dir ()] = s;
return true;
}
}
if (!parent->spanned_rank_iv ().contains_b (this->spanned_rank_iv ()))
{
programming_error (to_str ("Spanner `%s' is not fully contained in parent spanner `%s'.",
- name().ch_C(),
+ name ().ch_C (),
parent->name ().ch_C ()));
}
}
if (line_l () || broken_b ())
return;
- if (left == right)
+ if (left == right)
{
/*
If we have a spanner spanning one column, we must break it
programming_error ("no broken bound");
else if (bound->line_l ())
{
- Spanner * span_p = dynamic_cast<Spanner*>( clone ());
+ Spanner * span_p = dynamic_cast<Spanner*> (clone ());
span_p->set_bound (LEFT, bound);
span_p->set_bound (RIGHT, bound);
broken_into_l_arr_.push (span_p);
}
}
- while ((flip(&d))!= LEFT);
+ while ((flip (&d))!= LEFT);
}
else
{
break_points.insert (left,0);
break_points.push (right);
- for (int i=1; i < break_points.size(); i++)
+ for (int i=1; i < break_points.size (); i++)
{
Drul_array<Item*> bounds;
bounds[LEFT] = break_points[i-1];
Direction d = LEFT;
do
{
- if (!bounds[d]->line_l())
- bounds[d] = bounds[d]->find_prebroken_piece(- d);
+ if (!bounds[d]->line_l ())
+ bounds[d] = bounds[d]->find_prebroken_piece (- d);
}
- while ((flip(&d))!= LEFT);
+ while ((flip (&d))!= LEFT);
if (!bounds[LEFT] || ! bounds[RIGHT])
{
continue;
}
- Spanner *span_p = dynamic_cast<Spanner*>(clone ());
- span_p->set_bound(LEFT,bounds[LEFT]);
- span_p->set_bound(RIGHT,bounds[RIGHT]);
+ Spanner *span_p = dynamic_cast<Spanner*> (clone ());
+ span_p->set_bound (LEFT,bounds[LEFT]);
+ span_p->set_bound (RIGHT,bounds[RIGHT]);
if (!bounds[LEFT]->line_l ()
}
void
-Spanner::set_my_columns()
+Spanner::set_my_columns ()
{
Direction i = (Direction) LEFT;
do
{
- if (!spanned_drul_[i]->line_l())
- set_bound(i,spanned_drul_[i]->find_prebroken_piece((Direction) -i));
+ if (!spanned_drul_[i]->line_l ())
+ set_bound (i,spanned_drul_[i]->find_prebroken_piece ((Direction) -i));
}
- while (flip(&i) != LEFT);
+ while (flip (&i) != LEFT);
}
Interval_t<int>
X-axis parent of THIS to S.
*/
void
-Spanner::set_bound(Direction d, Grob*s)
+Spanner::set_bound (Direction d, Grob*s)
{
Item * i = dynamic_cast<Item*> (s);
if (!i)
}
Real
-Spanner::spanner_length() const
+Spanner::spanner_length () const
{
Real l = spanned_drul_[LEFT]->relative_coordinate (0, X_AXIS);
Real r = spanned_drul_[RIGHT]->relative_coordinate (0, X_AXIS);
}
Line_of_score *
-Spanner::line_l() const
+Spanner::line_l () const
{
if (!spanned_drul_[LEFT] || !spanned_drul_[RIGHT])
return 0;
if (spanned_drul_[LEFT]->line_l () != spanned_drul_[RIGHT]->line_l ())
return 0;
- return spanned_drul_[LEFT]->line_l();
+ return spanned_drul_[LEFT]->line_l ();
}
Grob*
Spanner::find_broken_piece (Line_of_score*l) const
{
- int idx = binsearch_link_array (broken_into_l_arr_, (Spanner*)l, Spanner::compare);
+ int idx = binsearch_link_array (broken_into_l_arr_, (Spanner*)l, Spanner::compare);
if (idx < 0)
return 0;
}
bool
-Spanner::broken_b() const
+Spanner::broken_b () const
{
- return broken_into_l_arr_.size();
+ return broken_into_l_arr_.size ();
}
Real
Spanner::get_broken_left_end_align () const
{
- Paper_column *sc = dynamic_cast<Paper_column*> (spanned_drul_[LEFT]->column_l());
+ Paper_column *sc = dynamic_cast<Paper_column*> (spanned_drul_[LEFT]->column_l ());
// Relevant only if left span point is first column in line
- if(sc != NULL &&
+ if (sc != NULL &&
sc->break_status_dir () == RIGHT)
{
/*
}
else if (unsmob_grob (value))
{
- if (Spanner * sp = dynamic_cast<Spanner*> (unsmob_grob(value)))
+ if (Spanner * sp = dynamic_cast<Spanner*> (unsmob_grob (value)))
{
extend_spanner_over_item (sp->get_bound (LEFT), extremal_pair);
extend_spanner_over_item (sp->get_bound (RIGHT), extremal_pair);
}
- else if (Item * it= dynamic_cast<Item*> (unsmob_grob(value)))
+ else if (Item * it= dynamic_cast<Item*> (unsmob_grob (value)))
extend_spanner_over_item (it, extremal_pair);
}
}
#include "performer-group-performer.hh"
/** Perform a staff. Individual notes should have their instrument
- (staff-wide) set, so we override play_element()
+ (staff-wide) set, so we override play_element ()
*/
class Staff_performer : public Performer_group_performer
{
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Staff_performer ();
// mustn't ask Score for instrument: it will return piano!
SCM minstr = get_property (ly_symbol2scm ("midiInstrument"));
- if (!gh_string_p(minstr))
+ if (!gh_string_p (minstr))
minstr = get_property (ly_symbol2scm ("instrument"));
if (!gh_string_p (minstr)
class Staff_symbol_engraver : public Engraver {
Spanner *span_p_;
public:
- VIRTUAL_COPY_CONS(Translator);
- Staff_symbol_engraver();
+ VIRTUAL_COPY_CONS (Translator);
+ Staff_symbol_engraver ();
protected:
- virtual ~Staff_symbol_engraver();
+ virtual ~Staff_symbol_engraver ();
virtual void acknowledge_grob (Grob_info);
- virtual void finalize();
- virtual void initialize();
+ virtual void finalize ();
+ virtual void initialize ();
};
-Staff_symbol_engraver::~Staff_symbol_engraver()
+Staff_symbol_engraver::~Staff_symbol_engraver ()
{
assert (!span_p_);
}
-Staff_symbol_engraver::Staff_symbol_engraver()
+Staff_symbol_engraver::Staff_symbol_engraver ()
{
span_p_ = 0;
}
void
-Staff_symbol_engraver::initialize()
+Staff_symbol_engraver::initialize ()
{
span_p_ = new Spanner (get_property ("StaffSymbol"));
- span_p_->set_bound(LEFT, unsmob_grob (get_property ("currentCommandColumn")));
+ span_p_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
announce_grob (span_p_, 0);
}
void
-Staff_symbol_engraver::finalize()
+Staff_symbol_engraver::finalize ()
{
- span_p_->set_bound(RIGHT,unsmob_grob (get_property ("currentCommandColumn")));
+ span_p_->set_bound (RIGHT,unsmob_grob (get_property ("currentCommandColumn")));
typeset_grob (span_p_);
span_p_ =0;
}
}
-ADD_THIS_TRANSLATOR(Staff_symbol_engraver);
+ADD_THIS_TRANSLATOR (Staff_symbol_engraver);
Staff_symbol_referencer::staff_symbol_l (Grob*me)
{
SCM st = me->get_grob_property ("staff-symbol");
- return unsmob_grob(st);
+ return unsmob_grob (st);
}
Real
/*
should use offset callback!
*/
-MAKE_SCHEME_CALLBACK(Staff_symbol_referencer,callback,2);
+MAKE_SCHEME_CALLBACK (Staff_symbol_referencer,callback,2);
SCM
-Staff_symbol_referencer::callback (SCM element_smob, SCM )
+Staff_symbol_referencer::callback (SCM element_smob, SCM)
{
Grob *me = unsmob_grob (element_smob);
Staff_symbol_referencer::set_position (Grob*me,Real p)
{
Grob * st = staff_symbol_l (me);
- if (st && me->common_refpoint(st, Y_AXIS))
+ if (st && me->common_refpoint (st, Y_AXIS))
{
Real oldpos = position_f (me);
me->set_grob_property ("staff-position", gh_double2scm (p - oldpos));
Real
Staff_symbol_referencer::staff_radius (Grob*me)
{
- return (line_count (me) -1) / 2;
+ return (line_count (me) -1) / 2;
}
int
compare_position (Grob *const &a, Grob * const &b)
{
- return sign (Staff_symbol_referencer::position_f((Grob*)a) -
- Staff_symbol_referencer::position_f((Grob*)b));
+ return sign (Staff_symbol_referencer::position_f ((Grob*)a) -
+ Staff_symbol_referencer::position_f ((Grob*)b));
}
-MAKE_SCHEME_CALLBACK(Staff_symbol,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Staff_symbol,brew_molecule,1);
SCM
Staff_symbol::brew_molecule (SCM smob)
}
int
-Staff_symbol::steps_i(Grob*me)
+Staff_symbol::steps_i (Grob*me)
{
return line_count (me) * 2;
}
}
Real
-Staff_symbol::staff_space (Grob*me )
+Staff_symbol::staff_space (Grob*me)
{
Real ss = 1.0;
void create_text (SCM s);
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Stanza_number_engraver ();
virtual void acknowledge_grob (Grob_info);
virtual void stop_translation_timestep ();
};
-ADD_THIS_TRANSLATOR(Stanza_number_engraver);
+ADD_THIS_TRANSLATOR (Stanza_number_engraver);
Stanza_number_engraver::Stanza_number_engraver ()
{
}
void
-Stanza_number_engraver::acknowledge_grob(Grob_info i)
+Stanza_number_engraver::acknowledge_grob (Grob_info i)
{
SCM s = get_property ("stanza");
{
// if (i.elem_l_->has_interface (symbol ("lyric-syllable-interface")))
// Tried catching lyric items to generate stanza numbers, but it spoils lyric spacing.
- if (Bar::has_interface (i.elem_l_) || now_mom() == Moment(0))
+ if (Bar::has_interface (i.elem_l_) || now_mom () == Moment (0))
// Works, but requires bar_engraver in LyricsVoice context apart from at beginning.
// Is there any score element we can catch that will do the trick?
// if (! i.elem_l_->has_interface (symbol ("lyric-syllable-interface")) ||
-// now_mom() == Moment(0))
+// now_mom () == Moment (0))
// What happens if we try anything at all EXCEPT a lyric? Is there anything else?
// Not sure what it's catching, but it still mucks up lyrics.
create_text (s);
void
Stanza_number_engraver::create_text (SCM txt)
{
- if(!text_)
+ if (!text_)
{
text_ = new Item (get_property ("StanzaNumber"));
text_->set_grob_property ("text", txt);
public:
VIRTUAL_COPY_CONS (Translator);
- Stem_engraver();
+ Stem_engraver ();
protected:
virtual void acknowledge_grob (Grob_info);
void
-Stem_engraver::acknowledge_grob(Grob_info i)
+Stem_engraver::acknowledge_grob (Grob_info i)
{
Grob* h = i.elem_l_;
if (Rhythmic_head::has_interface (h))
{
stem_p_ = new Item (get_property ("Stem"));
Stem::set_interface (stem_p_);
- Staff_symbol_referencer::set_interface(stem_p_);
+ Staff_symbol_referencer::set_interface (stem_p_);
stem_p_->set_grob_property ("duration-log", gh_int2scm (duration_log));
}
void
-Stem_engraver::stop_translation_timestep()
+Stem_engraver::stop_translation_timestep ()
{
if (tremolo_p_)
{
if (stem_p_)
{
SCM prop = get_property ("stemLeftBeamCount");
- if (gh_number_p(prop))
+ if (gh_number_p (prop))
{
Stem::set_beaming (stem_p_,gh_scm2int (prop),LEFT);
daddy_trans_l_->set_property ("stemLeftBeamCount", SCM_UNDEFINED);
}
prop = get_property ("stemRightBeamCount");
- if (gh_number_p(prop))
+ if (gh_number_p (prop))
{
Stem::set_beaming (stem_p_,gh_scm2int (prop), RIGHT);
daddy_trans_l_->set_property ("stemRightBeamCount", SCM_UNDEFINED);
to forced), if we have a Chord_tremolo.
*/
SCM dir = stem_p_->get_grob_property ("direction");
- if (gh_number_p (dir) && to_dir(dir))
+ if (gh_number_p (dir) && to_dir (dir))
{
stem_p_->set_grob_property ("dir-forced", SCM_BOOL_T);
}
- typeset_grob(stem_p_);
+ typeset_grob (stem_p_);
stem_p_ = 0;
}
return me->has_interface (ly_symbol2scm ("stem-tremolo"));
}
-MAKE_SCHEME_CALLBACK(Stem_tremolo,dim_callback,2);
+MAKE_SCHEME_CALLBACK (Stem_tremolo,dim_callback,2);
/*
todo: init with cons.
*/
SCM
-Stem_tremolo::dim_callback (SCM e, SCM )
+Stem_tremolo::dim_callback (SCM e, SCM)
{
Grob * se = unsmob_grob (e);
Real space = Staff_symbol_referencer::staff_space (se);
- return ly_interval2scm ( Interval (-space, space));
+ return ly_interval2scm (Interval (-space, space));
}
/*
{
Axis a = (Axis)gh_scm2int (ax);
Grob * me = unsmob_grob (smob);
- assert ( a == Y_AXIS);
+ assert (a == Y_AXIS);
SCM mol = me->get_uncached_molecule ();
return ly_interval2scm (unsmob_molecule (mol)->extent (a));
}
-MAKE_SCHEME_CALLBACK(Stem_tremolo,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Stem_tremolo,brew_molecule,1);
SCM
Stem_tremolo::brew_molecule (SCM smob)
{
if (beam)
{
// ugh, rather calc from Stem_tremolo_req
- int beams_i = Stem::beam_count(stem, RIGHT) >? Stem::beam_count (stem, LEFT);
- mol.translate (Offset(stem->relative_coordinate (0, X_AXIS) - me->relative_coordinate (0, X_AXIS),
- Stem::stem_end_position (stem ) * ss / 2 -
+ int beams_i = Stem::beam_count (stem, RIGHT) >? Stem::beam_count (stem, LEFT);
+ mol.translate (Offset (stem->relative_coordinate (0, X_AXIS) - me->relative_coordinate (0, X_AXIS),
+ Stem::stem_end_position (stem) * ss / 2 -
Directional_element_interface::get (beam) * beams_i * interbeam_f));
}
else
/*
Beams should intersect one beamthickness below stem end
*/
- Real dy = Stem::stem_end_position (stem ) * ss / 2;
- dy -= mol.extent (Y_AXIS).length () / 2 * Stem::get_direction (stem );
+ Real dy = Stem::stem_end_position (stem) * ss / 2;
+ dy -= mol.extent (Y_AXIS).length () / 2 * Stem::get_direction (stem);
/*
uhg. Should use relative coords and placement
*/
Real whole_note_correction;
- if (Stem::invisible_b (stem ))
+ if (Stem::invisible_b (stem))
{
- Grob *hed = Stem::support_head (stem );
- whole_note_correction = -Stem::get_direction (stem )
+ Grob *hed = Stem::support_head (stem);
+ whole_note_correction = -Stem::get_direction (stem)
*hed->extent (hed, X_AXIS).length () / 2;
}
else
void
-Stem::set_beaming (Grob*me ,int i, Direction d )
+Stem::set_beaming (Grob*me ,int i, Direction d)
{
SCM pair = me->get_grob_property ("beaming");
Drul_array<Grob*> e (extremal_heads (me));
return Interval (Staff_symbol_referencer::position_f (e[DOWN]),
- Staff_symbol_referencer::position_f ( e[UP]));
+ Staff_symbol_referencer::position_f (e[UP]));
}
Real
Stem::chord_start_f (Grob*me)
{
- return head_positions(me)[get_direction (me)]
+ return head_positions (me)[get_direction (me)]
* Staff_symbol_referencer::staff_space (me)/2.0;
}
// todo: margins
Direction d= get_direction (me);
- if (d && d * head_positions(me)[get_direction (me)] >= se*d)
+ if (d && d * head_positions (me)[get_direction (me)] >= se*d)
warning (_ ("Weird stem size; check for narrow beams"));
me->set_grob_property ("stem-end-position", gh_double2scm (se));
Grob * n = unsmob_grob (gh_car (s));
- int p = int(Staff_symbol_referencer::position_f (n));
+ int p = int (Staff_symbol_referencer::position_f (n));
Direction d = LEFT;
do {
bool
Stem::invisible_b (Grob*me)
{
- return !(heads_i (me) && Rhythmic_head::balltype_i (support_head (me)) >= 1);
+ return ! (heads_i (me) && Rhythmic_head::balltype_i (support_head (me)) >= 1);
}
int
Stem::get_center_distance (Grob*me, Direction d)
{
int staff_center = 0;
- int distance = (int) (d*(head_positions(me)[d] - staff_center));
+ int distance = (int) (d* (head_positions (me)[d] - staff_center));
return distance >? 0;
}
Array<Real> a;
Real length_f = 0.;
- SCM scm_len = me->get_grob_property("length");
+ SCM scm_len = me->get_grob_property ("length");
if (gh_number_p (scm_len))
{
length_f = gh_scm2double (scm_len);
}
else
{
- s = me->get_grob_property("lengths");
+ s = me->get_grob_property ("lengths");
for (SCM q = s; q != SCM_EOL; q = gh_cdr (q))
a.push (gh_scm2double (gh_car (q)));
// stem uses half-spaces
- length_f = a[((flag_i (me) - 2) >? 0) <? (a.size () - 1)] * 2;
+ length_f = a[ ((flag_i (me) - 2) >? 0) <? (a.size () - 1)] * 2;
}
// stem uses half-spaces
// fixme: use gh_list_ref () iso. array[]
- Real shorten_f = a[((flag_i (me) - 2) >? 0) <? (a.size () - 1)] * 2;
+ Real shorten_f = a[ ((flag_i (me) - 2) >? 0) <? (a.size () - 1)] * 2;
/* URGURGURG
'set-default-stemlen' sets direction too
stems in unnatural (forced) direction should be shortened,
according to [Roush & Gourlay]
*/
- if (((int)chord_start_f (me))
+ if (( (int)chord_start_f (me))
&& (get_direction (me) != get_default_dir (me)))
length_f -= shorten_f;
- Real st = head_positions(me)[dir] + dir * length_f;
+ Real st = head_positions (me)[dir] + dir * length_f;
bool no_extend_b = to_boolean (me->get_grob_property ("no-stem-extend"));
if (!grace_b && !no_extend_b && dir * st < 0) // junkme?
Stem::flag_i (Grob*me)
{
SCM s = me->get_grob_property ("duration-log");
- return (gh_number_p (s)) ? gh_scm2int (s) : 2;
+ return (gh_number_p (s)) ? gh_scm2int (s) : 2;
}
void
}
}
-MAKE_SCHEME_CALLBACK(Stem,before_line_breaking,1);
+MAKE_SCHEME_CALLBACK (Stem,before_line_breaking,1);
SCM
Stem::before_line_breaking (SCM smob)
{
if (invisible_b (me))
{
me->remove_grob_property ("molecule-callback");
- // suicide();
+ // suicide ();
}
set_spacing_hints (me);
{
Axis a = (Axis)gh_scm2int (ax);
Grob * me = unsmob_grob (smob);
- assert ( a == Y_AXIS);
+ assert (a == Y_AXIS);
SCM mol = me->get_uncached_molecule ();
Interval iv;
{
String style;
SCM st = me->get_grob_property ("flag-style");
- if ( gh_string_p (st))
+ if (gh_string_p (st))
{
style = ly_scm2string (st);
}
Molecule m = Font_interface::get_default_font (me)->find_by_name (String ("flags-") + to_str (c) +
to_str (flag_i (me)));
if (!style.empty_b ())
- m.add_molecule(Font_interface::get_default_font (me)->find_by_name (String ("flags-") + to_str (c) + style));
+ m.add_molecule (Font_interface::get_default_font (me)->find_by_name (String ("flags-") + to_str (c) + style));
return m;
}
-MAKE_SCHEME_CALLBACK(Stem,dim_callback,2);
+MAKE_SCHEME_CALLBACK (Stem,dim_callback,2);
SCM
Stem::dim_callback (SCM e, SCM ax)
{
{
r = flag (se).extent (X_AXIS);
}
- return ly_interval2scm ( r);
+ return ly_interval2scm (r);
}
-MAKE_SCHEME_CALLBACK(Stem,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Stem,brew_molecule,1);
SCM
Stem::brew_molecule (SCM smob)
Real y1 = Staff_symbol_referencer::position_f (first_head (me));
Real y2 = stem_end_position (me);
- Interval stem_y(y1,y2);
+ Interval stem_y (y1,y2);
stem_y.unite (Interval (y2,y1));
Real dy = Staff_symbol_referencer::staff_space (me)/2.0;
angle = gh_scm2double (hed->get_grob_property ("attachment-angle"));
}
- stem_y[Direction(-d)] += d * head_wid * tan(angle)/(2*dy);
+ stem_y[Direction (-d)] += d * head_wid * tan (angle)/ (2*dy);
if (!invisible_b (me))
{
if (!beam_l (me) && abs (flag_i (me)) > 2)
{
Molecule fl = flag (me);
- fl.translate_axis(stem_y[d]*dy, Y_AXIS);
+ fl.translate_axis (stem_y[d]*dy, Y_AXIS);
mol.add_molecule (fl);
}
/*
move the stem to right of the notehead if it is up.
*/
-MAKE_SCHEME_CALLBACK(Stem,off_callback,2);
+MAKE_SCHEME_CALLBACK (Stem,off_callback,2);
SCM
-Stem::off_callback (SCM element_smob, SCM )
+Stem::off_callback (SCM element_smob, SCM)
{
Grob *me = unsmob_grob (element_smob);
Real r=0;
if (Grob * f = first_head (me))
{
- Interval head_wid(0, f->extent (f,X_AXIS).length ());
+ Interval head_wid (0, f->extent (f,X_AXIS).length ());
if (to_boolean (me->get_grob_property ("stem-centered")))
- return gh_double2scm ( head_wid.center ());
+ return gh_double2scm (head_wid.center ());
Real rule_thick = gh_scm2double (me->get_grob_property ("thickness")) * me->paper_l ()->get_var ("stafflinethickness");
Direction d = get_direction (me);
Array<Real> a;
SCM s;
- s = me->get_grob_property("beamed-minimum-lengths");
+ s = me->get_grob_property ("beamed-minimum-lengths");
a.clear ();
for (SCM q = s; q != SCM_EOL; q = gh_cdr (q))
a.push (gh_scm2double (gh_car (q)));
Real minimum_length = a[multiplicity <? (a.size () - 1)] * staff_space;
s = me->get_grob_property ("beamed-lengths");
- a.clear();
+ a.clear ();
for (SCM q = s; q != SCM_EOL; q = gh_cdr (q))
a.push (gh_scm2double (gh_car (q)));
Grob *common = me->common_refpoint (beam, Y_AXIS);
Real interstaff_f = beam_dir *
- (me->relative_coordinate (common, Y_AXIS)
+ (me->relative_coordinate (common, Y_AXIS)
- beam->relative_coordinate (common, Y_AXIS));
info.idealy_f_ += interstaff_f;
struct Sustain_pedal
{
public:
- DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM));
+ DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
};
-MAKE_SCHEME_CALLBACK(Sustain_pedal,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Sustain_pedal,brew_molecule,1);
SCM
Sustain_pedal::brew_molecule (SCM smob)
{
-ADD_THIS_TRANSLATOR(Swallow_performer);
+ADD_THIS_TRANSLATOR (Swallow_performer);
member of the Lyric_phrasing_engraver class.
*/
-Syllable_group::Syllable_group()
+Syllable_group::Syllable_group ()
{
first_in_phrase_b_=true;
melisma_b_ = false;
- clear();
+ clear ();
}
void
-Syllable_group::clear()
+Syllable_group::clear ()
{
notehead_l_=0;
- lyric_list_.clear();
+ lyric_list_.clear ();
longest_lyric_l_=0;
shortest_lyric_l_=0;
melisma_b_ = false;
}
void
-Syllable_group::copy( Syllable_group *from)
+Syllable_group::copy (Syllable_group *from)
{
notehead_l_ = from->notehead_l_;
lyric_list_ = from->lyric_list_;
}
void
-Syllable_group::set_first_in_phrase(bool f)
+Syllable_group::set_first_in_phrase (bool f)
{
first_in_phrase_b_ = f;
}
void
-Syllable_group::set_notehead(Grob * notehead)
+Syllable_group::set_notehead (Grob * notehead)
{
- if(!notehead_l_) {
+ if (!notehead_l_) {
/* there should only be a single notehead, so silently ignore any extras */
notehead_l_=notehead;
}
}
void
-Syllable_group::add_lyric(Grob * lyric)
+Syllable_group::add_lyric (Grob * lyric)
{
- lyric_list_.push(lyric);
+ lyric_list_.push (lyric);
/* record longest and shortest lyrics */
- if( longest_lyric_l_ ) {
- if(lyric->extent(lyric,X_AXIS).length() > (longest_lyric_l_->extent(longest_lyric_l_, X_AXIS)).length())
+ if (longest_lyric_l_) {
+ if (lyric->extent (lyric,X_AXIS).length () > (longest_lyric_l_->extent (longest_lyric_l_, X_AXIS)).length ())
longest_lyric_l_ = lyric;
- if(lyric->extent(lyric, X_AXIS).length() < (shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS)).length())
+ if (lyric->extent (lyric, X_AXIS).length () < (shortest_lyric_l_->extent (shortest_lyric_l_, X_AXIS)).length ())
shortest_lyric_l_ = lyric;
}
else
}
void
-Syllable_group::add_extender(Grob * extender)
+Syllable_group::add_extender (Grob * extender)
{
- if(notehead_l_ && melisma_b_) {
- dynamic_cast<Spanner*>(extender)->set_bound (RIGHT, notehead_l_);
+ if (notehead_l_ && melisma_b_) {
+ dynamic_cast<Spanner*> (extender)->set_bound (RIGHT, notehead_l_);
// should the extender finish at the right of the last note of the melisma, or the left?
// Comments in lyric-extender.hh say left, but right looks better to me. GP.
// Left:
-// extender->set_grob_property("right-trim-amount", gh_double2scm(0.0));
+// extender->set_grob_property ("right-trim-amount", gh_double2scm (0.0));
// Right:
Real ss = 1.0;
- extender->set_grob_property("right-trim-amount",
- gh_double2scm(-notehead_l_->extent(notehead_l_, X_AXIS).length()/ss));
+ extender->set_grob_property ("right-trim-amount",
+ gh_double2scm (-notehead_l_->extent (notehead_l_, X_AXIS).length ()/ss));
}
}
bool
-Syllable_group::set_lyric_align(const char *punc, Grob *default_notehead_l)
+Syllable_group::set_lyric_align (const char *punc, Grob *default_notehead_l)
{
- if(lyric_list_.size()==0) {
+ if (lyric_list_.size ()==0) {
// No lyrics: nothing to do.
return true;
}
Grob * lyric;
- alignment_i_ = appropriate_alignment(punc);
+ alignment_i_ = appropriate_alignment (punc);
// If there was no notehead in the matching voice context, use the first
// notehead caught from any voice context (any port in a storm).
- if(!notehead_l_) {
+ if (!notehead_l_) {
notehead_l_ = default_notehead_l;
}
- group_translation_f_ = amount_to_translate();
+ group_translation_f_ = amount_to_translate ();
// set the x alignment of each lyric
- for(int l = 0; l < lyric_list_.size(); l++) {
+ for (int l = 0; l < lyric_list_.size (); l++) {
lyric = lyric_list_[l];
- lyric->set_grob_property("self-alignment-X", gh_int2scm(alignment_i_));
+ lyric->set_grob_property ("self-alignment-X", gh_int2scm (alignment_i_));
// centre on notehead ... if we have one.
- if(notehead_l_) {
- lyric->set_parent(notehead_l_, X_AXIS);
+ if (notehead_l_) {
+ lyric->set_parent (notehead_l_, X_AXIS);
lyric->add_offset_callback (Side_position_interface::centered_on_parent_proc, X_AXIS);
// reference is on the right of the notehead; move it left half way, and add translation
- lyric->translate_axis (group_translation_f_-(notehead_l_->extent(notehead_l_, X_AXIS)).center(), X_AXIS);
+ lyric->translate_axis (group_translation_f_- (notehead_l_->extent (notehead_l_, X_AXIS)).center (), X_AXIS);
}
}
return (notehead_l_);
- move so shortest lyric just reaches notehead centre
*/
Real
-Syllable_group::amount_to_translate()
+Syllable_group::amount_to_translate ()
{
Real translate = 0.0;
- if(alignment_i_ != CENTER) {
+ if (alignment_i_ != CENTER) {
// FIXME: do we really know the lyric extent here? Some font sizing comes later?
- Real l1 = longest_lyric_l_->extent(longest_lyric_l_, X_AXIS).length() / 2;
- Real l2 = shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS).length();
+ Real l1 = longest_lyric_l_->extent (longest_lyric_l_, X_AXIS).length () / 2;
+ Real l2 = shortest_lyric_l_->extent (shortest_lyric_l_, X_AXIS).length ();
translate = l1 <? l2;
translate *= alignment_i_ ;
otherwise alignment is centre.
*/
int
-Syllable_group::appropriate_alignment(const char *punc)
+Syllable_group::appropriate_alignment (const char *punc)
{
- if(first_in_phrase_b_)
+ if (first_in_phrase_b_)
return LEFT;
Grob * lyric;
bool end_phrase = true;
- for(int l = 0; l < lyric_list_.size() && end_phrase; l++) {
+ for (int l = 0; l < lyric_list_.size () && end_phrase; l++) {
lyric = lyric_list_[l];
- SCM lyric_scm = lyric->get_grob_property("text");
- String lyric_str = gh_string_p(lyric_scm)?ly_scm2string(lyric_scm):"";
+ SCM lyric_scm = lyric->get_grob_property ("text");
+ String lyric_str = gh_string_p (lyric_scm)?ly_scm2string (lyric_scm):"";
char lastchar;
- if(lyric_str.length_i()>0) {
- lastchar = lyric_str[lyric_str.length_i()-1];
+ if (lyric_str.length_i ()>0) {
+ lastchar = lyric_str[lyric_str.length_i ()-1];
/* If it doesn't end in punctuation then it ain't an end of phrase */
- if(! strchr(punc, lastchar)) {
+ if (! strchr (punc, lastchar)) {
/* Special case: trailing space. Here examine the previous character and reverse the
sense of the test (i.e. trailing space makes a break without punctuation, or
suppresses a break with punctuation).
FIXME: The extra space throws alignment out a bit.
*/
- if(lastchar == ' ') {
- if(lyric_str.length_i()>1) {
- lastchar = lyric_str[lyric_str.length_i()-2];
- if(strchr(punc, lastchar))
+ if (lastchar == ' ') {
+ if (lyric_str.length_i ()>1) {
+ lastchar = lyric_str[lyric_str.length_i ()-2];
+ if (strchr (punc, lastchar))
end_phrase=false;
}
}
}
}
}
- if(end_phrase)
+ if (end_phrase)
return RIGHT;
return CENTER;
back and fix the alignment when we DO know.
*/
void
-Syllable_group::adjust_melisma_align()
+Syllable_group::adjust_melisma_align ()
{
- if(notehead_l_ && lyric_list_.size()) {
+ if (notehead_l_ && lyric_list_.size ()) {
// override any previous offset adjustments
Real translation = -group_translation_f_;
// melisma aligning:
switch (alignment_i_) {
// case LEFT: // that's all
case CENTER: // move right so smallest lyric is left-aligned on notehead
- translation += (shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS)).length()/2;
+ translation += (shortest_lyric_l_->extent (shortest_lyric_l_, X_AXIS)).length ()/2;
break;
case RIGHT: // move right so smallest lyric is left-aligned on notehead
- translation += (shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS)).length();
+ translation += (shortest_lyric_l_->extent (shortest_lyric_l_, X_AXIS)).length ();
break;
}
group_translation_f_ += translation;
- for(int l = 0; l < lyric_list_.size(); l++) {
+ for (int l = 0; l < lyric_list_.size (); l++) {
lyric_list_[l]->translate_axis (translation, X_AXIS);
}
}
bool
-Syllable_group::is_empty()
+Syllable_group::is_empty ()
{
- return lyric_list_.size()==0;
+ return lyric_list_.size ()==0;
}
void
-Syllable_group::next_lyric()
+Syllable_group::next_lyric ()
{
first_in_phrase_b_ = (alignment_i_ == RIGHT);
- clear();
+ clear ();
}
/* SMOB */
}
int
-Syllable_group::print_smob (SCM, SCM port, scm_print_state * )
+Syllable_group::print_smob (SCM, SCM port, scm_print_state *)
{
scm_puts ("#<Syllable_group>", port);
return 1;
}
-IMPLEMENT_UNSMOB(Syllable_group, voice_entry);
-IMPLEMENT_SIMPLE_SMOBS(Syllable_group);
-IMPLEMENT_DEFAULT_EQUAL_P(Syllable_group);
+IMPLEMENT_UNSMOB (Syllable_group, voice_entry);
+IMPLEMENT_SIMPLE_SMOBS (Syllable_group);
+IMPLEMENT_DEFAULT_EQUAL_P (Syllable_group);
SCM
Syllable_group::make_entry ()
/*
symbol-cache.cc -- implement a cache for literal symbols, eg
- symbol("foo-bar")
+ symbol ("foo-bar")
source file of the GNU LilyPond music typesetter
symbol (const char*s)
{
Literal_symbol_map::const_iterator i = literal_map.find (s);
- if (i != literal_map.end())
+ if (i != literal_map.end ())
return (*i).second;
SCM sym = gh_symbol2scm ((char*)s);
This is a gory trick to cache the value gh_symbol2scm (), without
cluttering up the C code with snarf macros.
- You should *ONLY* use symbol() for arguments that are literal
+ You should *ONLY* use symbol () for arguments that are literal
strings!
without (wtk1-fugue2)
class System_start_delimiter_engraver : public Engraver
{
public:
- VIRTUAL_COPY_CONS(Translator);
- System_start_delimiter_engraver();
+ VIRTUAL_COPY_CONS (Translator);
+ System_start_delimiter_engraver ();
protected:
Spanner * delim_;
virtual void finalize ();
};
-ADD_THIS_TRANSLATOR(System_start_delimiter_engraver);
+ADD_THIS_TRANSLATOR (System_start_delimiter_engraver);
void
System_start_delimiter_engraver::acknowledge_grob (Grob_info inf)
if (Staff_symbol::has_interface (inf.elem_l_))
{
/*
- don't add as Axis_group_interface::add_element (delim_, ),
+ don't add as Axis_group_interface::add_element (delim_,),
because that would set the parent as well */
Pointer_group_interface::add_element (delim_, "elements", inf.elem_l_);
*/
if (gh_symbol_p (gl) && gl == ly_symbol2scm ("brace")
&& gh_symbol_p (my_gl) && my_gl == ly_symbol2scm ("bracket"))
- inf.elem_l_->translate_axis ( -1.0, X_AXIS); // ugh
+ inf.elem_l_->translate_axis (-1.0, X_AXIS); // ugh
}
}
-System_start_delimiter_engraver::System_start_delimiter_engraver()
+System_start_delimiter_engraver::System_start_delimiter_engraver ()
{
delim_ = 0;
}
void
-System_start_delimiter_engraver::initialize()
+System_start_delimiter_engraver::initialize ()
{
delim_ = new Spanner (get_property ("SystemStartDelimiter"));
Molecule
System_start_delimiter::staff_bracket (Grob*me,Real height)
{
- Real arc_height = gh_scm2double (me->get_grob_property("arch-height")) ;
+ Real arc_height = gh_scm2double (me->get_grob_property ("arch-height")) ;
SCM at = gh_list (ly_symbol2scm ("bracket"),
me->get_grob_property ("arch-angle"),
{
Real w = me->paper_l ()->get_var ("stafflinethickness") *
gh_scm2double (me->get_grob_property ("thickness"));
- return Lookup::filledbox (Box (Interval(0,w), Interval(-h/2, h/2)));
+ return Lookup::filledbox (Box (Interval (0,w), Interval (-h/2, h/2)));
}
-MAKE_SCHEME_CALLBACK(System_start_delimiter,after_line_breaking,1);
+MAKE_SCHEME_CALLBACK (System_start_delimiter,after_line_breaking,1);
SCM
System_start_delimiter::after_line_breaking (SCM smob)
}
-MAKE_SCHEME_CALLBACK(System_start_delimiter,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (System_start_delimiter,brew_molecule,1);
SCM
System_start_delimiter::brew_molecule (SCM smob)
Real staff_space = Staff_symbol_referencer::staff_space (me);
Interval ext = ly_scm2interval (Axis_group_interface::group_extent_callback
- (me->self_scm(), gh_int2scm (Y_AXIS)));
+ (me->self_scm (), gh_int2scm (Y_AXIS)));
Real l = ext.length () / staff_space;
if (ext.empty_b ()
|| (gh_number_p (c) && l <= gh_scm2double (c)))
{
- me->suicide();
+ me->suicide ();
return SCM_EOL;
}
int cmp = (lo + hi) / 2;
b = fm->get_char (cmp);
- if (b[Y_AXIS].empty_b () || b[Y_AXIS].length () > y )
+ if (b[Y_AXIS].empty_b () || b[Y_AXIS].length () > y)
hi = cmp;
else
lo = cmp;
b = fm->get_char (lo);
b[X_AXIS] = Interval (0,0);
- return Molecule(b, at);
+ return Molecule (b, at);
}
#include "compare.hh"
Rational
-Interval_t<Rational>::infinity()
+Interval_t<Rational>::infinity ()
{
Rational infty;
infty.set_infinite (1);
-template INTERVAL__INSTANTIATE(Rational);
+template INTERVAL__INSTANTIATE (Rational);
class Tempo_performer : public Performer
{
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
- Tempo_performer();
- ~Tempo_performer();
+ Tempo_performer ();
+ ~Tempo_performer ();
protected:
audio_p_ = new Audio_tempo (d->length_mom () /
Moment (1, 4)
- * Moment(gh_scm2int (met)));
+ * Moment (gh_scm2int (met)));
Audio_element_info info (audio_p_, tempo_req_l_);
announce_element (info);
Link_array<Text_script_req> reqs_;
Link_array<Item> texts_;
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
protected:
virtual bool try_music (Music* m);
virtual void stop_translation_timestep ();
/*
ugh.
*/
- if (Side_position_interface::get_axis( t) == X_AXIS
+ if (Side_position_interface::get_axis (t) == X_AXIS
&& !t->parent_l (Y_AXIS))
t->set_parent (inf.elem_l_, Y_AXIS);
- else if (Side_position_interface::get_axis(t) == Y_AXIS
+ else if (Side_position_interface::get_axis (t) == Y_AXIS
&& !t->parent_l (X_AXIS))
t->set_parent (inf.elem_l_, X_AXIS);
}
{
for (int i=0; i < texts_.size (); i++)
{
- Side_position_interface::add_support(texts_[i],inf.elem_l_);
+ Side_position_interface::add_support (texts_[i],inf.elem_l_);
}
}
}
reqs_.clear ();
}
-ADD_THIS_TRANSLATOR(Text_engraver);
+ADD_THIS_TRANSLATOR (Text_engraver);
source file of the GNU LilyPond music typesetter
- (c) 1998--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1998--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
Jan Nieuwenhuizen <janneke@gnu.org>
*/
#include <math.h>
{
SCM style = ly_assoc_chain (ly_symbol2scm ("font-style"),
alist_chain);
- if (gh_pair_p (style) && gh_symbol_p (gh_cdr (style)))
- alist_chain = Font_interface::add_style (me, gh_cdr(style), alist_chain);
+ if (gh_pair_p (style) && gh_symbol_p (gh_cdr (style)))
+ alist_chain = Font_interface::add_style (me, gh_cdr (style), alist_chain);
Font_metric *fm = Font_interface::get_font (me, alist_chain);
SCM text = gh_cdr (markup_text);
#if 1
- SCM p = gh_cons (gh_call2 (f, sheet, markup), alist_chain);
+ SCM p = gh_cons (gh_call2 (f, sheet, markup), alist_chain);
#else
SCM pp = gh_call2 (f, sheet, markup);
gh_newline ();
Molecule m = text2molecule (me, gh_car (text), p);
SCM m_p = SCM_EOL;
if (gh_pair_p (gh_car (text)))
- m_p = gh_cons (gh_call2 (f, sheet, gh_caar (text)), alist_chain);
+ m_p = gh_cons (gh_call2 (f, sheet, gh_caar (text)), alist_chain);
SCM m_k = ly_assoc_chain (ly_symbol2scm ("kern"), m_p);
Real m_kern = kern[align];
if (gh_pair_p (m_k) && gh_number_p (gh_cdr (m_k)))
}
else if (t == "text")
{
- req_drul_[s->get_span_dir()] = s;
+ req_drul_[s->get_span_dir ()] = s;
return true;
}
}
if (!span_)
{
req_drul_[STOP]->origin ()->warning
- (_ ("can't find start of text spanner"));
+ (_ ("can't find start of text spanner"));
}
else
{
if (current_req_)
{
req_drul_[START]->origin ()->warning
- (_ ("already have a text spanner"));
+ (_ ("already have a text spanner"));
}
else
{
#include "warn.hh"
#define format_str String_convert::form_str
-#define FIX_UNITY (1 << 20)
+#define FIX_UNITY \
+ (1 << 20)
static const Real fix_to_real (Fix f);
Tex_font_metric_reader::read_header ()
{
U16 file_length = input_.get_U16 ();
- (void) file_length;
+ (void) file_length;
U16 header_length = input_.get_U16 ();
info_.first_charcode = input_.get_U16 ();
U16 italic_correction_word_count = input_.get_U16 ();
U16 lig_kern_word_count = input_.get_U16 ();
U16 kern_word_count = input_.get_U16 ();
- (void)kern_word_count;
+ (void)kern_word_count;
U16 extensible_word_count = input_.get_U16 ();
- (void)extensible_word_count;
+ (void)extensible_word_count;
header_.param_word_count = input_.get_U16 ();
info_.parameter_count = header_.param_word_count;
/* We don't care about the extensible table. */
if (header_length < 2)
- error (_f ("TFM header of `%s' has only %u word(s)",
+ error (_f ("TFM header of `%s' has only %u word (s)",
input_.name_str ().ch_C (), header_length));
info_.checksum = input_.get_U32 ();
/* The first parameter is different than all the rest, because it
isn't scaled by the design size. */
- info_.parameters[(TFM_SLANT_PARAMETER) - 1] = get_U32_fix_f ();
+ info_.parameters[ (TFM_SLANT_PARAMETER) - 1] = get_U32_fix_f ();
for (Char_code i = 2; i <= header_.param_word_count; i++)
info_.parameters[i - 1] = get_U32_fix_scaled_f ();
* info_.design_size; \
}
- GET_CHAR_DIMEN(width);
- GET_CHAR_DIMEN(height);
- GET_CHAR_DIMEN(depth);
- GET_CHAR_DIMEN(italic_correction);
+ GET_CHAR_DIMEN (width);
+ GET_CHAR_DIMEN (height);
+ GET_CHAR_DIMEN (depth);
+ GET_CHAR_DIMEN (italic_correction);
/* The other condition for a character existing is that it be between
the first and last character codes given in the header. We've
}
Real d = -depth_;
- return Box (Interval (0, width_),Interval ( d <? height_, d >? height_));
+ return Box (Interval (0, width_),Interval (d <? height_, d >? height_));
}
Tex_font_char_metric::Tex_font_char_metric ()
Tex_font_char_metric const *
Tex_font_metric::find_ascii (int ascii, bool warn) const
{
- if (ascii < ascii_to_metric_idx_.size() && ascii_to_metric_idx_[ascii] >= 0)
+ if (ascii < ascii_to_metric_idx_.size () && ascii_to_metric_idx_[ascii] >= 0)
return & char_metrics_[ascii_to_metric_idx_ [ascii]];
else if (warn)
{
tie_compare (Grob* const & s1,
Grob* const & s2)
{
- return sign (Tie::position_f (s1) - Tie::position_f(s2));
+ return sign (Tie::position_f (s1) - Tie::position_f (s2));
}
/*
Link_array<Grob> ties =
Pointer_group_interface__extract_elements (me, (Grob*)0, "ties");
- for (int i = ties.size (); i--; )
+ for (int i = ties.size (); i--;)
if (Directional_element_interface::get (ties[i]))
ties.del (i);
- if(!ties.size())
+ if (!ties.size ())
return ;
}
ties.sort (tie_compare);
- Directional_element_interface::set( ties[0], DOWN);
+ Directional_element_interface::set (ties[0], DOWN);
ties.del (0);
- Directional_element_interface ::set(ties.pop (), UP);
- for (int i=ties.size(); i--; )
+ Directional_element_interface ::set (ties.pop (), UP);
+ for (int i=ties.size (); i--;)
{
Grob * t = ties[i];
Real p = Tie::position_f (t);
}
-MAKE_SCHEME_CALLBACK(Tie_column,after_line_breaking,1);
+MAKE_SCHEME_CALLBACK (Tie_column,after_line_breaking,1);
SCM
Tie_column::after_line_breaking (SCM smob)
{
virtual void create_grobs ();
void typeset_tie (Grob*);
public:
- VIRTUAL_COPY_CONS(Translator);
- Tie_engraver();
+ VIRTUAL_COPY_CONS (Translator);
+ Tie_engraver ();
};
-Tie_engraver::Tie_engraver()
+Tie_engraver::Tie_engraver ()
{
req_l_ = 0;
tie_column_p_ = 0;
Note_req * m = dynamic_cast<Note_req* > (i.req_l_);
if (!m)
return;
- now_heads_.push (CHead_melodic_tuple (i.elem_l_, m, now_mom()+ m->length_mom ()));
+ now_heads_.push (CHead_melodic_tuple (i.elem_l_, m, now_mom ()+ m->length_mom ()));
}
}
if (req_l_)
{
now_heads_.sort (CHead_melodic_tuple::pitch_compare);
- stopped_heads_.sort(CHead_melodic_tuple::pitch_compare);
+ stopped_heads_.sort (CHead_melodic_tuple::pitch_compare);
SCM head_list = SCM_EOL;
int j = stopped_heads_.size ()-1;
int i = now_heads_.size ()-1;
- while (i >= 0 && j >=0)
+ while (i >= 0 && j >=0)
{
int comp
- = Pitch::compare (*unsmob_pitch (now_heads_[i].req_l_->get_mus_property ("pitch") ),
+ = Pitch::compare (*unsmob_pitch (now_heads_[i].req_l_->get_mus_property ("pitch")),
*unsmob_pitch (stopped_heads_[j].req_l_->get_mus_property ("pitch")));
if (comp)
{
- (comp < 0) ? j -- : i--;
+ (comp < 0) ? j -- : i--;
continue;
}
else
{
tie_column_p_ = new Spanner (get_property ("TieColumn"));
Tie_column::set_interface (tie_column_p_);
- for (int i = tie_p_arr_.size (); i--; )
+ for (int i = tie_p_arr_.size (); i--;)
Tie_column::add_tie (tie_column_p_,tie_p_arr_ [i]);
announce_grob (tie_column_p_, 0);
}
if (req_l_ && !tie_p_arr_.size ())
{
+ /* How to shut up this warning, when no notes appeared because
+ they were suicided by Thread_devnull_engraver? */
req_l_->origin ()->warning (_ ("No ties were created!"));
}
void
Tie_engraver::typeset_tie (Grob *her)
{
- if (!(Tie::head (her,LEFT) && Tie::head (her,RIGHT)))
+ if (! (Tie::head (her,LEFT) && Tie::head (her,RIGHT)))
warning (_ ("lonely tie"));
Direction d = LEFT;
Drul_array<Grob *> new_head_drul;
- new_head_drul[LEFT] = Tie::head(her,LEFT);
+ new_head_drul[LEFT] = Tie::head (her,LEFT);
new_head_drul[RIGHT] = Tie::head (her,RIGHT);
do {
if (!Tie::head (her,d))
- new_head_drul[d] = Tie::head(her,(Direction)-d);
- } while (flip(&d) != LEFT);
+ new_head_drul[d] = Tie::head (her, (Direction)-d);
+ } while (flip (&d) != LEFT);
- index_set_cell (her->get_grob_property ("heads"), LEFT, new_head_drul[LEFT]->self_scm () );
- index_set_cell (her->get_grob_property ("heads"), RIGHT, new_head_drul[RIGHT]->self_scm () );
+ index_set_cell (her->get_grob_property ("heads"), LEFT, new_head_drul[LEFT]->self_scm ());
+ index_set_cell (her->get_grob_property ("heads"), RIGHT, new_head_drul[RIGHT]->self_scm ());
typeset_grob (her);
}
}
-ADD_THIS_TRANSLATOR(Tie_engraver);
+ADD_THIS_TRANSLATOR (Tie_engraver);
CHead_melodic_tuple::CHead_melodic_tuple ()
CHead_melodic_tuple::time_compare (CHead_melodic_tuple const&h1,
CHead_melodic_tuple const &h2)
{
- return (h1.end_ - h2.end_ ).sign ();
+ return (h1.end_ - h2.end_).sign ();
}
class Tie_performer : public Performer
{
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Tie_performer ();
private:
bool done_;
Note_req * m = dynamic_cast<Note_req* > (i.req_l_);
if (!m)
return;
- now_notes_.push (CNote_melodic_tuple (nh, m, now_mom()+ m->length_mom ()));
+ now_notes_.push (CNote_melodic_tuple (nh, m, now_mom ()+ m->length_mom ()));
}
}
if (req_l_)
{
now_notes_.sort (CNote_melodic_tuple::pitch_compare);
- stopped_notes_.sort(CNote_melodic_tuple::pitch_compare);
+ stopped_notes_.sort (CNote_melodic_tuple::pitch_compare);
int i=0;
int j=0;
int tie_count=0;
- while ( i < now_notes_.size () && j < stopped_notes_.size ())
+ while (i < now_notes_.size () && j < stopped_notes_.size ())
{
int comp
- = Pitch::compare (*unsmob_pitch (now_notes_[i].req_l_->get_mus_property ("pitch") ),
+ = Pitch::compare (*unsmob_pitch (now_notes_[i].req_l_->get_mus_property ("pitch")),
*unsmob_pitch (stopped_notes_[j].req_l_->get_mus_property ("pitch")));
if (comp)
{
- (comp < 0) ? i ++ : j++;
+ (comp < 0) ? i ++ : j++;
continue;
}
else
if (!tie_p_arr_.size ())
{
- req_l_->origin ()->warning (_("No ties were created!"));
+ req_l_->origin ()->warning (_ ("No ties were created!"));
}
}
}
CNote_melodic_tuple::time_compare (CNote_melodic_tuple const&h1,
CNote_melodic_tuple const &h2)
{
- return (h1.end_ - h2.end_ ).sign ();
+ return (h1.end_ - h2.end_).sign ();
}
Direction
Tie::get_default_dir (Grob*me)
{
- Item * sl = head(me,LEFT) ? Rhythmic_head::stem_l (head (me,LEFT)) :0;
- Item * sr = head(me,RIGHT) ? Rhythmic_head::stem_l (head (me,RIGHT)) :0;
+ Item * sl = head (me,LEFT) ? Rhythmic_head::stem_l (head (me,LEFT)) :0;
+ Item * sr = head (me,RIGHT) ? Rhythmic_head::stem_l (head (me,RIGHT)) :0;
if (sl && sr)
{
Direction headdir = CENTER;
if (head (me,LEFT))
headdir = LEFT;
- else if (head(me,RIGHT))
+ else if (head (me,RIGHT))
headdir = RIGHT;
else
{
this is a kludge: the tie has to be long enough to be
visible, but should not go through key sigs.
- (please fixme)
+ (please fixme)
*/
Real lambda = 0.5;
- 2 * x_gap_f;
}
- Direction dir = Directional_element_interface::get(me);
+ Direction dir = Directional_element_interface::get (me);
SCM details = me->get_grob_property ("details");
todo: tie / stem collision
*/
- b = slur_shape(width,h_inf, r_0);
+ b = slur_shape (width,h_inf, r_0);
b.scale (1, dir);
b.translate (Offset (left_x, ypos));
Real y1 = ry + clear;
Real y2 = ry - clear;
- newy = (fabs (y1 - y) < fabs (y2 - y)) ? y1 : y2;
+ newy = (fabs (y1 - y) < fabs (y2 - y)) ? y1 : y2;
// newy = ry - 0.5 * staff_space * sign (diff) ;
Real y0 = b.control_ [0][Y_AXIS];
b.control_[2][Y_AXIS] =
b.control_[1][Y_AXIS] =
- (b.control_[1][Y_AXIS] - y0) * ((newy - y0) / (y - y0)) + y0;
+ (b.control_[1][Y_AXIS] - y0) * ((newy - y0) / (y - y0)) + y0;
}
else
programming_error ("Tie is nowhere horizontal");
SCM controls = SCM_EOL;
for (int i= 4; i--;)
- controls = gh_cons ( ly_offset2scm (b.control_[i]), controls);
+ controls = gh_cons (ly_offset2scm (b.control_[i]), controls);
return controls;
}
-MAKE_SCHEME_CALLBACK(Tie,set_spacing_rods,1);
+MAKE_SCHEME_CALLBACK (Tie,set_spacing_rods,1);
/*
TODO: set minimum distances for begin/end of line
return SCM_UNSPECIFIED;
}
-MAKE_SCHEME_CALLBACK(Tie,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Tie,brew_molecule,1);
SCM
Tie::brew_molecule (SCM smob)
{
if (yeah)
set_translator (yeah->report_to_l ());
else
- music_l_->origin ()->warning ( _("no one to print a tuplet start bracket"));
+ music_l_->origin ()->warning (_ ("no one to print a tuplet start bracket"));
}
Music_wrapper_iterator::process (m);
}
-IMPLEMENT_CTOR_CALLBACK(Time_scaled_music_iterator);
+IMPLEMENT_CTOR_CALLBACK (Time_scaled_music_iterator);
}
+Time_scaled_music::Time_scaled_music ()
+{
+
+}
+ADD_MUSIC (Time_scaled_music);
*/
class Time_signature_engraver : public Engraver {
protected:
- virtual void stop_translation_timestep();
+ virtual void stop_translation_timestep ();
virtual void create_grobs ();
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
Item * time_signature_p_;
SCM last_time_fraction_;
- Time_signature_engraver();
+ Time_signature_engraver ();
};
-Time_signature_engraver::Time_signature_engraver()
+Time_signature_engraver::Time_signature_engraver ()
{
time_signature_p_ =0;
last_time_fraction_ = SCM_BOOL_F;
}
void
-Time_signature_engraver::create_grobs()
+Time_signature_engraver::create_grobs ()
{
/*
not rigorously safe, since the value might get GC'd and
void
-Time_signature_engraver::stop_translation_timestep()
+Time_signature_engraver::stop_translation_timestep ()
{
if (time_signature_p_)
{
}
-ADD_THIS_TRANSLATOR(Time_signature_engraver);
+ADD_THIS_TRANSLATOR (Time_signature_engraver);
class Time_signature_performer : public Performer
{
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
- Time_signature_performer();
- ~Time_signature_performer();
+ Time_signature_performer ();
+ ~Time_signature_performer ();
protected:
SCM prev_fraction_;
private:
- Time_signature_change_req* time_signature_req_l_;
+
Audio_time_signature* audio_p_;
};
audio_p_ = new Audio_time_signature (b,o);
Audio_element_info info (audio_p_, 0);
announce_element (info);
- time_signature_req_l_ = 0;
+
}
}
#include "paper-def.hh"
#include "font-interface.hh"
-MAKE_SCHEME_CALLBACK(Time_signature,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Time_signature,brew_molecule,1);
/*
TODO: make different functions for special and normal timesigs.
*/
String symbolname = "timesig-" + s + to_str (n) + "/" + to_str (d);
Molecule m = feta->find_by_name (symbolname);
- if (!m.empty_b())
+ if (!m.empty_b ())
return m;
/*
virtual void stop_translation_timestep ();
virtual void process_music ();
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
};
-ADD_THIS_TRANSLATOR(Timing_engraver);
+ADD_THIS_TRANSLATOR (Timing_engraver);
void
-Timing_engraver::start_translation_timestep( )
+Timing_engraver::start_translation_timestep ()
{
Timing_translator::start_translation_timestep ();
|| (to_boolean (always)))
{
/* should this work, or be junked? See input/bugs/no-bars.ly */
- which=get_property ("defaultBarType" );
+ which=get_property ("defaultBarType");
}
}
}
void
-Timing_translator::process_music()
+Timing_translator::process_music ()
{
if (check_ && measure_position ())
{
Moment zero;
if (!to_boolean (get_property ("barCheckNoSynchronize")))
- daddy_trans_l_->set_property("measurePosition", zero.smobbed_copy ());
+ daddy_trans_l_->set_property ("measurePosition", zero.smobbed_copy ());
}
SCM fr = get_property ("timeSignatureFraction");
void
-Timing_translator::stop_translation_timestep()
+Timing_translator::stop_translation_timestep ()
{
check_ = 0;
}
-ADD_THIS_TRANSLATOR(Timing_translator);
+ADD_THIS_TRANSLATOR (Timing_translator);
void
-Timing_translator::initialize()
+Timing_translator::initialize ()
{
Moment m;
daddy_trans_l_->set_property ("timing" , SCM_BOOL_T);
Moment
Timing_translator::measure_length () const
{
- SCM l = get_property("measureLength");
- if (unsmob_moment(l))
+ SCM l = get_property ("measureLength");
+ if (unsmob_moment (l))
return *unsmob_moment (l);
else
return Moment (1);
daddy_trans_l_->set_property ("beatLength", one_beat.smobbed_copy ());
}
-Timing_translator::Timing_translator()
+Timing_translator::Timing_translator ()
{
last_time_sig_ = SCM_BOOL_F;
Moment m =0;
if (unsmob_moment (sm))
{
- m = *unsmob_moment(sm);
+ m = *unsmob_moment (sm);
while (m < Moment (0))
m += measure_length ();
}
}
void
-Timing_translator::start_translation_timestep()
+Timing_translator::start_translation_timestep ()
{
check_ =00;
Translator *t = this;
SCM s = get_property ("measurePosition");
if (unsmob_moment (s))
{
- measposp = *unsmob_moment(s);
+ measposp = *unsmob_moment (s);
}
else
{
- daddy_trans_l_->set_property ("measurePosition", measposp.smobbed_copy());
+ daddy_trans_l_->set_property ("measurePosition", measposp.smobbed_copy ());
}
measposp += dt;
SCM barn = get_property ("currentBarNumber");
int b = 0;
- if (gh_number_p(barn))
+ if (gh_number_p (barn))
{
b = gh_scm2int (barn);
}
SCM cad = get_property ("timing");
- bool c= to_boolean (cad );
+ bool c= to_boolean (cad);
Moment len = measure_length ();
while (c && measposp >= len)
}
daddy_trans_l_->set_property ("currentBarNumber", gh_int2scm (b));
- daddy_trans_l_->set_property ("measurePosition", measposp.smobbed_copy());
+ daddy_trans_l_->set_property ("measurePosition", measposp.smobbed_copy ());
}
if (!global_translator_dict_p)
global_translator_dict_p = new Dictionary<Translator*>;
- (*global_translator_dict_p)[classname (t)] = t;
+ (*global_translator_dict_p)[classname (t)] = t;
}
Translator*
{
Translator_def* me = (Translator_def*) SCM_CELL_WORD_1 (smob);
- scm_puts("#<Translator_def ", port);
+ scm_puts ("#<Translator_def ", port);
scm_display (me->type_name_, port);
scm_puts (">", port);
return 1;
assign_sym = scm_permanent_object (ly_symbol2scm ("assign"));
}
-ADD_SCM_INIT_FUNC(transdef, foo_init);
+ADD_SCM_INIT_FUNC (transdef, foo_init);
Translator_def::Translator_def ()
{
{
if (scm_memq (str, list) != SCM_BOOL_F)
{
- warning (_f("Already contains: `%s'", s));
- warning (_f("Not adding translator: `%s'", s));
+ warning (_f ("Already contains: `%s'", s));
+ warning (_f ("Not adding translator: `%s'", s));
}
else
list= gh_cons (str, list);
Translator_def::apply_pushpop_property (Translator_group* me,SCM syms, SCM eprop, SCM val)
{
if (gh_symbol_p (syms))
- dynamic_cast<Translator_group*>(me)->execute_single_pushpop_property (syms, eprop, val);
+ dynamic_cast<Translator_group*> (me)->execute_single_pushpop_property (syms, eprop, val);
else for (SCM s = syms; gh_pair_p (s); s = gh_cdr (s))
- dynamic_cast<Translator_group*>(me)->execute_single_pushpop_property (gh_car (s), eprop, val);
+ dynamic_cast<Translator_group*> (me)->execute_single_pushpop_property (gh_car (s), eprop, val);
}
return best_result;
}
-IMPLEMENT_UNSMOB(Translator_def,translator_def);
-IMPLEMENT_SMOBS(Translator_def);
-IMPLEMENT_DEFAULT_EQUAL_P(Translator_def);
+IMPLEMENT_UNSMOB (Translator_def,translator_def);
+IMPLEMENT_SMOBS (Translator_def);
+IMPLEMENT_DEFAULT_EQUAL_P (Translator_def);
static SCM
}
else if (type == assign_sym)
{
- tg->set_property (gh_car(entry), gh_cadr (entry));
+ tg->set_property (gh_car (entry), gh_cadr (entry));
}
}
}
#include "translator-def.hh"
Translator_group::Translator_group (Translator_group const&s)
- : Translator(s)
+ : Translator (s)
{
iterator_count_ =0;
Scheme_hash_table * tab = new Scheme_hash_table (*s.properties_dict ());
properties_scm_ = tab->self_scm ();
- scm_unprotect_object (tab->self_scm( ));
+ scm_unprotect_object (tab->self_scm ());
}
Scheme_hash_table*
Translator_group::~Translator_group ()
{
- //assert (removable_b());
+ //assert (removable_b ());
}
-Translator_group::Translator_group()
+Translator_group::Translator_group ()
{
iterator_count_ = 0;
Scheme_hash_table *tab = new Scheme_hash_table ;
}
void
-Translator_group::check_removal()
+Translator_group::check_removal ()
{
SCM next = SCM_EOL;
for (SCM p = trans_group_list_; gh_pair_p (p); p = next)
Translator_group *trg = dynamic_cast<Translator_group*> (unsmob_translator (gh_car (p)));
trg->check_removal ();
- if (trg->removable_b())
+ if (trg->removable_b ())
terminate_translator (trg);
}
}
bool
-Translator_group::removable_b() const
+Translator_group::removable_b () const
{
return trans_group_list_ == SCM_EOL && ! iterator_count_;
}
return existing;
Link_array<Translator_def> path
- = unsmob_translator_def (definition_)->path_to_acceptable_translator (ly_str02scm ((char*)n.ch_C()), output_def_l ());
+ = unsmob_translator_def (definition_)->path_to_acceptable_translator (ly_str02scm ((char*)n.ch_C ()), output_def_l ());
if (path.size ())
{
}
int
-Translator_group::depth_i() const
+Translator_group::depth_i () const
{
- return (daddy_trans_l_) ? daddy_trans_l_->depth_i() + 1 : 0;
+ return (daddy_trans_l_) ? daddy_trans_l_->depth_i () + 1 : 0;
}
Translator_group*
void
Translator_group::terminate_translator (Translator*r_l)
{
- r_l->removal_processing();
+ r_l->removal_processing ();
/*
Return value ignored. GC does the rest.
*/
}
Translator_group*
-Translator_group::get_default_interpreter()
+Translator_group::get_default_interpreter ()
{
if (!is_bottom_translator_b ())
{
Translator_def *t = unsmob_translator_def (st);
if (!t)
{
- warning (_f ("can't find or create: `%s'", ly_scm2string (nm).ch_C()));
+ warning (_f ("can't find or create: `%s'", ly_scm2string (nm).ch_C ()));
t = unsmob_translator_def (this->definition_);
}
Translator_group *tg = t->instantiate (output_def_l_);
static void
static_each (SCM list, Method_pointer method)
{
- for (SCM p = list; gh_pair_p (p); p = gh_cdr(p))
- (unsmob_translator (gh_car (p))->*method) ();
+ for (SCM p = list; gh_pair_p (p); p = gh_cdr (p))
+ (unsmob_translator (gh_car (p))->*method) ();
}
void
Translator_group::set_property (String id, SCM val)
{
- set_property (ly_symbol2scm (id.ch_C()), val);
+ set_property (ly_symbol2scm (id.ch_C ()), val);
}
void
void
Translator_group::execute_single_pushpop_property (SCM prop, SCM eltprop, SCM val)
{
- if (gh_symbol_p(prop))
+ if (gh_symbol_p (prop))
{
if (val != SCM_UNDEFINED)
{
bool ok = true;
SCM type_p = SCM_EOL;
- if (gh_symbol_p(sym))
+ if (gh_symbol_p (sym))
type_p = scm_object_property (sym, type_symbol);
if (type_p != SCM_EOL && !gh_procedure_p (type_p))
scm_puts (_f ("Type check for `%s' failed; value `%s' must be of type `%s'",
ly_symbol2string (sym).ch_C (),
- ly_scm2string (ly_write2scm( val)).ch_C (),
+ ly_scm2string (ly_write2scm (val)).ch_C (),
ly_scm2string (type_name).ch_C ()).ch_C (),
errport);
scm_puts ("\n", errport);
scm_make_gsubr ("ly-set-trans-property", 3, 0, 0, (Scheme_function_unknown)ly_set_trans_property);
}
-ADD_SCM_INIT_FUNC(trans_scm, add_trans_scm_funcs);
+ADD_SCM_INIT_FUNC (trans_scm, add_trans_scm_funcs);
#include "ly-smobs.icc"
char const*
-Translator::name() const
+Translator::name () const
{
- return classname(this);
+ return classname (this);
}
Translator::~Translator ()
SCM
Translator::mark_smob (SCM sm)
{
- Translator * me = (Translator*) SCM_CELL_WORD_1(sm);
+ Translator * me = (Translator*) SCM_CELL_WORD_1 (sm);
scm_gc_mark (me->simple_trans_list_);
scm_gc_mark (me->trans_group_list_);
scm_gc_mark (me->definition_);
don't try to print properties, that is too much hassle.
*/
scm_puts (" >", port);
-
-
return 1;
}
-
-
-IMPLEMENT_UNSMOB(Translator, translator);
-IMPLEMENT_SMOBS(Translator);
-IMPLEMENT_DEFAULT_EQUAL_P(Translator);
+IMPLEMENT_UNSMOB (Translator, translator);
+IMPLEMENT_SMOBS (Translator);
+IMPLEMENT_DEFAULT_EQUAL_P (Translator);
return p;
}
+ADD_MUSIC (Transposed_music);
+Transposed_music::Transposed_music ()
+{
-
+}
class Tuplet_engraver : public Engraver
{
public:
- VIRTUAL_COPY_CONS(Translator);
+ VIRTUAL_COPY_CONS (Translator);
protected:
Link_array<Time_scaled_music> time_scaled_music_arr_;
stop_moments_.push (m);
SCM s = get_property ("tupletSpannerDuration");
- if (unsmob_moment(s))
+ if (unsmob_moment (s))
m = m <? (now_mom () + *unsmob_moment (s));
span_stop_moments_.push (m);
SCM proc = get_property ("tupletNumberFormatFunction");
- if (gh_procedure_p( proc))
+ if (gh_procedure_p (proc))
{
SCM t = gh_apply (proc, gh_list (time_scaled_music_arr_[i]->self_scm (), SCM_UNDEFINED));
glep->set_grob_property ("text", t);
if (grace != wgb)
return;
- if (Note_column::has_interface(i.elem_l_))
+ if (Note_column::has_interface (i.elem_l_))
{
for (int j =0; j <started_span_p_arr_.size (); j++)
if (started_span_p_arr_[j])
- Tuplet_bracket::add_column (started_span_p_arr_[j], dynamic_cast<Item*>(i.elem_l_));
+ Tuplet_bracket::add_column (started_span_p_arr_[j], dynamic_cast<Item*> (i.elem_l_));
}
else if (Beam::has_interface (i.elem_l_))
{
if (unsmob_moment (s))
tsd = *unsmob_moment (s);
- for (int i= started_span_p_arr_.size (); i--; )
+ for (int i= started_span_p_arr_.size (); i--;)
{
if (now >= span_stop_moments_[i])
{
if (now >= stop_moments_[i])
{
started_span_p_arr_.del (i);
- stop_moments_.del(i);
+ stop_moments_.del (i);
span_stop_moments_.del (i);
- time_scaled_music_arr_.del(i);
+ time_scaled_music_arr_.del (i);
}
}
}
}
}
-ADD_THIS_TRANSLATOR(Tuplet_engraver);
+ADD_THIS_TRANSLATOR (Tuplet_engraver);
-DECLARE_REQUEST_SWALLOWER(Skip_req);
+DECLARE_REQUEST_SWALLOWER (Skip_req);
/// pointer to the alternative that will be processed next.
SCM alternative_cons_;
- ~Unfolded_repeat_iterator();
+ ~Unfolded_repeat_iterator ();
Unfolded_repeat_iterator ();
Unfolded_repeat_iterator (Unfolded_repeat_iterator const &);
protected:
public:
Volta_repeat_iterator ();
static SCM constructor_cxx_function;
- VIRTUAL_COPY_CONS(Music_iterator);
+ VIRTUAL_COPY_CONS (Music_iterator);
};
if (do_repcommands)
add_repeat_command (gh_list (ly_symbol2scm ("volta"),
- ly_str02scm (repstr.ch_C()), SCM_UNDEFINED));
+ ly_str02scm (repstr.ch_C ()), SCM_UNDEFINED));
}
}
else if (volta_b_)
{
String repstr = to_str (done_count_ + 1) + ".";
add_repeat_command (gh_list (ly_symbol2scm ("volta"),
- ly_str02scm (repstr.ch_C()), SCM_UNDEFINED));
+ ly_str02scm (repstr.ch_C ()), SCM_UNDEFINED));
add_repeat_command (ly_symbol2scm ("end-repeat"));
}
do_main_b_ = false;
}
- while (current_iter_p_ && !current_iter_p_-> ok())
+ while (current_iter_p_ && !current_iter_p_-> ok ())
{
- next_element(true);
+ next_element (true);
}
}
Unfolded_repeat_iterator::add_repeat_command (SCM what)
{
SCM reps = ly_symbol2scm ("repeatCommands");
- SCM current_reps = report_to_l ()->get_property(reps);
+ SCM current_reps = report_to_l ()->get_property (reps);
Translator_group * where = report_to_l ()->where_defined (reps);
if (where
{
while (!current_iter_p_->ok ())
{
- next_element(true);
+ next_element (true);
if (!current_iter_p_)
return;
s = gh_append2 (nm, s);
Moment m = 0;
- for (SCM i = nm; gh_pair_p(i); i = gh_cdr (i))
+ for (SCM i = nm; gh_pair_p (i); i = gh_cdr (i))
m = m >? unsmob_music (gh_car (i))->length_mom ();
if (m > Moment (0))
return current_iter_p_->try_music (m);
}
-IMPLEMENT_CTOR_CALLBACK(Unfolded_repeat_iterator);
-IMPLEMENT_CTOR_CALLBACK(Volta_repeat_iterator);
+IMPLEMENT_CTOR_CALLBACK (Unfolded_repeat_iterator);
+IMPLEMENT_CTOR_CALLBACK (Volta_repeat_iterator);
Volta_repeat_iterator::Volta_repeat_iterator ()
{
Spanner * valign_p_;
bool qualifies_b (Grob_info) const;
public:
- VIRTUAL_COPY_CONS(Translator);
- Vertical_align_engraver();
+ VIRTUAL_COPY_CONS (Translator);
+ Vertical_align_engraver ();
protected:
virtual void acknowledge_grob (Grob_info);
- virtual void initialize();
- virtual void finalize();
+ virtual void initialize ();
+ virtual void finalize ();
};
-Vertical_align_engraver::Vertical_align_engraver()
+Vertical_align_engraver::Vertical_align_engraver ()
{
valign_p_ =0;
}
void
-Vertical_align_engraver::initialize()
+Vertical_align_engraver::initialize ()
{
valign_p_ =new Spanner (get_property ("VerticalAlignment"));
- valign_p_->set_bound(LEFT,unsmob_grob (get_property ("currentCommandColumn")));
+ valign_p_->set_bound (LEFT,unsmob_grob (get_property ("currentCommandColumn")));
announce_grob (valign_p_ , 0);
}
void
-Vertical_align_engraver::finalize()
+Vertical_align_engraver::finalize ()
{
- valign_p_->set_bound(RIGHT,unsmob_grob (get_property ("currentCommandColumn")));
+ valign_p_->set_bound (RIGHT,unsmob_grob (get_property ("currentCommandColumn")));
typeset_grob (valign_p_);
valign_p_ =0;
}
bool
Vertical_align_engraver::qualifies_b (Grob_info i) const
{
- int sz = i.origin_trans_l_arr ((Translator*)this).size() ;
+ int sz = i.origin_trans_l_arr ((Translator*)this).size () ;
return sz > 1 && Axis_group_interface::has_interface (i.elem_l_)
&& !i.elem_l_->parent_l (Y_AXIS) && Axis_group_interface::axis_b (i.elem_l_, Y_AXIS);
}
}
-ADD_THIS_TRANSLATOR(Vertical_align_engraver);
+ADD_THIS_TRANSLATOR (Vertical_align_engraver);
class Volta_engraver : public Engraver
{
public:
- Volta_engraver();
- VIRTUAL_COPY_CONS(Translator);
+ Volta_engraver ();
+ VIRTUAL_COPY_CONS (Translator);
protected:
virtual void acknowledge_grob (Grob_info);
SCM start_str_;
};
-ADD_THIS_TRANSLATOR(Volta_engraver);
+ADD_THIS_TRANSLATOR (Volta_engraver);
Volta_engraver::Volta_engraver ()
{
if (end && !volta_span_p_)
{
- warning (_("No volta spanner to end")); // fixme: be more verbose.
+ warning (_ ("No volta spanner to end")); // fixme: be more verbose.
}
else if (end)
{
if (volta_span_p_)
Volta_spanner::add_bar (volta_span_p_, item);
if (end_volta_span_p_)
- Volta_spanner::add_bar(end_volta_span_p_ , item);
+ Volta_spanner::add_bar (end_volta_span_p_ , item);
}
}
}
{
if (volta_span_p_)
{
- typeset_grob(volta_span_p_);
+ typeset_grob (volta_span_p_);
}
if (end_volta_span_p_)
{
{
Side_position_interface::add_staff_support (end_volta_span_p_);
- typeset_grob (end_volta_span_p_ );
+ typeset_grob (end_volta_span_p_);
end_volta_span_p_ =0;
}
}
*/
-MAKE_SCHEME_CALLBACK(Volta_spanner,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Volta_spanner,brew_molecule,1);
SCM
Volta_spanner::brew_molecule (SCM smob)
{
Real staff_thick = me->paper_l ()->get_var ("stafflinethickness");
Real half_space = 0.5;
- Item * bound = dynamic_cast<Spanner*>(me)->get_bound (LEFT);
+ Item * bound = dynamic_cast<Spanner*> (me)->get_bound (LEFT);
/*
not a start, but really broken in two
*/
}
- Real w = dynamic_cast<Spanner*>(me)->spanner_length () - left - half_space;
+ Real w = dynamic_cast<Spanner*> (me)->spanner_length () - left - half_space;
Real h = gh_scm2double (me->get_grob_property ("height"));
Real t = staff_thick * gh_scm2double (me->get_grob_property ("thickness"));
Box b (Interval (0, w), Interval (0, h));
Molecule mol (b, at);
- SCM text = me->get_grob_property("text");
+ SCM text = me->get_grob_property ("text");
SCM properties = gh_list (me->mutable_property_alist_, me->immutable_property_alist_,SCM_UNDEFINED);
Molecule num = Text_item::text2molecule (me, text, properties);
void
-Volta_spanner::add_bar (Grob *me, Item* b)
+Volta_spanner::add_bar (Grob *me, Item* b)
{
- Pointer_group_interface::add_element(me, "bars",b);
+ Pointer_group_interface::add_element (me, "bars",b);
Side_position_interface::add_support (me,b);
- add_bound_item (dynamic_cast<Spanner*>(me), b);
+ add_bound_item (dynamic_cast<Spanner*> (me), b);
}
void
(dash-length . 4.0)
(self-alignment-Y . 0)
(Y-offset-callbacks . (,Side_position_interface::aligned_on_self))
- (meta . ,(grob-description "Hairpin" hairpin-interface))
+ (meta . ,(grob-description "Hairpin" hairpin-interface dynamic-interface))
))
(DotColumn . (
(font-family . dynamic)
(font-shape . italic)
(self-alignment-Y . 0)
- (meta . ,(grob-description "DynamicText" font-interface text-interface ))
+ (meta . ,(grob-description "DynamicText" font-interface text-interface dynamic-interface))
))
(DynamicLineSpanner . (
(minimum-width . 12.5) ; staffspace
(font-family . number)
(font-relative-size . 1)
- (meta . ,(grob-description "MultiMeasureRest" multi-measure-rest-interface font-interface ))
+ (meta . ,(grob-description "MultiMeasureRest" multi-measure-rest-interface rest-interface font-interface ))
))
(NoteCollision . (
(axes 0 1)
(slope-limit . 0.8)
(meta . ,(grob-description "PhrasingSlur" slur-interface))
))
+
(NonMusicalPaperColumn . (
(axes 0)
(before-musical-spacing-factor . 1.0)
(column-space-strength . 2.0)
(meta . ,(grob-description "NonMusicalPaperColumn" paper-column-interface axis-group-interface spaceable-element-interface))
))
+
+ (PercentRepeat . (
+ (spacing-procedure . ,Multi_measure_rest::set_spacing_rods)
+ (molecule-callback . ,Multi_measure_rest::percent)
+ (staff-position . 0)
+ (expand-limit . 10)
+ (padding . 2.0) ; staffspace
+ (minimum-width . 12.5) ; staffspace
+ (font-family . music)
+ (meta . ,(grob-description "PercentRepeat" multi-measure-rest-interface font-interface))
+ ))
+
(Rest . (
(after-line-breaking-callback . ,Rest::after_line_breaking)
;; don't set direction here: it breaks staccato.
(molecule-callback . ,Script::brew_molecule)
(X-offset-callbacks . (,Side_position_interface::centered_on_parent))
- (after-line-breaking-callback . ,Script::after_line_breaking)
+ (before-line-breaking-callback . ,Script::before_line_breaking)
(meta . ,(grob-description "Script" script-interface side-position-interface font-interface))
))