]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/lily.scm (chain-assoc-get): bugfix.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 14 Mar 2004 01:46:49 +0000 (01:46 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 14 Mar 2004 01:46:49 +0000 (01:46 +0000)
* lily/paper-book.cc (stencil2line): don't make static SCMs to

ChangeLog
input/test/title-markup.ly
lily/include/paper-book.hh
lily/paper-book.cc
scm/define-markup-commands.scm
scm/lily.scm
scm/page-layout.scm

index 54e4f0e2ded497156c801cb2317b4e13c81403e0..c300eb7669fdb2259943a0b0323f45a4d92c67d3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2004-03-14  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * scm/lily.scm (chain-assoc-get): bugfix.
+
+       * lily/paper-book.cc (stencil2line): don't make static SCMs to
+       
+
        * lily/font-interface.cc (text_font_alist_chain): rename function,
        and use text-font-defaults. 
 
index a4ce65ff14a52d28e763a833d2991604c33c9c51..a1b999f0cdda4c656719f0bac3a31cc2db2181ce 100644 (file)
@@ -65,7 +65,7 @@ spaceTest = \markup { "two space chars" }
        c2-\sizeTest c2-\spaceTest
     }
     \paper {
-       #(paper-set-staff-size (* 11.0 pt)) 
+%      #(paper-set-staff-size (* 11.0 pt)) 
        }
 }
 
index 8a250407333889f124d18d60005d65518d5b91d0..7496ed4646a8a588bf051e58589ee4bf289b84c5 100644 (file)
@@ -24,8 +24,8 @@ public:
   Link_array<Paper_def> papers_;
   Array<SCM> scores_;
   Real height_;
-  Protected_scm copyright_;
-  Protected_scm tagline_;
+  SCM copyright_;
+  SCM tagline_;
 
   Paper_book ();
   void init ();
