2 main.cc -- implement main: entrypoints
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
20 #include "my-lily-parser.hh"
22 Sources* source_l_g = 0;
23 bool only_midi = false;
24 extern void parse_file(String,String);
28 destill_inname( String &name_str_r);
29 Long_option_init theopts[] = {
44 "--help, -h This help\n"
45 "--warranty, -w show warranty & copyright\n"
46 "--output, -o set default output\n"
47 "--debug, -d enable debug output\n"
48 "--init, -i set init file\n"
49 "--include, -I add to file search path.\n"
50 "--midi, -M midi output only\n"
52 "LilyPond was compiled with the following settings:\n"
59 #ifdef STRING_UTILS_INLINED
60 "STRING_UTILS_INLINED "
62 "datadir= " DIR_DATADIR "\n"
73 "LilyPond, a music typesetter.\n"
74 "Copyright (C) 1996,97 by\n"
75 " Han-Wen Nienhuys <hanwen@stack.nl>\n"
76 " Jan Nieuwenhuizen <jan@digicash.com>\n"
78 " Mats Bengtsson <matsb@s3.kth.se>\n"
80 " This program is free software; you can redistribute it and/or\n"
81 "modify it under the terms of the GNU General Public License version 2\n"
82 "as published by the Free Software Foundation.\n"
84 " This program is distributed in the hope that it will be useful,\n"
85 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
86 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
87 "General Public License for more details.\n"
89 " You should have received a copy (refer to the file COPYING) of the\n"
90 "GNU General Public License along with this program; if not, write to\n"
91 "the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n"
95 static File_path * path =0;
98 path = new File_path(String(DIR_DATADIR)+"/init/");
99 path->push(DIR_DATADIR );
108 do_one_file(String init_str, String file_str)
110 source_l_g = new Sources;
111 source_l_g->set_path(path);
112 My_lily_parser parser(source_l_g);
113 parser.parse_file(init_str, file_str);
120 main (int argc, char **argv)
122 Getopt_long oparser(argc, argv,theopts);
123 cout << get_version_str() << endl;
124 String init_str("symbol.ini");
126 while (Long_option_init * opt = oparser()) {
127 switch ( opt->shortname){
129 set_default_output(oparser.optarg);
136 path->push(oparser.optarg);
139 init_str = oparser.optarg;
159 while ( (arg= oparser.get_next_arg()) ) {
162 do_one_file(init_str,f);
166 do_one_file(init_str, "");
174 return path->find(f);
177 /// make input file name: add default extension. "" is stdin.
179 destill_inname( String &name_str_r)
181 if ( name_str_r.length_i() )
183 if( name_str_r[ 0 ] != '-' )
186 split_path(name_str_r,a,b,c,d);
188 // add extension if not present.
191 name_str_r = a+b+c+d;
193 } else name_str_r = "";