\consists "Chord_tremolo_engraver"
\consists "Percent_repeat_engraver"
\consists "Slash_repeat_engraver"
- \consists "Melisma_translator"
%{
Must come before text_engraver, but after note_column engraver.
#if HAVE_PANGO_FT2
Pango_font *
-All_font_metrics::find_pango_font (PangoFontDescription *description,
- Real magnification,
+All_font_metrics::find_pango_font (PangoFontDescription const *description,
Real output_scale
)
{
- pango_font_description_set_size (description,
- gint (magnification *
- pango_font_description_get_size (description)));
-
gchar *pango_fn = pango_font_description_to_filename (description);
SCM key = ly_symbol2scm (pango_fn);
(c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
+#include <cassert>
#include "audio-element.hh"
{
Midi_track midi_track;
midi_track.number_ = channel;
-
- for (Midi_walker i (this, &midi_track, channel); i.ok (); i++)
+
+ Midi_walker i (this, &midi_track, channel);
+ for (; i.ok (); i++)
i.process ();
- midi_stream << midi_track;
+ midi_stream.write (midi_track);
}
#include "grob.hh"
#include "paper-score.hh"
+#include "warn.hh"
#include "ly-smobs.icc"
SCM
Grob::mark_smob (SCM ses)
{
+ ASSERT_LIVE_IS_ALLOWED();
+
Grob *s = (Grob *) SCM_CELL_WORD_1 (ses);
scm_gc_mark (s->immutable_property_alist_);
All_font_metrics (string search_path);
~All_font_metrics ();
-#if HAVE_PANGO_FT2
- Pango_font *find_pango_font (PangoFontDescription *description,
- Real magnification,
+ Pango_font *find_pango_font (PangoFontDescription const *description,
Real scale);
-#endif
Font_metric *find_font (string name);
Open_type_font *find_otf (string name);
int channel_;
DECLARE_CLASSNAME(Midi_channel_item);
Midi_channel_item ();
- virtual const char *name () const { return "Midi_channel_item"; }
- virtual ~Midi_channel_item ();
};
/**
int clocks_per_1_;
};
-/**
- Turn a note on.
-*/
class Midi_note : public Midi_channel_item
{
public:
Byte dynamic_byte_;
};
-/**
- Turn a note off
-*/
class Midi_note_off : public Midi_note
{
public:
int number_;
DECLARE_CLASSNAME(Midi_track);
- /*
- Compensate for starting grace notes.
- */
vector<Midi_event*> events_;
Midi_track ();
Midi_stream (string file_name_string);
~Midi_stream ();
- Midi_stream &operator << (string str);
- Midi_stream &operator << (Midi_item const &midi_c_r);
- Midi_stream &operator << (int i);
+ void write (string);
+ void write (Midi_item const &);
+ void write (int);
void open ();
struct Midi_note_event : PQueue_ent<int, Midi_note *>
{
- bool ignore_b_;
+ bool ignore_;
Midi_note_event ();
};
void do_start_note (Midi_note *note);
void do_stop_notes (int);
void output_event (int, Midi_item *l);
-
+
int channel_;
Midi_track *track_;
Audio_staff *staff_;
vector<Audio_item*> items_;
PQueue<Midi_note_event> stop_note_queue;
int last_tick_;
+
};
#endif // MIDI_WALKER_HH
public:
SCM physical_font_tab () const;
Pango_font (PangoFT2FontMap *,
- PangoFontDescription *,
+ PangoFontDescription const *,
Real);
~Pango_font ();
extern bool parsed_objects_should_be_dead;
+#ifndef NDEDUG
#define ASSERT_LIVE_IS_ALLOWED() \
static bool passed_here_once;\
if (parsed_objects_should_be_dead && !passed_here_once) { \
- programming_error (string ("Parsed object should be dead: ") + __PRETTY_FUNCTION__ ); \
+ ::programming_error (string ("Parsed object should be dead: ") + __PRETTY_FUNCTION__ ); \
passed_here_once = true;\
}
+#else
+#define ASSERT_LIVE_IS_ALLOWED()
+#endif
#endif /* SMOBS_HH */
/*
- midi-item.cc -- implement Midi items.
+ midi-item.cc -- implement MIDI items.
source file of the GNU LilyPond music typesetter
else if (Audio_time_signature *i = dynamic_cast<Audio_time_signature *> (a))
return new Midi_time_signature (i);
else if (Audio_text *i = dynamic_cast<Audio_text *> (a))
- //return i->text_string_.length () ? new Midi_text (i) : 0;
return new Midi_text (i);
else
assert (0);
- // isn't C++ grand?
return 0;
}
{
}
-Midi_channel_item::~Midi_channel_item ()
-{
- channel_ = 0;
-}
-
Midi_channel_item::Midi_channel_item ()
{
channel_ = 0;
Midi_track::data_string () const
{
string str = Midi_chunk::data_string ();
- if (do_midi_debugging_global)
- str += "\n";
for (vector<Midi_event*>::const_iterator i (events_.begin());
i != events_.end(); i ++)
{
str += (*i)->to_string ();
- if (do_midi_debugging_global)
- str += "\n";
}
return str;
}
fclose (out_file_);
}
-Midi_stream &
-Midi_stream::operator << (string str)
+void
+Midi_stream::write (string str)
{
size_t sz = sizeof (Byte);
size_t n = str.length ();
if (written != sz * n)
warning (_ ("cannot write to file: `%s'"));
-
- return *this;
}
-Midi_stream &
-Midi_stream::operator << (Midi_item const &midi_c_r)
+void
+Midi_stream::write (Midi_item const &midi)
{
- string str = midi_c_r.to_string ();
-
- // ugh, should have separate debugging output with Midi*::print routines
- if (do_midi_debugging_global)
- {
- str = String_convert::bin2hex (str) + "\n";
- for (ssize i = str.find ("0a"); i != NPOS; i = str.find ("0a"))
- {
- str[i] = '\n';
- str[i + 1] = '\t';
- }
- }
+ string str = midi.to_string ();
- return operator << (str);
+ return write (str);
}
-Midi_stream &
-Midi_stream::operator << (int i)
+void
+Midi_stream::write (int i)
{
- // output binary string ourselves
- *this << Midi_item::i2varint_string (i);
- return *this;
+ write (Midi_item::i2varint_string (i));
}
Midi_note_event::Midi_note_event ()
{
- ignore_b_ = false;
+ ignore_ = false;
}
int
Midi_walker::~Midi_walker ()
{
- do_stop_notes (last_tick_ + 384);
+ do_stop_notes (INT_MAX);
}
+
/**
Find out if start_note event is needed, and do it if needed.
*/
{
/* let stopnote in queue be ignored,
new stop note wins */
- stop_note_queue[i].ignore_b_ = true;
+ stop_note_queue[i].ignore_ = true;
+
/* don't replay start note, */
play_start = false;
break;
while (stop_note_queue.size () && stop_note_queue.front ().key <= max_ticks)
{
Midi_note_event e = stop_note_queue.get ();
- if (e.ignore_b_)
+ if (e.ignore_)
{
delete e.val;
continue;
}
}
-/**
- Advance the track to #now#, output the item, and adjust current "moment".
-*/
void
Midi_walker::output_event (int now_ticks, Midi_item *l)
{
if (Midi_channel_item *mci = dynamic_cast<Midi_channel_item*> (midi))
mci->channel_ = channel_;
- //midi->channel_ = track_->number_;
if (Midi_note *note = dynamic_cast<Midi_note *> (midi))
{
if (note->audio_->length_mom_.to_bool ())
#include "stencil.hh"
Pango_font::Pango_font (PangoFT2FontMap *fontmap,
- PangoFontDescription *description,
+ PangoFontDescription const *description,
Real output_scale)
{
(void) fontmap;
+
physical_font_tab_ = scm_c_make_hash_table (11);
PangoDirection pango_dir = PANGO_DIRECTION_LTR;
context_
= pango_ft2_get_context (PANGO_RESOLUTION, PANGO_RESOLUTION);
- // context_ = pango_ft2_font_map_create_context (fontmap);
pango_description_ = pango_font_description_copy (description);
attribute_list_ = pango_attr_list_new ();
char glyph_name[GLYPH_NAME_LEN];
PangoAnalysis const *pa = &(item->analysis);
PangoGlyphString *pgs = pango_glyph_string_new ();
-
+
pango_shape (str.c_str () + item->offset,
item->length, (PangoAnalysis*) pa, pgs);
tail = SCM_CDRLOC (*tail);
}
+ pango_glyph_string_free (pgs);
+ pgs = 0;
PangoFontDescription *descr = pango_font_describe (pa->font);
Real size = pango_font_description_get_size (descr)
/ (Real (PANGO_SCALE));
return Stencil (b, exp);
}
+ g_list_free (items);
return dest;
}
PangoFontDescription *description
= pango_font_description_from_string (scm_i_string_chars (descr));
+
+ pango_font_description_set_size (description,
+ gint (factor *
+ pango_font_description_get_size (description)));
+
+
Font_metric *fm = all_fonts_global->find_pango_font (description,
- factor,
output_scale (layout));
+ pango_font_description_free (description);
+
sizes = scm_acons (size_key, fm->self_scm (), sizes);
scm_hash_set_x (table, descr, sizes);
{
int tracks_ = audio_staffs_.size ();
- midi_stream << Midi_header (1, tracks_, 384);
+ midi_stream.write (Midi_header (1, tracks_, 384));
if (be_verbose_global)
progress_indication (_ ("Track...") + " ");
#include "string-convert.hh"
#include "warn.hh"
-/* Write midi as formatted ascii stream? */
-bool do_midi_debugging_global;
bool debug_skylines;
/*
profile_property_accesses = to_boolean (val);
val = scm_from_bool (to_boolean (val));
}
- else if (var == ly_symbol2scm ("debug-midi"))
- {
- do_midi_debugging_global = to_boolean (val);
- val = scm_from_bool (to_boolean (val));
- }
else if (var == ly_symbol2scm ("point-and-click"))
{
point_and_click_global = to_boolean (val);
progress_indication (_f ("Setting %s to %s" , key, value.c_str ())
+ "\n");
- return putenv (s);
+ int retval = putenv (s);
+ /*
+ unfortunately, we can't portably free S here,
+ due to various bugs in glibc prior to 2.1.1
+ */
+ return retval;
}
return -1;
SCM
Skyline::mark_smob (SCM)
{
+ ASSERT_LIVE_IS_ALLOWED();
return SCM_EOL;
}
Bracket_nesting_group::~Bracket_nesting_group ()
{
- for (vsize i = 0 ; i < children_.size (); i++)
- delete children_[i];
+ junk_pointers (children_);
}
void
nesting_->set_bound (RIGHT,
unsmob_grob (get_property ("currentCommandColumn")));
nesting_->set_nesting_support (0);
+
+ delete nesting_;
}
}
(debug-gc-assert-parsed-dead #f "for memory debugging:
ensure that all refs to parsed objects are dead. This is an internal option, and is switched on automatically for -ddebug-gc.")
(debug-lexer #f "debug the flex lexer")
- (debug-midi #f "generate human readable MIDI")
(debug-parser #f "debug the bison parser")
(debug-skylines #f "debug skylines")
(delete-intermediate-files #f
(use-modules (ice-9 regex)
(ice-9 safe)
+ (ice-9 rdelim)
(ice-9 optargs)
(oop goops)
(srfi srfi-1)
(define gc-dumping #f)
(define gc-protect-stat-count 0)
+
+(define-public (dump-live-object-stats outfile)
+ (for-each
+ (lambda (x)
+ (format outfile "~a: ~a\n" (car x) (cdr x)))
+ (sort (gc-live-object-stats)
+ (lambda (x y)
+ (string<? (car x) (car y))))))
+
(define-public (dump-gc-protects)
(set! gc-protect-stat-count (1+ gc-protect-stat-count))
(let* ((protects (sort
(set! stats (gc-live-object-stats))
(display "Dumping live object statistics.\n")
-
- (for-each
- (lambda (x)
- (format outfile "~a: ~a\n" (car x) (cdr x)))
- (sort (gc-live-object-stats)
- (lambda (x y)
- (string<? (car x) (car y)))))))
-
+ (dump-live-object-stats outfile)))
(newline outfile)
(let*
)))
(set! gc-dumping #f)
+ (close-port outfile)
+
+ ))
+
+
+(define (check-memory)
+ "read /proc/self to check up on memory use."
+ (define (gulp-file name)
+ (let* ((file (open-input-file name))
+ (text (read-delimited "" file)))
+ (close file)
+ text))
+ (let*
+ ((stat (gulp-file "/proc/self/status"))
+ (lines (string-split stat #\newline))
+ (interesting (filter identity
+ (map
+ (lambda (l)
+ (string-match "^VmData:[ \t]*([0-9]*) kB" l))
+ lines)))
+ (mem (string->number (match:substring (car interesting) 1)))
+ )
+
+
+ (display (format "VMDATA: ~a\n" mem))
+ (display (gc-stats))
+ (if (> mem 100000)
+ (begin
+ (dump-gc-protects)
+ (raise 1)))
))
(lambda (s)
(ly:set-option (car s) (cdr s)))
all-settings)
-
+
(ly:clear-anonymous-modules)
(ly:set-option 'debug-gc-assert-parsed-dead #t)
(gc)
(ly:set-option 'debug-gc-assert-parsed-dead #f)
-
+
(if (ly:get-option 'debug-gc)
(dump-gc-protects)
;;;; (c) 1998--2006 Jan Nieuwenhuizen <janneke@gnu.org>
;;;; Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+(use-modules (ice-9 rdelim))
+
(define standalone (not (defined? 'ly:gulp-file)))
;;(write standalone (current-error-port))
(define (scm-gulp-file name)
(set! %load-path
- (cons (string-append (getenv 'LILYPONDPREFIX) "/ly")
- (cons (string-append (getenv 'LILYPONDPREFIX) "/ps")
+ (cons (string-append (getenv "LILYPONDPREFIX") "/ly")
+ (cons (string-append (getenv "LILYPONDPREFIX") "/ps")
%load-path)))
(let ((path (%search-load-path name)))
(if path