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_l_g = 0;
-bool only_midi = false;
+
+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 = false;
+bool dependency_global_b = false;
+
int exit_status_i_;
void destill_inname (String &name_str_r);
{0, "warranty", 'w'},
{0, "help", 'h'},
{0, "test", 't'},
- {0, "debug", 'd'},
+ {0, "debug", 'D'},
{1, "init", 'i'},
{1, "include", 'I'},
- {0, "midi", 'M'},
- {0, "postscript", 'p'},
+ {0, "no-paper", 'M'},
+ {0, "dependencies", 'd'},
+ {0, "no-timestamps", 'T'},
{0, "ignore-version", 'V'},
{0,0,0}
};
void
-usage()
+usage ()
{
cout <<
- _("Usage: lilypond [options] [mudela-file]\n"
+ _("Usage: lilypond [options] [mudela-files]\n"
"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"
" -w, --warranty show warranty and copyright\n"
" -o, --output=FILE set FILE as default output\n"
" -t, --test switch on experimental features\n"
- " -M, --midi produce midi output only\n"
+ " -M, --no-paper produce midi output only\n"
" -V, --ignore-version ignore mudela version\n"
- " -p, --postscript try to use PostScript\n"
+
+ " -T, --no-timestamps don't timestamp the output\n"
"\n"
"GNU LilyPond was compiled with the following settings:\n")
#ifdef NDEBUG
#ifdef STRING_UTILS_INLINED
"STRING_UTILS_INLINED "
#endif
- "datadir= " DIR_DATADIR
+ "datadir= " DIR_DATADIR
"\n";
}
void
-notice()
+notice ()
{
cout <<
_("\n"
"GNU LilyPond -- The GNU Project music typesetter.\n"
- "Copyright 1996,97 by\n"
+ "Copyright 1996, 97, 98 by\n"
" Han-Wen Nienhuys <hanwen@stack.nl>\n"
" Jan Nieuwenhuizen <jan@digicash.com>\n"
"\n"
}
-static File_path path;
+ File_path path;
+
void
-do_one_file (String init_str, String file_str)
+identify ()
{
- 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_l_g = &sources;
- source_l_g->set_path (&path);
- {
- My_lily_parser parser (source_l_g);
- parser.set_version_check (version_ignore_b);
- parser.parse_file (init_str, file_str);
-
- if (parser.error_level_i_)
- {
- exit_status_i_ = 1;
- }
- else
- do_scores();
- clear_scores ();
- }
- source_l_g = 0;
+ cout << get_version_str () << endl;
}
int
main (int argc, char **argv)
{
- debug_init(); // should be first
+ identify ();
+ call_constructors ();
+ debug_init (); // should be first
- // must override (come before) "/usr/local/share/lilypond"!
- char const * env_l=getenv ("LILYINCLUDE");
- if (env_l)
- {
- path.add (env_l);
- }
+
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 (String (DIR_DATADIR) + "/init/");
path.push (DIR_DATADIR);
Getopt_long oparser (argc, argv,theopts);
- cout << get_version_str() << endl;
String init_str ("lily-init.ly");
- while (Long_option_init const * opt = oparser())
+ while (Long_option_init const * opt = oparser ())
{
switch (opt->shortname)
{
experimental_features_global_b = true;
break;
case 'o':
- set_default_output (oparser.optional_argument_ch_C_);
+ default_outname_base_global = oparser.optional_argument_ch_C_;
break;
case 'w':
- notice();
+ notice ();
exit (0);
break;
case 'I':
init_str = oparser.optional_argument_ch_C_;
break;
case 'h':
- usage();
+ usage ();
exit (0);
break;
case 'V':
- version_ignore_b = true;
- break;
- case 'p':
- postscript_global_b = true;
+ version_ignore_global_b = true;
break;
case 'd':
+ dependency_global_b = true;
+ break;
+ case 'D':
set_debug (true);
break;
case 'M':
- only_midi = true;
+ no_paper_global_b = true;
+ break;
+ case 'T':
+ no_timestamps_global_b = true;
break;
default:
assert (false);
int p=0;
const char *arg ;
- while ((arg= oparser.get_next_arg()))
+ while ((arg= oparser.get_next_arg ()))
{
String f (arg);
destill_inname (f);
void
destill_inname (String &name_str_r)
{
- if (name_str_r.length_i())
+ if (name_str_r.length_i ())
{
if (name_str_r[ 0 ] != '-')
{