From: Han-Wen Nienhuys <hanwen@xs4all.nl>
Date: Sun, 11 Apr 2004 12:49:30 +0000 (+0000)
Subject: * lily/my-lily-parser.cc: remove paper_description function
X-Git-Tag: release/2.3.0~15
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d7b187976cff5a17b795c150d4703ded396b17a0;p=lilypond.git

* lily/my-lily-parser.cc: remove paper_description function

* lily/music-output-def.cc (LY_DEFINE): ly:output-description
new function.

* lily/main.cc: remove global_score_count.

* lily/book.cc (process): don't take header from global_input_file.

* buildscripts/lilypond-profile.sh (Error): set GS_FONTPATH

* lily/parser.yy (My_lily_lexer): remove current_parser global var.

* lily/music-output-def.cc (LY_DEFINE): new function
ly_output_description. This function does the bulk for  setting,
parsing and breaking down of an input file.

* lily/ly-module.cc (ly_make_anonymous_module): don't protect
anonymous modules globally. Let's hope they get GCd
---

diff --git a/ChangeLog b/ChangeLog
index 0deca1d110..135cf3ea30 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 2004-04-11  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+	* lily/music-output-def.cc (LY_DEFINE): ly:output-description
+	new function.
+
+	* lily/main.cc: remove global_score_count.
+
+	* lily/book.cc (process): don't take header from global_input_file.
+
+	* buildscripts/lilypond-profile.sh (Error): set GS_FONTPATH
+
+	* lily/parser.yy (My_lily_lexer): remove current_parser global var.
+
+	* lily/music-output-def.cc (LY_DEFINE): new function
+	ly_output_description. This function does the bulk for  setting,
+	parsing and breaking down of an input file.
+
+	* lily/ly-module.cc (ly_make_anonymous_module): don't protect
+	anonymous modules globally. Let's hope they get GCd
+
 	* scripts/lilypond.py (run_dvips): add sauter-mftrace.map 
 
 2004-04-11  Jan Nieuwenhuizen  <janneke@gnu.org>
diff --git a/buildscripts/lilypond-profile.sh b/buildscripts/lilypond-profile.sh
index d8ea2d3e67..43c535882b 100644
--- a/buildscripts/lilypond-profile.sh
+++ b/buildscripts/lilypond-profile.sh
@@ -84,8 +84,9 @@ else
 	## export GS_LIB
 
 	# For direct ps output fonts. Add all available TeX Type1 fonts
-	## GS_FONTPATH=`kpsewhich -expand-path=\\$T1FONTS`:${GS_FONTPATH:=""}
-	## export GS_FONTPATH
+	tmppfadir=`kpsewhich ecrm10.pfa`
+	GS_FONTPATH=$datadir/pfa:`dirname $tmppfadir`:${GS_FONTPATH:=""}
+	export GS_FONTPATH
 
 fi # remove for zsh
  	
diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc
index 6b4b63803f..304139cd95 100644
--- a/lily/all-font-metrics.cc
+++ b/lily/all-font-metrics.cc
@@ -11,7 +11,6 @@
 #include "config.h"
 #include "main.hh"
 #include "all-font-metrics.hh"
-
 #include "warn.hh"
 #include "afm.hh"
 #include "tfm.hh"
diff --git a/lily/book.cc b/lily/book.cc
index c6a4ddd524..e35f9d237d 100644
--- a/lily/book.cc
+++ b/lily/book.cc
@@ -88,7 +88,9 @@ Book::process (String outname, Music_output_def *default_def, SCM header)
 	  if (paper)
 	    paper_book->papers_.push (paper);
 	  paper_book->scores_.push (systems);
-	  paper_book->global_headers_.push (global_input_file->header_);
+
+	  // fixme.
+	  //paper_book->global_headers_.push (global_input_file->header_);
 	  //paper_book->headers_.push (scores_[i]->header_);
 	  paper_book->headers_.push (header);
 	}
diff --git a/lily/include/input-file-results.hh b/lily/include/input-file-results.hh
index 610ff422a6..cff21cbf0b 100644
--- a/lily/include/input-file-results.hh
+++ b/lily/include/input-file-results.hh
@@ -10,35 +10,10 @@
 #ifndef FILE_RESULTS_HH
 #define FILE_RESULTS_HH
 
