*/
#include <math.h>
+
#include "all-font-metrics.hh"
#include "string.hh"
#include "misc.hh"
#include "identifier.hh"
#include "main.hh"
#include "scope.hh"
-#include "dictionary-iter.hh"
#include "file-results.hh" // urg? header_global_p
#include "paper-outputter.hh"
#include "paper-stream.hh"
Paper_def::Paper_def ()
{
- lookup_p_tab_p_ = new Hash_table<int, Lookup*>;
- lookup_p_tab_p_->hash_func_ = int_hash;
+ lookup_p_tab_p_ = new map<int, Lookup*>;
}
Paper_def::~Paper_def ()
{
- for (Hash_table_iter<int, Lookup*> ai(*lookup_p_tab_p_); ai.ok (); ai++)
+ for (map<int,Lookup*>::const_iterator ai = lookup_p_tab_p_->begin();
+ ai != lookup_p_tab_p_->end (); ai++)
{
- delete ai.val ();
+ delete (*ai).second;
}
delete lookup_p_tab_p_;
: Music_output_def (s)
{
shape_int_a_ = s.shape_int_a_;
- lookup_p_tab_p_ = new Hash_table<int, Lookup*>;
- lookup_p_tab_p_->hash_func_ = int_hash;
+ lookup_p_tab_p_ = new map<int, Lookup*>;
- for (Hash_table_iter<int, Lookup*> ai(*s.lookup_p_tab_p_); ai.ok (); ai++)
+ for (map<int,Lookup*>::const_iterator ai = s.lookup_p_tab_p_->begin();
+ ai != s.lookup_p_tab_p_->end (); ai++)
{
- Lookup * l = new Lookup (*ai.val ());
- set_lookup (ai.key(), l);
+ Lookup * l = new Lookup (* (*ai).second);
+ set_lookup ((*ai).first, l);
}
}
return *p;
}
-
+/*
+ FIXME. This is broken until we have a generic way of
+ putting lists inside the \paper block.
+ */
Interval
Paper_def::line_dimensions_int (int n) const
{
- SCM s = default_properties_.get (ly_symbol2scm ("margin-shape"));
- if (!gh_pair_p (s))
- {
- Real lw = get_var ("linewidth");
- Real ind = n? 0.0:get_var ("indent");
-
- return Interval (ind, lw);
- }
+ Real lw = get_var ("linewidth");
+ Real ind = n? 0.0:get_var ("indent");
-
- SCM last = SCM_EOL;
- while (gh_pair_p (s) && n --)
- {
- last = s;
- s = gh_cdr (s);
- }
-
- if (s == SCM_EOL)
- {
- s = last;
- }
-
- SCM pair = gh_car (s);
-
- return Interval (gh_scm2double (gh_car (pair)),
- gh_scm2double (gh_cdr (pair)));
+ return Interval (ind, lw);
}
void
Paper_def::set_lookup (int i, Lookup*l)
{
- if (lookup_p_tab_p_->elem_b (i))
+ map<int,Lookup*> :: const_iterator it (lookup_p_tab_p_->find (i));
+ if (it != lookup_p_tab_p_->end ())
{
- delete lookup_p_tab_p_->elem (i);
+ delete (*it).second;
}
(*lookup_p_tab_p_)[i] = l;
}
#ifndef NPRINT
Music_output_def::print ();
DEBUG_OUT << "Paper {";
- for (Hash_table_iter<int, Lookup*> ai(*lookup_p_tab_p_); ai.ok (); ai++)
+ for (map<int,Lookup*>::const_iterator ai = lookup_p_tab_p_->begin();
+ ai != lookup_p_tab_p_->end (); ai++)
{
- DEBUG_OUT << "Lookup: " << ai.key () << " = " << ai.val ()->font_name_ << '\n';
+ DEBUG_OUT << "Lookup: " << (*ai).first
+ << " = " << (*ai).second->font_name_ << '\n';
}
DEBUG_OUT << "}\n";
#endif