These conditional compilation blocks were needed to support Guile V1.6.
Also rename ly_make_anonymous_module to ly_make_module.
(Modified the original patch to remove tab->space conversions.)
Signed-off-by: Patrick McCarty <pnorcks@gmail.com>
paper_ = s.paper_->clone ();
paper_->unprotect ();
}
-
+
input_location_ = make_input (*s.origin ());
- header_ = ly_make_anonymous_module (false);
+ header_ = ly_make_module (false);
if (ly_is_module (s.header_))
ly_module_copy (header_, s.header_);
-
+
SCM *t = &scores_;
for (SCM p = s.scores_; scm_is_pair (p); p = scm_cdr (p))
{
scm_gc_mark (book->scores_);
scm_gc_mark (book->bookparts_);
scm_gc_mark (book->input_location_);
-
+
return book->header_;
}
/* Copy the header block of the parent */
if (ly_is_module (parent->header_))
{
- SCM tmp_header = ly_make_anonymous_module (false);
+ SCM tmp_header = ly_make_module (false);
ly_module_copy (tmp_header, parent->header_);
if (ly_is_module (header_))
ly_module_copy (tmp_header, header_);
{
if (scm_is_pair (scores_))
{
- /* If scores have been added to this book, add them to a child
+ /* If scores have been added to this book, add them to a child
* book part */
Book *part = new Book;
part->set_parent (this);
if (Score *score = unsmob_score (scm_car (s)))
if (score->error_found_)
return true;
-
+
for (SCM part = bookparts_; scm_is_pair (part); part = scm_cdr (part))
if (Book *bookpart = unsmob_book (scm_car (part)))
if (bookpart->error_found ())
{
SCM outputs = score
->book_rendering (output_paper_book->paper_, layout);
-
+
while (scm_is_pair (outputs))
{
Music_output *output = unsmob_music_output (scm_car (outputs));
-
+
if (Performance *perf = dynamic_cast<Performance *> (output))
output_paper_book->add_performance (perf->self_scm ());
else if (Paper_score *pscore = dynamic_cast<Paper_score *> (output))
output_paper_book->add_score (score->get_header ());
output_paper_book->add_score (pscore->self_scm ());
}
-
+
outputs = scm_cdr (outputs);
}
}
output_paper_book->add_score (scm_car (s));
else
assert (0);
-
+
}
/* Concatenate all score or book part outputs into a Paper_book
#include "config.hh"
#include "lily-guile.hh"
-SCM ly_make_anonymous_module (bool safe);
+SCM ly_make_module (bool safe);
SCM ly_module_copy (SCM dest, SCM src);
SCM ly_module_2_alist (SCM mod);
SCM ly_module_lookup (SCM module, SCM sym);
SCM ly_module_symbols (SCM mod);
void ly_reexport_module (SCM mod);
inline bool ly_is_module (SCM x) { return SCM_MODULEP (x); }
-SCM ly_clear_anonymous_modules ();
-void clear_anonymous_modules ();
+
SCM ly_use_module (SCM mod, SCM used);
/* For backward compatability with Guile 1.8 */
typedef SCM (*scm_t_hash_handle_fn) (GUILE_ELLIPSIS);
#endif
-#define MODULE_GC_KLUDGE
#endif /* LY_MODULE_HH */
chord_repetition_ = Chord_repetition ();
smobify_self ();
- add_scope (ly_make_anonymous_module (false));
+ add_scope (ly_make_module (false));
push_note_state (scm_c_make_hash_table (0));
chordmodifier_tab_ = scm_make_vector (scm_from_int (1), SCM_EOL);
}
SCM *tail = &scopes;
for (SCM s = src.scopes_; scm_is_pair (s); s = scm_cdr (s))
{
- SCM newmod = ly_make_anonymous_module (false);
+ SCM newmod = ly_make_module (false);
ly_module_copy (newmod, scm_car (s));
*tail = scm_cons (newmod, SCM_EOL);
tail = SCM_CDRLOC (*tail);
{
lexer_ = new Lily_lexer (*src.lexer_, this);
}
-
+
lexer_->unprotect ();
}
void
Lily_parser::parse_file (string init, string name, string out_name)
{
- // TODO: use $parser
+ // TODO: use $parser
lexer_->set_identifier (ly_symbol2scm ("parser"), self_scm ());
output_basename_ = out_name;
void
Lily_parser::parse_string (string ly_code)
{
- // TODO: use $parser
+ // TODO: use $parser
lexer_->set_identifier (ly_symbol2scm ("parser"),
self_scm ());
lexer_->main_input_name_ = "<string>";
- lexer_->is_main_input_ = true;
+ lexer_->is_main_input_ = true;
lexer_->new_input (lexer_->main_input_name_, ly_code, sources_);
SCM mod = lexer_->set_current_scope ();
lexer_->remove_scope ();
}
- lexer_ = 0;
+ lexer_ = 0;
}
char const *
/****************************************************************
- OUTPUT-DEF
+ OUTPUT-DEF
****************************************************************/
Output_def *
Output_def *layout = unsmob_output_def (id);
layout = layout ? layout->clone () : new Output_def;
layout->set_variable (ly_symbol2scm ("is-layout"), SCM_BOOL_T);
-
+
return layout;
}
ly_module_copy (nid, id);
id = nid;
}
-
+
return id;
}
-SCM
+SCM
Lily_parser::make_scope () const
{
- SCM module = ly_make_anonymous_module (be_safe_global);
- return module;
+ SCM module = ly_make_module (be_safe_global);
+ return module;
}
#include "std-string.hh"
#include "protected-scm.hh"
-#ifdef MODULE_GC_KLUDGE
-Protected_scm anonymous_modules = SCM_EOL;
-bool perform_gc_kludge;
-#endif
-
-void
-clear_anonymous_modules ()
-{
-#ifdef MODULE_GC_KLUDGE
- for (SCM s = anonymous_modules;
- scm_is_pair (s);
- s = scm_cdr (s))
- {
- SCM module = scm_car (s);
- SCM closure = SCM_MODULE_EVAL_CLOSURE (module);
- SCM prop = scm_procedure_property (closure, ly_symbol2scm ("module"));
-
- if (ly_is_module (prop))
- {
- scm_set_procedure_property_x (closure, ly_symbol2scm ("module"),
- SCM_BOOL_F);
- }
- }
-
- anonymous_modules = SCM_EOL;
-#endif
-}
SCM
-ly_make_anonymous_module (bool safe)
+ly_make_module (bool safe)
{
SCM mod = SCM_EOL;
if (!safe)
mod = scm_call_0 (proc);
}
-#ifdef MODULE_GC_KLUDGE
- if (perform_gc_kludge)
- anonymous_modules = scm_cons (mod, anonymous_modules);
-#endif
return mod;
}
return SCM_UNSPECIFIED;
}
-LY_DEFINE (ly_clear_anonymous_modules, "ly:clear-anonymous-modules",
- 0, 0, 0, (),
- "Plug a GUILE 1.6 and 1.7 memory leak by breaking a weak"
- " reference pointer cycle explicitly.")
-{
-#ifdef MODULE_GC_KLUDGE
- clear_anonymous_modules ();
-#endif
-
- return SCM_UNSPECIFIED;
-}
/* Lookup SYM, but don't give error when it is not defined. */
SCM
smobify_self ();
- scope_ = ly_make_anonymous_module (false);
+ scope_ = ly_make_module (false);
}
Output_def::Output_def (Output_def const &s)
smobify_self ();
input_origin_ = s.input_origin_;
- scope_ = ly_make_anonymous_module (false);
+ scope_ = ly_make_module (false);
if (ly_is_module (s.scope_))
ly_module_copy (scope_, s.scope_);
}
error_found_ = s.error_found_;
smobify_self ();
- input_location_ = make_input (*s.origin ());
+ input_location_ = make_input (*s.origin ());
Music *m = unsmob_music (s.music_);
if (m)
defs_.push_back (copy);
copy->unprotect ();
}
- header_ = ly_make_anonymous_module (false);
+ header_ = ly_make_module (false);
if (ly_is_module (s.header_))
ly_module_copy (header_, s.header_);
}
(eval-string (ly:command-line-code))
(if (ly:get-option 'help)
(begin (ly:option-usage)
- (ly:exit 0 #t )))
+ (ly:exit 0 #t)))
(if (ly:get-option 'show-available-fonts)
(begin (ly:font-config-display-fonts)
(ly:exit 0 #t)))
(for-each (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)