X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Flily.scm;h=b8f9a672b7169a249d0d1e5995bcc8146f4a12bf;hb=5bc9118a9fca0752373f52b4aa7d599b8880862f;hp=bccfc72d1d6d801f6fdf6f0f3dcfe403ab1f2c3d;hpb=a3765e1d290e5e49093e7ca7791bf3fe20be1726;p=lilypond.git diff --git a/scm/lily.scm b/scm/lily.scm index bccfc72d1d..b8f9a672b7 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -2,7 +2,7 @@ ;;;; ;;;; source file of the GNU LilyPond music typesetter ;;;; -;;;; (c) 1998--2006 Jan Nieuwenhuizen +;;;; (c) 1998--2007 Jan Nieuwenhuizen ;;;; Han-Wen Nienhuys ;; Internationalisation: (_i "to be translated") gets an entry in the @@ -17,8 +17,6 @@ (read-enable 'positions) (debug-enable 'debug) - - (define scheme-options-definitions `( @@ -31,20 +29,26 @@ (backend ps "which backend to use by default; Options: eps, ps [default], scm, svg, tex, texstr)") (check-internal-types #f "check every property assignment for types") (clip-systems #f "Generate cut-out snippets of a score") + (datadir #f "LilyPond prefix for data files (Readonly).") (debug-gc #f "dump memory debugging statistics") (debug-gc-assert-parsed-dead #f "for memory debugging: ensure that all refs to parsed objects are dead. This is an internal option, and is switched on automatically for -ddebug-gc.") (debug-lexer #f "debug the flex lexer") + (debug-page-breaking-scoring #f "dump scores for many different page breaking configurations") (debug-parser #f "debug the bison parser") + (debug-property-callbacks #f "debug cyclic callback chains") (debug-skylines #f "debug skylines") (delete-intermediate-files #f "delete unusable PostScript files") - (dump-profile #f "dump timing information for each file") + (dump-profile #f "dump memory and time information for each file") + (dump-cpu-profile #f "dump timing information (system-dependent)") (dump-signatures #f "dump output signatures of each system. Used for regression testing.") (eps-box-padding #f "Pad EPS bounding box left edge. Guarantee alignment between systems in LaTeX.") (gs-load-fonts #f "load fonts via Ghostscript.") + (gs-load-lily-fonts #f + "load only lilypond fonts via Ghostscript.") (gui #f "running from gui; redirect stderr to log file") (help #f "show this help.") (include-book-title-preview #t "include book-titles in preview images.") @@ -58,6 +62,8 @@ similar to chord syntax") (point-and-click #t "use point & click") (paper-size "a4" "the default paper size") (pixmap-format "png16m" "GS format to use for pixel images") + (preview #f "make a incipit image. ") + (print-pages #t "print pages normally. ") (protected-scheme-parsing #t "continue when finding errors in inline scheme are caught in the parser. If off, halt on errors, and print a stack trace.") @@ -68,6 +74,7 @@ on errors, and print a stack trace.") (safe #f "Run safely") (strict-infinity-checking #f "If yes, crash on encountering Inf/NaN.") + (strip-output-dir #t "If yes, strip directories from input files.") (separate-log-files #f "Output to FILE.log per file.") (trace-memory-frequency #f "Record Scheme cell usage this many times per second, and dump to file.") (trace-scheme-coverage #f "Record coverage of Scheme files") @@ -100,6 +107,7 @@ on errors, and print a stack trace.") (use-modules (ice-9 regex) (ice-9 safe) + (ice-9 format) (ice-9 rdelim) (ice-9 optargs) (oop goops) @@ -110,6 +118,15 @@ on errors, and print a stack trace.") (scm memory-trace) (scm coverage) ) +(define-public fancy-format format) +(define-public (ergonomic-simple-format dest . rest) + "Like ice-9 format, but without the memory consumption." + + (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 ", ") @@ -124,7 +141,7 @@ on errors, and print a stack trace.") ;;; have a more sensible default. (if (or (ly:get-option 'verbose) - (ly:get-option 'trace-memory-frequencency) + (ly:get-option 'trace-memory-frequency) (ly:get-option 'trace-scheme-coverage) ) (begin @@ -142,14 +159,6 @@ on errors, and print a stack trace.") (define-public parser #f) -(define-public (lilypond-version) - (string-join - (map (lambda (x) (if (symbol? x) - (symbol->string x) - (number->string x))) - (ly:version)) - ".")) - ;; TeX C++ code actually hooks into TEX_STRING_HASHLIMIT (define-public TEX_STRING_HASHLIMIT 10000000) @@ -276,6 +285,14 @@ The syntax is the same as `define*-public'." safe-objects)) ,safe-symbol))) +(define-safe-public (lilypond-version) + (string-join + (map (lambda (x) (if (symbol? x) + (symbol->string x) + (number->string x))) + (ly:version)) + ".")) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; init pitch system @@ -394,13 +411,15 @@ The syntax is the same as `define*-public'." (define (dump-profile base last this) (let* - ((outname (format "~a.profile" (basename base ".ly"))) + ((outname (format "~a.profile" (dir-basename base ".ly"))) (diff (map (lambda (y) (apply - y)) (zip this last)))) (ly:progress "\nWriting timing to ~a..." outname) (format (open-file outname "w") "time: ~a\ncells: ~a\n" - (car diff) + (if (ly:get-option 'dump-cpu-profile) + (car diff) + 0) (cadr diff) ))) @@ -448,9 +467,10 @@ The syntax is the same as `define*-public'." outfile) (format outfile "\nprotected symbols: ~a\n" - (length (filter symbol? (map car protects)))) - - + (apply + (map (lambda (obj-count) (if (symbol? (car obj-count)) + (cdr obj-count) + 0)) + protects))) ;; (display (ly:smob-protects)) (newline outfile) @@ -540,17 +560,27 @@ The syntax is the same as `define*-public'." (define-public (lilypond-main files) "Entry point for LilyPond." - (define (no-files-handler) - (ly:usage) - (exit 2)) - (eval-string (ly:command-line-code)) + + (if (ly:get-option 'help) + (begin + (ly:option-usage) + (exit 0))) + + (if (ly:get-option 'show-available-fonts) + (begin + (ly:font-config-display-fonts) + (exit 0) + )) + (if (ly:get-option 'gui) (gui-main files)) (if (null? files) - (no-files-handler)) + (begin + (ly:usage) + (exit 2))) (if (ly:get-option 'read-file-list) (set! files @@ -634,22 +664,11 @@ The syntax is the same as `define*-public'." (ly:error (_ "failed files: ~S") (string-join failed)) (exit 1)) (begin - (ly:do-atexit) ;; HACK: be sure to exit with single newline (ly:message "") (exit 0))))) (define-public (lilypond-all files) - (if (ly:get-option 'help) - (begin - (ly:option-usage) - (exit 0))) - (if (ly:get-option 'show-available-fonts) - (begin - (ly:font-config-display-fonts) - (exit 0) - )) - (let* ((failed '()) (separate-logs (ly:get-option 'separate-log-files)) (do-measurements (ly:get-option 'dump-profile)) @@ -663,7 +682,7 @@ The syntax is the same as `define*-public'." ((start-measurements (if do-measurements (profile-measurements) #f)) - (base (basename x ".ly")) + (base (dir-basename x ".ly")) (all-settings (ly:all-options))) (if separate-logs @@ -722,7 +741,7 @@ The syntax is the same as `define*-public'." (gui-no-files-handler)) (if (not (string? (ly:get-option 'log-file))) - (let* ((base (basename (car files) ".ly")) + (let* ((base (dir-basename (car files) ".ly")) (log-name (string-append base ".log"))) (if (not (ly:get-option 'gui)) (ly:message (_ "Redirecting output to ~a...") log-name))