]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/main.cc
release: 0.1.61
[lilypond.git] / lily / main.cc
index 85968ddb1429b31108efae2129d93e4c7b79c468..2049462714fbf31e19491d47e2495d9b0dd6ad4a 100644 (file)
@@ -3,9 +3,10 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 
+#include <stdlib.h>
 #include <iostream.h>
 #include <assert.h>
 #include "proto.hh"
 #include "misc.hh"
 #include "string.hh"
 #include "main.hh"
-#include "path.hh"
+#include "file-path.hh"
 #include "config.hh"
-#include "source.hh"
+#include "file-results.hh"
 #include "debug.hh"
-#include "my-lily-parser.hh"
 
-static bool version_ignore_b = false;
-Sources* source_global_l = 0;
+
+bool version_ignore_global_b = false;
 bool no_paper_global_b = false;
+bool no_timestamps_global_b = false;
+String default_outname_base_global =  "lelie";
+int default_count_global;
 
 bool experimental_features_global_b = false;
-bool postscript_global_b = true;
+bool dependency_global_b = false;
+
 int exit_status_i_;
 
 void destill_inname (String &name_str_r);
@@ -35,11 +39,12 @@ Long_option_init theopts[] = {
   {0, "warranty", 'w'},
   {0, "help", 'h'},
   {0, "test", 't'},
-  {0, "debug", 'd'},
+  {0, "debug", 'D'},
   {1, "init", 'i'},
   {1, "include", 'I'},
   {0, "no-paper", 'M'},
-  {0, "no-postscript", 'P'},
+  {0, "dependencies", 'd'},
+  {0, "no-timestamps", 'T'},
   {0, "ignore-version", 'V'},
   {0,0,0}
 };
@@ -52,7 +57,8 @@ usage ()
     "Typeset and or produce midi output from mudela-file or stdin\n"
     "\n"
     "Options:\n"
-    "  -d, --debug            enable debugging output\n"
+    "  -D, --debug            enable debugging output\n"
+    "  -d, --dependencies     write dependency files for every output\n"
     "  -I, --include=DIR      add DIR to search path\n"
     "  -i, --init=FILE        use FILE as init file\n"
     "  -h, --help             this help\n"
@@ -61,7 +67,8 @@ usage ()
     "  -t, --test             switch on experimental features\n"
     "  -M, --no-paper         produce midi output only\n"
     "  -V, --ignore-version   ignore mudela version\n"
-    "  -P, --no-postscript    don't use PostScript\n"
+
+    "  -T, --no-timestamps    don't timestamp the output\n"
     "\n"
     "GNU LilyPond was compiled with the following settings:\n")
 #ifdef NDEBUG
@@ -73,7 +80,7 @@ usage ()
 #ifdef STRING_UTILS_INLINED
     "STRING_UTILS_INLINED "
 #endif
-    "datadir= " DIR_DATADIR
+        "datadir= " DIR_DATADIR
 
     "\n";
 
@@ -108,49 +115,8 @@ notice ()
 }
 
 
-static File_path path;
+ File_path path;
 
-void
-do_one_file (String init_str, String file_str)
-{
-  if (init_str.length_i () && path.find (init_str).empty_b ())
-    {
-      error (_("Can not find `") + init_str +"\'");
-      return ;
-    }
-  if (file_str.length_i () && path.find (file_str).empty_b ())
-    {
-      error (_("Can not find `") + file_str + "'");
-      return ;
-    }
-
-  Sources sources;
-  source_global_l = &sources;
-  source_global_l->set_path (&path);
-  {
-    My_lily_parser parser (source_global_l);
-    parser.set_version_check (version_ignore_b);
-    parser.parse_file (init_str, file_str);
-    
-    if (file_str.length_i () && file_str[0] != '-')
-      {
-       String a,b,c,d;
-       split_path (file_str, a, b, c, d);
-       default_outname_base_global = c;
-      }
-    else
-      default_outname_base_global = "lelie";
-  
-    if (parser.error_level_i_)
-      {
-       exit_status_i_  = 1;
-      }
-    else
-      do_scores ();
-    clear_scores ();
-  }
-  source_global_l = 0;
-}
 
 void
 identify ()
@@ -166,12 +132,13 @@ main (int argc, char **argv)
   debug_init ();               // should be first
 
 
+  
+  path.add ("");
   // must override (come before) "/usr/local/share/lilypond"!
   char const *env_sz = getenv ("LILYINCLUDE");
   if (env_sz)
     path.parse_path (env_sz);
 
-  path.add ("");
   path.add (String (DIR_DATADIR) + "/init/");
 
   path.push (DIR_DATADIR);
@@ -204,17 +171,20 @@ main (int argc, char **argv)
          exit (0);
          break;
        case 'V':
-         version_ignore_b = true;
-         break;
-       case 'P':
-         postscript_global_b = false;
+         version_ignore_global_b = true;
          break;
        case 'd':
+         dependency_global_b = true;
+         break; 
+       case 'D':
          set_debug (true);
          break;
        case 'M':
          no_paper_global_b = true;
          break;
+       case 'T':
+         no_timestamps_global_b = true;
+         break;
        default:
          assert (false);
          break;