From 25db659c539eba1b69214118d745ea0639e91e01 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 23 Jan 2006 21:28:10 +0000 Subject: [PATCH] * flower/international.cc: * flower/include/international.hh: --- ChangeLog | 6 +++++- flower/include/international.hh | 8 ++++---- flower/international.cc | 16 ++++++++-------- lily/general-scheme.cc | 2 +- lily/includable-lexer.cc | 2 +- lily/lexer.ll | 8 ++++---- lily/main.cc | 34 ++++++++++++++++----------------- 7 files changed, 40 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index b27db6b3b7..1db760ac20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,14 @@ 2006-01-23 Jan Nieuwenhuizen - * flower/include/std-string.hh: Oops, bugfix for --disable-std-string. + * flower/international.cc: + * flower/include/international.hh: + * flower/getopt-long.cc: * flower/include/getopt-long.hh: Use std::string [interface]. Update callers. + * flower/include/std-string.hh: Oops, bugfix for --disable-std-string. + * stepmake/stepmake/executable-rules.make: Add dependency on module libraries. diff --git a/flower/include/international.hh b/flower/include/international.hh index 4b37b7ecbb..bba4a5a330 100644 --- a/flower/include/international.hh +++ b/flower/include/international.hh @@ -9,7 +9,7 @@ #ifndef INTERNATIONAL_HH #define INTERNATIONAL_HH -#include "string.hh" +#include "std-string.hh" /** Internationalisation: _i ("to be translated") gets an entry in the POT file @@ -22,14 +22,14 @@ /** Internationalisation: _ ("to be translated") gets "translated" by GNU gettext */ -String _ (char const *ch); +Std_string _ (char const *ch); /** Internationalisation: _f ("Usage: %s [FILE]", "lilypond") gets "translated" by GNU gettext */ -String _f (char const *format, ...); -String _f (char const *format, String s, String s2 = "", 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/international.cc b/flower/international.cc index 1bdc1a3b90..9d9e824eea 100644 --- a/flower/international.cc +++ b/flower/international.cc @@ -19,25 +19,25 @@ gettext (char const *s) #include #endif -String +Std_string _ (char const *ch) { - return String (gettext (ch)); + return Std_string (gettext (ch)); } -String +Std_string _f (char const *format, ...) { va_list args; va_start (args, format); - String str = String_convert::vform_string (gettext (format), args); + Std_string str = String_convert::vform_string (gettext (format), args); va_end (args); return str; } -String -_f (char const *format, String s, String s2, 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.to_str0 (), s2.to_str0 (), - s3.to_str0 ()); + return String_convert::form_string (gettext (format), s.c_str (), s2.c_str (), + s3.c_str ()); } diff --git a/lily/general-scheme.cc b/lily/general-scheme.cc index b77914dd3e..fca5c81732 100644 --- a/lily/general-scheme.cc +++ b/lily/general-scheme.cc @@ -209,7 +209,7 @@ LY_DEFINE (ly_gettext, "ly:gettext", { SCM_ASSERT_TYPE (scm_is_string (string), string, SCM_ARG1, __FUNCTION__, "string"); - return scm_makfrom0str (_ (scm_i_string_chars (string)).to_str0 ()); + return scm_makfrom0str (_ (scm_i_string_chars (string)).c_str ()); } LY_DEFINE (ly_output_backend, "ly:output-backend", diff --git a/lily/includable-lexer.cc b/lily/includable-lexer.cc index a8edb0f16d..1ec8bcbbad 100644 --- a/lily/includable-lexer.cc +++ b/lily/includable-lexer.cc @@ -48,7 +48,7 @@ Includable_lexer::new_input (String name, Sources *sources) { if (!allow_includes_b_) { - LexerError (_ ("include files are not allowed in safe mode").to_str0 ()); + LexerError (_ ("include files are not allowed in safe mode").c_str ()); return; } diff --git a/lily/lexer.ll b/lily/lexer.ll index 7189daf623..2aa5551d7d 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -153,7 +153,7 @@ BOM_UTF8 \357\273\277 {BOM_UTF8} { if (this->lexloc->line_number () != 1 || this->lexloc->column_number () != 0) { - LexerError (_ ("stray UTF-8 BOM encountered").to_str0 ()); + LexerError (_ ("stray UTF-8 BOM encountered").c_str ()); exit (1); } if (be_verbose_global) @@ -209,11 +209,11 @@ BOM_UTF8 \357\273\277 } . { - LexerError (_ ("quoted string expected after \\version").to_str0 ()); + LexerError (_ ("quoted string expected after \\version").c_str ()); yy_pop_state (); } >. { - LexerError (_ ("quoted string expected after \\sourcefilename").to_str0 ()); + LexerError (_ ("quoted string expected after \\sourcefilename").c_str ()); yy_pop_state (); } { @@ -226,7 +226,7 @@ BOM_UTF8 \357\273\277 yy_pop_state (); } <> { - LexerError (_ ("EOF found inside a comment").to_str0 ()); + LexerError (_ ("EOF found inside a comment").c_str ()); is_main_input_ = false; if (! close_input ()) yyterminate (); // can't move this, since it actually rets a YY_NULL diff --git a/lily/main.cc b/lily/main.cc index 715a83186c..e2a0ea20e9 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -219,14 +219,14 @@ copyright () { printf (_f ("Copyright (c) %s by\n%s and others.", "1996--2006", - AUTHORS).to_str0 ()); + AUTHORS).c_str ()); printf ("\n"); } static void identify (FILE *out) { - fputs (gnu_lilypond_version_string ().to_str0 (), out); + fputs (gnu_lilypond_version_string ().c_str (), out); fputs ("\n", out); } @@ -234,7 +234,7 @@ static void notice () { identify (stdout); - puts (_f (NOTICE, PROGRAM_NAME).to_str0 ()); + puts (_f (NOTICE, PROGRAM_NAME).c_str ()); printf ("\n"); copyright (); } @@ -244,21 +244,21 @@ LY_DEFINE (ly_usage, "ly:usage", "Print usage message.") { /* No version number or newline here. It confuses help2man. */ - printf (_f ("Usage: %s [OPTION]... FILE...", PROGRAM_NAME).to_str0 ()); + printf (_f ("Usage: %s [OPTION]... FILE...", PROGRAM_NAME).c_str ()); printf ("\n\n"); - printf (_ ("Typeset music and/or produce MIDI from FILE.").to_str0 ()); + printf (_ ("Typeset music and/or produce MIDI from FILE.").c_str ()); printf ("\n\n"); - printf (_ ("LilyPond produces beautiful music notation.").to_str0 ()); + printf (_ ("LilyPond produces beautiful music notation.").c_str ()); printf ("\n"); - printf (_f ("For more information, see %s", PROGRAM_URL).to_str0 ()); + printf (_f ("For more information, see %s", PROGRAM_URL).c_str ()); printf ("\n\n"); - printf (_ ("Options:").to_str0 ()); + printf (_ ("Options:").c_str ()); printf ("\n"); printf (Long_option_init::table_string (options_static).c_str ()); printf ("\n"); printf (_f ("Report bugs via %s", "http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs" - ).to_str0 ()); + ).c_str ()); printf ("\n"); printf ("\n"); return SCM_UNSPECIFIED; @@ -271,14 +271,14 @@ warranty () printf ("\n"); copyright (); printf ("\n"); - printf (_ (WARRANTY).to_str0 ()); + printf (_ (WARRANTY).c_str ()); } static void prepend_load_path (String dir) { String s = "(set! %load-path (cons \"" + dir + "\" %load-path))"; - scm_c_eval_string (s.to_str0 ()); + scm_c_eval_string (s.c_str ()); } void init_global_tweak_registry (); @@ -311,7 +311,7 @@ do_chroot_jail () errno = 0; int uid; - if (passwd * passwd = getpwnam (components[USER_NAME].to_str0 ())) + if (passwd * passwd = getpwnam (components[USER_NAME].c_str ())) uid = passwd->pw_uid; else { @@ -328,7 +328,7 @@ do_chroot_jail () errno = 0; int gid; - if (group * group = getgrnam (components[GROUP_NAME].to_str0 ())) + if (group * group = getgrnam (components[GROUP_NAME].c_str ())) gid = group->gr_gid; else { @@ -341,7 +341,7 @@ do_chroot_jail () exit (3); } - if (chroot (components[JAIL].to_str0 ())) + if (chroot (components[JAIL].c_str ())) { error (_f ("can't chroot to: %s: %s", components[JAIL], strerror (errno))); @@ -360,7 +360,7 @@ do_chroot_jail () exit (3); } - if (chdir (components[DIR].to_str0 ())) + if (chdir (components[DIR].c_str ())) { error (_f ("can't change working directory to: %s: %s", components[DIR], strerror (errno))); @@ -406,7 +406,7 @@ main_with_guile (void *, int, char **) + init_scheme_code_string + ")"; - char const *str0 = init_scheme_code_string.to_str0 (); + char const *str0 = init_scheme_code_string.c_str (); if (be_verbose_global) progress_indication (_f ("Evaluating %s", str0)); @@ -454,7 +454,7 @@ setup_localisation () if (char const *env = getenv ("LILYPOND_LOCALEDIR")) localedir = env; - bindtextdomain ("lilypond", localedir.to_str0 ()); + bindtextdomain ("lilypond", localedir.c_str ()); textdomain ("lilypond"); #endif } -- 2.39.2