@section Finding functions
When making changes or fixing bugs in LilyPond, one of the initial
-challenges is finding out where in the code tree the functions to be
-modified live. With nearly 3000 files in the source tree,
-trial-and-error searching is generally inefective. This section describes
-a process for finding interesting code.
+challenges is finding out where in the code tree the functions to
+be modified live. With nearly 3000 files in the source tree,
+trial-and-error searching is generally ineffective. This section
+describes a process for finding interesting code.
@subsection Using the ROADMAP
be used to search for a function name. The format of the grep command is
@example
-grep functionName subdirectory/*
+grep -i functionName subdirectory/*
@end example
This command will search all the contents of the directory subdirectory/
-and display every line in any of the files that contains functionName.
+and display every line in any of the files that contains
+functionName. The @code{-i} option makes @command{grep} ignore
+case -- this can be very useful if you are not yet familiar with
+our capitalization conventions.
The most likely directories to grep for function names are scm/ for
scheme files, ly/ for lilypond input (*.ly) files, and lily/ for C++
@subsection Classes and Types
@verbatim
- This_is_a_class
+This_is_a_class
@end verbatim
Member variable names end with an underscore:
@verbatim
- Type Class::member_
+Type Class::member_
@end verbatim
@item
Messages to be localised must be encapsulated in `_ (STRING)' or
-`_f (FORMAT, ...)'. Eg:
+`_f (FORMAT, ...)'. E.g.:
@verbatim
warning (_ ("need music in a score"));
a no-op, it only serves as a marker for `xgettext'.
@verbatim
- char const* messages[] = {
- _i ("enable debugging output"),
- _i ("ignore lilypond version"),
- 0
- };
-
-
- void
- foo (int i)
- {
- puts (gettext (messages i));
- }
+char const* messages[] = {
+_i ("enable debugging output"),
+_i ("ignore lilypond version"),
+0
+};
+
+void
+foo (int i)
+{
+puts (gettext (messages i));
+}
@end verbatim
See also `flower/getopt-long.cc' and `lily/main.cc'.
message
@verbatim
- message (Calculating line breaks... + " ");
+message ("Calculating line breaks..." + " ");
@end verbatim
-
+
@item
Error or warning messages displayed with a file name and line
number never start with a capital, eg,
@verbatim
- foo.ly: 12: not a duration: 3
+foo.ly: 12: not a duration: 3
@end verbatim
Messages containing a final verb, or a gerund (`-ing'-form) always
lowercase letter
@verbatim
- Processing foo.ly...
- `foo': not declared.
- Not declaring: `foo'.
+Processing foo.ly...
+`foo': not declared.
+Not declaring: `foo'.
@end verbatim
@item
strings. Numbers are not quoted:
@verbatim
- _f ("cannot open file: `%s'", name_str)
- _f ("cannot find character number: %d", i)
+_f ("cannot open file: `%s'", name_str)
+_f ("cannot find character number: %d", i)
@end verbatim
@item
on the translator. So, instead of
@verbatim
- stem at + moment.str () + does not fit in beam
+stem at + moment.str () + does not fit in beam
@end verbatim
have
@verbatim
- _f ("stem at %s does not fit in beam", moment.str ())
+_f ("stem at %s does not fit in beam", moment.str ())
@end verbatim
@item
Split up multi-sentence messages, whenever possible. Instead of
@verbatim
- warning (_f ("out of tune! Can't find: `%s'",
-"Key_engraver"));
- warning (_f ("cannot find font `%s', loading default",
- font_name));
+warning (_f ("out of tune! Can't find: `%s'", "Key_engraver"));
+warning (_f ("cannot find font `%s', loading default", font_name));
@end verbatim
rather say:
@verbatim
- warning (out of tune:;
- warning (_f ("cannot find: `%s', "Key_engraver"));
- warning (_f ("cannot find font: `%s', font_name));
- warning (_f ("Loading default font"));
+warning (out of tune:;
+warning (_f ("cannot find: `%s', "Key_engraver"));
+warning (_f ("cannot find font: `%s', font_name));
+warning (_f ("Loading default font"));
@end verbatim
@item