2 main.cc -- implement main: entrypoints
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
18 #include "file-path.hh"
20 #include "file-results.hh"
24 bool version_ignore_global_b = false;
25 bool no_paper_global_b = false;
26 bool no_timestamps_global_b = false;
27 bool find_quarts_global_b = false;
28 String default_outname_base_global = "lelie";
29 int default_count_global;
31 bool experimental_features_global_b = false;
32 bool dependency_global_b = false;
36 void destill_inname (String &name_str_r);
38 Long_option_init theopts[] = {
47 {0, "dependencies", 'd'},
48 {0, "no-timestamps", 'T'},
49 {0, "find-quarts", 'Q'},
50 {0, "ignore-version", 'V'},
58 _("Usage: lilypond [options] [mudela-files]\n"
59 "Typeset and or produce midi output from mudela-file or stdin\n"
62 " -D, --debug enable debugging output\n"
63 " -d, --dependencies write Makefile dependencies for every input file\n"
64 " -Q, --find-quarts show all intervals bigger than a quart\n"
65 " -I, --include=DIR add DIR to search path\n"
66 " -i, --init=FILE use FILE as init file\n"
67 " -h, --help this help\n"
68 " -M, --no-paper produce midi output only\n"
69 " -o, --output=FILE set FILE as default output\n"
70 " -t, --test switch on experimental features\n"
71 " -T, --no-timestamps don't timestamp the output\n"
72 " -V, --ignore-version ignore mudela version\n"
73 " -w, --warranty show warranty and copyright\n"
75 "GNU LilyPond was compiled with the following settings:\n")
82 #ifdef STRING_UTILS_INLINED
83 "STRING_UTILS_INLINED "
85 "datadir= " DIR_DATADIR
97 "GNU LilyPond -- The GNU Project music typesetter.\n"
98 "Copyright 1996, 97, 98 by\n"
99 " Han-Wen Nienhuys <hanwen@stack.nl>\n"
100 " Jan Nieuwenhuizen <jan@digicash.com>\n"
102 " This program is free software; you can redistribute it and/or\n"
103 "modify it under the terms of the GNU General Public License version 2\n"
104 "as published by the Free Software Foundation.\n"
106 " This program is distributed in the hope that it will be useful,\n"
107 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
108 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
109 "General Public License for more details.\n"
111 " You should have received a copy (refer to the file COPYING) of the\n"
112 "GNU General Public License along with this program; if not, write to\n"
113 "the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n"
124 cout << get_version_str () << endl;
128 main (int argc, char **argv)
131 call_constructors ();
132 debug_init (); // should be first
137 // must override (come before) "/usr/local/share/lilypond"!
138 char const *env_sz = getenv ("LILYINCLUDE");
140 path.parse_path (env_sz);
142 path.add (String (DIR_DATADIR) + "/init/");
144 path.push (DIR_DATADIR);
146 Getopt_long oparser (argc, argv,theopts);
147 String init_str ("lily-init.ly");
149 while (Long_option_init const * opt = oparser ())
151 switch (opt->shortname)
154 experimental_features_global_b = true;
157 default_outname_base_global = oparser.optional_argument_ch_C_;
164 find_quarts_global_b = true;
167 path.push (oparser.optional_argument_ch_C_);
170 init_str = oparser.optional_argument_ch_C_;
177 version_ignore_global_b = true;
180 dependency_global_b = true;
186 no_paper_global_b = true;
189 no_timestamps_global_b = true;
199 while ((arg= oparser.get_next_arg ()))
203 do_one_file (init_str,f);
208 do_one_file (init_str, "");
211 return exit_status_i_;
214 /// make input file name: add default extension. "" is stdin.
216 destill_inname (String &name_str_r)
218 if (name_str_r.length_i ())
220 if (name_str_r[ 0 ] != '-')
223 split_path (name_str_r,a,b,c,d);
225 // add extension if not present.
228 name_str_r = a+b+c+d;
231 else name_str_r = "";