]> git.donarmstrong.com Git - lilypond.git/blob - src/main.cc
release: 0.0.9
[lilypond.git] / src / main.cc
1 #include <iostream.h>
2 #include <assert.h>
3 #include "lgetopt.hh"
4 #include "misc.hh"
5 #include "string.hh"
6 #include "main.hh"
7
8 extern void parse_file(String s);
9
10 long_option_init theopts[] = {
11     1, "output", 'o',
12     0, "warranty", 'w',
13     0, "help", 'h',
14     0,0,0
15 };
16
17 void
18 help()
19 {
20     cout <<
21         "--help, -h             This help\n"
22         "--warranty, -w         show warranty & copyright\n"
23         "--output, -o           set default output\n";
24 }
25 void notice()
26 {
27     cout <<
28         "LilyPond, a music typesetter.\n"
29         "Copyright (C) 1996 by\n"
30         "  Han-Wen Nienhuys <hanwen@stack.urc.tue.nl>\n"
31         "\n"
32         "    This program is free software; you can redistribute it and/or\n"
33         "modify it under the terms of the GNU General Public License version 2\n"
34         "as published by the Free Software Foundation.\n"
35         "\n"
36         "    This program is distributed in the hope that it will be useful,\n"
37         "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
38         "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n"
39         "General Public License for more details.\n"
40         "\n"
41         "    You should have received a copy (refer to the file COPYING) of the\n"
42         "GNU General Public License along with this program; if not, write to\n"
43         "the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n"
44         "USA.\n";
45 }
46
47 int
48 main (int argc, char **argv)
49 {
50     Getopt_long oparser(argc, argv,theopts);
51     debug_init();
52     cout << get_version();
53     
54     while (long_option_init * opt = oparser()) {
55         switch ( opt->shortname){
56         case 'o':
57             set_default_output(oparser.optarg);
58             break;
59         case 'w':
60             notice();
61             exit(0);
62             break;
63         case 'h':
64             help();
65             exit(0);
66             break;
67         default:
68             assert(false);
69             break;
70         }
71     }
72     char *arg = oparser.get_next_arg();
73
74     if (!arg) arg = "";
75     parse_file(arg);
76
77     do_scores();
78     exit (0);
79 }