CVSROOT:        /cvsroot/lilypond
Module name:    lilypond
Branch:         
Changes by:     Han-Wen Nienhuys <[EMAIL PROTECTED]>    05/06/09 17:16:46

Modified files:
        .              : ChangeLog 
        lily           : pfb.cc program-option.cc 
        scm            : backend-library.scm lily.scm 
        ttftool        : parse.c util.c 

Log message:
        * scm/backend-library.scm (postscript->pdf): use
        delete-intermediate-files iso. running-from-gui?
        
        * ttftool/util.c (surely_read): robustness. Allow read() to return
        less bytes than requested, as per posix standards.
        
        * lily/pfb.cc (LY_DEFINE): set ttf_verbosity from ttf-verbosity
        program option.
        
        * lily/program-option.cc: rename from scm-option.cc

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3750&tr2=1.3751&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/pfb.cc.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/program-option.cc.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/backend-library.scm.diff?tr1=1.33&tr2=1.34&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/lily.scm.diff?tr1=1.357&tr2=1.358&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ttftool/parse.c.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ttftool/util.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text

Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3750 lilypond/ChangeLog:1.3751
--- lilypond/ChangeLog:1.3750   Thu Jun  9 16:45:46 2005
+++ lilypond/ChangeLog  Thu Jun  9 17:16:45 2005
@@ -1,5 +1,11 @@
 2005-06-09  Han-Wen Nienhuys  <[EMAIL PROTECTED]>
 
+       * scm/backend-library.scm (postscript->pdf): use
+       delete-intermediate-files iso. running-from-gui? 
+
+       * ttftool/util.c (surely_read): robustness. Allow read() to return
+       less bytes than requested, as per posix standards.
+
        * lily/pfb.cc (LY_DEFINE): set ttf_verbosity from ttf-verbosity
        program option.
 
Index: lilypond/lily/pfb.cc
diff -u lilypond/lily/pfb.cc:1.16 lilypond/lily/pfb.cc:1.17
--- lilypond/lily/pfb.cc:1.16   Thu Jun  9 16:45:47 2005
+++ lilypond/lily/pfb.cc        Thu Jun  9 17:16:46 2005
@@ -17,7 +17,7 @@
 #include "open-type-font.hh"
 #include "main.hh"
 #include "warn.hh"
- 
+
 char *
 pfb2pfa (Byte const *pfb, int length)
 {
Index: lilypond/lily/program-option.cc
diff -u lilypond/lily/program-option.cc:1.2 lilypond/lily/program-option.cc:1.3
--- lilypond/lily/program-option.cc:1.2 Thu Jun  9 16:45:47 2005
+++ lilypond/lily/program-option.cc     Thu Jun  9 17:16:46 2005
@@ -53,6 +53,8 @@
    "include book-titles in preview images."},
   {"gs-font-load", "#f",
    "load fonts via Ghostscript."},
+  {"delete-intermediate-files", "#f",
+   "delete unusable PostScript files"},   
   {"ttf-verbosity", "0",
    "how much verbosity for TTF font embedding?"},
   {0,0,0},
Index: lilypond/scm/backend-library.scm
diff -u lilypond/scm/backend-library.scm:1.33 
lilypond/scm/backend-library.scm:1.34
--- lilypond/scm/backend-library.scm:1.33       Thu Jun  9 14:09:33 2005
+++ lilypond/scm/backend-library.scm    Thu Jun  9 17:16:46 2005
@@ -67,7 +67,9 @@
     (ly:message (_ "Converting to `~a'...") pdf-name)
     (ly:progress "\n")
     (ly:system cmd)
-    (if (running-from-gui?) (delete-file name))))
+    
+    (if (ly:get-option 'delete-intermediate-files)
+       (delete-file name))))
 
 (use-modules (scm ps-to-png))
 (define-public (postscript->png resolution paper-size-name name)
Index: lilypond/scm/lily.scm
diff -u lilypond/scm/lily.scm:1.357 lilypond/scm/lily.scm:1.358
--- lilypond/scm/lily.scm:1.357 Thu Jun  9 14:09:33 2005
+++ lilypond/scm/lily.scm       Thu Jun  9 17:16:46 2005
@@ -344,7 +344,8 @@
       (not have-tty?)))))
 
 (define-public (gui-main files)
-  (if (null? files) (gui-no-files-handler))
+  (if (null? files)
+      (gui-no-files-handler))
   (let* ((base (basename (car files) ".ly"))
         (log-name (string-append base ".log")))
     (if (not (running-from-gui?))
Index: lilypond/ttftool/parse.c
diff -u lilypond/ttftool/parse.c:1.6 lilypond/ttftool/parse.c:1.7
--- lilypond/ttftool/parse.c:1.6        Thu Jun  9 16:45:47 2005
+++ lilypond/ttftool/parse.c    Thu Jun  9 17:16:46 2005
@@ -17,13 +17,12 @@
   int i;
 
   struct TableDirectoryEntry *td;
-  if (ttf_verbosity >= 3)
-    fprintf (stderr, "");
   
   surely_read (fd, ot, sizeof (struct OffsetTable));
   FIX_OffsetTable (*ot);
   if (ttf_verbosity >= 2)
     fprintf (stderr, "%d tables\n", ot->numTables);
+
   n = sizeof (struct TableDirectoryEntry) * ot->numTables;
   td = mymalloc (n);
   surely_read (fd, td, n);
Index: lilypond/ttftool/util.c
diff -u lilypond/ttftool/util.c:1.9 lilypond/ttftool/util.c:1.10
--- lilypond/ttftool/util.c:1.9 Thu Jun  9 16:45:47 2005
+++ lilypond/ttftool/util.c     Thu Jun  9 17:16:46 2005
@@ -78,13 +78,19 @@
     fprintf (stderr, "Reading %d bytes\n", nbyte);
   
   ssize_t n;
-  if ((n = read (fildes, buf, nbyte)) < nbyte)
+  void *bufptr = buf;
+  while (nbyte > 0
+        && (n = read (fildes, bufptr, nbyte)) > 0)
     {
-      char s[100];
-      sprintf (s, "read too little in surely_read(), expect %d got %d", nbyte, 
n);
-      sprintf (s, "trying again yields %d", read (fildes, buf, nbyte - n));
-      syserror (s);
+      bufptr += n;
+      nbyte -= n;
     }
+
+  if (n < 0 || nbyte > 0)
+    {
+      syserror ("error during read()");
+    }
+  
   return n;
 }
 


_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs

Reply via email to