From 8a719f6eec1bd84269a55d1ec99adb3f17c04e64 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 24 Jan 2006 01:42:15 +0000 Subject: [PATCH] * buildscripts/analyse-cxx-log.py: new file. Read compile log to substitute appropriate functions. * flower/include/string.hh (class String): remove to_str0 and is_empty(). S&R everywhere. --- ChangeLog | 15 ++++++-- buildscripts/analyse-cxx-log.py | 42 ++++++++++++++++++++++ flower/include/file-storage.hh | 2 +- flower/include/string-data.hh | 2 +- flower/include/string-data.icc | 2 +- flower/include/string-handle.hh | 2 +- flower/include/string-handle.icc | 2 +- flower/include/string.hh | 10 ++---- flower/include/string.icc | 4 +-- flower/string-convert.cc | 6 ++-- flower/string.cc | 23 ++++++------ flower/warn.cc | 6 ++-- lily/accidental-engraver.cc | 6 ++-- lily/all-font-metrics.cc | 24 ++++++------- lily/beam-quanting.cc | 2 +- lily/binary-source-file.cc | 6 ++-- lily/break-align-interface.cc | 4 +-- lily/clef.cc | 4 +-- lily/cluster.cc | 2 +- lily/context-def.cc | 2 +- lily/context-scheme.cc | 4 +-- lily/context.cc | 10 +++--- lily/duration.cc | 2 +- lily/dynamic-engraver.cc | 8 ++--- lily/font-config-scheme.cc | 2 +- lily/font-config.cc | 6 ++-- lily/font-metric-scheme.cc | 2 +- lily/font-metric.cc | 4 +-- lily/function-documentation.cc | 2 +- lily/general-scheme.cc | 10 +++--- lily/gregorian-ligature.cc | 2 +- lily/grob-interface.cc | 6 ++-- lily/grob-smob.cc | 2 +- lily/hairpin.cc | 1 - lily/includable-lexer.cc | 4 +-- lily/include/source-file.hh | 2 +- lily/input-scheme.cc | 4 +-- lily/input-smob.cc | 2 +- lily/lexer.ll | 28 +++++++-------- lily/lily-guile.cc | 10 +++--- lily/lily-lexer.cc | 8 ++--- lily/lily-parser-scheme.cc | 16 ++++----- lily/lily-parser.cc | 4 +-- lily/lilypond-key.cc | 8 ++--- lily/main.cc | 8 ++--- lily/midi-item.cc | 4 +-- lily/midi-stream.cc | 2 +- lily/modified-font-metric.cc | 2 +- lily/moment.cc | 2 +- lily/music-function.cc | 2 +- lily/new-lyric-combine-music-iterator.cc | 2 +- lily/note-head.cc | 2 +- lily/note-name-engraver.cc | 2 +- lily/open-type-font-scheme.cc | 2 +- lily/open-type-font.cc | 14 ++++---- lily/output-def.cc | 2 +- lily/pango-font.cc | 12 +++---- lily/pango-select.cc | 4 +-- lily/paper-book.cc | 6 ++-- lily/paper-column.cc | 4 +-- lily/paper-outputter-scheme.cc | 2 +- lily/paper-outputter.cc | 2 +- lily/paper-system.cc | 2 -- lily/parse-scm.cc | 2 +- lily/parser.yy | 2 +- lily/piano-pedal-engraver.cc | 10 +++--- lily/piano-pedal-performer.cc | 2 +- lily/pitch.cc | 2 +- lily/program-option.cc | 6 ++-- lily/relocate.cc | 14 ++++---- lily/repeat-acknowledge-engraver.cc | 2 +- lily/rest.cc | 4 +-- lily/side-position-interface.cc | 2 +- lily/simultaneous-music-iterator.cc | 2 +- lily/slur-scoring.cc | 2 +- lily/source-file.cc | 26 +++++++------- lily/span-bar.cc | 2 +- lily/spanner.cc | 4 +-- lily/staff-performer.cc | 2 +- lily/stem.cc | 2 +- lily/system-start-delimiter-engraver.cc | 2 +- lily/text-metrics.cc | 4 +-- lily/tfm-reader.cc | 4 +-- lily/time-signature.cc | 4 +-- lily/translator-ctors.cc | 2 +- lily/translator.cc | 2 +- lily/ttf.cc | 2 +- lily/vaticana-ligature-engraver.cc | 6 ++-- lily/vertical-align-engraver.cc | 2 +- lily/vertically-spaced-context-engraver.cc | 2 +- lily/volta-repeat-iterator.cc | 2 +- 91 files changed, 275 insertions(+), 232 deletions(-) create mode 100644 buildscripts/analyse-cxx-log.py diff --git a/ChangeLog b/ChangeLog index dff1db7b94..8568c031df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-01-24 Han-Wen Nienhuys + + * buildscripts/analyse-cxx-log.py: new file. Read compile log to + substitute appropriate functions. + + * flower/include/string.hh (class String): remove to_str0 and + is_empty(). S&R everywhere. + 2006-01-23 Graham Percival * Documentation/user/basic-notation.itely: add hairpin @@ -53,10 +61,11 @@ 2006-01-22 Nicolas Sceaux - * ly/music-functions-init.ly (parallelMusic): new music function for parallel - music entry. + * ly/music-functions-init.ly (parallelMusic): new music function + for parallel music entry. - * scm/define-music-properties.scm (all-music-properties): new 'void music property + * scm/define-music-properties.scm (all-music-properties): new + 'void music property * scm/music-functions.scm (ly:music-message): make public, to be used in music function definitions diff --git a/buildscripts/analyse-cxx-log.py b/buildscripts/analyse-cxx-log.py new file mode 100644 index 0000000000..e0872f011e --- /dev/null +++ b/buildscripts/analyse-cxx-log.py @@ -0,0 +1,42 @@ +#!/usr/bin/python +import sys +import os +import re +import string + +if len (sys.argv) < 5: + print 'args: LOGFILE CLASS FUNC NEW_FUNC' + +func = sys.argv[3] +new_func = sys.argv[4] +klazz = sys.argv[2] +log_ls = open (sys.argv[1]).readlines () +regex = re.compile ("([^:]+):([0-9]+): error: .class ([_a-zA-Z]+). has no member named .%s." % func) + +files = {} + +for l in log_ls: + m = regex.search (l) + if not m: + continue + print l + + file = m.group (1) + line_no = string.atoi (m.group (2)) + klass = m.group (3) + + if klass <> klazz: + continue + + if not files.has_key (file): + files[file] = open (file).read ().split ('\n') + + line_no -= 1 + files[file][line_no] = re.sub (func, new_func, files[file][line_no]) + + +for (f,ls) in files.items(): + print 'writing ', f + os.rename (f, f + '~') + open (f, 'w').write ('\n'.join (ls)) + diff --git a/flower/include/file-storage.hh b/flower/include/file-storage.hh index 80a832ab95..f13cc47173 100644 --- a/flower/include/file-storage.hh +++ b/flower/include/file-storage.hh @@ -17,7 +17,7 @@ class File_storage { public: - virtual char const *to_str0 () const = 0; + virtual char const *c_str () const = 0; virtual int length () const = 0; virtual ~File_storage (){} }; diff --git a/flower/include/string-data.hh b/flower/include/string-data.hh index da528ef77b..43d145af6c 100644 --- a/flower/include/string-data.hh +++ b/flower/include/string-data.hh @@ -64,7 +64,7 @@ class String_data void operator += (char const *str0); - char const *to_str0 () const; + char const *c_str () const; char *get_str0 (); diff --git a/flower/include/string-data.icc b/flower/include/string-data.icc index fd603d532f..3e6e0d546d 100644 --- a/flower/include/string-data.icc +++ b/flower/include/string-data.icc @@ -152,7 +152,7 @@ String_data::operator += (char const *str0) INLINE char const * -String_data::to_str0 () const +String_data::c_str () const { return (char const *)data_byte_; } diff --git a/flower/include/string-handle.hh b/flower/include/string-handle.hh index ac951e756f..7527a2de50 100644 --- a/flower/include/string-handle.hh +++ b/flower/include/string-handle.hh @@ -37,7 +37,7 @@ public: String_handle (String_handle const &src); Byte const *to_bytes () const; - char const *to_str0 () const; + char const *c_str () const; Byte *get_bytes (); char *get_str0 (); bool is_binary_bo () const; diff --git a/flower/include/string-handle.icc b/flower/include/string-handle.icc index d560c1cfc2..10314f441c 100644 --- a/flower/include/string-handle.icc +++ b/flower/include/string-handle.icc @@ -87,7 +87,7 @@ const *String_handle::to_bytes () const } INLINE char const * -String_handle::to_str0 () const +String_handle::c_str () const { return (char const *)data->to_bytes (); } diff --git a/flower/include/string.hh b/flower/include/string.hh index af4ea7932f..93f83f234f 100644 --- a/flower/include/string.hh +++ b/flower/include/string.hh @@ -95,7 +95,6 @@ public: Byte *get_copy_byte () const; char *get_copy_str0 () const; - char const *to_str0 () const; Byte const *to_bytes () const; char *get_str0 (); Byte *get_bytes (); @@ -105,9 +104,7 @@ public: /// concatenate s void operator += (char const *s) { strh_ += s; } void operator += (String s); - - bool is_empty () const; - + void append (String); void prepend (String); @@ -135,12 +132,11 @@ public: /// signed comparison, analogous to memcmp; static int compare (String const &s1, const String &s2); - /// index of rightmost c - int index_last (char c) const; - /// index of rightmost element of string (???) int index_last (char const *string) const; + int index_last (char c) const; + int index (char c) const; /// index of leftmost occurance of STRING diff --git a/flower/include/string.icc b/flower/include/string.icc index 52d221b5a0..5da4b573f4 100644 --- a/flower/include/string.icc +++ b/flower/include/string.icc @@ -19,9 +19,9 @@ to_string (String s) INLINE char const * -String::to_str0 () const +String::c_str () const { - return strh_.to_str0 (); + return strh_.c_str (); } // because char const* also has an operator ==, this is for safety: diff --git a/flower/string-convert.cc b/flower/string-convert.cc index 7e771c8e73..91ef7e7f93 100644 --- a/flower/string-convert.cc +++ b/flower/string-convert.cc @@ -74,7 +74,7 @@ String_convert::dec2int (String dec_string) return 0; long l = 0; - int conv = sscanf (dec_string.to_str0 (), "%ld", &l); + int conv = sscanf (dec_string.c_str (), "%ld", &l); assert (conv); return (int)l; @@ -95,7 +95,7 @@ String_convert::dec2double (String dec_string) if (!dec_string.length ()) return 0; double d = 0; - int conv = sscanf (dec_string.to_str0 (), "%lf", &d); + int conv = sscanf (dec_string.c_str (), "%lf", &d); assert (conv); return d; } @@ -287,7 +287,7 @@ String String_convert::precision_string (double x, int n) { String format = "%." + to_string (max (0, n - 1)) + "e"; - String str = double_string (abs (x), format.to_str0 ()); + String str = double_string (abs (x), format.c_str ()); int exp = str.right_string (3).to_int (); str = str.left_string (str.length () - 4); diff --git a/flower/string.cc b/flower/string.cc index 7b4620906a..1c23618f39 100644 --- a/flower/string.cc +++ b/flower/string.cc @@ -56,16 +56,11 @@ String::String (int n, char c) *this = String_convert::char_string (c, n); } -char const * -String::c_str () const -{ - return to_str0 (); -} bool String::empty () const { - return is_empty (); + return !length (); } int @@ -225,11 +220,15 @@ String::get_str0 () return strh_.get_str0 (); } +#ifndef DISALLOW_OLD_STRING bool String::is_empty () const { return !length (); } +#endif + + /** Do a signed comparison, analogous to memcmp; */ @@ -257,7 +256,7 @@ String::index_last (char const c) const if (!length ()) return -1; - char const *me = strh_.to_str0 (); + char const *me = strh_.c_str (); char const *p = (char const *)memrchr ((Byte *)me, length (), c); if (p) return p - me; @@ -296,7 +295,7 @@ or -1 if not found. int String::index (char c) const { - char const *me = strh_.to_str0 (); + char const *me = strh_.c_str (); char const *p = (char const *) memchr (me, c, length ()); if (p) return p - me; @@ -312,11 +311,11 @@ String::index (char c) const int String::index (String searchfor) const { - char const *me = strh_.to_str0 (); + char const *me = strh_.c_str (); char const *p = (char const *) memmem (me, length (), - searchfor.to_str0 (), searchfor.length ()); + searchfor.c_str (), searchfor.length ()); if (p) return p - me; @@ -338,7 +337,7 @@ String::index_any (String set) const if (!n) return -1; - void const *me = (void const *) strh_.to_str0 (); + void const *me = (void const *) strh_.c_str (); for (int i = 0; i < set.length (); i++) { char *found = (char *) memchr (me, set[i], n); @@ -450,7 +449,7 @@ void String::print_on (ostream &os) const { if (!strh_.is_binary_bo ()) - os << to_str0 (); + os << c_str (); else for (int i = 0; i < length (); i++) os << (Byte) (*this)[ i ]; diff --git a/flower/warn.cc b/flower/warn.cc index 24117d7ec4..c911526c97 100644 --- a/flower/warn.cc +++ b/flower/warn.cc @@ -23,7 +23,7 @@ progress_indication (String s) if (s == "\n") return; - fputs (s.to_str0 (), stderr); + fputs (s.c_str (), stderr); fflush (stderr); if (s.length ()) progress_newline = s[s.length () - 1] == '\n'; @@ -42,13 +42,13 @@ message (String s) void warning (String s) { - message (_f ("warning: %s", s.to_str0 ()) + "\n"); + message (_f ("warning: %s", s.c_str ()) + "\n"); } void non_fatal_error (String s) { - message (_f ("error: %s", s.to_str0 ()) + "\n"); + message (_f ("error: %s", s.c_str ()) + "\n"); } /* Display an error message. Always starts on a new line. */ diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index 4558ff3393..62329c6dc0 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -235,7 +235,7 @@ number_accidentals (bool *different, *different = false; if (scm_is_pair (accidentals) && !scm_is_symbol (scm_car (accidentals))) warning (_f ("accidental typesetting list must begin with context-name: %s", - ly_scm2string (scm_car (accidentals)).to_str0 ())); + ly_scm2string (scm_car (accidentals)).c_str ())); for (; scm_is_pair (accidentals) && origin; accidentals = scm_cdr (accidentals)) @@ -263,7 +263,7 @@ number_accidentals (bool *different, } else warning (_f ("ignoring unknown accidental: %s", - ly_symbol2string (type).to_str0 ())); + ly_symbol2string (type).c_str ())); } /* if symbol then it is a context name. Scan parent contexts to @@ -279,7 +279,7 @@ number_accidentals (bool *different, } else warning (_f ("pair or context-name expected for accidental rule, found %s", - ly_scm2string (rule).to_str0 ())); + ly_scm2string (rule).c_str ())); } return number; diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index 6882651b8b..9dc7691c6a 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -114,7 +114,7 @@ kpathsea_find_file (String name, String ext) if (ly_is_procedure (proc)) { - SCM kp_result = scm_call_1 (proc, scm_makfrom0str (name.to_str0 ())); + SCM kp_result = scm_call_1 (proc, scm_makfrom0str (name.c_str ())); if (scm_is_string (kp_result)) return ly_scm2string (kp_result); } @@ -125,16 +125,16 @@ kpathsea_find_file (String name, String ext) Open_type_font * All_font_metrics::find_otf (String name) { - SCM sname = ly_symbol2scm (name.to_str0 ()); - SCM name_string = scm_makfrom0str (name.to_str0 ()); + 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; - if (file_name.is_empty ()) + if (file_name.empty ()) file_name = search_path_.find (name + ".otf"); - if (file_name.is_empty ()) + if (file_name.empty ()) return 0; if (be_verbose_global) @@ -158,14 +158,14 @@ All_font_metrics::find_otf (String name) Tex_font_metric * All_font_metrics::find_tfm (String name) { - SCM sname = ly_symbol2scm (name.to_str0 ()); - SCM name_string = scm_makfrom0str (name.to_str0 ()); + 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; - if (file_name.is_empty ()) + if (file_name.empty ()) { /* FIXME: should add "cork-" prefix to lm* fonts. How to do that, cleanly? */ @@ -174,9 +174,9 @@ All_font_metrics::find_tfm (String name) file_name = p; } - if (file_name.is_empty ()) + if (file_name.empty ()) file_name = search_path_.find (name + ".tfm"); - if (file_name.is_empty ()) + if (file_name.empty ()) return 0; if (be_verbose_global) @@ -209,7 +209,7 @@ All_font_metrics::find_font (String name) if (!f) { - warning (_f ("can't find font: `%s'", name.to_str0 ())); + warning (_f ("can't find font: `%s'", name.c_str ())); warning (_ ("loading default font")); } @@ -220,7 +220,7 @@ All_font_metrics::find_font (String name) if (!f) { - error (_f ("can't find default font: `%s'", def_name.to_str0 ())); + error (_f ("can't find default font: `%s'", def_name.c_str ())); error (_f ("(search path: `%s')", search_path_.to_string ())); error (_ ("giving up")); } diff --git a/lily/beam-quanting.cc b/lily/beam-quanting.cc index 90ace1f401..6ce2b7736a 100644 --- a/lily/beam-quanting.cc +++ b/lily/beam-quanting.cc @@ -320,7 +320,7 @@ Beam::quanting (SCM smob, SCM posns) // debug quanting me->set_property ("quant-score", - scm_makfrom0str (qscores[best_idx].score_card_.to_str0 ())); + scm_makfrom0str (qscores[best_idx].score_card_.c_str ())); } #endif diff --git a/lily/binary-source-file.cc b/lily/binary-source-file.cc index 0be17f601d..270d819164 100644 --- a/lily/binary-source-file.cc +++ b/lily/binary-source-file.cc @@ -28,8 +28,8 @@ Binary_source_file::quote_input (char const *pos_str0) const if (!contains (pos_str0)) return ""; - char const *begin_str0 = max (pos_str0 - 8, to_str0 ()); - char const *end_str0 = min (pos_str0 + 7, to_str0 () + length ()); + 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); pre_string = String_convert::bin2hex (pre_string); @@ -55,7 +55,7 @@ Binary_source_file::get_line (char const *pos_str0) const if (!contains (pos_str0)) return 0; - return pos_str0 - to_str0 (); + return pos_str0 - c_str (); } U8 diff --git a/lily/break-align-interface.cc b/lily/break-align-interface.cc index b5a2aa7377..e68453a34c 100644 --- a/lily/break-align-interface.cc +++ b/lily/break-align-interface.cc @@ -191,8 +191,8 @@ Break_align_interface::calc_positioning_done (SCM smob) orig_string = unsmob_grob (l->get_property ("cause"))->name (); programming_error (_f ("No spacing entry from %s to `%s'", - orig_string.to_str0 (), - sym_string.to_str0 ())); + orig_string.c_str (), + sym_string.c_str ())); } Real distance = 1.0; diff --git a/lily/clef.cc b/lily/clef.cc index a32a623df7..04a5537a22 100644 --- a/lily/clef.cc +++ b/lily/clef.cc @@ -31,7 +31,7 @@ Clef::calc_glyph_name (SCM smob) str += "_change"; } - return scm_makfrom0str (str.to_str0 ()); + return scm_makfrom0str (str.c_str ()); } s->suicide (); @@ -51,7 +51,7 @@ Clef::print (SCM smob) Font_metric *fm = Font_interface::get_default_font (me); Stencil out = fm->find_by_name (glyph); if (out.is_empty ()) - me->warning (_f ("clef `%s' not found", glyph.to_str0 ())); + me->warning (_f ("clef `%s' not found", glyph.c_str ())); return out.smobbed_copy (); } diff --git a/lily/cluster.cc b/lily/cluster.cc index d370a65030..7f4001007b 100644 --- a/lily/cluster.cc +++ b/lily/cluster.cc @@ -110,7 +110,7 @@ brew_cluster_piece (Grob *me, Array bottom_points, Array top_poi out.add_stencil (Lookup::round_filled_polygon (points, blotdiameter)); } else - me->warning (_f ("unknown cluster style `%s'", shape.to_str0 ())); + me->warning (_f ("unknown cluster style `%s'", shape.c_str ())); return out; } diff --git a/lily/context-def.cc b/lily/context-def.cc index 2f5362a052..6f91d8292a 100644 --- a/lily/context-def.cc +++ b/lily/context-def.cc @@ -121,7 +121,7 @@ Context_def::add_context_mod (SCM mod) { if (!get_translator (sym)) error (_f ("program has no such type: `%s'", - ly_symbol2string (sym).to_str0 ())); + ly_symbol2string (sym).c_str ())); else translator_mods_ = scm_cons (scm_list_2 (tag, sym), translator_mods_); } diff --git a/lily/context-scheme.cc b/lily/context-scheme.cc index da50d012cb..51b49b7d8f 100644 --- a/lily/context-scheme.cc +++ b/lily/context-scheme.cc @@ -19,7 +19,7 @@ LY_DEFINE (ly_context_id, "ly:context-id", Context *tr = unsmob_context (context); SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context"); - return scm_makfrom0str (tr->id_string ().to_str0 ()); + return scm_makfrom0str (tr->id_string ().c_str ()); } LY_DEFINE (ly_context_name, "ly:context-name", @@ -30,7 +30,7 @@ LY_DEFINE (ly_context_name, "ly:context-name", { Context *tr = unsmob_context (context); SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context"); - return ly_symbol2scm (tr->context_name ().to_str0 ()); + return ly_symbol2scm (tr->context_name ().c_str ()); } LY_DEFINE (ly_context_grob_definition, "ly:context-grob-definition", diff --git a/lily/context.cc b/lily/context.cc index 07bc051024..852303f25d 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -153,7 +153,7 @@ Context::create_unique_context (SCM n, SCM operations) else { warning (_f ("can't find or create new `%s'", - ly_symbol2string (n).to_str0 ())); + ly_symbol2string (n).c_str ())); ret = 0; } return ret; @@ -215,7 +215,7 @@ Context::find_create_context (SCM n, String id, SCM operations) else { warning (_f ("can't find or create `%s' called `%s'", - ly_symbol2string (n).to_str0 (), id)); + ly_symbol2string (n).c_str (), id)); ret = 0; } return ret; @@ -307,7 +307,7 @@ Context::get_default_interpreter () Context_def *t = unsmob_context_def (st); if (!t) { - warning (_f ("can't find or create: `%s'", name.to_str0 ())); + warning (_f ("can't find or create: `%s'", name.c_str ())); t = unsmob_context_def (this->definition_); } @@ -497,10 +497,10 @@ Context::print_smob (SCM s, SCM port, scm_print_state *) scm_display (d->get_context_name (), port); } - if (!sc->id_string_.is_empty ()) + if (!sc->id_string_.empty ()) { scm_puts ("=", port); - scm_puts (sc->id_string_.to_str0 (), port); + scm_puts (sc->id_string_.c_str (), port); } scm_puts (" ", port); diff --git a/lily/duration.cc b/lily/duration.cc index f2d79799de..f01d824621 100644 --- a/lily/duration.cc +++ b/lily/duration.cc @@ -91,7 +91,7 @@ Duration::print_smob (SCM s, SCM port, scm_print_state *) Duration *r = (Duration *) SCM_CELL_WORD_1 (s); scm_puts ("#to_string ().to_str0 ()), port); + scm_display (scm_makfrom0str (r->to_string ().c_str ()), port); scm_puts (" >", port); return 1; diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 04bae19316..5f5559110a 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -215,7 +215,7 @@ Dynamic_engraver::process_music () else if (start_type == "CrescendoEvent") start_type = "crescendo"; - SCM s = get_property ((start_type + "Spanner").to_str0 ()); + SCM s = get_property ((start_type + "Spanner").c_str ()); if (!scm_is_symbol (s) || s == ly_symbol2scm ("hairpin")) { cresc_ = make_spanner ("Hairpin", accepted_spanevents_drul_[START]->self_scm ()); @@ -244,8 +244,8 @@ Dynamic_engraver::process_music () cresc_ = make_spanner ("DynamicTextSpanner", accepted_spanevents_drul_[START]->self_scm ()); cresc_->set_property ("style", s); context ()->set_property ((start_type - + "Spanner").to_str0 (), SCM_EOL); - s = get_property ((start_type + "Text").to_str0 ()); + + "Spanner").c_str (), SCM_EOL); + s = get_property ((start_type + "Text").c_str ()); /* FIXME: use get_markup () to check type. */ @@ -253,7 +253,7 @@ Dynamic_engraver::process_music () { cresc_->set_property ("edge-text", scm_cons (s, scm_makfrom0str (""))); - context ()->set_property ((start_type + "Text").to_str0 (), + context ()->set_property ((start_type + "Text").c_str (), SCM_EOL); } } diff --git a/lily/font-config-scheme.cc b/lily/font-config-scheme.cc index a31bfa6e69..65349e87c2 100644 --- a/lily/font-config-scheme.cc +++ b/lily/font-config-scheme.cc @@ -86,7 +86,7 @@ LY_DEFINE (ly_font_config_get_font_file, "ly:font-config-get-font-file", 1, 0, 0 FcValue val; val.type = FcTypeString; - val.u.s = (const FcChar8*)ly_scm2string (name).to_str0 (); // FC_SLANT_ITALIC; + val.u.s = (const FcChar8*)ly_scm2string (name).c_str (); // FC_SLANT_ITALIC; FcPatternAdd(pat, FC_FAMILY, val, FcFalse); FcResult result; diff --git a/lily/font-config.cc b/lily/font-config.cc index 1e39ecbffb..f91916adba 100644 --- a/lily/font-config.cc +++ b/lily/font-config.cc @@ -44,10 +44,10 @@ init_fontconfig () for (int i = 0; i < dirs.size (); i++) { String dir = dirs[i]; - if (!FcConfigAppFontAddDir (font_config_global, (FcChar8 *)dir.to_str0 ())) - error (_f ("adding font directory: %s", dir.to_str0 ())); + if (!FcConfigAppFontAddDir (font_config_global, (FcChar8 *)dir.c_str ())) + error (_f ("adding font directory: %s", dir.c_str ())); else if (be_verbose_global) - message (_f ("adding font directory: %s", dir.to_str0 ())); + message (_f ("adding font directory: %s", dir.c_str ())); } FcConfigBuildFonts (font_config_global); diff --git a/lily/font-metric-scheme.cc b/lily/font-metric-scheme.cc index 05e69a9de9..b24a94c3db 100644 --- a/lily/font-metric-scheme.cc +++ b/lily/font-metric-scheme.cc @@ -117,7 +117,7 @@ LY_DEFINE (ly_font_name, "ly:font-name", Font_metric *fm = unsmob_metrics (font); SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); - return scm_makfrom0str (fm->font_name ().to_str0 ()); + return scm_makfrom0str (fm->font_name ().c_str ()); } LY_DEFINE (ly_font_magnification, "ly:font-magnification", 1, 0, 0, diff --git a/lily/font-metric.cc b/lily/font-metric.cc index 5d472bcc2c..9d90c62b7f 100644 --- a/lily/font-metric.cc +++ b/lily/font-metric.cc @@ -41,7 +41,7 @@ Font_metric::find_by_name (String s) const { expr = scm_list_3 (ly_symbol2scm ("named-glyph"), self_scm (), - scm_makfrom0str (s.to_str0 ())); + scm_makfrom0str (s.c_str ())); b = get_indexed_char (idx); } @@ -183,7 +183,7 @@ Font_metric::text_stencil (String str) const { SCM lst = scm_list_3 (ly_symbol2scm ("text"), this->self_scm (), - scm_makfrom0str (str.to_str0 ())); + scm_makfrom0str (str.c_str ())); Box b = text_dimension (str); return Stencil (b, lst); diff --git a/lily/function-documentation.cc b/lily/function-documentation.cc index d1eacb357d..cb04138ac1 100644 --- a/lily/function-documentation.cc +++ b/lily/function-documentation.cc @@ -29,7 +29,7 @@ void ly_add_function_documentation (SCM func, + "\n" + doc; scm_set_procedure_property_x (func, ly_symbol2scm ("documentation"), - scm_makfrom0str (s.to_str0 ())); + scm_makfrom0str (s.c_str ())); SCM entry = scm_cons (scm_makfrom0str (varlist), scm_makfrom0str (doc)); scm_hashq_set_x (doc_hash_table, ly_symbol2scm (fname), entry); } diff --git a/lily/general-scheme.cc b/lily/general-scheme.cc index fca5c81732..3ecb45fbd5 100644 --- a/lily/general-scheme.cc +++ b/lily/general-scheme.cc @@ -33,10 +33,10 @@ LY_DEFINE (ly_find_file, "ly:find-file", String nm = ly_scm2string (name); String file_name = global_path.find (nm); - if (file_name.is_empty ()) + if (file_name.empty ()) return SCM_BOOL_F; - return scm_makfrom0str (file_name.to_str0 ()); + return scm_makfrom0str (file_name.c_str ()); } /* @@ -216,7 +216,7 @@ LY_DEFINE (ly_output_backend, "ly:output-backend", 0, 0, 0, (), "Return name of output backend.") { - return scm_makfrom0str (output_backend_global.to_str0 ()); + return scm_makfrom0str (output_backend_global.c_str ()); } LY_DEFINE (ly_output_formats, "ly:output-formats", @@ -229,7 +229,7 @@ LY_DEFINE (ly_output_formats, "ly:output-formats", SCM lst = SCM_EOL; int output_formats_count = output_formats.size (); for (int i = 0; i < output_formats_count; i++) - lst = scm_cons (scm_makfrom0str (output_formats[i].to_str0 ()), lst); + lst = scm_cons (scm_makfrom0str (output_formats[i].c_str ()), lst); return lst; } @@ -273,7 +273,7 @@ LY_DEFINE (ly_effective_prefix, "ly:effective-prefix", 0, 0, 0, (), "Return effective prefix.") { - return scm_makfrom0str (prefix_directory.to_str0 ()); + return scm_makfrom0str (prefix_directory.c_str ()); } LY_DEFINE (ly_chain_assoc_get, "ly:chain-assoc-get", diff --git a/lily/gregorian-ligature.cc b/lily/gregorian-ligature.cc index 15a488b3b0..747a97bb1d 100644 --- a/lily/gregorian-ligature.cc +++ b/lily/gregorian-ligature.cc @@ -15,7 +15,7 @@ void check_prefix (String name, int mask, int prefix_set, String *str) { if (prefix_set & mask) { - if (!str->is_empty ()) + if (!str->empty ()) *str += ", "; *str += name; } diff --git a/lily/grob-interface.cc b/lily/grob-interface.cc index 4a46652b71..8a990cfb43 100644 --- a/lily/grob-interface.cc +++ b/lily/grob-interface.cc @@ -44,7 +44,7 @@ check_interfaces_for_property (Grob const *me, SCM sym) if (iface == SCM_BOOL_F) { String msg = to_string (_f ("Unknown interface `%s'", - ly_symbol2string (scm_car (ifs)).to_str0 ())); + ly_symbol2string (scm_car (ifs)).c_str ())); programming_error (msg); continue; } @@ -55,8 +55,8 @@ check_interfaces_for_property (Grob const *me, SCM sym) if (!found) { String str = to_string (_f ("Grob `%s' has no interface for property `%s'", - me->name ().to_str0 (), - ly_symbol2string (sym).to_str0 ())); + me->name ().c_str (), + ly_symbol2string (sym).c_str ())); programming_error (str); } } diff --git a/lily/grob-smob.cc b/lily/grob-smob.cc index ad13ecf7c5..4fb42c9237 100644 --- a/lily/grob-smob.cc +++ b/lily/grob-smob.cc @@ -48,7 +48,7 @@ Grob::print_smob (SCM s, SCM port, scm_print_state *) Grob *sc = (Grob *) SCM_CELL_WORD_1 (s); scm_puts ("#name ().to_str0 (), port); + scm_puts ((char *) sc->name ().c_str (), port); /* Do not print properties, that is too much hassle. */ scm_puts (" >", port); diff --git a/lily/hairpin.cc b/lily/hairpin.cc index 26669fdbec..5a9a885b23 100644 --- a/lily/hairpin.cc +++ b/lily/hairpin.cc @@ -7,7 +7,6 @@ */ #include "hairpin.hh" - #include "staff-symbol-referencer.hh" #include "line-interface.hh" #include "spanner.hh" diff --git a/lily/includable-lexer.cc b/lily/includable-lexer.cc index 1ec8bcbbad..9bcfbd2392 100644 --- a/lily/includable-lexer.cc +++ b/lily/includable-lexer.cc @@ -59,7 +59,7 @@ Includable_lexer::new_input (String name, Sources *sources) msg += "\n"; msg += _f ("(search path: `%s')", sources->path_->to_string ().c_str ()); - LexerError (msg.to_str0 ()); + LexerError (msg.c_str ()); return; } file_name_strings_.push (file->name_string ()); @@ -128,7 +128,7 @@ Includable_lexer::here_str0 () const { if (include_stack_.is_empty ()) return 0; - return include_stack_.top ()->to_str0 () + char_count_stack_.top (); + return include_stack_.top ()->c_str () + char_count_stack_.top (); } Includable_lexer::~Includable_lexer () diff --git a/lily/include/source-file.hh b/lily/include/source-file.hh index d3c5ab0aa5..161c8e3b8b 100644 --- a/lily/include/source-file.hh +++ b/lily/include/source-file.hh @@ -32,7 +32,7 @@ public: virtual ~Source_file (); - char const *to_str0 () const; + char const *c_str () const; virtual String quote_input (char const *pos_str0) const; istream *get_istream (); bool contains (char const *pos_str0) const; diff --git a/lily/input-scheme.cc b/lily/input-scheme.cc index 70a959c865..6923a8b104 100644 --- a/lily/input-scheme.cc +++ b/lily/input-scheme.cc @@ -42,7 +42,7 @@ LY_DEFINE (ly_input_file_line_column, "ly:input-file-line-char-column", 1, 0, 0, int l, ch, col; ip->get_counts (&l, &ch, &col); - return scm_list_4 (scm_makfrom0str (ip->file_string ().to_str0 ()), + return scm_list_4 (scm_makfrom0str (ip->file_string ().c_str ()), scm_from_int (l), scm_from_int (ch), scm_from_int (col)); @@ -53,7 +53,7 @@ LY_DEFINE (ly_input_both_locations, "ly:input-both-locations", 1, 0, 0, (SCM sip { Input *ip = unsmob_input (sip); SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location"); - return scm_list_5 (scm_makfrom0str (ip->file_string ().to_str0 ()), + return scm_list_5 (scm_makfrom0str (ip->file_string ().c_str ()), scm_from_int (ip->line_number ()), scm_from_int (ip->column_number ()), scm_from_int (ip->end_line_number ()), diff --git a/lily/input-smob.cc b/lily/input-smob.cc index 03c9da46b0..00c93305e7 100644 --- a/lily/input-smob.cc +++ b/lily/input-smob.cc @@ -27,7 +27,7 @@ static int print_smob (SCM s, SCM port, scm_print_state *) { String str = "#location_string () + ">"; - scm_puts (str.to_str0 (), port); + scm_puts (str.c_str (), port); return 1; } diff --git a/lily/lexer.ll b/lily/lexer.ll index 2aa5551d7d..92bbdc5e62 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -201,11 +201,11 @@ BOM_UTF8 \357\273\277 yy_pop_state (); this->here_input().get_source_file ()->name_ = s; - message (_f ("Renaming input to: `%s'", s.to_str0 ())); + message (_f ("Renaming input to: `%s'", s.c_str ())); progress_indication ("\n"); scm_module_define (scm_car (scopes_), ly_symbol2scm ("input-file-name"), - scm_makfrom0str (s.to_str0 ())); + scm_makfrom0str (s.c_str ())); } . { @@ -267,7 +267,7 @@ BOM_UTF8 \357\273\277 } else { String msg (_f ("wrong or undefined identifier: `%s'", s )); - LexerError (msg.to_str0 ()); + LexerError (msg.c_str ()); SCM err = scm_current_error_port (); scm_puts ("This value was found in the table: ", err); scm_display (sid, err); @@ -379,7 +379,7 @@ BOM_UTF8 \357\273\277 /* yylval is union. Must remember STRING before setting SCM*/ String *sp = yylval.string; - yylval.scm = scm_makfrom0str (sp->to_str0 ()); + yylval.scm = scm_makfrom0str (sp->c_str ()); delete sp; return STRING; } @@ -400,7 +400,7 @@ BOM_UTF8 \357\273\277 /* yylval is union. Must remember STRING before setting SCM*/ String *sp = yylval.string; - yylval.scm = scm_makfrom0str (sp->to_str0 ()); + yylval.scm = scm_makfrom0str (sp->c_str ()); delete sp; return LYRICS_STRING; } @@ -437,7 +437,7 @@ BOM_UTF8 \357\273\277 if (c == '{' || c == '}') // brace open is for not confusing dumb tools. here_input ().warning ( _ ("Brace found at end of lyric. Did you forget a space?")); - yylval.scm = scm_makfrom0str (s.to_str0 ()); + yylval.scm = scm_makfrom0str (s.c_str ()); return LYRICS_STRING; @@ -536,7 +536,7 @@ BOM_UTF8 \357\273\277 if (c == '{' || c == '}') here_input ().warning ( _ ("Brace found at end of markup. Did you forget a space?")); - yylval.scm = scm_makfrom0str (s.to_str0 ()); + yylval.scm = scm_makfrom0str (s.c_str ()); return STRING; @@ -628,7 +628,7 @@ BOM_UTF8 \357\273\277 <*>. { String msg = _f ("invalid character: `%c'", YYText ()[0]); - LexerError (msg.to_str0 ()); + LexerError (msg.c_str ()); return YYText ()[0]; } @@ -693,7 +693,7 @@ Lily_lexer::scan_escaped_word (String str) { // use more SCM for this. -// SCM sym = ly_symbol2scm (str.to_str0 ()); +// SCM sym = ly_symbol2scm (str.c_str ()); int i = lookup_keyword (str); if (i == MARKUP && is_lyric_state ()) @@ -715,9 +715,9 @@ Lily_lexer::scan_escaped_word (String str) } String msg (_f ("unknown escaped string: `\\%s'", str)); - LexerError (msg.to_str0 ()); + LexerError (msg.c_str ()); - yylval.scm = scm_makfrom0str (str.to_str0 ()); + yylval.scm = scm_makfrom0str (str.c_str ()); return STRING; } @@ -725,7 +725,7 @@ Lily_lexer::scan_escaped_word (String str) int Lily_lexer::scan_bare_word (String str) { - SCM sym = ly_symbol2scm (str.to_str0 ()); + SCM sym = ly_symbol2scm (str.c_str ()); if ((YYSTATE == notes) || (YYSTATE == chords)) { SCM handle = SCM_BOOL_F; if (scm_is_pair (pitchname_tab_stack_)) @@ -745,7 +745,7 @@ Lily_lexer::scan_bare_word (String str) } } - yylval.scm = scm_makfrom0str (str.to_str0 ()); + yylval.scm = scm_makfrom0str (str.c_str ()); return STRING; } @@ -867,7 +867,7 @@ SCM lookup_markup_command (String s) { SCM proc = ly_lily_module_constant ("lookup-markup-command"); - return scm_call_1 (proc, scm_makfrom0str (s.to_str0 ())); + return scm_call_1 (proc, scm_makfrom0str (s.c_str ())); } diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 4a237d7440..f1c0488e3f 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -360,7 +360,7 @@ ly_string_array_to_scm (Array a) { SCM s = SCM_EOL; for (int i = a.size () - 1; i >= 0; i--) - s = scm_cons (ly_symbol2scm (a[i].to_str0 ()), s); + s = scm_cons (ly_symbol2scm (a[i].c_str ()), s); return s; } @@ -439,8 +439,8 @@ type_check_assignment (SCM sym, SCM val, SCM type_symbol) if (type != SCM_EOL && !ly_is_procedure (type)) { warning (_f ("can't find property type-check for `%s' (%s).", - ly_symbol2string (sym).to_str0 (), - ly_symbol2string (type_symbol).to_str0 ()) + ly_symbol2string (sym).c_str (), + ly_symbol2string (type_symbol).c_str ()) + " " + _ ("perhaps a typing error?")); /* Be strict when being anal :) */ @@ -460,9 +460,9 @@ type_check_assignment (SCM sym, SCM val, SCM type_symbol) SCM type_name = scm_call_1 (typefunc, type); warning (_f ("type check for `%s' failed; value `%s' must be of type `%s'", - ly_symbol2string (sym).to_str0 (), + ly_symbol2string (sym).c_str (), print_scm_val (val), - ly_scm2string (type_name).to_str0 ())); + ly_scm2string (type_name).c_str ())); progress_indication ("\n"); } } diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index dd4c5e1b1d..9117decb5f 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -173,7 +173,7 @@ Lily_lexer::set_current_scope () int Lily_lexer::lookup_keyword (String s) { - return keytable_->lookup (s.to_str0 ()); + return keytable_->lookup (s.c_str ()); } SCM @@ -192,7 +192,7 @@ Lily_lexer::lookup_identifier_symbol (SCM sym) SCM Lily_lexer::lookup_identifier (String name) { - return lookup_identifier_symbol (ly_symbol2scm (name.to_str0 ())); + return lookup_identifier_symbol (ly_symbol2scm (name.c_str ())); } void @@ -206,7 +206,7 @@ Lily_lexer::start_main_input () scm_module_define (scm_car (scopes_), ly_symbol2scm ("input-file-name"), - scm_makfrom0str (main_input_name_.to_str0 ())); + scm_makfrom0str (main_input_name_.c_str ())); } void @@ -221,7 +221,7 @@ Lily_lexer::set_identifier (SCM name, SCM s) if (lookup_keyword (ly_symbol2string (sym)) >= 0) { String symstr = ly_symbol2string (sym); - warning (_f ("identifier name is a keyword: `%s'", symstr.to_str0 ())); + warning (_f ("identifier name is a keyword: `%s'", symstr.c_str ())); } SCM mod = scm_car (scopes_); diff --git a/lily/lily-parser-scheme.cc b/lily/lily-parser-scheme.cc index f7eac0e9f1..e9d533e91e 100644 --- a/lily/lily-parser-scheme.cc +++ b/lily/lily-parser-scheme.cc @@ -52,7 +52,7 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", out_file_name.dir_ = ""; /* When running from gui, generate output in .ly source directory. */ - if (output_name_global.is_empty () + if (output_name_global.empty () && ly_get_option (ly_symbol2scm ("gui")) == SCM_BOOL_T) { File_name f (file); @@ -61,7 +61,7 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", output_name_global = f.to_string (); } - if (!output_name_global.is_empty ()) + if (!output_name_global.empty ()) { /* Interpret --output=DIR to mean --output=DIR/BASE. */ if (is_dir (output_name_global)) @@ -73,8 +73,8 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", { global_path.prepend (cwd); message (_f ("Changing working directory to `%s'", - output_name_global.to_str0 ())); - chdir (output_name_global.to_str0 ()); + output_name_global.c_str ())); + chdir (output_name_global.c_str ()); } output_name_global = ""; } @@ -83,7 +83,7 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", } String init; - if (!init_name_global.is_empty ()) + if (!init_name_global.empty ()) init = init_name_global; else init = "init.ly"; @@ -110,7 +110,7 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", sources.set_path (&global_path); String mapped_fn = map_file_name (file_name); - message (_f ("Processing `%s'", mapped_fn.to_str0 ())); + message (_f ("Processing `%s'", mapped_fn.c_str ())); progress_indication ("\n"); Lily_parser *parser = new Lily_parser (&sources); @@ -123,7 +123,7 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", if (error) /* TODO: pass renamed input file too. */ scm_throw (ly_symbol2scm ("ly-file-failed"), - scm_list_1 (scm_makfrom0str (file_name.to_str0 ()))); + scm_list_1 (scm_makfrom0str (file_name.c_str ()))); } return SCM_UNSPECIFIED; } @@ -224,6 +224,6 @@ LY_DEFINE (ly_parser_output_name, "ly:parser-output-name", Lily_parser *p = unsmob_lily_parser (parser); SCM_ASSERT_TYPE (p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser"); - return scm_makfrom0str (p->output_basename_.to_str0 ()); + return scm_makfrom0str (p->output_basename_.c_str ()); } diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 00d68102e6..5e4aede18c 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -102,7 +102,7 @@ Lily_parser::parse_file (String init, String name, String out_name) File_name f (name); String s = global_path.find (f.base_ + ".twy"); s = gulp_file_to_string (s, false, -1); - scm_eval_string (scm_makfrom0str (s.to_str0 ())); + scm_eval_string (scm_makfrom0str (s.c_str ())); /* Read .ly IN_FILE, lex, parse, write \score blocks from IN_FILE to OUT_FILE (unless IN_FILE redefines output file name). */ @@ -165,7 +165,7 @@ Lily_parser::here_str0 () const void Lily_parser::parser_error (String s) { - lexer_->here_input ().error (_ (s.to_str0 ())); + lexer_->here_input ().error (_ (s.c_str ())); error_level_ = 1; } diff --git a/lily/lilypond-key.cc b/lily/lilypond-key.cc index be4c00b50e..d9833307af 100644 --- a/lily/lilypond-key.cc +++ b/lily/lilypond-key.cc @@ -62,7 +62,7 @@ Lilypond_grob_key::as_scheme () const { return scm_list_4 (context_ ? context_->self_scm () : SCM_BOOL_F, creation_moment_.smobbed_copy (), - scm_makfrom0str (grob_name_.to_str0 ()), + scm_makfrom0str (grob_name_.c_str ()), scm_from_int (disambiguation_count_)); } @@ -145,8 +145,8 @@ Lilypond_context_key::as_scheme () const { return scm_list_5 (parent_context_ ? parent_context_->self_scm () : SCM_BOOL_F, start_moment_.smobbed_copy (), - scm_makfrom0str (context_name_.to_str0 ()), - scm_makfrom0str (id_.to_str0 ()), + scm_makfrom0str (context_name_.c_str ()), + scm_makfrom0str (id_.c_str ()), scm_from_int (disambiguation_count_)); } @@ -212,7 +212,7 @@ SCM Lilypond_general_key::as_scheme () const { return scm_list_3 (parent_ ? parent_->self_scm () : SCM_BOOL_F, - scm_makfrom0str (name_.to_str0 ()), + scm_makfrom0str (name_.c_str ()), scm_from_int (disambiguation_count_)); } diff --git a/lily/main.cc b/lily/main.cc index e2a0ea20e9..daac5b01c0 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -200,7 +200,7 @@ dir_info (FILE *out) env_var_info (out, "LILYPONDPREFIX"); fprintf (out, "LOCALEDIR=\"%s\"\n", LOCALEDIR); - fprintf (out, "\nEffective prefix: \"%s\"\n", prefix_directory.to_str0 ()); + fprintf (out, "\nEffective prefix: \"%s\"\n", prefix_directory.c_str ()); if (relocate_binary) { @@ -394,8 +394,8 @@ main_with_guile (void *, int, char **) all_fonts_global = new All_font_metrics (global_path.to_string ()); - if (!init_scheme_variables.is_empty () - || !init_scheme_code_string.is_empty ()) + if (!init_scheme_variables.empty () + || !init_scheme_code_string.empty ()) { init_scheme_variables = "(map (lambda (x) (ly:set-option (car x) (cdr x))) (list " + init_scheme_variables + "))"; @@ -428,7 +428,7 @@ main_with_guile (void *, int, char **) option_parser = 0; #if HAVE_CHROOT - if (!jail_spec.is_empty ()) + if (!jail_spec.empty ()) do_chroot_jail (); #endif diff --git a/lily/midi-item.cc b/lily/midi-item.cc index 6b372e9472..d094899dc3 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -145,12 +145,12 @@ Midi_instrument::to_string () const UGH. don't use eval. */ SCM proc = ly_lily_module_constant ("midi-program"); - SCM program = scm_call_1 (proc, ly_symbol2scm (audio_->str_.to_str0 ())); + SCM program = scm_call_1 (proc, ly_symbol2scm (audio_->str_.c_str ())); found = (program != SCM_BOOL_F); if (found) program_byte = scm_to_int (program); else - warning (_f ("no such MIDI instrument: `%s'", audio_->str_.to_str0 ())); + 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); diff --git a/lily/midi-stream.cc b/lily/midi-stream.cc index c93aed5324..7af7a10649 100644 --- a/lily/midi-stream.cc +++ b/lily/midi-stream.cc @@ -22,7 +22,7 @@ using namespace std; Midi_stream::Midi_stream (String file_name) { file_name_string_ = file_name; - out_file_ = fopen (file_name.to_str0 (), "wb"); + out_file_ = fopen (file_name.c_str (), "wb"); if (!out_file_) error (_f ("can't open for write: %s: %s", file_name, strerror (errno))); } diff --git a/lily/modified-font-metric.cc b/lily/modified-font-metric.cc index e23323a829..74f744d872 100644 --- a/lily/modified-font-metric.cc +++ b/lily/modified-font-metric.cc @@ -179,7 +179,7 @@ Modified_font_metric::text_stencil (String text) const Box Modified_font_metric::text_dimension (String text) const { - SCM stext = scm_makfrom0str (text.to_str0 ()); + SCM stext = scm_makfrom0str (text.c_str ()); Box b = lookup_tex_text_dimension (orig_, stext); if (!b[Y_AXIS].is_empty ()) { diff --git a/lily/moment.cc b/lily/moment.cc index 5897f9163d..f0d34b8bc1 100644 --- a/lily/moment.cc +++ b/lily/moment.cc @@ -50,7 +50,7 @@ Moment::print_smob (SCM s, SCM port, scm_print_state *) scm_puts ("#to_string (); - scm_puts ((char *)str.to_str0 (), port); + scm_puts ((char *)str.c_str (), port); scm_puts (">", port); return 1; diff --git a/lily/music-function.cc b/lily/music-function.cc index 36a86a7688..e077624fe6 100644 --- a/lily/music-function.cc +++ b/lily/music-function.cc @@ -51,7 +51,7 @@ LY_DEFINE (ly_make_music_function, "ly:make-music-function", 2, 0, 0, signature); scm_set_object_property_x (func, ly_symbol2scm ("music-function-signature-keyword"), - ly_symbol2scm (str.to_str0 ())); + ly_symbol2scm (str.c_str ())); SCM_RETURN_NEWSMOB (music_function_tag, func); } diff --git a/lily/new-lyric-combine-music-iterator.cc b/lily/new-lyric-combine-music-iterator.cc index d3521c74a9..0603ea7ea5 100644 --- a/lily/new-lyric-combine-music-iterator.cc +++ b/lily/new-lyric-combine-music-iterator.cc @@ -241,7 +241,7 @@ Lyric_combine_music_iterator::do_quit () name = ly_scm2string (voice_name); get_music ()->origin ()->warning (_f ("cannot find Voice `%s'", - name.to_str0 ()) + "\n"); + name.c_str ()) + "\n"); } if (lyric_iter_) diff --git a/lily/note-head.cc b/lily/note-head.cc index ddbc6d0962..b1cbf0d7ca 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -63,7 +63,7 @@ internal_print (Grob *me, String *font_char) if (out.is_empty ()) { - me->warning (_f ("note head `%s' not found", idx.to_str0 ())); + me->warning (_f ("note head `%s' not found", idx.c_str ())); out = Stencil (Box (Interval (0, 0), Interval (0, 0)), SCM_EOL); } else diff --git a/lily/note-name-engraver.cc b/lily/note-name-engraver.cc index 4b63b4f32d..8946a43a82 100644 --- a/lily/note-name-engraver.cc +++ b/lily/note-name-engraver.cc @@ -50,7 +50,7 @@ Note_name_engraver::process_music () if (s.length ()) { Item *t = make_item ("NoteName", events_[0]->self_scm ()); - t->set_property ("text", scm_makfrom0str (s.to_str0 ())); + t->set_property ("text", scm_makfrom0str (s.c_str ())); texts_.push (t); } } diff --git a/lily/open-type-font-scheme.cc b/lily/open-type-font-scheme.cc index 43f8c32f8d..5eb45a76a8 100644 --- a/lily/open-type-font-scheme.cc +++ b/lily/open-type-font-scheme.cc @@ -52,7 +52,7 @@ LY_DEFINE (ly_otf_font_table_data, "ly:otf-font-table-data", 2, 0, 0, char ctag [5] = " "; String tag_string = ly_scm2string (tag); - strncpy (ctag, tag_string.to_str0 (), tag_string.length ()); + strncpy (ctag, tag_string.c_str (), tag_string.length ()); String tab = otf->get_otf_table (String (ctag)); diff --git a/lily/open-type-font.cc b/lily/open-type-font.cc index 85e38042f4..7f165ce8fc 100644 --- a/lily/open-type-font.cc +++ b/lily/open-type-font.cc @@ -61,7 +61,7 @@ load_scheme_table (char const *tag_str, FT_Face face) String contents ((Byte const *)buffer, length); contents = "(quote (" + contents + "))"; - tab = scm_c_eval_string (contents.to_str0 ()); + tab = scm_c_eval_string (contents.c_str ()); free (buffer); } return tab; @@ -92,7 +92,7 @@ String get_otf_table (FT_Face face, String tag) { FT_ULong len; - FT_Byte *tab = load_table (tag.to_str0 (), face, &len); + FT_Byte *tab = load_table (tag.c_str (), face, &len); return String (tab, len); } @@ -101,13 +101,13 @@ FT_Face open_ft_face (String str) { FT_Face face; - int error_code = FT_New_Face (freetype2_library, str.to_str0 (), 0, &face); + int error_code = FT_New_Face (freetype2_library, str.c_str (), 0, &face); if (error_code == FT_Err_Unknown_File_Format) - error (_f ("unsupported font format: %s", str.to_str0 ())); + error (_f ("unsupported font format: %s", str.c_str ())); else if (error_code) error (_f ("unknown error: %d reading font file: %s", error_code, - str.to_str0 ())); + str.c_str ())); return face; } @@ -148,7 +148,7 @@ Open_type_font::derived_mark () const Offset Open_type_font::attachment_point (String glyph_name) const { - SCM sym = ly_symbol2scm (glyph_name.to_str0 ()); + SCM sym = ly_symbol2scm (glyph_name.c_str ()); SCM entry = scm_hashq_ref (lily_character_table_, sym, SCM_BOOL_F); Offset o; @@ -224,7 +224,7 @@ Open_type_font::get_indexed_char (int signed_idx) const int Open_type_font::name_to_index (String nm) const { - char *nm_str = (char *) nm.to_str0 (); + char *nm_str = (char *) nm.c_str (); if (int idx = FT_Get_Name_Index (face_, nm_str)) return idx; return -1; diff --git a/lily/output-def.cc b/lily/output-def.cc index b87dd470b2..bb40a4d72c 100644 --- a/lily/output-def.cc +++ b/lily/output-def.cc @@ -120,7 +120,7 @@ Output_def::lookup_variable (SCM sym) const SCM Output_def::c_variable (String s) const { - return lookup_variable (ly_symbol2scm (s.to_str0 ())); + return lookup_variable (ly_symbol2scm (s.c_str ())); } void diff --git a/lily/pango-font.cc b/lily/pango-font.cc index cdfd744782..35eb6cb01c 100644 --- a/lily/pango-font.cc +++ b/lily/pango-font.cc @@ -63,8 +63,8 @@ void Pango_font::register_font_file (String filename, String ps_name) { scm_hash_set_x (physical_font_tab_, - scm_makfrom0str (ps_name.to_str0 ()), - scm_makfrom0str (filename.to_str0 ())); + scm_makfrom0str (ps_name.c_str ()), + scm_makfrom0str (filename.c_str ())); } void @@ -81,7 +81,7 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, String str) const PangoAnalysis const *pa = &(item->analysis); PangoGlyphString *pgs = pango_glyph_string_new (); - pango_shape (str.to_str0 () + item->offset, + pango_shape (str.c_str () + item->offset, item->length, (PangoAnalysis*) pa, pgs); PangoRectangle logical_rect; @@ -187,7 +187,7 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, String str) const pango_fc_font_unlock_face (fcfont); SCM expr = scm_list_5 (ly_symbol2scm ("glyph-string"), - scm_makfrom0str (ps_name.to_str0 ()), + scm_makfrom0str (ps_name.c_str ()), scm_from_double (size), scm_from_bool (cid_keyed), ly_quote_scm (glyph_exprs)); @@ -210,7 +210,7 @@ Pango_font::text_stencil (String str) const { GList *items = pango_itemize (context_, - str.to_str0 (), + str.c_str (), 0, str.length (), attribute_list_, NULL); @@ -270,7 +270,7 @@ Pango_font::text_stencil (String str) const SCM exp = scm_list_3 (ly_symbol2scm ("utf-8-string"), scm_makfrom0str (descr_string), - scm_makfrom0str (str.to_str0 ())); + scm_makfrom0str (str.c_str ())); g_free (descr_string); diff --git a/lily/pango-select.cc b/lily/pango-select.cc index 6cb4285056..8f7eb462a3 100644 --- a/lily/pango-select.cc +++ b/lily/pango-select.cc @@ -20,7 +20,7 @@ properties_to_pango_description (SCM chain, Real text_size) if (scm_is_string (name)) { String name_str = ly_scm2string (name); - description = pango_font_description_from_string (name_str.to_str0 ()); + description = pango_font_description_from_string (name_str.c_str ()); } else { @@ -140,7 +140,7 @@ symbols_to_pango_font_description (SCM family, family_str = ly_scm2string (family); pango_font_description_set_family (description, - family_str.to_str0 ()); + family_str.c_str ()); pango_font_description_set_style (description, symbol_to_pango_style (style)); pango_font_description_set_variant (description, diff --git a/lily/paper-book.cc b/lily/paper-book.cc index fc34423986..032af56391 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -67,7 +67,7 @@ dump_fields () SCM fields = SCM_EOL; for (int i = dump_header_fieldnames_global.size (); i--;) fields - = scm_cons (ly_symbol2scm (dump_header_fieldnames_global[i].to_str0 ()), + = scm_cons (ly_symbol2scm (dump_header_fieldnames_global[i].c_str ()), fields); return fields; } @@ -106,7 +106,7 @@ Paper_book::output (SCM output_channel) String mod_nm = "scm framework-" + output_backend_global; - SCM mod = scm_c_resolve_module (mod_nm.to_str0 ()); + SCM mod = scm_c_resolve_module (mod_nm.c_str ()); if (make_print) { SCM func = scm_c_module_lookup (mod, "output-framework"); @@ -147,7 +147,7 @@ Paper_book::classic_output (SCM output) String format = output_backend_global; String mod_nm = "scm framework-" + format; - SCM mod = scm_c_resolve_module (mod_nm.to_str0 ()); + SCM mod = scm_c_resolve_module (mod_nm.c_str ()); SCM func = scm_c_module_lookup (mod, "output-classic-framework"); func = scm_variable_ref (func); diff --git a/lily/paper-column.cc b/lily/paper-column.cc index f7cd30334c..188b24f12b 100644 --- a/lily/paper-column.cc +++ b/lily/paper-column.cc @@ -122,10 +122,10 @@ Paper_column::print (SCM p) SCM scm_mol = Text_interface::interpret_markup (me->layout ()->self_scm (), properties, - scm_makfrom0str (r.to_str0 ())); + scm_makfrom0str (r.c_str ())); SCM when_mol = Text_interface::interpret_markup (me->layout ()->self_scm (), properties, - scm_makfrom0str (when.to_str0 ())); + scm_makfrom0str (when.c_str ())); Stencil t = *unsmob_stencil (scm_mol); t.add_at_edge (Y_AXIS, DOWN, *unsmob_stencil (when_mol), 0.1, 0.1); t.align_to (X_AXIS, CENTER); diff --git a/lily/paper-outputter-scheme.cc b/lily/paper-outputter-scheme.cc index d5b52e0998..2bfdde5bc4 100644 --- a/lily/paper-outputter-scheme.cc +++ b/lily/paper-outputter-scheme.cc @@ -29,7 +29,7 @@ LY_DEFINE (ly_make_paper_outputter, "ly:make-paper-outputter", output_name = ly_scm2string (port_name); message (_f ("Layout output to `%s'...", - output_name.to_str0 ())); + output_name.c_str ())); progress_indication ("\n"); Paper_outputter *po = new Paper_outputter (port, f); diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 41a941884d..7a39af91d5 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -35,7 +35,7 @@ Paper_outputter::Paper_outputter (SCM port, String format) smobify_self (); String module_name = "scm output-" + format; - output_module_ = scm_c_resolve_module (module_name.to_str0 ()); + output_module_ = scm_c_resolve_module (module_name.c_str ()); } Paper_outputter::~Paper_outputter () diff --git a/lily/paper-system.cc b/lily/paper-system.cc index ea9c0c4346..b8fdfaa9d0 100644 --- a/lily/paper-system.cc +++ b/lily/paper-system.cc @@ -76,8 +76,6 @@ Paper_system::internal_get_property (SCM sym) const return scm_cdr (s); s = scm_sloppy_assq (sym, immutable_property_alist_); - - return (s == SCM_BOOL_F) ? SCM_EOL : scm_cdr (s); } diff --git a/lily/parse-scm.cc b/lily/parse-scm.cc index 834fac6449..4aee394290 100644 --- a/lily/parse-scm.cc +++ b/lily/parse-scm.cc @@ -25,7 +25,7 @@ internal_ly_parse_scm (Parse_start *ps) Source_file *sf = ps->start_location_.get_source_file (); SCM port = sf->get_port (); - int off = ps->start_location_.start () - sf->to_str0 (); + int off = ps->start_location_.start () - sf->c_str (); scm_seek (port, scm_long2num (off), scm_long2num (SEEK_SET)); SCM from = scm_ftell (port); diff --git a/lily/parser.yy b/lily/parser.yy index 195daf46fb..efd69b9150 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -2743,7 +2743,7 @@ bool is_regular_identifier (SCM id) { String str = ly_scm2string (id); - char const *s = str.to_str0 (); + char const *s = str.c_str (); bool v = true; #if 0 diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index 80677d7829..5ca0d358c4 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -152,7 +152,7 @@ Piano_pedal_engraver::try_music (Music *m) { String nm = p->name_ + String ("Event"); if (ly_is_equal (m->get_property ("name"), - scm_str2symbol (nm.to_str0 ()))) + scm_str2symbol (nm.c_str ()))) { Direction d = to_dir (m->get_property ("span-direction")); p->event_drul_[d] = m; @@ -174,7 +174,7 @@ Piano_pedal_engraver::process_music () { String name = String (p->name_) + "PedalLineSpanner"; Music *rq = (p->event_drul_[START] ? p->event_drul_[START] : p->event_drul_[STOP]); - p->line_spanner_ = make_spanner (name.to_str0 (), rq->self_scm ()); + p->line_spanner_ = make_spanner (name.c_str (), rq->self_scm ()); } /* Choose the appropriate grobs to add to the line spanner @@ -191,7 +191,7 @@ Piano_pedal_engraver::process_music () */ String prop = String ("pedal") + p->name_ + "Style"; - SCM style = get_property (prop.to_str0 ()); + SCM style = get_property (prop.c_str ()); bool mixed = style == ly_symbol2scm ("mixed"); bool bracket = (mixed @@ -211,7 +211,7 @@ 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").to_str0 ()); + SCM strings = get_property (("pedal" + String (p->name_) + "Strings").c_str ()); if (scm_ilength (strings) < 3) { @@ -271,7 +271,7 @@ Piano_pedal_engraver::create_text_grobs (Pedal_info *p, bool mixed) { String propname = String (p->name_) + "Pedal"; - p->item_ = make_item (propname.to_str0 (), (p->event_drul_[START] + p->item_ = make_item (propname.c_str (), (p->event_drul_[START] ? p->event_drul_[START] : p->event_drul_[STOP])->self_scm ()); diff --git a/lily/piano-pedal-performer.cc b/lily/piano-pedal-performer.cc index 1dfa092bca..e19feb9e42 100644 --- a/lily/piano-pedal-performer.cc +++ b/lily/piano-pedal-performer.cc @@ -132,7 +132,7 @@ Piano_pedal_performer::try_music (Music *r) { String nm = p->name_ + String ("Event"); if (ly_is_equal (r->get_property ("name"), - scm_str2symbol (nm.to_str0 ()))) + scm_str2symbol (nm.c_str ()))) { Direction d = to_dir (r->get_property ("span-direction")); p->event_drul_[d] = r; diff --git a/lily/pitch.cc b/lily/pitch.cc index 245c866030..6f5ea965ee 100644 --- a/lily/pitch.cc +++ b/lily/pitch.cc @@ -245,7 +245,7 @@ Pitch::print_smob (SCM s, SCM port, scm_print_state *) { Pitch *r = (Pitch *) SCM_CELL_WORD_1 (s); scm_puts ("#to_string ().to_str0 ()), port); + scm_display (scm_makfrom0str (r->to_string ().c_str ()), port); scm_puts (" >", port); return 1; } diff --git a/lily/program-option.cc b/lily/program-option.cc index a9d2329b3c..00e0fc9980 100644 --- a/lily/program-option.cc +++ b/lily/program-option.cc @@ -136,7 +136,7 @@ LY_DEFINE (ly_option_usage, "ly:option-usage", 0, 0, 0, (), "Print ly:set-option usage") { String help = get_help_string (); - fputs (help.to_str0 (), stdout); + fputs (help.c_str (), stdout); exit (0); return SCM_UNSPECIFIED; @@ -177,13 +177,13 @@ LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val), String varstr = ly_scm2string (scm_symbol_to_string (var)); if (varstr.left_string (3) == String ("no-")) { - var = ly_symbol2scm (varstr.nomid_string (0, 3).to_str0 ()); + var = ly_symbol2scm (varstr.nomid_string (0, 3).c_str ()); val = scm_from_bool (!to_boolean (val)); } SCM handle = scm_hashq_get_handle (option_hash, var); if (handle == SCM_BOOL_F) - warning (_f ("no such internal option: %s", varstr.to_str0 ())); + warning (_f ("no such internal option: %s", varstr.c_str ())); internal_set_option (var, val); return SCM_UNSPECIFIED; diff --git a/lily/relocate.cc b/lily/relocate.cc index fec75ee470..d511d21be1 100644 --- a/lily/relocate.cc +++ b/lily/relocate.cc @@ -33,7 +33,7 @@ sane_putenv (char const *key, String value, bool overwrite) if (overwrite || !getenv (key)) { String combine = String (key) + "=" + value; - char *s = strdup (combine.to_str0 ()); + char *s = strdup (combine.c_str ()); return putenv (s); } @@ -66,12 +66,12 @@ prepend_env_path (char const *key, String value) if (is_dir (value)) { if (be_verbose_global) - progress_indication (_f ("%s=%s\n", key, value.to_str0 ())); + progress_indication (_f ("%s=%s\n", key, value.c_str ())); if (char const *cur = getenv (key)) value += to_string (PATHSEP) + cur; - return sane_putenv (key, value.to_str0 (), true); + return sane_putenv (key, value.c_str (), true); } else if (be_verbose_global) warning (_f ("no such directory: %s for %s", value, key)); @@ -100,7 +100,7 @@ prefix_relocation (String prefix) if (be_verbose_global) warning (_f ("Relocation: compile prefix=%s, new prefix=%s", prefix_directory, - prefix.to_str0 ())); + prefix.c_str ())); String bindir = prefix + "/bin"; String datadir = prefix + "/share"; @@ -112,7 +112,7 @@ prefix_relocation (String prefix) #if HAVE_GETTEXT if (is_dir (localedir)) - bindtextdomain ("lilypond", localedir.to_str0 ()); + bindtextdomain ("lilypond", localedir.c_str ()); #endif prepend_env_path ("PATH", bindir); @@ -220,7 +220,7 @@ setup_paths (char const *argv0_ptr) argv0_abs = path.find (argv0_filename.to_string (), ext); #endif /* __MINGW32__ */ - if (argv0_abs.is_empty ()) + if (argv0_abs.empty ()) programming_error ("can't find absolute argv0."); } @@ -259,7 +259,7 @@ setup_paths (char const *argv0_ptr) struct stat statbuf; String build_prefix = prefix_directory + "/share/lilypond/" TOPLEVEL_VERSION; - if (stat (build_prefix.to_str0 (), &statbuf) == 0) + if (stat (build_prefix.c_str (), &statbuf) == 0) prefix_directory = build_prefix; diff --git a/lily/repeat-acknowledge-engraver.cc b/lily/repeat-acknowledge-engraver.cc index 1a22702241..6de07648c1 100644 --- a/lily/repeat-acknowledge-engraver.cc +++ b/lily/repeat-acknowledge-engraver.cc @@ -102,7 +102,7 @@ Repeat_acknowledge_engraver::process_music () if (!scm_is_string (wb) || ly_is_equal (db, wb)) { if (s != "" || (volta_found && !scm_is_string (wb))) - context ()->set_property ("whichBar", scm_makfrom0str (s.to_str0 ())); + context ()->set_property ("whichBar", scm_makfrom0str (s.c_str ())); } } diff --git a/lily/rest.cc b/lily/rest.cc index 552f881109..bc81554df3 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -74,7 +74,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.to_str0 ()); + String actual_style (style.c_str ()); if ((style == "mensural") || (style == "neomensural")) { @@ -136,7 +136,7 @@ Rest::brew_internal_stencil (Grob *me, bool ledgered) 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.to_str0 ())); + me->warning (_f ("rest `%s' not found", font_char.c_str ())); return out.smobbed_copy (); } diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 9decfed405..6acdc3977c 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -108,7 +108,7 @@ Side_position_interface::general_side_position (Grob *me, Axis a, bool use_exten { String msg = String_convert::form_string ("Improbable offset for grob %s: %f%s", - me->name ().to_str0 (), total_off, + me->name ().c_str (), total_off, INTERNAL_UNIT); programming_error (msg); diff --git a/lily/simultaneous-music-iterator.cc b/lily/simultaneous-music-iterator.cc index 33b5bc0472..16691c3e63 100644 --- a/lily/simultaneous-music-iterator.cc +++ b/lily/simultaneous-music-iterator.cc @@ -50,7 +50,7 @@ Simultaneous_music_iterator::construct_children () /* if create_separate_contexts_ is set, create a new context with the number number as name */ - SCM name = ly_symbol2scm (get_outlet ()->context_name ().to_str0 ()); + SCM name = ly_symbol2scm (get_outlet ()->context_name ().c_str ()); Context *t = (j && create_separate_contexts_) ? get_outlet ()->find_create_context (name, to_string (j), SCM_EOL) : get_outlet (); diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index 6005bc076b..d842abfc09 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -435,7 +435,7 @@ Slur_score_state::get_best_curve () // debug quanting slur_->set_property ("quant-score", - scm_makfrom0str (configurations_[opt_idx]->score_card_.to_str0 ())); + scm_makfrom0str (configurations_[opt_idx]->score_card_.c_str ())); #endif diff --git a/lily/source-file.cc b/lily/source-file.cc index f6537edddb..334d10d40f 100644 --- a/lily/source-file.cc +++ b/lily/source-file.cc @@ -50,10 +50,10 @@ gulp_file (String filename, int *filesize) { /* "b" must ensure to open literally, avoiding text (CR/LF) conversions. */ - FILE *f = fopen (filename.to_str0 (), "rb"); + FILE *f = fopen (filename.c_str (), "rb"); if (!f) { - warning (_f ("can't open file: `%s'", filename.to_str0 ())); + warning (_f ("can't open file: `%s'", filename.c_str ())); return 0; } @@ -84,7 +84,7 @@ Source_file::Source_file (String filename, String data) istream_ = 0; contents_str0_ = data.get_copy_str0 (); length_ = data.length (); - pos_str0_ = to_str0 (); + pos_str0_ = c_str (); init_port (); for (int i = 0; i < length_; i++) @@ -106,7 +106,7 @@ Source_file::Source_file (String filename_string) contents_str0_ = gulp_file (filename_string, &length_); } - pos_str0_ = to_str0 (); + pos_str0_ = c_str (); init_port (); @@ -135,7 +135,7 @@ Source_file::get_istream () if (!istream_) { if (length ()) // can-t this be done without such a hack? - istream_ = new istringstream (to_str0 ()); + istream_ = new istringstream (c_str ()); else { istream_ = new istringstream (""); @@ -149,7 +149,7 @@ Source_file::get_istream () String Source_file::file_line_column_string (char const *context_str0) const { - if (!to_str0 ()) + if (!c_str ()) return " (" + _ ("position unknown") + ")"; else { @@ -196,7 +196,7 @@ Source_file::line_slice (char const *pos_str0) const if (!contains (pos_str0)) return Slice (0, 0); - char const *data_str0 = to_str0 (); + char const *data_str0 = c_str (); char const *eof_C_ = data_str0 + length (); if (pos_str0 == eof_C_) @@ -227,7 +227,7 @@ Source_file::line_string (char const *pos_str0) const return ""; Slice line = line_slice (pos_str0); - char const *data_str0 = to_str0 (); + char const *data_str0 = c_str (); return String ((Byte const *)data_str0 + line[LEFT], line.length ()); } @@ -247,12 +247,12 @@ Source_file::get_counts (char const *pos_str0, *line_number = get_line (pos_str0); Slice line = line_slice (pos_str0); - char const *data = to_str0 (); + char const *data = c_str (); Byte const *line_start = (Byte const *)data + line[LEFT]; int left = (Byte const *) pos_str0 - line_start; String line_begin (line_start, left); - char const *line_chars = line_begin.to_str0 (); + char const *line_chars = line_begin.c_str (); *column = 0; *line_char = 0; @@ -301,7 +301,7 @@ Source_file::get_counts (char const *pos_str0, bool Source_file::contains (char const *pos_str0) const { - return (pos_str0 && (pos_str0 >= to_str0 ()) && (pos_str0 <= to_str0 () + length ())); + return (pos_str0 && (pos_str0 >= c_str ()) && (pos_str0 <= c_str () + length ())); } int @@ -339,7 +339,7 @@ Source_file::length () const } char const * -Source_file::to_str0 () const +Source_file::c_str () const { return contents_str0_; } @@ -356,7 +356,7 @@ Source_file::set_pos (char const *pos_str0) char const * Source_file::seek_str0 (int n) { - char const *new_str0 = to_str0 () + n; + char const *new_str0 = c_str () + n; if (n < 0) new_str0 += length (); if (contains (new_str0)) diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 7d1dd3fa6b..9a3a5c1e15 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -185,7 +185,7 @@ Span_bar::calc_glyph_name (SCM smob) else if (type == ":|:") type = ".|."; - return scm_makfrom0str (type.to_str0 ()); + return scm_makfrom0str (type.c_str ()); } Interval diff --git a/lily/spanner.cc b/lily/spanner.cc index 967fc62179..0e3d0fc559 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -45,8 +45,8 @@ Spanner::do_break_processing () if (!parent->spanned_rank_iv ().superset (this->spanned_rank_iv ())) { programming_error (to_string ("Spanner `%s' is not fully contained in parent spanner `%s'.", - name ().to_str0 (), - parent->name ().to_str0 ())); + name ().c_str (), + parent->name ().c_str ())); } } } diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index e6ea5567d9..77770cab3c 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -101,7 +101,7 @@ Staff_performer::stop_translation_timestep () { SCM proc = ly_lily_module_constant ("percussion?"); - SCM drums = scm_call_1 (proc, ly_symbol2scm (instrument_string_.to_str0 ())); + SCM drums = scm_call_1 (proc, ly_symbol2scm (instrument_string_.c_str ())); audio_staff_->channel_ = (drums == SCM_BOOL_T ? 9 : -1); if (name_) { diff --git a/lily/stem.cc b/lily/stem.cc index 18314f1b19..6829af1a35 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -592,7 +592,7 @@ Stem::flag (Grob *me) if (scm_is_string (stroke_style_scm)) { String stroke_style = ly_scm2string (stroke_style_scm); - if (!stroke_style.is_empty ()) + if (!stroke_style.empty ()) { String font_char = to_string (dir) + stroke_style; Stencil stroke = fm->find_by_name ("flags." + font_char); diff --git a/lily/system-start-delimiter-engraver.cc b/lily/system-start-delimiter-engraver.cc index d5adf8ecb9..a8dde07527 100644 --- a/lily/system-start-delimiter-engraver.cc +++ b/lily/system-start-delimiter-engraver.cc @@ -77,7 +77,7 @@ Bracket_nesting_group::create_grobs (Engraver *engraver, SCM default_type) { SCM type = scm_is_symbol (symbol_) ? symbol_ : default_type; delimiter_ = make_spanner_from_properties (engraver, type, - SCM_EOL, ly_symbol2string (type).to_str0 ()); + SCM_EOL, ly_symbol2string (type).c_str ()); for (int i = 0 ; i < children_.size (); i++) { diff --git a/lily/text-metrics.cc b/lily/text-metrics.cc index 84f4210cab..89dbfbd1cb 100644 --- a/lily/text-metrics.cc +++ b/lily/text-metrics.cc @@ -27,7 +27,7 @@ lookup_tex_text_dimension (Font_metric *font, SCM text) if (text_dimension_hash_tab) { scm_hash_ref (text_dimension_hash_tab, - scm_makfrom0str (key_str.to_str0 ()), + scm_makfrom0str (key_str.c_str ()), SCM_BOOL_F); } if (scm_is_pair (val)) @@ -78,7 +78,7 @@ try_load_text_metrics (String basename) String contents (gulp_file_to_string (path, true, -1)); contents = "(quote (" + contents + "))"; - SCM lst = scm_c_eval_string (contents.to_str0 ()); + SCM lst = scm_c_eval_string (contents.c_str ()); ly_load_text_dimensions (lst); } } diff --git a/lily/tfm-reader.cc b/lily/tfm-reader.cc index 1ab0fecf71..bd45cecc7e 100644 --- a/lily/tfm-reader.cc +++ b/lily/tfm-reader.cc @@ -104,7 +104,7 @@ Tex_font_metric_reader::read_header () /* Not using ngettext's plural feature here, as this message is more of a programming error. */ error (_f ("TFM header of `%s' has only %u word (s)", - input_.name_string ().to_str0 (), header_length)); + input_.name_string ().c_str (), header_length)); info_.checksum = input_.get_U32 (); info_.design_size = get_U32_fix (); @@ -137,7 +137,7 @@ Tex_font_metric_reader::read_params () if (header_.param_word_count > TFM_MAX_FONTDIMENS) { warning (_f ("%s: TFM file has %u parameters, which is more than the %u I can handle", - input_.name_string ().to_str0 (), + input_.name_string ().c_str (), header_.param_word_count, TFM_MAX_FONTDIMENS)); header_.param_word_count = TFM_MAX_FONTDIMENS; diff --git a/lily/time-signature.cc b/lily/time-signature.cc index a0f26e6c85..acc057e671 100644 --- a/lily/time-signature.cc +++ b/lily/time-signature.cc @@ -92,9 +92,9 @@ Time_signature::numbered_time_signature (Grob *me, int num, int den) chain); SCM sn = Text_interface::interpret_markup (me->layout ()->self_scm (), chain, - scm_makfrom0str (to_string (num).to_str0 ())); + scm_makfrom0str (to_string (num).c_str ())); SCM sd = Text_interface::interpret_markup (me->layout ()->self_scm (), chain, - scm_makfrom0str (to_string (den).to_str0 ())); + scm_makfrom0str (to_string (den).c_str ())); Stencil n = *unsmob_stencil (sn); Stencil d = *unsmob_stencil (sd); diff --git a/lily/translator-ctors.cc b/lily/translator-ctors.cc index ff5e3823f7..65bfa015fe 100644 --- a/lily/translator-ctors.cc +++ b/lily/translator-ctors.cc @@ -47,7 +47,7 @@ get_translator (SCM sym) global_translator_dict->try_retrieve (sym, &v); if (v == SCM_BOOL_F) - error (_f ("unknown translator: `%s'", ly_symbol2string (sym).to_str0 ())); + error (_f ("unknown translator: `%s'", ly_symbol2string (sym).c_str ())); return unsmob_translator (v); } diff --git a/lily/translator.cc b/lily/translator.cc index 3ab8a1c34c..56d49add46 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -169,7 +169,7 @@ add_acknowledger (Engraver_void_function_engraver_grob_info ptr, interface_name = interface_name.substitute ('_', '-'); interface_name += "-interface"; - inf.symbol_ = scm_gc_protect_object (ly_symbol2scm (interface_name.to_str0 ())); + inf.symbol_ = scm_gc_protect_object (ly_symbol2scm (interface_name.c_str ())); ack_array->push (inf); } diff --git a/lily/ttf.cc b/lily/ttf.cc index 677f4d0179..9cbfd730fc 100644 --- a/lily/ttf.cc +++ b/lily/ttf.cc @@ -88,7 +88,7 @@ print_header (void *out, FT_Face face) static void print_body (void *out, String name) { - FILE *fd = fopen (name.to_str0 (), "rb"); + FILE *fd = fopen (name.c_str (), "rb"); static char xdigits[] = "0123456789ABCDEF"; diff --git a/lily/vaticana-ligature-engraver.cc b/lily/vaticana-ligature-engraver.cc index ca8d042ce2..31005fac31 100644 --- a/lily/vaticana-ligature-engraver.cc +++ b/lily/vaticana-ligature-engraver.cc @@ -345,7 +345,7 @@ check_for_prefix_loss (Item *primitive) 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.to_str0 ())); + prefs.c_str ())); } } @@ -553,7 +553,7 @@ Vaticana_ligature_engraver::transform_heads (Spanner *ligature, if (prev_primitive) prev_primitive->set_property ("glyph-name", - scm_makfrom0str (prev_glyph_name.to_str0 ())); + scm_makfrom0str (prev_glyph_name.c_str ())); /* * In the backend, flexa shapes and joins need to know about line @@ -571,7 +571,7 @@ Vaticana_ligature_engraver::transform_heads (Spanner *ligature, } prev_primitive->set_property ("glyph-name", - scm_makfrom0str (prev_glyph_name.to_str0 ())); + scm_makfrom0str (prev_glyph_name.c_str ())); align_heads (primitives, flexa_width, thickness); diff --git a/lily/vertical-align-engraver.cc b/lily/vertical-align-engraver.cc index 697c0fea9a..ad316bd5e2 100644 --- a/lily/vertical-align-engraver.cc +++ b/lily/vertical-align-engraver.cc @@ -100,7 +100,7 @@ Vertical_align_engraver::acknowledge_axis_group (Grob_info i) { String id = i.context ()->id_string (); - scm_hash_set_x (id_to_group_hashtab_, scm_makfrom0str (id.to_str0 ()), + scm_hash_set_x (id_to_group_hashtab_, scm_makfrom0str (id.c_str ()), i.grob ()->self_scm ()); SCM before_id = i.context ()->get_property ("alignAboveContext"); diff --git a/lily/vertically-spaced-context-engraver.cc b/lily/vertically-spaced-context-engraver.cc index 863f902df9..9fa0f172f1 100644 --- a/lily/vertically-spaced-context-engraver.cc +++ b/lily/vertically-spaced-context-engraver.cc @@ -42,7 +42,7 @@ Vertically_spaced_contexts_engraver::acknowledge_vertically_spaceable (Grob_info SCM spaceable = get_property ("verticallySpacedContexts"); Context *orig = gi.origin_contexts (this)[0]; - if (scm_memq (ly_symbol2scm (orig->context_name ().to_str0 ()), + if (scm_memq (ly_symbol2scm (orig->context_name ().c_str ()), spaceable) != SCM_BOOL_F) { Pointer_group_interface::add_grob (system_, diff --git a/lily/volta-repeat-iterator.cc b/lily/volta-repeat-iterator.cc index b652d81c58..d739949394 100644 --- a/lily/volta-repeat-iterator.cc +++ b/lily/volta-repeat-iterator.cc @@ -98,7 +98,7 @@ Volta_repeat_iterator::next_element (bool side_effect) if (done_count_ <= alt_count_) add_repeat_command (scm_list_n (ly_symbol2scm ("volta"), - scm_makfrom0str (repstr.to_str0 ()), SCM_UNDEFINED)); + scm_makfrom0str (repstr.c_str ()), SCM_UNDEFINED)); } else add_repeat_command (ly_symbol2scm ("end-repeat")); -- 2.39.2