-#include "lily-proto.hh"
-#include "source.hh"
-#include "parray.hh"
-#include "protected-scm.hh"
+#include "lily-guile.hh"
 
-class Input_file_results
-{
-public:
-  Sources sources_;
-  Array<String> inclusion_names_;
-  Array<String> target_strings_;
-  Protected_scm header_;
 
-  int book_count_;
-  int score_count_;
-  
-  void do_deps (String);
-
-  Input_file_results (String init, String in, String out);
-  ~Input_file_results ();
-  
-private:
-  /* Make sure we never get an implicit constructor.*/
-  Input_file_results ();
-};
-
-extern Input_file_results* global_input_file;
-
-void do_one_file (char const* file);
+SCM ly_parse_file (SCM);
 
 #endif /* FILE_RESULTS_HH */
 
diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh
index bad4d43e2e..35690a1da8 100644
--- a/lily/include/lily-guile.hh
+++ b/lily/include/lily-guile.hh
@@ -235,7 +235,7 @@ void ly_display_scm (SCM s);
 #include "array.hh"
 
 void read_lily_scm_file (String);
-void ly_init_guile ();
+void ly_c_init_guile ();
 
 bool is_direction (SCM s);
 bool is_number_pair (SCM);
diff --git a/lily/include/main.hh b/lily/include/main.hh
index 5465c3cfd9..5470fc5832 100644
--- a/lily/include/main.hh
+++ b/lily/include/main.hh
@@ -19,8 +19,11 @@ void add_score (Score* s);
 void set_default_output (String s);
 String find_file (String);
 void call_constructors ();
-extern Array<String> get_inclusion_names ();
-extern void set_inclusion_names (Array<String>);
+
+Array<String> get_inclusion_names ();
+void set_inclusion_names (Array<String>);
+
+
 extern String init_name_global;
 
 /* FIXME: in warn.cc */
@@ -43,6 +46,5 @@ extern bool internal_type_checking_global_b;
 extern Array<String> failed_files;
 extern int exit_status_global;
 extern File_path global_path;
-extern int score_count_global;
 
 #endif /* MAIN_HH */
diff --git a/lily/include/music-output-def.hh b/lily/include/music-output-def.hh
index 4bde0d6e8d..e1b13accc1 100644
--- a/lily/include/music-output-def.hh
+++ b/lily/include/music-output-def.hh
@@ -24,7 +24,7 @@ class Music_output_def
 public:
   Scheme_hash_table * translator_tab_;
   Input input_origin_;
-  
+  Array<String> targets_;
   SCM scope_;
 
   virtual void derived_mark ();
@@ -39,6 +39,8 @@ public:
   SCM get_scmvar (String id) const;
   SCM lookup_variable (SCM sym) const;
   void set_variable (SCM, SCM sym);
+  // fixme: dependencies
+  //  virtual void add_target_file (String);
   
   DECLARE_SMOBS (Music_output_def,);
 };
diff --git a/lily/include/my-lily-lexer.hh b/lily/include/my-lily-lexer.hh
index 600e3dec3f..008f26ae91 100644
--- a/lily/include/my-lily-lexer.hh
+++ b/lily/include/my-lily-lexer.hh
@@ -24,7 +24,6 @@ bool busy_parsing ();
 void kill_lexer ();
 void set_lexer ();
 
