X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fmain.cc;h=728cd89508570f2fff306e3dd3a9ddc679c9c5bb;hb=8c84fff95418b3797c5c866fa569f9bb6f786949;hp=71e6eb22c165ae135013c76c774a11e5b29038ed;hpb=64313890b232c731d432e5b096f30bffc3f3756d;p=lilypond.git diff --git a/lily/main.cc b/lily/main.cc index 71e6eb22c1..728cd89508 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -34,7 +34,6 @@ using namespace std; #include "getopt-long.hh" #include "global-ctor.hh" #include "international.hh" -#include "lily-guile.hh" #include "lily-version.hh" #include "misc.hh" #include "output-def.hh" @@ -49,22 +48,23 @@ using namespace std; */ /* Names of header fields to be dumped to a separate file. */ -std::vector dump_header_fieldnames_global; +vector dump_header_fieldnames_global; /* Name of initialisation file. */ -std::string init_name_global; +string init_name_global; /* Selected output backend One of (gnome, ps [default], eps, scm, svg, tex, texstr)") */ -std::string output_backend_global = "ps"; +string output_backend_global = "ps"; + /* Output formats to generate. */ -std::string output_format_global = ""; +string output_format_global = ""; bool is_pango_format_global; bool is_TeX_format_global; /* Current output name. */ -std::string output_name_global; +string output_name_global; /* Run in safe mode? */ bool be_safe_global = false; @@ -77,8 +77,8 @@ bool be_verbose_global = false; /* Scheme code to execute before parsing, after .scm init. This is where -e arguments are appended to. */ -std::string init_scheme_code_string; -std::string init_scheme_variables; +string init_scheme_code_string; +string init_scheme_variables; /* Generate preview of first system. */ bool make_preview = false; @@ -88,7 +88,7 @@ bool make_print = true; bool relocate_binary = -#if ARGV0_RELOCATION +#if 1 true; #else false @@ -128,7 +128,7 @@ static char const *WARRANTY "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" "General Public License for more details.\n" "\n" - " You should have received a copy (refer to the file COPYING) of the\n" + " You should have received a copy of the\n" "GNU General Public License along with this program; if not, write to\n" "the Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n" "Boston, MA 02111-1307, USA.\n"); @@ -136,10 +136,10 @@ static char const *WARRANTY /* Where the init files live. Typically: LILYPOND_DATADIR = /usr/share/lilypond */ -std::string prefix_directory; +string prefix_directory; /* The jail specification: USER,GROUP,JAIL,DIR. */ -std::string jail_spec; +string jail_spec; /* The option parser */ static Getopt_long *option_parser = 0; @@ -184,7 +184,7 @@ static Long_option_init options_static[] {0, 0, 0, 0} }; -const char *LILYPOND_DATADIR = PACKAGE_DATADIR "/" TOPLEVEL_VERSION; +char const *LILYPOND_DATADIR = PACKAGE_DATADIR "/" TOPLEVEL_VERSION; static void env_var_info (FILE *out, char const *key) @@ -211,6 +211,7 @@ dir_info (FILE *out) env_var_info (out, "GS_LIB"); env_var_info (out, "GUILE_LOAD_PATH"); env_var_info (out, "PANGO_RC_FILE"); + env_var_info (out, "PANGO_PREFIX"); env_var_info (out, "PATH"); } } @@ -276,9 +277,9 @@ warranty () } static void -prepend_load_path (std::string dir) +prepend_load_path (string dir) { - std::string s = "(set! %load-path (cons \"" + dir + "\" %load-path))"; + string s = "(set! %load-path (cons \"" + dir + "\" %load-path))"; scm_c_eval_string (s.c_str ()); } @@ -300,11 +301,11 @@ do_chroot_jail () USER_NAME, GROUP_NAME, JAIL, DIR, JAIL_MAX }; - std::vector components = String_convert::split (jail_spec, ','); + vector components = string_split (jail_spec, ','); if (components.size () != JAIL_MAX) { - error (_f ("expected %d arguments with jail, found: %d", JAIL_MAX, - components.size ())); + error (_f ("expected %d arguments with jail, found: %u", JAIL_MAX, + (unsigned) components.size ())); exit (2); } @@ -392,8 +393,7 @@ main_with_guile (void *, int, char **) init_fontconfig (); init_freetype (); - - all_fonts_global = new All_font_metrics (global_path.to_string ()); + ly_reset_all_fonts (); if (!init_scheme_variables.empty () || !init_scheme_code_string.empty ()) @@ -402,7 +402,7 @@ main_with_guile (void *, int, char **) + init_scheme_variables + "))"; init_scheme_code_string - += "(begin #t " + = "(begin #t " + init_scheme_variables + init_scheme_code_string + ")"; @@ -425,6 +425,7 @@ main_with_guile (void *, int, char **) *tail = scm_cons (scm_makfrom0str (arg), SCM_EOL); tail = SCM_CDRLOC (*tail); } + delete option_parser; option_parser = 0; @@ -451,7 +452,7 @@ setup_localisation () Disable localisation of float values. This breaks TeX output. */ setlocale (LC_NUMERIC, "C"); - std::string localedir = LOCALEDIR; + string localedir = LOCALEDIR; if (char const *env = getenv ("LILYPOND_LOCALEDIR")) localedir = env; @@ -461,7 +462,7 @@ setup_localisation () } static void -add_output_format (std::string format) +add_output_format (string format) { if (output_format_global != "") output_format_global += ","; @@ -478,27 +479,27 @@ parse_argv (int argc, char **argv) switch (opt->shortname_char_) { case 0: - if (std::string (opt->longname_str0_) == "dvi" - || std::string (opt->longname_str0_) == "pdf" - || std::string (opt->longname_str0_) == "png" - || std::string (opt->longname_str0_) == "ps" - || std::string (opt->longname_str0_) == "tex") + if (string (opt->longname_str0_) == "dvi" + || string (opt->longname_str0_) == "pdf" + || string (opt->longname_str0_) == "png" + || string (opt->longname_str0_) == "ps" + || string (opt->longname_str0_) == "tex") add_output_format (opt->longname_str0_); - else if (std::string (opt->longname_str0_) == "preview") + else if (string (opt->longname_str0_) == "preview") make_preview = true; - else if (std::string (opt->longname_str0_) == "no-pages") + else if (string (opt->longname_str0_) == "no-pages") make_print = false; - else if (std::string (opt->longname_str0_) == "relocate") + else if (string (opt->longname_str0_) == "relocate") relocate_binary = true; break; case 'd': { - std::string arg (option_parser->optional_argument_str0_); + string arg (option_parser->optional_argument_str0_); ssize eq = arg.find ('='); - std::string key = arg; - std::string val = "#t"; + string key = arg; + string val = "#t"; if (eq != NPOS) { @@ -517,7 +518,7 @@ parse_argv (int argc, char **argv) break; case 'o': { - std::string s = option_parser->optional_argument_str0_; + string s = option_parser->optional_argument_str0_; File_name file_name (s); output_name_global = file_name.to_string (); } @@ -538,7 +539,12 @@ parse_argv (int argc, char **argv) break; case 'f': - output_format_global = option_parser->optional_argument_str0_; + { + vector components + = string_split (option_parser->optional_argument_str0_, ','); + for (vsize i = 0; i < components.size (); i++) + add_output_format (components[i]); + } break; case 'H': @@ -590,19 +596,28 @@ parse_argv (int argc, char **argv) void setup_guile_env () { - char *yield = getenv ("LILYPOND_GC_YIELD"); + const char *yield = getenv ("LILYPOND_GC_YIELD"); bool overwrite = true; if (!yield) { - yield = "70"; + yield = "65"; overwrite = false; } sane_putenv ("GUILE_MIN_YIELD_1", yield, overwrite); sane_putenv ("GUILE_MIN_YIELD_2", yield, overwrite); sane_putenv ("GUILE_MIN_YIELD_MALLOC", yield, overwrite); + + + sane_putenv ("GUILE_INIT_SEGMENT_SIZE_1", + "10485760", overwrite); + sane_putenv ("GUILE_MAX_SEGMENT_SIZE", + "104857600", overwrite); } +void +read_relocation_dir (string); + int main (int argc, char **argv) { @@ -617,6 +632,7 @@ main (int argc, char **argv) setup_paths (argv[0]); setup_guile_env (); +#if 0 /* Debugging aid. */ try { @@ -626,7 +642,10 @@ main (int argc, char **argv) { error (_f ("exception caught: %s", e.what ())); }; - +#else + scm_boot_guile (argc, argv, main_with_guile, 0); +#endif + /* Only reachable if GUILE exits. That is an error. */ return 1; }