* lily/paper-book.cc (mark_smob): implement smob marking.
2004-03-10 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/score.cc (default_rendering): clean protection.
+
+ * lily/paper-book.cc (mark_smob): implement smob marking.
+
* scripts/lilypond.py (make_html_menu_file): remove --psgz option
* Documentation/user/*.itely: user manual edits.
Cyclic references in Scheme values for properties can cause hangs
and/or crashes.
-@menu
-* Constructing a tweak::
-* Applyoutput::
-* Font selection::
-* Text markup::
-@end menu
@node Constructing a tweak
@subsection Constructing a tweak
font series for each font family and shape. Choices are @code{medium}
and @code{bold}.
-@end table
-
+@end itemize
Fonts selected in the way sketched above come from a predefined style
sheet.
@item relative, relative=@var{N}
uses relative octave mode. By default, notes are specified relative
to middle C. The optional integer argument specifies the octave of the
+@item relative, relative=@var{N}
+uses relative octave mode. By default, notes are specified relative
+to middle C. The optional integer argument specifies the octave of the
+starting note, where the default @code{1} is middle C.
+@end table
+
+
+@node Invoking lilypond-book
+@section Invoking lilypond-book
+
+
+Running @command{lilypond-book} generates lots of small files that
+LilyPond will process. To avoid all that garbage in the source
+directory use the @option{--output} command line option, and change to
+that directory before running La@TeX{} or @file{makeinfo}:
+
@example
lilypond-book --output=out yourfile.lytex
cd out && latex yourfile.tex
r
}
\context Lyrics \lyrics {
- \override LyricText #'font = #'typewriter
+ \override LyricText #'font-family = #'typewriter
"shortfermata" "fermata" "longfermata" "verylongfermata"
} >>
}
the `paper' definition
@item props
a list of alists, containing all active properties.
-@end lisp
+@end table
As a simple example, we show how to add a @code{\smallcaps} command,
which selects @TeX{}'s small caps font. Normally, we could select the
@example
#(def-markup-command (smallcaps paper props str) (string?)
- "Print the string argument in small caps. Syntax: \\smallcaps #\"string\""
+ "Print the string argument in small caps."
(interpret-markup paper props
(make-line-markup
(map (lambda (s)
@menu
* Context evaluation::
-* Applyoutput::
+* Running a function on all layout objects::
@end menu
@node Context evaluation
class Paper_book
{
public:
- Protected_scm protect_;
Array<SCM> headers_;
Array<SCM> global_headers_;
Link_array<Paper_def> papers_;
Stencil* get_title (int);
void output (String);
void classic_output (String);
-
- SCM smobbed_copy () const;
-
-private:
- DECLARE_SIMPLE_SMOBS (Paper_book, )
+ DECLARE_SMOBS (Paper_book, )
};
DECLARE_UNSMOB (Paper_book, paper_book)
if (!proc)
proc = scm_c_eval_string ("dump-gc-protects");
- Paper_book book;
- paper_book = &book;
+ paper_book = new Paper_book ();;
Input_file_results inp_file (init, in_file, out_file);
if (output_format_global == PAGE_LAYOUT)
- book.output (out_file);
+ paper_book->output (out_file);
+
+ scm_gc_unprotect_object (paper_book->self_scm ());
+ paper_book = 0;
}
return h;
}
+/****************************************************************/
-Paper_book *paper_book;
+
+Paper_book *paper_book; // huh? global var? --hwn
Paper_book::Paper_book ()
{
- protect_ = SCM_EOL;
+ smobify_self ();
}
void
#include "ly-smobs.icc"
IMPLEMENT_DEFAULT_EQUAL_P (Paper_book);
-IMPLEMENT_SIMPLE_SMOBS (Paper_book)
-IMPLEMENT_TYPE_P (Paper_book, "ly:paper_book?")
+IMPLEMENT_SMOBS (Paper_book)
+IMPLEMENT_TYPE_P (Paper_book, "ly:paper-book?")
SCM
Paper_book::mark_smob (SCM smob)
{
- Paper_book *b = (Paper_book*) SCM_CELL_WORD_1 (smob);
-
-#if 0 //TODO
- scm_gc_mark (b->scores_);
- scm_gc_mark (b->global_headers_);
- scm_gc_mark (b->headers_);
- scm_gc_mark (b->papers_);
-#endif
-
+ Paper_book *pb = (Paper_book*) SCM_CELL_WORD_1 (smob);
+ for (int i = 0; i < pb->headers_.size (); i++)
+ scm_gc_mark (pb->headers_[i]);
+ for (int i = 0; i < pb->global_headers_.size (); i++)
+ scm_gc_mark (pb->global_headers_[i]);
+ for (int i = 0; i < pb->papers_.size (); i++)
+ scm_gc_mark (pb->papers_[i]->self_scm ());
+ for (int i = 0; i < pb->scores_.size (); i++)
+ scm_gc_mark (pb->scores_[i]);
return SCM_EOL;
}
return 1;
}
-SCM
-Paper_book::smobbed_copy () const
+Paper_book::~Paper_book ()
{
- Paper_book *b = new Paper_book (*this);
- return b->smobbed_self ();
}
+
if (systems != SCM_UNDEFINED)
{
Paper_score *ps = dynamic_cast<Paper_score*> (output);
-#if 1
- paper_book->protect_ = scm_cons (systems, paper_book->protect_);
- paper_book->protect_ = scm_cons (global_input_file->header_,
- paper_book->protect_);
- paper_book->protect_ = scm_cons (header, paper_book->protect_);
- paper_book->protect_ = scm_cons (ps->paper_->smobbed_copy (),
- paper_book->protect_);
-#endif
+
paper_book->papers_.push (ps->paper_);
paper_book->scores_.push (systems);
paper_book->global_headers_.push (global_input_file->header_);