From 4cd5fde58781f8ea5e2e071674cbe0499eb1232e Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 23 Mar 2004 12:42:30 +0000 Subject: [PATCH] * lily/main.cc (main_with_guile): switch debugging. * lily/system.cc (get_line): plug leak. * lily/paper-book.cc (pages): plug memory leaks: delete page array and contents. (stencil2line): plug leak. * Documentation/user/changing-defaults.itely (Determining a grob property): new node. (Layout interfaces): new node. (Navigating the program reference): new node. --- ChangeLog | 8 + Documentation/user/changing-defaults.itely | 185 +++++++++++---------- Documentation/user/lilypond-book.itely | 3 - Documentation/user/notation.itely | 2 +- VERSION | 4 +- lily/include/paper-score.hh | 2 +- lily/include/staff-symbol-referencer.hh | 4 +- lily/main.cc | 2 - lily/paper-book.cc | 24 ++- lily/paper-score.cc | 5 +- lily/system.cc | 4 +- scm/define-music-types.scm | 2 +- scm/document-translation.scm | 10 +- scm/lily.scm | 1 + vim/GNUmakefile | 18 +- 15 files changed, 149 insertions(+), 125 deletions(-) diff --git a/ChangeLog b/ChangeLog index c606093600..b657eb3daf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2004-03-23 Han-Wen Nienhuys + * lily/main.cc (main_with_guile): switch debugging. + + * lily/system.cc (get_line): plug leak. + + * lily/paper-book.cc (pages): plug memory leaks: delete page array + and contents. + (stencil2line): plug leak. + * Documentation/user/changing-defaults.itely (Determining a grob property): new node. (Layout interfaces): new node. diff --git a/Documentation/user/changing-defaults.itely b/Documentation/user/changing-defaults.itely index ed7a7eec2d..861c9856a4 100644 --- a/Documentation/user/changing-defaults.itely +++ b/Documentation/user/changing-defaults.itely @@ -50,7 +50,6 @@ entering numbers, lists, strings and symbols in Scheme. * Fonts:: * Text markup:: * Global layout:: -* Font Size:: * Output details:: @end menu @@ -960,7 +959,6 @@ layout property name: * Navigating the program reference:: * Layout interfaces:: * Determining the grob property:: -* Determining a grob property:: @end menu @@ -1232,9 +1230,6 @@ object interface. Each interface has a number of properties. Some of them are not user-serviceable (``Internal properties''), but others are. -@node Determining the grob property -@subsection Determining the grob property - We have been talking of `the' @code{Fingering} object, but actually it does not amount to much. The initialization file @file{scm/define-grobs.scm} shows the soul of the `object', @@ -1261,8 +1256,9 @@ as you can see, @code{Fingering} is nothing more than a bunch of variable settings, and the webpage is directly generated from this definition. -@node Determining a grob property -@subsection Determining a grob property +@node Determining the grob property +@subsection Determining the grob property + Recall that we wanted to change the position of the @b{2} in @@ -1322,7 +1318,7 @@ also be deduced from the program reference, for the page for the @internalsref{Fingering_engraver} plug-in says @quotation - Fingering_engraver is part of contexts: @dots{} @internalsref{Voice} + Fingering_engraver is part of contexts: @dots{} @b{@internalsref{Voice}} @end quotation @@ -1334,6 +1330,8 @@ also be deduced from the program reference, for the page for the * Font selection:: @end menu + + @node Selecting font sizes @subsection Selecting font sizes @@ -1593,11 +1591,102 @@ are chosen whenever the page gets full. @menu +* Setting global staff size:: * Vertical spacing:: * Horizontal spacing:: +* Line breaking:: +* Page layout:: @end menu +@node Setting global staff size +@subsection Setting global staff size + +@cindex font size, setting +@cindex staff size, setting +@cindex @code{paper} file + +The Feta font provides musical symbols at eight different +sizes. Each font is tuned for a different staff size: at smaller sizes +the font gets heavier, to match the relatively heavier staff lines. +The recommended font sizes are listed in the following table: + +@multitable @columnfractions .25 .25 .25 .25 + +@item @b{font name} +@tab @b{staff height (pt)} +@tab @b{staff height (mm)} +@tab @b{use} + +@item feta11 +@tab 11.22 +@tab 3.9 +@tab pocket scores + +@item feta13 +@tab 12.60 +@tab 4.4 +@tab + +@item feta14 +@tab 14.14 +@tab 5.0 +@tab + +@item feta16 +@tab 15.87 +@tab 5.6 +@tab + +@item feta18 +@tab 17.82 +@tab 6.3 +@tab song books + +@item feta20 +@tab 17.82 +@tab 7.0 +@tab standard parts + +@item feta23 +@tab 22.45 +@tab 7.9 +@tab + +@item feta20 +@tab 25.2 +@tab 8.9 +@tab +@c modern rental material ? + +@end multitable + +These fonts are available in any sizes. The context property +@code{fontSize} and the layout property @code{staff-space} (in +@internalsref{StaffSymbol}) can be used to tune size for individual +staves. The size of individual staves are relative to the global size, +which can be set in the following manner: + +@example + #(set-global-staff-size 14) +@end example + +This sets the global default size to 14pt staff height, and scales all +fonts accordingly. + +@seealso + +This manual: @ref{Selecting font sizes}. + + + +@menu +* Vertical spacing:: +* Horizontal spacing:: +* Line breaking:: +* Page layout:: +@end menu + @node Vertical spacing @subsection Vertical spacing @@ -1765,86 +1854,6 @@ There is no convenient mechanism to manually override spacing. -@node Font Size -@section Font size - -@cindex font size, setting -@cindex staff size, setting -@cindex @code{paper} file - -The Feta font provides musical symbols at eight different -sizes. Each font is tuned for a different staff size: at smaller sizes -the font gets heavier, to match the relatively heavier staff lines. -The recommended font sizes are listed in the following table: - -@multitable @columnfractions .25 .25 .25 .25 - -@item @b{font name} -@tab @b{staff height (pt)} -@tab @b{staff height (mm)} -@tab @b{use} - -@item feta11 -@tab 11.22 -@tab 3.9 -@tab pocket scores - -@item feta13 -@tab 12.60 -@tab 4.4 -@tab - -@item feta14 -@tab 14.14 -@tab 5.0 -@tab - -@item feta16 -@tab 15.87 -@tab 5.6 -@tab - -@item feta18 -@tab 17.82 -@tab 6.3 -@tab song books - -@item feta20 -@tab 17.82 -@tab 7.0 -@tab standard parts - -@item feta23 -@tab 22.45 -@tab 7.9 -@tab - -@item feta20 -@tab 25.2 -@tab 8.9 -@tab -@c modern rental material ? - -@end multitable - -These fonts are available in any sizes. The context property -@code{fontSize} and the layout property @code{staff-space} (in -@internalsref{StaffSymbol}) can be used to tune size for individual -staves. The size of individual staves are relative to the global size, -which can be set in the following manner: - -@example - #(set-global-staff-size 14) -@end example - -This sets the global default size to 14pt staff height, and scales all -fonts accordingly. - -@seealso - -This manual: @ref{Selecting font sizes}. - - @menu * Line breaking:: * Page layout:: diff --git a/Documentation/user/lilypond-book.itely b/Documentation/user/lilypond-book.itely index cea6f98b9b..08fbcac767 100644 --- a/Documentation/user/lilypond-book.itely +++ b/Documentation/user/lilypond-book.itely @@ -364,8 +364,6 @@ fragments in the DVI output only. For getting images in the HTML version, the format @code{texi-html} must be used. -@ignore -@c broken @item @option{-F @var{filter}}, @option{--filter=@var{filter}} Pipe snippets through @var{filter}. @@ -373,7 +371,6 @@ For example: @example lilypond-book --filter='convert-ly --from=2.0.0' my-book.tely @end example -@end ignore @item @option{--help} Print a short help message. diff --git a/Documentation/user/notation.itely b/Documentation/user/notation.itely index 05178a0d43..a01a7c3d1f 100644 --- a/Documentation/user/notation.itely +++ b/Documentation/user/notation.itely @@ -7381,7 +7381,7 @@ used in music for beginners: The command @code{\setEasyHeads} overrides settings for the @internalsref{NoteHead} object. To make the letters readable, it has to be printed in a large font size. To print with a larger font, see -@ref{Font Size}. +@ref{Setting global staff size}. @cindex Xdvi @cindex ghostscript diff --git a/VERSION b/VERSION index e95b04287b..aeaa26a910 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=1 -PATCH_LEVEL=33 -MY_PATCH_LEVEL=hwn1 +PATCH_LEVEL=34 +MY_PATCH_LEVEL= diff --git a/lily/include/paper-score.hh b/lily/include/paper-score.hh index f6db4de575..43bc6a5836 100644 --- a/lily/include/paper-score.hh +++ b/lily/include/paper-score.hh @@ -34,7 +34,7 @@ protected: virtual SCM process (String); private: - Protected_scm score_; + Protected_scm systems_; void preprocess (); void calc_idealspacing (); diff --git a/lily/include/staff-symbol-referencer.hh b/lily/include/staff-symbol-referencer.hh index 3a4b5946ab..34fe6a9b27 100644 --- a/lily/include/staff-symbol-referencer.hh +++ b/lily/include/staff-symbol-referencer.hh @@ -21,7 +21,6 @@ class Staff_symbol_referencer { public: - static bool has_interface (Grob*); static bool ugly_hack (Grob*); static void set_position (Grob*,Real); @@ -31,10 +30,9 @@ public: Leading are the lead strips between the sticks (lines) of typeface. ie. leading is vertical space. */ - static Real line_thickness (Grob*); static Real staff_space (Grob*); - static Grob * get_staff_symbol (Grob*); + static Grob *get_staff_symbol (Grob*); static bool on_staffline (Grob*); static bool on_staffline (Grob*,int); static int line_count (Grob*); diff --git a/lily/main.cc b/lily/main.cc index ba7bddf161..a2a9ceec93 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -285,14 +285,12 @@ main_with_guile (void *, int, char **) bool first = true; while (char const *arg = option_parser->get_next_arg ()) { - #if 0 /* Code to debug memory leaks. Cannot call from within .ly since then we get the protects from the parser state too. */ scm_gc (); scm_call_0 (ly_scheme_function ("dump-gc-protects")); #endif - do_one_file (arg); first = false; } diff --git a/lily/paper-book.cc b/lily/paper-book.cc index 8c684df911..4f48f7a5ad 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -30,7 +30,8 @@ stencil2line (Stencil* stil, bool is_title = false) stil->extent (Y_AXIS).length ()); Paper_line *pl = new Paper_line (dim, scm_cons (stil->smobbed_copy (), SCM_EOL), is_title); - return pl->self_scm (); + + return scm_gc_unprotect_object (pl->self_scm ()); } /* Simplistic page interface */ @@ -261,6 +262,15 @@ Paper_book::output (String outname) (*pages)[i]->output (out, i + 1 == page_count); out->output_scheme (scm_list_1 (ly_symbol2scm ("end-output"))); + + /* + Ugh + */ + for (int i =pages->size (); i--;) + delete pages->elem(i); + delete pages; + + progress_indication ("\n"); } @@ -397,12 +407,11 @@ Paper_book::pages () SCM all = lines (); SCM proc = paper->get_scmvar ("page-breaking"); - SCM breaks = scm_apply_0 (proc, scm_list_n (all, - gh_double2scm (height_), - gh_double2scm (text_height), - gh_double2scm (-copy_height), - gh_double2scm (-tag_height), - SCM_UNDEFINED)); + SCM breaks = scm_apply_0 (proc, scm_list_n (all, gh_double2scm (height_), + gh_double2scm (text_height), + gh_double2scm (-copy_height), + gh_double2scm (-tag_height), + SCM_UNDEFINED)); /* Copyright on first page. */ if (unsmob_stencil (copyright_)) @@ -432,6 +441,7 @@ Paper_book::pages () /* Tagline on last page. */ if (unsmob_stencil (tagline_)) page->tagline_ = tagline_; + return pages; } diff --git a/lily/paper-score.cc b/lily/paper-score.cc index 92f27355f6..1eab7f80f6 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -31,7 +31,6 @@ Paper_score::Paper_score () { paper_ = 0; system_ = 0; - score_ = SCM_EOL; } Paper_score::Paper_score (Paper_score const &s) @@ -46,7 +45,7 @@ Paper_score::typeset_line (System *system) if (!system_) system_ = system; - score_ = gh_cons (system->self_scm (), score_); + systems_ = gh_cons (system->self_scm (), systems_); system->pscore_ = this; scm_gc_unprotect_object (system->self_scm ()); @@ -92,7 +91,7 @@ Paper_score::process (String) progress_indication ("\n"); /* Only keep result stencils in lines_, *title_; delete all grobs. */ - score_ = SCM_EOL; + systems_ = SCM_EOL; return lines; } diff --git a/lily/system.cc b/lily/system.cc index f0633da0c3..0237dbbd3f 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -424,7 +424,7 @@ System::get_line () /* must copy the stencil, for we cannot change the stencil cached in G. - */ + */ SCM my_stencil = stil->smobbed_copy (); unsmob_stencil (my_stencil)->translate (o + extra); stencils = scm_cons (my_stencil, stencils); @@ -445,6 +445,8 @@ System::get_line () Interval y (extent (this, Y_AXIS)); Paper_line *pl = new Paper_line (Offset (x.length (), y.length ()), stencils); + + scm_gc_unprotect_object (pl->self_scm ()); return pl->self_scm (); } diff --git a/scm/define-music-types.scm b/scm/define-music-types.scm index 62e5ab8df2..68f6357b58 100644 --- a/scm/define-music-types.scm +++ b/scm/define-music-types.scm @@ -33,7 +33,7 @@ Call the argument with all current grobs during interpreting phase. Syntax -\applyoutput FUNC +\\applyoutput FUNC arguments to func are 1. the grob, 2. the originating context, 3. context where FUNC is called. diff --git a/scm/document-translation.scm b/scm/document-translation.scm index 1fa883a977..5ebdc811be 100644 --- a/scm/document-translation.scm +++ b/scm/document-translation.scm @@ -133,7 +133,7 @@ (eg (find-engraver-by-name name )) ) - (cons (symbol->string name ) + (cons (string-append "@code{" (ref-ify (symbol->string name)) "}") (engraver-doc-string eg #f) ) )) @@ -205,8 +205,10 @@ #:text (string-append desc - "\n\n This context is also known as: \n\n" - (human-listify aliases) + (if (pair? aliases) + (string-append "\n\n This context is also known as: \n\n" + (human-listify aliases)) + "") "\n\nThis context creates the following layout objects: \n\n" (human-listify (uniq-list (sort grob-refs stringtexi - (map document-engraver-by-name consists)) + (map document-engraver-by-name consists)) )))) (define (engraver-grobs grav) diff --git a/scm/lily.scm b/scm/lily.scm index 1cd2fc684b..2360da093a 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -503,6 +503,7 @@ L1 is copied, L2 not. ) "w")) ) + (display "DUMPING...\n") (display (filter (lambda (x) (not (symbol? x))) diff --git a/vim/GNUmakefile b/vim/GNUmakefile index ae98124e8d..a52855eae9 100644 --- a/vim/GNUmakefile +++ b/vim/GNUmakefile @@ -4,6 +4,15 @@ INSTALLATION_OUT_DIR=$(vimdir)/syntax INSTALLATION_OUT_FILES=$(LILYPOND_WORDS) # $(outdir)/lilypond-words $(outdir)/lilypond-words.el +EXTRA_DIST_FILES=$(wildcard *.vim) vimrc + +LILYPOND_WORDS = $(outdir)/lilypond-words $(outdir)/lilypond-words.vim +LILYPOND_WORDS_DEPENDS =\ + $(topdir)/lily/my-lily-lexer.cc \ + $(buildscript-dir)/lilypond-words.py \ + $(topdir)/scm/new-markup.scm \ + $(topdir)/ly/engraver-init.ly + STEPMAKE_TEMPLATES=install-out # vimdir defined in config.make @@ -41,15 +50,6 @@ local-uninstall: rm $(vimdir)/syntax/lilypond.vim rmdir -p $(vimdir)/syntax -EXTRA_DIST_FILES=filetype.vim vimrc - -LILYPOND_WORDS = $(outdir)/lilypond-words $(outdir)/lilypond-words.vim -LILYPOND_WORDS_DEPENDS =\ - $(topdir)/lily/my-lily-lexer.cc \ - $(buildscript-dir)/lilypond-words.py \ - $(topdir)/scm/new-markup.scm \ - $(topdir)/ly/engraver-init.ly - $(LILYPOND_WORDS): cd $(topdir) && $(PYTHON) buildscripts/lilypond-words.py --words --vim --dir=$(builddir)/vim/$(outconfbase) -- 2.39.5