+2006-01-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * Finish std::string interface. For now, use std:: marker
+ throughout for easy s/r.
+
2006-01-26 Han-Wen Nienhuys <hanwen@xs4all.nl>
* Documentation/user/putting.itely (Score is a single musical
2006-01-25 Jan Nieuwenhuizen <janneke@gnu.org>
+ * GNUmakefile.in (c-clean): New target.
+
* flower/include/std-string.hh: String/std::string compatibility:
Use NPOS for `not found' (iso -1), use ssize for length () and pos
type.
tree-share-prefix = $(tree-share)/lilypond/$(TOPLEVEL_VERSION)
tree-lib-prefix = $(tree-lib)/lilypond/$(TOPLEVEL_VERSION)
+C_DIRS = flower lily
+c-clean:
+ $(foreach i, $(C_DIRS), $(MAKE) -C $(i) clean &&) true
+
src-ext = c cc yy ll hh icc py scm tex ps texi itexi tely itely sh
web-clean:
#endif
#ifdef __CYGWIN__
-static Std_string
-dos_to_posix (Std_string file_name)
+static std::string
+dos_to_posix (std::string file_name)
{
char buf[PATH_MAX] = "";
char *s = file_name.get_copy_str0 ();
#ifdef __MINGW32__
/** Use slash as directory separator. On Windows, they can pretty
much be exchanged. */
-static Std_string
-slashify (Std_string file_name)
+static std::string
+slashify (std::string file_name)
{
file_name.substitute ('\\', '/');
file_name.substitute ("//", "/");
#endif /* __MINGW32__ */
/* Join components to full file_name. */
-Std_string
+std::string
File_name::to_string () const
{
- Std_string s;
+ std::string s;
if (!root_.empty ())
- s = root_ + ::to_std_string (ROOTSEP);
+ s = root_ + std::to_string (ROOTSEP);
if (!dir_.empty ())
{
s += dir_;
if (!base_.empty () || !ext_.empty ())
- s += ::to_std_string (DIRSEP);
+ s += std::to_string (DIRSEP);
}
s += base_;
if (!ext_.empty ())
- s += ::to_std_string (EXTSEP) + ext_;
+ s += std::to_string (EXTSEP) + ext_;
return s;
}
-File_name::File_name (Std_string file_name)
+File_name::File_name (std::string file_name)
{
#ifdef __CYGWIN__
/* All system functions would work, even if we do not convert to
file_name = slashify (file_name);
#endif
- int i = file_name.find (ROOTSEP);
+ ssize i = file_name.find (ROOTSEP);
if (i != NPOS)
{
root_ = file_name.substr (0, i);
#if 0 //STD_STRING
File_name::File_name (String file_name)
{
- *this = File_name (Std_string (file_name));
+ *this = File_name (std::string (file_name));
}
#endif
#include "file-path.hh"
+#include "std-string.hh"
+
#include <cstdio>
#include <cerrno>
using namespace std;
#define PATHSEP ':'
#endif
-Array<Std_string>
+Array<std::string>
File_path::directories () const
{
return dirs_;
}
+#include <algorithm>
void
-File_path::parse_path (Std_string p)
+File_path::parse_path (std::string p)
{
- int len;
+ ssize len;
while ((len = p.length ()))
{
- int i = p.find (PATHSEP);
+ ssize i = p.find (PATHSEP);
if (i == NPOS)
i = len;
append (p.substr (0, i));
- p = p.substr (min (int(len), i + 1));
+ //p = p.substr (min (len, i + 1));
+ //ssize x = min (len, i + 1);
+ ssize a = len;
+ ssize b = i + 1;
+ ssize x = std::max (a, b);
+ p = p.substr (x);
}
}
bool
-is_file (Std_string file_name)
+is_file (std::string file_name)
{
#if 0 /* Check if directory. TODO: encapsulate for autoconf */
struct stat sbuf;
}
bool
-is_dir (Std_string file_name)
+is_dir (std::string file_name)
{
#if !STAT_MACROS_BROKEN
struct stat sbuf;
@return
The file name if found, or empty string if not found. */
-Std_string
-File_path::find (Std_string name) const
+std::string
+File_path::find (std::string name) const
{
if (!name.length () || (name == "-"))
return name;
for (int i = 0; i < dirs_.size (); i++)
{
File_name file_name (name);
- File_name dir = (Std_string) dirs_[i];
+ File_name dir = (std::string) dirs_[i];
file_name.root_ = dir.root_;
dir.root_ = "";
if (file_name.dir_.empty ())
file_name.dir_ = dir.to_string ();
else if (!dir.to_string ().empty ())
file_name.dir_ = dir.to_string ()
- + ::to_string (DIRSEP) + file_name.dir_;
+ + std::to_string (DIRSEP) + file_name.dir_;
if (is_file (file_name.to_string ()))
return file_name.to_string ();
}
where EXT is from EXTENSIONS.
*/
-Std_string
-File_path::find (Std_string name, char const *extensions[])
+std::string
+File_path::find (std::string name, char const *extensions[])
{
if (name.empty () || name == "-")
return name;
File_name file_name (name);
- Std_string orig_ext = file_name.ext_;
+ std::string orig_ext = file_name.ext_;
for (int i = 0; extensions[i]; i++)
{
file_name.ext_ = orig_ext;
if (*extensions[i] && !file_name.ext_.empty ())
file_name.ext_ += ".";
file_name.ext_ += extensions[i];
- Std_string found = find (file_name.to_string ());
+ std::string found = find (file_name.to_string ());
if (!found.empty ())
return found;
}
/** Append a directory, return false if failed. */
bool
-File_path::try_append (Std_string s)
+File_path::try_append (std::string s)
{
if (s == "")
s = ".";
return false;
}
-Std_string
+std::string
File_path::to_string () const
{
- Std_string s;
+ std::string s;
for (int i = 0; i < dirs_.size (); i++)
{
s = s + dirs_[i];
if (i < dirs_.size () - 1)
- s += ::to_string (PATHSEP);
+ s += std::to_string (PATHSEP);
}
return s;
}
void
-File_path::append (Std_string str)
+File_path::append (std::string str)
{
dirs_.push (str);
}
void
-File_path::prepend (Std_string str)
+File_path::prepend (std::string str)
{
dirs_.insert (str, 0);
}
#include <cstdlib>
#include "config.hh"
-#include "string.hh"
+#include "international.hh"
+#include "std-string.hh"
#if !HAVE_GETTEXT
inline char *
return found_option_;
}
-Std_string
+std::string
Long_option_init::to_string () const
{
- Std_string str;
+ std::string str;
if (shortname_char_)
str += "-" + shortname_char_;
if (shortname_char_ && longname_str0_)
str += ", ";
if (longname_str0_)
- str += Std_string ("`--") + longname_str0_ + "'";
+ str += std::string ("`--") + longname_str0_ + "'";
return str;
}
-Std_string
+std::string
Long_option_init::str_for_help () const
{
- Std_string s;
+ std::string s;
if (shortname_char_)
- s = "-" + ::to_string (shortname_char_);
+ s = "-" + std::to_string (shortname_char_);
else
s = " ";
if (!error_out_)
return;
- Std_string str = arg_value_char_a_a_[0];
+ std::string str = arg_value_char_a_a_[0];
str += ": ";
switch (c)
{
break;
case E_UNKNOWNOPTION:
str += _f ("unrecognized option: `%s'",
- Std_string (argument_index_
- ? Std_string ("-" + Std_string (1, arg_value_char_a_a_[array_index_][argument_index_]))
- : Std_string (arg_value_char_a_a_[array_index_])));
+ std::string (argument_index_
+ ? std::string ("-" + std::string (1, arg_value_char_a_a_[array_index_][argument_index_]))
+ : std::string (arg_value_char_a_a_[array_index_])));
break;
case E_ILLEGALARG:
str += _f ("invalid argument `%s' to option `%s'",
const int EXTRA_SPACES = 5;
-Std_string
+std::string
Long_option_init::table_string (Long_option_init *l)
{
- Std_string tabstr = "";
+ std::string tabstr = "";
int wid = 0;
for (int i = 0; l[i].shortname_char_ || l[i].longname_str0_; i++)
- wid = max (wid, int(l[i].str_for_help ().length ()));
+ wid = std::max (int(wid), int(l[i].str_for_help ().length ()));
for (int i = 0; l[i].shortname_char_ || l[i].longname_str0_; i++)
{
- Std_string s = " " + l[i].str_for_help ();
- s += Std_string (wid - s.length () + EXTRA_SPACES, ' ');
+ std::string s = " " + l[i].str_for_help ();
+ s += std::string (wid - s.length () + EXTRA_SPACES, ' ');
- Std_string help_text (gettext (l[i].help_str0_));
+ std::string help_text (gettext (l[i].help_str0_));
replace_all (help_text, "\n",
- "\n" + Std_string (wid + EXTRA_SPACES + 2, ' '));
+ "\n" + std::string (wid + EXTRA_SPACES + 2, ' '));
tabstr += s + help_text + "\n";
}
class File_name
{
public:
- Std_string root_;
- Std_string dir_;
- Std_string base_;
- Std_string ext_;
+ std::string root_;
+ std::string dir_;
+ std::string base_;
+ std::string ext_;
- File_name (Std_string);
+ File_name (std::string);
#if 0// STD_STRING
File_name (String);
#endif
bool is_absolute () const;
- Std_string to_string () const;
+ std::string to_string () const;
};
#endif /* FILE_NAME */
class File_path
{
- Array<Std_string> dirs_;
+ Array<std::string> dirs_;
public:
- Array<Std_string> directories () const;
- Std_string find (Std_string name) const;
- Std_string find (Std_string name, char const *extensions[]);
- Std_string to_string () const;
- bool try_append (Std_string str);
- void append (Std_string str);
- void parse_path (Std_string);
- void prepend (Std_string str);
+ Array<std::string> directories () const;
+ std::string find (std::string name) const;
+ std::string find (std::string name, char const *extensions[]);
+ std::string to_string () const;
+ bool try_append (std::string str);
+ void append (std::string str);
+ void parse_path (std::string);
+ void prepend (std::string str);
};
-bool is_file (Std_string file_name);
-bool is_dir (Std_string file_name);
+bool is_file (std::string file_name);
+bool is_dir (std::string file_name);
#endif /* FILE_PATH */
template<class T> struct Interval_t;
template<class T> struct PQueue;
+typedef unsigned char Byte;
+namespace std {
+ struct String_data;
+ struct String_handle;
+ //struct String;
+}
+struct String_convert;
+
+#include "std-string.hh"
#include "real.hh"
typedef Interval_t<Real> Interval;
class File_name;
class File_path;
struct Getopt_long;
-struct String_data;
-struct String_handle;
-struct String_convert;
-struct String;
struct Text_stream;
struct Data_file;
typedef int I32;
typedef long long I64;
-typedef unsigned char Byte;
struct Duration;
struct Duration_iterator;
char const *help_str0_;
- Std_string to_string () const;
- Std_string str_for_help () const;
+ std::string to_string () const;
+ std::string str_for_help () const;
// NO constructor!
static int compare (Long_option_init const &, Long_option_init const &);
- static Std_string table_string (Long_option_init *);
+ static std::string table_string (Long_option_init *);
};
/** C++ for version of long_getopt. For processing GNU style command
/**
Internationalisation: _ ("to be translated") gets "translated" by GNU gettext
*/
-Std_string _ (char const *ch);
+std::string _ (char const *ch);
/**
Internationalisation: _f ("Usage: %s [FILE]", "lilypond") gets "translated" by
GNU gettext
*/
-Std_string _f (char const *format, ...);
-Std_string _f (char const *format, Std_string s, Std_string s2 = "", Std_string s3 = "");
+std::string _f (char const *format, ...);
+std::string _f (char const *format, std::string s, std::string s2 = "", std::string s3 = "");
#endif // INTERNATIONAL_HH
Drul_array<T>::elem_ref;
static T infinity ();
- static Std_string T_to_string (T arg);
+ static std::string T_to_string (T arg);
T center () const;
void translate (T t)
{
Drul_array<Real> da (elem (LEFT), elem (RIGHT));
return ::linear_combination (da, x);
}
- Std_string to_string () const;
+ std::string to_string () const;
bool contains (T r) const;
void negate ()
#include <cassert>
#include "interval.hh"
-#include "string.hh"
+#include "std-string.hh"
// MacOS 10.3 problems:
// #include <cmath>
}
template<class T>
-Std_string
+std::string
Interval_t<T>::to_string () const
{
if (is_empty ())
return "[empty]";
- Std_string s ("[");
+ std::string s ("[");
- return (s + T_to_string (elem (LEFT)) + Std_string (",")
- + T_to_string (elem (RIGHT)) + Std_string ("]"));
+ return (s + T_to_string (elem (LEFT)) + std::string (",")
+ + T_to_string (elem (RIGHT)) + std::string ("]"));
}
template<class T>
#include "axis.hh"
#include "std-string.hh"
-#include "string.hh"
#include "real.hh"
class Offset;
coordinate_a_[X_AXIS] = coordinate_a_[Y_AXIS] = 0.0;
}
- Std_string to_string () const;
+ std::string to_string () const;
Offset &mirror (Axis a)
{
}
};
+#include "arithmetic-operator.hh"
IMPLEMENT_ARITHMETIC_OPERATOR (Offset, +);
IMPLEMENT_ARITHMETIC_OPERATOR (Offset, -);
IMPLEMENT_ARITHMETIC_OPERATOR (Offset, *);
#include "std-string.hh"
-#include "string.hh"
+#include "std-string.hh"
/**
Rational numbers. Included is support for + and - infinity.
Rational &operator %= (Rational);
static int compare (Rational const &, Rational const &);
int sign () const;
- Std_string to_string () const;
+ std::string to_string () const;
};
+#include "arithmetic-operator.hh"
IMPLEMENT_ARITHMETIC_OPERATOR (Rational, /);
IMPLEMENT_ARITHMETIC_OPERATOR (Rational, +);
IMPLEMENT_ARITHMETIC_OPERATOR (Rational, *);
/*
- std-string.hh -- declare Std_string
+ std-string.hh -- declare std::string
source file of the GNU LilyPond music typesetter
#if !STD_STRING
-#define Std_string String
-#define to_std_string to_string
-class String;
-typedef int ssize;
-#define NPOS -1
+/* Also declare string, in the wrong way. */
+#include <algorithm>
+#include <iostream>
+#include <sstream>
+
+#endif
-#include "string.hh"
-#else
+#include "compare.hh"
+
+#if STD_STRING
#include <string>
-// #warning Using std::string
-using namespace std;
-typedef size_t ssize;
+#endif
-#define NPOS std::string::npos
+#if STD_STRING
namespace std {
-#if 0
- class Std_string : public string
- {
- public:
- Std_string ();
- Std_string (char const*);
- Std_string (Std_string const&, int pos, int n=npos);
- ///Std_string (String const&, int pos, int n);
- ////Std_string (String const &);
- ////operator String ();
- };
-#else
- typedef string Std_string;
-#endif
+ typedef size_t ssize;
+#define NPOS std::string::npos
+ // typedef string std::string;
+}
- //operator Std_string (String const&);
+#else /* ! STD_STRING */
- Std_string to_std_string (Std_string s);
- Std_string to_std_string (char c, int n = 1);
- Std_string to_std_string (int i, char const *format = 0);
- Std_string to_std_string (double f, char const *format = 0);
- Std_string to_std_string (long b);
- Std_string to_std_string (bool b);
- Std_string to_std_string (char const *format, ...);
+namespace std {
+
+#define string String
+ using namespace std;
+ class String;
+ typedef int ssize;
+#define NPOS -1
+}
+
+#include "string.hh"
#endif /* STD_STRING */
- Std_string &replace_all (Std_string &str, Std_string find, Std_string replace);
-#if STD_STRING
-}
-#endif
+namespace std {
+
+ std::string to_string (std::string s);
+ std::string to_string (char c, int n = 1);
+ std::string to_string (int i, char const *format = 0);
+ std::string to_string (double f, char const *format = 0);
+ std::string to_string (long b);
+ std::string to_string (bool b);
+ std::string to_string (char const *format, ...);
+
+ std::string &replace_all (std::string &str, std::string find, std::string replace);
+ std::string &replace_all (std::string &str, char find, char replace);
+ char *string_copy (std::string s);
+ int string_compare (std::string const &, std::string const &);
+ INSTANTIATE_COMPARE (std::string const &, string_compare);
+}
#endif /* STD_STRING_HH */
using namespace std;
#include "std-string.hh"
-#include "string.hh"
+#include "flower-proto.hh"
-/** The functor Std_string_convert handles all conversions to/from Std_string
+/** The functor std::string_convert handles all conversions to/from std::string
(some time, anyway). The class is quite empty from data view. */
class String_convert
{
- static int hex2bin (Std_string hex_string, Std_string &bin_string_r);
+ static int hex2bin (std::string hex_string, std::string &bin_string_r);
static int hex2nibble (Byte byte);
static Byte nibble2hex_byte (Byte byte);
public:
- static Std_string pad_to (Std_string s, int length);
- static Std_string bool_string (bool b);
- static Std_string bin2dec (Std_string bin_string);
- static Std_string bin2hex (Std_string bin_string);
- static Std_string dec2bin (Std_string str);
- static int bin2int (Std_string bin_string);
- static unsigned bin2unsigned (Std_string bin_string);
- static Std_string char_string (char c, int n);
- static int dec2int (Std_string dec_string);
- static double dec2double (Std_string dec_string);
- static Std_string double_string (double f, char const *fmt = 0);
- static Std_string form_string (char const *format, ...);
- static Std_string vform_string (char const *format, va_list args);
- static int hex2int (Std_string str);
- static unsigned hex2unsigned (Std_string str);
- static Std_string hex2bin (Std_string str);
- static Std_string int_string (int i, char const *fmt = 0);
- static Std_string long_string (long);
- static Std_string int2hex (int i, int length_i, char ch);
- static Std_string unsigned2hex (unsigned u, ssize length, char ch);
- static Std_string int2dec (int i, int length_i, char ch);
- static Std_string rational_string (Rational);
- static Std_string pointer_string (void const *);
- static Std_string precision_string (double x, int n);
- static Array<Std_string> split (Std_string str, char c);
- static Std_string i64_string (I64, char const *fmt = 0);
+ static std::string pad_to (std::string s, int length);
+ static std::string bool_string (bool b);
+ static std::string bin2dec (std::string bin_string);
+ static std::string bin2hex (std::string bin_string);
+ static std::string dec2bin (std::string str);
+ static int bin2int (std::string bin_string);
+ static unsigned bin2unsigned (std::string bin_string);
+ static std::string char_string (char c, int n);
+ static int dec2int (std::string dec_string);
+ static double dec2double (std::string dec_string);
+ static std::string double_string (double f, char const *fmt = 0);
+ static std::string form_string (char const *format, ...);
+ static std::string vform_string (char const *format, va_list args);
+ static int hex2int (std::string str);
+ static unsigned hex2unsigned (std::string str);
+ static std::string hex2bin (std::string str);
+ static std::string int_string (int i, char const *fmt = 0);
+ static std::string long_string (long);
+ static std::string int2hex (int i, int length_i, char ch);
+ static std::string unsigned2hex (unsigned u, ssize length, char ch);
+ static std::string int2dec (int i, int length_i, char ch);
+ static std::string rational_string (Rational);
+ static std::string pointer_string (void const *);
+ static std::string precision_string (double x, int n);
+ static Array<std::string> split (std::string str, char c);
+ static std::string i64_string (I64, char const *fmt = 0);
+ static std::string to_lower (std::string s);
+ static std::string to_upper (std::string s);
+ static std::string reverse (std::string s);
};
#endif // __STRING_CONVERT_HH //
#include "flower-proto.hh"
+namespace std {
+
/**Internal String struct.
the data itself. Handles simple tasks (resizing, resetting)
*/
void operator += (char const *str0);
char const *c_str () const;
-
- char *get_str0 ();
+
+ char *get_c_str ();
Byte const *to_bytes () const;
bool is_binary_bo () const;
};
+}
+
#ifdef STRING_UTILS_INLINED
#ifndef INLINE
#define INLINE inline
#include "string-data.hh"
-#include <algorithm>
+//#include <algorithm>
#include <cassert>
#include <cstring>
#include <memory>
#include <sys/types.h>
+namespace std {
+
INLINE void
String_data::OKW ()
{
return (char const *)data_byte_;
}
INLINE char *
-String_data::get_str0 ()
+String_data::get_c_str ()
{
return (char *)data_byte_;
}
return data_byte_[j];
}
+}
+
#endif // __STRING_UTIL_CC //
#include "flower-proto.hh"
+namespace std {
/**
Reference counting for strings.
Byte const *to_bytes () const;
char const *c_str () const;
Byte *get_bytes ();
- char *get_str0 ();
+ char *get_c_str ();
bool is_binary_bo () const;
void operator = (String_handle const &src);
void operator += (char const *s);
int length () const;
};
+}
+
#ifdef STRING_UTILS_INLINED
#ifndef INLINE
#define INLINE inline
#include "string-data.hh"
#include "string-handle.hh"
+namespace std {
+
INLINE void
String_handle::down ()
{
}
INLINE char *
-String_handle::get_str0 ()
+String_handle::get_c_str ()
{
copy ();
return (char *)data->get_bytes ();
return data->is_binary_bo ();
}
+}
+
#endif
introduced Class String_handle
*/
+#ifndef STD_STRING_HH
+#error string.hh is obsolete, use std-string.hh
+#endif
+
#ifndef STRING_HH
#define STRING_HH
#endif
#endif
-#include "std-string.hh"
#include "arithmetic-operator.hh"
#include "string-handle.hh"
-/**
-
-Intuitive string class. provides
-\begin{itemize}
-\item
-ref counting through #String_handle#
-\item
-conversion from bool, int, double, char* , char.
-\item
-to be moved to String_convert:
-conversion to int, upcase, downcase
-
-\item
-printable.
-
-\item
-indexing (index_i, index_any_i, last_index_i)
+namespace std {
-\item
-cutting (left_string, right_string, mid_string)
-
-\item
-concat (+=, +)
-
-\item
-signed comparison (<, >, ==, etc)
-
-\item
-No operator[] is provided, since this would be enormously slow. If needed,
-convert to char const* .
-\end{itemize}
-*/
class String
{
public:
-#if STD_STRING
- String (Std_string const &);
- operator Std_string () const;
-#endif /* STD_STRING */
+ /* partial std::string interface */
+ String ();
+ String (int n, char c);
+ String (char const *source);
+ String (char const *, int n);
+ String (String const &, int pos, ssize n=NPOS);
+
+ String &operator = (String const &source);
+ /// concatenate s
+ void operator += (char const *s) { strh_ += s; }
+ void operator += (String s);
+ char &operator [] (int n);
+ char operator [] (int n) const;
+
- /* std::string interface */
char const *c_str () const;
char const *data () const;
bool empty () const;
- int find (String &s, int pos=0) const;
- int find (char c) const;
+ int find (String s, int pos=0) const;
+ int find (char c, int pos=0) const;
+ int find (char const *c, int pos=0) const;
int rfind (char c) const;
String replace (int pos, int n, String str);
- String substr (int pos=0, int n=NPOS) const;
+ String substr (int pos=0, ssize n=NPOS) const;
+ int compare (String const &s) const;
- //String (String const &, int pos, int n=NPOS);
- String (int n, char c);
+ void append (String);
+ int length () const;
+
+ String insert (ssize pos, String);
+ ssize copy (char *s, ssize n, ssize pos=0) const;
protected:
String_handle strh_;
bool null_terminated ();
-public:
-
- /** init to empty string. This is needed because other
- constructors are provided.*/
- String ();
-
- /// String s = "abc";
- String (char const *source);
- String (Byte const *byte, int length_i);
-
+private:
/// return "new"-ed copy of contents
Byte *get_copy_byte () const;
char *get_copy_str0 () const;
Byte const *to_bytes () const;
- char *get_str0 ();
Byte *get_bytes ();
- String &operator = (String const &source);
-
- /// concatenate s
- void operator += (char const *s) { strh_ += s; }
- void operator += (String s);
-
- void append (String);
void prepend (String);
- /**
- Return a char. UNSAFE because it may change strlen () result
- */
- char &operator [] (int n);
- char operator [] (int n) const;
-
/// return n leftmost chars
String left_string (int n) const;
/// return n rightmost chars
String right_string (int n) const;
- /// return the "esrever" of *this
- void reverse ();
-
/// return a piece starting at index (first char = index_i 0), length n
String cut_string (int index_i, int n) const;
/// cut out a middle piece, return remainder
String nomid_string (int index_i, int n) const;
- /// signed comparison, analogous to memcmp;
static int compare (String const &s1, const String &s2);
/// index of rightmost character C in string
int index_any (String) const;
- void to_upper ();
- void to_lower ();
-
#ifdef STREAM_SUPPORT
/// provide Stream output
void print_on (ostream &os) const;
#endif
- /// the length of the string
- int length () const;
-
/// convert to an integer
int to_int () const;
String substitute (char find, char replace);
};
-/*
- better to clutter global namespace, than suffer *ugh, ugh, ugh*
- implicit conversions.
-
- it might be cool to have no type-checking at all in a language,
- but once there is, having this silently circumvented is a nightmare.
-
- whenever implicit conversions seem necessary (e.g. operator << ()),
- use Scalar as the generic type iso String.
-*/
-
-/// for completeness (=handy)
-String to_string (String s);
-String to_string (char c, int n = 1);
-String to_string (int i, char const *format = 0);
-String to_string (double f, char const *format = 0);
-String to_string (long b);
-String to_string (bool b);
-String to_string (char const *format, ...);
-
-/*
- technically incorrect, but lets keep it here: this is a
- catch all place for this stuff.
-*/
-
-#include "international.hh"
-#include "compare.hh"
-
-INSTANTIATE_COMPARE (String const &, String::compare);
-
#ifdef STRING_UTILS_INLINED
#ifndef INLINE
#define INLINE inline
ostream &operator << (ostream &os, String d);
#endif
-#endif
+}
+
+/*
+ technically incorrect, but lets keep it here: this is a
+ catch all place for this stuff.
+*/
+#include "international.hh"
+
+
+#endif /* STRING_HH */
#ifndef STRING_ICC
#define STRING_ICC
-/// for completeness (=handy)
-INLINE
-String
-to_string (String s)
-{
- return s;
-}
+namespace std {
INLINE
char const *
strh_ = source;
}
+}
+
#endif /* STRING_ICC */
#ifndef WARN_HH
#define WARN_HH
-#include "string.hh"
+#include "std-string.hh"
-void error (String s);
-void message (String s);
-void non_fatal_error (String);
-void programming_error (String s);
-void progress_indication (String s);
-void warning (String s);
+void error (std::string s);
+void message (std::string s);
+void non_fatal_error (std::string);
+void programming_error (std::string s);
+void progress_indication (std::string s);
+void warning (std::string s);
#endif /* WARN_HH */
*/
#include "config.hh"
+
+#include "international.hh"
#include "string-convert.hh"
#if !HAVE_GETTEXT
#include <libintl.h>
#endif
-Std_string
+std::string
_ (char const *ch)
{
- return Std_string (gettext (ch));
+ return std::string (gettext (ch));
}
-Std_string
+std::string
_f (char const *format, ...)
{
va_list args;
va_start (args, format);
- Std_string str = String_convert::vform_string (gettext (format), args);
+ std::string str = String_convert::vform_string (gettext (format), args);
va_end (args);
return str;
}
-Std_string
-_f (char const *format, Std_string s, Std_string s2, Std_string s3)
+std::string
+_f (char const *format, std::string s, std::string s2, std::string s3)
{
return String_convert::form_string (gettext (format), s.c_str (), s2.c_str (),
s3.c_str ());
}
template<>
-Std_string
+std::string
Interval_t<Real>::T_to_string (Real r)
{
- return ::to_string (r);
+ return std::to_string (r);
}
template<>
}
template<>
-Std_string
+std::string
Interval_t<int>::T_to_string (int i)
{
- return ::to_string (i);
+ return std::to_string (i);
}
template INTERVAL__INSTANTIATE (int);
#ifndef STANDALONE
-Std_string
+std::string
Offset::to_string () const
{
- Std_string s;
- s = Std_string (" (") + ::to_string (coordinate_a_[X_AXIS]) + ", "
- + ::to_string (coordinate_a_[Y_AXIS]) + ")";
+ std::string s;
+ s = std::string (" (") + std::to_string (coordinate_a_[X_AXIS]) + ", "
+ + std::to_string (coordinate_a_[Y_AXIS]) + ")";
return s;
}
#endif
return (*this += r);
}
-Std_string
+std::string
Rational::to_string () const
{
if (is_infinity ())
{
- Std_string s (sign_ > 0 ? "" : "-");
- return Std_string (s + "infinity");
+ std::string s (sign_ > 0 ? "" : "-");
+ return std::string (s + "infinity");
}
- Std_string s = ::to_string (num ());
+ std::string s = std::to_string (num ());
if (den () != 1 && num ())
- s += "/" + ::to_string (den ());
+ s += "/" + std::to_string (den ());
return s;
}
/*
- std-tring.cc -- implement external interface for Std_String
+ std-string.cc -- implement external interface for Std_String
source file of the GNU LilyPond music typesetter
*/
#include "std-string.hh"
+#include "string-convert.hh"
#if STD_STRING
-
namespace std {
- Std_string
- to_std_string (char c, int n)
+#endif
+
+ std::string
+ to_string (std::string s)
{
- /* FIXME, remove this function and use std::string interface for
- String? This interface is a bit clumsy, almost alway you want
- n=1. */
- return Std_string (n, c);
+ return s;
}
-#else /* !STD_STRING */
+ std::string
+ to_string (char c, int n)
+ {
+ return std::string (n, c);
+ }
-#endif /* STD_STRING */
+ std::string
+ to_string (double f, char const *format)
+ {
+ return String_convert::double_string (f, format);
+ }
-Std_string &
-replace_all (Std_string &str, Std_string find, Std_string replace)
-{
- ssize len = find.length ();
- for (ssize i = str.find (find); i != NPOS; i = str.find (find, i + len))
- str = str.replace (i, len, replace);
- return str;
-}
+ std::string
+ to_string (int i, char const *format)
+ {
+ return String_convert::int_string (i, format);
+ }
+
+ std::string
+ to_string (bool b)
+ {
+ return String_convert::bool_string (b);
+ }
+
+ std::string
+ to_string (long b)
+ {
+ return String_convert::long_string (b);
+ }
+
+ std::string
+ to_string (char const *format, ...)
+ {
+ va_list args;
+ va_start (args, format);
+ std::string str = String_convert::vform_string (format, args);
+ va_end (args);
+ return str;
+ }
+
+ std::string &
+ replace_all (std::string &str, std::string find, std::string replace)
+ {
+ ssize len = find.length ();
+ for (ssize i = str.find (find); i != NPOS; i = str.find (find, i + len))
+ str = str.replace (i, len, replace);
+ return str;
+ }
+
+ std::string &
+ replace_all (std::string &str, char find, char replace)
+ {
+ for (ssize i = str.find (find); i != NPOS; i = str.find (find, i + 1))
+ str[i] = replace;
+ return str;
+ }
+
+ char *
+ string_copy (std::string s)
+ {
+ ssize len = s.length ();
+ char *dest = new char[len + 1];
+ //s.copy (dest, len + 1);
+ memcpy (dest, s.c_str (), len + 1);
+ return dest;
+ }
+
+ int
+ string_compare (std::string const &a, std::string const &b)
+ {
+ return a.compare (b);
+ }
#if STD_STRING
}
+
#endif
#include "string-convert.hh"
+#include <publib.h>
#include <cstring>
#include <cstdio>
using namespace std;
*/
static const int STRING_BUFFER_LEN = 1024;
-Std_string
+std::string
String_convert::bool_string (bool b)
{
- return Std_string (b ? "true" : "false");
+ return std::string (b ? "true" : "false");
}
-Std_string
-String_convert::bin2hex (Std_string bin_string)
+std::string
+String_convert::bin2hex (std::string bin_string)
{
- Std_string str;
+ std::string str;
Byte const *byte = (Byte const*)bin_string.data ();
for (ssize i = 0; i < bin_string.length (); i++)
{
}
int
-String_convert::bin2int (Std_string bin_string)
+String_convert::bin2int (std::string bin_string)
{
return bin2unsigned (bin_string);
}
unsigned
-String_convert::bin2unsigned (Std_string bin_string)
+String_convert::bin2unsigned (std::string bin_string)
{
assert (bin_string.length () <= (int)sizeof (unsigned));
return result_u;
}
-// breendet imp from Std_string
+// breendet imp from std::string
int
-String_convert::dec2int (Std_string dec_string)
+String_convert::dec2int (std::string dec_string)
{
if (!dec_string.length ())
return 0;
return (int)l;
}
-Std_string
+std::string
String_convert::i64_string (I64 i64, char const *fmt)
{
char buffer[STRING_BUFFER_LEN];
snprintf (buffer, STRING_BUFFER_LEN,
(fmt ? fmt : "%Ld"), i64); // assume radix 10
- return Std_string (buffer);
+ return std::string (buffer);
}
-// breendet imp from Std_string
+// breendet imp from std::string
double
-String_convert::dec2double (Std_string dec_string)
+String_convert::dec2double (std::string dec_string)
{
if (!dec_string.length ())
return 0;
}
int
-String_convert::hex2bin (Std_string hex_string, Std_string &bin_string_r)
+String_convert::hex2bin (std::string hex_string, std::string &bin_string_r)
{
if (hex_string.length () % 2)
hex_string = "0" + hex_string;
return 0;
}
-Std_string
-String_convert::hex2bin (Std_string hex_string)
+std::string
+String_convert::hex2bin (std::string hex_string)
{
- Std_string str;
+ std::string str;
// silly, asserts should alway be "on"!
// assert (!hex2bin (hex_string, str) );
int error_i = hex2bin (hex_string, str);
}
// stupido. Should use int_string ()
-Std_string
+std::string
String_convert::int2dec (int i, int length_i, char ch)
{
char fill_char = ch;
fill_char = '0';
// ugh
- Std_string dec_string = to_string (i);
+ std::string dec_string = to_string (i);
// ugh
return to_string (fill_char, length_i - dec_string.length ()) + dec_string;
}
// stupido. Should use int_string ()
-Std_string
+std::string
String_convert::unsigned2hex (unsigned u, ssize length, char fill_char)
{
- Std_string str;
+ std::string str;
if (!u)
str = "0";
return str;
}
-Std_string
+std::string
String_convert::int2hex (int i, int length_i, char fill_char)
{
return unsigned2hex ((unsigned)i, length_i, fill_char);
@param
#fmt# is a printf style format, default assumes "%d" as format.
*/
-Std_string
+std::string
String_convert::int_string (int i, char const *fmt)
{
char buffer[STRING_BUFFER_LEN];
snprintf (buffer, STRING_BUFFER_LEN,
(fmt ? fmt : "%d"), i); // assume radix 10
- return Std_string (buffer);
+ return std::string (buffer);
}
-Std_string
+std::string
String_convert::form_string (char const *format, ...)
{
va_list args;
char buffer[STRING_BUFFER_LEN];
vsnprintf (buffer, STRING_BUFFER_LEN, format, args);
va_end (args);
- return Std_string (buffer);
+ return std::string (buffer);
}
-Std_string
+std::string
String_convert::vform_string (char const *format, va_list args)
{
char buffer[STRING_BUFFER_LEN];
vsnprintf (buffer, STRING_BUFFER_LEN, format, args);
- return Std_string (buffer);
+ return std::string (buffer);
}
/**
@param #fmt# is a printf style format, default assumes "%lf" as format
*/
-Std_string
+std::string
String_convert::double_string (double f, char const *fmt)
{
char buf[STRING_BUFFER_LEN];
snprintf (buf, STRING_BUFFER_LEN, fmt ? fmt : "%f", f);
- return Std_string (buf);
+ return std::string (buf);
}
/**
@param
#n# is a repetition count, default value is 1
*/
-Std_string
+std::string
String_convert::char_string (char c, int n)
{
n = n >= 0 ? n : 0;
char *ch = new char[ n ];
memset (ch, c, n);
#if STD_STRING
- Std_string s (ch, n);
+ std::string s (ch, n);
#else
- Std_string s ((Byte*) ch, n);
+ std::string s (ch, n);
#endif
delete[] ch;
return s;
}
-Std_string
+std::string
String_convert::rational_string (Rational r)
{
return r.to_string ();
}
-Std_string
+std::string
String_convert::pointer_string (void const *l)
{
char buffer[STRING_BUFFER_LEN];
snprintf (buffer, STRING_BUFFER_LEN, "%p", l); // assume radix 10
- return Std_string (buffer);
+ return std::string (buffer);
}
/**
@param
#n# is the number of nonzero digits
*/
-Std_string
+std::string
String_convert::precision_string (double x, int n)
{
- Std_string format = "%." + to_string (max (0, n - 1)) + "e";
- Std_string str = double_string (abs (x), format.c_str ());
+ std::string format = "%." + to_string (max (0, n - 1)) + "e";
+ std::string str = double_string (abs (x), format.c_str ());
int exp = dec2int (str.substr (str.length () - 3));
str = str.substr (0, str.length () - 4);
return (sign (x) > 0 ? str : "-" + str);
}
-Array<Std_string>
-String_convert::split (Std_string str, char c)
+Array<std::string>
+String_convert::split (std::string str, char c)
{
- Array<Std_string> a;
+ Array<std::string> a;
ssize i = str.find (c);
while (i != NPOS)
{
- Std_string s = str.substr (0, i);
+ std::string s = str.substr (0, i);
a.push (s);
while (str[++i] == c)
;
return a;
}
-Std_string
+std::string
String_convert::long_string (long l)
{
char s[STRING_BUFFER_LEN];
return s;
}
-Std_string
-String_convert::pad_to (Std_string s, int n)
+std::string
+String_convert::pad_to (std::string s, int n)
{
- return s + Std_string (max (int(n - s.length ()), 0), ' ');
+ return s + std::string (max (int(n - s.length ()), 0), ' ');
+}
+
+std::string
+String_convert::to_upper (std::string s)
+{
+ return strnupr ((char *)s.c_str (), s.length ());
+}
+
+std::string
+String_convert::to_lower (std::string s)
+{
+ return strnlwr ((char *)s.c_str (), s.length ());
+}
+
+std::string
+String_convert::reverse (std::string s)
+{
+ return (char*) memrev ((unsigned char *)s.data (), s.length ());
}
(c) 1997--2006 Han-Wen Nienhuys & Jan Nieuwenhuizen
*/
+#if !STD_STRING
#ifndef _GNU_SOURCE // we want memmem
#define _GNU_SOURCE
#endif
-#include "string.hh"
+#include "std-string.hh"
#include <cstdlib>
#include <cstdio>
#include <cassert>
#include <cstring>
-#include <iostream>
using namespace std;
#include "libc-extension.hh"
#include "string-convert.hh"
-/* std::string conversion helpers */
-
-#if STD_STRING
+/* std::string interface */
-#include "std-string.hh"
+namespace std {
-String::String (Std_string const &s)
+String::String (char const *s, int n)
{
- *this = String (s.c_str ());
+ strh_.set ((Byte const *)s, n);
}
-String::operator Std_string () const
+String::String (String const &s, int pos, ssize n)
{
- return Std_string (this->c_str ());
+ *this = s.substr (pos, n);
}
-#endif
-
-/* std::string interface */
+String::String (int n, char c)
+{
+ *this = String_convert::char_string (c, n);
+}
-#if 0
-// FIXME, use .SUBSTR () ?
-String::String (String const &s, int pos, int n)
+String &
+String::operator = (String const &source)
{
- if (n == -1 || n == INT_MAX || n == NPOS)
- n = s.length () - pos;
- if (pos == 0)
- *this = s.left_string (n);
- else
- *this = s.right_string (s.length () - pos).left_string (n);
+ strh_ = source.strh_;
+ return *this;
}
-#endif
String
-String::substr (int pos, int n) const
+String::substr (int pos, ssize n) const
{
-#if 0
- if (n == -1 || n == INT_MAX || n == NPOS)
+#if 1
+ if (n == (ssize)-1 || n == (ssize)INT_MAX || n == NPOS)
n = length () - pos;
return cut_string (pos, n);
#else
- if (n == -1 || n == INT_MAX || n == NPOS)
+ if (n == (ssize)-1 || n == (ssize)INT_MAX || n == NPOS)
n = length () - pos;
if (pos == 0)
return left_string (n);
#endif
}
-String::String (int n, char c)
+String
+String::insert (ssize pos, String s)
{
- *this = String_convert::char_string (c, n);
+ *this = substr (0, pos) + s + substr (pos + 1);
+ return *this;
}
+ssize
+String::copy (char *buf, ssize n, ssize pos) const
+{
+ assert (pos == 0);
+ memcpy (buf, strh_.to_bytes (), strh_.length () + 1);
+ return n; // ?
+}
+
+int
+String::compare (String const &s) const
+{
+ char const *p1 = c_str ();
+ char const *p2 = s.c_str ();
+ if (p1 == p2)
+ return 0;
+
+ /*
+ don't forget the terminating '\0'
+ */
+ int f = min (length (), s.length ());
+ int cmp_length = 1+ f;
+ int i = memcmp (p1, p2, cmp_length);
+ return i;
+}
char const *
String::data () const
}
int
-String::find (char c) const
+String::find (char c, int pos) const
{
- return index (c);
+ String f = right_string (length () - pos);
+ ssize n = f.index (c);
+ if (n != NPOS)
+ return pos + n;
+ return NPOS;
+}
+
+int
+String::find (char const *c, int pos) const
+{
+ return find (String (c), pos);
}
int
-String::find (String &s, int pos) const
+String::find (String s, int pos) const
{
if (!pos)
return index (s);
String f = right_string (length () - pos);
- int n = f.index (s);
+ ssize n = f.index (s);
if (n != NPOS)
return pos + n;
return NPOS;
return this->substr (0, pos) + str + this->substr (pos + n);
}
+void
+String::append (String s)
+{
+ strh_.append (s.to_bytes (), s.length ());
+}
+
+void
+String::operator += (String s)
+{
+ append (s);
+}
+
+int
+String::length () const
+{
+ return strh_.length ();
+}
+
+
/* String */
+int
+String::compare (String const &s1, String const &s2)
+{
+ return s1.compare (s2);
+}
+
#ifdef STRING_DEBUG
void *mymemmove (void *dest, void const *src, size_t n);
#define memmove mymemmove
}
\f
-/*
- copying, constructing.
-*/
-String &
-String::operator = (String const &source)
-{
- strh_ = source.strh_;
- return *this;
-}
-
-String::String (Byte const *byte, int len_i)
-{
- strh_.set (byte, len_i);
-}
-
-/**
- @see
- String_convert::
-*/
-String
-to_string (char c, int n)
-{
- return String_convert::char_string (c, n);
-}
-
-String
-to_string (double f, char const *format)
-{
- return String_convert::double_string (f, format);
-}
-
-String
-to_string (int i, char const *format)
-{
- return String_convert::int_string (i, format);
-}
-
-String
-to_string (bool b)
-{
- return String_convert::bool_string (b);
-}
-String
-to_string (long b)
-{
- return String_convert::long_string (b);
-}
-
-String
-to_string (char const *format, ...)
-{
- va_list args;
- va_start (args, format);
- String str = String_convert::vform_string (format, args);
- va_end (args);
- return str;
-}
-
-\f
-void
-String::append (String s)
-{
- strh_.append (s.to_bytes (), s.length ());
-}
-void
-String::operator += (String s)
-{
- append (s);
-}
+#if 0
void
String::prepend (String s)
{
*this = s;
}
-int
-String::length () const
-{
- return strh_.length ();
-}
+#endif
+
Byte const *
String::to_bytes () const
return strh_.get_bytes ();
}
-char *
-String::get_str0 ()
-{
- return strh_.get_str0 ();
-}
-
-/**
- Do a signed comparison, analogous to memcmp;
-*/
-int
-String::compare (String const &s1, String const &s2)
-{
- Byte const *p1 = s1.to_bytes ();
- Byte const *p2 = s2.to_bytes ();
- if (p1 == p2)
- return 0;
-
- /*
- don't forget the terminating '\0'
- */
- int f = min (s1.length (), s2.length ());
- int cmp_length = 1+ f;
- int i = memcmp (p1, p2, cmp_length);
- return i;
-}
-
\f
int
String::index_last (char const c) const
if (n < 1)
return "";
- return String (strh_.to_bytes () + length () - n, n);
+ return String (strh_.c_str () + length () - n, n);
}
String
if ((n > length ()) || (index_i + n > length ()))
n = length () - index_i;
- return String (to_bytes () + index_i, n);
+ return String (c_str () + index_i, n);
}
\f
-void
-String::to_upper ()
-{
- strnupr (get_str0 (), length ());
-}
-
-void
-String::to_lower ()
-{
- strnlwr (get_str0 (), length ());
-}
-
-void
-String::reverse ()
-{
- memrev (get_bytes (), length ());
-}
-
int
String::to_int () const
{
}
#ifdef STREAM_SUPPORT
+#include <iostream>
+
ostream &
operator << (ostream &os, String d)
{
{
int n = find.length ();
int m = replace.length ();
- for (int i = index (find), j = 0; i != NPOS;
+ for (ssize i = index (find), j = 0; i != NPOS;
i = right_string (length () - j).index (find))
{
*this = left_string (i + j)
String
String::substitute (char find, char replace)
{
- for (int i = index (find); i != NPOS; i = index (find))
+ for (ssize i = index (find); i != NPOS; i = index (find))
(*this)[i] = replace;
return *this;
}
+
+}
+
+#endif /* !STD_STRING */
(c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl> */
+#if !STD_STRING
+
+
#ifdef STRING_DEBUG
#define memmove mymemmove
#endif
#define INLINE
+#include <algorithm>
+
#include "string-data.hh"
-#include "string.hh"
+#include "string-handle.hh"
+
+#include "std-string.hh"
#include "string-data.icc"
#include "string-handle.icc"
return memcpy (dest, src, n);
}
#endif
+
+#endif /* !STD_STRING */
#include <cstdlib>
#include <cstdio>
+
+#include "international.hh"
+
using namespace std;
/* Is progress indication at NEWLINE? */
/* Display user information that is not a full message. */
void
-progress_indication (String s)
+progress_indication (std::string s)
{
/* Test if all silly progress_indication ("\n") can be dropped now. */
if (s == "\n")
/* Display a single user message. Always starts on a new line. */
void
-message (String s)
+message (std::string s)
{
if (!progress_newline)
fputc ('\n', stderr);
/* Display a warning message. Always starts on a new line. */
void
-warning (String s)
+warning (std::string s)
{
message (_f ("warning: %s", s.c_str ()) + "\n");
}
void
-non_fatal_error (String s)
+non_fatal_error (std::string s)
{
message (_f ("error: %s", s.c_str ()) + "\n");
}
/* Display an error message. Always starts on a new line. */
void
-error (String s)
+error (std::string s)
{
non_fatal_error (s);
exit (1);
}
void
-programming_error (String s)
+programming_error (std::string s)
{
message (_f ("programming error: %s", s) + "\n");
message (_ ("continuing, cross fingers") + "\n");
#include "arpeggio.hh"
#include "context.hh"
#include "engraver.hh"
+#include "international.hh"
+#include "music.hh"
+#include "pitch.hh"
#include "protected-scm.hh"
#include "rhythmic-head.hh"
#include "side-position-interface.hh"
#include "tie.hh"
#include "warn.hh"
-#include "music.hh"
-#include "pitch.hh"
#include "translator.icc"
&& note->is_mus_type ("note-event"))
{
/*
- String harmonics usually don't have accidentals.
+ std::string harmonics usually don't have accidentals.
*/
if (to_boolean (get_property ("harmonicAccidentals"))
|| !ly_is_equal (info.grob ()->get_property ("style"),
#include "accidental-interface.hh"
#include "font-interface.hh"
+#include "international.hh"
#include "item.hh"
#include "output-def.hh"
#include "pitch.hh"
/*
todo: this sort of stuff in Scheme. --hwn.
*/
-String
-Accidental_interface::get_fontcharname (String style, int alteration)
+std::string
+Accidental_interface::get_fontcharname (std::string style, int alteration)
{
if (alteration == DOUBLE_FLAT
|| alteration == DOUBLE_SHARP)
}
SCM scm_style = me->get_property ("style");
- String style;
+ std::string style;
if (scm_is_symbol (scm_style))
style = ly_symbol2string (scm_style);
else
scm_is_pair (s); s = scm_cdr (s))
{
int alteration = scm_to_int (scm_car (s));
- String font_char = get_fontcharname (style, alteration);
+ std::string font_char = get_fontcharname (style, alteration);
Stencil acc (fm->find_by_name ("accidentals." + font_char));
if (acc.is_empty ())
#include "all-font-metrics.hh"
-#include "open-type-font.hh"
+#include "international.hh"
#include "main.hh"
-#include "warn.hh"
-#include "tfm.hh"
-#include "scm-hash.hh"
+#include "open-type-font.hh"
#include "pango-font.hh"
+#include "scm-hash.hh"
+#include "tfm.hh"
+#include "warn.hh"
static char const *default_font_str0_ = "cmr10";
-All_font_metrics::All_font_metrics (String path)
+All_font_metrics::All_font_metrics (std::string path)
{
tfm_dict_ = new Scheme_hash_table;
otf_dict_ = new Scheme_hash_table;
if (!pango_dict_->try_retrieve (key, &val))
{
if (be_verbose_global)
- progress_indication ("[" + String (pango_fn));
+ progress_indication ("[" + std::string (pango_fn));
Pango_font *pf = new Pango_font (pango_ft2_fontmap_,
description,
#endif
-String
-kpathsea_find_file (String name, String ext)
+std::string
+kpathsea_find_file (std::string name, std::string ext)
{
name += "." + ext;
- String path = global_path.find (name);
+ std::string path = global_path.find (name);
if (path.length () > 0)
return path;
}
Open_type_font *
-All_font_metrics::find_otf (String name)
+All_font_metrics::find_otf (std::string name)
{
SCM sname = ly_symbol2scm (name.c_str ());
SCM name_string = scm_makfrom0str (name.c_str ());
SCM val;
if (!otf_dict_->try_retrieve (sname, &val))
{
- String file_name;
+ std::string file_name;
if (file_name.empty ())
file_name = search_path_.find (name + ".otf");
}
Tex_font_metric *
-All_font_metrics::find_tfm (String name)
+All_font_metrics::find_tfm (std::string name)
{
SCM sname = ly_symbol2scm (name.c_str ());
SCM name_string = scm_makfrom0str (name.c_str ());
SCM val;
if (!tfm_dict_->try_retrieve (sname, &val))
{
- String file_name;
+ std::string file_name;
if (file_name.empty ())
{
/* FIXME: should add "cork-" prefix to lm* fonts. How to do
that, cleanly? */
- String p = kpathsea_find_file (name, "tfm");
+ std::string p = kpathsea_find_file (name, "tfm");
if (p.length ())
file_name = p;
}
}
Font_metric *
-All_font_metrics::find_font (String name)
+All_font_metrics::find_font (std::string name)
{
Font_metric *f = find_otf (name);
warning (_ ("loading default font"));
}
- String def_name = default_font_str0_;
+ std::string def_name = default_font_str0_;
if (!f)
f = find_tfm (def_name);
(c) 2004--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-#include "simple-music-iterator.hh"
#include "context.hh"
-#include "music.hh"
#include "input.hh"
+#include "international.hh"
+#include "music.hh"
+#include "simple-music-iterator.hh"
/**
Iterate a property.
#include "midi-item.hh"
#include "audio-column.hh"
-Audio_instrument::Audio_instrument (String instrument_string)
+Audio_instrument::Audio_instrument (std::string instrument_string)
{
str_ = instrument_string;
}
one_beat_ = one_beat;
}
-Audio_text::Audio_text (Audio_text::Type type, String text_string)
+Audio_text::Audio_text (Audio_text::Type type, std::string text_string)
{
text_string_ = text_string;
type_ = type;
*/
#include "context.hh"
-#include "music-wrapper-iterator.hh"
#include "direction.hh"
+#include "international.hh"
+#include "music-wrapper-iterator.hh"
class Auto_change_iterator : public Music_wrapper_iterator
{
private:
SCM split_list_;
Direction where_dir_;
- void change_to (Music_iterator *, SCM, String);
+ void change_to (Music_iterator *, SCM, std::string);
Moment start_moment_;
Context_handle up_;
void
Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym,
- String to_id)
+ std::string to_id)
{
Context *current = it->get_outlet ();
Context *last = 0;
if (current && current->id_string () == to_id)
{
- String msg;
+ std::string msg;
msg += _f ("can't change, already in translator: %s", to_id);
}
if (d && d != where_dir_)
{
where_dir_ = d;
- String to_id = (d >= 0) ? "up" : "down";
+ std::string to_id = (d >= 0) ? "up" : "down";
change_to (child_iter_,
ly_symbol2scm ("Staff"),
to_id);
#include "axis-group-engraver.hh"
-#include "spanner.hh"
#include "axis-group-interface.hh"
-#include "warn.hh"
#include "context.hh"
+#include "international.hh"
+#include "spanner.hh"
+#include "warn.hh"
#include "translator.icc"
(c) 2001--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-#include "simple-music-iterator.hh"
-#include "music.hh"
#include "context.hh"
#include "input.hh"
+#include "international.hh"
+#include "music.hh"
+#include "simple-music-iterator.hh"
/*
Check bar checks. We do this outside the engravers so that you can
{
public:
TRANSLATOR_DECLARATIONS (Bar_engraver);
- void request_bar (String type_string);
+ void request_bar (std::string type_string);
protected:
virtual void finalize ();
if (scm_is_string (s) && scm_is_number (barsize))
{
- String str = ly_scm2string (s);
+ std::string str = ly_scm2string (s);
Real sz = robust_scm2double (barsize, 0);
if (sz <= 0)
return SCM_EOL;
}
Stencil
-Bar_line::compound_barline (Grob *me, String str, Real h,
+Bar_line::compound_barline (Grob *me, std::string str, Real h,
bool rounded)
{
Real kern = robust_scm2double (me->get_property ("kern"), 1);
(c) 1998--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-#include "engraver.hh"
#include "beam.hh"
-#include "stem.hh"
-#include "warn.hh"
#include "beaming.hh"
-#include "score-engraver.hh"
-#include "rest.hh"
+#include "context.hh"
#include "drul-array.hh"
+#include "duration.hh"
+#include "engraver.hh"
+#include "international.hh"
#include "item.hh"
+#include "rest.hh"
+#include "score-engraver.hh"
#include "spanner.hh"
-#include "context.hh"
-#include "duration.hh"
+#include "stem.hh"
+#include "warn.hh"
#include "translator.icc"
Music *m = info.ultimate_music_cause ();
if (!m->is_mus_type ("rhythmic-event"))
{
- String s = _ ("stem must have Rhythmic structure");
+ std::string s = _ ("stem must have Rhythmic structure");
if (info.music_cause ())
info.music_cause ()->origin ()->warning (s);
else
#include <algorithm>
using namespace std;
-#include "warn.hh"
-#include "staff-symbol-referencer.hh"
-#include "stem.hh"
+#include "align-interface.hh"
+#include "international.hh"
#include "output-def.hh"
#include "pointer-group-interface.hh"
-#include "align-interface.hh"
+#include "staff-symbol-referencer.hh"
+#include "stem.hh"
+#include "warn.hh"
Real
get_detail (SCM alist, SCM sym, Real def)
Real demerits;
#if DEBUG_QUANTING
- String score_card_;
+ std::string score_card_;
#endif
};
*/
#include "beam.hh"
-#include "interval-set.hh"
-#include "directional-element-interface.hh"
+
#include "beaming.hh"
-#include "misc.hh"
+#include "directional-element-interface.hh"
+#include "international.hh"
+#include "interval-set.hh"
+#include "item.hh"
#include "least-squares.hh"
-#include "stem.hh"
-#include "output-def.hh"
#include "lookup.hh"
+#include "misc.hh"
+#include "output-def.hh"
#include "pointer-group-interface.hh"
-#include "staff-symbol-referencer.hh"
-#include "item.hh"
#include "spanner.hh"
+#include "staff-symbol-referencer.hh"
+#include "stem.hh"
#include "warn.hh"
#if DEBUG_QUANTING
should be switchable for those who want to twiddle with the
parameters.
*/
- String str;
+ std::string str;
SCM properties = Font_interface::text_font_alist_chain (me);
Direction stem_dir = stems.size () ? to_dir (stems[0]->get_property ("direction")) : UP;
#include "binary-source-file.hh"
#include "string-convert.hh"
-Binary_source_file::Binary_source_file (String &file_name_string)
+Binary_source_file::Binary_source_file (std::string &file_name_string)
: Source_file (file_name_string)
{
}
{
}
-String
+std::string
Binary_source_file::quote_input (char const *pos_str0) const
{
assert (this);
char const *begin_str0 = max (pos_str0 - 8, c_str ());
char const *end_str0 = min (pos_str0 + 7, c_str () + length ());
- String pre_string ((Byte const *)begin_str0, pos_str0 - begin_str0);
+ std::string pre_string (begin_str0, pos_str0 - begin_str0);
pre_string = String_convert::bin2hex (pre_string);
- for (int i = 2; i < pre_string.length (); i += 3)
- pre_string = pre_string.left_string (i)
- + " " + pre_string.cut_string (i, INT_MAX);
- String post_string ((Byte const *)pos_str0, end_str0 - pos_str0);
+ for (ssize i = 2; i < pre_string.length (); i += 3)
+ pre_string = pre_string.substr (0, i)
+ + " " + pre_string.substr (i, NPOS);
+ std::string post_string (pos_str0, end_str0 - pos_str0);
post_string = String_convert::bin2hex (post_string);
- for (int i = 2; i < post_string.length (); i += 3)
- post_string = post_string.left_string (i)
- + " " + post_string.cut_string (i, INT_MAX);
+ for (ssize i = 2; i < post_string.length (); i += 3)
+ post_string = post_string.substr (0, i)
+ + " " + post_string.substr (i, NPOS);
- String str = pre_string
+ std::string str = pre_string
+ to_string ('\n')
+ to_string (' ', pre_string.length () + 1)
+ post_string;
#include "break-align-interface.hh"
-#include "pointer-group-interface.hh"
-#include "self-alignment-interface.hh"
-#include "side-position-interface.hh"
+#include "align-interface.hh"
#include "axis-group-interface.hh"
-#include "warn.hh"
#include "dimensions.hh"
+#include "international.hh"
#include "output-def.hh"
#include "paper-column.hh"
-#include "align-interface.hh"
+#include "pointer-group-interface.hh"
+#include "self-alignment-interface.hh"
+#include "side-position-interface.hh"
+#include "warn.hh"
MAKE_SCHEME_CALLBACK (Break_align_interface, self_align_callback, 1);
bool entry_found = scm_is_pair (entry);
if (!entry_found)
{
- String sym_string;
+ std::string sym_string;
if (scm_is_symbol (rsym))
sym_string = ly_symbol2string (rsym);
- String orig_string;
+ std::string orig_string;
if (unsmob_grob (l->get_property ("cause")))
orig_string = unsmob_grob (l->get_property ("cause"))->name ();
#include "change-iterator.hh"
#include "context.hh"
+#include "input.hh"
+#include "international.hh"
#include "music.hh"
#include "warn.hh"
-#include "input.hh"
void
-Change_iterator::error (String reason)
+Change_iterator::error (std::string reason)
{
- String to_type = ly_symbol2string (get_music ()->get_property ("change-to-type"));
- String to_id = ly_scm2string (get_music ()->get_property ("change-to-id"));
+ std::string to_type = ly_symbol2string (get_music ()->get_property ("change-to-type"));
+ std::string to_id = ly_scm2string (get_music ()->get_property ("change-to-id"));
- String warn1 = _f ("can't change `%s' to `%s'", to_type, to_id)
+ std::string warn1 = _f ("can't change `%s' to `%s'", to_type, to_id)
+ ": " + reason;
/*
GUHG!
*/
- String warn2= "Change_iterator::process (): "
+ std::string warn2= "Change_iterator::process (): "
+ get_outlet ()->context_name () + " = `"
+ get_outlet ()->id_string () + "': ";
warning (warn2);
Context *last = 0;
SCM to_type = get_music ()->get_property ("change-to-type");
- String to_id = ly_scm2string (get_music ()->get_property ("change-to-id"));
+ std::string to_id = ly_scm2string (get_music ()->get_property ("change-to-id"));
/* find the type of translator that we're changing.
if (current && current->id_string () == to_id)
{
- String msg;
+ std::string msg;
msg += _f ("can't change, already in translator: %s", to_id);
}
(c) 2000--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
+#include "math.h" // ceil
+
#include "beam.hh"
-#include "repeated-music.hh"
-#include "stem.hh"
-#include "rhythmic-head.hh"
+#include "chord-tremolo-iterator.hh"
#include "engraver-group.hh"
-#include "warn.hh"
+#include "international.hh"
+#include "item.hh"
#include "misc.hh"
+#include "repeated-music.hh"
+#include "rhythmic-head.hh"
#include "spanner.hh"
-#include "item.hh"
-#include "chord-tremolo-iterator.hh"
#include "stem-tremolo.hh"
-#include "math.h" // ceil
+#include "stem.hh"
+#include "warn.hh"
#include "translator.icc"
Beam::add_stem (beam_, s);
else
{
- String s = _ ("stem must have Rhythmic structure");
+ std::string s = _ ("stem must have Rhythmic structure");
if (info.music_cause ())
info.music_cause ()->origin ()->warning (s);
else
#include "chord-tremolo-iterator.hh"
#include "input.hh"
+#include "international.hh"
#include "repeated-music.hh"
void
#include "clef.hh"
-#include "string.hh"
-#include "stencil.hh"
-#include "item.hh"
#include "font-interface.hh"
+#include "international.hh"
+#include "item.hh"
+#include "std-string.hh"
+#include "stencil.hh"
MAKE_SCHEME_CALLBACK (Clef, calc_glyph_name, 1);
SCM
if (scm_is_string (glyph))
{
- String str = ly_scm2string (glyph);
+ std::string str = ly_scm2string (glyph);
if (to_boolean (s->get_property ("non-default"))
&& s->break_status_dir () != RIGHT
if (!scm_is_string (glyph_scm))
return SCM_EOL;
- String glyph = String (ly_scm2string (glyph_scm));
+ std::string glyph = std::string (ly_scm2string (glyph_scm));
Font_metric *fm = Font_interface::get_default_font (me);
Stencil out = fm->find_by_name (glyph);
if (out.is_empty ())
#include <cstdio>
using namespace std;
-#include "spanner.hh"
+#include "international.hh"
#include "item.hh"
-#include "pitch.hh"
-#include "staff-symbol-referencer.hh"
#include "lookup.hh"
#include "output-def.hh"
-#include "warn.hh"
+#include "pitch.hh"
#include "pointer-group-interface.hh"
+#include "spanner.hh"
+#include "staff-symbol-referencer.hh"
+#include "warn.hh"
/*
TODO: Add support for cubic spline segments.
Offset hvpadding = 0.5 * hpadding + vpadding;
SCM shape_scm = me->get_property ("style");
- String shape;
+ std::string shape;
if (scm_is_symbol (shape_scm))
shape = ly_symbol2string (shape_scm);
Array<Offset> points;
points.clear ();
int size = bottom_points.size ();
- if (String::compare (shape, "leftsided-stairs") == 0)
+ if (shape == "leftsided-stairs")
{
for (int i = 0; i < size - 1; i++)
{
out.add_stencil (Lookup::round_filled_box (box, blotdiameter));
}
}
- else if (String::compare (shape, "rightsided-stairs") == 0)
+ else if (shape == "rightsided-stairs")
{
for (int i = 0; i < size - 1; i++)
{
out.add_stencil (Lookup::round_filled_box (box, blotdiameter));
}
}
- else if (String::compare (shape, "centered-stairs") == 0)
+ else if (shape == "centered-stairs")
{
Real left_xmid = bottom_points[0][X_AXIS];
for (int i = 0; i < size - 1; i++)
+ hvpadding);
out.add_stencil (Lookup::round_filled_box (box, blotdiameter));
}
- else if (String::compare (shape, "ramp") == 0)
+ else if (shape == "ramp")
{
points.push (bottom_points[0] - vpadding + hpadding);
for (int i = 1; i < size - 1; i++)
return;
}
- String name = parent->name ();
- if (!String::compare (name, "PaperColumn"))
+ std::string name = parent->name ();
+ if (name != "PaperColumn")
{
// Change column not only for targeted item (NoteColumn), but
// also for all associated grobs (NoteSpacing, SeparationItem).
#include "context-def.hh"
+#include "engraver-group.hh"
#include "engraver.hh"
+#include "international.hh"
#include "output-def.hh"
+#include "performer-group.hh"
#include "performer.hh"
#include "score-context.hh"
#include "translator-group.hh"
#include "warn.hh"
-#include "engraver-group.hh"
-#include "performer-group.hh"
-
Context_def::Context_def ()
{
context_aliases_ = SCM_EOL;
#include "context.hh"
#include "engraver.hh"
+#include "international.hh"
#include "item.hh"
#include "main.hh"
-#include "spanner.hh"
-#include "warn.hh"
#include "paper-column.hh"
#include "simple-closure.hh"
+#include "spanner.hh"
+#include "warn.hh"
SCM
lookup_nested_property (SCM alist,
{
SCM ct = get_music ()->get_property ("context-type");
- String c_id;
+ std::string c_id;
SCM ci = get_music ()->get_property ("context-id");
if (scm_is_string (ci))
c_id = ly_scm2string (ci);
#include "context.hh"
-#include "program-option.hh"
#include "context-def.hh"
+#include "international.hh"
+#include "lilypond-key.hh"
#include "ly-smobs.icc"
#include "main.hh"
#include "output-def.hh"
+#include "profile.hh"
+#include "program-option.hh"
#include "scm-hash.hh"
#include "score-context.hh"
#include "translator-group.hh"
#include "warn.hh"
-#include "lilypond-key.hh"
-#include "profile.hh"
bool
Context::is_removable () const
}
Context *
-Context::find_create_context (SCM n, String id, SCM operations)
+Context::find_create_context (SCM n, std::string id, SCM operations)
{
/*
Don't create multiple score contexts.
{
SCM ops = (i == path.size () -1) ? operations : SCM_EOL;
- String this_id = "";
+ std::string this_id = "";
if (i == path.size () -1)
this_id = id;
Context *
Context::create_context (Context_def *cdef,
- String id,
+ std::string id,
SCM ops)
{
- String type = ly_symbol2string (cdef->get_context_name ());
+ std::string type = ly_symbol2string (cdef->get_context_name ());
Object_key const *key = get_context_key (type, id);
Context *new_context
= cdef->instantiate (ops, key);
}
Object_key const *
-Context::get_context_key (String type, String id)
+Context::get_context_key (std::string type, std::string id)
{
if (!use_object_keys)
return 0;
- String now_key = type + "@" + id;
+ std::string now_key = type + "@" + id;
int disambiguation_count = 0;
if (context_counts_.find (now_key) != context_counts_.end ())
}
Object_key const *
-Context::get_grob_key (String name)
+Context::get_grob_key (std::string name)
{
if (!use_object_keys)
return 0;
unique identifier for each (book,score) tuple.
*/
Object_key const *
-Context::create_grob_key (String name)
+Context::create_grob_key (std::string name)
{
int disambiguation_count = 0;
if (grob_counts_.find (name) != grob_counts_.end ())
SCM nm = default_child_context_name ();
SCM st = find_context_def (get_output_def (), nm);
- String name = ly_symbol2string (nm);
+ std::string name = ly_symbol2string (nm);
Context_def *t = unsmob_context_def (st);
if (!t)
{
*/
Context *
find_context_below (Context *where,
- SCM type, String id)
+ SCM type, std::string id)
{
if (where->is_alias (type))
{
return td->get_context_name ();
}
-String
+std::string
Context::context_name () const
{
return ly_symbol2string (context_name_symbol ());
#include "custos.hh"
#include "direction.hh"
+#include "font-interface.hh"
+#include "international.hh"
+#include "item.hh"
+#include "note-head.hh"
#include "staff-symbol-referencer.hh"
#include "warn.hh"
-#include "note-head.hh"
-#include "item.hh"
-#include "font-interface.hh"
MAKE_SCHEME_CALLBACK (Custos, print, 1);
SCM
Item *me = (Item *)unsmob_grob (smob);
SCM scm_style = me->get_property ("style");
- String style;
+ std::string style;
if (scm_is_symbol (scm_style))
style = ly_symbol2string (scm_style);
else
int pos = Staff_symbol_referencer::get_rounded_position (me);
int sz = Staff_symbol_referencer::line_count (me) - 1;
- String font_char = "custodes." + style + ".";
+ std::string font_char = "custodes." + style + ".";
if (pos < neutral_pos)
font_char += "u";
else if (pos > neutral_pos)
if (scm_is_number (c))
{
- Stencil d = Font_interface::get_default_font (sc)->find_by_name (String ("dots.dot"));
+ Stencil d = Font_interface::get_default_font (sc)->find_by_name (std::string ("dots.dot"));
Real dw = d.extent (X_AXIS).length ();
/*
return mom * factor_;
}
-String
+std::string
Duration::to_string () const
{
- String s;
+ std::string s;
if (durlog_ < 0)
- s = "log = " + ::to_string (durlog_);
+ s = "log = " + std::to_string (durlog_);
else
- s = ::to_string (1 << durlog_);
+ s = std::to_string (1 << durlog_);
- s += ::to_string ('.', dots_);
+ s += std::to_string ('.', dots_);
if (factor_ != Moment (Rational (1, 1)))
s += "*" + factor_.to_string ();
return s;
#include "directional-element-interface.hh"
#include "engraver.hh"
#include "hairpin.hh"
+#include "international.hh"
#include "interval.hh"
#include "note-column.hh"
#include "paper-column.hh"
+#include "pointer-group-interface.hh"
#include "script-interface.hh"
+#include "self-alignment-interface.hh"
#include "side-position-interface.hh"
#include "staff-symbol-referencer.hh"
#include "warn.hh"
-#include "self-alignment-interface.hh"
-#include "pointer-group-interface.hh"
#include "translator.icc"
{
if (current_cresc_ev_)
{
- String msg = _ ("already have a decrescendo");
+ std::string msg = _ ("already have a decrescendo");
if (current_cresc_ev_->is_mus_type ("decrescendo-event"))
msg = _ ("already have a crescendo");
TODO: Use symbols.
*/
- String start_type
+ std::string start_type
= ly_symbol2string (current_cresc_ev_->get_property ("name"));
/*
#include "event-chord-iterator.hh"
#include "context.hh"
-#include "warn.hh"
-#include "music.hh"
+#include "duration.hh"
#include "input.hh"
+#include "international.hh"
+#include "music.hh"
#include "pitch.hh"
-#include "duration.hh"
+#include "warn.hh"
Event_chord_iterator::Event_chord_iterator ()
{
#include "context.hh"
#include "engraver.hh"
-#include "pointer-group-interface.hh"
+#include "international.hh"
#include "item.hh"
#include "lyric-extender.hh"
#include "note-head.hh"
+#include "pointer-group-interface.hh"
#include "warn.hh"
void completize_extender (Spanner *sp);
#include "file-name-map.hh"
#include "lily-guile.hh"
-map<String, String> file_name_map_global;
+map<std::string, std::string> file_name_map_global;
-String
-map_file_name (String s)
+std::string
+map_file_name (std::string s)
{
if (file_name_map_global.find (s) != file_name_map_global.end ())
s = file_name_map_global[s];
#include "folded-repeat-iterator.hh"
+#include "context.hh"
#include "input.hh"
+#include "international.hh"
#include "repeated-music.hh"
#include "simultaneous-music-iterator.hh"
-#include "context.hh"
Folded_repeat_iterator::Folded_repeat_iterator ()
{
*/
#include "lily-guile.hh"
-#include "string.hh"
+#include "std-string.hh"
#include <fontconfig/fontconfig.h>
#include <sys/stat.h>
#include "file-path.hh"
+#include "international.hh"
#include "main.hh"
#include "warn.hh"
if (!is_file ((char*)cache_file))
message (_f ("Rebuilding FontConfig cache %s. this may take a while...", cache_file));
- Array<String> dirs;
+ Array<std::string> dirs;
dirs.push (prefix_directory + "/fonts/otf/");
dirs.push (prefix_directory + "/fonts/type1/");
for (int i = 0; i < dirs.size (); i++)
{
- String dir = dirs[i];
+ std::string dir = dirs[i];
if (!FcConfigAppFontAddDir (font_config_global, (FcChar8 *)dir.c_str ()))
error (_f ("adding font directory: %s", dir.c_str ()));
else if (be_verbose_global)
}
Stencil
-Font_metric::find_by_name (String s) const
+Font_metric::find_by_name (std::string s) const
{
- s.substitute ('-', 'M');
+ replace_all (s, '-', 'M');
int idx = name_to_index (s);
Box b;
}
int
-Font_metric::name_to_index (String) const
+Font_metric::name_to_index (std::string) const
{
return -1;
}
return scm_car (description_);
}
-String
+std::string
Font_metric::font_name () const
{
- String s ("unknown");
+ std::string s ("unknown");
return s;
}
}
Offset
-Font_metric::attachment_point (String) const
+Font_metric::attachment_point (std::string) const
{
return Offset (0, 0);
}
}
Stencil
-Font_metric::text_stencil (String str) const
+Font_metric::text_stencil (std::string str) const
{
SCM lst = scm_list_3 (ly_symbol2scm ("text"),
this->self_scm (),
}
Box
-Font_metric::text_dimension (String) const
+Font_metric::text_dimension (std::string) const
{
return Box (Interval (0, 0), Interval (0, 0));
}
#include <cstring>
using namespace std;
-#include "string.hh"
+#include "std-string.hh"
#include "lily-guile.hh"
static SCM doc_hash_table;
if (!doc_hash_table)
doc_hash_table = scm_permanent_object (scm_c_make_hash_table (59));
- String s = String (" - ") + "LilyPond procedure: " + fname + " " + varlist
+ std::string s = std::string (" - ") + "LilyPond procedure: " + fname + " " + varlist
+ "\n" + doc;
scm_set_procedure_property_x (func, ly_symbol2scm ("documentation"),
#include "international.hh"
#include "libc-extension.hh"
#include "lily-guile.hh"
-#include "string.hh"
+#include "std-string.hh"
#include "misc.hh"
#include "warn.hh"
#include "version.hh"
{
SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string");
- String nm = ly_scm2string (name);
- String file_name = global_path.find (nm);
+ std::string nm = ly_scm2string (name);
+ std::string file_name = global_path.find (nm);
if (file_name.empty ())
return SCM_BOOL_F;
sz = scm_to_int (size);
}
- String contents = gulp_file_to_string (ly_scm2string (name), true, sz);
- return scm_from_locale_stringn (contents.get_str0 (), contents.length ());
+ std::string contents = gulp_file_to_string (ly_scm2string (name), true, sz);
+ return scm_from_locale_stringn (contents.c_str (), contents.length ());
}
LY_DEFINE (ly_error, "ly:error",
"Formats passed to --format as a list of strings, "
"used for the output.")
{
- Array<String> output_formats = split_string (output_format_global, ',');
+ Array<std::string> output_formats = split_string (output_format_global, ',');
SCM lst = SCM_EOL;
int output_formats_count = output_formats.size ();
(c) 2000--2006 Jan Nieuwenhuizen <janneke@gnu.org>
*/
-#include "warn.hh"
-#include "spanner.hh"
-#include "rhythmic-head.hh"
#include "engraver.hh"
+#include "international.hh"
+#include "rhythmic-head.hh"
+#include "spanner.hh"
+#include "warn.hh"
/**
Create line-spanner grobs for glissandi lines that connect note
{
if (line_)
{
- String msg = _ ("unterminated glissando");
+ std::string msg = _ ("unterminated glissando");
if (event_)
event_->origin ()->warning (msg);
(c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-#include "warn.hh"
-#include "music-output.hh"
-#include "output-def.hh"
-#include "music-iterator.hh"
-#include "music.hh"
#include "cpu-timer.hh"
#include "global-context.hh"
-#include "object-key.hh"
+#include "international.hh"
#include "main.hh"
+#include "music-iterator.hh"
+#include "music-output.hh"
+#include "music.hh"
+#include "object-key.hh"
+#include "output-def.hh"
+#include "warn.hh"
LY_DEFINE (ly_format_output, "ly:format-output",
1, 0, 0, (SCM context),
#include <cstdio>
using namespace std;
-#include "warn.hh"
-#include "music.hh"
-#include "music-iterator.hh"
-#include "score-context.hh"
#include "context-def.hh"
-#include "output-def.hh"
+#include "international.hh"
#include "lilypond-key.hh"
+#include "music-iterator.hh"
+#include "music.hh"
+#include "output-def.hh"
+#include "score-context.hh"
+#include "warn.hh"
Global_context::Global_context (Output_def *o, Moment final, Object_key *key)
: Context (new Lilypond_context_key (key,
#include <cstdio>
using namespace std;
-#include "warn.hh"
+#include "international.hh"
#include "main.hh"
+#include "output-def.hh"
#include "paper-column.hh"
#include "paper-score.hh"
-#include "output-def.hh"
#include "simple-spacer.hh"
#include "system.hh"
+#include "warn.hh"
/// How often to print operator pacification marks?
-const int HAPPY_DOTS_I = 3;
+const int HAPPY_DOTS = 3;
/**
Helper to trace back an optimal path
bnod.line_ = optimal_paths[bnod.prev_break_].line_ + 1;
optimal_paths.push (bnod);
- if (! (break_idx % HAPPY_DOTS_I))
- progress_indication (String ("[") + to_string (break_idx) + "]");
+ if (! (break_idx % HAPPY_DOTS))
+ progress_indication (std::string ("[") + to_string (break_idx) + "]");
}
/* do the last one */
- if (breaks.size () % HAPPY_DOTS_I)
- progress_indication (String ("[") + to_string (breaks.size ()) + "]");
+ if (breaks.size () % HAPPY_DOTS)
+ progress_indication (std::string ("[") + to_string (breaks.size ()) + "]");
progress_indication ("\n");
#include "gregorian-ligature-engraver.hh"
#include "gregorian-ligature.hh"
-#include "warn.hh"
-#include "staff-symbol-referencer.hh"
-#include "spanner.hh"
+#include "international.hh"
#include "paper-column.hh"
#include "pitch.hh"
+#include "spanner.hh"
+#include "staff-symbol-referencer.hh"
+#include "warn.hh"
/*
* This abstract class is the common superclass for all ligature
#include "gregorian-ligature.hh"
#include "grob.hh"
-#include "string.hh"
-void check_prefix (String name, int mask, int prefix_set, String *str)
+void check_prefix (std::string name, int mask, int prefix_set, std::string *str)
{
if (prefix_set & mask)
{
}
}
-String
+std::string
Gregorian_ligature::prefixes_to_str (Grob *primitive)
{
- String str;
+ std::string str;
int prefix_set
= scm_to_int (primitive->get_property ("prefix-set"));
check_prefix ("virga", VIRGA, prefix_set, &str);
*/
#include "lily-guile.hh"
-#include "string.hh"
+#include "std-string.hh"
static SCM all_ifaces;
#include "grob-interface.hh"
-#include "protected-scm.hh"
#include "grob.hh"
+#include "international.hh"
+#include "protected-scm.hh"
+#include "std-string.hh"
#include "warn.hh"
void add_interface (char const *symbol,
SCM iface = scm_hashq_ref (all_ifaces, scm_car (ifs), SCM_BOOL_F);
if (iface == SCM_BOOL_F)
{
- String msg = to_string (_f ("Unknown interface `%s'",
+ std::string msg = to_string (_f ("Unknown interface `%s'",
ly_symbol2string (scm_car (ifs)).c_str ()));
programming_error (msg);
continue;
if (!found)
{
- String str = to_string (_f ("Grob `%s' has no interface for property `%s'",
+ std::string str = to_string (_f ("Grob `%s' has no interface for property `%s'",
me->name ().c_str (),
ly_symbol2string (sym).c_str ()));
programming_error (str);
#include <cstring>
-#include "main.hh"
#include "input-smob.hh"
-#include "warn.hh"
-#include "pointer-group-interface.hh"
-#include "misc.hh"
-#include "stencil.hh"
-#include "warn.hh"
-#include "system.hh"
+#include "international.hh"
#include "item.hh"
-#include "stencil.hh"
+#include "main.hh"
#include "misc.hh"
#include "music.hh"
-#include "item.hh"
-#include "ly-smobs.icc"
#include "output-def.hh"
+#include "pointer-group-interface.hh"
+#include "stencil.hh"
+#include "system.hh"
+#include "warn.hh"
+
+#include "ly-smobs.icc"
Grob *
Grob::clone (int count) const
MESSAGES
****************************************************************/
void
-Grob::warning (String s) const
+Grob::warning (std::string s) const
{
SCM cause = self_scm ();
while (Grob *g = unsmob_grob (cause))
}
-String
+std::string
Grob::name () const
{
SCM meta = get_property ("meta");
}
void
-Grob::programming_error (String s) const
+Grob::programming_error (std::string s) const
{
SCM cause = self_scm ();
while (Grob *g = unsmob_grob (cause))
*/
#include "hairpin.hh"
-#include "staff-symbol-referencer.hh"
-#include "line-interface.hh"
-#include "spanner.hh"
-#include "font-interface.hh"
+
#include "dimensions.hh"
+#include "font-interface.hh"
+#include "international.hh"
+#include "line-interface.hh"
+#include "lookup.hh"
#include "output-def.hh"
-#include "warn.hh"
#include "paper-column.hh"
-#include "lookup.hh"
-#include "text-interface.hh"
#include "pointer-group-interface.hh"
+#include "spanner.hh"
+#include "staff-symbol-referencer.hh"
+#include "text-interface.hh"
+#include "warn.hh"
MAKE_SCHEME_CALLBACK (Hairpin, after_line_breaking, 1);
SCM
*/
#include "engraver.hh"
-#include "side-position-interface.hh"
+#include "international.hh"
#include "note-column.hh"
#include "pointer-group-interface.hh"
+#include "side-position-interface.hh"
#include "translator.icc"
*/
#include "engraver.hh"
-
-#include "warn.hh"
+#include "international.hh"
#include "item.hh"
-#include "spanner.hh"
#include "pointer-group-interface.hh"
+#include "spanner.hh"
+#include "warn.hh"
class Hyphen_engraver : public Engraver
{
using namespace std;
#include "config.hh"
+
#include "file-path.hh"
+#include "international.hh"
+#include "main.hh"
#include "source-file.hh"
#include "source.hh"
#include "warn.hh"
-#include "main.hh"
#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE 16384
/** Set the new input file to NAME, remember old file. */
void
-Includable_lexer::new_input (String name, Sources *sources)
+Includable_lexer::new_input (std::string name, Sources *sources)
{
if (!allow_includes_b_)
{
Source_file *file = sources->get_file (name);
if (!file)
{
- String msg = _f ("can't find file: `%s'", name);
+ std::string msg = _f ("can't find file: `%s'", name);
msg += "\n";
msg += _f ("(search path: `%s')",
sources->path_->to_string ().c_str ());
state_stack_.push (yy_current_buffer);
if (be_verbose_global)
- progress_indication (String ("[") + name);
+ progress_indication (std::string ("[") + name);
include_stack_.push (file);
}
void
-Includable_lexer::new_input (String name, String data, Sources *sources)
+Includable_lexer::new_input (std::string name, std::string data, Sources *sources)
{
Source_file *file = new Source_file (name, data);
sources->add (file);
state_stack_.push (yy_current_buffer);
if (be_verbose_global)
- progress_indication (String ("[") + name);
+ progress_indication (std::string ("[") + name);
include_stack_.push (file);
yy_switch_to_buffer (yy_create_buffer (file->get_istream (), YY_BUF_SIZE));
DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
static bool has_interface (Grob *);
- static String get_fontcharname (String style, int alteration);
+ static std::string get_fontcharname (std::string style, int alteration);
static Array<Box> accurate_boxes (Grob *me,
Grob **common);
};
All_font_metrics (All_font_metrics const &);
public:
- All_font_metrics (String search_path);
+ All_font_metrics (std::string search_path);
~All_font_metrics ();
#if HAVE_PANGO_FT2
Real scale);
#endif
- Tex_font_metric *find_tfm (String);
- Font_metric *find_font (String name);
- Open_type_font *find_otf (String name);
+ Tex_font_metric *find_tfm (std::string);
+ Font_metric *find_font (std::string name);
+ Open_type_font *find_otf (std::string name);
SCM font_descriptions () const;
};
class Audio_instrument : public Audio_item
{
public:
- Audio_instrument (String instrument_string);
+ Audio_instrument (std::string instrument_string);
- String str_;
+ std::string str_;
};
class Audio_note : public Audio_item
class Audio_piano_pedal : public Audio_item
{
public:
- String type_string_;
+ std::string type_string_;
Direction dir_;
};
MARKER, CUE_POINT
};
- Audio_text (Audio_text::Type type, String text_string);
+ Audio_text (Audio_text::Type type, std::string text_string);
Type type_;
- String text_string_;
+ std::string text_string_;
};
class Audio_tempo : public Audio_item
public:
static bool has_interface (Grob *);
- static Stencil compound_barline (Grob *, String, Real height, bool rounded);
+ static Stencil compound_barline (Grob *, std::string, Real height, bool rounded);
static Stencil simple_barline (Grob *, Real wid, Real height, bool rounded);
DECLARE_SCHEME_CALLBACK (calc_bar_size, (SCM));
DECLARE_SCHEME_CALLBACK (print, (SCM));
public:
static bool has_interface (Grob *);
- static Stencil compound_barline (Grob *, String, Real height);
+ static Stencil compound_barline (Grob *, std::string, Real height);
static Stencil simple_barline (Grob *, Real wid, Real height);
DECLARE_SCHEME_CALLBACK (get_staff_bar_size, (SCM));
DECLARE_SCHEME_CALLBACK (print, (SCM));
class Binary_source_file : public Source_file
{
public:
- Binary_source_file (String &file_name_string);
+ Binary_source_file (std::string &file_name_string);
virtual ~Binary_source_file ();
U8 get_U8 ();
Byte get_Byte () {return get_U8 (); }
int get_int () { return get_U32 (); }
- virtual String quote_input (char const *pos_str0) const;
+ virtual std::string quote_input (char const *pos_str0) const;
virtual int get_line (char const *pos_str0) const;
};
#include "lily-proto.hh"
#include "parray.hh"
#include "object-key.hh"
-#include "string.hh"
+#include "std-string.hh"
class Book : public Input
{
DECLARE_SMOBS (Book, foo);
public:
- String user_key_;
+ std::string user_key_;
SCM header_;
Output_def *paper_;
SCM scores_;
DECLARE_CLASSNAME(Change_iterator);
private:
- void error (String);
+ void error (std::string);
};
#endif
int iterator_count_;
bool init_;
- map<String, int> grob_counts_;
- map<String, int> context_counts_;
+ map<std::string, int> grob_counts_;
+ map<std::string, int> context_counts_;
protected:
Object_key const *key_;
SCM accepts_list_;
SCM aliases_;
Translator_group *implementation_;
- String id_string_;
+ std::string id_string_;
friend class Context_def;
void clear_key_disambiguations ();
public:
Object_key const *key () const { return key_; }
+ Object_key const *create_grob_key (std::string);
+ Object_key const *get_grob_key (std::string);
+ Object_key const *get_context_key (std::string, std::string);
- Object_key const *create_grob_key (String);
- Object_key const *get_grob_key (String);
- Object_key const *get_context_key (String, String);
-
- Context *create_context (Context_def *, String, SCM);
- String id_string () const { return id_string_; }
+ Context *create_context (Context_def *, std::string, SCM);
+ std::string id_string () const { return id_string_; }
SCM children_contexts () const { return context_list_; }
SCM default_child_context_name () const;
Context *remove_context (Context *trans);
void check_removal ();
- String context_name () const;
+ std::string context_name () const;
SCM context_name_symbol () const;
Global_context *get_global_context () const;
bool try_music (Music *);
Context *find_create_context (SCM context_name,
- String id, SCM ops);
+ std::string id, SCM ops);
Context *create_unique_context (SCM context_name,
SCM ops);
Link_array<Context> path_to_acceptable_context (SCM alias,
SCM context_property, SCM grob_property_path, SCM val);
SCM updated_grob_properties (Context *tg, SCM sym);
Context *find_context_below (Context *where,
- SCM type_sym, String id);
+ SCM type_sym, std::string id);
bool melisma_busy (Context *);
Context *get_voice_to_lyrics (Context *lyrics);
#define DIMENSIONS_HH
#include "real.hh"
-class String;
+#include "std-string.hh"
const Real INCH_TO_PT = 72.270;
const Real CM_TO_PT = (INCH_TO_PT / 2.54);
#endif
-String print_dimen (Real);
+std::string print_dimen (Real);
const Real point_constant = 1 PT;
const Real inch_constant = 1 INCH;
const Real cm_constant = 1 CM;
Duration ();
Duration (int, int);
- String to_string () const;
+ std::string to_string () const;
Duration compressed (Rational) const;
Rational get_length () const;
#ifndef FILE_NAME_MAP_HH
#define FILE_NAME_MAP_HH
-#include "string.hh"
+#include "std-string.hh"
-String map_file_name (String s);
+std::string map_file_name (std::string s);
#endif /* FILE_NAME_MAP_HH */
public:
SCM description_;
- String file_name_;
+ std::string file_name_;
- virtual Stencil text_stencil (String) const;
- virtual Box text_dimension (String) const;
- virtual String font_name () const;
+ virtual Stencil text_stencil (std::string) const;
+ virtual Box text_dimension (std::string) const;
+ virtual std::string font_name () const;
virtual int count () const;
- virtual Offset attachment_point (String) const;
+ virtual Offset attachment_point (std::string) const;
virtual Offset get_indexed_wxwy (int) const;
virtual Box get_indexed_char (int index) const;
virtual Box get_ascii_char (int ascii) const;
- virtual int name_to_index (String) const;
+ virtual int name_to_index (std::string) const;
virtual unsigned index_to_charcode (int) const;
virtual int index_to_ascii (int) const;
virtual Real design_size () const;
- virtual Stencil find_by_name (String) const;
+ virtual Stencil find_by_name (std::string) const;
virtual Stencil get_indexed_char_stencil (int k) const;
virtual Stencil get_ascii_char_stencil (int k) const;
virtual SCM sub_fonts () const;
Font_metric ();
};
-int get_encoded_index (Font_metric *m, String input_coding, int code);
+int get_encoded_index (Font_metric *m, std::string input_coding, int code);
class Simple_font_metric : public Font_metric
{
#include <ft2build.h>
#include FT_FREETYPE_H
-#include "string.hh"
+#include "std-string.hh"
void init_freetype ();
extern FT_Library freetype2_library;
-FT_Face open_ft_face (String str);
+FT_Face open_ft_face (std::string str);
#endif /* FREETYPE_HH */
#define GREGORIAN_LIGATURE_HH
class Grob;
-class String;
+#include "std-string.hh"
class Gregorian_ligature
{
public:
static bool has_interface (Grob *);
- static String prefixes_to_str (Grob *);
+ static std::string prefixes_to_str (Grob *);
};
/*
bool is_live () const;
/* naming. */
- String name () const;
+ std::string name () const;
/* Properties */
SCM get_property_alist_chain (SCM) const;
void internal_set_object (SCM sym, SCM val);
/* messages */
- void warning (String) const;
- void programming_error (String) const;
+ void warning (std::string) const;
+ void programming_error (std::string) const;
/* class hierarchy */
#define GROUP_INTERFACE_HH
#include "grob.hh"
-#include "string.hh"
+#include "std-string.hh"
/**
Look at Score element ELT as thing which has a list property called
NAME_. Normally the list would contain Grobs, but
#include <FlexLexer.h>
#endif
-#include "string.hh"
+#include "std-string.hh"
#include "parray.hh"
#include "lily-proto.hh"
~Includable_lexer ();
/// store dependencies for Makefile stuff.
- Array<String> file_name_strings_;
+ Array<std::string> file_name_strings_;
Source_file *get_source_file () const;
- void new_input (String s, Sources *);
- void new_input (String name, String data, Sources *);
+ void new_input (std::string s, Sources *);
+ void new_input (std::string name, std::string data, Sources *);
char const *here_str0 () const;
};
#define INPUT_HH
#include "flower-proto.hh"
+#include "std-string.hh"
/**
Base class for anything that records its poisition in the parse file.
char const *end () const;
void set (Source_file *, char const *, char const *);
- void warning (String) const; // should use member func?
- void non_fatal_error (String) const;
- void error (String) const;
- void message (String) const;
+ void warning (std::string) const; // should use member func?
+ void non_fatal_error (std::string) const;
+ void error (std::string) const;
+ void message (std::string) const;
void set_spot (Input const &);
void step_forward ();
void set_location (Input const &, Input const &);
Input spot () const;
- String location_string () const;
- String line_number_string () const;
- String file_string ()const;
+ std::string location_string () const;
+ std::string line_number_string () const;
+ std::string file_string ()const;
int line_number ()const;
int column_number ()const;
#ifndef KPATH_HH
#define KPATH_HH
-class String;
+#include "std-string.hh"
-String kpathsea_find_tfm (char const *name);
+std::string kpathsea_find_tfm (char const *name);
void initialize_kpathsea (char *av0);
#endif /* KPATH_HH */
extern SCM global_lily_module;
-String gulp_file_to_string (String fn, bool must_exist, int size);
+std::string gulp_file_to_string (std::string fn, bool must_exist, int size);
-String ly_scm2string (SCM s);
-String ly_symbol2string (SCM);
+std::string ly_scm2string (SCM s);
+std::string ly_symbol2string (SCM);
SCM ly_offset2scm (Offset);
Offset ly_scm2offset (SCM);
SCM ly_chain_assoc (SCM key, SCM achain);
SCM ly_quote_scm (SCM s);
bool type_check_assignment (SCM val, SCM sym, SCM type_symbol);
-String print_scm_val (SCM val);
+std::string print_scm_val (SCM val);
SCM ly_number2string (SCM s);
SCM parse_symbol_list (char const *);
void ly_display_scm (SCM s);
}
-void read_lily_scm_file (String);
+void read_lily_scm_file (std::string);
void ly_c_init_guile ();
bool is_direction (SCM s);
DECLARE_SMOBS (Lily_lexer,);
private:
- int lookup_keyword (String);
- int scan_bare_word (String);
- SCM scan_markup_word (String);
- int scan_escaped_word (String);
+ int lookup_keyword (std::string);
+ int scan_bare_word (std::string);
+ SCM scan_markup_word (std::string);
+ int scan_escaped_word (std::string);
int identifier_type (SCM);
char escaped_char (char) const;
SCM scopes_;
SCM start_module_;
public:
- String main_input_name_;
+ std::string main_input_name_;
void *lexval;
Input *lexloc;
bool is_main_input_;
void start_main_input ();
- SCM lookup_identifier (String s);
+ SCM lookup_identifier (std::string s);
SCM lookup_identifier_symbol (SCM s);
void push_chord_state (SCM tab);
void push_figuredbass_state ();
Lily_lexer *lexer_;
Sources *sources_;
Duration default_duration_;
- String output_basename_;
+ std::string output_basename_;
int fatal_error_;
int error_level_;
void do_init_file ();
void do_yyparse ();
- void parse_file (String init, String name, String out_name);
- void parse_string (String ly_code);
- void parser_error (String);
- void parser_error (Input const &, String);
+ void parse_file (std::string init, std::string name, std::string out_name);
+ void parse_string (std::string ly_code);
+ void parser_error (std::string);
+ void parser_error (Input const &, std::string);
void set_yydebug (bool);
};
#ifndef LILY_VERSION_HH
#define LILY_VERSION_HH
-#include "string.hh"
+#include "std-string.hh"
-String version_string ();
-String gnu_lilypond_string ();
-String gnu_lilypond_version_string ();
+std::string version_string ();
+std::string gnu_lilypond_string ();
+std::string gnu_lilypond_version_string ();
#endif // LILY_VERSION_HH
#ifndef LILYPOND_VERSION_HH
#define LILYPOND_VERSION_HH
-#include "string.hh"
+#include "std-string.hh"
struct Lilypond_version
{
Lilypond_version (int major, int minor, int patch);
- Lilypond_version (String str);
+ Lilypond_version (std::string str);
- String to_string () const;
+ std::string to_string () const;
operator int () const;
int major_;
int minor_;
int patch_;
- String extra_patch_string_;
+ std::string extra_patch_string_;
};
extern Lilypond_version oldest_version;
{
Object_key const *context_;
Moment creation_moment_;
- String grob_name_;
+ std::string grob_name_;
int disambiguation_count_;
public:
Lilypond_grob_key (Object_key const *context,
Moment start,
- String name, int);
+ std::string name, int);
static Object_key *from_scheme (SCM);
protected:
{
Object_key const *parent_context_;
Moment start_moment_;
- String context_name_;
- String id_;
+ std::string context_name_;
+ std::string id_;
int disambiguation_count_;
public:
Lilypond_context_key (Object_key const *parent,
Moment start,
- String type,
- String id,
+ std::string type,
+ std::string id,
int count);
static Object_key *from_scheme (SCM);
class Lilypond_general_key : public Object_key
{
Object_key const *parent_;
- String name_;
+ std::string name_;
int disambiguation_count_;
public:
- Lilypond_general_key (Object_key const *parent, String name,
+ Lilypond_general_key (Object_key const *parent, std::string name,
int count);
static Object_key *from_scheme (SCM);
#include "lily-proto.hh"
#include "array.hh"
+#include "std-string.hh"
void debug_init ();
void set_debug (bool);
void do_scores ();
void clear_scores ();
void add_score (Score *s);
-void set_default_output (String s);
-String find_file (String);
+void set_default_output (std::string s);
+std::string find_file (std::string);
void call_constructors ();
-Array<String> get_inclusion_names ();
-void set_inclusion_names (Array<String>);
+Array<std::string> get_inclusion_names ();
+void set_inclusion_names (Array<std::string>);
-extern String init_name_global;
+extern std::string init_name_global;
/* options */
-extern Array<String> dump_header_fieldnames_global;
-extern String output_backend_global;
-extern String output_name_global;
+extern Array<std::string> dump_header_fieldnames_global;
+extern std::string output_backend_global;
+extern std::string output_name_global;
extern bool be_safe_global;
extern bool be_verbose_global;
extern bool do_internal_type_checking_global;
extern bool is_pango_format_global;
extern bool is_TeX_format_global;
extern bool point_and_click_global;
-extern String prefix_directory;
+extern std::string prefix_directory;
extern bool use_object_keys;
/*
todo: collect in Output_option struct?
*/
-extern String output_format_global;
+extern std::string output_format_global;
extern bool make_preview;
extern bool make_print;
/* misc */
-extern Array<String> failed_files;
+extern Array<std::string> failed_files;
extern int exit_status_global;
extern File_path global_path;
extern const char *LILYPOND_DATADIR;
/// factory
static Midi_item *get_midi (Audio_item *a);
- static String i2varint_string (int i);
+ static std::string i2varint_string (int i);
- virtual String to_string () const = 0;
+ virtual std::string to_string () const = 0;
int channel_;
};
Moment delta_mom_;
Midi_item *midi_;
- String to_string () const;
+ std::string to_string () const;
};
/**
class Midi_chunk : public Midi_item
{
public:
- void set (String header_string, String data_string, String footer_string);
- virtual String to_string () const;
- virtual String data_string () const;
+ void set (std::string header_string, std::string data_string, std::string footer_string);
+ virtual std::string to_string () const;
+ virtual std::string data_string () const;
DECLARE_CLASSNAME(Midi_chunk);
private:
- String data_string_;
- String footer_string_;
- String header_string_;
+ std::string data_string_;
+ std::string footer_string_;
+ std::string header_string_;
};
class Midi_duration : public Midi_item
public:
Midi_duration (Real seconds_f);
- virtual String to_string () const;
+ virtual std::string to_string () const;
Real seconds_;
};
Midi_instrument (Audio_instrument *);
DECLARE_CLASSNAME(Midi_instrument);
- virtual String to_string () const;
+ virtual std::string to_string () const;
Audio_instrument *audio_;
};
Midi_key (Audio_key *);
DECLARE_CLASSNAME(Midi_key);
- virtual String to_string () const;
+ virtual std::string to_string () const;
Audio_key *audio_;
};
Midi_time_signature (Audio_time_signature *);
DECLARE_CLASSNAME(Midi_time_signature);
- virtual String to_string () const;
+ virtual std::string to_string () const;
Audio_time_signature *audio_;
int clocks_per_1_;
Moment get_length () const;
int get_pitch () const;
int get_fine_tuning () const;
- virtual String to_string () const;
+ virtual std::string to_string () const;
Audio_note *audio_;
Midi_note_off (Midi_note *);
DECLARE_CLASSNAME(Midi_note_off);
- virtual String to_string () const;
+ virtual std::string to_string () const;
Midi_note *on_;
Byte aftertouch_byte_;
Midi_text (Audio_text *);
- virtual String to_string () const;
+ virtual std::string to_string () const;
Audio_text *audio_;
};
Midi_dynamic (Audio_dynamic *);
DECLARE_CLASSNAME(Midi_dynamic);
- virtual String to_string () const;
+ virtual std::string to_string () const;
Audio_dynamic *audio_;
};
Midi_piano_pedal (Audio_piano_pedal *);
DECLARE_CLASSNAME(Midi_piano_pedal);
- virtual String to_string () const;
+ virtual std::string to_string () const;
Audio_piano_pedal *audio_;
};
Midi_tempo (Audio_tempo *);
DECLARE_CLASSNAME(Midi_tempo);
- virtual String to_string () const;
+ virtual std::string to_string () const;
Audio_tempo *audio_;
};
Midi_track ();
void add (Moment delta_time_mom, Midi_item *midi);
- virtual String data_string () const;
+ virtual std::string data_string () const;
};
#endif // MIDI_ITEM_HH
#include <cstdio>
using namespace std;
-#include "string.hh"
+#include "std-string.hh"
class Midi_item;
/// Midi outputfile
struct Midi_stream
{
- Midi_stream (String file_name_string);
+ Midi_stream (std::string file_name_string);
~Midi_stream ();
- Midi_stream &operator << (String str);
+ Midi_stream &operator << (std::string str);
Midi_stream &operator << (Midi_item const &midi_c_r);
Midi_stream &operator << (int i);
void open ();
FILE *out_file_;
- String file_name_string_;
+ std::string file_name_string_;
};
#endif // MIDI_STREAM_HH
else return 0;
}
-Array<String> split_string (String s, char c);
+Array<std::string> split_string (std::string s, char c);
inline Real
linear_interpolate (Real x, Real x1, Real x2, Real y1, Real y2)
struct Modified_font_metric : public Font_metric
{
public:
- virtual Box text_dimension (String) const;
- virtual Stencil text_stencil (String) const;
+ virtual Box text_dimension (std::string) const;
+ virtual Stencil text_stencil (std::string) const;
static SCM make_scaled_font_metric (Font_metric *fm, Real magnification);
virtual int count () const;
virtual Offset get_indexed_wxwy (int) const;
- virtual Offset attachment_point (String) const;
- virtual int name_to_index (String) const;
+ virtual Offset attachment_point (std::string) const;
+ virtual int name_to_index (std::string) const;
virtual unsigned index_to_charcode (int) const;
Font_metric *original_font () const;
Modified_font_metric (Font_metric *fm, Real magnification);
virtual SCM sub_fonts () const;
- virtual String font_name () const;
+ virtual std::string font_name () const;
virtual Real design_size () const;
virtual void derived_mark () const;
virtual Box get_indexed_char (int) const;
virtual int index_to_ascii (int) const;
virtual Box get_ascii_char (int) const;
- Box tex_kludge (String) const;
+ Box tex_kludge (std::string) const;
};
#endif /* MODIFIED_FONT_METRIC_HH */
/*
Deliver a copy of THIS as a smobified SCM
*/
- String to_string () const;
+ std::string to_string () const;
static int compare (Moment const &, Moment const &);
SCM as_scheme () const;
};
#ifndef MUSIC_OUTPUT_HH
#define MUSIC_OUTPUT_HH
-#include "string.hh"
+#include "std-string.hh"
#include "lily-proto.hh"
#include "protected-scm.hh"
#include "smobs.hh"
SCM get_char_table () const;
SCM glyph_list () const;
- String get_otf_table (String tag) const;
- static SCM make_otf (String);
- virtual String font_name () const;
+ std::string get_otf_table (std::string tag) const;
+ static SCM make_otf (std::string);
+ virtual std::string font_name () const;
virtual ~Open_type_font ();
- virtual Offset attachment_point (String) const;
+ virtual Offset attachment_point (std::string) const;
virtual int count () const;
virtual Box get_indexed_char (int) const;
- virtual int name_to_index (String) const;
- //virtual unsigned glyph_name_to_charcode (String) const;
+ virtual int name_to_index (std::string) const;
+ //virtual unsigned glyph_name_to_charcode (std::string) const;
virtual unsigned index_to_charcode (int) const;
virtual void derived_mark () const;
virtual SCM sub_fonts () const;
virtual Real design_size () const;
};
-String get_otf_table (FT_Face face, String tag);
-FT_Face open_ft_face (String str);
+std::string get_otf_table (FT_Face face, std::string tag);
+FT_Face open_ft_face (std::string str);
#endif /* OPEN_TYPE_FONT_HH */
#ifndef MUSIC_OUTPUT_DEF_HH
#define MUSIC_OUTPUT_DEF_HH
-#include "string.hh"
+#include "std-string.hh"
#include "lily-proto.hh"
#include "virtual-methods.hh"
#include "smobs.hh"
Output_def *parent_;
Input input_origin_;
- String user_key_;
+ std::string user_key_;
Lily_parser *parser_;
Lily_parser *get_parser () const;
/*
variables.
*/
- SCM c_variable (String id) const;
+ SCM c_variable (std::string id) const;
SCM lookup_variable (SCM sym) const;
void set_variable (SCM sym, SCM val);
Real get_dimension (SCM symbol) const;
~Pango_font ();
SCM font_file_name () const;
- void register_font_file (String, String);
- Stencil text_stencil (String) const;
- Stencil pango_item_string_stencil (PangoItem const *, String) const;
+ void register_font_file (std::string, std::string);
+ Stencil text_stencil (std::string) const;
+ Stencil pango_item_string_stencil (PangoItem const *, std::string) const;
virtual void derived_mark () const;
};
#include "lily-proto.hh"
#include "array.hh"
-#include "string.hh"
+#include "std-string.hh"
#include "protected-scm.hh"
#include "smobs.hh"
class Paper_outputter
{
SCM output_module_;
- String file_name_;
+ std::string file_name_;
SCM file_;
public:
SCM file () const;
SCM dump_string (SCM);
void output_scheme (SCM scm);
- Paper_outputter (SCM port, String format);
+ Paper_outputter (SCM port, std::string format);
SCM scheme_to_string (SCM);
void output_stencil (Stencil);
void close ();
};
-Paper_outputter *get_paper_outputter (String, String);
+Paper_outputter *get_paper_outputter (std::string, std::string);
DECLARE_UNSMOB (Paper_outputter, outputter);
#endif /* PAPER_OUTPUTTER_HH */
void output_header_track (Midi_stream &midi_stream_r);
void print () const;
- void write_output (String filename);
+ void write_output (std::string filename);
Link_array<Audio_staff> audio_staffs_;
Cons<Audio_element> *audio_element_list_;
int steps () const;
int semitone_pitch () const;
int quartertone_pitch () const;
- String to_string () const;
+ std::string to_string () const;
DECLARE_SCHEME_CALLBACK (less_p, (SCM a, SCM b));
DECLARE_SIMPLE_SMOBS (Pitch,);
public:
Prob (SCM, SCM);
Prob (Prob const &);
- virtual String name () const;
+ virtual std::string name () const;
SCM type () const { return type_; }
SCM get_property_alist (bool mutble) const;
SCM internal_get_property (SCM sym) const;
-#include "string.hh"
+#include "std-string.hh"
-int sane_putenv (char const *key, String value, bool overwrite);
+int sane_putenv (char const *key, std::string value, bool overwrite);
void setup_paths (char const *argv0);
extern bool relocate_binary;
public:
DECLARE_SCHEME_CALLBACK (y_offset_callback, (SCM));
static bool has_interface (Grob *);
- static String glyph_name (Grob *, int, String, bool);
+ static std::string glyph_name (Grob *, int, std::string, bool);
static SCM brew_internal_stencil (Grob*, bool);
static SCM generic_extent_callback (Grob*, Axis);
DECLARE_SCHEME_CALLBACK (polyphonic_offset_callback, (SCM));
#include "parray.hh"
#include "smobs.hh"
#include "virtual-methods.hh"
-#include "string.hh"
+#include "std-string.hh"
class Score : public Input
{
public:
Link_array<Output_def> defs_;
- String user_key_;
+ std::string user_key_;
SCM header_;
bool error_found_;
int index_;
#if DEBUG_SLUR_SCORING
- String score_card_;
+ std::string score_card_;
#endif
Slur_configuration ();
#ifndef SOURCE_FILE_HH
#define SOURCE_FILE_HH
+#include "std-string.hh"
+
#include <iostream>
using namespace std;
-#include "string.hh"
#include "protected-scm.hh"
#include "parray.hh"
class Source_file
{
public:
- Source_file (String fn);
- Source_file (String, String);
+ Source_file (std::string fn);
+ Source_file (std::string, std::string);
virtual ~Source_file ();
char const *c_str () const;
- virtual String quote_input (char const *pos_str0) const;
+ virtual std::string quote_input (char const *pos_str0) const;
istream *get_istream ();
bool contains (char const *pos_str0) const;
int length () const;
virtual int get_line (char const *pos_str0) const;
- String name_string () const;
- String file_line_column_string (char const *str0) const;
+ std::string name_string () const;
+ std::string file_line_column_string (char const *str0) const;
// return start + n
char const *seek_str0 (int n);
// return here + n bytes
char const *forward_str0 (int n);
char const *pos_str0 () { return pos_str0_; }
- String get_string (int n);
+ std::string get_string (int n);
void set_pos (char const *pos_str0);
public:
Slice line_slice (char const *pos_str0) const;
- String line_string (char const *pos_str0) const;
+ std::string line_string (char const *pos_str0) const;
void get_counts (char const *pos_str0, int *, int *, int *) const;
/*
char const *pos_str0_;
SCM get_port () const;
- String name_;
+ std::string name_;
private:
Link_array<char> newline_locations_;
Protected_scm str_port_;
};
-char *gulp_file (String fn, int *len);
+char *gulp_file (std::string fn, int *len);
#endif /* SOURCE_FILE_HH */
#ifndef SOURCE_HH
#define SOURCE_HH
+
#include "cons.hh"
#include "flower-proto.hh"
+#include "std-string.hh"
/* A set of sourcefiles. */
class Sources
Sources ();
~Sources ();
- Source_file *get_file (String &file_name);
+ Source_file *get_file (std::string &file_name);
Source_file *get_sourcefile (char const *);
void add (Source_file *sourcefile);
void set_path (File_path *);
#ifndef STREAM_HH
#define STREAM_HH
+#include "std-string.hh"
+
#include <iostream>
#include <sstream>
using namespace std;
-#include "string.hh"
-
#if __GNUC__ > 2
-ostream *open_file_stream (String file_name,
+ostream *open_file_stream (std::string file_name,
ios_base::openmode mode = ios::out);
#else
-ostream *open_file_stream (String file_name, int mode = ios::out);
+ostream *open_file_stream (std::string file_name, int mode = ios::out);
#endif
void close_file_stream (ostream *os);
#include "lily-guile.hh"
#include "box.hh"
-void try_load_text_metrics (String);
+void try_load_text_metrics (std::string);
SCM ly_load_text_dimensions (SCM);
Box lookup_tex_text_dimension (Font_metric *font,
SCM text);
private:
Real get_U32_fix ();
Real get_U32_fix_scaled ();
- String get_bcpl_string ();
+ std::string get_bcpl_string ();
void read_header ();
void read_params ();
void read_char_metrics ();
Binary_source_file input_;
public:
- Tex_font_metric_reader (String name);
+ Tex_font_metric_reader (std::string name);
Tfm_info info_;
Tfm_header header_;
Char_code first_charcode, last_charcode;
U32 checksum;
Real design_size;
- String coding_scheme;
+ std::string coding_scheme;
unsigned parameter_count;
// Real parameters [Tex_font_metric::MAX_FONTDIMENS];
Real parameters [TFM_MAX_FONTDIMENS];
{
DECLARE_CLASSNAME(Tex_font_metric);
public:
- static SCM make_tfm (String file_name);
+ static SCM make_tfm (std::string file_name);
virtual int count () const;
virtual Box get_ascii_char (int) const;
virtual Real design_size () const;
virtual void derived_mark () const;
- virtual int name_to_index (String) const;
- virtual String font_name () const;
+ virtual int name_to_index (std::string) const;
+ virtual std::string font_name () const;
Tfm_info const &info () const;
Array<Tex_font_char_metric> char_metrics_;
Array<int> ascii_to_metric_idx_;
SCM encoding_table_;
- String font_name_;
+ std::string font_name_;
private:
Tex_font_char_metric const *find_ascii (int ascii, bool warn = true) const;
Tex_font_metric ();
#define TRANSLATOR_HH
#include "global-ctor.hh"
-#include "string.hh"
+#include "std-string.hh"
#include "lily-proto.hh"
#include "virtual-methods.hh"
#include "input.hh"
class Type_swallow_translator : public Translator
{
protected:
- String swallow_string_;
+ std::string swallow_string_;
bool try_music (Music *);
public:
VIRTUAL_COPY_CONS (Translator);
(c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-#include "string.hh"
+#include "std-string.hh"
#include "input-smob.hh"
/* We don't use IMPLEMENT_TYPE_P, since the smobification part is
msg = scm_simple_format (SCM_BOOL_F, msg, rest);
- String m = ly_scm2string (msg);
+ std::string m = ly_scm2string (msg);
ip->message (m);
return SCM_UNSPECIFIED;
#include "input-smob.hh"
-#include "string.hh"
+#include "std-string.hh"
#include "ly-smobs.icc"
static int
print_smob (SCM s, SCM port, scm_print_state *)
{
- String str = "#<location " + unsmob_input (s)->location_string () + ">";
+ std::string str = "#<location " + unsmob_input (s)->location_string () + ">";
scm_puts (str.c_str (), port);
return 1;
}
#include <cstdio>
using namespace std;
-#include "source.hh"
+#include "international.hh"
#include "source-file.hh"
+#include "source.hh"
#include "warn.hh"
Input::Input (Input const &i)
[file:line:column:][warning:]message
*/
void
-Input::message (String s) const
+Input::message (std::string s) const
{
if (source_file_)
s = location_string () + ": " + s + "\n"
}
void
-Input::warning (String s) const
+Input::warning (std::string s) const
{
message (_f ("warning: %s", s));
}
void
-Input::error (String s) const
+Input::error (std::string s) const
{
message (_f ("error: %s", s));
// UGH, fix naming or usage
}
void
-Input::non_fatal_error (String s) const
+Input::non_fatal_error (std::string s) const
{
message (_f ("error: %s", s));
}
-String
+std::string
Input::location_string () const
{
if (source_file_)
return " (" + _ ("position unknown") + ")";
}
-String
+std::string
Input::line_number_string () const
{
if (source_file_)
return "?";
}
-String
+std::string
Input::file_string () const
{
if (source_file_)
keyplacement by Mats Bengtsson
*/
+#include "accidental-interface.hh"
+#include "font-interface.hh"
+#include "international.hh"
#include "item.hh"
+#include "lookup.hh"
#include "output-def.hh"
-#include "font-interface.hh"
#include "staff-symbol-referencer.hh"
-#include "lookup.hh"
-#include "accidental-interface.hh"
struct Key_signature_interface
{
Real inter = Staff_symbol_referencer::staff_space (me) / 2.0;
SCM scm_style = me->get_property ("style");
- String style;
+ std::string style;
if (scm_is_symbol (scm_style))
style = ly_symbol2string (scm_style);
else
for (SCM s = newas; scm_is_pair (s); s = scm_cdr (s))
{
int alteration = scm_to_int (scm_cdar (s));
- String font_char
+ std::string font_char
= Accidental_interface::get_fontcharname (style, alteration);
Stencil acc (fm->find_by_name ("accidentals." + font_char));
#include <iostream>
using namespace std;
-#include "music-function.hh"
-#include "source-file.hh"
-#include "parse-scm.hh"
-#include "lily-guile.hh"
-#include "string.hh"
-#include "string-convert.hh"
-#include "lily-lexer.hh"
+#include "context-def.hh"
+#include "identifier-smob.hh"
+#include "international.hh"
#include "interval.hh"
#include "lily-guile.hh"
-#include "parser.hh"
-#include "warn.hh"
+#include "lily-lexer.hh"
+#include "lilypond-input-version.hh"
#include "main.hh"
+#include "music-function.hh"
+#include "parse-scm.hh"
+#include "parser.hh"
+#include "source-file.hh"
+#include "std-string.hh"
+#include "string-convert.hh"
#include "version.hh"
-#include "lilypond-input-version.hh"
-#include "context-def.hh"
-#include "identifier-smob.hh"
+#include "warn.hh"
/*
RH 7 fix (?)
*/
#define isatty HORRIBLEKLUDGE
-void strip_trailing_white (String&);
-void strip_leading_white (String&);
-String lyric_fudge (String s);
+void strip_trailing_white (std::string&);
+void strip_leading_white (std::string&);
+std::string lyric_fudge (std::string s);
int music_function_type (SCM);
-SCM lookup_markup_command (String s);
-bool is_valid_version (String s);
+SCM lookup_markup_command (std::string s);
+bool is_valid_version (std::string s);
#define start_quote() \
yy_push_state (quote);\
- yylval.string = new String
+ yylval.string = new std::string
#define start_lyric_quote() \
yy_push_state (lyric_quote);\
- yylval.string = new String
+ yylval.string = new std::string
#define yylval \
(*(YYSTYPE*)lexval)
*/
-SCM scan_fraction (String);
+SCM scan_fraction (std::string);
SCM (* scm_parse_error_handler) (void *);
yy_push_state (sourcefilename);
}
<version>\"[^"]*\" { /* got the version number */
- String s (YYText () + 1);
- s = s.left_string (s.index_last ('\"'));
+ std::string s (YYText () + 1);
+ s = s.substr (0, s.rfind ('\"'));
yy_pop_state ();
if (!is_valid_version (s))
}
<sourcefilename>\"[^"]*\" {
- String s (YYText () + 1);
- s = s.left_string (s.index_last ('\"'));
+ std::string s (YYText () + 1);
+ s = s.substr (0, s.rfind ('\"'));
yy_pop_state ();
this->here_input().get_source_file ()->name_ = s;
yy_push_state (incl);
}
<incl>\"[^"]*\" { /* got the include file name */
- String s (YYText ()+1);
- s = s.left_string (s.index_last ('"'));
+ std::string s (YYText ()+1);
+ s = s.substr (0, s.rfind ('"'));
new_input (s, sources_);
yy_pop_state ();
}
<incl>\\{BLACK}*{WHITE} { /* got the include identifier */
- String s = YYText () + 1;
+ std::string s = YYText () + 1;
strip_trailing_white (s);
if (s.length () && (s[s.length () - 1] == ';'))
- s = s.left_string (s.length () - 1);
+ s = s.substr (0, s.length () - 1);
SCM sid = lookup_identifier (s);
if (scm_is_string (sid)) {
new_input (ly_scm2string (sid), sources_);
yy_pop_state ();
} else {
- String msg (_f ("wrong or undefined identifier: `%s'", s ));
+ std::string msg (_f ("wrong or undefined identifier: `%s'", s ));
LexerError (msg.c_str ());
SCM err = scm_current_error_port ();
}
{DIGIT} {
- yylval.i = String_convert::dec2int (String (YYText ()));
+ yylval.i = String_convert::dec2int (std::string (YYText ()));
return DIGIT;
}
{UNSIGNED} {
- yylval.i = String_convert::dec2int (String (YYText ()));
+ yylval.i = String_convert::dec2int (std::string (YYText ()));
return UNSIGNED;
}
{E_UNSIGNED} {
- yylval.i = String_convert::dec2int (String (YYText () +1));
+ yylval.i = String_convert::dec2int (std::string (YYText () +1));
return E_UNSIGNED;
}
\" {
yy_pop_state ();
/* yylval is union. Must remember STRING before setting SCM*/
- String *sp = yylval.string;
+ std::string *sp = yylval.string;
yylval.scm = scm_makfrom0str (sp->c_str ());
delete sp;
return STRING;
yy_pop_state ();
/* yylval is union. Must remember STRING before setting SCM*/
- String *sp = yylval.string;
+ std::string *sp = yylval.string;
yylval.scm = scm_makfrom0str (sp->c_str ());
delete sp;
return LYRICS_STRING;
return FRACTION;
}
{UNSIGNED} {
- yylval.i = String_convert::dec2int (String (YYText ()));
+ yylval.i = String_convert::dec2int (std::string (YYText ()));
return UNSIGNED;
}
{NOTECOMMAND} {
}
{LYRICS} {
/* ugr. This sux. */
- String s (YYText ());
+ std::string s (YYText ());
if (s == "__")
return yylval.i = EXTENDER;
if (s == "--")
return FRACTION;
}
{UNSIGNED} {
- yylval.i = String_convert::dec2int (String (YYText ()));
+ yylval.i = String_convert::dec2int (std::string (YYText ()));
return UNSIGNED;
}
\" {
return SCORE;
}
{MARKUPCOMMAND} {
- String str (YYText () + 1);
+ std::string str (YYText () + 1);
SCM s = lookup_markup_command (str);
if (scm_is_pair (s) && scm_is_symbol (scm_cdr (s)) ) {
return YYText ()[0];
}
[^#{}"\\ \t\n\r\f]+ {
- String s (YYText ());
+ std::string s (YYText ());
char c = s[s.length () - 1];
/* brace open is for not confusing dumb tools. */
}
{UNSIGNED} {
- yylval.i = String_convert::dec2int (String (YYText ()));
+ yylval.i = String_convert::dec2int (std::string (YYText ()));
return UNSIGNED;
}
}
<*>. {
- String msg = _f ("invalid character: `%c'", YYText ()[0]);
+ std::string msg = _f ("invalid character: `%c'", YYText ()[0]);
LexerError (msg.c_str ());
return YYText ()[0];
}
int
-Lily_lexer::scan_escaped_word (String str)
+Lily_lexer::scan_escaped_word (std::string str)
{
// use more SCM for this.
return identifier_type (sid);
}
- String msg (_f ("unknown escaped string: `\\%s'", str));
+ std::string msg (_f ("unknown escaped string: `\\%s'", str));
LexerError (msg.c_str ());
yylval.scm = scm_makfrom0str (str.c_str ());
}
int
-Lily_lexer::scan_bare_word (String str)
+Lily_lexer::scan_bare_word (std::string str)
{
SCM sym = ly_symbol2scm (str.c_str ());
if ((YYSTATE == notes) || (YYSTATE == chords)) {
}
/*
- urg, belong to String (_convert)
+ urg, belong to std::string (_convert)
and should be generalised
*/
void
-strip_leading_white (String&s)
+strip_leading_white (std::string&s)
{
- int i = 0;
- for (; i < s.length (); i++)
+ ssize i = 0;
+ for (; i < s.length (); i++)
if (!isspace (s[i]))
break;
- s = s.nomid_string (0, i);
+ s = s.substr (i);
}
void
-strip_trailing_white (String&s)
+strip_trailing_white (std::string&s)
{
- int i = s.length ();
+ ssize i = s.length ();
while (i--)
if (!isspace (s[i]))
break;
- s = s.left_string (i+1);
+ s = s.substr (0, i + 1);
}
bool
-is_valid_version (String s)
+is_valid_version (std::string s)
{
Lilypond_version current ( MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL );
Lilypond_version ver (s);
/*
substitute _ and \,
*/
-String
-lyric_fudge (String s)
+std::string
+lyric_fudge (std::string s)
{
- char * chars = s.get_copy_str0 ();
+ char *chars = string_copy (s);
- for (char * p = chars; *p ; p++)
+ for (char *p = chars; *p ; p++)
{
if (*p == '_' && (p == chars || *(p-1) != '\\'))
*p = ' ';
}
- s = String (chars);
+ s = std::string (chars);
delete[] chars;
- int i = 0;
- if ((i = s.index ("\\,")) != -1) // change "\," to TeX's "\c "
+ ssize i = 0;
+ if ((i = s.find ("\\,")) != NPOS) // change "\," to TeX's "\c "
{
- * (s.get_str0 () + i + 1) = 'c';
- s = s.left_string (i+2) + " " + s.right_string (s.length ()-i-2);
+ * (((char*)s.c_str ()) + i + 1) = 'c';
+ s = s.substr (0, i + 2) + " " + s.substr (i - 2);
}
return s;
Convert "NUM/DEN" into a '(NUM . DEN) cons.
*/
SCM
-scan_fraction (String frac)
+scan_fraction (std::string frac)
{
- int i = frac.index ('/');
- int l = frac.length ();
- String left = frac.left_string (i);
- String right = frac.right_string (l - i - 1);
+ ssize i = frac.find ('/');
+ std::string left = frac.substr (0, i);
+ std::string right = frac.substr (i - 1);
int n = String_convert::dec2int (left);
int d = String_convert::dec2int (right);
}
SCM
-lookup_markup_command (String s)
+lookup_markup_command (std::string s)
{
SCM proc = ly_lily_module_constant ("lookup-markup-command");
return scm_call_1 (proc, scm_makfrom0str (s.c_str ()));
#include "ligature-engraver.hh"
-#include "spanner.hh"
-#include "score-engraver.hh"
+#include "context.hh"
+#include "international.hh"
#include "note-head.hh"
#include "rest.hh"
+#include "score-engraver.hh"
+#include "spanner.hh"
#include "warn.hh"
-#include "context.hh"
#include "translator.icc"
return scm_list_n (ly_symbol2scm ("quote"), s, SCM_UNDEFINED);
}
-String
+std::string
ly_symbol2string (SCM s)
{
/*
return ly_scm2string (str);
}
-String
-gulp_file_to_string (String fn, bool must_exist, int size)
+std::string
+gulp_file_to_string (std::string fn, bool must_exist, int size)
{
- String s = global_path.find (fn);
+ std::string s = global_path.find (fn);
if (s == "")
{
if (must_exist)
{
- String e = _f ("can't find file: `%s'", fn);
+ std::string e = _f ("can't find file: `%s'", fn);
e += " ";
e += _f ("(load path: `%s')", global_path.to_string ());
error (e);
int n = size;
char *str = gulp_file (s, &n);
- String result ((Byte *) str, n);
+ std::string result (str, n);
delete[] str;
if (be_verbose_global)
}
};
-String
+std::string
ly_scm2string (SCM str)
{
assert (scm_is_string (str));
- return String ((Byte *)scm_i_string_chars (str),
- (int) scm_i_string_length (str));
+ return std::string (scm_i_string_chars (str),
+ (int) scm_i_string_length (str));
}
char *
}
SCM
-ly_string_array_to_scm (Array<Std_string> a)
+ly_string_array_to_scm (Array<std::string> a)
{
SCM s = SCM_EOL;
for (int i = a.size () - 1; i >= 0; i--)
{
while (isspace (*symbols))
*symbols++;
- String s = symbols;
- s.substitute ('\n', ' ');
- s.substitute ('\t', ' ');
+ std::string s = symbols;
+ replace_all (s, '\n', ' ');
+ replace_all (s, '\t', ' ');
return ly_string_array_to_scm (String_convert::split (s, ' '));
}
return lst;
}
-String
+std::string
print_scm_val (SCM val)
{
- String realval = ly_scm2string (ly_write2scm (val));
+ std::string realval = ly_scm2string (ly_write2scm (val));
if (realval.length () > 200)
- realval = realval.left_string (100)
+ realval = realval.substr (0, 100)
+ "\n :\n :\n"
- + realval.right_string (100);
+ + realval.substr (realval.length () - 100);
return realval;
}
#include <sstream>
using namespace std;
-#include "scm-hash.hh"
+#include "international.hh"
#include "interval.hh"
-#include "parser.hh"
#include "keyword.hh"
-#include "warn.hh"
-#include "source-file.hh"
#include "main.hh"
#include "moment.hh"
+#include "parser.hh"
+#include "scm-hash.hh"
+#include "source-file.hh"
+#include "warn.hh"
static Keyword_ent the_key_tab[]
= {
}
int
-Lily_lexer::lookup_keyword (String s)
+Lily_lexer::lookup_keyword (std::string s)
{
return keytable_->lookup (s.c_str ());
}
}
SCM
-Lily_lexer::lookup_identifier (String name)
+Lily_lexer::lookup_identifier (std::string name)
{
return lookup_identifier_symbol (ly_symbol2scm (name.c_str ()));
}
{
if (lookup_keyword (ly_symbol2string (sym)) >= 0)
{
- String symstr = ly_symbol2string (sym);
+ std::string symstr = ly_symbol2string (sym);
warning (_f ("identifier name is a keyword: `%s'", symstr.c_str ()));
}
#include "file-name-map.hh"
#include "file-name.hh"
#include "file-path.hh"
+#include "international.hh"
#include "lily-lexer.hh"
#include "lily-parser.hh"
#include "ly-module.hh"
char const *file = scm_i_string_chars (name);
char const *extensions[] = {"ly", "", 0};
- String file_name = global_path.find (file, extensions);
+ std::string file_name = global_path.find (file, extensions);
/* By default, use base name of input file for output file name,
write output to cwd; do not use root and directory parts of input
out_file_name = File_name (output_name_global);
}
- String init;
+ std::string init;
if (!init_name_global.empty ())
init = init_name_global;
else
init = "init.ly";
- String out_file = out_file_name.to_string ();
+ std::string out_file = out_file_name.to_string ();
if (init.length () && global_path.find (init).empty ())
{
Sources sources;
sources.set_path (&global_path);
- String mapped_fn = map_file_name (file_name);
+ std::string mapped_fn = map_file_name (file_name);
message (_f ("Processing `%s'", mapped_fn.c_str ()));
progress_indication ("\n");
*/
#include "lily-parser.hh"
-#include "text-metrics.hh"
+
#include "book.hh"
-#include "lilypond-key.hh"
+#include "file-name.hh"
+#include "file-path.hh"
+#include "international.hh"
+#include "lily-lexer.hh"
#include "lily-version.hh"
+#include "lilypond-key.hh"
#include "main.hh"
-#include "lily-lexer.hh"
#include "output-def.hh"
#include "paper-book.hh"
#include "parser.hh"
#include "score.hh"
-#include "file-name.hh"
-#include "file-path.hh"
#include "source.hh"
+#include "text-metrics.hh"
#include "warn.hh"
#include "ly-smobs.icc"
/* Process one .ly file, or book. */
void
-Lily_parser::parse_file (String init, String name, String out_name)
+Lily_parser::parse_file (std::string init, std::string name, std::string out_name)
{
if (output_backend_global == "tex")
try_load_text_metrics (out_name);
lexer_->new_input (init, sources_);
File_name f (name);
- String s = global_path.find (f.base_ + ".twy");
+ std::string s = global_path.find (f.base_ + ".twy");
s = gulp_file_to_string (s, false, -1);
scm_eval_string (scm_makfrom0str (s.c_str ()));
}
void
-Lily_parser::parse_string (String ly_code)
+Lily_parser::parse_string (std::string ly_code)
{
// TODO: use $parser
lexer_->set_identifier (ly_symbol2scm ("parser"),
}
void
-Lily_parser::parser_error (String s)
+Lily_parser::parser_error (std::string s)
{
lexer_->here_input ().error (_ (s.c_str ()));
error_level_ = 1;
}
void
-Lily_parser::parser_error (Input const &i, String s)
+Lily_parser::parser_error (Input const &i, std::string s)
{
i.error (s);
error_level_ = 1;
#include "config.hh"
#include "version.hh"
-String
+std::string
version_string ()
{
- String str = MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL;
- String mpl ("." MY_PATCH_LEVEL);
+ std::string str = MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL;
+ std::string mpl ("." MY_PATCH_LEVEL);
if (mpl != ".")
str += mpl;
return str;
}
-String
+std::string
gnu_lilypond_string ()
{
- String str = "GNU LilyPond";
+ std::string str = "GNU LilyPond";
return str;
}
-String
+std::string
gnu_lilypond_version_string ()
{
- String str = gnu_lilypond_string () + " " + version_string ();
+ std::string str = gnu_lilypond_string () + " " + version_string ();
return str;
}
Lilypond_grob_key::Lilypond_grob_key (Object_key const *context,
Moment start,
- String name,
+ std::string name,
int disambiguation_count)
{
context_ = context;
if (c)
return c;
- c = String::compare (grob_name_, other->grob_name_);
+ c = grob_name_.compare (other->grob_name_);
if (c)
return c;
Lilypond_context_key::Lilypond_context_key (Object_key const *parent,
Moment start,
- String type,
- String id,
+ std::string type,
+ std::string id,
int count)
{
disambiguation_count_ = count;
if (c)
return c;
- c = String::compare (context_name_, other->context_name_);
+ c = context_name_.compare (other->context_name_);
if (c)
return c;
- c = String::compare (id_, other->id_);
+ c = id_.compare (other->id_);
if (c)
return c;
}
Lilypond_general_key::Lilypond_general_key (Object_key const *parent,
- String name,
+ std::string name,
int count)
{
parent_ = parent;
else if (other->parent_)
return 1;
- int c = String::compare (name_, other->name_);
+ int c = name_.compare (other->name_);
if (c)
return c;
patch_ = patch;
}
-Lilypond_version::Lilypond_version (String str)
+Lilypond_version::Lilypond_version (std::string str)
{
major_ = 0;
minor_ = 0;
patch_ = 0;
- Array<Std_string> version;
+ Array<std::string> version;
version = String_convert::split (str, '.');
if (version.size () > 0 && isdigit (version[0][0]))
extra_patch_string_ = version[3];
}
-String
+std::string
Lilypond_version::to_string () const
{
- return ::to_string (major_) + "." + ::to_string (minor_) + "." + ::to_string (patch_);
+ return std::to_string (major_) + "." + std::to_string (minor_) + "." + std::to_string (patch_);
}
Lilypond_version::operator int () const
Lookup::accordion (SCM s, Real staff_space, Font_metric *fm)
{
Stencil m;
- String sym = ly_scm2string (scm_car (s));
- String reg = ly_scm2string (scm_car (scm_cdr (s)));
+ std::string sym = ly_scm2string (scm_car (s));
+ std::string reg = ly_scm2string (scm_car (scm_cdr (s)));
if (sym == "Discant")
{
Stencil r = fm->find_by_name ("accordion.accDiscant");
m.add_stencil (r);
- if (reg.left_string (1) == "F")
+ if (reg.substr (0, 1) == "F")
{
Stencil d = fm->find_by_name ("accordion.accDot");
d.translate_axis (staff_space * 2.5 PT, Y_AXIS);
m.add_stencil (d);
- reg = reg.right_string (reg.length () - 1);
+ reg = reg.substr (1);
}
int eflag = 0x00;
- if (reg.left_string (3) == "EEE")
+ if (reg.substr (0, 3) == "EEE")
{
eflag = 0x07;
- reg = reg.right_string (reg.length () - 3);
+ reg = reg.substr (3);
}
- else if (reg.left_string (2) == "EE")
+ else if (reg.substr (0, 2) == "EE")
{
eflag = 0x05;
- reg = reg.right_string (reg.length () - 2);
+ reg = reg.substr (2);
}
- else if (reg.left_string (2) == "Eh")
+ else if (reg.substr (0, 2) == "Eh")
{
eflag = 0x04;
- reg = reg.right_string (reg.length () - 2);
+ reg = reg.substr (2);
}
- else if (reg.left_string (1) == "E")
+ else if (reg.substr (0, 1) == "E")
{
eflag = 0x02;
- reg = reg.right_string (reg.length () - 1);
+ reg = reg.substr (1);
}
if (eflag & 0x02)
{
d.translate_axis (-0.8 * staff_space PT, X_AXIS);
m.add_stencil (d);
}
- if (reg.left_string (2) == "SS")
+ if (reg.substr (0, 2) == "SS")
{
Stencil d = fm->find_by_name ("accordion.accDot");
d.translate_axis (0.5 * staff_space PT, Y_AXIS);
m.add_stencil (d);
d.translate_axis (-0.8 * staff_space PT, X_AXIS);
m.add_stencil (d);
- reg = reg.right_string (reg.length () - 2);
+ reg = reg.substr (2);
}
- if (reg.left_string (1) == "S")
+ if (reg.substr (0, 1) == "S")
{
Stencil d = fm->find_by_name ("accordion.accDot");
d.translate_axis (0.5 * staff_space PT, Y_AXIS);
m.add_stencil (d);
- reg = reg.right_string (reg.length () - 1);
+ reg = reg.substr (1);
}
}
else if (sym == "Freebase")
{
Stencil r = fm->find_by_name ("accordion.accFreebase");
m.add_stencil (r);
- if (reg.left_string (1) == "F")
+ if (reg.substr (0, 1) == "F")
{
Stencil d = fm->find_by_name ("accordion.accDot");
d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
m.add_stencil (d);
- reg = reg.right_string (reg.length () - 1);
+ reg = reg.substr (1);
}
if (reg == "E")
{
{
Stencil r = fm->find_by_name ("accordion.accBayanbase");
m.add_stencil (r);
- if (reg.left_string (1) == "T")
+ if (reg.substr (0, 1) == "T")
{
Stencil d = fm->find_by_name ("accordion.accDot");
d.translate_axis (staff_space * 2.5 PT, Y_AXIS);
m.add_stencil (d);
- reg = reg.right_string (reg.length () - 1);
+ reg = reg.substr (1);
}
/* include 4' reed just for completeness. You don't want to use this. */
- if (reg.left_string (1) == "F")
+ if (reg.substr (0, 1) == "F")
{
Stencil d = fm->find_by_name ("accordion.accDot");
d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
m.add_stencil (d);
- reg = reg.right_string (reg.length () - 1);
+ reg = reg.substr (1);
}
- if (reg.left_string (2) == "EE")
+ if (reg.substr (0, 2) == "EE")
{
Stencil d = fm->find_by_name ("accordion.accDot");
d.translate_axis (staff_space * 0.5 PT, Y_AXIS);
m.add_stencil (d);
d.translate_axis (-0.8 * staff_space PT, X_AXIS);
m.add_stencil (d);
- reg = reg.right_string (reg.length () - 2);
+ reg = reg.substr (2);
}
- if (reg.left_string (1) == "E")
+ if (reg.substr (0, 1) == "E")
{
Stencil d = fm->find_by_name ("accordion.accDot");
d.translate_axis (staff_space * 0.5 PT, Y_AXIS);
m.add_stencil (d);
- reg = reg.right_string (reg.length () - 1);
+ reg = reg.substr (1);
}
}
else if (sym == "Stdbase")
{
Stencil r = fm->find_by_name ("accordion.accStdbase");
m.add_stencil (r);
- if (reg.left_string (1) == "T")
+ if (reg.substr (0, 1) == "T")
{
Stencil d = fm->find_by_name ("accordion.accDot");
d.translate_axis (staff_space * 3.5 PT, Y_AXIS);
m.add_stencil (d);
- reg = reg.right_string (reg.length () - 1);
+ reg = reg.substr (1);
}
- if (reg.left_string (1) == "F")
+ if (reg.substr (0, 1) == "F")
{
Stencil d = fm->find_by_name ("accordion.accDot");
d.translate_axis (staff_space * 2.5 PT, Y_AXIS);
m.add_stencil (d);
- reg = reg.right_string (reg.length () - 1);
+ reg = reg.substr (1);
}
- if (reg.left_string (1) == "M")
+ if (reg.substr (0, 1) == "M")
{
Stencil d = fm->find_by_name ("accordion.accDot");
d.translate_axis (staff_space * 2 PT, Y_AXIS);
d.translate_axis (staff_space PT, X_AXIS);
m.add_stencil (d);
- reg = reg.right_string (reg.length () - 1);
+ reg = reg.substr (1);
}
- if (reg.left_string (1) == "E")
+ if (reg.substr (0, 1) == "E")
{
Stencil d = fm->find_by_name ("accordion.accDot");
d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
m.add_stencil (d);
- reg = reg.right_string (reg.length () - 1);
+ reg = reg.substr (1);
}
- if (reg.left_string (1) == "S")
+ if (reg.substr (0, 1) == "S")
{
Stencil d = fm->find_by_name ("accordion.accDot");
d.translate_axis (staff_space * 0.5 PT, Y_AXIS);
m.add_stencil (d);
- reg = reg.right_string (reg.length () - 1);
+ reg = reg.substr (1);
}
}
/* ugh maybe try to use regular font for S.B. and B.B and only use one font
#include "lily-guile.hh"
#include "warn.hh"
#include "main.hh"
-#include "string.hh"
+#include "std-string.hh"
#include "protected-scm.hh"
#ifdef MODULE_GC_KLUDGE
return c;
SCM voice_name = lyrics->get_property ("associatedVoice");
- String nm = lyrics->id_string ();
+ std::string nm = lyrics->id_string ();
if (scm_is_string (voice_name))
nm = ly_scm2string (voice_name);
else
{
- int idx = nm.index_last ('-');
+ ssize idx = nm.rfind ('-');
if (idx != NPOS)
- nm = nm.left_string (idx);
+ nm = nm.substr (0, idx);
}
Context *parent = lyrics;
#include "freetype.hh"
#include "getopt-long.hh"
#include "global-ctor.hh"
+#include "international.hh"
#include "lily-guile.hh"
#include "lily-version.hh"
#include "misc.hh"
#include "output-def.hh"
+#include "program-option.hh"
+#include "relocate.hh"
#include "string-convert.hh"
#include "version.hh"
#include "warn.hh"
-#include "program-option.hh"
-#include "relocate.hh"
/*
* Global options that can be overridden through command line.
*/
/* Names of header fields to be dumped to a separate file. */
-Array<String> dump_header_fieldnames_global;
+Array<std::string> dump_header_fieldnames_global;
/* Name of initialisation file. */
-String init_name_global;
+std::string init_name_global;
/* Selected output backend
One of (gnome, ps [default], eps, scm, svg, tex, texstr)") */
-String output_backend_global = "ps";
+std::string output_backend_global = "ps";
/* Output formats to generate. */
-String output_format_global = "";
+std::string output_format_global = "";
bool is_pango_format_global;
bool is_TeX_format_global;
/* Current output name. */
-String output_name_global;
+std::string output_name_global;
/* Run in safe mode? */
bool be_safe_global = false;
/* Scheme code to execute before parsing, after .scm init.
This is where -e arguments are appended to. */
-String init_scheme_code_string;
-String init_scheme_variables;
+std::string init_scheme_code_string;
+std::string init_scheme_variables;
/* Generate preview of first system. */
bool make_preview = false;
/* Where the init files live. Typically:
LILYPOND_DATADIR = /usr/share/lilypond
*/
-String prefix_directory;
+std::string prefix_directory;
/* The jail specification: USER,GROUP,JAIL,DIR. */
-String jail_spec;
+std::string jail_spec;
/* The option parser */
static Getopt_long *option_parser = 0;
}
static void
-prepend_load_path (String dir)
+prepend_load_path (std::string dir)
{
- String s = "(set! %load-path (cons \"" + dir + "\" %load-path))";
+ std::string s = "(set! %load-path (cons \"" + dir + "\" %load-path))";
scm_c_eval_string (s.c_str ());
}
USER_NAME, GROUP_NAME, JAIL, DIR, JAIL_MAX
};
- Array<Std_string> components = String_convert::split (jail_spec, ',');
+ Array<std::string> components = String_convert::split (jail_spec, ',');
if (components.size () != JAIL_MAX)
{
error (_f ("expected %d arguments with jail, found: %d", JAIL_MAX,
Disable localisation of float values. This breaks TeX output. */
setlocale (LC_NUMERIC, "C");
- String localedir = LOCALEDIR;
+ std::string localedir = LOCALEDIR;
if (char const *env = getenv ("LILYPOND_LOCALEDIR"))
localedir = env;
}
static void
-add_output_format (String format)
+add_output_format (std::string format)
{
if (output_format_global != "")
output_format_global += ",";
switch (opt->shortname_char_)
{
case 0:
- if (String (opt->longname_str0_) == "dvi"
- || String (opt->longname_str0_) == "pdf"
- || String (opt->longname_str0_) == "png"
- || String (opt->longname_str0_) == "ps"
- || String (opt->longname_str0_) == "tex")
+ if (std::string (opt->longname_str0_) == "dvi"
+ || std::string (opt->longname_str0_) == "pdf"
+ || std::string (opt->longname_str0_) == "png"
+ || std::string (opt->longname_str0_) == "ps"
+ || std::string (opt->longname_str0_) == "tex")
add_output_format (opt->longname_str0_);
- else if (String (opt->longname_str0_) == "preview")
+ else if (std::string (opt->longname_str0_) == "preview")
make_preview = true;
- else if (String (opt->longname_str0_) == "no-pages")
+ else if (std::string (opt->longname_str0_) == "no-pages")
make_print = false;
- else if (String (opt->longname_str0_) == "relocate")
+ else if (std::string (opt->longname_str0_) == "relocate")
relocate_binary = true;
break;
case 'd':
{
- String arg (option_parser->optional_argument_str0_);
- int eq = arg.index ('=');
+ std::string arg (option_parser->optional_argument_str0_);
+ ssize eq = arg.find ('=');
- String key = arg;
- String val = "#t";
+ std::string key = arg;
+ std::string val = "#t";
if (eq != NPOS)
{
- key = arg.left_string (eq);
- val = arg.right_string (arg.length () - eq - 1);
+ key = arg.substr (0, eq);
+ val = arg.substr (eq + 1);
}
init_scheme_variables
break;
case 'o':
{
- String s = option_parser->optional_argument_str0_;
+ std::string s = option_parser->optional_argument_str0_;
File_name file_name (s);
output_name_global = file_name.to_string ();
}
#include "engraver.hh"
+#include "axis-group-interface.hh"
#include "bar-line.hh"
#include "context.hh"
+#include "grob-array.hh"
+#include "international.hh"
#include "item.hh"
-#include "warn.hh"
#include "text-interface.hh"
-#include "grob-array.hh"
-#include "axis-group-interface.hh"
+#include "warn.hh"
/**
put stuff over or next to bars. Examples: bar numbers, marginal notes,
*/
#include "coherent-ligature-engraver.hh"
+#include "font-interface.hh"
+#include "international.hh"
#include "mensural-ligature.hh"
#include "music.hh"
-#include "warn.hh"
-#include "spanner.hh"
-#include "paper-column.hh"
#include "note-column.hh"
-#include "rhythmic-head.hh"
#include "note-head.hh"
-#include "staff-symbol-referencer.hh"
#include "output-def.hh"
-#include "font-interface.hh"
+#include "paper-column.hh"
+#include "rhythmic-head.hh"
+#include "spanner.hh"
+#include "staff-symbol-referencer.hh"
+#include "warn.hh"
/*
* TODO: accidentals are aligned with the first note;
Pal Benko <benkop@freestart.hu>
*/
-
#include "mensural-ligature.hh"
-#include "item.hh"
+
#include "font-interface.hh"
+#include "international.hh"
+#include "item.hh"
#include "lookup.hh"
-#include "staff-symbol-referencer.hh"
#include "note-head.hh"
#include "output-def.hh"
+#include "staff-symbol-referencer.hh"
#include "warn.hh"
/*
#include "midi-item.hh"
-#include "warn.hh"
+#include "duration.hh"
+#include "international.hh"
#include "main.hh"
-#include "misc.hh"
-#include "string-convert.hh"
#include "midi-stream.hh"
-#include "duration.hh"
+#include "misc.hh"
#include "program-option.hh"
+#include "string-convert.hh"
+#include "warn.hh"
#include "killing-cons.tcc"
}
void
-Midi_chunk::set (String header_string, String data_string, String footer_string)
+Midi_chunk::set (std::string header_string, std::string data_string, std::string footer_string)
{
data_string_ = data_string;
footer_string_ = footer_string;
header_string_ = header_string;
}
-String
+std::string
Midi_chunk::data_string () const
{
return data_string_;
}
-String
+std::string
Midi_chunk::to_string () const
{
- String str = header_string_;
- String dat = data_string ();
- String length_string = String_convert::int2hex (dat.length ()
+ std::string str = header_string_;
+ std::string dat = data_string ();
+ std::string length_string = String_convert::int2hex (dat.length ()
+ footer_string_.length (), 8, '0');
length_string = String_convert::hex2bin (length_string);
seconds_ = seconds_f;
}
-String
+std::string
Midi_duration::to_string () const
{
- return String ("<duration: ") + ::to_string (seconds_) + ">";
+ return std::string ("<duration: ") + std::to_string (seconds_) + ">";
}
Midi_event::Midi_event (Moment delta_mom, Midi_item *midi)
/*
ugh. midi output badly broken since grace note hackage.
*/
-String
+std::string
Midi_event::to_string () const
{
Rational rat_dt = (delta_mom_.main_part_ * Rational (384)
+ delta_mom_.grace_part_ * Rational (100)) * Rational (4);
int delta_i = rat_dt.to_int ();
- String delta_string = Midi_item::i2varint_string (delta_i);
- String midi_string = midi_->to_string ();
+ std::string delta_string = Midi_item::i2varint_string (delta_i);
+ std::string midi_string = midi_->to_string ();
assert (midi_string.length ());
return delta_string + midi_string;
}
Midi_header::Midi_header (int format_i, int tracks_i, int clocks_per_4_i)
{
- String str;
+ std::string str;
- String format_string = String_convert::int2hex (format_i, 4, '0');
+ std::string format_string = String_convert::int2hex (format_i, 4, '0');
str += String_convert::hex2bin (format_string);
- String tracks_string = String_convert::int2hex (tracks_i, 4, '0');
+ std::string tracks_string = String_convert::int2hex (tracks_i, 4, '0');
str += String_convert::hex2bin (tracks_string);
- String tempo_string = String_convert::int2hex (clocks_per_4_i, 4, '0');
+ std::string tempo_string = String_convert::int2hex (clocks_per_4_i, 4, '0');
str += String_convert::hex2bin (tempo_string);
set ("MThd", str, "");
Midi_instrument::Midi_instrument (Audio_instrument *a)
{
audio_ = a;
- audio_->str_.to_lower ();
+ audio_->str_ = String_convert::to_lower (audio_->str_);
}
-String
+std::string
Midi_instrument::to_string () const
{
Byte program_byte = 0;
else
warning (_f ("no such MIDI instrument: `%s'", audio_->str_.c_str ()));
- String str = ::to_string ((char) (0xc0 + channel_)); //YIKES! FIXME : Should be track. -rz
- str += ::to_string ((char)program_byte);
+ std::string str = std::to_string ((char) (0xc0 + channel_)); //YIKES! FIXME : Should be track. -rz
+ str += std::to_string ((char)program_byte);
return str;
}
{
}
-String
+std::string
Midi_item::i2varint_string (int i)
{
int buffer_i = i & 0x7f;
buffer_i += (i & 0x7f);
}
- String str;
+ std::string str;
while (1)
{
- str += ::to_string ((char)buffer_i);
+ str += std::to_string ((char)buffer_i);
if (buffer_i & 0x80)
buffer_i >>= 8;
else
audio_ = a;
}
-String
+std::string
Midi_key::to_string () const
{
- String str = "ff5902";
+ std::string str = "ff5902";
str += String_convert::int2hex (audio_->accidentals_, 2, '0');
if (audio_->major_)
str += String_convert::int2hex (0, 2, '0');
clocks_per_1_ = 18;
}
-String
+std::string
Midi_time_signature::to_string () const
{
int num = audio_->beats_;
int den = audio_->one_beat_;
- String str = "ff5804";
+ std::string str = "ff5804";
str += String_convert::int2hex (num, 2, '0');
str += String_convert::int2hex (intlog2 (den), 2, '0');
str += String_convert::int2hex (clocks_per_1_, 2, '0');
return p;
}
-String
+std::string
Midi_note::to_string () const
{
Byte status_byte = (char) (0x90 + channel_);
- String str = "";
+ std::string str = "";
int finetune;
// print warning if fine tuning was needed, HJJ
// The pitch wheel range (of 4 semitones) is multiplied by the cents.
finetune += (PITCH_WHEEL_RANGE *get_fine_tuning ()) / (4 * 100);
- str += ::to_string ((char) (0xE0 + channel_));
- str += ::to_string ((char) (finetune & 0x7F));
- str += ::to_string ((char) (finetune >> 7));
- str += ::to_string ((char) (0x00));
+ str += std::to_string ((char) (0xE0 + channel_));
+ str += std::to_string ((char) (finetune & 0x7F));
+ str += std::to_string ((char) (finetune >> 7));
+ str += std::to_string ((char) (0x00));
}
- str += ::to_string ((char)status_byte);
- str += ::to_string ((char) (get_pitch () + c0_pitch_i_));
- str += ::to_string ((char)dynamic_byte_);
+ str += std::to_string ((char)status_byte);
+ str += std::to_string ((char) (get_pitch () + c0_pitch_i_));
+ str += std::to_string ((char)dynamic_byte_);
return str;
}
aftertouch_byte_ = 64;
}
-String
+std::string
Midi_note_off::to_string () const
{
Byte status_byte = (char) (0x80 + channel_);
- String str = ::to_string ((char)status_byte);
- str += ::to_string ((char) (get_pitch () + Midi_note::c0_pitch_i_));
- str += ::to_string ((char)aftertouch_byte_);
+ std::string str = std::to_string ((char)status_byte);
+ str += std::to_string ((char) (get_pitch () + Midi_note::c0_pitch_i_));
+ str += std::to_string ((char)aftertouch_byte_);
if (get_fine_tuning () != 0)
{
// Move pitch wheel back to the central position.
- str += ::to_string ((char) 0x00);
- str += ::to_string ((char) (0xE0 + channel_));
- str += ::to_string ((char) (PITCH_WHEEL_CENTER &0x7F));
- str += ::to_string ((char) (PITCH_WHEEL_CENTER >> 7));
+ str += std::to_string ((char) 0x00);
+ str += std::to_string ((char) (0xE0 + channel_));
+ str += std::to_string ((char) (PITCH_WHEEL_CENTER &0x7F));
+ str += std::to_string ((char) (PITCH_WHEEL_CENTER >> 7));
}
return str;
audio_ = a;
}
-String
+std::string
Midi_dynamic::to_string () const
{
Byte status_byte = (char) (0xB0 + channel_);
- String str = ::to_string ((char)status_byte);
+ std::string str = std::to_string ((char)status_byte);
/*
Main volume controller (per channel):
if (volume > full_scale)
volume = (int)full_scale;
- str += ::to_string ((char)0x07);
- str += ::to_string ((char)volume);
+ str += std::to_string ((char)0x07);
+ str += std::to_string ((char)volume);
return str;
}
audio_ = a;
}
-String
+std::string
Midi_piano_pedal::to_string () const
{
Byte status_byte = (char) (0xB0 + channel_);
- String str = ::to_string ((char)status_byte);
+ std::string str = std::to_string ((char)status_byte);
if (audio_->type_string_ == "Sostenuto")
- str += ::to_string ((char)0x42);
+ str += std::to_string ((char)0x42);
else if (audio_->type_string_ == "Sustain")
- str += ::to_string ((char)0x40);
+ str += std::to_string ((char)0x40);
else if (audio_->type_string_ == "UnaCorda")
- str += ::to_string ((char)0x43);
+ str += std::to_string ((char)0x43);
int pedal = ((1 - audio_->dir_) / 2) * 0x7f;
- str += ::to_string ((char)pedal);
+ str += std::to_string ((char)pedal);
return str;
}
audio_ = a;
}
-String
+std::string
Midi_tempo::to_string () const
{
int useconds_per_4_i = 60 * (int)1e6 / audio_->per_minute_4_;
- String str = "ff5103";
+ std::string str = "ff5103";
str += String_convert::int2hex (useconds_per_4_i, 6, '0');
return String_convert::hex2bin (str);
}
audio_ = a;
}
-String
+std::string
Midi_text::to_string () const
{
- String str = "ff" + String_convert::int2hex (audio_->type_, 2, '0');
+ std::string str = "ff" + String_convert::int2hex (audio_->type_, 2, '0');
str = String_convert::hex2bin (str);
str += i2varint_string (audio_->text_string_.length ());
str += audio_->text_string_;
// "00" "ff59" "02" "ff" "00"
;
- String data_string;
+ std::string data_string;
// only for format 0 (currently using format 1)?
data_string += String_convert::hex2bin (data_str0);
char const *footer_str0 = "00" "ff2f" "00";
- String footer_string = String_convert::hex2bin (footer_str0);
+ std::string footer_string = String_convert::hex2bin (footer_str0);
set ("MTrk", data_string, footer_string);
}
event_p_list_.append (new Killing_cons<Midi_event> (e, 0));
}
-String
+std::string
Midi_track::data_string () const
{
- String str = Midi_chunk::data_string ();
+ std::string str = Midi_chunk::data_string ();
if (do_midi_debugging_global)
str += "\n";
for (Cons<Midi_event> *i = event_p_list_.head_; i; i = i->next_)
#include <cerrno>
using namespace std;
-#include "stream.hh"
-#include "string-convert.hh"
+#include "international.hh"
#include "main.hh"
-#include "misc.hh"
#include "midi-item.hh"
-#include "warn.hh"
+#include "misc.hh"
#include "program-option.hh"
+#include "stream.hh"
+#include "string-convert.hh"
+#include "warn.hh"
-Midi_stream::Midi_stream (String file_name)
+Midi_stream::Midi_stream (std::string file_name)
{
file_name_string_ = file_name;
out_file_ = fopen (file_name.c_str (), "wb");
}
Midi_stream &
-Midi_stream::operator << (String str)
+Midi_stream::operator << (std::string str)
{
size_t sz = sizeof (Byte);
size_t n = str.length ();
- size_t written = fwrite (str.get_bytes (),
- sz, n, out_file_);
+ size_t written = fwrite (str.data (), sz, n, out_file_);
if (written != sz * n)
warning (_ ("can't write to file: `%s'"));
Midi_stream &
Midi_stream::operator << (Midi_item const &midi_c_r)
{
- String str = midi_c_r.to_string ();
+ std::string str = midi_c_r.to_string ();
// ugh, should have separate debugging output with Midi*::print routines
if (do_midi_debugging_global)
{
str = String_convert::bin2hex (str) + "\n";
- for (int i = str.index ("0a"); i != NPOS; i = str.index ("0a"))
+ for (ssize i = str.find ("0a"); i != NPOS; i = str.find ("0a"))
{
str[i] = '\n';
str[i + 1] = '\t';
#include "misc.hh"
-#include "string.hh"
+#include "std-string.hh"
/*
Return the 2-log, rounded down
return log (x) / log (2.0);
}
-Array<String>
-split_string (String s, char c)
+Array<std::string>
+split_string (std::string s, char c)
{
- Array<String> rv;
+ Array<std::string> rv;
while (s.length ())
{
- int i = s.index (c);
+ ssize i = s.find (c);
if (i == 0)
{
- s = s.nomid_string (0, 1);
+ s = s.substr (1);
continue;
}
if (i == NPOS)
i = s.length ();
- rv.push (s.cut_string (0, i));
- s = s.nomid_string (0, i);
+ rv.push (s.substr (0, i));
+ s = s.substr (i);
}
return rv;
}
Offset
-Modified_font_metric::attachment_point (String s) const
+Modified_font_metric::attachment_point (std::string s) const
{
Offset o = orig_->attachment_point (s);
return o * magnification_;
}
int
-Modified_font_metric::name_to_index (String s) const
+Modified_font_metric::name_to_index (std::string s) const
{
return orig_->name_to_index (s);
}
/* TODO: put this klutchness behind ly:option switch. */
Box
-Modified_font_metric::tex_kludge (String text) const
+Modified_font_metric::tex_kludge (std::string text) const
{
Interval ydims;
Real w = 0;
- for (int i = 0; i < text.length (); i++)
+ for (ssize i = 0; i < text.length (); i++)
{
switch (text[i])
{
case '\\':
/* Accent marks use width of base letter */
- if (i +1 < text.length ())
+ if (i < text.length () - 1)
{
if (text[i + 1]=='\'' || text[i + 1]=='`' || text[i + 1]=='"'
|| text[i + 1]=='^')
}
Stencil
-Modified_font_metric::text_stencil (String text) const
+Modified_font_metric::text_stencil (std::string text) const
{
Box b;
if (Pango_font *pf = dynamic_cast<Pango_font *> (orig_))
}
Box
-Modified_font_metric::text_dimension (String text) const
+Modified_font_metric::text_dimension (std::string text) const
{
SCM stext = scm_makfrom0str (text.c_str ());
Box b = lookup_tex_text_dimension (orig_, stext);
Real w = 0.0;
- for (int i = 0; i < text.length (); i++)
+ for (ssize i = 0; i < text.length (); i++)
{
Box b = get_ascii_char ((unsigned char)text[i]);
return orig_->sub_fonts ();
}
-String
+std::string
Modified_font_metric::font_name () const
{
return original_font ()->font_name ();
#include "lily-guile.hh"
#include "warn.hh"
#include "main.hh"
-#include "string.hh"
+#include "std-string.hh"
#include "ly-module.hh"
Moment *r = (Moment *) SCM_CELL_WORD_1 (s);
scm_puts ("#<Mom ", port);
- String str = r->to_string ();
+ std::string str = r->to_string ();
scm_puts ((char *)str.c_str (), port);
scm_puts (">", port);
main_part_.set_infinite (k);
}
-String
+std::string
Moment::to_string () const
{
- String s = main_part_.to_string ();
+ std::string s = main_part_.to_string ();
if (grace_part_)
s += "G" + grace_part_.to_string ();
return s;
{
extern SCM ly_music_p_proc;
- String str = "";
+ std::string str = "";
for (SCM s = signature; scm_is_pair (s); s = scm_cdr (s))
{
if (str != "")
*/
#include "music.hh"
-#include "music-sequence.hh"
+
#include "duration.hh"
#include "input-smob.hh"
+#include "international.hh"
#include "ly-smobs.icc"
#include "main.hh"
+#include "music-sequence.hh"
#include "pitch.hh"
#include "score.hh"
#include "warn.hh"
(c) 1998--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-#include "warn.hh"
#include "engraver.hh"
-#include "side-position-interface.hh"
-#include "stem.hh"
+
+#include "international.hh"
#include "rhythmic-head.hh"
-#include "self-alignment-interface.hh"
#include "script-interface.hh"
+#include "self-alignment-interface.hh"
+#include "side-position-interface.hh"
#include "stem.hh"
+#include "stem.hh"
+#include "warn.hh"
#include "translator.icc"
*/
#include "context.hh"
-#include "music.hh"
#include "grob.hh"
-#include "music-iterator.hh"
#include "input.hh"
+#include "international.hh"
+#include "music-iterator.hh"
+#include "music.hh"
class Lyric_combine_music_iterator : public Music_iterator
{
while (t && t->get_parent_context ())
t = t->get_parent_context ();
- String name = ly_scm2string (voice_name);
+ std::string name = ly_scm2string (voice_name);
Context *voice = find_context_below (t, ly_symbol2scm ("Voice"), name);
if (voice)
{
SCM voice_name = get_music ()->get_property ("associated-context");
- String name;
+ std::string name;
if (scm_is_string (voice_name))
name = ly_scm2string (voice_name);
#include "note-collision.hh"
-
-#include "warn.hh"
+#include "axis-group-interface.hh"
+#include "dot-column.hh"
+#include "international.hh"
#include "note-column.hh"
#include "note-head.hh"
-#include "rhythmic-head.hh"
#include "output-def.hh"
-#include "axis-group-interface.hh"
-#include "stem.hh"
-#include "side-position-interface.hh"
-#include "dot-column.hh"
#include "pointer-group-interface.hh"
-
+#include "rhythmic-head.hh"
+#include "side-position-interface.hh"
+#include "stem.hh"
+#include "warn.hh"
void
#include <cmath> // ceil
using namespace std;
+#include "accidental-placement.hh"
#include "axis-group-interface.hh"
-#include "stem.hh"
-#include "warn.hh"
-#include "output-def.hh"
-#include "staff-symbol-referencer.hh"
-#include "rest.hh"
+#include "directional-element-interface.hh"
+#include "international.hh"
#include "note-head.hh"
-#include "accidental-placement.hh"
+#include "output-def.hh"
#include "pointer-group-interface.hh"
-#include "directional-element-interface.hh"
+#include "rest.hh"
+#include "staff-symbol-referencer.hh"
+#include "stem.hh"
+#include "warn.hh"
/*
TODO: figure out if we can prune this class. This is just an
using namespace std;
#include "directional-element-interface.hh"
-#include "staff-symbol.hh"
-#include "misc.hh"
#include "dots.hh"
-#include "warn.hh"
#include "font-interface.hh"
+#include "international.hh"
+#include "lookup.hh"
+#include "misc.hh"
#include "music.hh"
+#include "output-def.hh"
#include "rhythmic-head.hh"
#include "staff-symbol-referencer.hh"
-#include "lookup.hh"
-#include "output-def.hh"
+#include "staff-symbol.hh"
+#include "warn.hh"
/*
clean up the mess left by ledger line handling.
*/
static Stencil
-internal_print (Grob *me, String *font_char)
+internal_print (Grob *me, std::string *font_char)
{
SCM style = me->get_property ("style");
if (!scm_is_symbol (style))
style = ly_symbol2scm ("default");
- String suffix = to_string (min (robust_scm2int (me->get_property ("duration-log"), 2), 2));
+ std::string suffix = to_string (min (robust_scm2int (me->get_property ("duration-log"), 2), 2));
if (style != ly_symbol2scm ("default"))
{
SCM gn = me->get_property ("glyph-name");
Font_metric *fm = Font_interface::get_default_font (me);
- String idx = "noteheads.s" + suffix;
+ std::string idx = "noteheads.s" + suffix;
Stencil out = fm->find_by_name (idx);
if (out.is_empty ())
{
- String prefix = "noteheads.";
+ std::string prefix = "noteheads.";
Grob *stem = unsmob_grob (me->get_object ("stem"));
Direction stem_dir = stem ? get_grob_direction (stem) : CENTER;
{
Grob *me = unsmob_grob (smob);
- String idx;
+ std::string idx;
return internal_print (me, &idx).smobbed_copy ();
}
{
Grob *me = unsmob_grob (smob);
Font_metric *fm = Font_interface::get_default_font (me);
- String key;
+ std::string key;
internal_print (me, &key);
Offset att;
void
Note_name_engraver::process_music ()
{
- String s;
+ std::string s;
for (int i = 0; i < events_.size (); i++)
{
if (i)
char ctag [5] = " ";
- String tag_string = ly_scm2string (tag);
+ std::string tag_string = ly_scm2string (tag);
strncpy (ctag, tag_string.c_str (), tag_string.length ());
- String tab = otf->get_otf_table (String (ctag));
+ std::string tab = otf->get_otf_table (std::string (ctag));
- return scm_from_locale_stringn ((char const *) tab.to_bytes (), tab.length ());
+ return scm_from_locale_stringn ((char const *) tab.data (), tab.length ());
}
LY_DEFINE (ly_otf_font_p, "ly:otf-font?", 1, 0, 0,
#include <freetype/tttables.h>
#include "dimensions.hh"
+#include "international.hh"
#include "modified-font-metric.hh"
#include "warn.hh"
return 0;
}
-String
-Open_type_font::get_otf_table (String tag) const
+std::string
+Open_type_font::get_otf_table (std::string tag) const
{
return ::get_otf_table (face_, tag);
}
SCM tab = SCM_EOL;
if (buffer)
{
- String contents ((Byte const *)buffer, length);
+ std::string contents ((char const*)buffer, length);
contents = "(quote (" + contents + "))";
tab = scm_c_eval_string (contents.c_str ());
/*
UGH fix naming
*/
-String
-get_otf_table (FT_Face face, String tag)
+std::string
+get_otf_table (FT_Face face, std::string tag)
{
FT_ULong len;
FT_Byte *tab = load_table (tag.c_str (), face, &len);
- return String (tab, len);
+ return std::string ((char const*) tab, len);
}
FT_Face
-open_ft_face (String str)
+open_ft_face (std::string str)
{
FT_Face face;
int error_code = FT_New_Face (freetype2_library, str.c_str (), 0, &face);
}
SCM
-Open_type_font::make_otf (String str)
+Open_type_font::make_otf (std::string str)
{
FT_Face face = open_ft_face (str);
Open_type_font *otf = new Open_type_font (face);
}
Offset
-Open_type_font::attachment_point (String glyph_name) const
+Open_type_font::attachment_point (std::string glyph_name) const
{
SCM sym = ly_symbol2scm (glyph_name.c_str ());
SCM entry = scm_hashq_ref (lily_character_table_, sym, SCM_BOOL_F);
}
int
-Open_type_font::name_to_index (String nm) const
+Open_type_font::name_to_index (std::string nm) const
{
char *nm_str = (char *) nm.c_str ();
if (int idx = FT_Get_Name_Index (face_, nm_str))
return lily_global_table_;
}
-String
+std::string
Open_type_font::font_name () const
{
return FT_Get_Postscript_Name (face_);
}
SCM
-Output_def::c_variable (String s) const
+Output_def::c_variable (std::string s) const
{
return lookup_variable (ly_symbol2scm (s.c_str ()));
}
(c) 2000--2006 Jan Nieuwenhuizen <janneke@gnu.org>
*/
-#include "input.hh"
#include "simple-music-iterator.hh"
+
+#include "input.hh"
+#include "international.hh"
#include "music.hh"
class Output_property_music_iterator : public Simple_music_iterator
#include "dimensions.hh"
#include "file-name.hh"
+#include "international.hh"
#include "lookup.hh"
#include "main.hh"
+#include "string-convert.hh"
#include "warn.hh"
#if HAVE_PANGO_FT2
}
void
-Pango_font::register_font_file (String filename, String ps_name)
+Pango_font::register_font_file (std::string filename, std::string ps_name)
{
scm_hash_set_x (physical_font_tab_,
scm_makfrom0str (ps_name.c_str ()),
}
Stencil
-Pango_font::pango_item_string_stencil (PangoItem const *item, String str) const
+Pango_font::pango_item_string_stencil (PangoItem const *item, std::string str) const
{
const int GLYPH_NAME_LEN = 256;
char glyph_name[GLYPH_NAME_LEN];
char *file_name_as_ptr = 0;
FcPatternGetString (fcpat, FC_FILE, 0, (FcChar8 **) & file_name_as_ptr);
- String file_name;
+ std::string file_name;
if (file_name_as_ptr)
{
/* Normalize file name. */
if (!ps_name_str0)
warning (_f ("no PostScript font name for font `%s'", file_name));
- String ps_name;
+ std::string ps_name;
if (!ps_name_str0
&& file_name != ""
- && (file_name.index (".otf") != NPOS
- || file_name.index (".cff") != NPOS))
+ && (file_name.find (".otf") != NPOS
+ || file_name.find (".cff") != NPOS))
{
/* UGH: kludge a PS name for OTF/CFF fonts. */
- String name = file_name;
- int idx = max (file_name.index (".otf"),
- file_name.index (".cff"));
+ std::string name = file_name;
+ ssize idx = file_name.find (".otf");
+ if (idx == NPOS)
+ idx = file_name.find (".cff");
- name = name.left_string (idx);
+ name = name.substr (0, idx);
- int slash_idx = name.index_last ('/');
+ ssize slash_idx = name.rfind ('/');
if (slash_idx != NPOS)
- name = name.right_string (name.length () - slash_idx - 1);
+ name = name.substr (slash_idx - 1);
- String initial = name.cut_string (0, 1);
- initial.to_upper ();
- name = name.nomid_string (0, 1);
- name.to_lower ();
+ std::string initial = name.substr (0, 1);
+ initial = String_convert::to_upper (initial);
+ name = name.substr (1);
+ name = String_convert::to_lower (name);
ps_name = initial + name;
}
else if (ps_name_str0)
}
Stencil
-Pango_font::text_stencil (String str) const
+Pango_font::text_stencil (std::string str) const
{
GList *items
= pango_itemize (context_,
PangoFontDescription *description = 0;
if (scm_is_string (name))
{
- String name_str = ly_scm2string (name);
+ std::string name_str = ly_scm2string (name);
description = pango_font_description_from_string (name_str.c_str ());
}
else
{
PangoFontDescription *description = pango_font_description_new ();
- String family_str = "roman";
+ std::string family_str = "roman";
if (scm_is_symbol (family))
family_str = ly_symbol2string (family);
else if (scm_is_string (family))
if (ly_is_module (header_))
scopes = scm_cons (header_, scopes);
- String mod_nm = "scm framework-" + output_backend_global;
+ std::string mod_nm = "scm framework-" + output_backend_global;
SCM mod = scm_c_resolve_module (mod_nm.c_str ());
if (make_print)
if (ly_is_module (header_0_))
scopes = scm_cons (header_0_, scopes);
- String format = output_backend_global;
- String mod_nm = "scm framework-" + format;
+ std::string format = output_backend_global;
+ std::string mod_nm = "scm framework-" + format;
SCM mod = scm_c_resolve_module (mod_nm.c_str ());
SCM func = scm_c_module_lookup (mod, "output-classic-framework");
{
Grob *me = unsmob_grob (p);
- String r = to_string (Paper_column::get_rank (me));
+ std::string r = to_string (Paper_column::get_rank (me));
Moment *mom = unsmob_moment (me->get_property ("when"));
- String when = mom ? mom->to_string () : "?/?";
+ std::string when = mom ? mom->to_string () : "?/?";
SCM properties = Font_interface::text_font_alist_chain (me);
*/
#include "paper-outputter.hh"
-#include "warn.hh"
+
+#include "international.hh"
#include "stencil.hh"
+#include "warn.hh"
LY_DEFINE (ly_make_paper_outputter, "ly:make-paper-outputter",
2, 0, 0, (SCM port, SCM format),
SCM_ASSERT_TYPE (scm_is_string (format), format, SCM_ARG2, __FUNCTION__,
"String");
- String f = ly_scm2string (format);
+ std::string f = ly_scm2string (format);
- String output_name = "<unknown>";
+ std::string output_name = "<unknown>";
SCM port_name = scm_port_filename (port);
if (scm_is_string (port_name))
#include "ly-smobs.icc"
-Paper_outputter::Paper_outputter (SCM port, String format)
+Paper_outputter::Paper_outputter (SCM port, std::string format)
{
file_ = port;
output_module_ = SCM_EOL;
smobify_self ();
- String module_name = "scm output-" + format;
+ std::string module_name = "scm output-" + format;
output_module_ = scm_c_resolve_module (module_name.c_str ());
}
*/
#include "paper-score.hh"
-#include "book.hh"
+
#include "all-font-metrics.hh"
+#include "book.hh"
#include "gourlay-breaking.hh"
+#include "international.hh"
#include "main.hh"
#include "misc.hh"
#include "output-def.hh"
#include <cstdio>
using namespace std;
+#include "international.hh"
#include "main.hh"
#include "paper-book.hh"
#include "source-file.hh"
#include "book.hh"
#include "context-def.hh"
#include "dimensions.hh"
-#include "music.hh"
#include "file-path.hh"
#include "input-smob.hh"
#include "input.hh"
+#include "international.hh"
#include "lily-guile.hh"
+#include "lily-lexer.hh"
+#include "lily-parser.hh"
#include "lilypond-input-version.hh"
#include "main.hh"
#include "misc.hh"
-#include "lily-lexer.hh"
-#include "lily-parser.hh"
-#include "paper-book.hh"
+#include "music.hh"
+#include "music.hh"
#include "output-def.hh"
-#include "scm-hash.hh"
+#include "paper-book.hh"
#include "program-option.hh"
+#include "scm-hash.hh"
#include "score.hh"
#include "text-interface.hh"
#include "warn.hh"
-#include "music.hh"
%}
Book *book;
Output_def *outputdef;
SCM scm;
- String *string;
+ std::string *string;
Music *music;
Score *score;
int i;
bool
is_regular_identifier (SCM id)
{
- String str = ly_scm2string (id);
+ std::string str = ly_scm2string (id);
char const *s = str.c_str ();
bool v = true;
solo2 ();
else if (scm_is_symbol (tag))
{
- String s = "Unknown split directive: "
- + (scm_is_symbol (tag) ? ly_symbol2string (tag) : String ("not a symbol"));
+ std::string s = "Unknown split directive: "
+ + (scm_is_symbol (tag) ? ly_symbol2string (tag) : std::string ("not a symbol"));
programming_error (s);
}
}
#include "score-engraver.hh"
-#include "repeated-music.hh"
+#include "bar-line.hh"
#include "global-context.hh"
-#include "warn.hh"
-#include "misc.hh"
-#include "spanner.hh"
+#include "international.hh"
#include "item.hh"
+#include "misc.hh"
#include "percent-repeat-iterator.hh"
-#include "bar-line.hh"
+#include "repeated-music.hh"
#include "side-position-interface.hh"
+#include "spanner.hh"
+#include "warn.hh"
#include "translator.icc"
#include "percent-repeat-iterator.hh"
-#include "repeated-music.hh"
#include "input.hh"
+#include "international.hh"
+#include "repeated-music.hh"
IMPLEMENT_CTOR_CALLBACK (Percent_repeat_iterator);
#include "audio-column.hh"
#include "audio-staff.hh"
#include "file-name.hh"
+#include "international.hh"
#include "lily-version.hh"
#include "main.hh"
#include "midi-item.hh"
midi_track.channel_ = 9;
// perhaps multiple text events?
- String id_string;
- String str = String (_ ("Creator: "));
+ std::string id_string;
+ std::string str = std::string (_ ("Creator: "));
id_string = String_convert::pad_to (gnu_lilypond_version_string (), 30);
str += id_string;
str = _ ("at ");
time_t t (time (0));
str += ctime (&t);
- str = str.left_string (str.length () - 1);
+ str = str.substr (0, str.length () - 1);
str = String_convert::pad_to (str, 60);
Audio_text at_a (Audio_text::TEXT, str);
}
void
-Performance::write_output (String out)
+Performance::write_output (std::string out)
{
if (out == "-")
out = "lelie.midi";
SCM_ASSERT_TYPE (scm_is_string (pfb_file_name), pfb_file_name,
SCM_ARG1, __FUNCTION__, "string");
- String file_name = ly_scm2string (pfb_file_name);
+ std::string file_name = ly_scm2string (pfb_file_name);
int len = -1;
if (be_verbose_global)
SCM_ASSERT_TYPE (scm_is_string (otf_file_name), otf_file_name,
SCM_ARG1, __FUNCTION__, "string");
- String file_name = ly_scm2string (otf_file_name);
+ std::string file_name = ly_scm2string (otf_file_name);
if (be_verbose_global)
progress_indication ("[" + file_name);
FT_Face face = open_ft_face (file_name);
- String table = get_otf_table (face, "CFF ");
+ std::string table = get_otf_table (face, "CFF ");
- SCM asscm = scm_from_locale_stringn ((char *) table.get_bytes (),
+ SCM asscm = scm_from_locale_stringn ((char *) table.data (),
table.length ());
if (be_verbose_global)
(c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
+#include "engraver.hh"
+
#include "context.hh"
#include "directional-element-interface.hh"
-#include "engraver.hh"
-#include "slur.hh"
+#include "international.hh"
#include "note-column.hh"
+#include "slur.hh"
#include "spanner.hh"
#include "tie.hh"
#include "warn.hh"
*/
#include "engraver.hh"
-#include "lily-guile.hh"
-#include "side-position-interface.hh"
-#include "staff-symbol-referencer.hh"
+
#include "axis-group-interface.hh"
#include "context.hh"
#include "directional-element-interface.hh"
+#include "international.hh"
+#include "lily-guile.hh"
#include "note-column.hh"
+#include "side-position-interface.hh"
+#include "staff-symbol-referencer.hh"
#include "warn.hh"
/*
{
for (Pedal_info *p = info_list_; p->name_; p++)
{
- String nm = p->name_ + String ("Event");
+ std::string nm = p->name_ + std::string ("Event");
if (ly_is_equal (m->get_property ("name"),
scm_str2symbol (nm.c_str ())))
{
{
if (!p->line_spanner_)
{
- String name = String (p->name_) + "PedalLineSpanner";
+ std::string name = std::string (p->name_) + "PedalLineSpanner";
Music *rq = (p->event_drul_[START] ? p->event_drul_[START] : p->event_drul_[STOP]);
p->line_spanner_ = make_spanner (name.c_str (), rq->self_scm ());
}
mixed: Ped. _____/\____|
*/
- String prop = String ("pedal") + p->name_ + "Style";
+ std::string prop = std::string ("pedal") + p->name_ + "Style";
SCM style = get_property (prop.c_str ());
bool mixed = style == ly_symbol2scm ("mixed");
Piano_pedal_engraver::create_text_grobs (Pedal_info *p, bool mixed)
{
SCM s = SCM_EOL;
- SCM strings = get_property (("pedal" + String (p->name_) + "Strings").c_str ());
+ SCM strings = get_property (("pedal" + std::string (p->name_) + "Strings").c_str ());
if (scm_ilength (strings) < 3)
{
Music *m = p->event_drul_[START];
if (!m) m = p->event_drul_ [STOP];
- String msg = _f ("expect 3 strings for piano pedals, found: %d",
+ std::string msg = _f ("expect 3 strings for piano pedals, found: %d",
scm_ilength (strings));
if (m)
m->origin ()->warning (msg);
if (scm_is_string (s))
{
- String propname = String (p->name_) + "Pedal";
+ std::string propname = std::string (p->name_) + "Pedal";
p->item_ = make_item (propname.c_str (), (p->event_drul_[START]
? p->event_drul_[START]
{
if (!p->bracket_ && p->event_drul_[STOP])
{
- String msg = _f ("can't find start of piano pedal bracket: `%s'", p->name_);
+ std::string msg = _f ("can't find start of piano pedal bracket: `%s'", p->name_);
p->event_drul_[STOP]->origin ()->warning (msg);
p->event_drul_[STOP] = 0;
}
*/
#include "performer.hh"
+
#include "audio-item.hh"
+#include "international.hh"
#include "music.hh"
/**
if (p->event_drul_[STOP])
{
if (!p->start_event_)
- p->event_drul_[STOP]->origin ()->warning (_f ("can't find start of piano pedal: `%s'", String (p->name_)));
+ p->event_drul_[STOP]->origin ()->warning (_f ("can't find start of piano pedal: `%s'", std::string (p->name_)));
else
{
Audio_piano_pedal *a = new Audio_piano_pedal;
- a->type_string_ = String (p->name_);
+ a->type_string_ = std::string (p->name_);
a->dir_ = STOP;
audios_.push (a);
Audio_element_info info(a, p->event_drul_[STOP]);
{
p->start_event_ = p->event_drul_[START];
Audio_piano_pedal *a = new Audio_piano_pedal;
- a->type_string_ = String (p->name_);
+ a->type_string_ = std::string (p->name_);
a->dir_ = START;
audios_.push (a);
Audio_element_info info(a, p->event_drul_[START]);
{
for (Pedal_info *p = info_alist_; p->name_; p++)
{
- String nm = p->name_ + String ("Event");
+ std::string nm = p->name_ + std::string ("Event");
if (ly_is_equal (r->get_property ("name"),
scm_str2symbol (nm.c_str ())))
{
*/
#include "pitch.hh"
-#include "warn.hh"
+
#include "main.hh"
+#include "string-convert.hh"
+#include "warn.hh"
#include "ly-smobs.icc"
char const *accname[] = {"eses", "eseh", "es", "eh", "",
"ih", "is", "isih", "isis"};
-String
+std::string
Pitch::to_string () const
{
int n = (notename_ + 2) % 7;
- String s = ::to_string (char (n + 'a'));
+ std::string s = std::to_string (char (n + 'a'));
if (alteration_)
- s += String (accname[alteration_ - DOUBLE_FLAT]);
+ s += std::string (accname[alteration_ - DOUBLE_FLAT]);
if (octave_ >= 0)
{
{
int o = (-octave_) - 1;
while (o--)
- s += ::to_string (',');
+ s += std::to_string (',');
}
return s;
return (m) ? mutable_property_alist_ : immutable_property_alist_;
}
-String
+std::string
Prob::name () const
{
SCM nm = get_property ("name");
#include <cstring>
using namespace std;
-#include "string-convert.hh"
+#include "international.hh"
+#include "main.hh"
#include "parse-scm.hh"
+#include "string-convert.hh"
#include "warn.hh"
-#include "main.hh"
/* Write midi as formatted ascii stream? */
bool do_midi_debugging_global;
}
}
-const int HELP_INDENT = 30;
-const int INDENT = 2;
-const int SEPARATION = 5;
+ssize const HELP_INDENT = 30;
+ssize const INDENT = 2;
+ssize const SEPARATION = 5;
/*
Hmmm. should do in SCM / C++ ?
*/
-static String
+static std::string
get_help_string ()
{
SCM alist = ly_hash2alist (option_hash);
SCM convertor = ly_lily_module_constant ("scm->string");
- Array<String> opts;
+ Array<std::string> opts;
for (SCM s = alist; scm_is_pair (s); s = scm_cdr (s))
{
SCM sym = scm_caar (s);
SCM val = scm_cdar (s);
- String opt_spec
+ std::string opt_spec
= String_convert::char_string (' ', INDENT)
+ ly_symbol2string (sym)
+ " ("
SCM opt_help_scm
= scm_object_property (sym, ly_symbol2scm ("program-option-documentation"));
- String opt_help = ly_scm2string (opt_help_scm);
- opt_help.substitute (String ("\n"),
- String ("\n")
- + String_convert::char_string (' ', HELP_INDENT));
+ std::string opt_help = ly_scm2string (opt_help_scm);
+ replace_all (opt_help,
+ std::string ("\n"),
+ std::string ("\n")
+ + String_convert::char_string (' ', HELP_INDENT));
opts.push (opt_spec + opt_help + "\n");
}
- String help ("Options supported by ly:set-option\n\n");
- opts.sort (String::compare);
+ std::string help ("Options supported by ly:set-option\n\n");
+ opts.sort (string_compare);
for (int i = 0; i < opts.size (); i++)
help += opts[i];
- help += String ("\n");
+ help += std::string ("\n");
return help;
}
LY_DEFINE (ly_option_usage, "ly:option-usage", 0, 0, 0, (),
"Print ly:set-option usage")
{
- String help = get_help_string ();
+ std::string help = get_help_string ();
fputs (help.c_str (), stdout);
exit (0);
if (val == SCM_UNDEFINED)
val = SCM_BOOL_T;
- String varstr = ly_scm2string (scm_symbol_to_string (var));
- if (varstr.left_string (3) == String ("no-"))
+ std::string varstr = ly_scm2string (scm_symbol_to_string (var));
+ if (varstr.substr (0, 3) == std::string ("no-"))
{
- var = ly_symbol2scm (varstr.nomid_string (0, 3).c_str ());
+ var = ly_symbol2scm (varstr.substr (3).c_str ());
val = scm_from_bool (!to_boolean (val));
}
#include "property-iterator.hh"
-#include "music.hh"
#include "context-def.hh"
#include "global-context.hh"
+#include "international.hh"
+#include "music.hh"
bool check_grob (Music *mus, SCM sym);
(c) 2004--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
+#include "music-wrapper-iterator.hh"
+
#include "context.hh"
-#include "music.hh"
-#include "music-sequence.hh"
+#include "input.hh"
+#include "international.hh"
#include "lily-guile.hh"
-#include "music-wrapper-iterator.hh"
+#include "music-sequence.hh"
+#include "music.hh"
#include "warn.hh"
-#include "input.hh"
class Quote_iterator : public Music_wrapper_iterator
{
(c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-#include "music.hh"
#include "input.hh"
+#include "international.hh"
+#include "music.hh"
#include "pitch.hh"
class Relative_octave_check
if (result != *check_p)
{
- String s = _ ("Failed octave check, got: ");
+ std::string s = _ ("Failed octave check, got: ");
s += result.to_string ();
m->origin ()->warning (s);
#include "file-name.hh"
#include "file-path.hh"
+#include "international.hh"
#include "lily-guile.hh"
#include "lily-version.hh"
#include "main.hh"
int
-sane_putenv (char const *key, String value, bool overwrite)
+sane_putenv (char const *key, std::string value, bool overwrite)
{
if (overwrite || !getenv (key))
{
- String combine = String (key) + "=" + value;
+ std::string combine = std::string (key) + "=" + value;
char *s = strdup (combine.c_str ());
return putenv (s);
}
}
static int
-set_env_file (char const *key, String value, bool overwrite = false)
+set_env_file (char const *key, std::string value, bool overwrite = false)
{
if (is_file (value))
return sane_putenv (key, value, overwrite);
}
static int
-set_env_dir (char const *key, String value)
+set_env_dir (char const *key, std::string value)
{
if (is_dir (value))
return sane_putenv (key, value, false);
}
static int
-prepend_env_path (char const *key, String value)
+prepend_env_path (char const *key, std::string value)
{
if (is_dir (value))
{
return -1;
}
-String
-dir_name (String const file_name)
+std::string
+dir_name (std::string const file_name)
{
- String s = file_name;
- s.substitute ('\\', '/');
- int n = s.length ();
+ std::string s = file_name;
+ replace_all (s, '\\', '/');
+ ssize n = s.length ();
if (n && s[n - 1] == '/')
s[n - 1] = 0;
- s = s.left_string (s.index_last ('/'));
+ s = s.substr (0, s.rfind ('/'));
return s;
}
#endif
void
-prefix_relocation (String prefix)
+prefix_relocation (std::string prefix)
{
if (be_verbose_global)
warning (_f ("Relocation: compile prefix=%s, new prefix=%s",
prefix_directory,
prefix.c_str ()));
- String bindir = prefix + "/bin";
- String datadir = prefix + "/share";
- String localedir = datadir + "/locale";
- String lilypond_datadir = datadir + "/lilypond/" TOPLEVEL_VERSION;
+ std::string bindir = prefix + "/bin";
+ std::string datadir = prefix + "/share";
+ std::string localedir = datadir + "/locale";
+ std::string lilypond_datadir = datadir + "/lilypond/" TOPLEVEL_VERSION;
if (is_dir (lilypond_datadir))
prefix_directory = lilypond_datadir;
}
void
-framework_relocation (String prefix)
+framework_relocation (std::string prefix)
{
if (be_verbose_global)
warning (_f ("Relocation: framework_prefix=%s", prefix));
- String bindir = prefix + "/bin";
- String datadir = prefix + "/share";
- String libdir = prefix + "/lib";
- String sysconfdir = prefix + "/etc";
+ std::string bindir = prefix + "/bin";
+ std::string datadir = prefix + "/share";
+ std::string libdir = prefix + "/lib";
+ std::string sysconfdir = prefix + "/etc";
/* need otherwise dynamic .so's aren't found. */
prepend_env_path ("DYLD_LIBRARY_PATH", libdir);
prepend_env_path ("PATH", bindir);
}
-String
+std::string
get_working_directory ()
{
char cwd[PATH_MAX];
getcwd (cwd, PATH_MAX);
- return String (cwd);
+ return std::string (cwd);
}
void
if (relocate_binary
&& getenv ("LILYPOND_RELOCATE_PREFIX"))
{
- String prefix = getenv ("LILYPOND_RELOCATE_PREFIX");
+ std::string prefix = getenv ("LILYPOND_RELOCATE_PREFIX");
#ifdef __MINGW32__
/* Normalize file name. */
prefix = File_name (prefix).to_string ().get_copy_str0 ();
#endif /* __MINGW32__ */
prefix_relocation (prefix);
- String bindir = prefix + "/bin";
+ std::string bindir = prefix + "/bin";
framework_relocation (bindir + "/" FRAMEWORKDIR);
}
else if (relocate_binary)
{
- String argv0_abs;
+ std::string argv0_abs;
if (argv0_filename.is_absolute ())
{
argv0_abs = argv0_filename.to_string ();
else if (argv0_filename.dir_.length ())
{
argv0_abs = get_working_directory ()
- + "/" + String (argv0_filename.to_string ());
+ + "/" + std::string (argv0_filename.to_string ());
if (be_verbose_global)
warning (_f ("Relocation: from cwd: argv0=%s", argv0_ptr));
}
programming_error ("can't find absolute argv0.");
}
- String bindir = dir_name (argv0_abs);
- String argv0_prefix = dir_name (bindir);
- String compile_prefix = dir_name (dir_name (dir_name (prefix_directory)));
+ std::string bindir = dir_name (argv0_abs);
+ std::string argv0_prefix = dir_name (bindir);
+ std::string compile_prefix = dir_name (dir_name (dir_name (prefix_directory)));
if (argv0_prefix != compile_prefix)
prefix_relocation (argv0_prefix);
- if (argv0_prefix != compile_prefix || String (FRAMEWORKDIR) != "..")
+ if (argv0_prefix != compile_prefix || std::string (FRAMEWORKDIR) != "..")
framework_relocation (bindir + "/" FRAMEWORKDIR);
}
*/
struct stat statbuf;
- String build_prefix = prefix_directory + "/share/lilypond/" TOPLEVEL_VERSION;
+ std::string build_prefix = prefix_directory + "/share/lilypond/" TOPLEVEL_VERSION;
if (stat (build_prefix.c_str (), &statbuf) == 0)
prefix_directory = build_prefix;
char *suffixes[] = {"ly", "ps", "scm", 0 };
- Array<String> dirs;
+ Array<std::string> dirs;
for (char **s = suffixes; *s; s++)
{
- String path = prefix_directory + to_string ('/') + String (*s);
+ std::string path = prefix_directory + to_string ('/') + std::string (*s);
dirs.push (path);
}
SCM cs = get_property ("repeatCommands");
- String s = "";
+ std::string s = "";
bool start = false;
bool end = false;
bool volta_found = false;
#include <cmath> // ceil.
using namespace std;
-#include "warn.hh"
+#include "directional-element-interface.hh"
+#include "duration.hh"
+#include "international.hh"
#include "note-column.hh"
-#include "stem.hh"
-#include "rhythmic-head.hh"
#include "output-def.hh"
-#include "rest.hh"
#include "pointer-group-interface.hh"
+#include "rest.hh"
+#include "rhythmic-head.hh"
#include "staff-symbol-referencer.hh"
-#include "duration.hh"
-#include "directional-element-interface.hh"
+#include "stem.hh"
+#include "warn.hh"
MAKE_SCHEME_CALLBACK (Rest_collision, force_shift_callback, 1);
SCM
#include "rest.hh"
-#include "stencil.hh"
-#include "output-def.hh"
-#include "font-interface.hh"
+#include "directional-element-interface.hh"
#include "dots.hh"
+#include "font-interface.hh"
+#include "international.hh"
+#include "output-def.hh"
#include "paper-score.hh"
#include "staff-symbol-referencer.hh"
-#include "directional-element-interface.hh"
+#include "stencil.hh"
// -> offset callback
MAKE_SCHEME_CALLBACK (Rest, y_offset_callback, 1);
/*
make this function easily usable in C++
*/
-String
-Rest::glyph_name (Grob *me, int balltype, String style, bool try_ledgers)
+std::string
+Rest::glyph_name (Grob *me, int balltype, std::string style, bool try_ledgers)
{
bool is_ledgered = false;
if (try_ledgers && (balltype == 0 || balltype == 1))
is_ledgered |= (balltype == 1) && (pos <= -rad - 2 || pos > +rad);
}
- String actual_style (style.c_str ());
+ std::string actual_style (style.c_str ());
if ((style == "mensural") || (style == "neomensural"))
{
int balltype = scm_to_int (balltype_scm);
- String style;
+ std::string style;
SCM style_scm = me->get_property ("style");
if (scm_is_symbol (style_scm))
style = ly_scm2string (scm_symbol_to_string (style_scm));
Font_metric *fm = Font_interface::get_default_font (me);
- String font_char = glyph_name (me, balltype, style, ledgered);
+ std::string font_char = glyph_name (me, balltype, style, ledgered);
Stencil out = fm->find_by_name (font_char);
if (out.is_empty ())
me->warning (_f ("rest `%s' not found", font_char.c_str ()));
(c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-#include "all-font-metrics.hh"
-#include "warn.hh"
-#include "main.hh"
-#include "system.hh"
#include "score-engraver.hh"
-#include "paper-score.hh"
-#include "paper-column.hh"
-#include "output-def.hh"
+
+#include "all-font-metrics.hh"
#include "axis-group-interface.hh"
#include "context-def.hh"
#include "global-context.hh"
+#include "international.hh"
+#include "main.hh"
#include "open-type-font.hh"
+#include "output-def.hh"
#include "paper-column-engraver.hh"
+#include "paper-column.hh"
+#include "paper-score.hh"
+#include "system.hh"
+#include "warn.hh"
Score_engraver::Score_engraver ()
{
#include "book.hh"
#include "cpu-timer.hh"
#include "global-context.hh"
+#include "international.hh"
#include "lily-parser.hh"
#include "lilypond-key.hh"
#include "main.hh"
#include "music.hh"
+#include "music.hh"
#include "output-def.hh"
#include "paper-book.hh"
#include "paper-score.hh"
#include "warn.hh"
-#include "music.hh"
#include "ly-smobs.icc"
(c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
+#include "engraver.hh"
+
#include "context.hh"
#include "directional-element-interface.hh"
-#include "engraver.hh"
-#include "slur.hh"
+#include "international.hh"
#include "note-column.hh"
#include "paper-column.hh"
#include "rhythmic-head.hh"
#include "script-interface.hh"
#include "side-position-interface.hh"
+#include "slur.hh"
#include "staff-symbol-referencer.hh"
#include "stem.hh"
#include "warn.hh"
/* FIXME: 1000 should relate to paper size. */
if (fabs (total_off) > 1000)
{
- String msg
+ std::string msg
= String_convert::form_string ("Improbable offset for grob %s: %f%s",
me->name ().c_str (), total_off,
INTERNAL_UNIT);
#include <cstdio>
+#include "column-x-positions.hh"
+#include "dimensions.hh"
+#include "international.hh"
#include "libc-extension.hh" // isinf
-#include "simple-spacer.hh"
#include "paper-column.hh"
+#include "simple-spacer.hh"
+#include "spaceable-grob.hh"
#include "spring.hh"
#include "warn.hh"
-#include "column-x-positions.hh"
-#include "spaceable-grob.hh"
-#include "dimensions.hh"
/*
A simple spacing constraint solver. The approach:
(c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-#include "slur.hh"
-#include "note-column.hh"
+#include "engraver.hh"
+
#include "context.hh"
#include "directional-element-interface.hh"
-#include "engraver.hh"
+#include "international.hh"
+#include "note-column.hh"
+#include "slur.hh"
#include "spanner.hh"
#include "tie.hh"
#include "warn.hh"
->lookup_variable (ly_symbol2scm ("debug-slur-scoring")))
&& scm_is_string (quant_score))
{
- String str;
+ std::string str;
SCM properties = Font_interface::text_font_alist_chain (me);
Stencil tm = *unsmob_stencil (Text_interface::interpret_markup
#endif
using namespace std;
-#include "warn.hh"
#include "file-name-map.hh"
+#include "international.hh"
+#include "warn.hh"
void
Source_file::load_stdin ()
}
char *
-gulp_file (String filename, int *filesize)
+gulp_file (std::string filename, int *filesize)
{
/* "b" must ensure to open literally, avoiding text (CR/LF)
conversions. */
return str;
}
-Source_file::Source_file (String filename, String data)
+Source_file::Source_file (std::string filename, std::string data)
{
name_ = filename;
istream_ = 0;
- contents_str0_ = data.get_copy_str0 ();
length_ = data.length ();
+ contents_str0_ = string_copy (data);
pos_str0_ = c_str ();
init_port ();
newline_locations_.push (contents_str0_ + i);
}
-Source_file::Source_file (String filename_string)
+Source_file::Source_file (std::string filename_string)
{
name_ = filename_string;
istream_ = 0;
{
SCM str = scm_makfrom0str (contents_str0_);
str_port_ = scm_mkstrport (SCM_INUM0, str, SCM_OPN | SCM_RDNG, __FUNCTION__);
- scm_set_port_filename_x (str_port_, scm_makfrom0str (name_.get_str0 ()));
+ scm_set_port_filename_x (str_port_, scm_makfrom0str (name_.c_str ()));
}
int
return istream_;
}
-String
+std::string
Source_file::file_line_column_string (char const *context_str0) const
{
if (!c_str ())
}
}
-String
+std::string
Source_file::quote_input (char const *pos_str0) const
{
if (!contains (pos_str0))
int l, ch, col;
get_counts (pos_str0, &l, &ch, &col);
- String line = line_string (pos_str0);
- String context = line.left_string (ch)
+ std::string line = line_string (pos_str0);
+ std::string context = line.substr (0, ch)
+ to_string ('\n')
+ to_string (' ', col)
- + line.cut_string (ch, INT_MAX);
+ + line.substr (ch);
return context;
}
-String
+std::string
Source_file::name_string () const
{
return map_file_name (name_);
return Slice (begin_str0 - data_str0, end_str0 - data_str0);
}
-String
+std::string
Source_file::line_string (char const *pos_str0) const
{
if (!contains (pos_str0))
Slice line = line_slice (pos_str0);
char const *data_str0 = c_str ();
- return String ((Byte const *)data_str0 + line[LEFT], line.length ());
+ return std::string (data_str0 + line[LEFT], line.length ());
}
void
Slice line = line_slice (pos_str0);
char const *data = c_str ();
- Byte const *line_start = (Byte const *)data + line[LEFT];
+ char const *line_start = (char const *)data + line[LEFT];
- int left = (Byte const *) pos_str0 - line_start;
- String line_begin (line_start, left);
+ ssize left = (char const *) pos_str0 - line_start;
+ std::string line_begin (line_start, left);
char const *line_chars = line_begin.c_str ();
*column = 0;
return old_pos;
}
-String
+std::string
Source_file::get_string (int n)
{
- String str = String ((Byte const *)forward_str0 (n), n);
+ std::string str = std::string ((char const *)forward_str0 (n), n);
return str;
}
@return 0 if no file found
*/
Source_file *
-Sources::get_file (String &file_string) //UGH
+Sources::get_file (std::string &file_string) //UGH
{
if ((file_string != "-") && path_)
{
- String file_string_o = path_->find (file_string);
+ std::string file_string_o = path_->find (file_string);
if ((file_string_o == "") && (file_string != ""))
return 0;
file_string = file_string_o;
(c) 1999--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-#include <math.h>
+#include "spacing-spanner.hh"
+#include <math.h>
#include <cstdio>
using namespace std;
-#include "spacing-spanner.hh"
-#include "paper-column.hh"
-#include "output-def.hh"
-#include "paper-score.hh"
-#include "system.hh"
+#include "international.hh"
+#include "main.hh"
#include "moment.hh"
#include "note-spacing.hh"
-#include "main.hh"
-#include "warn.hh"
+#include "output-def.hh"
+#include "paper-column.hh"
+#include "paper-score.hh"
#include "pointer-group-interface.hh"
#include "spaceable-grob.hh"
-#include "staff-spacing.hh"
#include "spacing-interface.hh"
+#include "staff-spacing.hh"
+#include "system.hh"
+#include "warn.hh"
/*
if (!scm_is_string (glyph))
return SCM_EOL;
- String glyph_string = ly_scm2string (glyph);
+ std::string glyph_string = ly_scm2string (glyph);
/* compose span_bar_mol */
Array<Interval> extents;
if (!me->is_live ())
return ly_interval2scm (Interval ());
- String gl = ly_scm2string (gn);
+ std::string gl = ly_scm2string (gn);
/*
urg.
return SCM_UNSPECIFIED;
}
- String type = ly_scm2string (gl);
+ std::string type = ly_scm2string (gl);
if (type == "|:")
type = ".|";
else if (type == ":|")
*/
#include "performer.hh"
+
#include "audio-item.hh"
+#include "international.hh"
#include "music.hh"
/*
TRANSLATOR_DECLARATIONS (Staff_performer);
~Staff_performer ();
- String new_instrument_string ();
- String instrument_string_;
+ std::string new_instrument_string ();
+ std::string instrument_string_;
protected:
virtual void acknowledge_audio_element (Audio_element_info info);
void
Staff_performer::process_music ()
{
- String str = new_instrument_string ();
+ std::string str = new_instrument_string ();
if (str.length ())
{
instrument_name_ = new Audio_text (Audio_text::INSTRUMENT_NAME, str);
audio_staff_ = 0;
}
-String
+std::string
Staff_performer::new_instrument_string ()
{
// mustn't ask Score for instrument: it will return piano!
SCM glyph = bar_grob->get_property ("glyph-name");
Grob *staff_sym = Staff_symbol_referencer::get_staff_symbol (bar_grob);
- String glyph_string = scm_is_string (glyph) ? ly_scm2string (glyph) : "";
- if (glyph_string.left_string (1) == "|" || glyph_string.left_string (1) == ".")
+ std::string glyph_string = scm_is_string (glyph) ? ly_scm2string (glyph) : "";
+ if (glyph_string.substr (0, 1) == "|"
+ || glyph_string.substr (0, 1) == ".")
{
Grob *common = bar_grob->common_refpoint (staff_sym, Y_AXIS);
Interval bar_size = bar_grob->extent (common, Y_AXIS);
(c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
+#include "engraver.hh"
+
#include "context.hh"
#include "directional-element-interface.hh"
-#include "engraver.hh"
+#include "duration.hh"
+#include "international.hh"
#include "item.hh"
#include "misc.hh"
#include "rhythmic-head.hh"
#include "staff-symbol-referencer.hh"
#include "stem-tremolo.hh"
#include "stem.hh"
-#include "duration.hh"
/**
Make stems upon receiving noteheads.
#include <cmath> // rint
using namespace std;
-#include "lookup.hh"
+#include "beam.hh"
#include "directional-element-interface.hh"
+#include "dot-column.hh"
+#include "font-interface.hh"
+#include "international.hh"
+#include "lookup.hh"
+#include "misc.hh"
#include "note-head.hh"
-#include "warn.hh"
#include "output-def.hh"
-#include "rhythmic-head.hh"
-#include "font-interface.hh"
#include "paper-column.hh"
-#include "misc.hh"
-#include "beam.hh"
-#include "rest.hh"
#include "pointer-group-interface.hh"
-#include "staff-symbol-referencer.hh"
+#include "rest.hh"
+#include "rhythmic-head.hh"
#include "side-position-interface.hh"
-#include "dot-column.hh"
+#include "staff-symbol-referencer.hh"
#include "stem-tremolo.hh"
+#include "warn.hh"
void
Stem::set_beaming (Grob *me, int beam_count, Direction d)
TODO: maybe property stroke-style should take different values,
e.g. "" (i.e. no stroke), "single" and "double" (currently, it's
'() or "grace"). */
- String flag_style;
+ std::string flag_style;
SCM flag_style_scm = me->get_property ("flag-style");
if (scm_is_symbol (flag_style_scm))
bool adjust = true;
- String staffline_offs;
- if (String::compare (flag_style, "mensural") == 0)
+ std::string staffline_offs;
+ if (flag_style == "mensural")
/* Mensural notation: For notes on staff lines, use different
flags than for notes between staff lines. The idea is that
flags are always vertically aligned with the staff lines,
staffline_offs = "";
char dir = (get_grob_direction (me) == UP) ? 'u' : 'd';
- String font_char = flag_style
+ std::string font_char = flag_style
+ to_string (dir) + staffline_offs + to_string (log);
Font_metric *fm = Font_interface::get_default_font (me);
Stencil flag = fm->find_by_name ("flags." + font_char);
SCM stroke_style_scm = me->get_property ("stroke-style");
if (scm_is_string (stroke_style_scm))
{
- String stroke_style = ly_scm2string (stroke_style_scm);
+ std::string stroke_style = ly_scm2string (stroke_style_scm);
if (!stroke_style.empty ())
{
- String font_char = to_string (dir) + stroke_style;
+ std::string font_char = to_string (dir) + stroke_style;
Stencil stroke = fm->find_by_name ("flags." + font_char);
if (stroke.is_empty ())
me->warning (_f ("flag stroke `%s' not found", font_char));
if (!scm_is_string (glyph))
return mol.smobbed_copy ();
- String text = ly_scm2string (glyph);
+ std::string text = ly_scm2string (glyph);
- for (int i = 0; i < text.length (); i++)
+ for (ssize i = 0; i < text.length (); i++)
{
- String idx ("pedal.");
- if (text.cut_string (i, 3) == "Ped")
+ std::string idx ("pedal.");
+ if (text.substr (i, 3) == "Ped")
{
idx += "Ped";
i += 2;
}
else
- idx += String (&text.to_bytes ()[i], 1);
+ idx += std::string (&text.c_str ()[i], 1);
Stencil m = Font_interface::get_default_font (e)->find_by_name (idx);
if (!m.is_empty ())
mol.add_at_edge (X_AXIS, RIGHT, m, 0, 0);
#include "system.hh"
-
#include "align-interface.hh"
+#include "all-font-metrics.hh"
#include "axis-group-interface.hh"
-#include "warn.hh"
+#include "grob-array.hh"
+#include "international.hh"
#include "main.hh"
-#include "paper-column.hh"
#include "output-def.hh"
+#include "paper-column.hh"
#include "paper-score.hh"
-#include "warn.hh"
-#include "all-font-metrics.hh"
+#include "paper-system.hh"
+#include "pointer-group-interface.hh"
#include "spacing-interface.hh"
#include "staff-symbol-referencer.hh"
-#include "paper-system.hh"
#include "tweak-registration.hh"
-#include "grob-array.hh"
-#include "pointer-group-interface.hh"
+#include "warn.hh"
+#include "warn.hh"
System::System (System const &src, int count)
: Spanner (src, count)
}
template<>
-Std_string
+std::string
Interval_t<Rational>::T_to_string (Rational a)
{
return a.to_string ();
SCM_ASSERT_TYPE (scm_is_string (markup), markup, SCM_ARG3,
__FUNCTION__, "string");
- String str = ly_scm2string (markup);
+ std::string str = ly_scm2string (markup);
Font_metric *fm = select_encoded_font (layout, props);
return fm->text_stencil (str).smobbed_copy ();
Box b;
SCM limit = ly_lily_module_constant ("TEX_STRING_HASHLIMIT");
- String key_str = ly_scm2string (font->font_file_name ());
+ std::string key_str = ly_scm2string (font->font_file_name ());
int hash_code = scm_to_int (scm_hash (text, limit));
key_str = to_string (hash_code) + key_str;
}
void
-try_load_text_metrics (String basename)
+try_load_text_metrics (std::string basename)
{
- String path = global_path.find (basename + ".textmetrics");
+ std::string path = global_path.find (basename + ".textmetrics");
if (path != "")
{
- String contents (gulp_file_to_string (path, true, -1));
+ std::string contents (gulp_file_to_string (path, true, -1));
contents = "(quote (" + contents + "))";
SCM lst = scm_c_eval_string (contents.c_str ());
(c) 2000--2006 Jan Nieuwenhuizen <janneke@gnu.org>
*/
+#include "engraver.hh"
+
+#include "international.hh"
#include "note-column.hh"
#include "side-position-interface.hh"
-#include "engraver.hh"
class Text_spanner_engraver : public Engraver
{
#include "tfm-reader.hh"
+#include "international.hh"
#include "string-convert.hh"
#include "warn.hh"
(1 << 20)
static const Real fix_to_real (Fix f);
-Tex_font_metric_reader::Tex_font_metric_reader (String name)
+Tex_font_metric_reader::Tex_font_metric_reader (std::string name)
: input_ (name)
{
return get_U32_fix () * info_.design_size;
}
-String
+std::string
Tex_font_metric_reader::get_bcpl_string ()
{
U8 length_u8 = input_.get_U8 ();
- String str = input_.get_string (length_u8);
+ std::string str = input_.get_string (length_u8);
return str;
}
some code shamelessly copied from GNU fontutils-0.6/tfm/tfm_input.c
*/
-#include "file-name.hh"
#include "tfm.hh"
-#include "tfm-reader.hh"
+
+#include "dimensions.hh"
+#include "file-name.hh"
+#include "international.hh"
#include "string-convert.hh"
+#include "tfm-reader.hh"
#include "warn.hh"
-#include "dimensions.hh"
static Tex_font_char_metric dummy_static_char_metric;
}
SCM
-Tex_font_metric::make_tfm (String file_name)
+Tex_font_metric::make_tfm (std::string file_name)
{
Tex_font_metric *tfm = new Tex_font_metric;
Tex_font_metric_reader reader (file_name);
return info_.design_size * point_constant;
}
-String
+std::string
Tex_font_metric::font_name () const
{
return font_name_;
}
int
-Tex_font_metric::name_to_index (String) const
+Tex_font_metric::name_to_index (std::string) const
{
assert (false);
return 0;
(c) 1998--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-#include "tie.hh"
+#include "engraver.hh"
+
#include "context.hh"
+#include "grob-pitch-tuple.hh"
+#include "international.hh"
+#include "item.hh"
+#include "note-head.hh"
#include "protected-scm.hh"
#include "spanner.hh"
+#include "staff-symbol-referencer.hh"
#include "tie-column.hh"
-#include "engraver.hh"
-#include "item.hh"
-#include "grob-pitch-tuple.hh"
+#include "tie.hh"
#include "warn.hh"
-#include "note-head.hh"
-#include "staff-symbol-referencer.hh"
/**
Manufacture ties. Acknowledge noteheads, and put them into a
*/
#include "time-scaled-music-iterator.hh"
+
#include "context.hh"
#include "input.hh"
+#include "international.hh"
void
Time_scaled_music_iterator::process (Moment m)
(c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-#include "time-signature.hh"
-#include "warn.hh"
#include "engraver-group.hh"
+
+#include "international.hh"
#include "misc.hh"
+#include "time-signature.hh"
+#include "warn.hh"
/**
generate time_signatures.
#include "time-signature.hh"
-#include "text-interface.hh"
-#include "output-def.hh"
#include "font-interface.hh"
-#include "warn.hh"
+#include "international.hh"
+#include "output-def.hh"
#include "staff-symbol-referencer.hh"
+#include "text-interface.hh"
+#include "warn.hh"
/*
TODO:
Stencil
Time_signature::special_time_signature (Grob *me, SCM scm_style, int n, int d)
{
- String style = ly_scm2string (scm_symbol_to_string (scm_style));
+ std::string style = ly_scm2string (scm_symbol_to_string (scm_style));
if (style == "numbered")
return numbered_time_signature (me, n, d);
return numbered_time_signature (me, n, d);
}
- String char_name = style + to_string (n) + to_string (d);
+ std::string char_name = style + to_string (n) + to_string (d);
me->set_property ("font-encoding", ly_symbol2scm ("fetaMusic"));
Stencil out = Font_interface::get_default_font (me)
->find_by_name ("timesig." + char_name);
*/
#include "translator.hh"
+
+#include "international.hh"
#include "scm-hash.hh"
#include "warn.hh"
Acknowledge_information inf;
inf.function_ = ptr;
- String interface_name (func_name);
+ std::string interface_name (func_name);
- interface_name = interface_name.substitute ('_', '-');
+ interface_name = replace_all (interface_name, '_', '-');
interface_name += "-interface";
inf.symbol_ = scm_gc_protect_object (ly_symbol2scm (interface_name.c_str ()));
automatically is the end of the trill?
*/
+#include "engraver.hh"
+
+#include "international.hh"
#include "note-column.hh"
#include "side-position-interface.hh"
-#include "engraver.hh"
#include "translator.icc"
#define CHUNKSIZE 65534
static void
-print_body (void *out, String name)
+print_body (void *out, std::string name)
{
FILE *fd = fopen (name.c_str (), "rb");
}
static void
-create_type42_font (void *out, String name)
+create_type42_font (void *out, std::string name)
{
FT_Face face = open_ft_face (name);
{
SCM_ASSERT_TYPE (scm_is_string (ttf_file_name), ttf_file_name,
SCM_ARG1, __FUNCTION__, "string");
- String file_name = ly_scm2string (ttf_file_name);
+ std::string file_name = ly_scm2string (ttf_file_name);
if (be_verbose_global)
progress_indication ("[" + file_name);
SCM_ASSERT_TYPE (scm_is_string (ttf_file_name), ttf_file_name,
SCM_ARG1, __FUNCTION__, "string");
- String file_name = ly_scm2string (ttf_file_name);
+ std::string file_name = ly_scm2string (ttf_file_name);
if (be_verbose_global)
progress_indication ("[" + file_name);
*/
#include "gregorian-ligature-engraver.hh"
+
+#include "font-interface.hh"
#include "gregorian-ligature.hh"
-#include "vaticana-ligature.hh"
+#include "international.hh"
+#include "output-def.hh"
+#include "paper-column.hh"
#include "spanner.hh"
#include "staff-symbol-referencer.hh"
-#include "font-interface.hh"
+#include "vaticana-ligature.hh"
#include "warn.hh"
-#include "output-def.hh"
-#include "paper-column.hh"
#include "translator.icc"
"ignoring grob");
continue;
}
- String glyph_name = ly_scm2string (glyph_name_scm);
+ std::string glyph_name = ly_scm2string (glyph_name_scm);
int delta_pitch = 0;
if (prev_primitive) /* urgh, need prev_primitive only here */
- Font_interface::get_default_font (primitive)->
find_by_name ("noteheads.s" + glyph_name).extent (X_AXIS).length ();
}
- else if (!String::compare (glyph_name, "flexa")
- || !String::compare (glyph_name, ""))
+ else if (glyph_name == "flexa" || glyph_name == "")
{
/*
* This head represents either half of a flexa shape.
ligature_width -= join_thickness;
}
}
- else if (!String::compare (glyph_name, ""))
+ else if (glyph_name == "")
{
/*
* This is the 2nd (virtual) head of flexa shape. Join it
= scm_to_int (primitive->get_property ("prefix-set"));
if (prefix_set & ~PES_OR_FLEXA)
{
- String prefs = Gregorian_ligature::prefixes_to_str (primitive);
+ std::string prefs = Gregorian_ligature::prefixes_to_str (primitive);
primitive->warning (_f ("ignored prefix (es) `%s' of this head according "
"to restrictions of the selected ligature style",
prefs.c_str ()));
int prev_prefix_set = 0;
int prev_context_info = 0;
int prev_delta_pitch = 0;
- String prev_glyph_name = "";
+ std::string prev_glyph_name = "";
for (int i = 0; i < primitives.size (); i++)
{
Item *primitive = dynamic_cast<Item *> (primitives[i].grob ());
* this decision must be made here in the engraver rather than in
* the backend).
*/
- String glyph_name;
+ std::string glyph_name;
if (prefix_set & VIRGA)
{
glyph_name = "vaticana.punctum";
* head of a pes, and if it is a punctum.
*/
if ((context_info & FLEXA_LEFT) && ! (context_info & PES_UPPER))
- if (!String::compare (glyph_name, "vaticana.punctum"))
+ if (glyph_name == "vaticana.punctum")
primitive->set_property ("add-cauda", ly_bool2scm (true));
/*
{
if ((context_info & PES_UPPER) && (context_info & STACKED_HEAD))
{
- if (!String::compare (prev_glyph_name, "vaticana.punctum"))
+ if (prev_glyph_name == "vaticana.punctum")
if (prev_delta_pitch > 1)
prev_glyph_name = "vaticana.lpes";
else
#include "vaticana-ligature.hh"
-
-#include "item.hh"
+#include "bezier.hh"
#include "font-interface.hh"
+#include "international.hh"
+#include "item.hh"
#include "lookup.hh"
-#include "staff-symbol-referencer.hh"
#include "note-head.hh"
#include "output-def.hh"
-#include "bezier.hh"
+#include "staff-symbol-referencer.hh"
#include "warn.hh"
Stencil
return Stencil ();
}
- String glyph_name = ly_scm2string (glyph_name_scm);
+ std::string glyph_name = ly_scm2string (glyph_name_scm);
Stencil out;
Real thickness = robust_scm2double (me->get_property ("thickness"), 1);
bool add_cauda = to_boolean (me->get_property ("add-cauda"));
bool add_join = to_boolean (me->get_property ("add-join"));
- if (!String::compare (glyph_name, ""))
+ if (glyph_name == "")
{
/*
* This is an empty head. This typically applies for the right
out
= Lookup::blank (Box (Interval (0, 0.5 * flexa_width), Interval (0, 0)));
}
- else if (!String::compare (glyph_name, "flexa"))
+ else if (glyph_name == "flexa")
out = vaticana_brew_flexa (me, true, line_thickness);
else
{
{
if (qualifies (i))
{
- String id = i.context ()->id_string ();
+ std::string id = i.context ()->id_string ();
scm_hash_set_x (id_to_group_hashtab_, scm_makfrom0str (id.c_str ()),
i.grob ()->self_scm ());
Grob *endbar = bars.size () ? bars.top () : 0;
SCM glyph = endbar ? endbar->get_property ("glyph") : SCM_EOL;
- String str;
+ std::string str;
if (scm_is_string (glyph))
str = ly_scm2string (glyph);
else
*/
#include "engraver.hh"
+
+#include "bar-line.hh"
#include "context.hh"
-#include "volta-bracket.hh"
+#include "international.hh"
#include "note-column.hh"
-#include "bar-line.hh"
#include "side-position-interface.hh"
-#include "warn.hh"
#include "staff-symbol.hh"
#include "text-interface.hh"
+#include "volta-bracket.hh"
+#include "warn.hh"
#include "translator.icc"
{
if (alt_count_)
{
- String repstr = to_string (rep_count_ - alt_count_ + done_count_) + ".";
+ std::string repstr = to_string (rep_count_ - alt_count_ + done_count_) + ".";
if (done_count_ > 1)
{
add_repeat_command (scm_list_n (ly_symbol2scm ("volta"), SCM_BOOL_F, SCM_UNDEFINED));