]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/backend-library.scm (postscript->pdf): use
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 9 Jun 2005 17:16:46 +0000 (17:16 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 9 Jun 2005 17:16:46 +0000 (17:16 +0000)
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

ChangeLog
lily/pfb.cc
lily/program-option.cc
scm/backend-library.scm
scm/lily.scm
ttftool/parse.c
ttftool/util.c

index 1e8d5a8d9beffad5b8de73c3a2746455efe9d1cc..f6269944f8f5e0a056084c004d7acb0ca5157274 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2005-06-09  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * 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 375429cdd56f23e6f2322678cc0092652445dbdd..cc93d4a23a0be87fa2621513122f465788e1af7b 100644 (file)
@@ -17,7 +17,7 @@
 #include "open-type-font.hh"
 #include "main.hh"
 #include "warn.hh"
+
 char *
 pfb2pfa (Byte const *pfb, int length)
 {
index c4b2d0c856272a97715510bfc1a1a678622c2806..2887a022786cffa481879ab42f4cf78af3a2ac6f 100644 (file)
@@ -53,6 +53,8 @@ static Lilypond_option_init options[] = {
    "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 7293b7be955bd6ea909f1116678cbed21d9630cf..d7a2cef49e29b0393c751bf637c447e84587b585 100644 (file)
@@ -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 4b5f1311f457fb376ce1b84f65d1ab86b606c0ae..4a3da324e5a0445e95171570f500c7765187b201 100644 (file)
@@ -344,7 +344,8 @@ The syntax is the same as `define*-public'."
       (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 a8e7e3326d54b90d5b4424fb0b5d918e271a5d0e..95a605ee434bfc5df3003a443f118b36d96433fc 100644 (file)
@@ -17,13 +17,12 @@ readDirectory (int fd, struct OffsetTable *ot)
   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 aedbd43a239b83412bf0f1c23e6006074a067226..872431a34012906b04ec10f9b32ecaa0f60e13ab 100644 (file)
@@ -78,13 +78,19 @@ surely_read (int fildes, void *buf, size_t nbyte)
     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;
 }