]> git.donarmstrong.com Git - lilypond.git/commitdiff
define and use ergonomic-simple-format
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 10 Jun 2007 04:04:22 +0000 (01:04 -0300)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 10 Jun 2007 04:04:22 +0000 (01:04 -0300)
scm/framework-eps.scm
scm/framework-ps.scm
scm/framework-svg.scm
scm/framework-tex.scm
scm/framework-texstr.scm
scm/lily.scm

index 1662491d86fdb4a91ce5cf049061a57bafeac18d..85a4a9863600332d3c77044b92d456068a14cce6 100644 (file)
@@ -19,6 +19,8 @@
             (srfi srfi-13)
             (lily))
 
+(define format ergonomic-simple-format)
+
 (define framework-eps-module (current-module))
 
 
index 0eb622fe48d56d184ab341e28ee429d3e40ff055..5d693358bfe4ed104d78075561cf4b53bd670dec 100644 (file)
             (scm clip-region)
             (lily))
 
-(define (format dest . rest)
-  (if (string? dest)
-      (apply simple-format (cons #f (cons dest rest)))
-      (apply simple-format (cons dest rest))))
+(define format ergonomic-simple-format)
 
 (define framework-ps-module (current-module))
 
index 8f5f34d7c079c8057fe8521d206297f78badc734..87480f1955893dfdee22905f23a585940dd71f64 100644 (file)
@@ -17,6 +17,8 @@
             (srfi srfi-13)
             (ice-9 regex))
 
+(define format ergonomic-simple-format)
+
 (define-public (output-framework basename book scopes fields)
   (let* ((filename (format "~a.svg" basename))
         (outputter  (ly:make-paper-outputter (open-file filename "wb")
@@ -44,8 +46,8 @@
              '(version . "1.2")
 
              ;; Argggghhhh: SVG takes the px <-> mm mapping from the windowing system
-             `(width . ,(format #f "~s" page-width))
-             `(height . ,(format #f "~s" page-height))))
+             `(width . ,(format "~s" page-width))
+             `(height . ,(format "~s" page-height))))
     
     (dump (dump-fonts outputter paper))
     (dump
@@ -75,7 +77,7 @@
 (define (dump-page outputter page page-number page-count landscape? page-set?)
   (define (dump str) (display str (ly:outputter-port outputter)))
   
-  (dump (comment (format #f "Page: ~S/~S" page-number page-count)))
+  (dump (comment (format "Page: ~S/~S" page-number page-count)))
   (if (or landscape? page-set?)
       (dump
        (if landscape?
index 1cf3a08e08502c9df1c3b1a4105969f578375a54..5553b5b442ea19e8dfabb7650c1f3bb0e73f162c 100644 (file)
@@ -19,6 +19,8 @@
             (scm kpathsea)
             (lily))
 
+(define format ergonomic-simple-format)
+
 (define (output-formats)
   (define formats (ly:output-formats))
   (set! formats (completize-formats formats))
@@ -67,7 +69,7 @@
 (define-public (tex-font-command-raw name magnification)
   (string-append
    "magfont"
-   (digits->letters (format #f "~a" name))
+   (digits->letters (format "~a" name))
    "m"
    (string-encode-integer
     (inexact->exact (round (* 1000 magnification))))))
@@ -82,7 +84,7 @@
      (apply string-append
            (map
             (lambda (sub-name)
-              (format #f "\\font\\~a=~a scaled ~a%\n"
+              (format "\\font\\~a=~a scaled ~a%\n"
                       (tex-font-command-raw
                        sub-name (ly:font-magnification font))
                       sub-name
 (define (dump-page putter page last? with-extents?)
   (ly:outputter-dump-string
    putter
-   (format #f "\\lybox{~a}{~a}{%\n"
+   (format "\\lybox{~a}{~a}{%\n"
           (if with-extents?
               (interval-start (ly:stencil-extent page X))
               0.0)
        "}%\n\\vfill\n\\lilypondpagebreak\n")))
 
 (define-public (output-framework basename book scopes fields)
-  (let* ((filename (format #f "~a.tex" basename))
+  (let* ((filename (format "~a.tex" basename))
         (outputter  (ly:make-paper-outputter (open-file filename "wb") 'tex))
         (paper (ly:paper-book-paper book))
         (page-stencils (map page-stencil (ly:paper-book-pages book)))
 (define (dump-line putter line last?)
   (ly:outputter-dump-string
    putter
-   (format #f "\\lybox{~a}{~a}{%\n"
+   (format "\\lybox{~a}{~a}{%\n"
           (ly:number->string
            (max 0 (interval-end (paper-system-extent line X))))
           (ly:number->string
 
 (define-public (output-classic-framework
                basename book scopes fields)
-  (let* ((filename (format #f "~a.tex" basename))
+  (let* ((filename (format "~a.tex" basename))
         (outputter  (ly:make-paper-outputter
                      (open-file filename "w") 'tex))
         (paper (ly:paper-book-paper book))
 
 (define-public (output-preview-framework
                basename book scopes fields)
-  (let* ((filename (format #f "~a.tex" basename))
+  (let* ((filename (format "~a.tex" basename))
         (outputter  (ly:make-paper-outputter (open-file filename "wb")
                                              'tex))
         (paper (ly:paper-book-paper book))
         (papersizename (ly:output-def-lookup paper 'papersizename))
         (landscape? (eq? #t (ly:output-def-lookup paper 'landscape)))
         (base (basename name ".tex"))
-        (ps-name (format #f "~a.ps"  base ".ps"))
+        (ps-name (format "~a.ps"  base ".ps"))
         (cmd (string-append "dvips"
                             (if preview?
                                 " -E"
index ebc6b0c2b214ea8c4d43b802e6fbb83622688646..2dcbebe9fc20df719f9da28676376d026b8a3a54 100644 (file)
@@ -16,6 +16,8 @@
             (srfi srfi-13)
             (lily))
 
+(define format ergonomic-simple-format)
+
 (define (header filename)
   (format  "% header
 \\input{lilypond-tex-metrics}
index 101e94a61c120ff084075298d843d868adf717e1..b85f354e006ebf3c6d0ae46663abae39acd28bb7 100644 (file)
@@ -17,8 +17,6 @@
 (read-enable 'positions)
 (debug-enable 'debug)
 
-
-
 (define scheme-options-definitions
   `(
 
@@ -115,12 +113,15 @@ on errors, and print a stack trace.")
             (scm memory-trace)
             (scm coverage)
             )
-(define-public (format . rest)
-  "We don't want to use ice-9 format, due to its memory use."
+(define-public (ergonomic-simple-format dest . rest)
+  "Like ice-9 format, but without the memory consumption."
   
-  (if (string? (car rest))
-      (apply simple-format (cons #f rest))
-      (apply simple-format rest)))
+  (if (string? dest)
+      (apply simple-format (cons #f (cons dest rest)))
+      (apply simple-format (cons dest rest))))
+
+
+(define format ergonomic-simple-format)
 
 ;; my display
 (define-public (myd k v) (display k) (display ": ") (display v) (display ", ")