CVSROOT: /cvsroot/lilypond
Module name: lilypond
Branch:
Changes by: Jan Nieuwenhuizen <[EMAIL PROTECTED]> 05/05/15 23:44:07
Modified files:
scm : lily.scm framework-ps.scm backend-library.scm
lily : pango-font.cc lily-guile.cc
flower/include : string.icc string.hh
flower : libc-extension.cc file-path.cc file-name.cc
. : ChangeLog
Log message:
* scm/lily.scm (PLATFORM): Export.
* scm/framework-ps.scm (write-preamble)[MINGW]: Use
load-font-via-GS, ttftool or fopencookie is broken on windows.
* scm/backend-library.scm (postscript->pdf)[MINGW]: Do not use
-dSAFER, that is broken on windows.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/lily.scm.diff?tr1=1.338&tr2=1.339&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/framework-ps.scm.diff?tr1=1.105&tr2=1.106&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/backend-library.scm.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/pango-font.cc.diff?tr1=1.33&tr2=1.34&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/lily-guile.cc.diff?tr1=1.212&tr2=1.213&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/flower/include/string.icc.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/flower/include/string.hh.diff?tr1=1.34&tr2=1.35&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/flower/libc-extension.cc.diff?tr1=1.34&tr2=1.35&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/flower/file-path.cc.diff?tr1=1.32&tr2=1.33&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/flower/file-name.cc.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3620&tr2=1.3621&r1=text&r2=text
Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3620 lilypond/ChangeLog:1.3621
--- lilypond/ChangeLog:1.3620 Sun May 15 21:23:41 2005
+++ lilypond/ChangeLog Sun May 15 23:44:07 2005
@@ -1,3 +1,13 @@
+2005-05-16 Jan Nieuwenhuizen <[EMAIL PROTECTED]>
+
+ * scm/lily.scm (PLATFORM): Export.
+
+ * scm/framework-ps.scm (write-preamble)[MINGW]: Use
+ load-font-via-GS, ttftool or fopencookie is broken on windows.
+
+ * scm/backend-library.scm (postscript->pdf)[MINGW]: Do not use
+ -dSAFER, that is broken on windows.
+
2005-05-15 Han-Wen Nienhuys <[EMAIL PROTECTED]>
* lily/GNUmakefile ($(outdir)/FlexLexer.h): conditional dependency
@@ -7,6 +17,12 @@
2005-05-15 Jan Nieuwenhuizen <[EMAIL PROTECTED]>
+ * lily/lily-guile.cc (ly_scm2newstr): Use scm_i_string_length.
+ Fixes deprecation warning.
+
+ * flower/include/string.icc (to_string): Only inline if
+ -DSTRING_UTILS_INLINED.
+
* lily/pango-font.cc (pango_item_string_stencil): Normalize file
name. Remove windows comment.
Index: lilypond/flower/file-name.cc
diff -u lilypond/flower/file-name.cc:1.9 lilypond/flower/file-name.cc:1.10
--- lilypond/flower/file-name.cc:1.9 Sat May 14 21:43:04 2005
+++ lilypond/flower/file-name.cc Sun May 15 23:44:06 2005
@@ -54,11 +54,8 @@
static String
slashify (String file_name)
{
- if (file_name.index ('/') >= 0)
- return file_name;
file_name.substitute ('\\', '/');
- file_name.substitute ("\"", "\\\"");
- file_name.substitute ("\'", "\\\'");
+ file_name.substitute ("//", "/");
return file_name;
}
#endif /* __MINGW32__ */
Index: lilypond/flower/file-path.cc
diff -u lilypond/flower/file-path.cc:1.32 lilypond/flower/file-path.cc:1.33
--- lilypond/flower/file-path.cc:1.32 Sat May 14 21:43:04 2005
+++ lilypond/flower/file-path.cc Sun May 15 23:44:06 2005
@@ -112,7 +112,8 @@
return name;
#ifdef __MINGW32__
- if (name[0] == '\\' || (name.length () > 2 && name[2] == '\\'))
+ if (name[0] == '\\' || (name.length () > 2 && name[2] == '\\')
+ || name.index ('//'))
programming_error ("file name not normalized: " + name);
#endif /* __MINGW32__ */
Index: lilypond/flower/include/string.hh
diff -u lilypond/flower/include/string.hh:1.34
lilypond/flower/include/string.hh:1.35
--- lilypond/flower/include/string.hh:1.34 Fri May 13 15:45:33 2005
+++ lilypond/flower/include/string.hh Sun May 15 23:44:06 2005
@@ -160,8 +160,7 @@
*/
/// for completeness (=handy)
-inline String to_string (String s) { return s; }
-/// "cccc"
+String to_string (String s);
String to_string (char c, int n = 1);
String to_string (int i, char const *format = 0);
String to_string (double f, char const *format = 0);
@@ -188,22 +187,10 @@
#endif
// because char const* also has an operator ==, this is for safety:
-inline bool operator == (String s1, char const *s2)
-{
- return s1 == String (s2);
-}
-inline bool operator == (char const *s1, String s2)
-{
- return String (s1) == s2;
-}
-inline bool operator != (String s1, char const *s2)
-{
- return s1 != String (s2);
-}
-inline bool operator != (char const *s1, String s2)
-{
- return String (s2) != s1;
-}
+bool operator == (String s1, char const *s2);
+bool operator == (char const *s1, String s2);
+bool operator != (String s1, char const *s2);
+bool operator != (char const *s1, String s2);
IMPLEMENT_ARITHMETIC_OPERATOR (String, +);
#ifdef STREAM_SUPPORT
Index: lilypond/flower/include/string.icc
diff -u lilypond/flower/include/string.icc:1.12
lilypond/flower/include/string.icc:1.13
--- lilypond/flower/include/string.icc:1.12 Wed Mar 16 19:19:15 2005
+++ lilypond/flower/include/string.icc Sun May 15 23:44:06 2005
@@ -9,6 +9,43 @@
#ifndef STRING_ICC
#define STRING_ICC
+/// for completeness (=handy)
+INLINE
+String
+to_string (String s)
+{
+ return s;
+}
+
+// because char const* also has an operator ==, this is for safety:
+INLINE
+bool
+operator == (String s1, char const *s2)
+{
+ return s1 == String (s2);
+}
+
+INLINE
+bool
+operator == (char const *s1, String s2)
+{
+ return String (s1) == s2;
+}
+
+INLINE
+bool
+operator != (String s1, char const *s2)
+{
+ return s1 != String (s2);
+}
+
+INLINE
+bool
+operator != (char const *s1, String s2)
+{
+ return String (s2) != s1;
+}
+
INLINE
char &
String::operator [] (int n)
Index: lilypond/flower/libc-extension.cc
diff -u lilypond/flower/libc-extension.cc:1.34
lilypond/flower/libc-extension.cc:1.35
--- lilypond/flower/libc-extension.cc:1.34 Mon May 2 12:39:28 2005
+++ lilypond/flower/libc-extension.cc Sun May 15 23:44:06 2005
@@ -134,11 +134,13 @@
#if ! HAVE_SNPRINTF
int
-snprintf (char *str, size_t, char const *format, ...)
+snprintf (char *str, size_t n, char const *format, ...)
{
va_list ap;
va_start (ap, format);
int i = vsprintf (str, format, ap);
+ if (i > 0 && (unsigned) i > n)
+ assert (false);
va_end (ap);
return i;
}
@@ -146,9 +148,11 @@
#if ! HAVE_VSNPRINTF
int
-vsnprintf (char *str, size_t, char const *format, va_list args)
+vsnprintf (char *str, size_t n, char const *format, va_list args)
{
int i = vsprintf (str, format, args);
+ if (i > 0 && (unsigned) i > n)
+ assert (false);
return i;
}
#endif
@@ -172,7 +176,6 @@
(int (*) (void *, char const *, int)) fun.write,
(fpos_t (*) (void *, fpos_t, int)) fun.seek,
(int (*) (void *)) fun.close);
-
#endif
}
@@ -215,9 +218,9 @@
va_start (ap, format);
if (is_memory_stream (file))
{
- static char buf[1024];
+ static char buf[65536];
int i = vsnprintf (buf, sizeof (buf), format, ap);
- if (i == -1)
+ if (i == -1 || (unsigned) i > sizeof (buf))
assert (false);
return Memory_out_stream::writer (file, buf, i);
}
Index: lilypond/lily/lily-guile.cc
diff -u lilypond/lily/lily-guile.cc:1.212 lilypond/lily/lily-guile.cc:1.213
--- lilypond/lily/lily-guile.cc:1.212 Mon May 2 12:39:28 2005
+++ lilypond/lily/lily-guile.cc Sun May 15 23:44:06 2005
@@ -135,7 +135,7 @@
{
SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string");
- size_t len = SCM_STRING_LENGTH (str);
+ size_t len = scm_i_string_length (str);
if (char *new_str = (char *) malloc ((len + 1) * sizeof (char)))
{
memcpy (new_str, scm_i_string_chars (str), len);
Index: lilypond/lily/pango-font.cc
diff -u lilypond/lily/pango-font.cc:1.33 lilypond/lily/pango-font.cc:1.34
--- lilypond/lily/pango-font.cc:1.33 Sun May 15 17:20:41 2005
+++ lilypond/lily/pango-font.cc Sun May 15 23:44:06 2005
@@ -140,9 +140,9 @@
FcPattern *fcpat = fcfont->font_pattern;
char *file_name = 0;
FcPatternGetString (fcpat, FC_FILE, 0, (FcChar8 **) & file_name);
-#ifdef __MINGW32__
+#ifdef __MINGW32__
/* Normalize file name. */
- // FIXME: memleak(s?)
+ // FIXME: memleak(s?), drop the #ifdef?
file_name = File_name (file_name).to_string ().get_copy_str0 ();
#endif
Index: lilypond/scm/backend-library.scm
diff -u lilypond/scm/backend-library.scm:1.24
lilypond/scm/backend-library.scm:1.25
--- lilypond/scm/backend-library.scm:1.24 Sat May 14 21:43:04 2005
+++ lilypond/scm/backend-library.scm Sun May 15 23:44:06 2005
@@ -37,7 +37,7 @@
(cmd (format #f
"gs\
-dCompatibilityLevel=1.4 \
- -dSAFER\
+ ~S\
-sPAPERSIZE=~a\
-q\
-dNOPAUSE\
@@ -47,6 +47,9 @@
-c .setpdfwrite\
-f ~S\
"
+ ;; gs on windows with -dSAFER fails on opening a
+ ;; file that has no group read permissions.
+ (if (eq? PLATFORM 'windows) "" "-dSAFER")
(sanitize-command-option papersizename)
pdf-name
name)))
Index: lilypond/scm/framework-ps.scm
diff -u lilypond/scm/framework-ps.scm:1.105 lilypond/scm/framework-ps.scm:1.106
--- lilypond/scm/framework-ps.scm:1.105 Sun May 15 17:20:40 2005
+++ lilypond/scm/framework-ps.scm Sun May 15 23:44:06 2005
@@ -24,7 +24,6 @@
(define mm-to-bigpoint
(/ 72 25.4))
-
(define-public (ps-font-command font)
(let* ((name (munge-lily-font-name (ly:font-file-name font)))
(magnify (ly:font-magnification font)))
@@ -39,7 +38,6 @@
(equal? (substring fontname 0 2) "cm")
(equal? (substring fontname 0 2) "ec")))
-
(define (define-fonts paper)
(define font-list (ly:paper-fonts paper))
(define (define-font command fontname scaling)
@@ -73,7 +71,6 @@
(display (list font fontname)))
(define-font plain fontname scaling)))
-
(apply string-append
(map (lambda (x) (font-load-command x))
(filter (lambda (x) (not (ly:pango-font? x)))
@@ -83,7 +80,7 @@
;; FIXME: silly interface name
(define (output-variables layout)
;; FIXME: duplicates output-layout's scope-entry->string, mostly
- (define (value->string val)
+ (define (value->string val)
(cond
((string? val) (string-append "(" val ")"))
((symbol? val) (symbol->string val))
@@ -115,13 +112,13 @@
(string-append
"%%Page: "
(number->string page-number) " " (number->string page-count) "\n"
-
+
"%%BeginPageSetup\n"
(if landscape?
"page-width output-scale lily-output-units mul mul 0 translate 90
rotate\n"
"")
"%%EndPageSetup\n"
-
+
"start-page { "
"set-ps-scale-to-lily-scale "
"\n"))
@@ -133,10 +130,10 @@
(if (ly:pango-font? font)
(map car (ly:pango-font-physical-fonts font))
(list (munge-lily-font-name (ly:font-name font)))))
-
+
(let* ((fonts (ly:paper-fonts paper))
(names (apply append (map extract-names fonts))))
-
+
(apply string-append
(map (lambda (f)
(format
@@ -195,7 +192,7 @@
(define (cff-font? font)
(let*
- ((cff-string (ly:otf-font-table-data font "CFF ")))
+ ((cff-string (ly:otf-font-table-data font "CFF ")))
(> (string-length cff-string) 0)))
(define-public (ps-embed-cff body font-set-name version)
@@ -231,17 +228,17 @@
(define (write-preamble paper load-fonts? port)
-
+
(define (load-font-via-GS font-name-filename)
(define (ps-load-file name)
(format "(~a) (r) file .loadfont " name))
-
+
(let* ((font (car font-name-filename))
(name (cadr font-name-filename))
(file-name (caddr font-name-filename))
(bare-file-name (ly:find-file file-name)))
- (cons
+ (cons
(munge-lily-font-name name)
(cond
((string-match "([eE]mmentaler|[Aa]ybabtu)" file-name)
@@ -252,14 +249,14 @@
(else
(ly:warning (_ "don't know how to embed ~S=~S") name file-name)
"")))))
-
+
(define (load-font font-name-filename)
(let* ((font (car font-name-filename))
(name (cadr font-name-filename))
(file-name (caddr font-name-filename))
(bare-file-name (ly:find-file file-name)))
- (cons
+ (cons
(munge-lily-font-name name)
(cond
((and bare-file-name (string-match "\\.pfa" bare-file-name))
@@ -275,7 +272,7 @@
((and bare-file-name (string-match "\\.otf" bare-file-name))
(ps-embed-cff (ly:otf->cff bare-file-name) name 0))
-
+
((and bare-file-name (string-match "\\.ttf" bare-file-name))
(ly:ttf->pfa bare-file-name))
@@ -286,7 +283,7 @@
(else
(ly:warning (_ "don't know how to embed ~S=~S") name file-name)
"")))))
-
+
(define (load-fonts paper)
(let* ((fonts (ly:paper-fonts paper))
(all-font-names
@@ -307,14 +304,16 @@
(ly:pango-font-physical-fonts font)))
(else
(ly:font-sub-fonts font))))
-
+
fonts))
(font-names
(uniq-list
(sort (apply append all-font-names)
(lambda (x y) (string<? (cadr x) (cadr y))))))
-
- (pfas (map load-font font-names)))
+ ;; ttftool/fopencookie is broken on Windows,
+ ;; possibly a stack corruption bug.
+ (pfas (map (if (eq? PLATFORM 'windows) load-font-via-GS load-font)
+ font-names)))
pfas))
(if load-fonts?
@@ -324,17 +323,17 @@
(display (cdr f) port)
(display "\n%%EndFont\n" port))
(load-fonts paper)))
-
+
(display (setup paper) port)
- ; adobe note 5002: should initialize variables before loading routines.
+ ;; adobe note 5002: should initialize variables before loading routines.
(display (procset "music-drawing-routines.ps") port)
(display (procset "lilyponddefs.ps") port)
(display "init-lilypond-parameters\n" port))
(define-public (output-framework basename book scopes fields)
(let* ((filename (format "~a.ps" basename))
- (outputter (ly:make-paper-outputter filename "ps"))
+ (outputter (ly:make-paper-outputter filename "ps"))
(paper (ly:paper-book-paper book))
(pages (ly:paper-book-pages book))
(landscape? (eq? (ly:output-def-lookup paper 'landscape) #t))
@@ -344,7 +343,7 @@
(output-scopes scopes fields basename)
(display (page-header paper page-count #t) port)
- (write-preamble paper #t port)
+ (write-preamble paper #t port)
(for-each
(lambda (page)
@@ -365,8 +364,8 @@
(define-public (dump-stencil-as-EPS paper dump-me filename load-fonts?)
(define (mm-to-bp-box mmbox)
- (let* ((scale (ly:output-def-lookup paper 'outputscale))
- (box (map
+ (let* ((scale (ly:output-def-lookup paper 'outputscale))
+ (box (map
(lambda (x)
(inexact->exact
(round (* x scale mm-to-bigpoint)))) mmbox)))
@@ -397,29 +396,23 @@
(display "} stop-system\n%%Trailer\n%%EOF\n" port)
(ly:outputter-close outputter)))
-
(define-public (output-preview-framework basename book scopes fields)
-
(let* ((paper (ly:paper-book-paper book))
(systems (ly:paper-book-systems book))
(scale (ly:output-def-lookup paper 'outputscale))
- (to-dump-systems '())
- )
+ (to-dump-systems '()))
-
-
;; skip booktitles.
(if (and
(not
(cdr (assoc
'preview-include-book-title
- (ly:get-option 'command-line-settings)
- )))
+ (ly:get-option 'command-line-settings))))
(< 1 (length systems))
(ly:paper-system-title? (list-ref systems 0))
(ly:paper-system-title? (list-ref systems 1)))
(set! systems (cdr systems)))
-
+
(for-each
(lambda (sys)
(if (or
@@ -438,12 +431,10 @@
(postprocess-output book framework-ps-module
(format "~a.preview.eps" basename)
- (completize-formats (cons "png" (ly:output-formats))))
-
- ))
+ (completize-formats (cons "png" (ly:output-formats))))))
(if #f
(define-public (output-preview-framework basename book scopes fields)
-
+
(let* ((paper (ly:paper-book-paper book))
(systems (ly:paper-book-systems book))
(scale (ly:output-def-lookup paper 'outputscale))
@@ -461,10 +452,7 @@
(postprocess-output book framework-ps-module
(format "~a.preview.eps" basename)
- (completize-formats (ly:output-formats)))
-
- ))
- )
+ (completize-formats (ly:output-formats))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-public (convert-to-pdf book name)
@@ -486,9 +474,7 @@
(papersizename (ly:output-def-lookup defs 'papersizename)))
(postscript->png resolution
- (if (string? papersizename)
- papersizename "a4")
-
+ (if (string? papersizename) papersizename "a4")
name)))
(define-public (convert-to-dvi book name)
Index: lilypond/scm/lily.scm
diff -u lilypond/scm/lily.scm:1.338 lilypond/scm/lily.scm:1.339
--- lilypond/scm/lily.scm:1.338 Sun May 15 11:45:13 2005
+++ lilypond/scm/lily.scm Sun May 15 23:44:06 2005
@@ -86,7 +86,7 @@
;; Mingw
;; #(Windows XP HOSTNAME build 2600 5.01 Service Pack 1 i686)
;;
-(define PLATFORM
+(define-public PLATFORM
(string->symbol
(string-downcase
(car (string-tokenize (vector-ref (uname) 0) char-set:letter)))))
_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs