]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/main.cc
Fix [a8 a32].
[lilypond.git] / lily / main.cc
index 11de9e3fb1b9c44c00f58095526cb8e4b962c421..3375142449239b40e8baffc8f95c8ef63c1f3ef1 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <assert.h>
 #include <locale.h>
-#include <stdio.h>
+#include <string.h>
 
 #include "config.h"
 
@@ -26,7 +26,7 @@
 #include "string.hh"
 #include "main.hh"
 #include "file-path.hh"
-#include "file-results.hh"
+#include "input-file-results.hh"
 #include "warn.hh"
 #include "lily-guile.hh"
 #include "paper-def.hh"
@@ -103,11 +103,11 @@ static Getopt_long *oparser_p_static = 0;
        follow regular localisation guidelines).
  */
 static Long_option_init options_static[] = {
-  /* print example usage:  lilypond -e "" ? */
-  {_i ("EXPR"), "evaluate", 'e',_i ("Scheme options: try -e \"(set-lily-option 'help 0)\" for more help.")},
+  {_i ("EXPR"), "evaluate", 'e',
+   _i ("set options, use -e '(ly-option-usage)' for help")},
   /* another bug in option parser: --output=foe is taken as an abbreviation
      for --output-format */
-  {_i ("EXT"), "format", 'f',  _i ("use output format EXT")},
+  {_i ("EXT"), "format", 'f', _i ("use output format EXT")},
   {0, "help", 'h',  _i ("this help")},
   {_i ("FIELD"), "header", 'H',  _i ("write header field to BASENAME.FIELD")},
   {_i ("DIR"), "include", 'I',  _i ("add DIR to search path")},
@@ -337,13 +337,12 @@ main_prog (void *, int, char **)
       prepend_load_path (String (prefix_directory[i]) + "/scm");
     }
 
-  SCM_RECORD_POSITIONS_P = 1; 
   if (verbose_global_b)
     dirinfo (stderr);
   
   ly_init_guile ();
 
-  printf ("\n");
+  progress_indication ("\n");
 
   call_constructors ();
   all_fonts_global = new All_font_metrics (global_path.string ());
@@ -353,7 +352,17 @@ main_prog (void *, int, char **)
   
   int p=0;
   const char *arg  = oparser_p_static->get_next_arg ();
-  
+
+  /* Only exit until after running init_scheme_code, for
+     (ly-option-usage) or
+     -e "(ly-set-option 'help #t)" */
+  if (!arg)
+    {
+      usage ();
+      /* No FILE arguments is now a usage error */
+      exit (2);
+    }
+
   do
     {
       String infile (arg);
@@ -404,7 +413,7 @@ sane_putenv (char const* key, char const* value, bool overwrite)
     {
       String combine = String (key) + "=" + String (value);
       char * s = strdup(combine.to_str0 ());
-      //      return putenv (s);
+      return putenv (s);
     }
   return -1;
 }
@@ -414,17 +423,15 @@ main (int argc, char **argv)
 {
   setup_paths ();
 
-  /* Prepare GUILE for heavy memory usage.  If you have plenty memory,
-     this may speed up GUILE a bit.  If you're short on memory, these
-     settings
+  /*
     
-        export GUILE_INIT_SEGMENT_SIZE_1=36000
-         export GUILE_MAX_SEGMENT_SIZE=576000
+    These settings hopefully prepare lily for a lot of memory usage.
 
-     may considerably decrease memory footprint (~*0.85), with a small
-     execution time penalty (~*1.10).  However, if this 15% gain in memory
-     usage prevents swapping, the execution time falls drastically. */
-  
+    In practice the effect on GC times is barely measurable -- larger
+    segments cost slighly less time for the conservative marking. (but
+    not impressively much)
+    
+  */
   sane_putenv ("GUILE_INIT_SEGMENT_SIZE_1", "4194304", false);
   sane_putenv ("GUILE_MAX_SEGMENT_SIZE", "8388608", false);
 
@@ -508,21 +515,7 @@ main (int argc, char **argv)
       exit (0);
     }
 
-
-  if (!oparser_p_static->current_arg () )
-    {
-      usage ();
-      /* No FILE arguments is now a usage error */
-      exit (2);
-    }
-
-#ifdef WINNT
-  scm_boot_guile (argc, argv, main_prog, 0);
-#else
   scm_boot_guile (argc, argv, (void (*) (void*, int, char**))main_prog, 0);
-#endif
 
   return 0;                    // unreachable
 }
-
-