-/// lexer for LilyPond
 class My_lily_lexer : public Includable_lexer 
 {
   Protected_scm scopes_;
@@ -33,16 +32,19 @@ public:
   String main_input_name_;
   void *lexval;
   bool main_input_b_;
+  
+  Sources * sources_; 
 
   /*
-    Scheme hash tables with (oct name acc)  values, and symbol keys
+   Scheme hash tables with (oct name acc)  values, and symbol keys
    */
   Protected_scm chordmodifier_tab_;
   Protected_scm pitchname_tab_stack_;
+
   Keyword_table * keytable_;
   int errorlevel_;
 
-  My_lily_lexer ();
+  My_lily_lexer (Sources*);
   ~My_lily_lexer ();
   int yylex ();
 
diff --git a/lily/include/my-lily-parser.hh b/lily/include/my-lily-parser.hh
index b98bc843ba..05393324d5 100644
--- a/lily/include/my-lily-parser.hh
+++ b/lily/include/my-lily-parser.hh
@@ -10,11 +10,11 @@
 #ifndef MY_LILY_PARSER_HH
 #define MY_LILY_PARSER_HH
 
+#include "protected-scm.hh"
 #include "lily-proto.hh"
 #include "string.hh"
 #include "parray.hh"
 #include "lily-proto.hh"
-#include "lily-proto.hh"
 #include "duration.hh"
 #include "pitch.hh"
 #include "string.hh"
@@ -30,7 +30,7 @@
 class My_lily_parser 
 {
 public:
-  My_lily_parser (Input_file_results * sources);
+  My_lily_parser (Sources * sources);
   ~My_lily_parser ();
 
   void do_init_file ();
@@ -40,10 +40,13 @@ public:
   Duration default_duration_;
   String output_basename_;
   
-  Scheme_hash_table *default_header_;
+  Protected_scm header_;
 
+  int score_count_;
+  int book_count_;
+  Sources *sources_;
+  
   int fatal_error_;
-  Input_file_results * input_file_;
   int error_level_;
 
   My_lily_lexer * lexer_;
diff --git a/lily/input-file-results.cc b/lily/input-file-results.cc
index d29420140f..5c900200c7 100644
--- a/lily/input-file-results.cc
+++ b/lily/input-file-results.cc
@@ -1,5 +1,5 @@
 /*
-  scores.cc -- implement some globals
+  input-file-results.cc -- implement some globals
 
   source file of the GNU LilyPond music typesetter
 
@@ -57,8 +57,7 @@ LY_DEFINE (ly_set_point_and_click, "ly:set-point-and-click", 1, 0, 0,
     val = scm_c_eval_string ("line-location");
 
   scm_module_define (global_lily_module, ly_symbol2scm ("point-and-click"), val);
-
-  store_locations_global_b =is_procedure (val);
+  store_locations_global_b = is_procedure (val);
   return SCM_UNSPECIFIED;
 }
 
@@ -100,57 +99,6 @@ write_dependency_file (String fn,
   fprintf (f, "%s\n",  out.to_str0 ());
 }
 
-
-void
-Input_file_results::do_deps (String output)
-{
-  if (dependency_global_b)
-    {
-      Path p = split_path (output);
-      p.ext = "dep";
-      write_dependency_file (p.to_string (),
-			     target_strings_,
-			     inclusion_names_);
-    }
-}
-
-Input_file_results::~Input_file_results ()
-{
-  inclusion_names_.clear ();
-  if (header_)
-    header_ = SCM_EOL;
-
-  global_input_file = 0;
-
-  ly_clear_anonymous_modules ();
-}
-
-Input_file_results* global_input_file;
-
-Input_file_results::Input_file_results (String init,
-					String in_file, String out_file)
-{
-  header_ = ly_make_anonymous_module ();
-  global_input_file = this;
-  book_count_ = 0;
-  score_count_ = 0;
-  sources_.set_path (&global_path);
-  
-  progress_indication (_f ("Now processing `%s'", in_file.to_str0 ()));
-  progress_indication ("\n");
-
-  My_lily_parser parser (this);
-  parser.parse_file (init, in_file, out_file);
-  
-  if (parser.error_level_)
-    {
-      exit_status_global  = 1;
-      failed_files.push (in_file);
-    }
-  
-  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.  */
@@ -179,10 +127,15 @@ distill_inname (String str)
   return p;
 }
 
-/* ugr. */
-void
-do_one_file (char const *file)
+LY_DEFINE(ly_parse_file, "ly:parse-file",
+	  1,0,0,
+	  (SCM name),
+	  "Parse a single @code{.ly} file."
+	  )
 {
+  SCM_ASSERT_TYPE (is_string (name), name, SCM_ARG1, __FUNCTION__, "string");
+  char const *file = SCM_STRING_CHARS(name);
+  
   String infile (file);
   Path inpath = distill_inname (infile);
   
@@ -212,14 +165,41 @@ do_one_file (char const *file)
     {
       warning (_f ("can't find file: `%s'", init));
       warning (_f ("(search path: `%s')", global_path.to_string ().to_str0 ()));
-      return;
+      return SCM_UNSPECIFIED;
     }
 
   if ((in_file != "-") && global_path.find (in_file).is_empty ())
     {
       warning (_f ("can't find file: `%s'", in_file));
-      return;
+      return SCM_UNSPECIFIED;
     }
+  
+  Sources sources;
+  sources.set_path (&global_path);
+  
+  progress_indication (_f ("Now processing `%s'", in_file.to_str0 ()));
+  progress_indication ("\n");
 
-  Input_file_results inp_file (init, in_file, out_file);
+  My_lily_parser parser (&sources);
+  parser.parse_file (init, in_file, out_file);
+  
+  if (parser.error_level_)
+    {
+      exit_status_global = 1;
+      failed_files.push (in_file);
+    }
+
+#if 0
+  // fixme dependencies
+  if (dependency_global_b)
+    {
+      Path p = split_path (output);
+      p.ext = "dep";
+      write_dependency_file (p.to_string (),
+			     target_strings_,
+			     inclusion_names_);
+    }
+#endif
+
+  return SCM_UNSPECIFIED;
 }
diff --git a/lily/lexer.ll b/lily/lexer.ll
index a5cc4354fc..010f5c5284 100644
--- a/lily/lexer.ll
+++ b/lily/lexer.ll
@@ -241,7 +241,7 @@ HYPHEN		--
 	String s (YYText ()+1);
 	s = s.left_string (s.index_last ('"'));
 
-	new_input (s, &global_input_file->sources_);
+	new_input (s, sources_);
 	yy_pop_state ();
 }
 <incl>\\{BLACK}*;?{WHITE} { /* got the include identifier */
@@ -252,7 +252,7 @@ HYPHEN		--
 
 	SCM sid = lookup_identifier (s);
 	if (is_string (sid)) {
-		new_input (ly_scm2string (sid), &global_input_file->sources_);
+		new_input (ly_scm2string (sid), sources_);
 		yy_pop_state ();
 	} else { 
 	    String msg (_f ("wrong or undefined identifier: `%s'", s ));
diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc
index 3df914a86f..24cbc9e069 100644
--- a/lily/lily-guile.cc
+++ b/lily/lily-guile.cc
@@ -225,11 +225,10 @@ ly_init_ly_module (void *)
   scm_primitive_load_path (scm_makfrom0str ("lily.scm"));
 }
 
-
 SCM global_lily_module;
 
 void
-ly_init_guile ()
+ly_c_init_guile ()
 {
   global_lily_module = scm_c_define_module ("lily", ly_init_ly_module, 0);
   scm_c_use_module ("lily");
diff --git a/lily/ly-module.cc b/lily/ly-module.cc
index a3a5be680f..d7d72fce5b 100644
--- a/lily/ly-module.cc
+++ b/lily/ly-module.cc
@@ -23,32 +23,14 @@ ly_init_anonymous_module (void * data)
   scm_c_use_module ("lily");
 }
 
-Protected_scm anon_modules;
-
 SCM
 ly_make_anonymous_module ()
 {
   String s = "*anonymous-ly-" + to_string (module_count++) +  "*";
   SCM mod = scm_c_define_module (s.to_str0(), ly_init_anonymous_module, 0);
-  anon_modules = scm_cons (mod, anon_modules);
   return mod;
 }
 
-void
-ly_clear_anonymous_modules ()
-{
-  SCM s = anon_modules;
-  anon_modules = SCM_EOL;
-  
-  for (; is_pair (s) ; s = ly_cdr (s))
-    {
-      SCM tab= scm_c_make_hash_table (2);
-      /* UGH. */
-      SCM_STRUCT_DATA (ly_car (s))[scm_module_index_obarray]
-	= (long unsigned int) tab;
-    }
-}
-
 #define FUNC_NAME __FUNCTION__
 
 static SCM
diff --git a/lily/main.cc b/lily/main.cc
index 6748d944db..c9a60ca970 100644
--- a/lily/main.cc
+++ b/lily/main.cc
@@ -68,10 +68,13 @@ bool safe_global_b = false;
 /* Verbose progress indication? */
 bool verbose_global_b = false;
 
-/* Scheme code to execute before parsing, after .scm init */
+/* Scheme code to execute before parsing, after .scm init
+   This is where -e arguments are appended to.
+*/
 String init_scheme_code_string = "(begin #t ";
 
 
+
 /*
  * Miscellaneous global stuff.
  */
@@ -79,10 +82,6 @@ String init_scheme_code_string = "(begin #t ";
 int exit_status_global;
 File_path global_path;
 
-/* Number of current score output block.  If there's more than one
-   score block, this counter will be added to the output filename. */
-int score_count_global;
-
 
 /*
  * File globals.
@@ -266,10 +265,11 @@ main_with_guile (void *, int, char **)
       prepend_load_path (String (prefix_directory[i]) + "/scm");
     }
 
+
   if (verbose_global_b)
     dir_info (stderr);
 
-  ly_init_guile ();
+  ly_c_init_guile ();
   call_constructors ();
   progress_indication ("\n");
 
@@ -290,7 +290,7 @@ main_with_guile (void *, int, char **)
       scm_gc ();
       scm_call_0 (ly_scheme_function ("dump-gc-protects"));
 #endif
-      do_one_file (arg);
+      ly_parse_file (scm_makfrom0str (arg));
       first = false;
     }
   delete option_parser;
diff --git a/lily/music-output-def.cc b/lily/music-output-def.cc
index 73c2326e73..71b8b3f63f 100644
--- a/lily/music-output-def.cc
+++ b/lily/music-output-def.cc
@@ -7,15 +7,15 @@
 */
 
 #include "scm-hash.hh"
-
-#include "warn.hh"
-#include "music-output-def.hh"
-#include "global-context.hh"
 #include "context-def.hh"
-#include "main.hh"
 #include "file-path.hh"
+#include "global-context.hh"
 #include "lily-guile.hh"
 #include "ly-module.hh"
+#include "main.hh"
+#include "music-output-def.hh"
+#include "paper-def.hh"
+#include "warn.hh"
 
 #include "ly-smobs.icc"
 
@@ -162,3 +162,20 @@ LY_DEFINE (ly_output_def_clone, "ly:output-def-clone",
   return s;
 }
 
+LY_DEFINE(ly_output_description, "ly:output-description",
+	  1,0,0,
+	  (SCM output_def),
+	  "Return the description of translators in @var{output-def}.")
+{
+  Music_output_def *id = unsmob_music_output_def (output_def);
+  SCM al = id->translator_tab_->to_alist ();
+  SCM l = SCM_EOL;
+  for (SCM s = al ; is_pair (s); s = ly_cdr (s))
+    {
+      Context_def * td = unsmob_context_def (ly_cdar (s));
+      l = scm_cons (scm_cons (ly_caar (s), td->to_alist ()),  l);
+    }
+  return l;  
+}
+  
+
diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc
index cafa1f6a78..dc91e7d96f 100644
--- a/lily/my-lily-lexer.cc
+++ b/lily/my-lily-lexer.cc
@@ -93,13 +93,13 @@ static Keyword_ent the_key_tab[] = {
 };
 
 
-My_lily_lexer::My_lily_lexer ()
+My_lily_lexer::My_lily_lexer (Sources *srcs)
 {
   keytable_ = new Keyword_table (the_key_tab);
   encoding_ = SCM_EOL;
   chordmodifier_tab_ = scm_make_vector (scm_int2num (1), SCM_EOL);
   pitchname_tab_stack_ = SCM_EOL; 
-  
+  sources_ = srcs;
   scopes_ = SCM_EOL;
   
   add_scope (ly_make_anonymous_module ());
@@ -167,8 +167,7 @@ void
 My_lily_lexer::start_main_input ()
 {
   // yy_flex_debug = 1;
-
-  new_input (main_input_name_, &global_input_file->sources_);
+  new_input (main_input_name_, sources_);
   /* Do not allow \include in --safe-mode */
   allow_includes_b_ = allow_includes_b_ && ! safe_global_b;
 
diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc
index 47728ded09..7c5e9b1607 100644
--- a/lily/my-lily-parser.cc
+++ b/lily/my-lily-parser.cc
@@ -13,31 +13,32 @@
 #include "main.hh"
 #include "parser.hh"
 #include "input-file-results.hh"
+#include "ly-module.hh"
 #include "scm-hash.hh"
 
-My_lily_parser::My_lily_parser (Input_file_results * source)
+My_lily_parser::My_lily_parser (Sources * sources)
 {
-  input_file_ = source;
+  book_count_ = 0;
+  score_count_ = 0;
   lexer_ = 0;
+  sources_ = sources;
   default_duration_ = Duration (2,0);
   error_level_ = 0;
   last_beam_start_ = SCM_EOL;
 
-  default_header_ =0;
+  header_ = ly_make_anonymous_module ();
 }
 
 My_lily_parser::~My_lily_parser ()
 {
   delete lexer_;
-  if (default_header_)
-    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)
 {
-  lexer_ = new My_lily_lexer;
+  lexer_ = new My_lily_lexer (sources_);
   output_basename_ = out_file;
   
   lexer_->main_input_name_ = in_file;
@@ -46,7 +47,7 @@ My_lily_parser::parse_file (String init, String in_file, String out_file)
   progress_indication ("\n");
 
   set_yydebug (0);
-  lexer_->new_input (init, &input_file_->sources_);
+  lexer_->new_input (init, sources_);
 
   /* Read .ly IN_FILE, lex, parse, write \score blocks from IN_FILE to
      OUT_FILE (unless IN_FILE redefines output file name).  */
@@ -58,7 +59,8 @@ My_lily_parser::parse_file (String init, String in_file, String out_file)
       error_level_ = 1;
     }
 
-  input_file_->inclusion_names_ = lexer_->filename_strings_;
+  // fixme: dependencies
+  //input_file_->inclusion_names_ = lexer_->filename_strings_;
 
   error_level_ = error_level_ | lexer_->errorlevel_; // ugh naming.
 }
@@ -97,14 +99,14 @@ My_lily_parser::here_input () const
   /*
     Parsing looks ahead , so we really want the previous location of the
     lexer, not lexer_->here_input ().
-   */
+  */
   /*
     Actually, that gets very icky when there are white space, because
     the line-numbers are all wrong.  Let's try the character before
     the current token. That gets the right result for
     note/duration stuff, but doesn't mess up for errors in the 1st token of the line. 
     
-   */
+  */
   Input hi (lexer_->here_input ());
 
   char const * bla = hi.defined_str0_;
@@ -114,30 +116,3 @@ My_lily_parser::here_input () const
   
   return Input (hi.source_file_, bla);
 }
-
-#include "paper-def.hh"
-#include "context-def.hh"
-
-My_lily_parser * current_parser;
-
-MAKE_SCHEME_CALLBACK (My_lily_parser,paper_description, 0);
-
-SCM
-My_lily_parser::paper_description ()
-{
-  My_lily_parser * me = current_parser;
-
-  Music_output_def *id = unsmob_music_output_def (me->lexer_->lookup_identifier ("$defaultpaper"));
-  Paper_def *p = dynamic_cast<Paper_def*> (id->clone ());
-
-  SCM al = p->translator_tab_->to_alist ();
-  SCM l = SCM_EOL;
-  for (SCM s = al ; is_pair (s); s = ly_cdr (s))
-    {
-      Context_def * td = unsmob_context_def (ly_cdar (s));
-      l = scm_cons (scm_cons (ly_caar (s), td->to_alist ()),  l);
-    }
-  return l;  
-}
-  
-
diff --git a/lily/paper-book.cc b/lily/paper-book.cc
index fb4b9a76fc..8620970ab1 100644
--- a/lily/paper-book.cc
+++ b/lily/paper-book.cc
@@ -273,7 +273,8 @@ Paper_book::scopes (int i)
   SCM scopes = SCM_EOL;
   if (headers_[i])
     scopes = scm_cons (headers_[i], scopes);
-  if (global_headers_[i] && global_headers_[i] != headers_[i])
+  if (global_headers_.size ()
+      && global_headers_[i] && global_headers_[i] != headers_[i])
     scopes = scm_cons (global_headers_[i], scopes);
   return scopes;
 }
