]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/main.cc
patch::: 1.0.14.jcn1: braak
[lilypond.git] / lily / main.cc
index 379e4daa46a6a2ce0268902601f0c47979c86146..24278fb5770fa75da6abc2f53f38987918a5fe31 100644 (file)
@@ -11,6 +11,7 @@
 #include <assert.h>
 #include <locale.h>
 #include "proto.hh"
+#include "dimensions.hh"
 #include "plist.hh"
 #include "getopt-long.hh"
 #include "misc.hh"
 #include "config.hh"
 #include "file-results.hh"
 #include "debug.hh"
+#include "ps-def.hh"
+#include "tex-def.hh"
+#include "ps-lookup.hh"
+#include "tex-lookup.hh"
 
 #if HAVE_GETTEXT
 #include <libintl.h>
@@ -34,6 +39,13 @@ String default_outname_base_global =  "lelie";
 int default_count_global;
 File_path global_path;
 
+Ps_lookup ps_lookup;
+Tex_lookup tex_lookup;
+Lookup* global_lookup_l = &tex_lookup;
+
+Ps_def ps_def;
+Tex_def tex_def;
+Paper_def* global_paper_l = &tex_def;
 
 bool experimental_features_global_b = false;
 bool dependency_global_b = false;
@@ -182,13 +194,25 @@ identify ()
 int
 main (int argc, char **argv)
 {
+  // facilitate binary distributions
+  char const *env_lily = getenv ("LILYPONDPREFIX");
+  String prefix_directory;
+  if (env_lily)
+    prefix_directory = env_lily;
 
 #if HAVE_GETTEXT
-  setlocale (LC_ALL, "");
-//  setlocale (LC_MESSAGES, "");
+  setlocale (LC_ALL, ""); /* enable locales */
+  setlocale (LC_NUMERIC, "C"); /* musn't have comma's in TeX output... */
+  String lily_locale_dir;
   String name (PACKAGE);
   name.to_lower ();
-  bindtextdomain (name.ch_C (), DIR_LOCALEDIR);
+  if (!prefix_directory.empty_b())
+    {
+      lily_locale_dir = prefix_directory + "/share/locale";
+      bindtextdomain (name.ch_C (), lily_locale_dir.ch_C());
+    }
+  else
+    bindtextdomain (name.ch_C (), DIR_LOCALEDIR);
   textdomain (name.ch_C ());
 #endif
 
@@ -202,6 +226,12 @@ main (int argc, char **argv)
   if (env_sz)
     global_path.parse_path (env_sz);
 
+  if (!prefix_directory.empty_b())
+    {
+      global_path.add (prefix_directory + "/share/lilypond/init/");
+      global_path.add (prefix_directory + "/share/lilypond");
+    }
+
   global_path.add (String (DIR_DATADIR) + "/init/");
 
   global_path.push (DIR_DATADIR);
@@ -216,6 +246,8 @@ main (int argc, char **argv)
        {
        case 't':
          experimental_features_global_b = true;
+         global_lookup_l = &ps_lookup;
+         global_paper_l = &ps_def;
          break;
        case 'o':
          outname_str = oparser.optional_argument_ch_C_;
@@ -307,11 +339,12 @@ main (int argc, char **argv)
 
 /*
   urg: make input file name: 
+
   input: file name
+
   output: file name with added default extension. "" is stdin.
-          in reference argument: the extention. ".ly" if none
+          in reference argument: the extension. ".ly" if none
  */
-
 String
 distill_inname_str (String name_str, String& ext_r)
 {