From: Jan Nieuwenhuizen Date: Sun, 4 Nov 2001 19:54:52 +0000 (+0100) Subject: partial: 1.5.21.jcn X-Git-Tag: release/1.5.21~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e11dc9a89c31b64615bcdcb8b536621ded30176b;p=lilypond.git partial: 1.5.21.jcn =========== * Fixed direct PostScript output, and changed default fonts. * Bugfix: automaticMelismata in refman (huh, or should lily be changed?) * pktrace: cp mf/out/feta20.* $HOME/usr/src/sketch-0.7.8/Resources/Fontmetrics echo 'TeX-feta20,feta20,Roman,-gnu-feta20-medium-r-normal,adobe-fontspec\ific,feta20' >> $HOME/usr/src/sketch-0.7.8/Resources/Fontmetrics/std.sfd 1.5.3.l --- diff --git a/scm/pysk.scm b/scm/pysk.scm new file mode 100644 index 0000000000..e999e00d25 --- /dev/null +++ b/scm/pysk.scm @@ -0,0 +1,98 @@ +;;; pysk.scm -- implement Python output routines (for Sketch) +;;; +;;; source file of the GNU LilyPond music typesetter +;;; +;;; (c) 1998--2001 Jan Nieuwenhuizen +;;; Han-Wen Nienhuys + + + +(define-module (scm pysk) + :export (pysk-output-expression) + :no-backtrace + ) + +(use-modules (scm ps) + (ice-9 regex) + (ice-9 string-fun) + (guile-user) + (guile) + ) + +(define this-module (current-module)) +(define (pysk-output-expression expr port) + (display (pythonify expr) port ) + ) + +(define (ly-warn s) (display s)) + +(define (pythonify q) + (cond + ((string? q) (py-str q)) + ((symbol? q) (py-str (symbol->string q))) + ((and (pair? q) + (not (pair? (cdr q))) + (not (eq? '() (cdr q))) + ) (py-tuple q)) + ((pair? q) (py-listify q)) + ((number? q) (number->string q)) + ((eq? q '()) '()) + (else (begin + (ly-warn "Unknown object to pythonify:") + (write q) + (newline) + ) + ))) + +(define (py-str s) + (string-append "'" s "'") + ) + +(define (py-tuple q) + (string-append "(" (pythonify (car q)) "," (pythonify (cdr q)) ")") + ) + +(define (reduce-list list between) + "Create new list, inserting BETWEEN between elements of LIST" + (if (null? list) + '() + (if (null? (cdr list)) + list + (cons (car list) + (cons between (reduce-list (cdr list) between))) + + ))) + +(define (string-join str-list sep) + (apply string-append (reduce-list str-list sep)) + ) + +(define (my-map f l) + (if (null? l) + '() + (if (pair? (cdr l)) + (cons (f (car l)) (my-map f (cdr l))) + (cons (f (car l)) (f (cdr l))) + ) + )) + +(define (tuplify-list lst) + (if (null? lst) + '() + (if (pair? (cdr lst)) + (cons (car lst) (tuplify-list (cdr lst))) + (if (eq? '() (cdr lst)) + lst + (list (string-append "(" (car lst) ", " (cdr lst) ")" )) + )) + )) + +(define (py-listify q) + (string-append + "[" + (string-join + (tuplify-list (my-map pythonify q)) ",") + "]\n" + )) + +