]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/main.cc
* lily/main.cc (main_with_guile): call lilypond-main
[lilypond.git] / lily / main.cc
index a2a9ceec93aae70096af7b7d597d8732f4df8c45..7431bce28df601b951177c7cc1c9351651cb32b3 100644 (file)
@@ -34,8 +34,6 @@
 #include "global-ctor.hh"
 #include "kpath.hh"
 
-Array<String> failed_files;
-
 /*
  * Global options that can be overridden through command line.
  */
@@ -68,22 +66,18 @@ bool safe_global_b = false;
 /* Verbose progress indication? */
 bool verbose_global_b = false;
 
-/* Scheme code to execute before parsing, after .scm init */
+/* Scheme code to execute before parsing, after .scm init
+   This is where -e arguments are appended to.
+*/
 String init_scheme_code_string = "(begin #t ";
 
 
+
 /*
  * Miscellaneous global stuff.
  */
-
-All_font_metrics *all_fonts_global;
-int exit_status_global;
 File_path global_path;
 
-/* Number of current score output block.  If there's more than one
-   score block, this counter will be added to the output filename. */
-int score_count_global;
-
 
 /*
  * File globals.
@@ -200,7 +194,7 @@ usage ()
   printf ("\n\n");
   printf (_ ("LilyPond produces beautiful music notation.").to_str0 ());
   printf ("\n");
-  printf (_f ("For more information, see %s,", PROGRAM_URL).to_str0 ());
+  printf (_f ("For more information, see %s", PROGRAM_URL).to_str0 ());
   printf ("\n\n");
   printf (_ ("Options:").to_str0 ());
   printf ("\n");
@@ -267,53 +261,51 @@ main_with_guile (void *, int, char **)
       prepend_load_path (String (prefix_directory[i]) + "/scm");
     }
 
+
   if (verbose_global_b)
     dir_info (stderr);
 
-  ly_init_guile ();
+  ly_c_init_guile ();
   call_constructors ();
   progress_indication ("\n");
 
   all_fonts_global = new All_font_metrics (global_path.to_string ());
 
   init_scheme_code_string += ")";
-  gh_eval_str ((char*) init_scheme_code_string.to_str0 ());
+  scm_c_eval_string ((char*) init_scheme_code_string.to_str0 ());
 
   /* We accept multiple independent music files on the command line to
      reduce compile time when processing lots of small files.
      Starting the GUILE engine is very time consuming.  */
+
+  SCM files = SCM_EOL;
+  SCM *tail = &files;
   bool first = true;
   while (char const *arg = option_parser->get_next_arg ())
     {
-#if 0
-      /* Code to debug memory leaks.  Cannot call from within .ly
-        since then we get the protects from the parser state too.  */
-      scm_gc ();
-      scm_call_0 (ly_scheme_function ("dump-gc-protects"));
-#endif
-      do_one_file (arg);
-      first = false;
+      *tail = scm_cons (scm_makfrom0str (arg), SCM_EOL);
+      tail = SCM_CDRLOC(*tail);
     }
   delete option_parser;
   option_parser = 0;
 
-  /* No FILE arguments is now a usage error to help newbies.  If you
+  if (files == SCM_EOL)
+    {
+      /* No FILE arguments is now a usage error to help newbies.  If you
      want a filter, you're not a newbie and should know to use file
      argument `-'.  */
-  if (first)
-    {
       usage ();
       exit (2);
     }
 
-  if (exit_status_global)
-    {
-      printf ("Failed files: ");
-      for (int i = 0; i < failed_files.size (); i++)
-       printf ("%s ", failed_files[i].to_str0 ());
-      printf ("\n");
-    }
-  exit (exit_status_global);
+  SCM result = scm_call_1 (ly_scheme_function ("lilypond-main"),
+                          files);
+
+
+  /*
+    unreachable.
+   */
+  exit (0);
 }
 
 static void