}
@end lilypond
-@funindex \voiceXXXStyle
+@funindex \voiceOneStyle
+@funindex \voiceTwoStyle
+@funindex \voiceThreeStyle
+@funindex \voiceFourStyle
+@funindex \voiceNeutralStyle
The commands @code{\voiceXXXStyle} are mainly intended for use in
educational documents such as this one. They modify the color
note head, so that the voices may be easily distinguished.
Voice one is set to red diamonds, voice two to blue triangles,
voice three to green crossed circles, and voice four (not used
-here) to magenta crosses. We shall see later how commands like
-these may be created by the user.
+here) to magenta crosses; @code{\voiceNeutralStyle} (also not
+used here) reverts the style back to the default.
+We shall see later how commands like these may be created by the
+user.
See @ref{Visibility and color of objects} and
@ref{Using variables for tweaks}.
@funindex \voiceTwo
@funindex \voiceThree
@funindex \voiceFour
+@funindex \oneVoice
@funindex \new Voice
@cindex Voice contexts, creating
\score {
\new ChoirStaff {
\new Staff <<
- \context Voice = "verse" {
+ \new Voice = "verse" {
\versenotes \break
<<
\refrainnotesA
string
slashify (string file_name)
{
- replace_all (file_name, '\\', '/');
- replace_all (file_name, string ("//"), "/");
+ replace_all (&file_name, '\\', '/');
+ replace_all (&file_name, string ("//"), "/");
return file_name;
}
{
File_name c = *this;
- replace_all (c.dir_, string ("//"), string ("/"));
+ replace_all (&c.dir_, string ("//"), string ("/"));
vector<string> components = string_split (c.dir_, '/');
vector<string> new_components;
s += string (wid - s.length () + EXTRA_SPACES, ' ');
string help_text (gettext (l[i].help_str0_));
- replace_all (help_text, "\n",
+ replace_all (&help_text, "\n",
"\n" + string (wid + EXTRA_SPACES + 2, ' '));
tabstr += s + help_text + "\n";
}
string to_string (char const *format, ...)
__attribute__ ((format (printf, 1, 2)));
-string &replace_all (string &str, string find, string replace);
-string &replace_all (string &str, char find, char replace);
+string &replace_all (string* str, string const &find, string const &replace);
+string &replace_all (string* str, char find, char replace);
char *string_copy (string s);
int string_compare (string const &, string const &);
TODO: this O(n^2) in #occurences of find, due to repeated copying.
*/
string &
-replace_all (string &str, string find, string replace)
+replace_all (string *str, string const &find, string const &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;
+ for (ssize i = str->find (find); i != NPOS; i = str->find (find, i + len))
+ *str = str->replace (i, len, replace);
+ return *str;
}
string &
-replace_all (string &str, char find, char replace)
+replace_all (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;
+ for (ssize i = str->find (find); i != NPOS; i = str->find (find, i + 1))
+ (*str)[i] = replace;
+ return *str;
}
char *
texidoc = "
Many piano scores have the dynamics centered between the two staves.
This requires a bit of tweaking to implement, but since the template is
-right here, you don't have to do the tweaking yourself.
+right here, you don't have to do the tweaking yourself. Note that
+the two piano staves will move closer together in any system that
+does not contain at least one dynamic marking.
"
doctitle = "Piano template with centered dynamics"
} % begin verbatim
\clef treble
\key c \major
\time 4/4
-
+
a4 b c d
}
\clef bass
\key c \major
\time 4/4
-
+
a2 c
}
% So that \cresc works, for example.
\alias Voice
\consists "Output_property_engraver"
-
+
\override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)
\override DynamicLineSpanner #'Y-offset = #0
pedalSustainStrings = #'("Ped." "*Ped." "*")
pedalUnaCordaStrings = #'("una corda" "" "tre corde")
-
+
\consists "Piano_pedal_engraver"
\consists "Script_engraver"
\consists "Dynamic_engraver"
\consists "Text_engraver"
-
+
\override TextScript #'font-size = #2
\override TextScript #'font-shape = #'italic
-
+
\consists "Skip_event_swallow_translator"
-
+
\consists "Axis_group_engraver"
}
\context {
}
}
\score {
- \new PianoStaff <<
- \new Staff = "upper" << \upper \dynamics \pedal >>
- \new Staff = "lower" << \lower \dynamics \pedal >>
- >>
+ \unfoldRepeats {
+ \new PianoStaff <<
+ \new Staff = "upper" << \upper \dynamics \pedal >>
+ \new Staff = "lower" << \lower \dynamics \pedal >>
+ >>
+ }
\midi {}
}
return SCM_EOL;
}
- Stencil mol (fm->find_by_name (scm_i_string_chars (glyph_name)));
+ Stencil mol (fm->find_by_name (ly_scm2string (glyph_name)));
if (to_boolean (me->get_property ("restore-first")))
{
/*
struct Substitution_entry
{
Grob *grob_;
+
+ /* Assumption: we have less than 32k paper columns. */
short left_;
short right_;
else
{
char s[2] = "a";
- s[0] = (pit->get_notename () + 2) % 7 + 'a';
- s[0] = toupper (s[0]);
+ s[0] = char ((pit->get_notename () + 2) % 7 + 'a');
+ s[0] = char (toupper (s[0]));
charstr = scm_from_locale_string (s);
}
Stencil
Font_metric::find_by_name (string s) const
{
- replace_all (s, '-', 'M');
+ replace_all (&s, '-', 'M');
int idx = name_to_index (s);
Box b;
LY_ASSERT_TYPE (scm_is_string, s, 3);
string ss = ly_scm2string (s);
- replace_all (ss, string (scm_i_string_chars (a)),
- string (scm_i_string_chars (b)));
+ replace_all (&ss, ly_scm2string (a),
+ ly_scm2string (b));
+
return ly_string2scm (ss);
}
}
LY_DEFINE (ly_gettext, "ly:gettext",
- 1, 0, 0, (SCM string),
+ 1, 0, 0, (SCM original),
"A Scheme wrapper function for @code{gettext}.")
{
- LY_ASSERT_TYPE (scm_is_string, string, 1);
- return ly_string2scm (_ (scm_i_string_chars (string)));
+ LY_ASSERT_TYPE (scm_is_string, original, 1);
+ return ly_string2scm (_ (ly_scm2string (original).c_str ()));
}
LY_DEFINE (ly_output_formats, "ly:output-formats",
ly_scm2string (SCM str)
{
assert (scm_is_string (str));
- return string (scm_i_string_chars (str),
- (int) scm_i_string_length (str));
+ string result;
+ size_t len = scm_c_string_length (str);
+ if (len) {
+ result.resize(len);
+ scm_to_locale_stringbuf(str, &result.at(0), len);
+ }
+ return result;
}
SCM
char *
ly_scm2newstr (SCM str, size_t *lenp)
{
- LY_ASSERT_TYPE (scm_is_string, str, 1);
-
- size_t len = scm_i_string_length (str);
- if (char *new_str = (char *) malloc ((len + 1) * sizeof (char)))
- {
- memcpy (new_str, scm_i_string_chars (str), len);
- new_str[len] = '\0';
-
- if (lenp)
- *lenp = len;
-
- return new_str;
- }
- return 0;
+ char* p = scm_to_locale_stringn(str, lenp);
+ return p;
}
-
/*
PAIRS
*/
-SCM
+SCM
index_get_cell (SCM s, Direction d)
{
-
assert (d);
return (d == LEFT) ? scm_car (s) : scm_cdr (s);
}
return scm_ihashv (s, ~1u);
}
-
bool
is_axis (SCM s)
{
else if (cxx_id.substr (cxx_id.length () - 2) == "_x")
cxx_id = cxx_id.replace (cxx_id.length () - 2, 2, "!");
- cxx_id = replace_all (cxx_id, "_less?", "<?");
- cxx_id = replace_all (cxx_id, "_2_", "->");
- cxx_id = replace_all (cxx_id, "__", "::");
- cxx_id = replace_all (cxx_id, '_', '-');
+ replace_all (&cxx_id, "_less?", "<?");
+ replace_all (&cxx_id, "_2_", "->");
+ replace_all (&cxx_id, "__", "::");
+ replace_all (&cxx_id, '_', '-');
return cxx_id;
while (isspace (*symbols))
*symbols++;
string s = symbols;
- replace_all (s, '\n', ' ');
- replace_all (s, '\t', ' ');
- replace_all (s, " ", " ");
+ replace_all (&s, '\n', ' ');
+ replace_all (&s, '\t', ' ');
+ replace_all (&s, " ", " ");
return ly_string_array_to_scm (string_split (s, ' '));
}
unpredictable places. To get around this, we tell the x87 FPU to use only
double precision. Note that this is not needed for x86_64 because that uses
the SSE unit by default instead of the x87 FPU. */
-#ifdef __x86__
+#if defined(__x86__) || defined(__i386__)
#include <fpu_control.h>
static void configure_fpu() {
static void configure_fpu() {
}
-#endif /* __x86__ */
+#endif /* defined(__x86__) || defined(__i386__) */
static void
vector<char> out;
/* don't add '-' before first character */
- out.push_back (tolower (in[0]));
+ out.push_back (char (tolower (in[0])));
for (size_t inpos = 1; inpos < in.size (); inpos++)
{
if (isupper (in[inpos]))
out.push_back ('-');
- out.push_back (tolower (in[inpos]));
+ out.push_back ( char(tolower (in[inpos])));
}
string result (&out[0], out.size ());
- replace_all (result, '_', '-');
+ replace_all (&result, '_', '-');
return result;
}
SCM opt_help_scm
= scm_object_property (sym, ly_symbol2scm ("program-option-documentation"));
string opt_help = ly_scm2string (opt_help_scm);
- replace_all (opt_help,
+ replace_all (&opt_help,
string ("\n"),
string ("\n")
+ String_convert::char_string (' ', HELP_INDENT));
{
/* ev_class is the C++ identifier name. Convert to scm symbol */
string name = string (ev_class);
- name = replace_all (name, '_', '-');
+ name = replace_all (&name, '_', '-');
name += "-event";
SCM class_sym = scm_str2symbol (name.c_str ());
string interface_name (func_name);
- interface_name = replace_all (interface_name, '_', '-');
+ interface_name = replace_all (&interface_name, '_', '-');
interface_name += "-interface";
/*
/* "listen_foo_bar" -> "foo-bar" */
ev_class.erase (0, strlen (prefix));
- replace_all (ev_class, '_', '-');
+ replace_all (&ev_class, '_', '-');
new_ev->origin ()->warning (_f ("Two simultaneous %s events, junking this one", ev_class.c_str ()));
(*old_ev)->origin ()->warning (_f ("Previous %s event here", ev_class.c_str ()));