From b37e3f652677ae0298423db9fa0e552e5fce0c92 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 26 Jan 2006 11:17:24 +0000 Subject: [PATCH] *** empty log message *** --- ChangeLog | 7 + GNUmakefile.in | 4 + flower/file-name.cc | 24 +-- flower/file-path.cc | 50 +++-- flower/getopt-long.cc | 37 ++-- flower/include/file-name.hh | 12 +- flower/include/file-path.hh | 22 +- flower/include/flower-proto.hh | 14 +- flower/include/getopt-long.hh | 6 +- flower/include/international.hh | 6 +- flower/include/interval.hh | 4 +- flower/include/interval.tcc | 10 +- flower/include/offset.hh | 4 +- flower/include/rational.hh | 5 +- flower/include/std-string.hh | 81 +++---- flower/include/string-convert.hh | 61 +++--- flower/include/string-data.hh | 8 +- flower/include/string-data.icc | 8 +- flower/include/string-handle.hh | 5 +- flower/include/string-handle.icc | 6 +- flower/include/string.hh | 147 ++++--------- flower/include/string.icc | 10 +- flower/include/warn.hh | 14 +- flower/international.cc | 14 +- flower/interval.cc | 8 +- flower/offset.cc | 8 +- flower/rational.cc | 10 +- flower/std-string.cc | 96 +++++++-- flower/string-convert.cc | 113 +++++----- flower/string.cc | 255 +++++++++-------------- flower/stringutil.cc | 11 +- flower/warn.cc | 15 +- lily/accidental-engraver.cc | 7 +- lily/accidental.cc | 9 +- lily/all-font-metrics.cc | 33 +-- lily/apply-context-iterator.cc | 5 +- lily/audio-item.cc | 4 +- lily/auto-change-iterator.cc | 11 +- lily/axis-group-engraver.cc | 5 +- lily/bar-check-iterator.cc | 5 +- lily/bar-engraver.cc | 2 +- lily/bar-line.cc | 4 +- lily/beam-engraver.cc | 17 +- lily/beam-quanting.cc | 11 +- lily/beam.cc | 18 +- lily/binary-source-file.cc | 22 +- lily/break-align-interface.cc | 15 +- lily/change-iterator.cc | 17 +- lily/chord-tremolo-engraver.cc | 18 +- lily/chord-tremolo-iterator.cc | 1 + lily/clef.cc | 11 +- lily/cluster.cc | 19 +- lily/coherent-ligature-engraver.cc | 4 +- lily/context-def.cc | 6 +- lily/context-property.cc | 5 +- lily/context-specced-music-iterator.cc | 2 +- lily/context.cc | 29 +-- lily/custos.cc | 11 +- lily/dots.cc | 2 +- lily/duration.cc | 10 +- lily/dynamic-engraver.cc | 9 +- lily/event-chord-iterator.cc | 7 +- lily/extender-engraver.cc | 3 +- lily/file-name-map.cc | 6 +- lily/folded-repeat-iterator.cc | 3 +- lily/font-config-scheme.cc | 2 +- lily/font-config.cc | 5 +- lily/font-metric.cc | 16 +- lily/function-documentation.cc | 4 +- lily/general-scheme.cc | 12 +- lily/glissando-engraver.cc | 9 +- lily/global-context-scheme.cc | 13 +- lily/global-context.cc | 11 +- lily/gourlay-breaking.cc | 15 +- lily/gregorian-ligature-engraver.cc | 7 +- lily/gregorian-ligature.cc | 7 +- lily/grob-interface-scheme.cc | 2 +- lily/grob-interface.cc | 8 +- lily/grob.cc | 24 +-- lily/hairpin.cc | 16 +- lily/horizontal-bracket-engraver.cc | 3 +- lily/hyphen-engraver.cc | 6 +- lily/includable-lexer.cc | 14 +- lily/include/accidental-interface.hh | 2 +- lily/include/all-font-metrics.hh | 8 +- lily/include/audio-item.hh | 10 +- lily/include/bar-line.hh | 2 +- lily/include/bar.hh | 2 +- lily/include/binary-source-file.hh | 4 +- lily/include/book.hh | 4 +- lily/include/change-iterator.hh | 2 +- lily/include/context.hh | 23 +- lily/include/dimensions.hh | 4 +- lily/include/duration.hh | 2 +- lily/include/file-name-map.hh | 4 +- lily/include/font-metric.hh | 16 +- lily/include/freetype.hh | 4 +- lily/include/gregorian-ligature.hh | 4 +- lily/include/grob.hh | 6 +- lily/include/group-interface.hh | 2 +- lily/include/includable-lexer.hh | 8 +- lily/include/input.hh | 15 +- lily/include/kpath.hh | 4 +- lily/include/lily-guile.hh | 10 +- lily/include/lily-lexer.hh | 12 +- lily/include/lily-parser.hh | 10 +- lily/include/lily-version.hh | 8 +- lily/include/lilypond-input-version.hh | 8 +- lily/include/lilypond-key.hh | 16 +- lily/include/main.hh | 23 +- lily/include/midi-item.hh | 40 ++-- lily/include/midi-stream.hh | 8 +- lily/include/misc.hh | 2 +- lily/include/modified-font-metric.hh | 12 +- lily/include/moment.hh | 2 +- lily/include/music-output.hh | 2 +- lily/include/open-type-font.hh | 16 +- lily/include/output-def.hh | 6 +- lily/include/pango-font.hh | 6 +- lily/include/paper-outputter.hh | 8 +- lily/include/performance.hh | 2 +- lily/include/pitch.hh | 2 +- lily/include/prob.hh | 2 +- lily/include/relocate.hh | 4 +- lily/include/rest.hh | 2 +- lily/include/score.hh | 4 +- lily/include/slur-configuration.hh | 2 +- lily/include/source-file.hh | 21 +- lily/include/source.hh | 4 +- lily/include/stream.hh | 8 +- lily/include/text-metrics.hh | 2 +- lily/include/tfm-reader.hh | 4 +- lily/include/tfm.hh | 10 +- lily/include/translator.hh | 2 +- lily/include/type-swallow-translator.hh | 2 +- lily/input-scheme.cc | 4 +- lily/input-smob.cc | 4 +- lily/input.cc | 17 +- lily/key-signature-interface.cc | 11 +- lily/lexer.ll | 135 ++++++------ lily/ligature-engraver.cc | 7 +- lily/lily-guile.cc | 34 +-- lily/lily-lexer.cc | 15 +- lily/lily-parser-scheme.cc | 9 +- lily/lily-parser.cc | 22 +- lily/lily-version.cc | 14 +- lily/lilypond-key.cc | 16 +- lily/lilypond-version.cc | 8 +- lily/lookup.cc | 72 +++---- lily/ly-module.cc | 2 +- lily/lyric-engraver.cc | 6 +- lily/main.cc | 63 +++--- lily/mark-engraver.cc | 7 +- lily/mensural-ligature-engraver.cc | 13 +- lily/mensural-ligature.cc | 7 +- lily/midi-item.cc | 131 ++++++------ lily/midi-stream.cc | 20 +- lily/misc.cc | 16 +- lily/modified-font-metric.cc | 18 +- lily/module-scheme.cc | 2 +- lily/moment.cc | 6 +- lily/music-function.cc | 2 +- lily/music.cc | 4 +- lily/new-fingering-engraver.cc | 10 +- lily/new-lyric-combine-music-iterator.cc | 9 +- lily/note-collision.cc | 15 +- lily/note-column.cc | 15 +- lily/note-head.cc | 23 +- lily/note-name-engraver.cc | 2 +- lily/open-type-font-scheme.cc | 6 +- lily/open-type-font.cc | 23 +- lily/output-def.cc | 2 +- lily/output-property-music-iterator.cc | 4 +- lily/pango-font.cc | 37 ++-- lily/pango-select.cc | 4 +- lily/paper-book.cc | 6 +- lily/paper-column.cc | 4 +- lily/paper-outputter-scheme.cc | 8 +- lily/paper-outputter.cc | 4 +- lily/paper-score.cc | 4 +- lily/parse-scm.cc | 1 + lily/parser.yy | 17 +- lily/part-combine-iterator.cc | 4 +- lily/percent-repeat-engraver.cc | 11 +- lily/percent-repeat-iterator.cc | 3 +- lily/performance.cc | 9 +- lily/pfb.cc | 8 +- lily/phrasing-slur-engraver.cc | 6 +- lily/piano-pedal-engraver.cc | 22 +- lily/piano-pedal-performer.cc | 10 +- lily/pitch.cc | 12 +- lily/prob.cc | 2 +- lily/program-option.cc | 40 ++-- lily/property-iterator.cc | 3 +- lily/quote-iterator.cc | 10 +- lily/relative-octave-check.cc | 5 +- lily/relocate.cc | 69 +++--- lily/repeat-acknowledge-engraver.cc | 2 +- lily/rest-collision.cc | 13 +- lily/rest.cc | 19 +- lily/score-engraver.cc | 16 +- lily/score.cc | 3 +- lily/script-engraver.cc | 6 +- lily/side-position-interface.cc | 2 +- lily/simple-spacer.cc | 9 +- lily/slur-engraver.cc | 8 +- lily/slur.cc | 2 +- lily/source-file.cc | 39 ++-- lily/source.cc | 4 +- lily/spacing-spanner.cc | 19 +- lily/span-bar.cc | 6 +- lily/span-dynamic-performer.cc | 2 + lily/staff-performer.cc | 8 +- lily/staff-spacing.cc | 5 +- lily/stem-engraver.cc | 6 +- lily/stem.cc | 31 +-- lily/sustain-pedal.cc | 10 +- lily/system.cc | 16 +- lily/template5.cc | 2 +- lily/text-interface.cc | 2 +- lily/text-metrics.cc | 8 +- lily/text-spanner-engraver.cc | 4 +- lily/tfm-reader.cc | 7 +- lily/tfm.cc | 14 +- lily/tie-engraver.cc | 14 +- lily/time-scaled-music-iterator.cc | 2 + lily/time-signature-engraver.cc | 6 +- lily/time-signature.cc | 11 +- lily/translator-ctors.cc | 2 + lily/translator.cc | 4 +- lily/trill-spanner-engraver.cc | 4 +- lily/ttf.cc | 8 +- lily/vaticana-ligature-engraver.cc | 27 +-- lily/vaticana-ligature.cc | 14 +- lily/vertical-align-engraver.cc | 2 +- lily/volta-bracket.cc | 2 +- lily/volta-engraver.cc | 8 +- lily/volta-repeat-iterator.cc | 2 +- 238 files changed, 1773 insertions(+), 1635 deletions(-) diff --git a/ChangeLog b/ChangeLog index 925558bbbc..e000adc6e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-01-26 Jan Nieuwenhuizen + + * Finish std::string interface. For now, use std:: marker + throughout for easy s/r. + 2006-01-26 Han-Wen Nienhuys * Documentation/user/putting.itely (Score is a single musical @@ -28,6 +33,8 @@ 2006-01-25 Jan Nieuwenhuizen + * 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. diff --git a/GNUmakefile.in b/GNUmakefile.in index 332676d2c2..c84bf3fa4c 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -94,6 +94,10 @@ tree-share = $(tree-prefix)/share 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: diff --git a/flower/file-name.cc b/flower/file-name.cc index fbd31de4c8..9cd37c9a7b 100644 --- a/flower/file-name.cc +++ b/flower/file-name.cc @@ -36,8 +36,8 @@ using namespace std; #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 (); @@ -53,8 +53,8 @@ dos_to_posix (Std_string file_name) #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 ("//", "/"); @@ -63,25 +63,25 @@ slashify (Std_string file_name) #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 @@ -93,7 +93,7 @@ File_name::File_name (Std_string file_name) 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); @@ -129,6 +129,6 @@ File_name::is_absolute () const #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 diff --git a/flower/file-path.cc b/flower/file-path.cc index 19d9d9bfab..058d54793b 100644 --- a/flower/file-path.cc +++ b/flower/file-path.cc @@ -9,6 +9,8 @@ #include "file-path.hh" +#include "std-string.hh" + #include #include using namespace std; @@ -29,28 +31,34 @@ using namespace std; #define PATHSEP ':' #endif -Array +Array File_path::directories () const { return dirs_; } +#include 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; @@ -79,7 +87,7 @@ is_file (Std_string file_name) } bool -is_dir (Std_string file_name) +is_dir (std::string file_name) { #if !STAT_MACROS_BROKEN struct stat sbuf; @@ -106,8 +114,8 @@ directory, in this order. @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; @@ -125,14 +133,14 @@ File_path::find (Std_string name) const 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 (); } @@ -146,21 +154,21 @@ File_path::find (Std_string name) const 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; } @@ -170,7 +178,7 @@ File_path::find (Std_string name, char const *extensions[]) /** 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 = "."; @@ -182,27 +190,27 @@ File_path::try_append (Std_string 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); } diff --git a/flower/getopt-long.cc b/flower/getopt-long.cc index b7abd93817..561210dc60 100644 --- a/flower/getopt-long.cc +++ b/flower/getopt-long.cc @@ -11,7 +11,8 @@ #include #include "config.hh" -#include "string.hh" +#include "international.hh" +#include "std-string.hh" #if !HAVE_GETTEXT inline char * @@ -85,25 +86,25 @@ Getopt_long::parselong () 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 = " "; @@ -132,7 +133,7 @@ Getopt_long::report (Errorcod c) 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) { @@ -146,9 +147,9 @@ Getopt_long::report (Errorcod 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'", @@ -295,23 +296,23 @@ Getopt_long::get_next_arg () 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"; } diff --git a/flower/include/file-name.hh b/flower/include/file-name.hh index b91eb35156..329a972c9f 100644 --- a/flower/include/file-name.hh +++ b/flower/include/file-name.hh @@ -15,18 +15,18 @@ 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 */ diff --git a/flower/include/file-path.hh b/flower/include/file-path.hh index 2399700232..22b943e9c8 100644 --- a/flower/include/file-path.hh +++ b/flower/include/file-path.hh @@ -23,19 +23,19 @@ class File_path { - Array dirs_; + Array dirs_; public: - Array 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 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 */ diff --git a/flower/include/flower-proto.hh b/flower/include/flower-proto.hh index 24a050b169..f175eebb1a 100644 --- a/flower/include/flower-proto.hh +++ b/flower/include/flower-proto.hh @@ -19,6 +19,15 @@ template struct Link_list; template struct Interval_t; template 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 Interval; @@ -29,10 +38,6 @@ struct Rational; 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; @@ -46,7 +51,6 @@ typedef unsigned U32; typedef int I32; typedef long long I64; -typedef unsigned char Byte; struct Duration; struct Duration_iterator; diff --git a/flower/include/getopt-long.hh b/flower/include/getopt-long.hh index 03b660b30d..0ab316fc94 100644 --- a/flower/include/getopt-long.hh +++ b/flower/include/getopt-long.hh @@ -20,12 +20,12 @@ struct Long_option_init 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 diff --git a/flower/include/international.hh b/flower/include/international.hh index bba4a5a330..fdf41a9b96 100644 --- a/flower/include/international.hh +++ b/flower/include/international.hh @@ -22,14 +22,14 @@ /** 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 diff --git a/flower/include/interval.hh b/flower/include/interval.hh index 6351d35535..01754b9716 100644 --- a/flower/include/interval.hh +++ b/flower/include/interval.hh @@ -24,7 +24,7 @@ struct Interval_t : public Drul_array Drul_array::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) { @@ -111,7 +111,7 @@ struct Interval_t : public Drul_array Drul_array 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 () diff --git a/flower/include/interval.tcc b/flower/include/interval.tcc index 9af4047a8c..396904d05d 100644 --- a/flower/include/interval.tcc +++ b/flower/include/interval.tcc @@ -12,7 +12,7 @@ #include #include "interval.hh" -#include "string.hh" +#include "std-string.hh" // MacOS 10.3 problems: // #include @@ -105,15 +105,15 @@ Interval_t::intersect (Interval_t h) } template -Std_string +std::string Interval_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 diff --git a/flower/include/offset.hh b/flower/include/offset.hh index 5ca7e0e68c..73684355ae 100644 --- a/flower/include/offset.hh +++ b/flower/include/offset.hh @@ -9,7 +9,6 @@ #include "axis.hh" #include "std-string.hh" -#include "string.hh" #include "real.hh" class Offset; @@ -94,7 +93,7 @@ public: coordinate_a_[X_AXIS] = coordinate_a_[Y_AXIS] = 0.0; } - Std_string to_string () const; + std::string to_string () const; Offset &mirror (Axis a) { @@ -112,6 +111,7 @@ public: } }; +#include "arithmetic-operator.hh" IMPLEMENT_ARITHMETIC_OPERATOR (Offset, +); IMPLEMENT_ARITHMETIC_OPERATOR (Offset, -); IMPLEMENT_ARITHMETIC_OPERATOR (Offset, *); diff --git a/flower/include/rational.hh b/flower/include/rational.hh index 6c0da7b9a9..461b2522a2 100644 --- a/flower/include/rational.hh +++ b/flower/include/rational.hh @@ -11,7 +11,7 @@ #include "std-string.hh" -#include "string.hh" +#include "std-string.hh" /** Rational numbers. Included is support for + and - infinity. @@ -69,9 +69,10 @@ public: 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, *); diff --git a/flower/include/std-string.hh b/flower/include/std-string.hh index 4cefb79953..6c83bc526f 100644 --- a/flower/include/std-string.hh +++ b/flower/include/std-string.hh @@ -1,5 +1,5 @@ /* - std-string.hh -- declare Std_string + std-string.hh -- declare std::string source file of the GNU LilyPond music typesetter @@ -11,56 +11,61 @@ #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 +#include +#include + +#endif -#include "string.hh" -#else +#include "compare.hh" + +#if STD_STRING #include -// #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 */ diff --git a/flower/include/string-convert.hh b/flower/include/string-convert.hh index 1e9da716ef..198e365b96 100644 --- a/flower/include/string-convert.hh +++ b/flower/include/string-convert.hh @@ -10,42 +10,45 @@ 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 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 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 // diff --git a/flower/include/string-data.hh b/flower/include/string-data.hh index 43d145af6c..11dbe28189 100644 --- a/flower/include/string-data.hh +++ b/flower/include/string-data.hh @@ -11,6 +11,8 @@ #include "flower-proto.hh" +namespace std { + /**Internal String struct. the data itself. Handles simple tasks (resizing, resetting) */ @@ -65,8 +67,8 @@ class String_data void operator += (char const *str0); char const *c_str () const; - - char *get_str0 (); + + char *get_c_str (); Byte const *to_bytes () const; @@ -82,6 +84,8 @@ class String_data bool is_binary_bo () const; }; +} + #ifdef STRING_UTILS_INLINED #ifndef INLINE #define INLINE inline diff --git a/flower/include/string-data.icc b/flower/include/string-data.icc index 3e6e0d546d..078e5724b2 100644 --- a/flower/include/string-data.icc +++ b/flower/include/string-data.icc @@ -11,7 +11,7 @@ #include "string-data.hh" -#include +//#include #include #include #include @@ -21,6 +21,8 @@ const int INITIALMAX = 8; #include +namespace std { + INLINE void String_data::OKW () { @@ -157,7 +159,7 @@ String_data::c_str () const return (char const *)data_byte_; } INLINE char * -String_data::get_str0 () +String_data::get_c_str () { return (char *)data_byte_; } @@ -206,4 +208,6 @@ String_data::operator [] (int j) const return data_byte_[j]; } +} + #endif // __STRING_UTIL_CC // diff --git a/flower/include/string-handle.hh b/flower/include/string-handle.hh index 7527a2de50..9551508110 100644 --- a/flower/include/string-handle.hh +++ b/flower/include/string-handle.hh @@ -11,6 +11,7 @@ #include "flower-proto.hh" +namespace std { /** Reference counting for strings. @@ -39,7 +40,7 @@ public: 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); @@ -56,6 +57,8 @@ public: int length () const; }; +} + #ifdef STRING_UTILS_INLINED #ifndef INLINE #define INLINE inline diff --git a/flower/include/string-handle.icc b/flower/include/string-handle.icc index 10314f441c..7e653ef2e2 100644 --- a/flower/include/string-handle.icc +++ b/flower/include/string-handle.icc @@ -17,6 +17,8 @@ using namespace std; #include "string-data.hh" #include "string-handle.hh" +namespace std { + INLINE void String_handle::down () { @@ -74,7 +76,7 @@ String_handle::get_bytes () } INLINE char * -String_handle::get_str0 () +String_handle::get_c_str () { copy (); return (char *)data->get_bytes (); @@ -162,4 +164,6 @@ String_handle::is_binary_bo () const return data->is_binary_bo (); } +} + #endif diff --git a/flower/include/string.hh b/flower/include/string.hh index b541368d7e..7dd9932fe4 100644 --- a/flower/include/string.hh +++ b/flower/include/string.hh @@ -6,6 +6,10 @@ introduced Class String_handle */ +#ifndef STD_STRING_HH +#error string.hh is obsolete, use std-string.hh +#endif + #ifndef STRING_HH #define STRING_HH @@ -18,119 +22,75 @@ class ostream; #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 @@ -143,17 +103,11 @@ public: 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; @@ -164,36 +118,6 @@ public: 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 @@ -213,4 +137,13 @@ IMPLEMENT_ARITHMETIC_OPERATOR (String, +); 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 */ diff --git a/flower/include/string.icc b/flower/include/string.icc index 5da4b573f4..5f8a39a495 100644 --- a/flower/include/string.icc +++ b/flower/include/string.icc @@ -9,13 +9,7 @@ #ifndef STRING_ICC #define STRING_ICC -/// for completeness (=handy) -INLINE -String -to_string (String s) -{ - return s; -} +namespace std { INLINE char const * @@ -79,4 +73,6 @@ String::String (char const *source) strh_ = source; } +} + #endif /* STRING_ICC */ diff --git a/flower/include/warn.hh b/flower/include/warn.hh index 4aa4375197..6b4cd85322 100644 --- a/flower/include/warn.hh +++ b/flower/include/warn.hh @@ -9,13 +9,13 @@ #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 */ diff --git a/flower/international.cc b/flower/international.cc index 9d9e824eea..c50a3bad33 100644 --- a/flower/international.cc +++ b/flower/international.cc @@ -7,6 +7,8 @@ */ #include "config.hh" + +#include "international.hh" #include "string-convert.hh" #if !HAVE_GETTEXT @@ -19,24 +21,24 @@ gettext (char const *s) #include #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 ()); diff --git a/flower/interval.cc b/flower/interval.cc index a3dc129019..7b0c34d02e 100644 --- a/flower/interval.cc +++ b/flower/interval.cc @@ -18,10 +18,10 @@ Interval_t::infinity () } template<> -Std_string +std::string Interval_t::T_to_string (Real r) { - return ::to_string (r); + return std::to_string (r); } template<> @@ -32,10 +32,10 @@ Interval_t::infinity () } template<> -Std_string +std::string Interval_t::T_to_string (int i) { - return ::to_string (i); + return std::to_string (i); } template INTERVAL__INSTANTIATE (int); diff --git a/flower/offset.cc b/flower/offset.cc index 9265f12fda..b45809e0b9 100644 --- a/flower/offset.cc +++ b/flower/offset.cc @@ -10,12 +10,12 @@ #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 diff --git a/flower/rational.cc b/flower/rational.cc index 8ecdbccf34..3e8c421886 100644 --- a/flower/rational.cc +++ b/flower/rational.cc @@ -269,18 +269,18 @@ Rational::operator -= (Rational r) 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; } diff --git a/flower/std-string.cc b/flower/std-string.cc index 66b94fda31..531e134332 100644 --- a/flower/std-string.cc +++ b/flower/std-string.cc @@ -1,5 +1,5 @@ /* - 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 @@ -7,32 +7,92 @@ */ #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 diff --git a/flower/string-convert.cc b/flower/string-convert.cc index 5f74cc9fa6..7f36355fa8 100644 --- a/flower/string-convert.cc +++ b/flower/string-convert.cc @@ -6,6 +6,7 @@ #include "string-convert.hh" +#include #include #include using namespace std; @@ -27,16 +28,16 @@ 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++) { @@ -47,13 +48,13 @@ String_convert::bin2hex (Std_string bin_string) } 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)); @@ -66,9 +67,9 @@ String_convert::bin2unsigned (Std_string bin_string) 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; @@ -80,17 +81,17 @@ String_convert::dec2int (Std_string dec_string) 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; @@ -101,7 +102,7 @@ String_convert::dec2double (Std_string dec_string) } 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; @@ -121,10 +122,10 @@ String_convert::hex2bin (Std_string hex_string, Std_string &bin_string_r) 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); @@ -145,7 +146,7 @@ String_convert::hex2nibble (Byte byte) } // stupido. Should use int_string () -Std_string +std::string String_convert::int2dec (int i, int length_i, char ch) { char fill_char = ch; @@ -153,17 +154,17 @@ String_convert::int2dec (int i, int length_i, 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"; @@ -184,7 +185,7 @@ String_convert::unsigned2hex (unsigned u, ssize length, char fill_char) 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); @@ -204,16 +205,16 @@ String_convert::nibble2hex_byte (Byte byte) @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; @@ -221,15 +222,15 @@ String_convert::form_string (char const *format, ...) 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); } /** @@ -237,13 +238,13 @@ String_convert::vform_string (char const *format, va_list args) @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); } /** @@ -252,33 +253,33 @@ String_convert::double_string (double f, char const *fmt) @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); } /** @@ -287,11 +288,11 @@ String_convert::pointer_string (void const *l) @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); @@ -318,14 +319,14 @@ String_convert::precision_string (double x, int n) return (sign (x) > 0 ? str : "-" + str); } -Array -String_convert::split (Std_string str, char c) +Array +String_convert::split (std::string str, char c) { - Array a; + Array 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) ; @@ -337,7 +338,7 @@ String_convert::split (Std_string str, char c) return a; } -Std_string +std::string String_convert::long_string (long l) { char s[STRING_BUFFER_LEN]; @@ -345,8 +346,26 @@ String_convert::long_string (long l) 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 ()); } diff --git a/flower/string.cc b/flower/string.cc index ec4bd90243..47cf6f11f2 100644 --- a/flower/string.cc +++ b/flower/string.cc @@ -3,66 +3,59 @@ (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 #include #include #include -#include 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); @@ -71,11 +64,37 @@ String::substr (int pos, int n) const #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 @@ -90,18 +109,28 @@ String::empty () 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; @@ -119,10 +148,35 @@ String::replace (int pos, int n, String str) 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 @@ -145,76 +199,8 @@ String::get_copy_str0 () const } -/* - 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; -} - - -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) { @@ -222,11 +208,8 @@ String::prepend (String s) *this = s; } -int -String::length () const -{ - return strh_.length (); -} +#endif + Byte const * String::to_bytes () const @@ -240,32 +223,6 @@ String::get_bytes () 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; -} - int String::index_last (char const c) const @@ -367,7 +324,7 @@ String::right_string (int n) const if (n < 1) return ""; - return String (strh_.to_bytes () + length () - n, n); + return String (strh_.c_str () + length () - n, n); } String @@ -399,28 +356,10 @@ String::cut_string (int index_i, int n) const 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); } -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 { @@ -434,6 +373,8 @@ String::to_double () const } #ifdef STREAM_SUPPORT +#include + ostream & operator << (ostream &os, String d) { @@ -457,7 +398,7 @@ String::substitute (String find, String replace) { 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) @@ -471,7 +412,11 @@ String::substitute (String find, String replace) 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 */ diff --git a/flower/stringutil.cc b/flower/stringutil.cc index f586031f8e..0134136192 100644 --- a/flower/stringutil.cc +++ b/flower/stringutil.cc @@ -8,6 +8,9 @@ (c) 1997--2006 Han-Wen Nienhuys */ +#if !STD_STRING + + #ifdef STRING_DEBUG #define memmove mymemmove #endif @@ -22,8 +25,12 @@ #define INLINE +#include + #include "string-data.hh" -#include "string.hh" +#include "string-handle.hh" + +#include "std-string.hh" #include "string-data.icc" #include "string-handle.icc" @@ -40,3 +47,5 @@ mymemmove (void *dest, void const *src, size_t n) return memcpy (dest, src, n); } #endif + +#endif /* !STD_STRING */ diff --git a/flower/warn.cc b/flower/warn.cc index c911526c97..1dcf357736 100644 --- a/flower/warn.cc +++ b/flower/warn.cc @@ -10,6 +10,9 @@ #include #include + +#include "international.hh" + using namespace std; /* Is progress indication at NEWLINE? */ @@ -17,7 +20,7 @@ static bool progress_newline = true; /* 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") @@ -31,7 +34,7 @@ progress_indication (String s) /* 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); @@ -40,27 +43,27 @@ message (String s) /* 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"); diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index 62329c6dc0..7d97b65d26 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -11,13 +11,14 @@ #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" @@ -531,7 +532,7 @@ Accidental_engraver::acknowledge_rhythmic_head (Grob_info info) && 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"), diff --git a/lily/accidental.cc b/lily/accidental.cc index edea40f95e..94f92f3a72 100644 --- a/lily/accidental.cc +++ b/lily/accidental.cc @@ -8,6 +8,7 @@ #include "accidental-interface.hh" #include "font-interface.hh" +#include "international.hh" #include "item.hh" #include "output-def.hh" #include "pitch.hh" @@ -141,8 +142,8 @@ Accidental_interface::accurate_boxes (Grob *a, Grob **common) /* 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) @@ -201,7 +202,7 @@ Accidental_interface::print (SCM 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 @@ -231,7 +232,7 @@ Accidental_interface::print (SCM smob) 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 ()) diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index 9dc7691c6a..576a9d86f1 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -8,16 +8,17 @@ #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; @@ -73,7 +74,7 @@ All_font_metrics::find_pango_font (PangoFontDescription *description, 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, @@ -96,11 +97,11 @@ All_font_metrics::find_pango_font (PangoFontDescription *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; @@ -123,14 +124,14 @@ kpathsea_find_file (String name, String ext) } 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"); @@ -156,20 +157,20 @@ All_font_metrics::find_otf (String name) } 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; } @@ -198,7 +199,7 @@ All_font_metrics::find_tfm (String name) } Font_metric * -All_font_metrics::find_font (String name) +All_font_metrics::find_font (std::string name) { Font_metric *f = find_otf (name); @@ -213,7 +214,7 @@ All_font_metrics::find_font (String 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); diff --git a/lily/apply-context-iterator.cc b/lily/apply-context-iterator.cc index 2714c5c77d..0f6e6daff8 100644 --- a/lily/apply-context-iterator.cc +++ b/lily/apply-context-iterator.cc @@ -6,10 +6,11 @@ (c) 2004--2006 Han-Wen Nienhuys */ -#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. diff --git a/lily/audio-item.cc b/lily/audio-item.cc index aedf9785db..b5edac5fbb 100644 --- a/lily/audio-item.cc +++ b/lily/audio-item.cc @@ -11,7 +11,7 @@ #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; } @@ -62,7 +62,7 @@ Audio_time_signature::Audio_time_signature (int beats, int one_beat) 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; diff --git a/lily/auto-change-iterator.cc b/lily/auto-change-iterator.cc index 3f65471843..31d75f0f1c 100644 --- a/lily/auto-change-iterator.cc +++ b/lily/auto-change-iterator.cc @@ -7,8 +7,9 @@ */ #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 { @@ -25,7 +26,7 @@ protected: 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_; @@ -34,7 +35,7 @@ private: 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; @@ -57,7 +58,7 @@ Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym, if (current && current->id_string () == to_id) { - String msg; + std::string msg; msg += _f ("can't change, already in translator: %s", to_id); } @@ -100,7 +101,7 @@ Auto_change_iterator::process (Moment m) 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); diff --git a/lily/axis-group-engraver.cc b/lily/axis-group-engraver.cc index 87fcd2817d..b20abef88f 100644 --- a/lily/axis-group-engraver.cc +++ b/lily/axis-group-engraver.cc @@ -8,10 +8,11 @@ #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" diff --git a/lily/bar-check-iterator.cc b/lily/bar-check-iterator.cc index f08a9e43db..9f9f20fee0 100644 --- a/lily/bar-check-iterator.cc +++ b/lily/bar-check-iterator.cc @@ -6,10 +6,11 @@ (c) 2001--2006 Han-Wen Nienhuys */ -#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 diff --git a/lily/bar-engraver.cc b/lily/bar-engraver.cc index bed12337d8..85c98ead9c 100644 --- a/lily/bar-engraver.cc +++ b/lily/bar-engraver.cc @@ -21,7 +21,7 @@ class Bar_engraver : public Engraver { public: TRANSLATOR_DECLARATIONS (Bar_engraver); - void request_bar (String type_string); + void request_bar (std::string type_string); protected: virtual void finalize (); diff --git a/lily/bar-line.cc b/lily/bar-line.cc index ec91336621..5a30a2c9a5 100644 --- a/lily/bar-line.cc +++ b/lily/bar-line.cc @@ -26,7 +26,7 @@ Bar_line::print (SCM smob) 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; @@ -37,7 +37,7 @@ Bar_line::print (SCM smob) } 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); diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 39ee8c6f3d..e8a77ec1ff 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -6,18 +6,19 @@ (c) 1998--2006 Han-Wen Nienhuys */ -#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" @@ -242,7 +243,7 @@ Beam_engraver::acknowledge_stem (Grob_info info) 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 diff --git a/lily/beam-quanting.cc b/lily/beam-quanting.cc index 6ce2b7736a..c982c6d812 100644 --- a/lily/beam-quanting.cc +++ b/lily/beam-quanting.cc @@ -12,12 +12,13 @@ #include 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) @@ -61,7 +62,7 @@ struct Quant_score Real demerits; #if DEBUG_QUANTING - String score_card_; + std::string score_card_; #endif }; diff --git a/lily/beam.cc b/lily/beam.cc index cab9d8fdfc..5861dba321 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -25,18 +25,20 @@ */ #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 @@ -498,7 +500,7 @@ Beam::print (SCM grob) 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; diff --git a/lily/binary-source-file.cc b/lily/binary-source-file.cc index 270d819164..818d5a4f2b 100644 --- a/lily/binary-source-file.cc +++ b/lily/binary-source-file.cc @@ -12,7 +12,7 @@ using namespace std; #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) { } @@ -21,7 +21,7 @@ Binary_source_file::~Binary_source_file () { } -String +std::string Binary_source_file::quote_input (char const *pos_str0) const { assert (this); @@ -31,18 +31,18 @@ Binary_source_file::quote_input (char const *pos_str0) const 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; diff --git a/lily/break-align-interface.cc b/lily/break-align-interface.cc index e68453a34c..233bb33e45 100644 --- a/lily/break-align-interface.cc +++ b/lily/break-align-interface.cc @@ -9,15 +9,16 @@ #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); @@ -182,11 +183,11 @@ Break_align_interface::calc_positioning_done (SCM smob) 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 (); diff --git a/lily/change-iterator.cc b/lily/change-iterator.cc index 5735d4915d..ff13c3d204 100644 --- a/lily/change-iterator.cc +++ b/lily/change-iterator.cc @@ -9,23 +9,24 @@ #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); @@ -42,7 +43,7 @@ Change_iterator::process (Moment m) 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. @@ -56,7 +57,7 @@ Change_iterator::process (Moment m) if (current && current->id_string () == to_id) { - String msg; + std::string msg; msg += _f ("can't change, already in translator: %s", to_id); } diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc index aac261420d..d28af332f6 100644 --- a/lily/chord-tremolo-engraver.cc +++ b/lily/chord-tremolo-engraver.cc @@ -6,18 +6,20 @@ (c) 2000--2006 Han-Wen Nienhuys */ +#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" @@ -157,7 +159,7 @@ Chord_tremolo_engraver::acknowledge_stem (Grob_info info) 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 diff --git a/lily/chord-tremolo-iterator.cc b/lily/chord-tremolo-iterator.cc index 1ed8508ca5..b6f1c4f69a 100644 --- a/lily/chord-tremolo-iterator.cc +++ b/lily/chord-tremolo-iterator.cc @@ -9,6 +9,7 @@ #include "chord-tremolo-iterator.hh" #include "input.hh" +#include "international.hh" #include "repeated-music.hh" void diff --git a/lily/clef.cc b/lily/clef.cc index 04a5537a22..59d9375c00 100644 --- a/lily/clef.cc +++ b/lily/clef.cc @@ -8,10 +8,11 @@ #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 @@ -22,7 +23,7 @@ Clef::calc_glyph_name (SCM smob) 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 @@ -47,7 +48,7 @@ Clef::print (SCM smob) 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 ()) diff --git a/lily/cluster.cc b/lily/cluster.cc index 7f4001007b..a81df96cc4 100644 --- a/lily/cluster.cc +++ b/lily/cluster.cc @@ -13,14 +13,15 @@ #include 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. @@ -37,7 +38,7 @@ brew_cluster_piece (Grob *me, Array bottom_points, Array top_poi 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); @@ -52,7 +53,7 @@ brew_cluster_piece (Grob *me, Array bottom_points, Array top_poi Array 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++) { @@ -63,7 +64,7 @@ brew_cluster_piece (Grob *me, Array bottom_points, Array top_poi 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++) { @@ -74,7 +75,7 @@ brew_cluster_piece (Grob *me, Array bottom_points, Array top_poi 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++) @@ -97,7 +98,7 @@ brew_cluster_piece (Grob *me, Array bottom_points, Array top_poi + 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++) diff --git a/lily/coherent-ligature-engraver.cc b/lily/coherent-ligature-engraver.cc index e01c6ec1fe..8ab2e16f2d 100644 --- a/lily/coherent-ligature-engraver.cc +++ b/lily/coherent-ligature-engraver.cc @@ -116,8 +116,8 @@ Coherent_ligature_engraver::get_set_column (Item *item, Paper_column *column) 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). diff --git a/lily/context-def.cc b/lily/context-def.cc index 6f91d8292a..ee4220469a 100644 --- a/lily/context-def.cc +++ b/lily/context-def.cc @@ -11,16 +11,16 @@ #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; diff --git a/lily/context-property.cc b/lily/context-property.cc index 396cd8246a..502fc92f11 100644 --- a/lily/context-property.cc +++ b/lily/context-property.cc @@ -9,12 +9,13 @@ #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, diff --git a/lily/context-specced-music-iterator.cc b/lily/context-specced-music-iterator.cc index 06fa347912..323dd7ca50 100644 --- a/lily/context-specced-music-iterator.cc +++ b/lily/context-specced-music-iterator.cc @@ -22,7 +22,7 @@ Context_specced_music_iterator::construct_children () { 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); diff --git a/lily/context.cc b/lily/context.cc index e2d597b15a..cc4536279e 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -8,17 +8,18 @@ #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 @@ -160,7 +161,7 @@ Context::create_unique_context (SCM n, SCM operations) } 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. @@ -193,7 +194,7 @@ Context::find_create_context (SCM n, String id, SCM operations) { SCM ops = (i == path.size () -1) ? operations : SCM_EOL; - String this_id = ""; + std::string this_id = ""; if (i == path.size () -1) this_id = id; @@ -223,10 +224,10 @@ Context::find_create_context (SCM n, String id, SCM operations) 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); @@ -239,12 +240,12 @@ Context::create_context (Context_def *cdef, } 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 ()) @@ -259,7 +260,7 @@ Context::get_context_key (String type, String id) } Object_key const * -Context::get_grob_key (String name) +Context::get_grob_key (std::string name) { if (!use_object_keys) return 0; @@ -272,7 +273,7 @@ Context::get_grob_key (String name) 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 ()) @@ -313,7 +314,7 @@ Context::get_default_interpreter () 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) { @@ -424,7 +425,7 @@ Context::remove_context (Context *trans) */ Context * find_context_below (Context *where, - SCM type, String id) + SCM type, std::string id) { if (where->is_alias (type)) { @@ -457,7 +458,7 @@ Context::context_name_symbol () const return td->get_context_name (); } -String +std::string Context::context_name () const { return ly_symbol2string (context_name_symbol ()); diff --git a/lily/custos.cc b/lily/custos.cc index 0b928b500d..5b6fc3df26 100644 --- a/lily/custos.cc +++ b/lily/custos.cc @@ -19,11 +19,12 @@ using namespace std; #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 @@ -32,7 +33,7 @@ Custos::print (SCM smob) 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 @@ -52,7 +53,7 @@ Custos::print (SCM smob) 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) diff --git a/lily/dots.cc b/lily/dots.cc index 51c5ef9893..0627b2b720 100644 --- a/lily/dots.cc +++ b/lily/dots.cc @@ -26,7 +26,7 @@ Dots::print (SCM d) 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 (); /* diff --git a/lily/duration.cc b/lily/duration.cc index f01d824621..b21ca97a97 100644 --- a/lily/duration.cc +++ b/lily/duration.cc @@ -60,17 +60,17 @@ Duration::get_length () const 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; diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 5f5559110a..e6ecc2a972 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -12,15 +12,16 @@ #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" @@ -186,7 +187,7 @@ Dynamic_engraver::process_music () { 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"); @@ -204,7 +205,7 @@ Dynamic_engraver::process_music () TODO: Use symbols. */ - String start_type + std::string start_type = ly_symbol2string (current_cresc_ev_->get_property ("name")); /* diff --git a/lily/event-chord-iterator.cc b/lily/event-chord-iterator.cc index 4e97968a83..2b1441a275 100644 --- a/lily/event-chord-iterator.cc +++ b/lily/event-chord-iterator.cc @@ -9,11 +9,12 @@ #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 () { diff --git a/lily/extender-engraver.cc b/lily/extender-engraver.cc index d4b521af9c..a0799a7ff0 100644 --- a/lily/extender-engraver.cc +++ b/lily/extender-engraver.cc @@ -10,10 +10,11 @@ #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); diff --git a/lily/file-name-map.cc b/lily/file-name-map.cc index da6447db25..8d3eb19c8e 100644 --- a/lily/file-name-map.cc +++ b/lily/file-name-map.cc @@ -12,10 +12,10 @@ using namespace std; #include "file-name-map.hh" #include "lily-guile.hh" -map file_name_map_global; +map 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]; diff --git a/lily/folded-repeat-iterator.cc b/lily/folded-repeat-iterator.cc index 51df070893..b927653e0c 100644 --- a/lily/folded-repeat-iterator.cc +++ b/lily/folded-repeat-iterator.cc @@ -8,10 +8,11 @@ #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 () { diff --git a/lily/font-config-scheme.cc b/lily/font-config-scheme.cc index 65349e87c2..482a240c9f 100644 --- a/lily/font-config-scheme.cc +++ b/lily/font-config-scheme.cc @@ -8,7 +8,7 @@ */ #include "lily-guile.hh" -#include "string.hh" +#include "std-string.hh" #include diff --git a/lily/font-config.cc b/lily/font-config.cc index f91916adba..66aba66409 100644 --- a/lily/font-config.cc +++ b/lily/font-config.cc @@ -14,6 +14,7 @@ #include #include "file-path.hh" +#include "international.hh" #include "main.hh" #include "warn.hh" @@ -36,14 +37,14 @@ init_fontconfig () if (!is_file ((char*)cache_file)) message (_f ("Rebuilding FontConfig cache %s. this may take a while...", cache_file)); - Array dirs; + Array 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) diff --git a/lily/font-metric.cc b/lily/font-metric.cc index 9d90c62b7f..8f42c7ff77 100644 --- a/lily/font-metric.cc +++ b/lily/font-metric.cc @@ -30,9 +30,9 @@ Font_metric::design_size () const } 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; @@ -83,7 +83,7 @@ Font_metric::get_indexed_char (int k) const } int -Font_metric::name_to_index (String) const +Font_metric::name_to_index (std::string) const { return -1; } @@ -129,10 +129,10 @@ Font_metric::font_file_name () const return scm_car (description_); } -String +std::string Font_metric::font_name () const { - String s ("unknown"); + std::string s ("unknown"); return s; } @@ -167,7 +167,7 @@ Font_metric::get_indexed_char_stencil (int code) const } Offset -Font_metric::attachment_point (String) const +Font_metric::attachment_point (std::string) const { return Offset (0, 0); } @@ -179,7 +179,7 @@ Font_metric::sub_fonts () const } 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 (), @@ -190,7 +190,7 @@ Font_metric::text_stencil (String str) const } Box -Font_metric::text_dimension (String) const +Font_metric::text_dimension (std::string) const { return Box (Interval (0, 0), Interval (0, 0)); } diff --git a/lily/function-documentation.cc b/lily/function-documentation.cc index cb04138ac1..27caa90fbf 100644 --- a/lily/function-documentation.cc +++ b/lily/function-documentation.cc @@ -9,7 +9,7 @@ #include using namespace std; -#include "string.hh" +#include "std-string.hh" #include "lily-guile.hh" static SCM doc_hash_table; @@ -25,7 +25,7 @@ void ly_add_function_documentation (SCM func, 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"), diff --git a/lily/general-scheme.cc b/lily/general-scheme.cc index 3ecb45fbd5..933a34b991 100644 --- a/lily/general-scheme.cc +++ b/lily/general-scheme.cc @@ -16,7 +16,7 @@ using namespace std; #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" @@ -31,8 +31,8 @@ LY_DEFINE (ly_find_file, "ly:find-file", { 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; @@ -56,8 +56,8 @@ LY_DEFINE (ly_gulp_file, "ly:gulp-file", 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", @@ -224,7 +224,7 @@ LY_DEFINE (ly_output_formats, "ly:output-formats", "Formats passed to --format as a list of strings, " "used for the output.") { - Array output_formats = split_string (output_format_global, ','); + Array output_formats = split_string (output_format_global, ','); SCM lst = SCM_EOL; int output_formats_count = output_formats.size (); diff --git a/lily/glissando-engraver.cc b/lily/glissando-engraver.cc index 4bb180ef16..b06ac56165 100644 --- a/lily/glissando-engraver.cc +++ b/lily/glissando-engraver.cc @@ -6,10 +6,11 @@ (c) 2000--2006 Jan Nieuwenhuizen */ -#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 @@ -87,7 +88,7 @@ Glissando_engraver::finalize () { if (line_) { - String msg = _ ("unterminated glissando"); + std::string msg = _ ("unterminated glissando"); if (event_) event_->origin ()->warning (msg); diff --git a/lily/global-context-scheme.cc b/lily/global-context-scheme.cc index 115b7f180b..7eb5fb224a 100644 --- a/lily/global-context-scheme.cc +++ b/lily/global-context-scheme.cc @@ -6,15 +6,16 @@ (c) 2005--2006 Han-Wen Nienhuys */ -#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), diff --git a/lily/global-context.cc b/lily/global-context.cc index d04ec4eb38..6c8b4e62f0 100644 --- a/lily/global-context.cc +++ b/lily/global-context.cc @@ -11,13 +11,14 @@ #include 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, diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc index df64d3e171..4438abd491 100644 --- a/lily/gourlay-breaking.cc +++ b/lily/gourlay-breaking.cc @@ -12,16 +12,17 @@ #include 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 @@ -173,13 +174,13 @@ Gourlay_breaking::do_solve () const 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"); diff --git a/lily/gregorian-ligature-engraver.cc b/lily/gregorian-ligature-engraver.cc index 29d8f40d3e..230a0e5425 100644 --- a/lily/gregorian-ligature-engraver.cc +++ b/lily/gregorian-ligature-engraver.cc @@ -9,11 +9,12 @@ #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 diff --git a/lily/gregorian-ligature.cc b/lily/gregorian-ligature.cc index 747a97bb1d..43cc3c5967 100644 --- a/lily/gregorian-ligature.cc +++ b/lily/gregorian-ligature.cc @@ -9,9 +9,8 @@ #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) { @@ -21,10 +20,10 @@ void check_prefix (String name, int mask, int prefix_set, String *str) } } -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); diff --git a/lily/grob-interface-scheme.cc b/lily/grob-interface-scheme.cc index 74aa84a7d9..e8e9e9200c 100644 --- a/lily/grob-interface-scheme.cc +++ b/lily/grob-interface-scheme.cc @@ -7,7 +7,7 @@ */ #include "lily-guile.hh" -#include "string.hh" +#include "std-string.hh" static SCM all_ifaces; diff --git a/lily/grob-interface.cc b/lily/grob-interface.cc index 8a990cfb43..779f54377b 100644 --- a/lily/grob-interface.cc +++ b/lily/grob-interface.cc @@ -8,8 +8,10 @@ #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, @@ -43,7 +45,7 @@ check_interfaces_for_property (Grob const *me, SCM sym) 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; @@ -54,7 +56,7 @@ check_interfaces_for_property (Grob const *me, SCM sym) 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); diff --git a/lily/grob.cc b/lily/grob.cc index cb3f90467c..0ad308bdb1 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -10,21 +10,19 @@ #include -#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 @@ -432,7 +430,7 @@ Grob::fixup_refpoint () MESSAGES ****************************************************************/ void -Grob::warning (String s) const +Grob::warning (std::string s) const { SCM cause = self_scm (); while (Grob *g = unsmob_grob (cause)) @@ -445,7 +443,7 @@ Grob::warning (String s) const } -String +std::string Grob::name () const { SCM meta = get_property ("meta"); @@ -455,7 +453,7 @@ Grob::name () const } void -Grob::programming_error (String s) const +Grob::programming_error (std::string s) const { SCM cause = self_scm (); while (Grob *g = unsmob_grob (cause)) diff --git a/lily/hairpin.cc b/lily/hairpin.cc index 5a9a885b23..199b69e719 100644 --- a/lily/hairpin.cc +++ b/lily/hairpin.cc @@ -7,17 +7,19 @@ */ #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 diff --git a/lily/horizontal-bracket-engraver.cc b/lily/horizontal-bracket-engraver.cc index 5475557ea7..176b5d56ef 100644 --- a/lily/horizontal-bracket-engraver.cc +++ b/lily/horizontal-bracket-engraver.cc @@ -8,9 +8,10 @@ */ #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" diff --git a/lily/hyphen-engraver.cc b/lily/hyphen-engraver.cc index 27572d852f..de6fa24b1e 100644 --- a/lily/hyphen-engraver.cc +++ b/lily/hyphen-engraver.cc @@ -9,11 +9,11 @@ */ #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 { diff --git a/lily/includable-lexer.cc b/lily/includable-lexer.cc index 9bcfbd2392..fcf1ff1909 100644 --- a/lily/includable-lexer.cc +++ b/lily/includable-lexer.cc @@ -12,11 +12,13 @@ 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 @@ -44,7 +46,7 @@ Includable_lexer::Includable_lexer () /** 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_) { @@ -55,7 +57,7 @@ Includable_lexer::new_input (String name, Sources *sources) 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 ()); @@ -69,7 +71,7 @@ Includable_lexer::new_input (String name, Sources *sources) state_stack_.push (yy_current_buffer); if (be_verbose_global) - progress_indication (String ("[") + name); + progress_indication (std::string ("[") + name); include_stack_.push (file); @@ -81,7 +83,7 @@ Includable_lexer::new_input (String name, Sources *sources) } 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); @@ -92,7 +94,7 @@ Includable_lexer::new_input (String name, String data, Sources *sources) 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)); diff --git a/lily/include/accidental-interface.hh b/lily/include/accidental-interface.hh index 5f28885f6e..12c77eace2 100644 --- a/lily/include/accidental-interface.hh +++ b/lily/include/accidental-interface.hh @@ -20,7 +20,7 @@ public: 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 accurate_boxes (Grob *me, Grob **common); }; diff --git a/lily/include/all-font-metrics.hh b/lily/include/all-font-metrics.hh index 5d1b8a6d38..414233124e 100644 --- a/lily/include/all-font-metrics.hh +++ b/lily/include/all-font-metrics.hh @@ -35,7 +35,7 @@ class All_font_metrics 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 @@ -44,9 +44,9 @@ public: 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; }; diff --git a/lily/include/audio-item.hh b/lily/include/audio-item.hh index cfcbe4034e..7def69e343 100644 --- a/lily/include/audio-item.hh +++ b/lily/include/audio-item.hh @@ -47,9 +47,9 @@ public: 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 @@ -68,7 +68,7 @@ public: class Audio_piano_pedal : public Audio_item { public: - String type_string_; + std::string type_string_; Direction dir_; }; @@ -81,10 +81,10 @@ public: 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 diff --git a/lily/include/bar-line.hh b/lily/include/bar-line.hh index f0626a6f13..dbc99745f2 100644 --- a/lily/include/bar-line.hh +++ b/lily/include/bar-line.hh @@ -18,7 +18,7 @@ class Bar_line 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)); diff --git a/lily/include/bar.hh b/lily/include/bar.hh index 0977b15af7..27fbe484a6 100644 --- a/lily/include/bar.hh +++ b/lily/include/bar.hh @@ -18,7 +18,7 @@ class Bar 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)); diff --git a/lily/include/binary-source-file.hh b/lily/include/binary-source-file.hh index 7934c88d26..429a04d667 100644 --- a/lily/include/binary-source-file.hh +++ b/lily/include/binary-source-file.hh @@ -11,7 +11,7 @@ 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 (); @@ -20,7 +20,7 @@ public: 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; }; diff --git a/lily/include/book.hh b/lily/include/book.hh index e77c196224..c731e21a50 100644 --- a/lily/include/book.hh +++ b/lily/include/book.hh @@ -13,14 +13,14 @@ #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_; diff --git a/lily/include/change-iterator.hh b/lily/include/change-iterator.hh index 27d8c263ca..75c84286d9 100644 --- a/lily/include/change-iterator.hh +++ b/lily/include/change-iterator.hh @@ -20,7 +20,7 @@ public: DECLARE_CLASSNAME(Change_iterator); private: - void error (String); + void error (std::string); }; #endif diff --git a/lily/include/context.hh b/lily/include/context.hh index 36ffd924a8..a667f9d408 100644 --- a/lily/include/context.hh +++ b/lily/include/context.hh @@ -30,8 +30,8 @@ private: int iterator_count_; bool init_; - map grob_counts_; - map context_counts_; + map grob_counts_; + map context_counts_; protected: Object_key const *key_; @@ -43,20 +43,19 @@ protected: 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; @@ -73,7 +72,7 @@ public: 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; @@ -90,7 +89,7 @@ public: 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 path_to_acceptable_context (SCM alias, @@ -107,7 +106,7 @@ void execute_general_pushpop_property (Context *context, 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); diff --git a/lily/include/dimensions.hh b/lily/include/dimensions.hh index 84f8c2884b..aa01197611 100644 --- a/lily/include/dimensions.hh +++ b/lily/include/dimensions.hh @@ -2,7 +2,7 @@ #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); @@ -37,7 +37,7 @@ const Real PT_TO_MM = (1.0 / MM_TO_PT); #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; diff --git a/lily/include/duration.hh b/lily/include/duration.hh index 00fb689cd6..6d7bdf6a32 100644 --- a/lily/include/duration.hh +++ b/lily/include/duration.hh @@ -20,7 +20,7 @@ public: Duration (); Duration (int, int); - String to_string () const; + std::string to_string () const; Duration compressed (Rational) const; Rational get_length () const; diff --git a/lily/include/file-name-map.hh b/lily/include/file-name-map.hh index 98273e170c..28a5d30aec 100644 --- a/lily/include/file-name-map.hh +++ b/lily/include/file-name-map.hh @@ -9,9 +9,9 @@ #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 */ diff --git a/lily/include/font-metric.hh b/lily/include/font-metric.hh index df3be0645c..d43403b378 100644 --- a/lily/include/font-metric.hh +++ b/lily/include/font-metric.hh @@ -20,21 +20,21 @@ class Font_metric 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; @@ -51,7 +51,7 @@ protected: 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 { diff --git a/lily/include/freetype.hh b/lily/include/freetype.hh index 188e6bc6a9..72ff32b99c 100644 --- a/lily/include/freetype.hh +++ b/lily/include/freetype.hh @@ -12,12 +12,12 @@ #include #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 */ diff --git a/lily/include/gregorian-ligature.hh b/lily/include/gregorian-ligature.hh index eaac1dd589..d59833a161 100644 --- a/lily/include/gregorian-ligature.hh +++ b/lily/include/gregorian-ligature.hh @@ -10,13 +10,13 @@ #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 *); }; /* diff --git a/lily/include/grob.hh b/lily/include/grob.hh index c5413c5e74..0652c9f815 100644 --- a/lily/include/grob.hh +++ b/lily/include/grob.hh @@ -73,7 +73,7 @@ public: bool is_live () const; /* naming. */ - String name () const; + std::string name () const; /* Properties */ SCM get_property_alist_chain (SCM) const; @@ -85,8 +85,8 @@ public: 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 */ diff --git a/lily/include/group-interface.hh b/lily/include/group-interface.hh index 00946d588b..67aa59a8b6 100644 --- a/lily/include/group-interface.hh +++ b/lily/include/group-interface.hh @@ -10,7 +10,7 @@ #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 diff --git a/lily/include/includable-lexer.hh b/lily/include/includable-lexer.hh index 2d4754fec2..66c07ef78d 100644 --- a/lily/include/includable-lexer.hh +++ b/lily/include/includable-lexer.hh @@ -13,7 +13,7 @@ #include #endif -#include "string.hh" +#include "std-string.hh" #include "parray.hh" #include "lily-proto.hh" @@ -39,11 +39,11 @@ public: ~Includable_lexer (); /// store dependencies for Makefile stuff. - Array file_name_strings_; + Array 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; }; diff --git a/lily/include/input.hh b/lily/include/input.hh index f9300bf4e8..9c255b70f0 100644 --- a/lily/include/input.hh +++ b/lily/include/input.hh @@ -10,6 +10,7 @@ #define INPUT_HH #include "flower-proto.hh" +#include "std-string.hh" /** Base class for anything that records its poisition in the parse file. @@ -26,17 +27,17 @@ public: 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; diff --git a/lily/include/kpath.hh b/lily/include/kpath.hh index 511362375c..ec74c7027a 100644 --- a/lily/include/kpath.hh +++ b/lily/include/kpath.hh @@ -9,9 +9,9 @@ #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 */ diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index de3d8f0e8c..b51629fa15 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -41,10 +41,10 @@ SCM ly_to_symbol (SCM scm); 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); @@ -67,7 +67,7 @@ Offset robust_scm2offset (SCM, Offset); 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 *); @@ -121,7 +121,7 @@ extern "C" { 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); diff --git a/lily/include/lily-lexer.hh b/lily/include/lily-lexer.hh index f1b88bf7c6..fcad09d526 100644 --- a/lily/include/lily-lexer.hh +++ b/lily/include/lily-lexer.hh @@ -24,10 +24,10 @@ class Lily_lexer : public Includable_lexer 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; @@ -35,7 +35,7 @@ private: SCM scopes_; SCM start_module_; public: - String main_input_name_; + std::string main_input_name_; void *lexval; Input *lexloc; bool is_main_input_; @@ -65,7 +65,7 @@ public: 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 (); diff --git a/lily/include/lily-parser.hh b/lily/include/lily-parser.hh index a6a151beb6..cfb3cd149d 100644 --- a/lily/include/lily-parser.hh +++ b/lily/include/lily-parser.hh @@ -39,7 +39,7 @@ public: Lily_lexer *lexer_; Sources *sources_; Duration default_duration_; - String output_basename_; + std::string output_basename_; int fatal_error_; int error_level_; @@ -52,10 +52,10 @@ public: 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); }; diff --git a/lily/include/lily-version.hh b/lily/include/lily-version.hh index 345caf46cd..d4df9e0529 100644 --- a/lily/include/lily-version.hh +++ b/lily/include/lily-version.hh @@ -9,11 +9,11 @@ #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 diff --git a/lily/include/lilypond-input-version.hh b/lily/include/lilypond-input-version.hh index 908474a76b..69e13e3b86 100644 --- a/lily/include/lilypond-input-version.hh +++ b/lily/include/lilypond-input-version.hh @@ -9,20 +9,20 @@ #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; diff --git a/lily/include/lilypond-key.hh b/lily/include/lilypond-key.hh index 7d18abd385..dc27c98fea 100644 --- a/lily/include/lilypond-key.hh +++ b/lily/include/lilypond-key.hh @@ -17,13 +17,13 @@ class Lilypond_grob_key : public Object_key { 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: @@ -37,15 +37,15 @@ class Lilypond_context_key : public Object_key { 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); @@ -59,10 +59,10 @@ protected: 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); diff --git a/lily/include/main.hh b/lily/include/main.hh index a54ff5a39d..d79b608c3e 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -10,43 +10,44 @@ #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 get_inclusion_names (); -void set_inclusion_names (Array); +Array get_inclusion_names (); +void set_inclusion_names (Array); -extern String init_name_global; +extern std::string init_name_global; /* options */ -extern Array dump_header_fieldnames_global; -extern String output_backend_global; -extern String output_name_global; +extern Array 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 failed_files; +extern Array failed_files; extern int exit_status_global; extern File_path global_path; extern const char *LILYPOND_DATADIR; diff --git a/lily/include/midi-item.hh b/lily/include/midi-item.hh index a4fc034ed1..4f0e22a19f 100644 --- a/lily/include/midi-item.hh +++ b/lily/include/midi-item.hh @@ -26,9 +26,9 @@ public: /// 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_; }; @@ -43,7 +43,7 @@ public: Moment delta_mom_; Midi_item *midi_; - String to_string () const; + std::string to_string () const; }; /** @@ -52,15 +52,15 @@ public: 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 @@ -68,7 +68,7 @@ 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_; }; @@ -89,7 +89,7 @@ public: Midi_instrument (Audio_instrument *); DECLARE_CLASSNAME(Midi_instrument); - virtual String to_string () const; + virtual std::string to_string () const; Audio_instrument *audio_; }; @@ -100,7 +100,7 @@ public: Midi_key (Audio_key *); DECLARE_CLASSNAME(Midi_key); - virtual String to_string () const; + virtual std::string to_string () const; Audio_key *audio_; }; @@ -111,7 +111,7 @@ public: 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_; @@ -129,7 +129,7 @@ public: 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_; @@ -146,7 +146,7 @@ public: 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_; @@ -164,7 +164,7 @@ public: Midi_text (Audio_text *); - virtual String to_string () const; + virtual std::string to_string () const; Audio_text *audio_; }; @@ -175,7 +175,7 @@ public: Midi_dynamic (Audio_dynamic *); DECLARE_CLASSNAME(Midi_dynamic); - virtual String to_string () const; + virtual std::string to_string () const; Audio_dynamic *audio_; }; @@ -186,7 +186,7 @@ public: 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_; }; @@ -197,7 +197,7 @@ public: Midi_tempo (Audio_tempo *); DECLARE_CLASSNAME(Midi_tempo); - virtual String to_string () const; + virtual std::string to_string () const; Audio_tempo *audio_; }; @@ -216,7 +216,7 @@ public: 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 diff --git a/lily/include/midi-stream.hh b/lily/include/midi-stream.hh index be91402d96..1d460c29da 100644 --- a/lily/include/midi-stream.hh +++ b/lily/include/midi-stream.hh @@ -10,24 +10,24 @@ #include 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 diff --git a/lily/include/misc.hh b/lily/include/misc.hh index 65b1155b18..34b28a118f 100644 --- a/lily/include/misc.hh +++ b/lily/include/misc.hh @@ -28,7 +28,7 @@ sign (int i) else return 0; } -Array split_string (String s, char c); +Array split_string (std::string s, char c); inline Real linear_interpolate (Real x, Real x1, Real x2, Real y1, Real y2) diff --git a/lily/include/modified-font-metric.hh b/lily/include/modified-font-metric.hh index 274e031b39..d0f73f1066 100644 --- a/lily/include/modified-font-metric.hh +++ b/lily/include/modified-font-metric.hh @@ -15,14 +15,14 @@ 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; @@ -32,13 +32,13 @@ protected: 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 */ diff --git a/lily/include/moment.hh b/lily/include/moment.hh index ea6ef59a5f..8d594d4931 100644 --- a/lily/include/moment.hh +++ b/lily/include/moment.hh @@ -46,7 +46,7 @@ public: /* 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; }; diff --git a/lily/include/music-output.hh b/lily/include/music-output.hh index 15771f9a13..ba34466128 100644 --- a/lily/include/music-output.hh +++ b/lily/include/music-output.hh @@ -9,7 +9,7 @@ #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" diff --git a/lily/include/open-type-font.hh b/lily/include/open-type-font.hh index c27c9a66ff..1a19ab3ccb 100644 --- a/lily/include/open-type-font.hh +++ b/lily/include/open-type-font.hh @@ -38,22 +38,22 @@ public: 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 */ diff --git a/lily/include/output-def.hh b/lily/include/output-def.hh index bf9d23f934..8b4dfe943f 100644 --- a/lily/include/output-def.hh +++ b/lily/include/output-def.hh @@ -9,7 +9,7 @@ #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" @@ -47,7 +47,7 @@ public: Output_def *parent_; Input input_origin_; - String user_key_; + std::string user_key_; Lily_parser *parser_; Lily_parser *get_parser () const; @@ -58,7 +58,7 @@ public: /* 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; diff --git a/lily/include/pango-font.hh b/lily/include/pango-font.hh index 852e73e28e..b3d4ebd934 100644 --- a/lily/include/pango-font.hh +++ b/lily/include/pango-font.hh @@ -36,9 +36,9 @@ public: ~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; }; diff --git a/lily/include/paper-outputter.hh b/lily/include/paper-outputter.hh index 6af69ce235..a45d3313e8 100644 --- a/lily/include/paper-outputter.hh +++ b/lily/include/paper-outputter.hh @@ -11,7 +11,7 @@ #include "lily-proto.hh" #include "array.hh" -#include "string.hh" +#include "std-string.hh" #include "protected-scm.hh" #include "smobs.hh" @@ -22,7 +22,7 @@ class Paper_outputter { SCM output_module_; - String file_name_; + std::string file_name_; SCM file_; public: @@ -32,13 +32,13 @@ 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 */ diff --git a/lily/include/performance.hh b/lily/include/performance.hh index 9fcfa38384..4ea823bd11 100644 --- a/lily/include/performance.hh +++ b/lily/include/performance.hh @@ -25,7 +25,7 @@ public: 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_staffs_; Cons *audio_element_list_; diff --git a/lily/include/pitch.hh b/lily/include/pitch.hh index 56617d9e61..1b6742afee 100644 --- a/lily/include/pitch.hh +++ b/lily/include/pitch.hh @@ -57,7 +57,7 @@ public: 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,); diff --git a/lily/include/prob.hh b/lily/include/prob.hh index f854bf3a41..719c140651 100644 --- a/lily/include/prob.hh +++ b/lily/include/prob.hh @@ -36,7 +36,7 @@ protected: 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; diff --git a/lily/include/relocate.hh b/lily/include/relocate.hh index c477acaab9..c8ccacc029 100644 --- a/lily/include/relocate.hh +++ b/lily/include/relocate.hh @@ -12,9 +12,9 @@ -#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; diff --git a/lily/include/rest.hh b/lily/include/rest.hh index aa82cc2142..19e3abc3d4 100644 --- a/lily/include/rest.hh +++ b/lily/include/rest.hh @@ -18,7 +18,7 @@ class Rest 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)); diff --git a/lily/include/score.hh b/lily/include/score.hh index 2e1724a35d..6cb5cf927d 100644 --- a/lily/include/score.hh +++ b/lily/include/score.hh @@ -15,7 +15,7 @@ #include "parray.hh" #include "smobs.hh" #include "virtual-methods.hh" -#include "string.hh" +#include "std-string.hh" class Score : public Input { @@ -25,7 +25,7 @@ class Score : public Input public: Link_array defs_; - String user_key_; + std::string user_key_; SCM header_; bool error_found_; diff --git a/lily/include/slur-configuration.hh b/lily/include/slur-configuration.hh index f7e2731a5c..3039bd960c 100644 --- a/lily/include/slur-configuration.hh +++ b/lily/include/slur-configuration.hh @@ -24,7 +24,7 @@ public: int index_; #if DEBUG_SLUR_SCORING - String score_card_; + std::string score_card_; #endif Slur_configuration (); diff --git a/lily/include/source-file.hh b/lily/include/source-file.hh index 161c8e3b8b..098ae75925 100644 --- a/lily/include/source-file.hh +++ b/lily/include/source-file.hh @@ -9,10 +9,11 @@ #ifndef SOURCE_FILE_HH #define SOURCE_FILE_HH +#include "std-string.hh" + #include using namespace std; -#include "string.hh" #include "protected-scm.hh" #include "parray.hh" @@ -27,19 +28,19 @@ using namespace std; 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); @@ -48,11 +49,11 @@ public: // 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; /* @@ -63,7 +64,7 @@ public: char const *pos_str0_; SCM get_port () const; - String name_; + std::string name_; private: Link_array newline_locations_; @@ -76,7 +77,7 @@ private: Protected_scm str_port_; }; -char *gulp_file (String fn, int *len); +char *gulp_file (std::string fn, int *len); #endif /* SOURCE_FILE_HH */ diff --git a/lily/include/source.hh b/lily/include/source.hh index 24ff6ad077..a786bea4ae 100644 --- a/lily/include/source.hh +++ b/lily/include/source.hh @@ -6,8 +6,10 @@ #ifndef SOURCE_HH #define SOURCE_HH + #include "cons.hh" #include "flower-proto.hh" +#include "std-string.hh" /* A set of sourcefiles. */ class Sources @@ -20,7 +22,7 @@ public: 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 *); diff --git a/lily/include/stream.hh b/lily/include/stream.hh index 7559d91201..fe33920d64 100644 --- a/lily/include/stream.hh +++ b/lily/include/stream.hh @@ -9,17 +9,17 @@ #ifndef STREAM_HH #define STREAM_HH +#include "std-string.hh" + #include #include 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); diff --git a/lily/include/text-metrics.hh b/lily/include/text-metrics.hh index 80765c75a1..47004766e9 100644 --- a/lily/include/text-metrics.hh +++ b/lily/include/text-metrics.hh @@ -12,7 +12,7 @@ #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); diff --git a/lily/include/tfm-reader.hh b/lily/include/tfm-reader.hh index d18db85d0a..9b2c8e22d1 100644 --- a/lily/include/tfm-reader.hh +++ b/lily/include/tfm-reader.hh @@ -20,7 +20,7 @@ class Tex_font_metric_reader 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 (); @@ -32,7 +32,7 @@ private: Binary_source_file input_; public: - Tex_font_metric_reader (String name); + Tex_font_metric_reader (std::string name); Tfm_info info_; Tfm_header header_; diff --git a/lily/include/tfm.hh b/lily/include/tfm.hh index 394c489ea3..85e2002029 100644 --- a/lily/include/tfm.hh +++ b/lily/include/tfm.hh @@ -103,7 +103,7 @@ struct Tfm_info 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]; @@ -144,14 +144,14 @@ class Tex_font_metric : public Simple_font_metric { 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; @@ -161,7 +161,7 @@ protected: Array char_metrics_; Array 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 (); diff --git a/lily/include/translator.hh b/lily/include/translator.hh index e88ab8b4c4..2b2cb9698c 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -10,7 +10,7 @@ #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" diff --git a/lily/include/type-swallow-translator.hh b/lily/include/type-swallow-translator.hh index a2205c8a0e..f477beeb3e 100644 --- a/lily/include/type-swallow-translator.hh +++ b/lily/include/type-swallow-translator.hh @@ -17,7 +17,7 @@ class Type_swallow_translator : public Translator { protected: - String swallow_string_; + std::string swallow_string_; bool try_music (Music *); public: VIRTUAL_COPY_CONS (Translator); diff --git a/lily/input-scheme.cc b/lily/input-scheme.cc index 6923a8b104..bf5793f52d 100644 --- a/lily/input-scheme.cc +++ b/lily/input-scheme.cc @@ -6,7 +6,7 @@ (c) 2005--2006 Han-Wen Nienhuys */ -#include "string.hh" +#include "std-string.hh" #include "input-smob.hh" /* We don't use IMPLEMENT_TYPE_P, since the smobification part is @@ -28,7 +28,7 @@ LY_DEFINE (ly_input_message, "ly:input-message", 2, 0, 1, (SCM sip, SCM msg, SCM 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; diff --git a/lily/input-smob.cc b/lily/input-smob.cc index 00c93305e7..be28167194 100644 --- a/lily/input-smob.cc +++ b/lily/input-smob.cc @@ -8,7 +8,7 @@ #include "input-smob.hh" -#include "string.hh" +#include "std-string.hh" #include "ly-smobs.icc" @@ -26,7 +26,7 @@ SCM mark_smob (SCM) static int print_smob (SCM s, SCM port, scm_print_state *) { - String str = "#location_string () + ">"; + std::string str = "#location_string () + ">"; scm_puts (str.c_str (), port); return 1; } diff --git a/lily/input.cc b/lily/input.cc index 3802e7d2cd..ef78037fad 100644 --- a/lily/input.cc +++ b/lily/input.cc @@ -11,8 +11,9 @@ #include using namespace std; -#include "source.hh" +#include "international.hh" #include "source-file.hh" +#include "source.hh" #include "warn.hh" Input::Input (Input const &i) @@ -66,7 +67,7 @@ Input::set_location (Input const &i_start, Input const &i_end) [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" @@ -75,13 +76,13 @@ Input::message (String s) const } 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 @@ -89,12 +90,12 @@ Input::error (String s) const } 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_) @@ -102,7 +103,7 @@ Input::location_string () const return " (" + _ ("position unknown") + ")"; } -String +std::string Input::line_number_string () const { if (source_file_) @@ -110,7 +111,7 @@ Input::line_number_string () const return "?"; } -String +std::string Input::file_string () const { if (source_file_) diff --git a/lily/key-signature-interface.cc b/lily/key-signature-interface.cc index 28db248a6d..d591d105d9 100644 --- a/lily/key-signature-interface.cc +++ b/lily/key-signature-interface.cc @@ -8,12 +8,13 @@ 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 { @@ -91,7 +92,7 @@ Key_signature_interface::print (SCM smob) 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 @@ -115,7 +116,7 @@ Key_signature_interface::print (SCM smob) 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)); diff --git a/lily/lexer.ll b/lily/lexer.ll index 92bbdc5e62..0a4db93461 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -35,43 +35,43 @@ #include 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) @@ -87,7 +87,7 @@ LYRICS ({AA}|{TEX})[^0-9 \t\n\f]* */ -SCM scan_fraction (String); +SCM scan_fraction (std::string); SCM (* scm_parse_error_handler) (void *); @@ -184,8 +184,8 @@ BOM_UTF8 \357\273\277 yy_push_state (sourcefilename); } \"[^"]*\" { /* 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)) @@ -196,8 +196,8 @@ BOM_UTF8 \357\273\277 } \"[^"]*\" { - 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; @@ -248,24 +248,24 @@ BOM_UTF8 \357\273\277 yy_push_state (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 (); } \\{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 (); @@ -347,15 +347,15 @@ BOM_UTF8 \357\273\277 } {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; } \" { @@ -378,7 +378,7 @@ BOM_UTF8 \357\273\277 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; @@ -399,7 +399,7 @@ BOM_UTF8 \357\273\277 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; @@ -418,7 +418,7 @@ BOM_UTF8 \357\273\277 return FRACTION; } {UNSIGNED} { - yylval.i = String_convert::dec2int (String (YYText ())); + yylval.i = String_convert::dec2int (std::string (YYText ())); return UNSIGNED; } {NOTECOMMAND} { @@ -426,7 +426,7 @@ BOM_UTF8 \357\273\277 } {LYRICS} { /* ugr. This sux. */ - String s (YYText ()); + std::string s (YYText ()); if (s == "__") return yylval.i = EXTENDER; if (s == "--") @@ -458,7 +458,7 @@ BOM_UTF8 \357\273\277 return FRACTION; } {UNSIGNED} { - yylval.i = String_convert::dec2int (String (YYText ())); + yylval.i = String_convert::dec2int (std::string (YYText ())); return UNSIGNED; } \" { @@ -493,7 +493,7 @@ BOM_UTF8 \357\273\277 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)) ) { @@ -529,7 +529,7 @@ BOM_UTF8 \357\273\277 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. */ @@ -577,7 +577,7 @@ BOM_UTF8 \357\273\277 } {UNSIGNED} { - yylval.i = String_convert::dec2int (String (YYText ())); + yylval.i = String_convert::dec2int (std::string (YYText ())); return UNSIGNED; } @@ -627,7 +627,7 @@ BOM_UTF8 \357\273\277 } <*>. { - String msg = _f ("invalid character: `%c'", YYText ()[0]); + std::string msg = _f ("invalid character: `%c'", YYText ()[0]); LexerError (msg.c_str ()); return YYText ()[0]; } @@ -689,7 +689,7 @@ Lily_lexer::identifier_type (SCM sid) int -Lily_lexer::scan_escaped_word (String str) +Lily_lexer::scan_escaped_word (std::string str) { // use more SCM for this. @@ -714,7 +714,7 @@ Lily_lexer::scan_escaped_word (String str) 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 ()); @@ -723,7 +723,7 @@ Lily_lexer::scan_escaped_word (String 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)) { @@ -774,29 +774,29 @@ Lily_lexer::is_figure_state () const } /* - 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); } @@ -806,7 +806,7 @@ Lilypond_version oldest_version ("2.3.22"); 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); @@ -823,25 +823,25 @@ is_valid_version (String 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; @@ -851,12 +851,11 @@ lyric_fudge (String 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); @@ -864,7 +863,7 @@ scan_fraction (String frac) } 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 ())); diff --git a/lily/ligature-engraver.cc b/lily/ligature-engraver.cc index 7649daf1e1..8c77ceb456 100644 --- a/lily/ligature-engraver.cc +++ b/lily/ligature-engraver.cc @@ -8,12 +8,13 @@ #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" diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index faa02a66e6..3ab11f3ccc 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -75,7 +75,7 @@ ly_quote_scm (SCM s) return scm_list_n (ly_symbol2scm ("quote"), s, SCM_UNDEFINED); } -String +std::string ly_symbol2string (SCM s) { /* @@ -85,15 +85,15 @@ 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); @@ -107,7 +107,7 @@ gulp_file_to_string (String fn, bool must_exist, int size) 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) @@ -126,12 +126,12 @@ extern "C" { } }; -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 * @@ -356,7 +356,7 @@ ly_assoc_cdr (SCM key, SCM alist) } SCM -ly_string_array_to_scm (Array a) +ly_string_array_to_scm (Array a) { SCM s = SCM_EOL; for (int i = a.size () - 1; i >= 0; i--) @@ -370,9 +370,9 @@ parse_symbol_list (char const *symbols) { 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, ' ')); } @@ -394,14 +394,14 @@ ly_truncate_list (int k, SCM lst) 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; } diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index 9117decb5f..a5c03cf736 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -12,14 +12,15 @@ #include 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[] = { @@ -171,7 +172,7 @@ Lily_lexer::set_current_scope () } int -Lily_lexer::lookup_keyword (String s) +Lily_lexer::lookup_keyword (std::string s) { return keytable_->lookup (s.c_str ()); } @@ -190,7 +191,7 @@ Lily_lexer::lookup_identifier_symbol (SCM sym) } SCM -Lily_lexer::lookup_identifier (String name) +Lily_lexer::lookup_identifier (std::string name) { return lookup_identifier_symbol (ly_symbol2scm (name.c_str ())); } @@ -220,7 +221,7 @@ Lily_lexer::set_identifier (SCM name, SCM s) { 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 ())); } diff --git a/lily/lily-parser-scheme.cc b/lily/lily-parser-scheme.cc index 6d615ea915..212ca92e68 100644 --- a/lily/lily-parser-scheme.cc +++ b/lily/lily-parser-scheme.cc @@ -11,6 +11,7 @@ #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" @@ -38,7 +39,7 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", 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 @@ -82,13 +83,13 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", 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 ()) { @@ -109,7 +110,7 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", 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"); diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 7ede1f2e7a..39e5c197a6 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -8,19 +8,21 @@ */ #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" @@ -80,7 +82,7 @@ Lily_parser::print_smob (SCM s, SCM port, scm_print_state*) /* 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); @@ -100,7 +102,7 @@ Lily_parser::parse_file (String init, String name, String 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 ())); @@ -130,7 +132,7 @@ Lily_parser::parse_file (String init, String name, String out_name) } 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"), @@ -163,14 +165,14 @@ Lily_parser::here_str0 () const } 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; diff --git a/lily/lily-version.cc b/lily/lily-version.cc index 4cf80766eb..28f2fbaa1a 100644 --- a/lily/lily-version.cc +++ b/lily/lily-version.cc @@ -11,27 +11,27 @@ #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; } diff --git a/lily/lilypond-key.cc b/lily/lilypond-key.cc index ecdb9f4b4c..f43d247a00 100644 --- a/lily/lilypond-key.cc +++ b/lily/lilypond-key.cc @@ -10,7 +10,7 @@ Lilypond_grob_key::Lilypond_grob_key (Object_key const *context, Moment start, - String name, + std::string name, int disambiguation_count) { context_ = context; @@ -41,7 +41,7 @@ Lilypond_grob_key::do_compare (Object_key const *key) const if (c) return c; - c = String::compare (grob_name_, other->grob_name_); + c = grob_name_.compare (other->grob_name_); if (c) return c; @@ -87,8 +87,8 @@ Lilypond_context_key::derived_mark () const 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; @@ -120,11 +120,11 @@ Lilypond_context_key::do_compare (Object_key const *key) const 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; @@ -177,7 +177,7 @@ Lilypond_general_key::derived_mark () const } Lilypond_general_key::Lilypond_general_key (Object_key const *parent, - String name, + std::string name, int count) { parent_ = parent; @@ -198,7 +198,7 @@ Lilypond_general_key::do_compare (Object_key const *key)const else if (other->parent_) return 1; - int c = String::compare (name_, other->name_); + int c = name_.compare (other->name_); if (c) return c; diff --git a/lily/lilypond-version.cc b/lily/lilypond-version.cc index da44cba73b..984c4e7c80 100644 --- a/lily/lilypond-version.cc +++ b/lily/lilypond-version.cc @@ -19,13 +19,13 @@ Lilypond_version::Lilypond_version (int major, int minor, int patch) patch_ = patch; } -Lilypond_version::Lilypond_version (String str) +Lilypond_version::Lilypond_version (std::string str) { major_ = 0; minor_ = 0; patch_ = 0; - Array version; + Array version; version = String_convert::split (str, '.'); if (version.size () > 0 && isdigit (version[0][0])) @@ -42,10 +42,10 @@ Lilypond_version::Lilypond_version (String str) 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 diff --git a/lily/lookup.cc b/lily/lookup.cc index a1ef5ef432..4ed1226b4c 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -451,40 +451,40 @@ Stencil 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) { @@ -506,7 +506,7 @@ Lookup::accordion (SCM s, Real staff_space, Font_metric *fm) 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); @@ -514,26 +514,26 @@ Lookup::accordion (SCM s, Real staff_space, Font_metric *fm) 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") { @@ -546,22 +546,22 @@ Lookup::accordion (SCM s, Real staff_space, Font_metric *fm) { 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); @@ -569,55 +569,55 @@ Lookup::accordion (SCM s, Real staff_space, Font_metric *fm) 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 diff --git a/lily/ly-module.cc b/lily/ly-module.cc index 4968c8255b..45db747819 100644 --- a/lily/ly-module.cc +++ b/lily/ly-module.cc @@ -9,7 +9,7 @@ #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 diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index 484167c109..4048ed2f26 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -83,15 +83,15 @@ get_voice_to_lyrics (Context *lyrics) 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; diff --git a/lily/main.cc b/lily/main.cc index 36ae928b47..73218de4b3 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -33,37 +33,38 @@ using namespace std; #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 dump_header_fieldnames_global; +Array 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; @@ -76,8 +77,8 @@ bool be_verbose_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; @@ -135,10 +136,10 @@ static char const *WARRANTY /* 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; @@ -275,9 +276,9 @@ warranty () } 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 ()); } @@ -299,7 +300,7 @@ do_chroot_jail () USER_NAME, GROUP_NAME, JAIL, DIR, JAIL_MAX }; - Array components = String_convert::split (jail_spec, ','); + Array components = String_convert::split (jail_spec, ','); if (components.size () != JAIL_MAX) { error (_f ("expected %d arguments with jail, found: %d", JAIL_MAX, @@ -450,7 +451,7 @@ setup_localisation () 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; @@ -460,7 +461,7 @@ setup_localisation () } static void -add_output_format (String format) +add_output_format (std::string format) { if (output_format_global != "") output_format_global += ","; @@ -477,32 +478,32 @@ parse_argv (int argc, char **argv) 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 @@ -516,7 +517,7 @@ parse_argv (int argc, char **argv) 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 (); } diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index 2715cf8ad0..2a4fbe3510 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -11,13 +11,14 @@ using namespace std; #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, diff --git a/lily/mensural-ligature-engraver.cc b/lily/mensural-ligature-engraver.cc index 79b6ccdf2b..92bcf58405 100644 --- a/lily/mensural-ligature-engraver.cc +++ b/lily/mensural-ligature-engraver.cc @@ -8,17 +8,18 @@ */ #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; diff --git a/lily/mensural-ligature.cc b/lily/mensural-ligature.cc index 36e5ef2026..aeb0194a3b 100644 --- a/lily/mensural-ligature.cc +++ b/lily/mensural-ligature.cc @@ -7,14 +7,15 @@ Pal Benko */ - #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" /* diff --git a/lily/midi-item.cc b/lily/midi-item.cc index d094899dc3..34184b636a 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -8,13 +8,14 @@ #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" @@ -51,25 +52,25 @@ Midi_item::get_midi (Audio_item *a) } 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); @@ -85,10 +86,10 @@ Midi_duration::Midi_duration (Real seconds_f) seconds_ = seconds_f; } -String +std::string Midi_duration::to_string () const { - return String (""; + return std::string (""; } Midi_event::Midi_event (Moment delta_mom, Midi_item *midi) @@ -100,30 +101,30 @@ 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, ""); @@ -132,10 +133,10 @@ Midi_header::Midi_header (int format_i, int tracks_i, int clocks_per_4_i) 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; @@ -152,8 +153,8 @@ Midi_instrument::to_string () const 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; } @@ -166,7 +167,7 @@ Midi_item::~Midi_item () { } -String +std::string Midi_item::i2varint_string (int i) { int buffer_i = i & 0x7f; @@ -177,10 +178,10 @@ Midi_item::i2varint_string (int i) 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 @@ -194,10 +195,10 @@ Midi_key::Midi_key (Audio_key *a) 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'); @@ -212,13 +213,13 @@ Midi_time_signature::Midi_time_signature (Audio_time_signature *a) 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'); @@ -260,11 +261,11 @@ Midi_note::get_pitch () const 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 @@ -278,15 +279,15 @@ Midi_note::to_string () const // 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; } @@ -304,22 +305,22 @@ Midi_note_off::Midi_note_off (Midi_note *n) 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; @@ -330,11 +331,11 @@ Midi_dynamic::Midi_dynamic (Audio_dynamic *a) 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): @@ -349,8 +350,8 @@ Midi_dynamic::to_string () const 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; } @@ -359,21 +360,21 @@ Midi_piano_pedal::Midi_piano_pedal (Audio_piano_pedal *a) 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; } @@ -382,11 +383,11 @@ Midi_tempo::Midi_tempo (Audio_tempo *a) 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); } @@ -396,10 +397,10 @@ Midi_text::Midi_text (Audio_text *a) 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_; @@ -435,12 +436,12 @@ Midi_track::Midi_track () // "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); } @@ -454,10 +455,10 @@ Midi_track::add (Moment delta_time_mom, Midi_item *midi) event_p_list_.append (new Killing_cons (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 *i = event_p_list_.head_; i; i = i->next_) diff --git a/lily/midi-stream.cc b/lily/midi-stream.cc index b139c8239e..b03d63b721 100644 --- a/lily/midi-stream.cc +++ b/lily/midi-stream.cc @@ -11,15 +11,16 @@ #include 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"); @@ -33,12 +34,11 @@ Midi_stream::~Midi_stream () } 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'")); @@ -49,13 +49,13 @@ Midi_stream::operator << (String str) 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'; diff --git a/lily/misc.cc b/lily/misc.cc index d605eb88a5..607cbe9953 100644 --- a/lily/misc.cc +++ b/lily/misc.cc @@ -9,7 +9,7 @@ #include "misc.hh" -#include "string.hh" +#include "std-string.hh" /* Return the 2-log, rounded down @@ -35,25 +35,25 @@ log_2 (double x) return log (x) / log (2.0); } -Array -split_string (String s, char c) +Array +split_string (std::string s, char c) { - Array rv; + Array 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; diff --git a/lily/modified-font-metric.cc b/lily/modified-font-metric.cc index 74f744d872..771ec857e9 100644 --- a/lily/modified-font-metric.cc +++ b/lily/modified-font-metric.cc @@ -66,7 +66,7 @@ Modified_font_metric::count () const } 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_; @@ -80,7 +80,7 @@ Modified_font_metric::get_indexed_wxwy (int k) const } 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); } @@ -104,17 +104,17 @@ Modified_font_metric::derived_mark () const /* 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]=='^') @@ -159,7 +159,7 @@ Modified_font_metric::tex_kludge (String text) const } 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 (orig_)) @@ -177,7 +177,7 @@ Modified_font_metric::text_stencil (String text) const } 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); @@ -197,7 +197,7 @@ Modified_font_metric::text_dimension (String text) const 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]); @@ -223,7 +223,7 @@ Modified_font_metric::sub_fonts () const return orig_->sub_fonts (); } -String +std::string Modified_font_metric::font_name () const { return original_font ()->font_name (); diff --git a/lily/module-scheme.cc b/lily/module-scheme.cc index c8a9002a63..0d64fa5290 100644 --- a/lily/module-scheme.cc +++ b/lily/module-scheme.cc @@ -9,7 +9,7 @@ #include "lily-guile.hh" #include "warn.hh" #include "main.hh" -#include "string.hh" +#include "std-string.hh" #include "ly-module.hh" diff --git a/lily/moment.cc b/lily/moment.cc index f0d34b8bc1..1bab8f8fc5 100644 --- a/lily/moment.cc +++ b/lily/moment.cc @@ -49,7 +49,7 @@ Moment::print_smob (SCM s, SCM port, scm_print_state *) Moment *r = (Moment *) SCM_CELL_WORD_1 (s); scm_puts ("#to_string (); + std::string str = r->to_string (); scm_puts ((char *)str.c_str (), port); scm_puts (">", port); @@ -153,10 +153,10 @@ Moment::set_infinite (int k) 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; diff --git a/lily/music-function.cc b/lily/music-function.cc index 4f49a05519..984edc9c0f 100644 --- a/lily/music-function.cc +++ b/lily/music-function.cc @@ -35,7 +35,7 @@ LY_DEFINE (ly_make_music_function, "ly:make-music-function", 2, 0, 0, { 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 != "") diff --git a/lily/music.cc b/lily/music.cc index cf48775f00..715df36c36 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -7,11 +7,13 @@ */ #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" diff --git a/lily/new-fingering-engraver.cc b/lily/new-fingering-engraver.cc index 934d4e40cf..0b796673e8 100644 --- a/lily/new-fingering-engraver.cc +++ b/lily/new-fingering-engraver.cc @@ -6,14 +6,16 @@ (c) 1998--2006 Han-Wen Nienhuys */ -#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" diff --git a/lily/new-lyric-combine-music-iterator.cc b/lily/new-lyric-combine-music-iterator.cc index 0603ea7ea5..0adccba96d 100644 --- a/lily/new-lyric-combine-music-iterator.cc +++ b/lily/new-lyric-combine-music-iterator.cc @@ -7,10 +7,11 @@ */ #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 { @@ -182,7 +183,7 @@ Lyric_combine_music_iterator::find_voice () 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) @@ -236,7 +237,7 @@ Lyric_combine_music_iterator::do_quit () { 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); diff --git a/lily/note-collision.cc b/lily/note-collision.cc index cdd5bf7423..99be0410dd 100644 --- a/lily/note-collision.cc +++ b/lily/note-collision.cc @@ -8,18 +8,17 @@ #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 diff --git a/lily/note-column.cc b/lily/note-column.cc index 2b84370faa..8d4204b674 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -11,16 +11,17 @@ #include // 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 diff --git a/lily/note-head.cc b/lily/note-head.cc index b1cbf0d7ca..5a0c9abf84 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -14,28 +14,29 @@ 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"); @@ -45,12 +46,12 @@ internal_print (Grob *me, String *font_char) 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; @@ -93,7 +94,7 @@ Note_head::print (SCM smob) { Grob *me = unsmob_grob (smob); - String idx; + std::string idx; return internal_print (me, &idx).smobbed_copy (); } @@ -112,7 +113,7 @@ Note_head::calc_stem_attachment (SCM smob) { 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; diff --git a/lily/note-name-engraver.cc b/lily/note-name-engraver.cc index 8946a43a82..b464eeefcf 100644 --- a/lily/note-name-engraver.cc +++ b/lily/note-name-engraver.cc @@ -35,7 +35,7 @@ Note_name_engraver::try_music (Music *m) void Note_name_engraver::process_music () { - String s; + std::string s; for (int i = 0; i < events_.size (); i++) { if (i) diff --git a/lily/open-type-font-scheme.cc b/lily/open-type-font-scheme.cc index 5eb45a76a8..b2692d994b 100644 --- a/lily/open-type-font-scheme.cc +++ b/lily/open-type-font-scheme.cc @@ -51,12 +51,12 @@ LY_DEFINE (ly_otf_font_table_data, "ly:otf-font-table-data", 2, 0, 0, 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, diff --git a/lily/open-type-font.cc b/lily/open-type-font.cc index 7f165ce8fc..1a9623cdf0 100644 --- a/lily/open-type-font.cc +++ b/lily/open-type-font.cc @@ -15,6 +15,7 @@ using namespace std; #include #include "dimensions.hh" +#include "international.hh" #include "modified-font-metric.hh" #include "warn.hh" @@ -43,8 +44,8 @@ load_table (char const *tag_str, FT_Face face, FT_ULong *length) 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); } @@ -58,7 +59,7 @@ load_scheme_table (char const *tag_str, FT_Face face) 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 ()); @@ -88,17 +89,17 @@ Open_type_font::~Open_type_font () /* 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); @@ -112,7 +113,7 @@ open_ft_face (String str) } 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); @@ -146,7 +147,7 @@ Open_type_font::derived_mark () const } 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); @@ -222,7 +223,7 @@ Open_type_font::get_indexed_char (int signed_idx) const } 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)) @@ -282,7 +283,7 @@ Open_type_font::get_global_table () const return lily_global_table_; } -String +std::string Open_type_font::font_name () const { return FT_Get_Postscript_Name (face_); diff --git a/lily/output-def.cc b/lily/output-def.cc index eda08dd7b4..99015153f9 100644 --- a/lily/output-def.cc +++ b/lily/output-def.cc @@ -127,7 +127,7 @@ Output_def::lookup_variable (SCM sym) const } SCM -Output_def::c_variable (String s) const +Output_def::c_variable (std::string s) const { return lookup_variable (ly_symbol2scm (s.c_str ())); } diff --git a/lily/output-property-music-iterator.cc b/lily/output-property-music-iterator.cc index feffeedd2f..a08b88413c 100644 --- a/lily/output-property-music-iterator.cc +++ b/lily/output-property-music-iterator.cc @@ -6,8 +6,10 @@ (c) 2000--2006 Jan Nieuwenhuizen */ -#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 diff --git a/lily/pango-font.cc b/lily/pango-font.cc index e97c914b24..da0f1022d2 100644 --- a/lily/pango-font.cc +++ b/lily/pango-font.cc @@ -14,8 +14,10 @@ #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 @@ -60,7 +62,7 @@ Pango_font::~Pango_font () } 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 ()), @@ -74,7 +76,7 @@ Pango_font::derived_mark () const } 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]; @@ -142,7 +144,7 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, String str) const 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. */ @@ -154,28 +156,29 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, String str) const 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) @@ -206,7 +209,7 @@ Pango_font::physical_font_tab () const } Stencil -Pango_font::text_stencil (String str) const +Pango_font::text_stencil (std::string str) const { GList *items = pango_itemize (context_, diff --git a/lily/pango-select.cc b/lily/pango-select.cc index 8f7eb462a3..6f832e7621 100644 --- a/lily/pango-select.cc +++ b/lily/pango-select.cc @@ -19,7 +19,7 @@ properties_to_pango_description (SCM chain, Real text_size) 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 @@ -133,7 +133,7 @@ symbols_to_pango_font_description (SCM family, { 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)) diff --git a/lily/paper-book.cc b/lily/paper-book.cc index 48b0fe34f7..bf12566460 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -104,7 +104,7 @@ Paper_book::output (SCM output_channel) 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) @@ -144,8 +144,8 @@ Paper_book::classic_output (SCM output) 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"); diff --git a/lily/paper-column.cc b/lily/paper-column.cc index 188b24f12b..9993b029ed 100644 --- a/lily/paper-column.cc +++ b/lily/paper-column.cc @@ -113,10 +113,10 @@ Paper_column::print (SCM p) { 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); diff --git a/lily/paper-outputter-scheme.cc b/lily/paper-outputter-scheme.cc index 2bfdde5bc4..e05f6cc8ac 100644 --- a/lily/paper-outputter-scheme.cc +++ b/lily/paper-outputter-scheme.cc @@ -7,8 +7,10 @@ */ #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), @@ -20,9 +22,9 @@ LY_DEFINE (ly_make_paper_outputter, "ly:make-paper-outputter", 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 = ""; + std::string output_name = ""; SCM port_name = scm_port_filename (port); if (scm_is_string (port_name)) diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index bbefe954f9..aff76981f7 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -29,13 +29,13 @@ using namespace std; #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 ()); } diff --git a/lily/paper-score.cc b/lily/paper-score.cc index 9e93234909..4247732273 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -7,9 +7,11 @@ */ #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" diff --git a/lily/parse-scm.cc b/lily/parse-scm.cc index 4aee394290..75f161540d 100644 --- a/lily/parse-scm.cc +++ b/lily/parse-scm.cc @@ -11,6 +11,7 @@ #include using namespace std; +#include "international.hh" #include "main.hh" #include "paper-book.hh" #include "source-file.hh" diff --git a/lily/parser.yy b/lily/parser.yy index dcba6806ce..0f6e2c120f 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -74,24 +74,25 @@ using namespace std; #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" %} @@ -100,7 +101,7 @@ using namespace std; Book *book; Output_def *outputdef; SCM scm; - String *string; + std::string *string; Music *music; Score *score; int i; @@ -2742,7 +2743,7 @@ run_music_function (Lily_parser *parser, SCM expr) 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; diff --git a/lily/part-combine-iterator.cc b/lily/part-combine-iterator.cc index 9d2a520f7c..c2625f28c1 100644 --- a/lily/part-combine-iterator.cc +++ b/lily/part-combine-iterator.cc @@ -410,8 +410,8 @@ Part_combine_iterator::process (Moment m) 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); } } diff --git a/lily/percent-repeat-engraver.cc b/lily/percent-repeat-engraver.cc index 8b7d0d7060..0f5ef279c3 100644 --- a/lily/percent-repeat-engraver.cc +++ b/lily/percent-repeat-engraver.cc @@ -9,15 +9,16 @@ #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" diff --git a/lily/percent-repeat-iterator.cc b/lily/percent-repeat-iterator.cc index fb14f2abdd..79fd496daa 100644 --- a/lily/percent-repeat-iterator.cc +++ b/lily/percent-repeat-iterator.cc @@ -8,8 +8,9 @@ #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); diff --git a/lily/performance.cc b/lily/performance.cc index a70f7aff99..695bb399f7 100644 --- a/lily/performance.cc +++ b/lily/performance.cc @@ -14,6 +14,7 @@ using namespace std; #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" @@ -88,8 +89,8 @@ Performance::output_header_track (Midi_stream &midi_stream) 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; @@ -112,7 +113,7 @@ Performance::output_header_track (Midi_stream &midi_stream) 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); @@ -149,7 +150,7 @@ Performance::add_element (Audio_element *p) } void -Performance::write_output (String out) +Performance::write_output (std::string out) { if (out == "-") out = "lelie.midi"; diff --git a/lily/pfb.cc b/lily/pfb.cc index fc20dfd5cd..b27fe906c5 100644 --- a/lily/pfb.cc +++ b/lily/pfb.cc @@ -77,7 +77,7 @@ LY_DEFINE (ly_pfb_to_pfa, "ly:pfb->pfa", 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) @@ -103,14 +103,14 @@ LY_DEFINE (ly_otf_to_cff, "ly:otf->cff", 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) diff --git a/lily/phrasing-slur-engraver.cc b/lily/phrasing-slur-engraver.cc index 7276302f57..4194be280f 100644 --- a/lily/phrasing-slur-engraver.cc +++ b/lily/phrasing-slur-engraver.cc @@ -6,11 +6,13 @@ (c) 1997--2006 Han-Wen Nienhuys */ +#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" diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index 5ca0d358c4..716f5a4742 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -10,13 +10,15 @@ */ #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" /* @@ -150,7 +152,7 @@ Piano_pedal_engraver::try_music (Music *m) { 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 ()))) { @@ -172,7 +174,7 @@ Piano_pedal_engraver::process_music () { 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 ()); } @@ -190,7 +192,7 @@ Piano_pedal_engraver::process_music () 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"); @@ -211,14 +213,14 @@ void 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); @@ -269,7 +271,7 @@ Piano_pedal_engraver::create_text_grobs (Pedal_info *p, bool mixed) 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] @@ -291,7 +293,7 @@ Piano_pedal_engraver::create_bracket_grobs (Pedal_info *p, bool mixed) { 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; } diff --git a/lily/piano-pedal-performer.cc b/lily/piano-pedal-performer.cc index e19feb9e42..0edfcfb997 100644 --- a/lily/piano-pedal-performer.cc +++ b/lily/piano-pedal-performer.cc @@ -7,7 +7,9 @@ */ #include "performer.hh" + #include "audio-item.hh" +#include "international.hh" #include "music.hh" /** @@ -77,11 +79,11 @@ Piano_pedal_performer::process_music () 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]); @@ -94,7 +96,7 @@ Piano_pedal_performer::process_music () { 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]); @@ -130,7 +132,7 @@ Piano_pedal_performer::try_music (Music *r) { 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 ()))) { diff --git a/lily/pitch.cc b/lily/pitch.cc index 6f5ea965ee..076615391c 100644 --- a/lily/pitch.cc +++ b/lily/pitch.cc @@ -7,8 +7,10 @@ */ #include "pitch.hh" -#include "warn.hh" + #include "main.hh" +#include "string-convert.hh" +#include "warn.hh" #include "ly-smobs.icc" @@ -164,13 +166,13 @@ pitch_interval (Pitch const &from, Pitch const &to) 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) { @@ -182,7 +184,7 @@ Pitch::to_string () const { int o = (-octave_) - 1; while (o--) - s += ::to_string (','); + s += std::to_string (','); } return s; diff --git a/lily/prob.cc b/lily/prob.cc index 66829f3b2e..c3c95bb760 100644 --- a/lily/prob.cc +++ b/lily/prob.cc @@ -118,7 +118,7 @@ Prob::get_property_alist (bool m) const return (m) ? mutable_property_alist_ : immutable_property_alist_; } -String +std::string Prob::name () const { SCM nm = get_property ("name"); diff --git a/lily/program-option.cc b/lily/program-option.cc index 00e0fc9980..894f9d0db9 100644 --- a/lily/program-option.cc +++ b/lily/program-option.cc @@ -12,10 +12,11 @@ #include 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; @@ -79,26 +80,26 @@ void internal_set_option (SCM var, SCM val) } } -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 opts; + Array 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) + " (" @@ -115,27 +116,28 @@ get_help_string () 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); @@ -174,10 +176,10 @@ LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val), 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)); } diff --git a/lily/property-iterator.cc b/lily/property-iterator.cc index 4f379b4b83..a4c993b756 100644 --- a/lily/property-iterator.cc +++ b/lily/property-iterator.cc @@ -8,9 +8,10 @@ #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); diff --git a/lily/quote-iterator.cc b/lily/quote-iterator.cc index e755d50fa5..aa06734e00 100644 --- a/lily/quote-iterator.cc +++ b/lily/quote-iterator.cc @@ -6,13 +6,15 @@ (c) 2004--2006 Han-Wen Nienhuys */ +#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 { diff --git a/lily/relative-octave-check.cc b/lily/relative-octave-check.cc index 9fe109b084..07d70acc45 100644 --- a/lily/relative-octave-check.cc +++ b/lily/relative-octave-check.cc @@ -6,8 +6,9 @@ (c) 2005--2006 Han-Wen Nienhuys */ -#include "music.hh" #include "input.hh" +#include "international.hh" +#include "music.hh" #include "pitch.hh" class Relative_octave_check @@ -35,7 +36,7 @@ Relative_octave_check::relative_callback (SCM music, SCM last_pitch) 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); diff --git a/lily/relocate.cc b/lily/relocate.cc index d511d21be1..39ecf8670b 100644 --- a/lily/relocate.cc +++ b/lily/relocate.cc @@ -20,6 +20,7 @@ #include "file-name.hh" #include "file-path.hh" +#include "international.hh" #include "lily-guile.hh" #include "lily-version.hh" #include "main.hh" @@ -28,11 +29,11 @@ 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); } @@ -41,7 +42,7 @@ sane_putenv (char const *key, String value, bool overwrite) } 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); @@ -51,7 +52,7 @@ set_env_file (char const *key, String value, bool overwrite = false) } 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); @@ -61,7 +62,7 @@ set_env_dir (char const *key, String value) } static int -prepend_env_path (char const *key, String value) +prepend_env_path (char const *key, std::string value) { if (is_dir (value)) { @@ -78,15 +79,15 @@ prepend_env_path (char const *key, String 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; } @@ -95,17 +96,17 @@ dir_name (String const file_name) #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; @@ -119,15 +120,15 @@ prefix_relocation (String prefix) } 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); @@ -160,13 +161,13 @@ framework_relocation (String prefix) 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 @@ -178,18 +179,18 @@ setup_paths (char const *argv0_ptr) 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 (); @@ -199,7 +200,7 @@ setup_paths (char const *argv0_ptr) 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)); } @@ -224,12 +225,12 @@ setup_paths (char const *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); } @@ -258,7 +259,7 @@ setup_paths (char const *argv0_ptr) */ 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; @@ -268,10 +269,10 @@ setup_paths (char const *argv0_ptr) char *suffixes[] = {"ly", "ps", "scm", 0 }; - Array dirs; + Array 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); } diff --git a/lily/repeat-acknowledge-engraver.cc b/lily/repeat-acknowledge-engraver.cc index 6de07648c1..f752d5447d 100644 --- a/lily/repeat-acknowledge-engraver.cc +++ b/lily/repeat-acknowledge-engraver.cc @@ -66,7 +66,7 @@ Repeat_acknowledge_engraver::process_music () SCM cs = get_property ("repeatCommands"); - String s = ""; + std::string s = ""; bool start = false; bool end = false; bool volta_found = false; diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index ee1e8868e9..1bd6f7924e 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -11,16 +11,17 @@ #include // 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 diff --git a/lily/rest.cc b/lily/rest.cc index bc81554df3..181626ef3a 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -8,13 +8,14 @@ #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); @@ -56,8 +57,8 @@ Rest::y_offset_callback (SCM smob) /* 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)) @@ -74,7 +75,7 @@ Rest::glyph_name (Grob *me, int balltype, String style, bool try_ledgers) 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")) { @@ -127,13 +128,13 @@ Rest::brew_internal_stencil (Grob *me, bool ledgered) 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 ())); diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 94d269df9f..b582326786 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -6,19 +6,21 @@ (c) 1997--2006 Han-Wen Nienhuys */ -#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 () { diff --git a/lily/score.cc b/lily/score.cc index 505a1fee5e..1545debcfb 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -15,15 +15,16 @@ using namespace std; #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" diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index eb1ce89537..44d9de4cac 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -6,15 +6,17 @@ (c) 1997--2006 Han-Wen Nienhuys */ +#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" diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 6acdc3977c..a035ca45a0 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -106,7 +106,7 @@ Side_position_interface::general_side_position (Grob *me, Axis a, bool use_exten /* 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); diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index a9c70489dd..6b359f38c0 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -11,14 +11,15 @@ #include +#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: diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc index 2481ea41ac..1b8f6d153b 100644 --- a/lily/slur-engraver.cc +++ b/lily/slur-engraver.cc @@ -6,11 +6,13 @@ (c) 1997--2006 Han-Wen Nienhuys */ -#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" diff --git a/lily/slur.cc b/lily/slur.cc index bda0ff9ebf..d40104b1ad 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -108,7 +108,7 @@ Slur::print (SCM smob) ->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 diff --git a/lily/source-file.cc b/lily/source-file.cc index 334d10d40f..c350248065 100644 --- a/lily/source-file.cc +++ b/lily/source-file.cc @@ -27,8 +27,9 @@ #endif using namespace std; -#include "warn.hh" #include "file-name-map.hh" +#include "international.hh" +#include "warn.hh" void Source_file::load_stdin () @@ -46,7 +47,7 @@ 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. */ @@ -78,12 +79,12 @@ gulp_file (String filename, int *filesize) 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 (); @@ -92,7 +93,7 @@ Source_file::Source_file (String filename, String data) 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; @@ -120,7 +121,7 @@ Source_file::init_port () { 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 @@ -146,7 +147,7 @@ Source_file::get_istream () return istream_; } -String +std::string Source_file::file_line_column_string (char const *context_str0) const { if (!c_str ()) @@ -161,7 +162,7 @@ Source_file::file_line_column_string (char const *context_str0) const } } -String +std::string Source_file::quote_input (char const *pos_str0) const { if (!contains (pos_str0)) @@ -169,15 +170,15 @@ Source_file::quote_input (char const *pos_str0) const 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_); @@ -220,7 +221,7 @@ Source_file::line_slice (char const *pos_str0) const 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)) @@ -228,7 +229,7 @@ Source_file::line_string (char const *pos_str0) const 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 @@ -248,10 +249,10 @@ Source_file::get_counts (char const *pos_str0, 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; @@ -380,10 +381,10 @@ Source_file::forward_str0 (int n) 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; } diff --git a/lily/source.cc b/lily/source.cc index 6c5a47691c..775668e08d 100644 --- a/lily/source.cc +++ b/lily/source.cc @@ -40,11 +40,11 @@ Sources::set_path (File_path *f) @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; diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index d6a546e124..ec4907be63 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -6,24 +6,25 @@ (c) 1999--2006 Han-Wen Nienhuys */ -#include +#include "spacing-spanner.hh" +#include #include 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" /* diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 9a3a5c1e15..2149f2ddfc 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -53,7 +53,7 @@ Span_bar::print (SCM smobbed_me) 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 extents; @@ -116,7 +116,7 @@ Span_bar::width (SCM smob) if (!me->is_live ()) return ly_interval2scm (Interval ()); - String gl = ly_scm2string (gn); + std::string gl = ly_scm2string (gn); /* urg. @@ -177,7 +177,7 @@ Span_bar::calc_glyph_name (SCM smob) return SCM_UNSPECIFIED; } - String type = ly_scm2string (gl); + std::string type = ly_scm2string (gl); if (type == "|:") type = ".|"; else if (type == ":|") diff --git a/lily/span-dynamic-performer.cc b/lily/span-dynamic-performer.cc index 7a46b839ab..03ed5f1f40 100644 --- a/lily/span-dynamic-performer.cc +++ b/lily/span-dynamic-performer.cc @@ -7,7 +7,9 @@ */ #include "performer.hh" + #include "audio-item.hh" +#include "international.hh" #include "music.hh" /* diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index 77770cab3c..4d2d53beb0 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -22,8 +22,8 @@ public: 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); @@ -77,7 +77,7 @@ Staff_performer::initialize () 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); @@ -124,7 +124,7 @@ Staff_performer::finalize () audio_staff_ = 0; } -String +std::string Staff_performer::new_instrument_string () { // mustn't ask Score for instrument: it will return piano! diff --git a/lily/staff-spacing.cc b/lily/staff-spacing.cc index a4cf1d368a..994d642c0a 100644 --- a/lily/staff-spacing.cc +++ b/lily/staff-spacing.cc @@ -102,8 +102,9 @@ Staff_spacing::bar_y_positions (Grob *bar_grob) 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); diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index 41a1107d9d..b14bdbae64 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -6,9 +6,12 @@ (c) 1997--2006 Han-Wen Nienhuys */ +#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" @@ -16,7 +19,6 @@ #include "staff-symbol-referencer.hh" #include "stem-tremolo.hh" #include "stem.hh" -#include "duration.hh" /** Make stems upon receiving noteheads. diff --git a/lily/stem.cc b/lily/stem.cc index 6829af1a35..e572acb652 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -18,22 +18,23 @@ #include // 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) @@ -547,7 +548,7 @@ Stem::flag (Grob *me) 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)) @@ -558,8 +559,8 @@ Stem::flag (Grob *me) 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, @@ -581,7 +582,7 @@ Stem::flag (Grob *me) 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); @@ -591,10 +592,10 @@ Stem::flag (Grob *me) 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)); diff --git a/lily/sustain-pedal.cc b/lily/sustain-pedal.cc index fe7d121e38..b1d87e79a3 100644 --- a/lily/sustain-pedal.cc +++ b/lily/sustain-pedal.cc @@ -44,18 +44,18 @@ Sustain_pedal::print (SCM smob) 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); diff --git a/lily/system.cc b/lily/system.cc index 147d85c863..4da50a8292 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -8,22 +8,22 @@ #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) diff --git a/lily/template5.cc b/lily/template5.cc index d2581833b6..6ecd872feb 100644 --- a/lily/template5.cc +++ b/lily/template5.cc @@ -20,7 +20,7 @@ Interval_t::infinity () } template<> -Std_string +std::string Interval_t::T_to_string (Rational a) { return a.to_string (); diff --git a/lily/text-interface.cc b/lily/text-interface.cc index c21975bb8f..d95ed7a63a 100644 --- a/lily/text-interface.cc +++ b/lily/text-interface.cc @@ -32,7 +32,7 @@ Text_interface::interpret_string (SCM layout_smob, 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 (); diff --git a/lily/text-metrics.cc b/lily/text-metrics.cc index 89dbfbd1cb..dbeafffef6 100644 --- a/lily/text-metrics.cc +++ b/lily/text-metrics.cc @@ -19,7 +19,7 @@ lookup_tex_text_dimension (Font_metric *font, SCM text) 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; @@ -70,12 +70,12 @@ LY_DEFINE (ly_load_text_dimensions, "ly:load-text-dimensions", } 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 ()); diff --git a/lily/text-spanner-engraver.cc b/lily/text-spanner-engraver.cc index baee8ee508..d5212ded7f 100644 --- a/lily/text-spanner-engraver.cc +++ b/lily/text-spanner-engraver.cc @@ -6,9 +6,11 @@ (c) 2000--2006 Jan Nieuwenhuizen */ +#include "engraver.hh" + +#include "international.hh" #include "note-column.hh" #include "side-position-interface.hh" -#include "engraver.hh" class Text_spanner_engraver : public Engraver { diff --git a/lily/tfm-reader.cc b/lily/tfm-reader.cc index bd45cecc7e..a14a929d3c 100644 --- a/lily/tfm-reader.cc +++ b/lily/tfm-reader.cc @@ -11,6 +11,7 @@ #include "tfm-reader.hh" +#include "international.hh" #include "string-convert.hh" #include "warn.hh" @@ -19,7 +20,7 @@ (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) { @@ -54,11 +55,11 @@ Tex_font_metric_reader::get_U32_fix_scaled () 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; } diff --git a/lily/tfm.cc b/lily/tfm.cc index 9a8d7ee08a..82a4fee1ee 100644 --- a/lily/tfm.cc +++ b/lily/tfm.cc @@ -8,12 +8,14 @@ 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; @@ -89,7 +91,7 @@ Tex_font_metric::get_ascii_char (int a) const } 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); @@ -116,14 +118,14 @@ Tex_font_metric::design_size () const 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; diff --git a/lily/tie-engraver.cc b/lily/tie-engraver.cc index f5ee147e21..6382222676 100644 --- a/lily/tie-engraver.cc +++ b/lily/tie-engraver.cc @@ -6,17 +6,19 @@ (c) 1998--2006 Han-Wen Nienhuys */ -#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 diff --git a/lily/time-scaled-music-iterator.cc b/lily/time-scaled-music-iterator.cc index 309d45f1ff..e1385ce2cc 100644 --- a/lily/time-scaled-music-iterator.cc +++ b/lily/time-scaled-music-iterator.cc @@ -7,8 +7,10 @@ */ #include "time-scaled-music-iterator.hh" + #include "context.hh" #include "input.hh" +#include "international.hh" void Time_scaled_music_iterator::process (Moment m) diff --git a/lily/time-signature-engraver.cc b/lily/time-signature-engraver.cc index c90ee4b331..df4a4114c7 100644 --- a/lily/time-signature-engraver.cc +++ b/lily/time-signature-engraver.cc @@ -6,10 +6,12 @@ (c) 1997--2006 Han-Wen Nienhuys */ -#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. diff --git a/lily/time-signature.cc b/lily/time-signature.cc index acc057e671..66b788a181 100644 --- a/lily/time-signature.cc +++ b/lily/time-signature.cc @@ -8,11 +8,12 @@ #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: @@ -53,7 +54,7 @@ Time_signature::print (SCM smob) 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); @@ -69,7 +70,7 @@ Time_signature::special_time_signature (Grob *me, SCM scm_style, int n, int 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); diff --git a/lily/translator-ctors.cc b/lily/translator-ctors.cc index 65bfa015fe..1fe410f25d 100644 --- a/lily/translator-ctors.cc +++ b/lily/translator-ctors.cc @@ -7,6 +7,8 @@ */ #include "translator.hh" + +#include "international.hh" #include "scm-hash.hh" #include "warn.hh" diff --git a/lily/translator.cc b/lily/translator.cc index 56d49add46..d55fe15729 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -164,9 +164,9 @@ add_acknowledger (Engraver_void_function_engraver_grob_info ptr, 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 ())); diff --git a/lily/trill-spanner-engraver.cc b/lily/trill-spanner-engraver.cc index a2cccde61a..2b72316660 100644 --- a/lily/trill-spanner-engraver.cc +++ b/lily/trill-spanner-engraver.cc @@ -13,9 +13,11 @@ 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" diff --git a/lily/ttf.cc b/lily/ttf.cc index 9cbfd730fc..a457ac4cc6 100644 --- a/lily/ttf.cc +++ b/lily/ttf.cc @@ -86,7 +86,7 @@ print_header (void *out, FT_Face face) #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"); @@ -152,7 +152,7 @@ print_trailer (void *out, } static void -create_type42_font (void *out, String name) +create_type42_font (void *out, std::string name) { FT_Face face = open_ft_face (name); @@ -170,7 +170,7 @@ LY_DEFINE (ly_ttf_ps_name, "ly:ttf-ps-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); @@ -196,7 +196,7 @@ LY_DEFINE (ly_ttf_to_pfa, "ly:ttf->pfa", 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); diff --git a/lily/vaticana-ligature-engraver.cc b/lily/vaticana-ligature-engraver.cc index 31005fac31..bb535d3442 100644 --- a/lily/vaticana-ligature-engraver.cc +++ b/lily/vaticana-ligature-engraver.cc @@ -7,14 +7,16 @@ */ #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" @@ -198,7 +200,7 @@ Vaticana_ligature_engraver::align_heads (Array primitives, "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 */ @@ -236,8 +238,7 @@ Vaticana_ligature_engraver::align_heads (Array primitives, - 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. @@ -290,7 +291,7 @@ Vaticana_ligature_engraver::align_heads (Array primitives, 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 @@ -342,7 +343,7 @@ check_for_prefix_loss (Item *primitive) = 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 ())); @@ -361,7 +362,7 @@ Vaticana_ligature_engraver::transform_heads (Spanner *ligature, 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 (primitives[i].grob ()); @@ -396,7 +397,7 @@ Vaticana_ligature_engraver::transform_heads (Spanner *ligature, * 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"; @@ -504,7 +505,7 @@ Vaticana_ligature_engraver::transform_heads (Spanner *ligature, * 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)); /* @@ -543,7 +544,7 @@ Vaticana_ligature_engraver::transform_heads (Spanner *ligature, { 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 diff --git a/lily/vaticana-ligature.cc b/lily/vaticana-ligature.cc index 1fdf2b5430..87c983dcb3 100644 --- a/lily/vaticana-ligature.cc +++ b/lily/vaticana-ligature.cc @@ -8,14 +8,14 @@ #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 @@ -197,7 +197,7 @@ vaticana_brew_primitive (Grob *me) 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); @@ -223,7 +223,7 @@ vaticana_brew_primitive (Grob *me) 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 @@ -237,7 +237,7 @@ vaticana_brew_primitive (Grob *me) 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 { diff --git a/lily/vertical-align-engraver.cc b/lily/vertical-align-engraver.cc index ad316bd5e2..890490069c 100644 --- a/lily/vertical-align-engraver.cc +++ b/lily/vertical-align-engraver.cc @@ -98,7 +98,7 @@ Vertical_align_engraver::acknowledge_axis_group (Grob_info i) { 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 ()); diff --git a/lily/volta-bracket.cc b/lily/volta-bracket.cc index f314d807a2..595ed9b192 100644 --- a/lily/volta-bracket.cc +++ b/lily/volta-bracket.cc @@ -119,7 +119,7 @@ Volta_bracket_interface::after_line_breaking (SCM smob) 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 diff --git a/lily/volta-engraver.cc b/lily/volta-engraver.cc index 4a6c555d96..1f64defa4a 100644 --- a/lily/volta-engraver.cc +++ b/lily/volta-engraver.cc @@ -7,14 +7,16 @@ */ #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" diff --git a/lily/volta-repeat-iterator.cc b/lily/volta-repeat-iterator.cc index d739949394..8ff30631ea 100644 --- a/lily/volta-repeat-iterator.cc +++ b/lily/volta-repeat-iterator.cc @@ -84,7 +84,7 @@ Volta_repeat_iterator::next_element (bool side_effect) { 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)); -- 2.39.2