index 6bcbe0c40e74fd684fbacf159919f0f28ede56c8..09c6253b8d1bbdfc6f9c6c8dd4231728e83b089b 100644 (file)
@@ -23,7 +23,9 @@ static Real const MAX_CRAMP = 0.05;
 static SCM
 stencil2line (Stencil* stil)
 {
-  static SCM z = ly_offset2scm (Offset (0, 0));
+  static SCM z;
+  if (!z)
+    z = scm_permanent_object (ly_offset2scm (Offset (0, 0)));
   Offset dim = Offset (stil->extent (X_AXIS).length (),
                       stil->extent (Y_AXIS).length ());
   return scm_cons (ly_offset2scm (dim),
@@ -202,6 +204,9 @@ Paper_book *paper_book;
 
 Paper_book::Paper_book ()
 {
+  copyright_ = SCM_EOL;
+  tagline_ = SCM_EOL;
+  
   smobify_self ();
 }
 
@@ -471,7 +476,11 @@ Paper_book::mark_smob (SCM smob)
     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;
+
+  scm_gc_mark (pb->copyright_);
+
+  
+  return pb->tagline_;
 }
 
 int
index 6332287c412a676f2c4a71bfdcac26550a10a707..c42aef7c319817003ab649b02561b1adbcc982f1 100644 (file)
@@ -518,18 +518,14 @@ any sort of property supported by @internalsref{font-interface} and
 (def-markup-command (smaller paper props arg) (markup?)
   "Decrease the font size relative to current setting"
   (let* ((fs (chain-assoc-get 'font-size props 0))
-        ;; FIXME: crasher fix
-         ;; (entry (cons 'font-size (- fs 1))))
-         (entry (cons 'font-size (if (number? fs) (- fs 1) 0))))
+        (entry (cons 'font-size (- fs 1))))
     (interpret-markup paper (cons (list entry) props) arg)))
 
 
 (def-markup-command (bigger paper props arg) (markup?)
   "Increase the font size relative to current setting"
   (let* ((fs (chain-assoc-get 'font-size props 0))
-        ;; FIXME: crasher fix
-         ;; (entry (cons 'font-size (+ fs 1))))
-         (entry (cons 'font-size (if (number? fs) (+ fs 1) 0))))
+         (entry (cons 'font-size (+ fs 1))))
     (interpret-markup paper (cons (list entry) props) arg)))
 
 (def-markup-command larger (markup?)
index 3b9e77530dd386196861351e4673276861e85917..7729fdf6133f7e7aa129f2ec048e7b684d8877bf 100644 (file)
 (define (chain-assoc-get x alist-list . default)
   "Return ALIST entry for X. Return DEFAULT (optional, else #f) if not
 found."
-  (if (null? alist-list)
-      (if (pair? default) (car default) #f)
-      (let* ((handle (assoc x (car alist-list))))
-       (if (pair? handle)
-           (cdr handle)
-           (chain-assoc-get x (cdr alist-list) default)))))
+
+  (define (helper x alist-list default)
+    (if (null? alist-list)
+       default
+       (let* ((handle (assoc x (car alist-list))))
+         (if (pair? handle)
+             (cdr handle)
+             (helper x (cdr alist-list) default)))))
+
+  (helper x alist-list
+         (if (pair? default) (car default) #f)))
 
 (define (map-alist-vals func list)
   "map FUNC over the vals of  LIST, leaving the keys."
index 83e0bdb1660d0f68394a6945488867e9d1150739..5d41927d0c92716d6d31c52633124112c9305df1 100644 (file)
        (variable-ref v)
        (if (module? (cdr modules)) (ly:modules-lookup (cdr modules) sym)))))
 
+(define (page-properties paper)
+  (list (append `((linewidth . ,(ly:paper-get-number
+                                paper 'linewidth)))
+               (ly:paper-lookup paper 'text-font-defaults))))
 
 (define-public (book-title paper scopes)
   "Generate book title from header strings."
     (let ((x (ly:modules-lookup scopes sym)))
       (if (and x (not (unspecified? x))) x "")))
   
-  (let ((props (list (append `((linewidth . ,(ly:paper-get-number
-                                             paper 'linewidth))
-                              )
-                            (ly:paper-lookup paper 'text-font-defaults)))))
+  (let ((props (page-properties paper)))
+    
     (interpret-markup
      paper props
      (markup
 (define-public (user-title paper markup)
   "Generate book title from header markup."
   (if (markup? markup)
-      (let ((BASELINE-SKIP 2)
-            (props (list (append `((linewidth . ,(ly:paper-get-number
-                                                 paper 'linewidth))
-                                   (font-family . roman))
-                                 (ly:paper-lookup paper 'font-defaults)))))
+      (let ((props (page-properties paper))
+           (baseline-skip (chain-assoc-get 'baseline-skip props 2)) )
        (stack-lines DOWN 0 BASELINE-SKIP
                     (list (interpret-markup paper props markup))))))
 
     (let ((x (ly:modules-lookup scopes sym)))
       (if (and x (not (unspecified? x))) x "")))
   
-  (let ((props (list (append `((linewidth . ,(ly:paper-get-number
-                                             paper 'linewidth))
-                              (font-family . roman))
-                            (ly:paper-lookup paper 'font-defaults)))))
+  (let ((props (page-properties paper)))
     
     (interpret-markup
      paper props
        #:fill-line (#:large #:bigger #:caps (get 'piece) "")))))))
 
 (define-public (make-header paper page-number)
-  (let ((props (list (append `((linewidth . ,(ly:paper-get-number
-                                             paper 'linewidth))
-                              (font-family . roman))
-                            (ly:paper-lookup paper 'font-defaults)))))
+  (let ((props (page-properties paper) ))
     (interpret-markup paper props
                      (markup #:fill-line
                              ;; FIXME: font not found
                              ("" (number->string page-number))))))
 
 (define-public (make-footer paper page-number)
-  (let ((props (list (append `((linewidth . ,(ly:paper-get-number
-                                             paper 'linewidth))
-                              (font-family . roman))
-                            (ly:paper-lookup paper 'font-defaults)))))
-  (interpret-markup paper props
+  (let ((props (page-properties paper)))
+
+    (interpret-markup paper props
                    (markup #:fill-line ("" (number->string page-number))))))
 
 
   (string-append "Engraved by LilyPond (version " (lilypond-version) ")"))
 
 (define-public (make-tagline paper scopes)
-  (let* ((props (list (append `((linewidth . ,(ly:paper-get-number
-                                              paper 'linewidth))
-                               (font-family . roman))
-                             (ly:paper-lookup paper 'font-defaults))))
+  (let* ((props (page-properties paper))
         (tagline-var (ly:modules-lookup scopes 'tagline))
         (tagline (if (markup? tagline-var) tagline-var TAGLINE)))
+
     (cond ((string? tagline)
           (if (not (equal? tagline ""))
               (interpret-markup paper props
          ((markup? tagline) (interpret-markup paper props tagline)))))
 
 (define-public (make-copyright paper scopes)
-  (let ((props (list (append `((linewidth . ,(ly:paper-get-number
-                                             paper 'linewidth))
-                              (font-family . roman))
-                            (ly:paper-lookup paper 'font-defaults))))
+  (let ((props (page-properties paper))
        (copyright (ly:modules-lookup scopes 'copyright)))
+    
     (cond ((string? copyright)
           (if (not (equal? copyright ""))
               (interpret-markup paper props