source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <assert.h>
-
#include "axes.hh"
-#include "string.hh"
String
axis_name_str (Axis a)
{
- return String (char(a + 'x'));
+ return to_str (char(a + 'x'));
}
/*
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "choleski.hh"
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "cpu-timer.hh"
source file of the Flower Library
- (c) '95, '96, '97 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) '95, '96, '97 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <fstream.h>
char c;
while ((c=data_get()) == ' ' ||c == '\t')
- if (eof())
- break;
+ if (eof_b())
+ return;
data_unget (c);
}
while (1)
{
char c = data_get();
+
+ if (eof_b ())
+ break;
- if (isspace (c) || eof())
+ if (isspace (c))
{
data_unget (c);
break;
rawmode= true;
while ((c = data_get()) != '\"')
- if (eof())
- error (_("EOF in a string"));
+ if (eof_b ())
+ error (_ ("EOF in a string"));
else
- s += c;
+ s += to_str (c);
rawmode= false;
}
else
- s += c;
+ s += to_str (c);
}
return s;
Only class member who uses text_file::get
*/
char
-Data_file::data_get() {
+Data_file::data_get()
+{
char c = get();
if (!rawmode && c == '#') // gobble comment
{
- while ((c = get()) != '\n' && !eof ())
+ while (!eof_b () && (c = get()) != '\n')
;
return '\n';
}
}
/// read line, gobble '\n'
-String Data_file::get_line()
+String
+Data_file::get_line()
{
char c;
String s;
- while ((c = data_get()) != '\n' && !eof ())
- s += c;
+ while (!eof_b () && (c = data_get()) != '\n')
+ s += to_str (c);
return s;
}
Data_file::gobble_leading_white()
{
// eat blank lines.
- while (!eof())
+ while (!eof_b ())
{
char c = data_get();
if (!isspace (c))
}
}
}
+
+Data_file::Data_file (String s)
+ : Text_stream (s)
+{
+ //*mlog << "(" << s << flush;
+ rawmode= false;
+}
+
+void
+Data_file::warning (String s)
+{
+ message (_ ("warning: ") + s);
+}
+
+void
+Data_file::error (String s)
+{
+ message (s);
+ exit (1);
+}
+
+String
+Data_file::gulp ()
+{
+ String s;
+
+ while (!eof_b ())
+ {
+ s += to_str (data_get ());
+ }
+ return s;
+}
+
+
+Data_file::~Data_file ()
+{
+}
/**
- neuk. hsearch_* is te dom.
+ Dictionary implementation. Please fix me.
+
+ (neuk. hsearch_* is te dom.)
*/
template<class T>
class Dictionary<T>
source file FlowerLib
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "directed-graph.hh"
Directed_graph_node::copy_edges_out (Directed_graph_node const &s)
{
for (int i=0; i < s.edge_out_l_arr_.size(); i++)
- add (s.edge_out_l_arr_[i]);
+ add_edge (s.edge_out_l_arr_[i]);
}
void
Directed_graph_node::~Directed_graph_node()
{
- assert (!linked_b());
+ // assert (!linked_b()); // hampered by memfrobbing
}
void
-Directed_graph_node::add (Directed_graph_node* dep_l)
+Directed_graph_node::add_edge (Directed_graph_node* dep_l)
{
PARANOID_OK();
if (!dep_l)
source file of the Flower Library
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <fstream.h>
#include "text-db.hh"
#include "string-convert.hh"
#include "assoc-iter.hh"
+#include "rational.hh"
/// indent of each level
const INDTAB = 2;
}
Dstream &
-Dstream::operator<<(String s)
+Dstream::operator<<(void const *v_l)
{
- output (s);
+ output (String_convert::pointer_str (v_l));
return *this;
}
Dstream &
-Dstream::operator<<(void const *v_l)
+Dstream::operator <<(Scalar s)
{
- output (String_convert::pointer_str (v_l));
+ output (s);
return *this;
}
Dstream &
-Dstream::operator<<(char const *ch_l)
+Dstream::operator <<(const char * s)
{
- output (ch_l);
+ output (String (s));
return *this;
}
break;
case '\n':
- *os_l_ << '\n' << String (' ', indent_level_i_) << flush;
+ *os_l_ << '\n' << to_str (' ', indent_level_i_) << flush;
break;
default:
*os_l_ << *cp;
char const * fn =cfg_nm ? cfg_nm : ".dstreamrc";
{
- ifstream ifs (fn); // can't open
+ ifstream ifs (fn); // can 't open
if (!ifs)
return;
}
Text_db cfg (fn);
- while (! cfg.eof()){
+ while (!cfg.eof_b ()){
Text_record r (cfg++);
if (r.size() != 2)
{
- r.message (_("not enough fields in Dstream init."));
+ r.message (_ ("Not enough fields in Dstream init."));
continue;
}
(*silent_assoc_p_)[r[0]] = (bool)(int)(Scalar (r[1]));
i.val() = false;
}
}
+
source file of the Flower Library
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "full-storage.hh"
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
bool rawmode;
Text_stream::line;
- Text_stream::eof;
+ Text_stream::eof_b;
Text_stream::get_name;
char data_get();
/// gobble empty stuff before first field.
void gobble_leading_white();
- Data_file (String s) : Text_stream (s) {
- //*mlog << "(" << s << flush;
- rawmode= false;
- }
-
- ~Data_file() {
- // *mlog << ")"<<flush;
- }
-
- warning (String s) {
- message ("warning: " + s);
- }
- error (String s){
- message (s);
- exit (1);
- }
+ Data_file (String);
+ ~Data_file();
+ /**
+ eat complete file
+ @post
+ eof () is true
+ */
+ String gulp ();
+ void warning (String s);
+ void error (String s);
};
#endif // DATAFILE_HH
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
bool linked_b() const;
void unlink();
void junk_links();
- void add (Directed_graph_node*);
+ void add_edge (Directed_graph_node*);
void remove_edge_in (Directed_graph_node *);
void remove_edge_out (Directed_graph_node*);
bool contains_b (Directed_graph_node const*) const;
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef DSTREAM_HH
#define DSTREAM_HH
#include "string.hh"
+#include "scalar.hh"
const char eol= '\n';
String current_classname_str_;
void output (String s);
Assoc<String, bool> *silent_assoc_p_;
+
public:
void clear_silence();
bool silent_b (String) const;
virtual ~Dstream();
Dstream &identify_as (String s);
- /** Output a string via the Dstream. This is the only output
- interface. It delegates all conversion to String class. */
- Dstream &operator << (String s);
+ /**
+ Output a Scalar via the Dstream. This is the only output
+ interface. It explicitely delegates all implicit conversion
+ to Scalar class.
+ */
+ Dstream &operator << (Scalar);
/**
Output memory locations.
*/
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef PATH_HH
#define PATH_HH
#include "string.hh"
-#include "varray.hh"
+#include "array.hh"
/**
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef FULL_STORAGE_HH
#define FULL_STORAGE_HH
-#include "varray.hh"
+#include "array.hh"
#include "real.hh"
#ifndef INLINE
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the Flower Library
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the flowerlib
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the flowerlib
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef LIBC_EXTENSION_HH
#define LIBC_EXTENSION_HH
-#include "fproto.hh"
+#include "fproto.hh"
#include "config.hh"
-
#include <cstddef>
+#include <stdarg.h>
char* strnlwr (char* start_l ,int n);
char* strnupr (char* start_l, int n);
#endif HAVE_MEMMEM
#if !HAVE_SNPRINTF // GNU extension.
-int snprintf (char *str, size_t n,
- char const *format, ...);
+int snprintf (char *str, size_t n, char const *format, ...);
+#endif
+
+#if !HAVE_VSNPRINTF // GNU extension.
+int vsnprintf (char *str, size_t, char const *format, va_list args);
#endif
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef LIST_CC
#define LIST_CC
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef MATRIX_STORAGE_HH
#define MATRIX_STORAGE_HH
-#include "varray.hh"
+#include "array.hh"
#include "real.hh"
/**
source file of the Flower Library
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
Vector row (int) const;
Vector col (int) const;
- operator String() const;
+ String str () const;
void print() const;
~Matrix ();
};
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef PARRAY_HH
#define PARRAY_HH
-#include "varray.hh"
+#include "array.hh"
/**
an array of pointers.
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef PQUEUE_HH
#define PQUEUE_HH
-#include "varray.hh"
+#include "array.hh"
template<class K, class T>
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef PRIORITIES_HH
#define PRIORITIES_HH
-#include "varray.hh"
+#include "array.hh"
/**
A sorted (uni)set. Should connect with PQueue
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
unsigned int num_, den_;
void normalise ();
void copy (Rational const &);
+
public:
void set_infinite (int sign);
bool infty_b () const;
operator bool () const;
operator int () const;
operator double () const;
- operator String () const;
Rational operator - () const;
Rational ();
Rational (int, int =1);
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "string.hh"
#include "real.hh"
+#include "matrix.hh"
/// Perl -like scalar type.
-struct Scalar : public String {
-
- Scalar (Real r) : String (r) {}
- Scalar (int i) : String (i) {}
- Scalar (char c) : String (c) {}
+struct Scalar : public String
+{
+ Scalar (Real r) { *this = to_str (r); }
+ Scalar (int i) { *this = to_str (i); }
+ Scalar (char c) { *this = to_str (c); }
Scalar (char const *c) : String (c) {}
- Scalar (String s):String (s) {}
+ Scalar (String s) : String (s) {}
Scalar (Rational);
operator Rational();
Scalar() {}
operator int();
bool to_bool () const;
+ /*
+ urg, these are bit silly; perhaps should make "Print_string" class
+ (derive from Scalar?)
+ */
+ Scalar (Vector v) { *this = v.str (); }
+ Scalar (Matrix m) { *this = m.str (); }
+
/** perl -like string to bool conversion.
*/
operator bool() const;
source file of the LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of Flower lib
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef STRINGDATA_INL
source file of the LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of Flower lib
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef STRINGHANDLE_INL
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
/*
- virtual-methods.hh -- declare
+ virtual-methods.hh -- declare macros for our do-it-yourself RTTI
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef VIRTUAL_METHODS_HH
#define VIRTUAL_METHODS_HH
-/** a macro to declare the classes name as a static and virtual function.
+#include "stdlib.h" // size_t
+
+/** Declare the classes name as a static and virtual function.
The static_name() can *not* be inlined (this might have the effect that
s->name() != S::static_name (). Overlapping strings need not be merged in C++
*/
#define DECLARE_MY_RUNTIME_TYPEINFO \
-static char const *static_name();\
static bool static_is_type_b (const char*s);\
virtual bool is_type_b (const char *s) const { return static_is_type_b (s); } \
virtual char const *name() const{ return static_name (); } \
-int a_stupid_nonexistent_function_to_allow_the_semicolon_come_out()
+virtual size_t class_size () const { return static_class_size (); }\
+static size_t static_class_size (); \
+static char const *static_name()
#define IMPLEMENT_STATIC_NAME(c)\
- char const *c::static_name() { return #c; }
+ char const *c::static_name() { return #c; } \
+ size_t c::static_class_size () { return sizeof (c); }
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
String
Interval_t<Real>::T_to_str (Real r)
{
- return String (r);
+ return to_str (r);
}
template INTERVAL__INSTANTIATE (int);
String
Interval_t<int>::T_to_str (int i)
{
- return String (i);
+ return to_str (i);
}
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "flower-debug.hh"
#include "matrix.hh"
-Matrix::operator String() const
+String
+Matrix::str () const
{
String s;
#ifndef NPRINT
Full_storage const * stor_c_l = dat_;
- s=String ("matrix {");
+ s = String ("matrix {");
for (int i=0; i< rows(); i++)
{
for (int j = 0; j < cols(); j++)
{
- s+= String (stor_c_l->elem (i,j), "%6f ");
+ s+= to_str (stor_c_l->elem (i,j), "%6f ");
}
s+="\n";
}
void
-Matrix::print() const
+Matrix::print () const
{
#ifndef NPRINT
fdebug << *this;
#endif
}
-Vector::operator String() const
+String
+Vector::str () const
{
String s;
#ifndef NPRINT
- s=String ("vector (") + dim () + ") [";
+ s = String ("vector (") + to_str (dim ()) + ") [";
for (int i=0; i < dim(); i++)
{
- s += String (dat[i], "%6f") + String (' ');
+ s += to_str (dat[i], "%6f") + to_str (' ');
}
- s+="]\n";
+ s += "]\n";
#endif
return s;
}
Vector::print() const
{
#ifndef NDEBUG
- fdebug << *this<<'\n';
+ fdebug << *this << '\n';
#endif
}
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "matrix.hh"
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <math.h>
Offset::str () const
{
String s;
- s = String("(") + coordinate_a_[X_AXIS] + ", " + coordinate_a_[Y_AXIS] + ")";
+ s = String("(") + to_str (coordinate_a_[X_AXIS]) + ", "
+ + to_str (coordinate_a_[Y_AXIS]) + ")";
return s;
}
#endif
source file of the Flower Library
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <assert.h>
source file of the LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl> */
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl> */
#ifdef STRING_DEBUG
#define memmove mymemmove
source file of the LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "duration.hh"
#include "string.hh"
//#include "array.hh"
-#include "varray.hh"
+#include "array.hh"
/**
Duration_convert handles all conversions to -n fro Duration (dur).
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "proto.hh"
#include "input.hh"
void
Input::non_fatal_error (String s) const
{
- message (_ ("Non fatal error: ")+ s);
+ message (_ ("Non fatal error: ") + s);
}
String
Input::location_str () const
if (source_file_l_)
return source_file_l_->file_line_column_str (defined_ch_C_);
else
- return _("(location unknown)");
+ return "(" + _ ("position unknown") + ")";
}
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <iostream.h>
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "plet.hh"
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <stdio.h>
#endif
#include "simple-file-storage.hh"
-#include "varray.hh"
+#include "array.hh"
#include "string.hh"
#include "warn.hh"
void
Simple_file_storage::load_stdin ()
{
- int data_len = 0;
len_i_ = 0;
int c;
if (!f)
{
- warning (_ ("can't open file `") + s + "'");
+ warning (_f ("can't open file: `%s\'", s));
return ;
}
ret = fread (data_p_, sizeof (char), len_i_, f);
if (ret!=len_i_)
- warning (_ ("Huh? got ") + String (ret) + _ (", expected ")
- + String (len_i_) + _ (" characters"));
+ warning (_f ("Huh? got %d, expected %d characters", ret, len_i_));
fclose (f);
}
data_p_ = 0;
len_i_ = 0;
- if (!s.length_i ())
+ if (!s.length_i () || (s == "-"))
load_stdin ();
else
load_file (s);
source file of the LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
Source_file*
Sources::get_file_l (String &file_str) //UGH
{
- if (path_C_)
+ if ((file_str != "-") && path_C_)
{
String file_str_o = path_C_->find (file_str);
if ((file_str_o == "") && (file_str != ""))
return 0;
file_str = file_str_o;
}
- Source_file * f_p= (!binary_b_) ?
+ Source_file * f_p = (!binary_b_) ?
new Source_file (file_str) : new Binary_source_file (file_str);
add (f_p);
return f_p;
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "config.hh"
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+
+
#include "atom.hh"
#include "tex.hh"
#include "interval.hh"
-#include "dimen.hh"
+#include "dimension.hh"
#include "string.hh"
-#include "varray.hh"
+#include "array.hh"
#include "debug.hh"
#include "main.hh"
Axis ax = (Axis)a;
if (abs (off_[ax]) >= 100 CM)
{
- warning (_("ridiculous dimension ") + axis_name_str (ax) + ", "
- +print_dimen(off_[ax]));
+ warning (_f ("ridiculous dimension: %s, %s", axis_name_str (ax),
+ print_dimen(off_[ax])));
if (experimental_features_global_b)
assert (false);
Atom::print() const
{
#ifndef NPRINT
- DOUT << "texstring: " <<tex_<<"\n";
+ DOUT << "texstring: " << tex_ << '\n';
DOUT << "dim:";
- for (Axis i=X_AXIS; i < NO_AXES; incr(i))
- DOUT << axis_name_str(i) << " = " << dim_[i].str();
+ for (Axis i=X_AXIS; i < NO_AXES; incr(i))
+ DOUT << axis_name_str(i) << " = " << dim_[i].str();
DOUT << "\noffset: " << off_.str ();
#endif
String
Atom::str() const
{
- return "Atom (\'"+tex_+"\', (" + dim_.x().str () + ", "
+ return String ("Atom (\'") + tex_ + "\', (" + dim_.x().str () + ", "
+ dim_.y ().str () + "))";
}
-
-String
-Atom::TeX_string() const
+Offset
+Atom::offset () const
{
- String tex_str = tex_;
- if (check_infinity_b ())
- tex_str += "\errormark";
-
- // whugh.. Hard coded...
- String s ("\\placebox{");
- s += print_dimen (off_[Y_AXIS])+"}{";
- s += print_dimen (off_[X_AXIS]) + "}{";
- s += tex_str + "}";
- return s;
+ return off_;
}
+
+
void
Atom::translate_axis (Real r, Axis a)
{
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "audio-element.hh"
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "bar.hh"
}
void
-Bar_column::do_substitute_dependency (Score_elem*o,Score_elem*n)
+Bar_column::do_substitute_dependency (Score_element*o,Score_element*n)
{
Script_column::do_substitute_dependency (o,n);
if (o == bar_l_)
{
- bar_l_ = n ? (Bar*)n->item() : 0;
+ bar_l_ = n ? (Bar*)n->access_Item () : 0;
}
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-#include "boxes.hh"
-#include "varray.hh"
+#include "box.hh"
+#include "array.hh"
void
Box::translate (Offset o)
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "change-iterator.hh"
String to_type = change_l_->change_to_type_str_;
String to_id = change_l_->change_to_id_str_;
- String warn1 =
- _ ("Can't change ") + to_type
- + _(" to ") + "`" + to_id + "\': " + reason;
- String warn2= "Change_iterator::process_and_next (): " + report_to_l ()->type_str_ + " = `"
+ String warn1 = _f ("can't change `%s\' to `%s\'", to_type, to_id)
+ + ": " + reason;
+ String warn2= "Change_iterator::process_and_next (): "
+ + report_to_l ()->type_str_ + " = `"
+ report_to_l ()->id_str_ + "\': ";
warning (warn2);
change_l_->warning (warn1);
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "change-translator.hh"
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "translator-group.hh"
/*
- col-info.cc -- implement Colinfo
+ col-info.cc -- implement Column_info
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "p-col.hh"
#include "debug.hh"
void
-Colinfo::print() const
+Column_info::print() const
{
#ifndef NPRINT
DOUT << "column { ";
if (fixed_b())
- DOUT << "fixed at " << fixed_position()<<", ";
+ DOUT << "fixed at " << fixed_position() << ", ";
assert (pcol_l_);
DOUT << width_.str();
Direction d = LEFT;
#endif
}
-Colinfo::Colinfo (Paper_column *col_l, Real const *fixed_C)
+Column_info::Column_info (Paper_column *col_l, Real const *fixed_C)
{
if (fixed_C)
fixpos_p_.set_l (fixed_C);
}
-Colinfo::Colinfo()
+Column_info::Column_info()
{
ugh_b_ = false;
pcol_l_ =0;
}
bool
-Colinfo::fixed_b () const
+Column_info::fixed_b () const
{
return fixpos_p_.get_C();
}
Real
-Colinfo::fixed_position () const
+Column_info::fixed_position () const
{
return *fixpos_p_;
}
int
-Colinfo::rank_i () const
+Column_info::rank_i () const
{
return pcol_l_->rank_i ();
}
/*
- colhpos.cc -- implement Col_hpositions
+ colhpos.cc -- implement Column_x_positions
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "colhpos.hh"
#include "vector.hh"
#include "line-spacer.hh"
-Col_hpositions::Col_hpositions()
+Column_x_positions::Column_x_positions()
{
energy_f_ = infinity_f;
ugh_b_ = false;
spacer_l_ =0;
}
-Col_hpositions::~Col_hpositions()
+Column_x_positions::~Column_x_positions()
{
}
void
-Col_hpositions::add (Paper_column*c)
+Column_x_positions::add_paper_column (Paper_column*c)
{
cols.push (c);
}
void
-Col_hpositions::print() const
+Column_x_positions::print() const
{
#ifndef NPRINT
DOUT << "energy : " << energy_f_ << '\n';
}
void
-Col_hpositions::OK() const
+Column_x_positions::OK() const
{
#ifndef NDEBUG
assert (config.size() == cols.size ());
}
void
-Col_hpositions::set_stupid_solution(Vector v)
+Column_x_positions::set_stupid_solution(Vector v)
{
energy_f_ = infinity_f;
ugh_b_ = true;
}
void
-Col_hpositions::stupid_solution()
+Column_x_positions::stupid_solution()
{
set_stupid_solution (spacer_l_->default_solution());
}
void
-Col_hpositions::solve_line()
+Column_x_positions::solve_line()
{
spacer_l_->solve (this);
}
void
-Col_hpositions::approximate_solve_line()
+Column_x_positions::approximate_solve_line()
{
spacer_l_->lower_bound_solution (this);
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "debug.hh"
#include "collision.hh"
}
void
-Collision::add (Note_column* ncol_l)
+Collision::add_column (Note_column* ncol_l)
{
clash_l_arr_.push (ncol_l);
add_element (ncol_l);
Note_column* c_l = clash_l_arr_[i];
if (! c_l->dir_)
{
- warning (_("No stem direction set. Ignoring column in clash. "));
+ warning (_ ("No stem direction set. Ignoring column in clash."));
continue;
}
int d = (c_l->dir_);
{
if (clash_group_arr_a[j].size() > 1)
{
- warning (_("Too many clashing notecolumns. Ignoring them."));
+ warning (_ ("Too many clashing notecolumns. Ignoring them."));
return;
}
}
(shaddup)
*/
Offset o (x_off[j] * wid_f, y_off[j] * inter_f);
- ((Score_elem*)col_l_a[j])->translate (o);
+ ((Score_element*)col_l_a[j])->translate (o);
}
}
}
IMPLEMENT_IS_TYPE_B1(Collision, Item);
void
-Collision::do_substitute_dependency (Score_elem*o_l,Score_elem*n_l)
+Collision::do_substitute_dependency (Score_element*o_l,Score_element*n_l)
{
- clash_l_arr_.substitute ((Note_column*)o_l->item(),
- (Note_column*)(n_l?n_l->item():0));
+ clash_l_arr_.substitute ((Note_column*)o_l->access_Item (),
+ (Note_column*)(n_l?n_l->access_Item ():0));
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "molecule.hh"
-#include "dimen.hh"
+#include "dimension.hh"
#include "crescendo.hh"
#include "lookup.hh"
#include "paper-def.hh"
if (w_dim < 0)
{
- warning (_("Crescendo too small"));
+ warning (_ ("crescendo") + " " + _("too small"));
w_dim = 0;
}
bool continued = broken[(Direction)-grow_dir_];
- return Atom (paper()->lookup_l ()->hairpin (w_dim, grow_dir_ < 0, continued));
+ return Atom (lookup_l ()->hairpin (w_dim, grow_dir_ < 0, continued));
}
Molecule*
m_p = new Molecule;
Atom s (get_symbol());
- m_p->add (Atom (s));
- m_p->translate (Offset (x_off_dim, y_));
+ m_p->add_atom (s);
+ m_p->translate (Offset (x_off_dim, coordinate_offset_f_));
return m_p;
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "dots.hh"
#include "rhythmic-head.hh"
void
-Dot_column::add (Dots *d)
+Dot_column::add_dots (Dots *d)
{
dot_l_arr_.push (d);
add_dependency (d);
}
void
-Dot_column::add (Rhythmic_head *r)
+Dot_column::add_head (Rhythmic_head *r)
{
if (!r->dots_l_)
return ;
head_l_arr_.push (r);
add_dependency (r);
- add (r->dots_l_);
+ add_dots (r->dots_l_);
}
void
-Dot_column::do_substitute_dependency (Score_elem*o,Score_elem*n)
+Dot_column::do_substitute_dependency (Score_element*o,Score_element*n)
{
- Item *oi =o->item ();
- Item *ni = n?n->item ():0;
+ Item *oi =o->access_Item ();
+ Item *ni = n?n->access_Item ():0;
if (oi&&oi->is_type_b (Rhythmic_head::static_name ()))
head_l_arr_.substitute ((Rhythmic_head*)oi, (Rhythmic_head*)ni);
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "dots.hh"
Dots::brew_molecule_p () const
{
Molecule *out = new Molecule;
- Atom fill = paper ()->lookup_l ()->fill (Box (Interval (0,0),
+ Atom fill = lookup_l ()->fill (Box (Interval (0,0),
Interval (0,0)));
- out->add(fill);
+ out->add_atom (fill);
- Atom d = paper ()->lookup_l ()->dots ();
+ Atom d = lookup_l ()->dots ();
Real dw = d.dim_[X_AXIS].length ();
d.translate_axis (-dw, X_AXIS);
for (int i=no_dots_i_; i--; )
{
d.translate_axis (2*dw,X_AXIS);
- out->add (d);
+ out->add_atom (d);
}
Real inter_f = paper ()->internote_f ();
out->translate_axis (inter_f * position_i_, Y_AXIS);
Sourcefile of GNU LilyPond musictypesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "music-list.hh"
void
-Engraver::announce_element (Score_elem_info i)
+Engraver::announce_element (Score_element_info i)
{
i.origin_grav_l_arr_.push (this);
daddy_grav_l()->announce_element (i);
void
-Engraver::typeset_element (Score_elem*p)
+Engraver::typeset_element (Score_element*p)
{
daddy_grav_l()->typeset_element (p);
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "global-translator.hh"
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "gourlay-breaking.hh"
int prev_break_i_;
int line_i_;
Real energy_f_;
- Col_hpositions line_config_;
+ Column_x_positions line_config_;
Break_node ()
{
prev_break_i_ = -1;
This algorithms is adapted from
*/
-Array<Col_hpositions>
+Array<Column_x_positions>
Gourlay_breaking::do_solve () const
{
Array<Break_node> optimal_paths;
for (; break_idx< breaks.size (); break_idx++)
{
Array<int> candidates;
- Array<Col_hpositions> candidate_lines;
+ Array<Column_x_positions> candidate_lines;
Pointer_list<Line_spacer*> spacer_p_list;
/*
if (!feasible (line))
break;
- Col_hpositions approx;
+ Column_x_positions approx;
approx.cols = line;
approx.spacer_l_ = generate_spacing_problem (line,
}
if (! (break_idx % HAPPY_DOTS_I))
- *mlog << "[" << break_idx << "]"<<flush;
+ *mlog << "[" << break_idx << "]" << flush;
}
if (break_idx % HAPPY_DOTS_I)
- *mlog << "[" << break_idx << "]"<<flush;
+ *mlog << "[" << break_idx << "]" << flush;
Array<int> final_breaks;
- Array<Col_hpositions> lines;
+ Array<Column_x_positions> lines;
/* skip 0-th element, since it is a "dummy" elt*/
for (int i = optimal_paths.size ()-1; i> 0;)
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "idealspacing.hh"
{
#ifndef NPRINT
DOUT << "idealspacing {" ;
- DOUT << "distance "<<space_f_<< " strength " << hooke_f_ ;
+ DOUT << "distance " << space_f_ << " strength " << hooke_f_;
DOUT << "left " << left_i_ << " right " << right_i_ << "}\n";
#endif
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <assert.h>
Identifier::error (String expect) const
{
String e (_("Wrong identifier type: "));
- e += String (name()) + _("(expected ") + expect + ")";
+ e += _f ("%s expected", expect);
::error (e);
}
}
/* ugh. */
-/* UGH MEMORY LEAK! */
-#define DEFAULT_PRINT(Class, accessor) \
+#define DEFAULT_PRINT(Class) \
void \
Class ## _identifier::do_print () const { \
- Class *cl = ((Class ## _identifier *)this)->accessor();\
+ Class *cl = ((Class ## _identifier *)this)->access_ ## Class(false);\
cl->print (); \
- delete cl; \
}
-DEFAULT_PRINT(General_script_def, script);
-DEFAULT_PRINT(Lookup, lookup);
-DEFAULT_PRINT(Translator, translator);
-DEFAULT_PRINT(Symtables, symtables);
-DEFAULT_PRINT(Music, music);
-DEFAULT_PRINT(Request, request);
-DEFAULT_PRINT(Score, score);
-DEFAULT_PRINT(Midi_def, mididef);
-DEFAULT_PRINT(Paper_def, paperdef);
+DEFAULT_PRINT(General_script_def);
+DEFAULT_PRINT(Lookup);
+DEFAULT_PRINT(Translator);
+DEFAULT_PRINT(Symtables);
+DEFAULT_PRINT(Music);
+DEFAULT_PRINT(Request);
+DEFAULT_PRINT(Score);
+DEFAULT_PRINT(Midi_def);
+DEFAULT_PRINT(Paper_def);
/* ugh. */
#define DUMMY_STR(Class) \
void \
Class ## _identifier::do_print () const\
{\
- DOUT << do_str () << "\n";\
+ DOUT << do_str () << '\n';\
}\
String \
Class ## _identifier::do_str () const\
{\
- return String (*data_p_);\
+ return to_str (*data_p_);\
}
DEFAULT_STR(int);
fucking C++ blows me.
*/
-#define DEFAULT_ACCESSOR(Class, accessor)\
+#define DEFAULT_ACCESSOR(Class)\
Class*\
-Class ## _identifier::accessor () const {\
+Class ## _identifier::access_ ## Class (bool copy_b) const {\
((Class ## _identifier*)this)->accessed_b_ = true;\
- return new Class (*data_p_);\
+ return copy_b ? new Class (*data_p_) : data_p_;\
}
-#define VIRTUAL_ACCESSOR(Class, accessor)\
+#define VIRTUAL_ACCESSOR(Class)\
Class*\
-Class ## _identifier::accessor () const{\
+Class ## _identifier::access_ ## Class (bool copy_b) const{\
((Class ## _identifier*)this)->accessed_b_ = true;\
- return (Class*)data_p_->clone();\
+ return copy_b ? (Class*)data_p_->clone() : data_p_;\
}
-#define IMPLEMENT_ID_CLASS(Class, accessor) \
+#define IMPLEMENT_ID_CLASS(Class) \
IMPLEMENT_IS_TYPE_B1(Class ## _identifier,Identifier)\
Class ## _identifier::~Class ## _identifier() { delete data_p_; }\
- Class ## _identifier::Class ## _identifier (Class*st, int code):Identifier (code) { data_p_ = st; }\
+ Class ## _identifier::Class ## _identifier (Class*st, int code) \
+ :Identifier (code)\
+ {\
+ data_p_ = st;\
+ }\
Class ## _identifier::Class ## _identifier (Class ## _identifier const &s) \
-: Identifier (s)\
+ : Identifier (s)\
{\
- data_p_ = s.accessor ();\
+ data_p_ = s.access_ ## Class (true);\
}
-IMPLEMENT_ID_CLASS(Duration, duration);
-IMPLEMENT_ID_CLASS(Translator, translator);
-IMPLEMENT_ID_CLASS(int, intid);
-IMPLEMENT_ID_CLASS(Real, real);
-IMPLEMENT_ID_CLASS(String, string);
-IMPLEMENT_ID_CLASS(General_script_def, script);
-IMPLEMENT_ID_CLASS(Lookup, lookup);
-IMPLEMENT_ID_CLASS(Symtables, symtables);
-IMPLEMENT_ID_CLASS(Music, music);
-IMPLEMENT_ID_CLASS(Score, score);
-IMPLEMENT_ID_CLASS(Request, request);
-IMPLEMENT_ID_CLASS(Midi_def, mididef);
-IMPLEMENT_ID_CLASS(Paper_def, paperdef);
-
-VIRTUAL_ACCESSOR(Music, music);
-VIRTUAL_ACCESSOR(Request, request);
-VIRTUAL_ACCESSOR(Translator, translator);
-VIRTUAL_ACCESSOR(General_script_def, script);
-
-DEFAULT_ACCESSOR(Duration, duration);
-DEFAULT_ACCESSOR(int, intid);
-DEFAULT_ACCESSOR(Real, real);
-DEFAULT_ACCESSOR(String, string);
-DEFAULT_ACCESSOR(Lookup, lookup);
-DEFAULT_ACCESSOR(Symtables, symtables);
-DEFAULT_ACCESSOR(Score, score);
-DEFAULT_ACCESSOR(Midi_def, mididef);
-DEFAULT_ACCESSOR(Paper_def, paperdef);
+IMPLEMENT_ID_CLASS(Duration);
+IMPLEMENT_ID_CLASS(Translator);
+IMPLEMENT_ID_CLASS(int);
+IMPLEMENT_ID_CLASS(Real);
+IMPLEMENT_ID_CLASS(String);
+IMPLEMENT_ID_CLASS(General_script_def);
+IMPLEMENT_ID_CLASS(Lookup);
+IMPLEMENT_ID_CLASS(Symtables);
+IMPLEMENT_ID_CLASS(Music);
+IMPLEMENT_ID_CLASS(Score);
+IMPLEMENT_ID_CLASS(Request);
+IMPLEMENT_ID_CLASS(Midi_def);
+IMPLEMENT_ID_CLASS(Paper_def);
+
+VIRTUAL_ACCESSOR(Music);
+VIRTUAL_ACCESSOR(Request);
+VIRTUAL_ACCESSOR(Translator);
+VIRTUAL_ACCESSOR(General_script_def);
+
+DEFAULT_ACCESSOR(Duration);
+DEFAULT_ACCESSOR(int);
+DEFAULT_ACCESSOR(Real);
+DEFAULT_ACCESSOR(String);
+DEFAULT_ACCESSOR(Lookup);
+DEFAULT_ACCESSOR(Symtables);
+DEFAULT_ACCESSOR(Score);
+DEFAULT_ACCESSOR(Midi_def);
+DEFAULT_ACCESSOR(Paper_def);
source file of the LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+
+#include <strstream.h>
+
#include "includable-lexer.hh"
#include "source-file.hh"
#include "source.hh"
+#include "debug.hh"
#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE 16384
#endif
+#ifndef YY_START
+#define YY_START ((yy_start - 1) / 2)
+#define YYSTATE YY_START
+#endif
+
Includable_lexer::Includable_lexer ()
{
yy_current_buffer = 0;
Source_file * sl = global_sources->get_file_l (s);
if (!sl)
{
- String msg =_ ("Can't find file `") + s+ "'";
+ String msg = _f ("can't find file: `%s\'", s);
LexerError (msg.ch_C ());
return;
}
char_count_stack_.push (0);
if (yy_current_buffer)
state_stack_.push (yy_current_buffer);
- cout << "[" << s<<flush;
+ *mlog << "[" << s<<flush;
include_stack_.push (sl);
/*
yy_switch_to_buffer (yy_create_buffer (sl->istream_l (), YY_BUF_SIZE));
}
+void
+Includable_lexer::new_input (String name, String data, Sources* sources)
+{
+ Source_file* file = new Source_file (name, data);
+ sources->add (file);
+ filename_str_arr_.push (name);
+
+ char_count_stack_.push (0);
+ if (yy_current_buffer)
+ state_stack_.push (yy_current_buffer);
+ *mlog << "[" << name << flush;
+ include_stack_.push (file);
+
+ yy_switch_to_buffer (yy_create_buffer (file->istream_l (), YY_BUF_SIZE));
+}
/** pop the inputstack. conceptually this is a destructor, but it
does not destruct the Source_file that Includable_lexer::new_input creates. */
{
include_stack_.pop ();
char_count_stack_.pop ();
- cout << "]"<<flush;
+ *mlog << "]"<<flush;
yy_delete_buffer (yy_current_buffer);
yy_current_buffer = 0;
if (state_stack_.empty ())
{
+ yy_current_buffer = 0;
return false;
}
else
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
protected:
virtual void do_print () const;
virtual Molecule *brew_molecule_p () const;
- virtual void do_substitute_dependent (Score_elem*, Score_elem*);
+ virtual void do_substitute_dependent (Score_element*, Score_element*);
public:
int abbrev_flags_i_;
Abbreviation ();
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef ATOM_HH
#define ATOM_HH
#include "string.hh"
-#include "boxes.hh"
+#include "box.hh"
#include "lily-proto.hh"
Offset off_;
public:
String tex_;
+ String font_;
Box dim_;
+ Offset offset () const;
String str() const; // for printing.
Atom (String, Box);
Atom ();
/// how big is #this#?
Box extent() const;
void print() const;
- String TeX_string() const;
bool check_infinity_b () const;
};
#endif
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
Bar_column();
void set_bar (Bar*);
protected:
- SCORE_ELEM_CLONE(Bar_column);
- void do_substitute_dependency (Score_elem*,Score_elem*);
+ SCORE_ELEMENT_CLONE(Bar_column);
+ void do_substitute_dependency (Score_element*,Score_element*);
DECLARE_MY_RUNTIME_TYPEINFO;
};
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
virtual void do_pre_processing();
public:
DECLARE_MY_RUNTIME_TYPEINFO;
- SCORE_ELEM_CLONE(Break_align_item);
+ SCORE_ELEMENT_CLONE(Break_align_item);
};
#endif // BREAK_ALIGN_ITEM_HH
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
struct Break_caching : Break_algorithm
{
void do_set_pscore();
- Array<Col_hpositions> do_solve() const;
+ Array<Column_x_positions> do_solve() const;
};
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef BREAK_HH
#define BREAK_HH
-#include "varray.hh"
+#include "array.hh"
#include "interval.hh"
#include "lily-proto.hh"
#include "colhpos.hh"
/// helper: solve for the columns in #curline#.
- void solve_line (Col_hpositions*) const;
+ void solve_line (Column_x_positions*) const;
/// helper: approximate the energyv
- void approximate_solve_line (Col_hpositions*) const;
+ void approximate_solve_line (Column_x_positions*) const;
/// does curline fit on the paper?
bool feasible (Line_of_cols) const;
Line_spacer* generate_spacing_problem (Line_of_cols, Interval) const;
- virtual Array<Col_hpositions> do_solve() const=0;
+ virtual Array<Column_x_positions> do_solve() const=0;
virtual void do_set_pscore();
public:
/// check if the spacing/breaking problem is well-stated
void problem_OK() const;
void OK() const;
- Array<Col_hpositions> solve() const;
+ Array<Column_x_positions> solve() const;
};
#endif // BREAK_HH
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
/*
- col-info.hh -- declare Colinfo
+ col-info.hh -- declare Column_info
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
/// helper struct for #Spacing_problem#
-struct Colinfo {
+struct Column_info {
Paper_column *pcol_l_;
P<Real> fixpos_p_;
Drul_array< Array<Spacer_rod> > rods_;
/* *************** */
- Colinfo();
- Colinfo (Paper_column *,Real const *);
+ Column_info();
+ Column_info (Paper_column *,Real const *);
int rank_i () const;
void print() const;
/*
colhpos.hh -- part of GNU LilyPond
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef COLHPOS_HH
#define COLHPOS_HH
-#include "varray.hh"
+#include "array.hh"
#include "lily-proto.hh"
typedef Array<Paper_column*> Line_of_cols;
-struct Col_hpositions {
+struct Column_x_positions {
Line_spacer * spacer_l_;
bool ugh_b_;
Line_of_cols error_col_l_arr_;
/* ************** */
void OK() const;
- ~Col_hpositions();
+ ~Column_x_positions();
void solve_line();
void approximate_solve_line();
/** generate a solution with no regard to idealspacings or
constraints. should always work */
void stupid_solution();
void set_stupid_solution (Vector);
- Col_hpositions();
- void add (Paper_column*c);
+ Column_x_positions();
+ void add_paper_column (Paper_column*c);
void print() const;
};
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
*/
class Collision : public Horizontal_vertical_group_item {
protected:
- virtual void do_substitute_dependency (Score_elem*,Score_elem*);
+ virtual void do_substitute_dependency (Score_element*,Score_element*);
virtual void do_pre_processing();
public:
Link_array<Note_column> clash_l_arr_;
DECLARE_MY_RUNTIME_TYPEINFO;
- void add (Note_column*ncol_l);
+ void add_column (Note_column*ncol_l);
Collision();
};
#endif // COLLISION_HH
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
Crescendo();
protected:
- SCORE_ELEM_CLONE(Crescendo);
+ SCORE_ELEMENT_CLONE(Crescendo);
virtual Molecule*brew_molecule_p() const;
virtual Interval symbol_height() const;
DECLARE_MY_RUNTIME_TYPEINFO;
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
{
Link_array<Rhythmic_head> head_l_arr_;
Link_array<Dots> dot_l_arr_;
- void add (Dots*);
public:
DECLARE_MY_RUNTIME_TYPEINFO;
- void add (Rhythmic_head*);
+ void add_head (Rhythmic_head*);
+ void add_dots (Dots*);
+
protected:
virtual void do_pre_processing ();
- virtual void do_substitute_dependency (Score_elem *o, Score_elem*n);
+ virtual void do_substitute_dependency (Score_element *o, Score_element*n);
};
#endif // DOT_COLUMN_HH
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
/// maximum number of measures in a line
int max_measures_i_;
void do_set_pscore();
- Array<Col_hpositions> do_solve() const;
+ Array<Column_x_positions> do_solve() const;
Gourlay_breaking();
};
#endif // GOURLAY_BREAKING_HH
/*
- header.hh -- declare
+ header.hh -- declare Header
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "dictionary.hh"
+/** Store bibliographical information. The information in the \header
+ block is read into this struct. Lily does not process this
+ information. */
struct Header : Dictionary<String>
{
String lily_id_str_;
String TeX_string() const;
+ Header ();
};
#endif // HEADER_HH
source file of the LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <FlexLexer.h>
#include "string.hh"
-#include "varray.hh"
+#include "array.hh"
#include "fproto.hh"
#include "proto.hh"
/**
an yyFlexLexer child with provisions for inclusion.
*/
-class Includable_lexer : public yyFlexLexer {
+class Includable_lexer : public yyFlexLexer
+{
Array<YY_BUFFER_STATE> state_stack_;
+
protected:
bool close_input ();
Array<Source_file*> include_stack_;
Array<int> char_count_stack_;
+
public:
+ Includable_lexer ();
+ ~Includable_lexer ();
+
/// store dependencies for Makefile stuff.
Array<String> filename_str_arr_;
Source_file* source_file_l () const;
- void new_input (String s,Sources*);
- Includable_lexer ();
- ~Includable_lexer ();
+ void new_input (String s, Sources*);
+ void new_input (String name, String data, Sources*);
+
void add_lexed_char (int);
char const * here_ch_C ();
};
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef LINE_SPACER_HH
#define LINE_SPACER_HH
#include "lily-proto.hh"
-#include "varray.hh"
+#include "array.hh"
#include "vector.hh"
#include "interval.hh"
/** solve the spacing problem
*/
- virtual void solve (Col_hpositions *) const=0;
+ virtual void solve (Column_x_positions *) const=0;
/**
Approximate the spacing problem:
return a lower bound on the energy
*/
- virtual void lower_bound_solution (Col_hpositions *) const=0;
+ virtual void lower_bound_solution (Column_x_positions *) const=0;
/** add a col to the problem. columns have to be added left to
right. The column contains info on it's minimum width. */
/*
- linespace.hh -- declare Colinfo, Spacing_problem
+ linespace.hh -- declare Spacing_problem
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#error
#define LINESPACE_HH
#include "plist.hh"
-#include "varray.hh"
+#include "array.hh"
#include "vector.hh"
#include "interval.hh"
#include "pointer.hh"
*/
class Spacing_problem {
PointerList<Idealspacing *> ideal_p_list_;
- Array<Colinfo> cols;
- Array<Colinfo> loose_col_arr_;
+ Array<Column_info> cols;
+ Array<Column_info> loose_col_arr_;
/// mark column #i# as being loose.
void loosen_column (int i);
Array<Paper_column*> error_pcol_l_arr() const;
virtual Array<Real> solve() const;
- virtual void add_column (Paper_column *, bool fixed=false, Real fixpos=0.0);
+ virtual void add_column (Paper_column *, bool fixed=false, Real fixpos=0.0);
virtual Vector default_solution() contains {
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef LYRIC_ENGRAVER_HH
#define LYRIC_ENGRAVER_HH
#include "engraver.hh"
-#include "varray.hh"
+#include "array.hh"
#include "lily-proto.hh"
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef MOLECULE_HH
#define MOLECULE_HH
#include "lily-proto.hh"
#include "plist.hh"
-#include "boxes.hh"
+#include "box.hh"
#include "axes.hh"
#include "direction.hh"
/** a group of individually translated symbols. You can add molecules
to the top, to the right, etc. */
struct Molecule {
- Pointer_list<Atom*> ats; // change to List<Atom>?
+ Pointer_list<Atom*> atoms_; // change to List<Atom>?
/* *************** */
Molecule() { }
- Molecule (Atom const &a) { add (a) ;}
+ Molecule (Atom const &a);
void add_at_edge (Axis a, Direction d, const Molecule &m);
- void add (Molecule const &m);
+ void add_molecule (Molecule const &m);
void translate (Offset);
void translate_axis (Real,Axis);
- void add (Atom const & a) ;
+ void add_atom (Atom const & a) ;
/// how big is #this#?
Box extent() const;
- String TeX_string() const;
Molecule (const Molecule&s);
void print() const;
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef LEXER_HH
#include "lily-proto.hh"
#include "lily-proto.hh"
#include "fproto.hh"
-#include "varray.hh"
+#include "array.hh"
#include "string.hh"
#include "includable-lexer.hh"
#include "duration.hh"
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
class Paper_column : public Horizontal_group_item {
public:
DECLARE_MY_RUNTIME_TYPEINFO;
- SCORE_ELEM_CLONE(Paper_column);
+ SCORE_ELEMENT_CLONE(Paper_column);
Drul_array< Array<Column_rod> > minimal_dists_arr_drul_;
void preprocess ();
bool used_b() const;
bool breakpoint_b() const;
- void add (Item *i);
+ void add_item (Item *i);
Paper_column();
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
Pointer_list<Spanner *> span_p_list_;
/// other elements
- Pointer_list<Score_elem*> elem_p_list_;
+ Pointer_list<Score_element*> elem_p_list_;
Outputter *outputter_l_;
Super_elem *super_elem_l_;
Paper_score ();
/// add a line to the broken stuff. Positions given in #config#
- void set_breaking (Array<Col_hpositions> const &);
+ void set_breaking (Array<Column_x_positions> const &);
/// add to bottom of pcols
/* STANDARD ROUTINES */
void print() const;
- void typeset_element (Score_elem*);
+ void typeset_element (Score_element*);
void typeset_broken_spanner (Spanner*);
/// add a Spanner
void typeset_unbroken_spanner (Spanner*);
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef QLP_HH
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
Ineq_constrained_qp const *opt;
public:
+
+ int degenerate_count_i_;
String status() const;
Vector vec (int k) const { return opt->cons_[k]; }
constraint in #active#
*/
- void drop (int k);
+ void drop_constraint (int k);
/** add constraint j.
add constraint j to the active set j is the index of the
constraint in #inactive#
*/
- void add (int j);
+ void add_constraint (int j);
/// exchange in and out.
- void exchange (int in, int out) { add (in); drop (out); }
+ void exchange (int in, int out) { add_constraint (in); drop_constraint (out); }
Vector find_active_optimum (Vector g);
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef REQUEST_HH
#include "music.hh"
#include "direction.hh"
+#define DEFAULTACCESSOR(T) virtual T *access_ ## T () { return 0; }
+
+
/**
a voice element wants something printed.
Hungarian postfix: req
public:
- /* *************** */
+ /* *************** */
- virtual ~Request(){}
+ virtual ~Request(){}
- DECLARE_MY_RUNTIME_TYPEINFO;
- VIRTUAL_COPY_CONS(Request,Music);
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ VIRTUAL_COPY_CONS(Request,Music);
- virtual MInterval time_int() const;
- virtual Moment duration() const { return 0; }
-
- /* accessors for children
- maybe checkout RTTI
- */
- virtual Barcheck_req *barcheck() { return 0; }
- virtual Script_req *script() { return 0;}
- virtual Span_req *span() { return 0; }
- virtual Spacing_req * spacing() { return 0; }
- virtual Blank_req * blank() { return 0; }
- virtual Musical_req *musical() { return 0; }
- virtual Command_req * command() { return 0; }
- bool equal_b (Request*) const;
+ virtual MInterval time_int() const;
+ virtual Moment duration() const { return 0; }
+
+ /* accessors for children
+ maybe checkout RTTI
+ */
+
+ DEFAULTACCESSOR(Barcheck_req)
+ DEFAULTACCESSOR(Script_req)
+ DEFAULTACCESSOR(Span_req)
+ DEFAULTACCESSOR(Spacing_req)
+ DEFAULTACCESSOR(Musical_req)
+ DEFAULTACCESSOR(Command_req)
+
+ bool equal_b (Request*) const;
protected:
- virtual bool do_equal_b (Request*) const;
- virtual void do_print() const;
+ virtual bool do_equal_b (Request*) const;
+ virtual void do_print() const;
};
-#define REQUESTMETHODS(T,accessor) \
-virtual T * accessor() { return this;}\
+
+#define REQUESTMETHODS(T) \
+virtual T * access_ ## T() { return this;}\
DECLARE_MY_RUNTIME_TYPEINFO;\
VIRTUAL_COPY_CONS(T, Request);\
virtual void do_print() const
/** Put a script above or below this ``note'' or bar. eg upbow, downbow. Why
a request? These symbols may conflict with slurs and brackets, so
this also a request */
+
class Script_req : public virtual Request {
public:
- Direction dir_;
- General_script_def *scriptdef_p_;
-
- /* *************** */
- bool do_equal_b (Request*) const;
-
- Script_req();
- REQUESTMETHODS(Script_req,script);
- ~Script_req();
- Script_req (Script_req const&);
+ Direction dir_;
+ General_script_def *scriptdef_p_;
+
+ bool do_equal_b (Request*) const;
+
+ Script_req();
+ REQUESTMETHODS(Script_req);
+ ~Script_req();
+ Script_req (Script_req const&);
};
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
Link_array<Note_column> rest_l_arr_;
Link_array<Note_column> ncol_l_arr_;
public:
- void add (Note_column*);
+ void add_column (Note_column*);
DECLARE_MY_RUNTIME_TYPEINFO;
Rest_collision();
protected:
virtual void do_post_processing();
virtual void do_pre_processing();
virtual void do_print() const;
- virtual void do_substitute_dependency (Score_elem*,Score_elem*);
+ virtual void do_substitute_dependency (Score_element*,Score_element*);
};
#endif // REST_COLLISION_HH
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
int position_i_;
Rest ();
- void add (Dots*);
+ void add_dots (Dots*);
protected:
virtual void do_add_processing ();
virtual Molecule * brew_molecule_p () const;
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
class Score_bar : public virtual Bar {
public:
DECLARE_MY_RUNTIME_TYPEINFO;
- SCORE_ELEM_CLONE(Score_bar);
+ SCORE_ELEMENT_CLONE(Score_bar);
protected:
void do_pre_processing ();
};
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#define SCORE_COLUMN_HH
#include "lily-proto.hh"
-#include "varray.hh"
+#include "array.hh"
#include "moment.hh"
#include "p-col.hh"
public:
int break_penalty_i () { return break_penalty_i_; }
DECLARE_MY_RUNTIME_TYPEINFO;
- SCORE_ELEM_CLONE(Score_column);
+ SCORE_ELEMENT_CLONE(Score_column);
/// length of notes/rests in this column
Array<Moment> durations;
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef SCORE_HH
#define SCORE_HH
-#include "varray.hh"
+#include "array.hh"
#include "lily-proto.hh"
#include "plist.hh"
#include "string.hh"
~Score();
void process();
- void add (Music_output_def *def_p);
+ void add_output (Music_output_def *def_p);
void print() const;
private:
void run_translator (Music_output_def*);
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
protected:
virtual void do_print() const;
- virtual void do_substitute_dependency (Score_elem*, Score_elem*);
+ virtual void do_substitute_dependency (Score_element*, Score_element*);
virtual void do_pre_processing() ;
public:
Link_array<Script> script_l_arr_;
Link_array<Item> support_l_arr_;
DECLARE_MY_RUNTIME_TYPEINFO;
- virtual void add (Script *);
+ virtual void add_script (Script *);
void add_support (Item*);
};
source file of the GNU LilyPond music typesetter
- (c) 1998 Han-Wen Nienhuys <hanwen@cs.ruu.nl>
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef SEPARATING_GROUP_SPANNER_HH
#define SEPARATING_GROUP_SPANNER_HH
-#include "vertical-group-spanner.hh"
+#include "spanner.hh"
class Separating_group_spanner : public Spanner
DECLARE_MY_RUNTIME_TYPEINFO;
void add_spacing_unit (Single_malt_grouping_item*);
protected:
- SCORE_ELEM_CLONE (Separating_group_spanner);
+ SCORE_ELEMENT_CLONE (Separating_group_spanner);
virtual Array<Rod> get_rods () const;
- virtual void do_substitute_dependency (Score_elem*,Score_elem*);
+ virtual void do_substitute_dependency (Score_element*,Score_element*);
};
#endif /* SEPARATING_GROUP_SPANNER_HH */
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.ruu.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
It's 1 30 am. Naming suggestions appreciated. */
class Single_malt_grouping_item : public Item
{
- SCORE_ELEM_CLONE (Single_malt_grouping_item);
+ SCORE_ELEMENT_CLONE (Single_malt_grouping_item);
Link_array<Item> item_l_arr_;
public:
Single_malt_grouping_item ();
Interval my_width () const;
- void add (Item*);
+ void add_item (Item*);
DECLARE_MY_RUNTIME_TYPEINFO;
protected:
- virtual void do_substitute_dependency (Score_elem*, Score_elem*);
+ virtual void do_substitute_dependency (Score_element*, Score_element*);
virtual void do_print () const;
};
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
Pointer_list<Idealspacing *> ideal_p_list_;
- Array<Colinfo> cols_;
- Array<Colinfo> loose_col_arr_;
+ Array<Column_info> cols_;
+ Array<Column_info> loose_col_arr_;
Array<Spacer_rod> rods_;
/// mark column #i# as being loose.
static Line_spacer *constructor();
Real energy_normalisation_f_;
Spring_spacer ();
- virtual void solve (Col_hpositions*) const;
- virtual void lower_bound_solution (Col_hpositions*) const;
+ virtual void solve (Column_x_positions*) const;
+ virtual void lower_bound_solution (Column_x_positions*) const;
virtual void add_column (Paper_column *, bool fixed=false, Real fixpos=0.0);
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
/// struct to pass staff info along a Engraver hierarchy.
struct Staff_info {
- int *c0_position_i_l_;
Staff_symbol*staff_sym_l_;
Time_description const *time_C_;
Score_column *musical_l_;
Score_column *command_l_;
- ///
- bool break_allowed_b_;
Score * score_l_;
Score *score_l();
Paper_column * command_pcol_l();
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
Real inter_note_f() const;
int steps_i() const;
protected:
- SCORE_ELEM_CLONE(Staff_symbol);
+ SCORE_ELEMENT_CLONE(Staff_symbol);
virtual Interval do_height () const;
virtual Molecule* brew_molecule_p() const;
virtual void do_print() const;
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
/*
- symtable.hh -- declare
+ symtable.hh -- declare Symtable, Symtables
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
--- /dev/null
+/*
+ outputter.hh -- declare Outputter
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+
+#ifndef OUTPUTTER_HH
+#define OUTPUTTER_HH
+
+#include "lily-proto.hh"
+#include "array.hh"
+#include "string.hh"
+
+/**
+ Abstract interface for a Score_element to output itself.
+ */
+struct Outputter
+{
+ virtual ~Outputter(){}
+ virtual void start_line ()=0;
+ virtual void output_molecule (Molecule const *, Offset, char const *)=0;
+ virtual void stop_line ()=0;
+};
+
+/**
+ Output a line of score using TeX strings
+ */
+struct Tex_outputter : Outputter
+{
+ Array<String> font_arr_;
+ String current_font_;
+
+ Tex_outputter (Tex_stream *);
+ Tex_stream * outstream_l_;
+ void switch_to_font (String);
+ virtual void output_molecule (Molecule const*, Offset, char const*);
+ virtual void start_line ();
+ virtual void stop_line ();
+};
+
+#endif // OUTPUTTER_HH
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
void set_head (Direction, Note_head*head_l);
DECLARE_MY_RUNTIME_TYPEINFO;
- SCORE_ELEM_CLONE(Tie);
+ SCORE_ELEMENT_CLONE(Tie);
bool same_pitch_b_;
Drul_array<Note_head *> head_l_drul_;
virtual void do_add_processing ();
virtual void do_post_processing ();
virtual void set_default_dir();
- virtual void do_substitute_dependency (Score_elem*,Score_elem*);
+ virtual void do_substitute_dependency (Score_element*,Score_element*);
Array<Offset> get_controls () const;
};
#endif // TIE_HH
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
virtual void do_removal_processing() {}
};
+
+template<class T>
+class Translator_adder
+{
+public:
+ static Translator *ctor ()
+ {
+ Translator *t = new T;
+ t->type_str_ = T::static_name ();
+ return t;
+ }
+ Translator_adder () {
+ add_constructor (ctor);
+ }
+};
+
/**
A macro to automate administration of translators.
*/
#define ADD_THIS_TRANSLATOR(c) \
-struct c ## init { \
- static Translator *ctor ()\
- {\
- Translator *t = new c;\
- t-> type_str_ = c::static_name ();\
- return t;\
- }\
- c ## init() { \
- add_constructor (ctor);\
- } \
-} _ ## c ## init;
+ Translator_adder<c> _ ## c ## init;
typedef Translator *(*Translator_ctor) ();
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
/// wordwrap type algorithm: move to next line if current is optimal.
struct Word_wrap : Break_algorithm {
- virtual Array<Col_hpositions> do_solve() const;
+ virtual Array<Column_x_positions> do_solve() const;
Word_wrap();
};
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "ineq-constrained-qp.hh"
#include "qlpsolve.hh"
const int MAXITER=100; // qlpsolve.hh
+const int MAXDEGEN=5;
/*
assume x (idx) == value, and adjust constraints, lin and quad accordingly
Vector x (start);
Vector gradient=quad_*x+lin_;
- // Real fvalue = x*quad_*x/2 + lin*x + const_term;
- // it's no use.
+
+ // Real fvalue = x*quad_*x/2 + lin*x + const_term;// it's no use.
Vector last_gradient (gradient);
int iterations=0;
- while (iterations++ < MAXITER)
+ while (iterations++ < MAXITER && act.degenerate_count_i_ < MAXDEGEN)
{
//#ifdef PARANOID
if (experimental_features_global_b)
Vector direction= - act.find_active_optimum (gradient);
- DOUT << "gradient "<< gradient<< "\ndirection " << direction<<"\n";
+ DOUT << "gradient "<< gradient<< "\ndirection " << direction<< '\n';
if (direction.norm() > EPS)
{
if (numerator >= 0)
{
if (numerator > EPS)
- warning (String ("Ineq_constrained_qp::solve (): Constraint off by ") + numerator);
+ {
+ warning (_f ("Ineq_constrained_qp::solve (): Constraint off by %f", numerator));
+ act.degenerate_count_i_ ++;
+ }
minalf = -numerator;
minidx = ia;
break;
Real optimal_step = minalf;
- Vector deltax=direction * optimal_step;
+ Vector deltax = direction * optimal_step;
x += deltax;
gradient += optimal_step * (quad_ * deltax);
- DOUT << "step = " << optimal_step<< " (|dx| = " <<
- deltax.norm() << ")\n";
+ DOUT << "step = " << optimal_step << " (|dx| = " <<
+ to_str (deltax.norm()) << ")\n";
if (minalf < unbounded_alfa)
{
/* bumped into an edge. try again, in smaller space. */
- act.add (minidx.idx());
- DOUT << "adding cons "<< minidx.idx()<<'\n';
+ act.add_constraint (minidx.idx());
+ DOUT << "adding cons "<< minidx.idx () << '\n';
continue;
}
- /*ASSERT: we are at optimal solution for this "plane"*/
-
-
+ /*ASSERT: we are at the optimal solution for this "plane"*/
}
Vector lagrange_mult=act.get_lagrange (gradient);
break;
}
- DOUT << "dropping cons " << m<<'\n';
- act.drop (m);
+ DOUT << "dropping cons " << m << '\n';
+ act.drop_constraint (m);
}
if (iterations >= MAXITER)
- WARN<<_("didn't converge!\n");
-
- DOUT << ": found " << x<<" in " << iterations <<" iterations\n";
+ WARN << _ ("didn't converge!") << '\n';
+ if (act.degenerate_count_i_ >= MAXDEGEN)
+ WARN << _ ("Too much degeneracy. ") << '\n';
+ DOUT << ": found " << x << " in " << iterations <<" iterations\n";
assert_solution (x);
return x;
}
return lin_.dim();
}
+
+
+
+void
+Ineq_constrained_qp::assert_solution (Vector sol) const
+{
+ bool sol_b=true;
+
+ for (int i=0; sol_b && i < cons_.size(); i++)
+ {
+ Real R=cons_[i] * sol- consrhs_[i];
+ if (R> -EPS)
+ sol_b = false;
+ }
+}
+
+void
+Ineq_constrained_qp::print() const
+{
+#ifndef NPRINT
+ DOUT << "Quad " << quad_;
+ DOUT << "lin " << lin_ << '\n'
+ << "const " << const_term_<< '\n';
+ for (int i=0; i < cons_.size(); i++)
+ {
+ DOUT << "constraint["<<i<<"]: " << cons_[i] << " >= " << consrhs_[i];
+ DOUT << '\n';
+ }
+#endif
+}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
TODO
transposition.
Octave_key::print () const
{
for (int i= 0; i < 7 ; i++)
- DOUT << "note " << i << " acc: " << accidental_i_arr_[i] << "\n";
+ DOUT << "note " << i << " acc: " << accidental_i_arr_[i] << '\n';
}
int i = o + ZEROOCTAVE;
if (i < 0)
{
- warning ("Don't have that many octaves (" + String (o) + ")");
+ warning ("Don't have that many octaves (" + to_str (o) + ")");
i = 0;
}
if (i >= NUMBER_OF_OCTAVES)
{
- warning ("Don't have that many octaves (" + String (o) + ")");
+ warning ("Don't have that many octaves (" + to_str (o) + ")");
i = NUMBER_OF_OCTAVES -1;
}
return i;
{
if (a <= -3)
{
- warning ("Underdone accidentals (" + String (a)+ ")");
+ warning ("Underdone accidentals (" + to_str (a) + ")");
a = -2;
}
if (a >= 3)
{
- warning ("Overdone accidentals (" + String (a) + ")");
+ warning ("Overdone accidentals (" + to_str (a) + ")");
a = 2;
}
accidental_i_arr_[i]=a;
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <iostream.h>
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
--- /dev/null
+/*
+ qlp.cc -- implement Mixed_qp
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+#include "debug.hh"
+#include "qlp.hh"
+
+
+void
+Mixed_qp::add_equality_cons (Vector , double)
+{
+ assert (false);
+}
+
+void
+Mixed_qp::add_fixed_var (int i, Real r)
+{
+ eq_cons.push (i);
+ eq_consrhs.push (r);
+}
+
+
+/**
+ eliminate appropriate variables, until we have a Ineq_constrained_qp
+ then solve that.
+
+ PRE
+ cons should be ascending
+ */
+Vector
+Mixed_qp::solve (Vector start) const
+{
+ if (!dim())
+ return Vector (0);
+
+ print();
+ Ineq_constrained_qp pure (*this);
+
+ for (int i= eq_cons.size()-1; i>=0; i--)
+ {
+ pure.eliminate_var (eq_cons[i], eq_consrhs[i]);
+ start.del (eq_cons[i]);
+ }
+ Vector sol = pure.solve (start);
+ for (int i= 0; i < eq_cons.size(); i++)
+ {
+ sol.insert (eq_consrhs[i],eq_cons[i]);
+ }
+ return sol;
+}
+
+
+Mixed_qp::Mixed_qp (int n)
+ : Ineq_constrained_qp (n)
+{
+}
+
+void
+Mixed_qp::OK() const
+{
+#ifndef NDEBUG
+ Ineq_constrained_qp::OK();
+ assert (eq_consrhs.size() == eq_cons.size ());
+#endif
+}
+
+void
+Mixed_qp::print() const
+{
+#ifndef NPRINT
+ Ineq_constrained_qp::print();
+ for (int i=0; i < eq_cons.size(); i++)
+ {
+ DOUT << "eq cons "<<i<<": x["<<eq_cons[i]<<"] == " << eq_consrhs[i]<< '\n';
+ }
+#endif
+}
+
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "interval.hh"
-#include "dimen.hh"
+#include "dimension.hh"
#include "string.hh"
#include "molecule.hh"
#include "atom.hh"
#include "debug.hh"
#include "tex.hh"
-String
-Molecule::TeX_string() const
-{
- String s;
- for (iter_top (ats,c); c.ok(); c++)
- s+=c->TeX_string();
- return s;
-}
-
Box
Molecule::extent() const
{
Box b;
- for (iter_top (ats,c); c.ok(); c++)
+ for (iter_top (atoms_,c); c.ok(); c++)
b.unite (c->extent());
return b;
}
void
Molecule::translate (Offset o)
{
- for (iter_top (ats,c); c.ok(); c++)
+ for (iter_top (atoms_,c); c.ok(); c++)
c->translate (o);
}
void
Molecule::translate_axis (Real x,Axis a)
{
- for (iter_top (ats,c); c.ok(); c++)
+ for (iter_top (atoms_,c); c.ok(); c++)
c->translate_axis (x,a);
}
void
-Molecule::add (Molecule const &m)
+Molecule::add_molecule (Molecule const &m)
{
- for (iter_top (m.ats,c); c.ok(); c++)
+ for (iter_top (m.atoms_,c); c.ok(); c++)
{
- add (**c);
+ add_atom (**c);
}
}
void
Molecule::add_at_edge (Axis a, Direction d, Molecule const &m)
{
- if (!ats.size())
+ if (!atoms_.size())
{
- add (m);
+ add_molecule (m);
return;
}
Real offset = extent ()[a][d] - m.extent ()[a][-d];
Molecule toadd (m);
toadd.translate_axis (offset, a);
- add (toadd);
+ add_molecule (toadd);
}
Molecule::Molecule (Molecule const &s)
{
- add (s);
+ add_molecule (s);
}
void
#ifndef NPRINT
if (! check_debug)
return;
- for (iter_top (ats,c); c.ok(); c++)
+ for (iter_top (atoms_,c); c.ok(); c++)
c->print();
#endif
}
void
-Molecule::add (Atom const &a)
+Molecule::add_atom (Atom const &a)
+{
+ atoms_.bottom().add (new Atom (a));
+}
+
+Molecule::Molecule (Atom const &a)
{
- ats.bottom().add (new Atom (a));
+ add_atom (a) ;
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
{
for (iter (music_p_list_.top(),i); i.ok (); i++)
{
- Musical_req *m =((Request*)i.ptr ())->musical ();
- if (m && m->melodic ())
+ Musical_req *m =((Request*)i.ptr ())->access_Musical_req ();
+ if (m && m->access_Melodic_req ())
{
- Musical_pitch &pit = m->melodic()->pitch_;
+ Musical_pitch &pit = m->access_Melodic_req ()->pitch_;
pit.to_relative_octave (last);
return pit;
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "misc.hh"
#include "dots.hh"
#include "note-head.hh"
-#include "dimen.hh"
+#include "dimension.hh"
#include "debug.hh"
#include "paper-def.hh"
#include "lookup.hh"
Interval
Note_head::do_width () const
{
- Atom a = paper ()->lookup_l()->ball (balltype_i_);
+ Atom a = lookup_l ()->ball (balltype_i_);
Interval i = a.dim_[X_AXIS];
i+= x_dir_ * i.length ();
return i;
? 0
: (abs(position_i_) - staff_size_i_/2) /2;
- Atom s = p->lookup_l()->ball (balltype_i_);
+ Atom s = lookup_l()->ball (balltype_i_);
out = new Molecule (Atom (s));
out->translate_axis (x_dir_ * s.dim_[X_AXIS].length (), X_AXIS);
if (streepjes_i)
{
int dir = sign (position_i_);
- Atom streepje = p->lookup_l ()->streepje (balltype_i_);
+ Atom streepje = lookup_l ()->streepje (balltype_i_);
int parity = (position_i_ % 2) ? 1 : 0;
Atom s = streepje;
s.translate_axis (-dir * inter_f * (i*2 + parity),
Y_AXIS);
- out->add (s);
+ out->add_atom (s);
}
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "notename-table.hh"
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "musical-request.hh"
bool
Plet_swallow_engraver::do_try_request (Request* req_l)
{
- if (req_l && req_l->musical () && req_l->musical ()->plet ())
+ if (req_l && req_l->access_Musical_req () && req_l->access_Musical_req ()->access_Plet_req ())
return true;
return false;
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "property-iterator.hh"
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
TODO:
try fixed point arithmetic, to speed up lily.
String s ("Active|Inactive [");
for (int i=0; i< active.size(); i++)
{
- s += String (active[i]) + " ";
+ s += to_str (active[i]) + " ";
}
s+="| ";
for (int i=0; i< inactive.size(); i++)
{
- s += String (inactive[i]) + " ";
+ s += to_str (inactive[i]) + " ";
}
s+="]";
}
void
-Active_constraints::add (int k)
+Active_constraints::add_constraint (int k)
{
// add indices
int cidx=inactive[k];
- active.push (cidx);
-
- inactive.swap (k,inactive.size()-1);
- inactive.pop();
Vector a (opt->cons_[cidx]);
// update of matrices
Vector Ha = H*a;
Real aHa = a*Ha;
Vector addrow (Ha.dim());
- if (abs (aHa) > EPS)
+ bool degenerate = (abs (aHa) < EPS);
+
+ if (degenerate)
{
+ warning (String ("Active_constraints::add ():")
+ + _("degenerate constraints"));
+ DOUT << "Ha = " << Ha.str () << '\n';
/*
a != 0, so if Ha = O(EPS), then
Ha * aH / aHa = O(EPS^2/EPS)
if H*a == 0, the constraints are dependent.
- */
- H -= Matrix (Ha/aHa , Ha);
-
+ */
+ degenerate_count_i_ ++;
+ }
+ if (!degenerate)
+ {
+ active.push (cidx);
+ inactive.swap (k,inactive.size()-1);
+ inactive.pop();
- /*
- sorry, don't know how to justify this. ..
- */
+ H -= Matrix (Ha/aHa , Ha);
+
addrow=Ha;
- addrow/= aHa;
+ addrow /= aHa;
A -= Matrix (A*a, addrow);
A.insert_row (addrow,A.rows());
- }else
- WARN << _("degenerate constraints");
+ }
}
void
-Active_constraints::drop (int k)
+Active_constraints::drop_constraint (int k)
{
int q=active.size()-1;
- // drop indices
- inactive.push (active[k]);
- active.swap (k,q);
- A.swap_rows (k,q);
- active.pop();
Vector a (A.row (q));
if (a.norm() > EPS)
{
+ // drop indices
+ inactive.push (active[k]);
+ active.swap (k,q);
+ A.swap_rows (k,q);
+ active.pop();
/*
*/
- Real q = a*opt->quad_*a;
- Matrix aaq (a,a/q);
+ Real aqa = a*opt->quad_*a;
+ Matrix aaq (a,a/aqa);
H += aaq;
A -= A*opt->quad_*aaq;
- }else
- WARN << _("degenerate constraints");
-#ifndef NDEBUG
- Vector rem_row (A.row (q));
- assert (rem_row.norm() < EPS);
-#endif
-
- A.delete_row (q);
+
+ A.delete_row (q);
+ }else {
+ degenerate_count_i_ ++;
+ warning (String ("Active_constraints::drop ():")
+ + _("degenerate constraints"));
+ }
}
Active_constraints::Active_constraints (Ineq_constrained_qp const *op)
- : A(0,op->dim()),
- H(op->dim()),
- opt (op)
+ : A(0,op->dim()),
+ H(op->dim()),
+ opt (op)
{
for (int i=0; i < op->cons_.size(); i++)
inactive.push (i);
*/
H=chol.inverse();
OK();
+
+ degenerate_count_i_ = 0;
}
/** Find the optimum which is in the planes generated by the active
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "request.hh"
Request::equal_b (Request *r) const
{
if (is_type_b (r->name()))
- return r->do_equal_b ((Request*)this);
+ return r->do_equal_b ((Request*)this);
if (r->is_type_b (name()))
- return do_equal_b (r);
+ return do_equal_b (r);
return false;
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "debug.hh"
IMPLEMENT_IS_TYPE_B1(Rest_collision,Item);
void
-Rest_collision::add (Note_column *nc_l)
+Rest_collision::add_column (Note_column *nc_l)
{
add_dependency (nc_l);
if (nc_l->rest_b ())
}
void
-Rest_collision::do_substitute_dependency (Score_elem*o,Score_elem*n)
+Rest_collision::do_substitute_dependency (Score_element*o,Score_element*n)
{
- Item*o_l = o->item();
+ Item*o_l = o->access_Item ();
if (o_l&&o_l->is_type_b (Note_column::static_name ()))
{
- Note_column *n_l = n?(Note_column*)n->item():0;
+ Note_column *n_l = n?(Note_column*)n->access_Item ():0;
rest_l_arr_.substitute ((Note_column*)o_l, n_l);
ncol_l_arr_.substitute ((Note_column*)o_l, n_l);
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "rhythmic-head.hh"
if (dots_i_ && !dots_l_)
{
Dots *d = new Dots;
- add (d);
+ add_dots (d);
pscore_l_->typeset_element (d);
axis_group_l_a_[Y_AXIS]->add_element (d);
axis_group_l_a_[X_AXIS]->add_element (d);
}
void
-Rhythmic_head::add (Dots *dot_l)
+Rhythmic_head::add_dots (Dots *dot_l)
{
dots_l_ = dot_l;
dot_l->add_dependency (this);
}
void
-Rhythmic_head::do_substitute_dependent (Score_elem*o,Score_elem*n)
+Rhythmic_head::do_substitute_dependent (Score_element*o,Score_element*n)
{
if (o == dots_l_)
- dots_l_ = n ? (Dots*)n->item () :0;
+ dots_l_ = n ? (Dots*)n->access_Item () :0;
}
IMPLEMENT_IS_TYPE_B1(Rhythmic_head, Item);
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "debug.hh"
Score_column::do_print() const
{
#ifndef NPRINT
- DOUT << "mus "<< musical_b_ <<" at " << when_<< '\n';
+ DOUT << "mus "<< musical_b_ << " at " << when_ << '\n';
if (break_penalty_i_ >= Break_req::FORCE)
DOUT << "Break forced";
{
if (!d)
{
- warning (_("Ignoring zero duration added to column at ")
- + when_.str ());
+ warning (_f ("ignoring zero duration added to column at %s",
+ when_.str ()));
return;
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <fstream.h>
#include "main.hh"
Array<String> inclusion_global_array;
Array<String> target_str_global_array;
Link_array<Score> score_global_array;
+Header * header_global_p;
void write_dependency_file (String fn, Array<String> targets,
const int WRAPWIDTH = 65;
- cout << "Writing dependency file " << fn << " ...\n";
+ cout << _f ("writing dependency file: `%s\'...", fn) << '\n';
ofstream f (fn.ch_C ());
if (!f)
- warning ( _("Can't open dependency file `" + fn + "\'"));
+ warning (_f ("can't open file: `%s\'", fn));
- f << "# Automatically generated by " << get_version_str () << "\n";
+ f << "# Automatically generated by " << get_version_str () << '\n';
String out;
for (int i=0; i < targets.size (); i ++)
out += targets[i] + " ";
void
do_scores()
{
+ if (!header_global_p)
+ header_global_p = new Header;
for (int i=0; i < score_global_array.size(); i++)
{
Score* is_p = score_global_array[i];
- if (!is_p->header_p_)
- is_p->header_p_ = new Header;
-
-
- is_p->header_p_->lily_id_str_ = "Lily was here, " +
- get_version_number_str();
+
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_i_ |= 1;
}
else
}
score_global_array.clear();
inclusion_global_array.clear ();
+ delete header_global_p ;
+ header_global_p =0;
}
-extern File_path path;
void
do_one_file (String init_str, String file_str)
{
- if (init_str.length_i () && path.find (init_str).empty_b ())
+ if (init_str.length_i () && global_path.find (init_str).empty_b ())
{
- warning (_("Can not find `") + init_str +"\'");
- return ;
+ warning (_f ("can't find file: `%s\'", init_str));
+ return;
}
- if (file_str.length_i () && path.find (file_str).empty_b ())
+ if ((file_str != "-") && global_path.find (file_str).empty_b ())
{
- warning (_("Can not find `") + file_str + "'");
- return ;
+ warning (_f ("can't find file: `%s\'", file_str));
+ return;
}
Sources sources;
source_global_l = &sources;
- source_global_l->set_path (&path);
+ source_global_l->set_path (&global_path);
{
My_lily_parser parser (source_global_l);
parser.set_version_check (version_ignore_global_b);
parser.parse_file (init_str, file_str);
-
- if (file_str.length_i () && file_str[0] != '-')
- {
- String a,b,c,d;
- split_path (file_str, a, b, c, d);
- default_outname_base_global = c;
- }
- else
- default_outname_base_global = "lelie";
-
if (parser.error_level_i_)
{
exit_status_i_ = 1;
}
source_global_l = 0;
}
+
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "script-column.hh"
void
-Script_column::add (Script*s_l)
+Script_column::add_script (Script*s_l)
{
script_l_arr_.push (s_l);
add_dependency (s_l);
for (int i=0; i < script_l_arr_.size(); i++)
{
Script*s_l = script_l_arr_[i];
- placed_l_arr_a[idx (s_l->specs_l_->inside_b(),
+ placed_l_arr_a[idx (s_l->specs_p_->inside_b(),
s_l->dir_) ].push (s_l);
}
}
void
-Script_column::do_substitute_dependency (Score_elem*o,Score_elem*n)
+Script_column::do_substitute_dependency (Score_element*o,Score_element*n)
{
- if (o->item())
+ if (o->access_Item ())
{
- script_l_arr_.substitute ((Script*)o->item(),(Script*) (n?n->item ():0));
- support_l_arr_.substitute (o->item(), (n?n->item ():0));
+ script_l_arr_.substitute ((Script*)o->access_Item (),(Script*) (n?n->access_Item ():0));
+ support_l_arr_.substitute (o->access_Item (), (n?n->access_Item ():0));
}
}
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "debug.hh"
if (invertsym_b_)
preidx_str = (d < 0)? "d" : "u";
- return p->lookup_l()->script (preidx_str + symidx_str_);
+ return p->lookup_l(0)->script (preidx_str + symidx_str_);
}
source file of the GNU LilyPond music typesetter
- (c) 1998 Han-Wen Nienhuys <hanwen@cs.ruu.nl>
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
r.distance_f_ += paper ()->interline_f () *1.5;
a.push (r);
}
-
}
return a;
IMPLEMENT_IS_TYPE_B1(Separating_group_spanner, Spanner);
void
-Separating_group_spanner::do_substitute_dependency (Score_elem*o, Score_elem*n)
+Separating_group_spanner::do_substitute_dependency (Score_element*o, Score_element*n)
{
if (o->is_type_b (Single_malt_grouping_item::static_name ()))
{
Single_malt_grouping_item*ns = n ?
- (Single_malt_grouping_item*)n->item () : 0;
- spacing_unit_l_arr_.substitute ((Single_malt_grouping_item*)o->item (), ns);
+ (Single_malt_grouping_item*)n->access_Item () : 0;
+ spacing_unit_l_arr_.substitute ((Single_malt_grouping_item*)o->access_Item (), ns);
}
}
source file of the GNU LilyPond music typesetter
- (c) 1998 Han-Wen Nienhuys <hanwen@cs.ruu.nl>
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
}
void
-Single_malt_grouping_item::add (Item* i)
+Single_malt_grouping_item::add_item (Item* i)
{
assert (i);
item_l_arr_.push (i);
IMPLEMENT_IS_TYPE_B1(Single_malt_grouping_item, Item);
void
-Single_malt_grouping_item::do_substitute_dependency (Score_elem*o, Score_elem*n)
+Single_malt_grouping_item::do_substitute_dependency (Score_element*o, Score_element*n)
{
- if (o->item ())
+ if (o->access_Item ())
{
- item_l_arr_.unordered_substitute (o->item (), n ? n->item () : 0);
+ item_l_arr_.unordered_substitute (o->access_Item (), n ? n->access_Item () : 0);
}
}
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "debug.hh"
#include "spanner.hh"
#include "p-col.hh"
#include "p-score.hh"
-#include "outputter.hh"
+#include "tex-outputter.hh"
+#include "molecule.hh"
-IMPLEMENT_IS_TYPE_B1(Spanner,Score_elem);
+IMPLEMENT_IS_TYPE_B1(Spanner,Score_element);
void
Spanner::do_print() const
{
#ifndef NPRINT
- DOUT << "Between col ";
+ DOUT << "Between " << spanned_drul_[LEFT]->name ()
+ << " and " << spanned_drul_[RIGHT]->name() << '\n';
if (broken_into_l_arr_.size())
- DOUT << "with broken pieces\n";
+ {
+ DOUT << "with broken pieces:\n";
+ for (int i=0; i < broken_into_l_arr_.size (); i++)
+ broken_into_l_arr_[i]->print ();
+ }
#endif
}
Item * left = spanned_drul_[LEFT];
Item * right = spanned_drul_[RIGHT];
+ if (left == right)
+ {
+ warning (_ ("left spanpoint is right spanpoint\n"));
+ return;
+ }
Link_array<Item> break_cols = pscore_l_->broken_col_range (left,right);
Link_array<Spanner> broken_into_l_arr;
for (int i=1; i < break_cols.size(); i++)
{
- Spanner* span_p = clone()->spanner ();
+ Spanner* span_p = clone()->access_Spanner ();
left = break_cols[i-1];
right = break_cols[i];
if (!right->line_l())
if (!left->line_l())
left = left->find_prebroken_piece(RIGHT);
- assert (left&&right && left->line_l() == right->line_l());
+ assert (left&&right && left->line_l() == right->line_l());
span_p->set_bounds(LEFT,left);
span_p->set_bounds(RIGHT,right);
if (spanned_drul_[Direction(-d)] == spanned_drul_[d]
&& i)
- warning ("Spanner (" + String (name ()) + ") with equal left and right spanpoints.");
+ warning (_f ("Spanner `%s\' with equal left and right spanpoints", name ()));
}
void
}
}
+Spanner*
+Spanner::access_Spanner ()
+{
+ return this;
+}
-Spanner::Spanner()
+Spanner::Spanner ()
{
spanned_drul_[LEFT]=0;
spanned_drul_[RIGHT]=0;
Molecule *output= brew_molecule_p ();
Offset left_off (spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), 0);
Offset o = absolute_offset() + left_off;
- pscore_l_->outputter_l_->output_molecule (output, o);
+ pscore_l_->outputter_l_->output_molecule (output, o, name ());
+ delete output;
}
Interval
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998, 1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998, 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "pointer.tcc"
#include "score-column.hh"
#include "paper-def.hh"
-#include "dimen.hh"
+#include "dimension.hh"
#include "colhpos.hh"
-#include "main.hh" // experimental_fietsers
Vector
Spring_spacer::default_solution() const
{
if (! connected.equiv (fixed[0], i))
{
- warning (_("unconnected column: ") + String (i));
+ warning (_f ("unconnected column: %d", i));
loosen_column (i);
}
}
int right_rank = (j<sol_vec.dim()) ? cols_[j].rank_i_ : sol_vec.dim ();
int d_r = right_rank - left_rank;
- Colinfo loose=loose_col_arr_[k++];
+ Column_info loose=loose_col_arr_[k++];
int r = loose.rank_i_ ;
assert (r > left_rank && r < right_rank);
Real diff =v (other) - v (i) ;
if (COLFUDGE +diff < rods[j].distance_f_)
{
- DOUT << "i, other_i: " << i << " " << other << "\n";
- DOUT << "dist, minimal = " << diff <<" "
- << rods[j].distance_f_<<'\n';
+ DOUT << "i, other_i: " << i << " " << other << '\n';
+ DOUT << "dist, minimal = " << diff << " "
+ << rods[j].distance_f_ << '\n';
return false;
}
}
Vector v;
if (!try_initial_solution_and_tell (v))
{
- warning ("I'm too fat; call Oprah");
+ warning (_ ("I'm too fat; call Oprah"));
}
return v;
initsol (i)=cols_[i].fixed_position();
if (initsol (i) < min_x )
{
- DOUT << "failing: init, min : " << initsol (i) << " " << min_x << "\n";
+ DOUT << "failing: init, min : " << initsol (i) << " " << min_x << '\n';
initsol (i) = min_x;
succeeded = false;
}
c += sqr (i->space_f_);
}
- // experimental
+
if (quad.dim() > 10)
quad.set_band();
return e;
}
void
-Spring_spacer::lower_bound_solution (Col_hpositions*positions) const
+Spring_spacer::lower_bound_solution (Column_x_positions*positions) const
{
Mixed_qp lp (cols_.size());
make_matrices (lp.quad_,lp.lin_, lp.const_term_);
}
void
-Spring_spacer::solve (Col_hpositions*positions) const
+Spring_spacer::solve (Column_x_positions*positions) const
{
DOUT << "Spring_spacer::solve ()...";
positions->satisfies_constraints_b_ = check_constraints (solution_vec);
if (!positions->satisfies_constraints_b_)
{
- WARN << _("solution doesn't satisfy constraints.\n") ;
+ WARN << _ ("solution doesn't satisfy constraints") << '\n' ;
}
position_loose_cols (solution_vec);
positions->energy_f_ = calculate_energy_f (solution_vec);
void
Spring_spacer::add_column (Paper_column *col, bool fixed, Real fixpos)
{
- Colinfo c (col,(fixed)? &fixpos : 0);
+ Column_info c (col,(fixed)? &fixpos : 0);
int this_rank = cols_.size();
c.rank_i_ = this_rank;
void
Spring_spacer::loosen_column (int i)
{
- Colinfo c=cols_.get (i);
+ Column_info c=cols_.get (i);
for (PCursor<Idealspacing*> j (ideal_p_list_.top()); j.ok (); j++)
{
if (j->left_i_ == i|| j->right_i_ == i)
#ifndef NPRINT
for (int i=0; i < cols_.size(); i++)
{
- DOUT << "col " << i<<' ';
+ DOUT << "col " << i << " ";
cols_[i].print();
}
for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok (); i++)
/**
generate springs between columns.
- TODO: This needs rethinking. Spacing should take optical
+ TODO: This needs rethinking.
+
+ * Spacing should take optical
effects into account
+ * Should be decentralised
+
The algorithm is taken from :
John S. Gourlay. ``Spacing a Line of Music,'' Technical Report
Moment delta_t = scol_l (i+1)->when() - scol_l (i)->when () ;
- Real k= paper_l()->arithmetic_constant (context_shortest_arr[i]);
+
/*
ugh should use shortest_playing distance
*/
if (delta_t)
- durational_distance = paper_l()->duration_to_dist (delta_t,k);
+ {
+ Real k= paper_l()->arithmetic_constant (context_shortest_arr[i]);
+ durational_distance = paper_l()->duration_to_dist (delta_t,k);
+ }
symbol_distance += -cols_[i+1].width_[LEFT];
Moment context_shortest = context_shortest_arr[i];
if (! shortest_playing_len)
{
- warning (_("Can't find a ruling note at ")
- +scol_l (i)->when().str ());
+ warning (_f ("can't find a ruling note at %s",
+ scol_l (i)->when().str ()));
shortest_playing_len = 1;
}
if (! context_shortest)
{
- warning(_("No minimum in measure at ")
- + scol_l (i)->when().str ());
+ warning (_f ("no minimum in measure at %s",
+ scol_l (i)->when().str ()));
context_shortest = 1;
}
Moment delta_t = scol_l (i+1)->when() - scol_l (i)->when ();
// fixed: probably should set minimum (rod/spring)?
cols_[i-1].width_[RIGHT] += interline_f;
// should adjust dist too?
- ideal_arr_[i-1] = ideal_arr_[i-1] >? interline_f;
+ ideal_arr_[i-1] = ideal_arr_[i-1] >? (2 * interline_f);
}
/*
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "proto.hh"
Staff_info::Staff_info()
{
score_l_ =0;
- c0_position_i_l_ = 0;
time_C_ = 0;
rhythmic_C_ =0;
- break_allowed_b_ = 0;
}
Score_column*
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "swallow-perf.hh"
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "misc.hh"
-#include "dimen.hh"
+#include "dimension.hh"
#include "debug.hh"
#include "real.hh"
#include "atom.hh"
Symtable::lookup (String s) const
{
if (elt_b (s))
- return (*this)[s];
+ {
+ Atom a (elem(s));
+ return a;
+ }
else
{
- warning ("Symtable `" + id_str+ _("\': unknown symbol `") +s+"'\n");
+ warning (_f ("Symtable `%s\': unknown symbol: `%s\'", id_str, s));
Atom sy;
return sy;
}
{
if (!elt_b (s))
{
- error ("Symtable `" + s + _("\' unknown"));
+ error (_f ("Symtable `%s\' unknown", s));
/*
- We can't return, because we'll dump core anyway.
+ We can 't return, because we'll dump core anyway.
*/
return 0;
}
{
for (Assoc_iter<String, Symtable*> i (*this); i.ok(); i++)
{
- DOUT << "table \'" << i.key() << "\' {\n";
+ DOUT << "table \'" << i.key () << "\' {\n";
i.val()->print ();
DOUT << "}\n";
}
{
for (Assoc_iter<String, Atom> i (*this); i.ok(); i++)
{
- DOUT << "\'" << i.key() << "\'->" << i.val ().str () << "\n";
+ DOUT << "\'" << i.key() << "\'->" << i.val ().str () << '\n';
}
}
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "proto.hh"
#define IPLC_INSTANTIATE(a) POINTERLIST_INSTANTIATE(a)
-IPLC_INSTANTIATE(Score_elem);
+IPLC_INSTANTIATE(Score_element);
IPLC_INSTANTIATE(Spanner);
IPLC_INSTANTIATE(Idealspacing);
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "line-spacer.hh"
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "atom.hh"
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef __CYGWIN32__
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <limits.h>
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "proto.hh"
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "proto.hh"
/*
- tex-beam.cc -- implement Lookup::{beam_element, beam, rule_symbol}
+ tex-beam.cc -- implement Lookup::beam
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
/*
#include "molecule.hh"
#include "tex.hh"
#include "symtable.hh"
-#include "dimen.hh"
+#include "dimension.hh"
#include "debug.hh"
#include "lookup.hh"
#include "misc.hh"
Lookup::ps_beam (Real slope, Real width, Real thick) const
{
String ps = "\\embeddedps{\n";
- ps += String (width) + " "+ String (slope) + " " + String (thick)
+ ps += to_str (width) + " "+ to_str (slope) + " " + to_str (thick)
+ " draw_beam}";
Atom s;
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
Tex_stream::Tex_stream (String filename)
{
- os = new ofstream (filename.ch_C ());
+ if (filename.length_i () && (filename != "-"))
+ os = new ofstream (filename.ch_C ());
+ else
+// os = new ostream (cout.ostreambuf ());
+ os = new ostream (cout._strbuf);
if (!*os)
- error (_("can't open `") + filename+"\'");
+ error (_f ("can't open file: `%s\'", filename));
nest_level = 0;
line_len_i_ = 0;
outputting_comment=false;
void
Tex_stream::header()
{
- *os << _("% Creator: ");
+ *os << _ ("% Creator: ");
if (no_timestamps_global_b)
*os << "GNU LilyPond\n";
else
- *os << get_version_str() << "\n";
- *os << _("% Automatically generated");
+ *os << get_version_str() << '\n';
+ *os << _ ("% Automatically generated");
if (no_timestamps_global_b)
*os << ".\n";
else
{
- *os << _(", at ");
+ *os << _ (", at ");
time_t t (time (0));
*os << ctime (&t) << "%\n";
}
*os << flush;
if (!*os)
{
- warning(_("error syncing file (disk full?)"));
+ warning(_ ("error syncing file (disk full?)"));
exit_status_i_ = 1;
}
delete os;
}
// print string. don't forget indent.
-Tex_stream &
-Tex_stream::operator<<(String s)
+Tex_stream&
+Tex_stream::operator << (Scalar s)
{
-
for (char const *cp = s.ch_C (); *cp; cp++)
{
if (outputting_comment)
Tex_stream::break_line()
{
*os << "%\n";
- *os << String (' ', nest_level);
+ *os << to_str (' ', nest_level);
line_len_i_ = 0;
}
+
source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-#include "dimen.hh"
+#include "dimension.hh"
#include "tex.hh"
#include "atom.hh"
-#include "varray.hh"
+#include "array.hh"
String
vstrut (Real h)
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
return -20;
}
- Interval v = support_height ();
+ Interval v = support_extent ();
// add no extra: fingers should be just above note, no?
return v[dir_];
}
if (dir_<0) // should do something better anyway.
mol_p->translate_axis (-mol_p->extent ().y ().left , Y_AXIS);
- mol_p->translate_axis (y_, Y_AXIS);
+ mol_p->translate_axis (coordinate_offset_f_, Y_AXIS);
+
return mol_p;
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "molecule.hh"
-#include "boxes.hh"
+#include "box.hh"
#include "text-spanner.hh"
#include "text-def.hh"
#include "debug.hh"
tsym.translate (text_off_);
Molecule*output = new Molecule;
- output->add (tsym);
+ output->add_atom (tsym);
return output;
}
}
void
-Text_spanner::do_substitute_dependency (Score_elem* o, Score_elem*n)
+Text_spanner::do_substitute_dependency (Score_element* o, Score_element*n)
{
if (support_span_l_ == o)
- support_span_l_ = (Directional_spanner*) (n?n->spanner():0);
+ support_span_l_ = (Directional_spanner*) (n?n->access_Spanner ():0);
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "translation-property.hh"
Translation_property::do_print () const
{
#ifndef NPRINT
- DOUT << "." << var_str_ << " = " << String(value_);
+ DOUT << "." << var_str_ << " = " << value_;
#endif
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "proto.hh"
#include "dictionary.hh"
#include "debug.hh"
+/*
+ should delete these after exit.
+ */
+
Dictionary<Translator*> *global_translator_dict_p=0;
void
{
if (global_translator_dict_p->elt_b (s))
{
- return (*global_translator_dict_p)[s];
+// return (*global_translator_dict_p)[s];
+ Translator* t = (*global_translator_dict_p)[s];
+ return t;
}
- error (_("Unknown translator `") + s +"\'");
+ error (_f ("unknown translator `%s\'", s));
return 0;
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "music-output-def.hh"
ret = daddy_trans_l_->find_create_translator_l (n,id);
else
{
- warning (_("Can't find or create `") + n + _("' called `") + id + "'\n");
+ warning (_f ("can't find or create `%s\' called `%s\'", n, id));
ret =0;
}
return ret;
void
Translator_group::terminate_translator (Translator*r_l)
{
- DOUT << "Removing " << r_l->name() << " at " << now_moment () << "\n";
+ DOUT << "Removing " << r_l->name() << " at " << now_moment () << '\n';
r_l->removal_processing();
Translator * trans_p =remove_translator_p (r_l);
if (accepts_str_arr_.size())
{
Translator*t = output_def_l ()->find_translator_l (accepts_str_arr_[0]);
+ if (!t)
+ {
+ warning (_f ("can't find or create `%s\'", accepts_str_arr_[0]));
+ t = this;
+ }
Translator_group * g= t->clone ()->group_l ();
add (g);
{
if (id_str_.length_i ())
DOUT << "ID: " << id_str_ ;
- DOUT << " iterators: " << iterator_count_<< "\n";
+ DOUT << " iterators: " << iterator_count_<< '\n';
}
each (&Translator::print);
#endif
{
Translator * t = output_def_l ()->find_translator_l (consists_str_arr_[i]);
if (!t)
- warning (_("Could not find `") +consists_str_arr_[i]+ "'");
+ warning (_f ("can't find `%s\'", consists_str_arr_[i]));
else
add (t->clone ());
}
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
DOUT << "type = " << type_str_;
for (Dictionary_iter<Scalar> i (properties_dict_); i.ok (); i++)
{
- DOUT << i.key () << "=" << i.val () <<"\n";
+ DOUT << i.key () << "=" << i.val () << '\n';
}
do_print ();
DOUT << "}\n";
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "type-swallow-trans.hh"
source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "proto.hh"
void
error_t (String const & s, Time_description const &t_tdes)
{
- String e=s+ " (at t=" + String(t_tdes.bars_i_) + ": " + (t_tdes.whole_in_measure_).str () + ")\n";
+ String e=s+ " (at t=" + to_str (t_tdes.bars_i_) + ": " + (t_tdes.whole_in_measure_).str () + ")\n";
error (e);
}
source file of the LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "word-wrap.hh"
similar to TeX's is in Gourlay_breaking
*/
-Array<Col_hpositions>
+Array<Column_x_positions>
Word_wrap::do_solve() const
{
problem_OK();
PCursor<Paper_column*> curcol (pscore_l_->col_p_list_.top());
- Array<Col_hpositions> breaking;
+ Array<Column_x_positions> breaking;
Line_of_cols breakpoints (find_breaks());
assert (breakpoints.size()>=2);
int line_no_i = 0;
while (break_idx_i < breakpoints.size() -1)
{
- Col_hpositions minimum;
- Col_hpositions current;
+ Column_x_positions minimum;
+ Column_x_positions current;
// do another line
line_no_i ++;
Paper_column *post = breakpoints[break_idx_i]->postbreak_l();
int start_break_idx = break_idx_i;
- current.add (post);
+ current.add_paper_column (post);
curcol++; // skip the breakable.
break_idx_i++;
// add another measure.
while (breakpoints[break_idx_i] != curcol.ptr())
{
- current.add (curcol);
+ current.add_paper_column (curcol);
curcol++;
}
- current.add (breakpoints[break_idx_i]->prebreak_l());
+ current.add_paper_column (breakpoints[break_idx_i]->prebreak_l());
current.spacer_l_ = generate_spacing_problem (current.cols,
pscore_l_->paper_l_->line_dimensions_int (line_no_i));
{
if (!minimum.cols.size())
{
- warning (_("Ugh, this measure is too long, breakpoint: ")
- + String (break_idx_i) +
- _(" (generating stupido solution)"));
+ warning (_ ("ugh, this measure is too long")
+ + ", " + _f ("breakpoint: %d", break_idx_i)
+ + "(" + _ ("generating stupido solution") + ")");
current.stupid_solution();
current.energy_f_ = - 1; // make sure we break out.
}
if (!current.satisfies_constraints_b_ && start_break_idx == break_idx_i - 1)
{
- warning ( _ ("I don't fit. Put me on Montignac"));
+ warning ( _ ("I don't fit; put me on Montignac"));
minimum = current;
break;
}
break_idx_i++;
}
- *mlog << "[" <<break_idx_i<<"]"<<flush;
+ *mlog << "[" << break_idx_i << "]" << flush;
breaking.push (minimum);
}
return breaking;