]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/main.cc: Cleanups.
authorJan Nieuwenhuizen <janneke@gnu.org>
Fri, 5 Mar 2004 15:51:52 +0000 (15:51 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Fri, 5 Mar 2004 15:51:52 +0000 (15:51 +0000)
(setup_localisation): New function.
(sane_putenv): Remove.
(main_with_guile): New name (Was: main_prog).  Remove musings
about possible preparation for GUILE heavy memory usage and
practical uselessness.  Do not set environment variables
GUILE_INIT_SEGMENT_SIZE_1, GUILE_MAX_SEGMENT_SIZE.  Remove file
name juggling.
(parse_argv): New function.
(copyright): New function.  It's 2004 already.

* lily/input-file-results.cc (do_one_file): Add file name juggling.
(distill_inname): Move from main.

ChangeLog
lily/include/input-file-results.hh
lily/include/kpath.hh
lily/include/main.hh
lily/input-file-results.cc
lily/kpath.cc
lily/main.cc
lily/my-lily-parser.cc

index cf4a4f43a5a750746a908f9c52a524410701a022..e8d219cc57d27796ac81738187e09d2315913780 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2004-03-05  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * lily/main.cc: Cleanups.
+       (setup_localisation): New function.
+       (sane_putenv): Remove.
+       (main_with_guile): New name (Was: main_prog).  Remove musings
+       about possible preparation for GUILE heavy memory usage and
+       practical uselessness.  Do not set environment variables
+       GUILE_INIT_SEGMENT_SIZE_1, GUILE_MAX_SEGMENT_SIZE.  Remove file
+       name juggling.
+       (parse_argv): New function.
+       (copyright): New function.  It's 2004 already.
+
+       * lily/input-file-results.cc (do_one_file): Add file name juggling.
+       (distill_inname): Move from main.
+
 2004-03-05  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
        * GNUmakefile.in (EXTRA_DIST_FILES): remove VIM stuff.
@@ -9,9 +25,10 @@
        * lily/include/audio-element.hh (class Audio_element): remove grace_b_
 
        * lily/score-performer.cc (finish): call Translator::finalize ().
+
 2004-03-05  Heikki Junes <hjunes@cc.hut.fi>
 
-        * GNUmakefile.in: update VIM_FILES.
+       * GNUmakefile.in: update VIM_FILES.
 
 2004-03-04  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
index 66143c51e45ba57409d5a67eecb8c034bca55434..08d7192417ae6bf24cf902425cede48e96b90c9c 100644 (file)
@@ -37,8 +37,7 @@ private:
 
 extern Input_file_results* global_input_file;
 
-void do_one_file (String init_string, String in_file, String out_file);
-
+void do_one_file (char const* file);
 
 #endif /* FILE_RESULTS_HH */
 
index b5f4f802baef2b3fa9ce20b9e3ad75645b010849..f941091b1a7a28627218f705b21d373f172c85f7 100644 (file)
@@ -1,7 +1,7 @@
 /*   
-kpath.hh -- declare kpath funcs.
+  kpath.hh -- declare kpathsea functions.
 
-source file of the GNU LilyPond music typesetter
+  source file of the GNU LilyPond music typesetter
 
   (c) 2000--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 
@@ -10,13 +10,9 @@ source file of the GNU LilyPond music typesetter
 #ifndef KPATH_HH
 #define KPATH_HH
 
-
-
 String kpathsea_find_afm (char const * name);
 String kpathsea_find_tfm (char const * name);
-void init_kpath (char *av0);
-
-
+void initialize_kpathsea (char *av0);
 
 #endif /* KPATH_HH */
 
index 86d578a53616df02febdcf9a53881bcb33418cd5..978e3f86d13548ef25b999e77a0dc5c8ada096a0 100644 (file)
@@ -21,6 +21,7 @@ String find_file (String);
 void call_constructors ();
 extern Array<String> get_inclusion_names ();
 extern void set_inclusion_names (Array<String>);
+extern String init_name_global;
 
 /* FIXME: in warn.cc */
 void progress_indication (String);
index 3755089f3596bbcc8a75f42f7ab0ba1e7de70096..9c9b29a3fc14125e8bcacc335a534afe5bd02dff 100644 (file)
@@ -154,10 +154,73 @@ Input_file_results::Input_file_results (String init, String in_file, String out_
   do_deps (out_file);
 }
 
+/* Distill full input file name from command argument.  PATH describes
+   file name with added default extension, ".ly" if none.  "-" is
+   STDIN.  */
+Path
+distill_inname (String str)
+{
+  Path p = split_path (str);
+  if (str.is_empty () || str == "-")
+    p.base = "-";
+  else
+    {
+      String orig_ext = p.ext;
+      char const *extensions[] = {"ly", "", 0};
+      for (int i = 0; extensions[i]; i++)
+       {
+         p.ext = orig_ext;
+         if (*extensions[i] && !p.ext.is_empty ())
+           p.ext += ".";
+         p.ext += extensions[i];
+         if (!global_path.find (p.to_string ()).is_empty ())
+             break;
+       }
+      /* Reshuffle extension */
+      p = split_path (p.to_string ());
+    }
+  return p;
+}
 
+/* ugr. */
 void
-do_one_file (String init, String in_file, String out_file) 
+do_one_file (char const *file)
 {
+  String infile (file);
+  Path inpath = distill_inname (infile);
+  
+  /* By default, use base name of input file for output file name */
+  Path outpath = inpath;
+  if (inpath.to_string () != "-")
+    outpath.ext = output_format_global;
+  
+  /* By default, write output to cwd; do not copy directory part
+     of input file name */
+  outpath.root = "";
+  outpath.dir = "";
+  
+  if (!output_name_global.is_empty ())
+    outpath = split_path (output_name_global);
+  
+  String init;
+  if (!init_name_global.is_empty ())
+    init = init_name_global;
+  else
+    init = "init.ly";
+  
+  String in_file = inpath.to_string ();
+  String out_file = outpath.to_string ();
+  
+#if 0
+  /* Code to debug memory leaks.  Cannot call from within .ly
+     since then we get the protects from the parser state too. */
+  static SCM proc ;
+  if (!proc)
+       proc = scm_c_eval_string ("dump-gc-protects");
+  scm_gc ();
+  scm_call_0 (proc);
+#endif
+      
   if (init.length () && global_path.find (init).is_empty ())
     {
       warning (_f ("can't find file: `%s'", init));
index 8cb57d8c862392f3f5c2dd853dfcfda316b71356..cb6968aafbf3c5387a901e4c0e78db0ccac1e6b4 100644 (file)
@@ -84,7 +84,7 @@ kpathsea_find_tfm (char const * name)
 
 
 void
-init_kpath (char *av0)
+initialize_kpathsea (char *av0)
 {
 #if KPATHSEA && HAVE_KPATHSEA_KPATHSEA_H
   /*
index 4ad74a0b10ae9a5c50434fa746b7fe9a586d8174..d3f29fdd99eb078868540761c7c6f181cf6325f3 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  main.cc -- implement main: entrypoints
+  main.cc -- implement main () entrypoint.
 
   source file of the GNU LilyPond music typesetter
 
 
 Array<String> failed_files;
 
-static int sane_putenv (char const* key, char const* value, bool overwrite = false);
-
 /*
-  Global options that can be overridden through command line.
-*/
* Global options that can be overridden through command line.
+ */
 
 /* Write dependencies file? */
 bool dependency_global_b = false;
@@ -75,10 +73,9 @@ String init_scheme_code_string = "(begin #t ";
 
 
 /*
 Misc. global stuff.
* Miscellaneous global stuff.
  */
 
-
 All_font_metrics *all_fonts_global;
 int exit_status_global;
 File_path global_path;
@@ -88,51 +85,75 @@ File_path global_path;
 int score_count_global;
 
 
-
 /*
-  File globals.
* File globals.
  */
 
+static char const *AUTHORS =
+"  Han-Wen Nienhuys <hanwen@cs.uu.nl>\n"
+"  Jan Nieuwenhuizen <janneke@gnu.org>\n";
+
+static char const *PROGRAM_NAME = "lilypond-bin";
+static char const *PROGRAM_URL = "http://lilypond.org";
+
+static char const *NOTICE =
+_i ("This program is free software.  It is covered by the GNU General Public\n"
+    "License and you are welcome to change it and/or distribute copies of it\n"
+    "under certain conditions.  Invoke as `lilypond-bin --warranty' for more\n"
+    "information.\n");
+  
+static char const *WARRANTY =
+_i ("    This program is free software; you can redistribute it and/or\n"
+    "modify it under the terms of the GNU General Public License version 2\n"
+    "as published by the Free Software Foundation.\n"
+    "\n"
+    "    This program is distributed in the hope that it will be useful,\n"
+    "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+    "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"
+    "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");
+
+
+/* Where the init files live.  Typically:
+   LILYPOND_DATADIR = /usr/share/lilypond
+   LOCAL_LILYPOND_DATADIR = /usr/share/lilypond/<VERSION> */
+char const *prefix_directory[] = {LILYPOND_DATADIR, LOCAL_LILYPOND_DATADIR, 0};
+
 /*  The option parser */
-static Getopt_long *oparser_p_static = 0;
+static Getopt_long *option_parser = 0;
 
-/*
- Internationalisation kludge in two steps:
+/* Internationalisation kludge in two steps:
    * use _i () to get entry in POT file
-   * call gettext () explicitely for actual "translation"
-
- Note: these messages all start with lower case (ie, don't
-       follow regular localisation guidelines).
- */
-static Long_option_init options_static[] = {
-  {_i ("EXPR"), "evaluate", 'e',
-   _i ("set options, use -e '(ly-option-usage)' for help")},
-  /* another bug in option parser: --output=foe is taken as an abbreviation
-     for --output-format */
-  {_i ("EXT"), "format", 'f', _i ("use output format EXT")},
-  {0, "help", 'h',  _i ("print this help")},
-  {_i ("FIELD"), "header", 'H',  _i ("write header field to BASENAME.FIELD")},
-  {_i ("DIR"), "include", 'I',  _i ("add DIR to search path")},
-  {_i ("FILE"), "init", 'i',  _i ("use FILE as init file")},
-  {0, "dependencies", 'M',  _i ("write Makefile dependencies for every input file")},
-  {0, "no-paper", 'm',  _i ("produce MIDI output only")},
-  {_i ("FILE"), "output", 'o',  _i ("write output to FILE")},
-  {_i ("DIR"), "dep-prefix", 'P',  _i ("prepend DIR to dependencies")},
-  {0, "safe-mode", 's',  _i ("run in safe mode")},
-  {0, "version", 'v',  _i ("print version number")},
-  {0, "verbose", 'V', _i ("be verbose")},
-  {0, "warranty", 'w',  _i ("show warranty and copyright")},
-  {0,0,0,0}
-};
-
-void
-identify (FILE *out)
-{
-  fputs (gnu_lilypond_version_string ().to_str0 (), out);
-}
-void
-dirinfo (FILE *out)
+   * call gettext () explicitely for actual "translation"  */
+
+static Long_option_init options_static[] =
+  {
+    {_i ("EXPR"), "evaluate", 'e',
+     _i ("set options, use -e '(ly-option-usage)' for help")},
+    /* Bug in option parser: --output=foe is taken as an abbreviation
+       for --output-format.  */
+    {_i ("EXT"), "format", 'f', _i ("use output format EXT")},
+    {0, "help", 'h',  _i ("print this help")},
+    {_i ("FIELD"), "header", 'H',  _i ("write header field to BASENAME.FIELD")},
+    {_i ("DIR"), "include", 'I',  _i ("add DIR to search path")},
+    {_i ("FILE"), "init", 'i',  _i ("use FILE as init file")},
+    {0, "dependencies", 'M',  _i ("write Makefile dependencies")},
+    {0, "no-paper", 'm',  _i ("produce MIDI output only")},
+    {_i ("FILE"), "output", 'o',  _i ("write output to FILE")},
+    {_i ("DIR"), "dep-prefix", 'P',  _i ("prepend DIR to dependencies")},
+    {0, "safe-mode", 's',  _i ("run in safe mode")},
+    {0, "version", 'v',  _i ("print version number")},
+    {0, "verbose", 'V', _i ("be verbose")},
+    {0, "warranty", 'w',  _i ("show warranty and copyright")},
+    {0,0,0,0}
+  };
+
+static void
+dir_info (FILE *out)
 {
   fputs ("\n", out);
   fprintf (out, "lilypond_datadir: `%s'\n", LILYPOND_DATADIR);
@@ -144,20 +165,43 @@ dirinfo (FILE *out)
           (lilypond_prefix ? lilypond_prefix : ""));
 }
 
-void
-usage ()
+static void
+copyright ()
+{
+  printf (_f ("Copyright (c) %s by\n%s  and others.",
+             "1996--2004",
+             AUTHORS).to_str0 ());
+  printf ("\n");
+}
+
+static void
+identify (FILE *out)
+{
+  fputs (gnu_lilypond_version_string ().to_str0 (), out);
+}
+static void
+notice ()
 {
+  identify (stdout);
   printf ("\n");
-  /* No version number or newline here. It confuses help2man.  */
-  printf (_f ("Usage: %s [OPTIONS]... FILE...", "lilypond").to_str0 ());
+  printf (_f (NOTICE, PROGRAM_NAME).to_str0 ());
+  printf ("\n");
+  copyright ();
+}
+
+static void
+usage ()
+{
+  /* No version number or newline here.  It confuses help2man.  */
+  printf (_f ("Usage: %s [OPTIONS]... FILE...", PROGRAM_NAME).to_str0 ());
   printf ("\n\n");
   printf (_ ("Typeset music and/or produce MIDI from FILE.").to_str0 ());
   printf ("\n\n");
-  printf(_ ("LilyPond produces beautiful music notation.\n"
-           "For more information, see http://lilypond.org/"
-).to_str0 ());
-
+  printf(_ ("LilyPond produces beautiful music notation.").to_str0 ());
   printf ("\n");
+  printf (_f ("For more information, see %s,", PROGRAM_URL).to_str0 ());
+  printf ("\n\n");
   printf (_ ("Options:").to_str0 ());
   printf ("\n");
   printf (Long_option_init::table_string (options_static).to_str0 ());
@@ -167,78 +211,24 @@ usage ()
   printf ("\n");
 }
 
-void
-version ()
+static void
+warranty ()
 {
   identify (stdout);
   printf ("\n");
-  printf (_f (
-  "This is free software.  It is covered by the GNU General Public License,\n"
-  "and you are welcome to change it and/or distribute copies of it under\n"
-  "certain conditions.  Invoke as `%s --warranty' for more information.\n",
-    "lilypond").to_str0 ());
-  printf ("\n");
-
-  printf (_f ("Copyright (c) %s by", "1996--2003").to_str0 ());
-  printf ("\n");
-  printf ("  Han-Wen Nienhuys <hanwen@cs.uu.nl>\n");
-  printf ("  Jan Nieuwenhuizen <janneke@gnu.org>\n");
-}
-
-void
-notice ()
-{
-  printf ("\n");
-  printf (_ ("GNU LilyPond -- The music typesetter").to_str0 ());
-  printf ("\n");
-  printf (_f ("Copyright (c) %s by", "1996--2003").to_str0 ());
+  copyright ();
   printf ("\n");
-  printf ("  Han-Wen Nienhuys <hanwen@cs.uu.nl>\n");
-  printf ("  Jan Nieuwenhuizen <janneke@gnu.org>\n");
-  printf ("\n");
-  printf ( _ (
-            "    This program is free software; you can redistribute it and/or\n"
-            "modify it under the terms of the GNU General Public License version 2\n"
-            "as published by the Free Software Foundation.\n"
-            "\n"
-            "    This program is distributed in the hope that it will be useful,\n"
-            "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
-            "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"
-            "GNU General Public License along with this program; if not, write to\n"
-            "the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,\n"
-            "USA.\n").to_str0 ());
+  printf (_ (WARRANTY).to_str0 ());
 }
 
-
-/* Where LilyPond's init files live.  Typically:
-   LILYPOND_DATADIR = /usr/local/share/lilypond
-   LOCAL_LILYPOND_DATADIR = /usr/local/share/lilypond/1.5.68 */
-char const *prefix_directory[] = {LILYPOND_DATADIR, LOCAL_LILYPOND_DATADIR, 0};
-
-void
+static void
 setup_paths ()
 {
   if (char const *lilypond_prefix = getenv ("LILYPONDPREFIX"))
     prefix_directory[1] = lilypond_prefix;
 
-#if HAVE_GETTEXT
-  /* Enable locales */
-  setlocale (LC_ALL, "");
-  /* Mustn't have commas in TeX output... */
-  setlocale (LC_NUMERIC, "C");
-  String lily_locale_dir;
-  String name (PACKAGE);
-  name.to_lower ();
-  bindtextdomain (name.to_str0 (), LOCALEDIR);
-  textdomain (name.to_str0 ());
-#endif
-
   global_path.add ("");
 
-
   /* Adding mf/out make lilypond unchanged source directory, when setting
      LILYPONDPREFIX to lilypond-x.y.z */
   char *suffixes[] = {"ly", "afm", "mf/out", "scm", "tfm", "ps", 0};
@@ -256,131 +246,55 @@ setup_paths ()
          i++;
 #endif
       }
-  }
-  
-/**
-  Make input file name from command argument.
-
-  Path describes file name with added default extension,
-  ".ly" if none.  "-" is stdin.
- */
-Path
-distill_inname (String str)
-{
-  Path p = split_path (str);
-  if (str.is_empty () || str == "-")
-    p.base = "-";
-  else
-    {
-      String orig_ext = p.ext;
-      char const *extensions[] = {"ly", "", 0};
-      for (int i = 0; extensions[i]; i++)
-       {
-         p.ext = orig_ext;
-         if (*extensions[i] && !p.ext.is_empty ())
-           p.ext += ".";
-         p.ext += extensions[i];
-         if (!global_path.find (p.to_string ()).is_empty ())
-             break;
-       }
-      /* Reshuffle extension */
-      p = split_path (p.to_string ());
-    }
-  return p;
 }
-
-void
+  
+static void
 prepend_load_path (String dir)
 {
-  String s = "(set! %load-path (cons \""
-    + dir
-    + "\" %load-path))";
+  String s = "(set! %load-path (cons \"" + dir + "\" %load-path))";
   scm_c_eval_string (s.to_str0 ());
 }
 
-void
-main_prog (void *, int, char **)
+static void
+main_with_guile (void *, int, char **)
 {
   /* Engravers use lily.scm contents, need to make Guile find it.
      Prepend onto GUILE %load-path, very ugh. */
-     
   for (unsigned i = 0; prefix_directory[i]; i++)
     {
       prepend_load_path (prefix_directory[i]);
-
       /* Junk this.  We should make real modules iso. just loading files. */
       prepend_load_path (String (prefix_directory[i]) + "/scm");
     }
 
   if (verbose_global_b)
-    dirinfo (stderr);
-  
+    dir_info (stderr);
+
   ly_init_guile ();
   call_constructors ();
-
   progress_indication ("\n");
 
   all_fonts_global = new All_font_metrics (global_path.to_string ());
 
   init_scheme_code_string += ")";
-  gh_eval_str ((char *)init_scheme_code_string.to_str0 ());
+  gh_eval_str ((char*) init_scheme_code_string.to_str0 ());
   
-  int p=0;
-  const char *arg  = oparser_p_static->get_next_arg ();
+  bool first = true;
+  while (char const *arg = option_parser->get_next_arg ())
+    {
+      do_one_file (arg);
+      first = false;
+    }
+  delete option_parser;
+  option_parser = 0;
 
-  /* Only exit until after running init_scheme_code, for
-     (ly-option-usage) or
-     -e "(ly-set-option 'help #t)" */
-  if (!arg)
+  /* No FILE arguments is now a usage error */
+  if (first)
     {
       usage ();
-      /* No FILE arguments is now a usage error */
       exit (2);
     }
 
-  do
-    {
-      String infile (arg);
-      Path inpath = distill_inname (infile);
-
-      /* By default, use base name of input file for output file name */
-      Path outpath = inpath;
-      if (inpath.to_string () != "-")
-       outpath.ext = output_format_global;
-
-      /* By default, write output to cwd; do not copy directory part
-         of input file name */
-      outpath.root = "";
-      outpath.dir = "";
-      
-      if (!output_name_global.is_empty ())
-       outpath = split_path (output_name_global);
-      
-      String init;
-      if (!init_name_global.is_empty ())
-       init = init_name_global;
-      else
-       init = "init.ly";
-       
-      do_one_file (init, inpath.to_string (), outpath.to_string ());
-
-#if 0
-      /*
-       Code to debug memory leaks. Cannot call from within .ly since
-       then we get the protects from the parser state too.
-       */
-      static SCM proc ;
-      if (!proc)
-       proc = scm_c_eval_string ("dump-gc-protects");
-      scm_gc ();
-      scm_call_0 (proc);
-#endif
-      
-      p++;
-    } while ((arg  = oparser_p_static->get_next_arg ()));
-  delete oparser_p_static;
-  oparser_p_static = 0;
-
   if (exit_status_global)
     {
       printf ("Failed files: ");
@@ -391,89 +305,74 @@ main_prog (void *, int, char **)
   exit (exit_status_global);
 }
 
-
-static int
-sane_putenv (char const* key, char const* value, bool overwrite)
+static void
+setup_localisation ()
 {
-  if (overwrite || !getenv (key))
-    {
-      String combine = String (key) + "=" + String (value);
-      char * s = strdup(combine.to_str0 ());
-      return putenv (s);
-    }
-  return -1;
+#if HAVE_GETTEXT
+  /* Enable locales */
+  setlocale (LC_ALL, "");
+  
+  /* FIXME: check if this is still true.
+    Disable localisation of float values.  This breaks TeX output.  */
+  setlocale (LC_NUMERIC, "C");
+  
+  String name (PACKAGE);
+  name.to_lower ();
+  bindtextdomain (name.to_str0 (), LOCALEDIR);
+  textdomain (name.to_str0 ());
+#endif
 }
 
-int
-main (int argc, char **argv)
+static void
+parse_argv (int argc, char **argv)
 {
-  setup_paths ();
-
-  /*
-    
-    These settings hopefully prepare lily for a lot of memory usage.
-
-    In practice the effect on GC times is barely measurable -- larger
-    segments cost slighly less time for the conservative marking. (but
-    not impressively much)
-    
-  */
-  sane_putenv ("GUILE_INIT_SEGMENT_SIZE_1", "4194304", false);
-  sane_putenv ("GUILE_MAX_SEGMENT_SIZE", "8388608", false);
-
-  init_kpath (argv[0]);
-
   bool help_b = false;
-  oparser_p_static = new Getopt_long (argc, argv, options_static);
-  while (Long_option_init const * opt = (*oparser_p_static) ())
+  option_parser = new Getopt_long (argc, argv, options_static);
+  while (Long_option_init const * opt = (*option_parser) ())
     {
       switch (opt->shortname_char_)
        {
        case 'v':
-         version ();
-         exit (0);             // we print a version anyway.
+         notice ();
+         exit (0);
          break;
        case 'o':
          {
-           String s = oparser_p_static->optional_argument_str0_;
+           String s = option_parser->optional_argument_str0_;
            Path p = split_path (s);
            if (s != "-" && p.ext.is_empty ())
              p.ext = output_format_global;
-
            output_name_global = p.to_string ();
          }
          break;
        case 'e':
-         init_scheme_code_string +=
-           oparser_p_static->optional_argument_str0_;
+         init_scheme_code_string += option_parser->optional_argument_str0_;
          break;
        case 'w':
-         notice ();
+         warranty ();
          exit (0);
          break;
        case 'f':
-         if (oparser_p_static->optional_argument_str0_ == "help")
+         if (option_parser->optional_argument_str0_ == "help")
            {
-             printf("This option is for developers only;  Read the source code for more information\n");
-             
-             // actually it's not here,
-             // but we award you special points for looking here.
-             
+             printf (_ ("This option is for developers only.").to_str0 ());
+             printf (_ ("Read the sources for more information.").to_str0 ());
              exit (0);
            }
-         output_format_global = oparser_p_static->optional_argument_str0_;
+         output_format_global = option_parser->optional_argument_str0_;
          break;
        case 'P':
-           dependency_prefix_global = oparser_p_static->optional_argument_str0_;
+           dependency_prefix_global = option_parser->optional_argument_str0_;
          break;
        case 'H':
-         dump_header_fieldnames_global.push (oparser_p_static->optional_argument_str0_);
+         dump_header_fieldnames_global
+           .push (option_parser->optional_argument_str0_);
          break;
        case 'I':
-         global_path.push (oparser_p_static->optional_argument_str0_);
+         global_path.push (option_parser->optional_argument_str0_);
          break;
        case 'i':
-         init_name_global = oparser_p_static->optional_argument_str0_;
+         init_name_global = option_parser->optional_argument_str0_;
          break;
        case 'h':
          help_b = true;
@@ -500,11 +399,21 @@ main (int argc, char **argv)
     {
       usage ();
       if (verbose_global_b)
-       dirinfo (stdout);
+       dir_info (stdout);
       exit (0);
     }
+}
+
+int
+main (int argc, char **argv)
+{
+  setup_localisation ();  
+  setup_paths ();
+  parse_argv (argc, argv);
+  initialize_kpathsea (argv[0]);
 
-  scm_boot_guile (argc, argv, (void (*) (void*, int, char**))main_prog, 0);
+  scm_boot_guile (argc, argv, main_with_guile, 0);
 
-  return 0;                    // unreachable
+  /* Unreachable */
+  return 0;
 }
index a2e9bb48fb11d64a5e49ec4654b10f99fa239bcf..a3b2ec86cb5d7aabaa2165b9e5e0e940c26fe81e 100644 (file)
@@ -33,7 +33,7 @@ My_lily_parser::~My_lily_parser ()
     scm_gc_unprotect_object (default_header_->self_scm());
 }
 
-
+/* Process one .ly file, or book.  */
 void
 My_lily_parser::parse_file (String init, String in_file, String out_file)
 {
@@ -46,6 +46,9 @@ My_lily_parser::parse_file (String init, String in_file, String out_file)
 
   set_yydebug (0);
   lexer_->new_input (init, &input_file_->sources_);
+
+  /* Read .ly IN_FILE, lex, parse, write \score blocks from IN_FILE to
+     OUT_FILE (unless IN_FILE redefines output file name).  */
   do_yyparse ();
 
   progress_indication ("\n");