source file of the GNU LilyPond music typesetter
- (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <stdlib.h>
/* Do not calculate and write paper output? */
bool no_paper_global_b = false;
-/* Do not write timestamps in output? */
-bool no_timestamps_global_b = false;
-
/* Selected output format.
One of tex, ps, scm, as. */
String output_format_global = "tex";
/* Verbose progress indication? */
bool verbose_global_b = false;
+/* Scheme code to execute before parsing, after .scm init */
+String init_scheme_code_string = "(begin #t ";
/*
{0, "no-paper", 'm', _i ("produce MIDI output only")},
{_i ("NAME"), "output", 'o', _i ("write output to NAME")},
{0, "safe", 's', _i ("inhibit file output naming and exporting")},
- {0, "no-timestamps", 'T', _i ("don't timestamp the output")},
{0, "version", 'v', _i ("print version number")},
- {0, "verbose", 'V', _i("verbose")},
+ {0, "verbose", 'V', _i ("verbose")},
{0, "warranty", 'w', _i ("show warranty and copyright")},
+ {_i ("EXPR"), "evaluate", 'e',_i ("evalute EXPR as Scheme after .scm init is read")},
{0,0,0,0}
};
cout << _ ("Typeset music and or play MIDI from FILE");
cout << "\n\n";
cout <<
-_(
+_ (
"LilyPond is a music typesetter. It produces beautiful sheet music\n"
"using a high level description file as input. LilyPond is part of \n"
"the GNU Project.\n"
"lilypond");
cout << endl;
- cout << _f ("Copyright (c) %s by", "1996--2000");
+ cout << _f ("Copyright (c) %s by", "1996--2001");
cout << '\n';
cout << " Han-Wen Nienhuys <hanwen@cs.uu.nl>\n";
cout << " Jan Nieuwenhuizen <janneke@gnu.org>\n";
cout << '\n';
cout << _ ("GNU LilyPond -- The music typesetter");
cout << '\n';
- cout << _f ("Copyright (c) %s by", "1996--2000");
+ cout << _f ("Copyright (c) %s by", "1996--2001");
cout << '\n';
cout << " Han-Wen Nienhuys <hanwen@cs.uu.nl>\n";
cout << " Jan Nieuwenhuizen <janneke@gnu.org>\n";
urg; what *do* we want with $LILYPONDPREFIX, DIR_DATADIR and $prefix/share
handy for multiple source-dir runs, though...
*/
- if (!prefix_directory.empty_b())
+ if (!prefix_directory.empty_b ())
{
lily_locale_dir = prefix_directory + "/share/locale";
- bindtextdomain (name.ch_C (), lily_locale_dir.ch_C());
+ bindtextdomain (name.ch_C (), lily_locale_dir.ch_C ());
}
else
bindtextdomain (name.ch_C (), DIR_LOCALEDIR);
global_path.add (p);
#if !KPATHSEA
- /* Urg: GNU make's $(word) index starts at 1 */
+ /* Urg: GNU make's $ (word) index starts at 1 */
int i = 1;
while (global_path.try_add (p + to_str (".") + to_str (i)))
i++;
call_constructors ();
all_fonts_global_p = new All_font_metrics (global_path.str ());
+ init_scheme_code_string += ")";
+ gh_eval_str ((char *)init_scheme_code_string.ch_C());
+
int p=0;
const char *arg ;
while ((arg = oparser_p_static->get_next_arg ()) || p == 0)
exit (exit_status_global);
}
+static int
+sane_putenv (char const* key, char const* value)
+{
+ /*
+ putenv is POSIX, setenv is BSD 4.3
+ Urg, but putenv blindly overwrites environment settings.
+ */
+ if (!getenv (key))
+ return putenv ((char*)((String (key) + "=" + value).ch_C ()));
+ return -1;
+}
int
main (int argc, char **argv)
{
- debug_init (); // should be first (can see that; but Why?)
setup_paths ();
- /*
- prepare guile for heavy mem usage.
+ /* Prepare GUILE for heavy memory usage. If you have plenty memory,
+ this may speed up GUILE a bit. If you're short on memory, these
+ settings
+
+ export GUILE_INIT_SEGMENT_SIZE_1=36000
+ export GUILE_MAX_SEGMENT_SIZE=576000
- putenv is POSIX, setenv is BSD 4.3
- */
- putenv ("GUILE_INIT_SEGMENT_SIZE_1=4194304");
- putenv ("GUILE_MAX_SEGMENT_SIZE=8388608");
+ may considerably decrease memory footprint (~*0.85), with a small
+ execution time penalty (~*1.10). */
+
+ sane_putenv ("GUILE_INIT_SEGMENT_SIZE_1", "4194304");
+ sane_putenv ("GUILE_MAX_SEGMENT_SIZE", "8388608");
ly_init_kpath (argv[0]);
- oparser_p_static = new Getopt_long(argc, argv, options_static);
- while (Long_option_init const * opt = (*oparser_p_static)())
+ oparser_p_static = new Getopt_long (argc, argv, options_static);
+ while (Long_option_init const * opt = (*oparser_p_static) ())
{
switch (opt->shortname_ch_)
{
output_name_global = p.str ();
}
break;
+ case 'e':
+ init_scheme_code_string +=
+ oparser_p_static->optional_argument_ch_C_;
+ break;
case 'w':
notice ();
exit (0);
case 'm':
no_paper_global_b = true;
break;
- case 'T':
- no_timestamps_global_b = true;
- break;
default:
assert (false);
break;
#ifdef WINNT
gh_enter (argc, argv, main_prog);
#else
- gh_enter (argc, argv, (void(*)(int, char**))main_prog);
+ gh_enter (argc, argv, (void (*) (int, char**))main_prog);
#endif
return 0; // unreachable