diff --git a/lily/paper-def.cc b/lily/paper-def.cc
index 98b46180de..9d95e0ed18 100644
--- a/lily/paper-def.cc
+++ b/lily/paper-def.cc
@@ -79,7 +79,10 @@ Paper_def::get_paper_outputter (String outname) const
 {
   progress_indication (_f ("paper output to `%s'...",
 			   outname == "-" ? String ("<stdout>") : outname));
-  global_input_file->target_strings_.push (outname);
+
+  // fixme: dependencies
+  //  add_target_file (outname);
+  
   Paper_outputter * po = new Paper_outputter (outname);
   Path p = split_path (outname);
   p.ext = "";
diff --git a/lily/parser.yy b/lily/parser.yy
index aaad718b35..20be2022c3 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -422,15 +422,15 @@ lilypond:	/* empty */
 
 toplevel_expression:
 	lilypond_header {
-		THIS->input_file_->header_ = $1;
+		THIS->header_ = $1;
 	}
 	| add_quote {
 	}
 	| book_block {
 		Book *book = $1;
-		SCM header = THIS->input_file_->header_.to_SCM ();
+		SCM header = THIS->header_;
 		Path outname = split_path (THIS->output_basename_);
-		int *c = &THIS->input_file_->book_count_;
+		int *c = &THIS->book_count_;
 		if (*c)
  			outname.base += "-" + to_string (*c);
 		(*c)++;
@@ -443,10 +443,10 @@ toplevel_expression:
 	| score_block {
 		Score *sc = $1;
 		SCM head = is_module (sc->header_) ? sc->header_
-			: THIS->input_file_->header_.to_SCM ();
+			: THIS->header_.to_SCM ();
 
 		Path p = split_path (THIS->output_basename_);
-		int *c = &THIS->input_file_->score_count_;
+		int *c = &THIS->score_count_;
 		if (*c)
 			p.base += "-" + to_string (*c);
 
@@ -2387,12 +2387,9 @@ My_lily_parser::set_yydebug (bool )
 #endif
 }
 
-extern My_lily_parser *current_parser;
-
 void
 My_lily_parser::do_yyparse ()
 {
-	current_parser = this;;
 	yyparse ((void*)this);
 }
 
diff --git a/lily/performance.cc b/lily/performance.cc
index 3c9e700f04..2a12ac1c73 100644
--- a/lily/performance.cc
+++ b/lily/performance.cc
@@ -171,7 +171,8 @@ Performance::process (String out)
   Midi_stream midi_stream (out);
   progress_indication (_f ("MIDI output to `%s'...", out));
 
-  global_input_file->target_strings_.push (out);
+  // fixme: dependencies
+  //add_target_file (out);
 
   output (midi_stream);
   progress_indication ("\n");
diff --git a/lily/score.cc b/lily/score.cc
index e81210c996..bf668c1b0f 100644
--- a/lily/score.cc
+++ b/lily/score.cc
@@ -174,7 +174,10 @@ default_rendering (SCM music, SCM outdef, SCM header, SCM outname)
 	  Paper_score *ps = dynamic_cast<Paper_score*> (output);
 	  paper_book->papers_.push (ps->paper_);
 	  paper_book->scores_.push (systems);
-	  paper_book->global_headers_.push (global_input_file->header_);
+
+	  // fixme.
+	  //paper_book->global_headers_.push (global_input_file->header_);
+	  
 	  paper_book->headers_.push (header);
 	  paper_book->classic_output (ly_scm2string (outname));
 	  scm_gc_unprotect_object (paper_book->self_scm ());
diff --git a/scm/document-translation.scm b/scm/document-translation.scm
index 5ebdc811be..a138bbc399 100644
--- a/scm/document-translation.scm
+++ b/scm/document-translation.scm
@@ -74,7 +74,7 @@
 
      (if in-which-contexts
 	 (let*
-	     ((paper-alist (My_lily_parser::paper_description))
+	     ((paper-alist (ly:output-description $defaultpaper))
 	      (context-description-alist (map cdr paper-alist))
 	      (contexts
 	       (apply append
@@ -263,7 +263,7 @@
 (define (all-contexts-doc)
   (let* (
 	 (paper-alist
-	  (sort (My_lily_parser::paper_description)
+	  (sort (ly:output-description $defaultpaper)
 		(lambda (x y) (symbol<? (car x) (car y)))))
 	 (names (sort (map symbol->string (map car paper-alist)) string<?))
 	 (contexts (map cdr paper-alist))
diff --git a/scm/font.scm b/scm/font.scm
index e07e706625..8491cd3b42 100644
--- a/scm/font.scm
+++ b/scm/font.scm
@@ -290,9 +290,9 @@
 		,(delay (ly:font-load "ecti12"))
 		)))
      (#(roman italic bold) .
-      (10.0 . #(,(delay (ly:font-load "ecbxti8"))
-		,(delay (ly:font-load "ecbxti10"))
-		,(delay (ly:font-load "ecbxti14"))
+      (10.0 . #(,(delay (ly:font-load "ecbi8"))
+		,(delay (ly:font-load "ecbi10"))
+		,(delay (ly:font-load "ecbi14"))
 		)))
      
      (#(roman caps medium) .