/* Name of initialisation file. */
String init_name_global;
-/* Write midi as formatted ascii stream? */
-bool midi_debug_global_b;
-
/* 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, "warranty", 'w', _i ("show warranty and copyright")},
- {0, "midi-debug", 'X', _i ("write midi ouput in formatted ascii")},
+ {_i ("EXPR"), "evaluate", 'e',_i ("evalute EXPR as Scheme after .scm init is read")},
{0,0,0,0}
};
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]);
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;
- case 'X':
- midi_debug_global_b = true;
- break;
default:
assert (false);
break;