#include "chord-tremolo-iterator.hh"
#include "repeated-music.hh"
+#include "lily-imports.hh"
Chord_tremolo_iterator::Chord_tremolo_iterator ()
{
SCM
Chord_tremolo_iterator::get_music_list () const
{
- Music *mus = get_music ();
- SCM proc = ly_lily_module_constant ("tremolo::get-music-list");
- return scm_call_1 (proc, mus->self_scm ());
+ return Lily::tremolo_get_music_list (get_music ()->self_scm ());
}
IMPLEMENT_CTOR_CALLBACK (Chord_tremolo_iterator);
#include "side-position-interface.hh"
#include "translator.icc"
+#include "lily-imports.hh"
class Clef_engraver : public Engraver
{
|| !ly_is_equal (transposition, prev_transposition_)
|| to_boolean (force_clef))
{
- apply_on_children (context (),
- ly_lily_module_constant ("invalidate-alterations"));
+ apply_on_children (context (), Lily::invalidate_alterations);
set_glyph ();
if (scm_is_true (prev_cpos_) || to_boolean (get_property ("firstClef")))
#include "scm-hash.hh"
#include "translator-group.hh"
#include "warn.hh"
+#include "lily-imports.hh"
bool
Context::is_removable () const
void
Context::internal_send_stream_event (SCM type, Input *origin, SCM props[])
{
- Stream_event *e = new Stream_event
- (scm_call_1 (ly_lily_module_constant ("ly:make-event-class"), type),
- origin);
+ Stream_event *e = new Stream_event (Lily::ly_make_event_class (type), origin);
for (int i = 0; props[i]; i += 2)
{
e->set_property (props[i], props[i + 1]);
#include "input.hh"
#include "international.hh"
#include "warn.hh"
+#include "lily-imports.hh"
const char Dispatcher::type_p_name_[] = "ly:dispatcher?";
Dispatcher::print_smob (SCM p, scm_print_state *) const
{
scm_puts ("#<Dispatcher ", p);
- scm_write (scm_call_1 (ly_lily_module_constant ("hash-table->alist"),
- listeners_), p);
+ scm_write (Lily::hash_table_to_alist (listeners_), p);
scm_puts (">", p);
return 1;
}
listen_classes_ = scm_cons (ev_class, listen_classes_);
}
SCM entry = scm_cons (scm_from_int (priority), callback);
- list = scm_merge (list, scm_list_1 (entry), ly_lily_module_constant ("car<"));
+ list = scm_merge (list, scm_list_1 (entry), Lily::car_less);
scm_set_cdr_x (handle, list);
}
#include "warn.hh"
#include "pango-font.hh"
#include "main.hh"
+#include "lily-imports.hh"
Font_metric *
get_font_by_design_size (Output_def *layout, Real requested,
SCM
properties_to_font_size_family (SCM fonts, SCM alist_chain)
{
- return scm_call_2 (ly_lily_module_constant ("lookup-font"), fonts,
- alist_chain);
+ return Lily::lookup_font (fonts, alist_chain);
}
Font_metric *
#include "grob.hh"
#include "simple-closure.hh"
#include "unpure-pure-container.hh"
+#include "lily-imports.hh"
SCM
axis_offset_symbol (Axis a)
else if (Simple_closure *sc = unsmob<Simple_closure> (data))
data = sc->expression ();
- SCM plus = ly_lily_module_constant ("+");
-
if (ly_is_procedure (proc))
proc = Simple_closure::make_smob (scm_list_1 (proc));
- SCM expr = scm_list_3 (plus, proc, data);
+ SCM expr = scm_list_3 (Guile_user::plus, proc, data);
g->set_property (axis_offset_symbol (a), Simple_closure::make_smob (expr));
}
#include "system.hh"
#include "unpure-pure-container.hh"
#include "warn.hh"
+#include "lily-imports.hh"
Grob *
if (!transparent && (scm_is_number (get_property("whiteout"))
|| to_boolean (get_property ("whiteout"))))
{
- SCM wh_proc = ly_lily_module_constant ("stencil-whiteout");
Real thickness = robust_scm2double (get_property("whiteout"), 3.0)
* layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
- retval = *unsmob<Stencil> (scm_call_2 (wh_proc,
- retval.smobbed_copy (),
- scm_from_double (thickness)));
+ retval = *unsmob<Stencil>
+ (Lily::stencil_whiteout (retval.smobbed_copy (),
+ scm_from_double (thickness)));
}
/* Calls the scheme procedure stencil-whiteout-box in scm/stencils.scm */
if (!transparent && to_boolean (get_property ("whiteout-box")))
{
- SCM wh_proc = ly_lily_module_constant ("stencil-whiteout-box");
- retval = *unsmob<Stencil> (scm_call_1 (wh_proc,
- retval.smobbed_copy ()));
+ retval = *unsmob<Stencil>
+ (Lily::stencil_whiteout_box (retval.smobbed_copy ()));
}
if (transparent)
#include "main.hh"
#include "warn.hh"
#include "smobs.hh"
+#include "lily-imports.hh"
/*
INIT
scm_init_funcs_->push_back (f);
}
-void
+SCM
ly_init_ly_module (void *)
{
// Start up type system first.
}
scm_primitive_load_path (scm_from_ascii_string ("lily.scm"));
+ return SCM_UNDEFINED;
}
-SCM global_lily_module;
-
void
ly_c_init_guile ()
{
- global_lily_module = scm_c_define_module ("lily", ly_init_ly_module, 0);
+ Guile_user::module.import ();
+ Lily::module.boot ();
+ scm_c_call_with_current_module (Lily::module, ly_init_ly_module, 0);
+ Display::module.import ();
scm_c_use_module ("lily");
}
// Fluid is a wrapper class for cached storage of GUILE fluids.
// You use it like
//
-// Fluid parser (ly_lily_module_constant ("%parser"));
+// Fluid parser (Lily::f_parser);
//
// and when you first access `parser' as an SCM value, its value is
-// fetched from the respective fluid (in this case `%parser') and
-// cached for future accesses. Be sure to use ly_lily_module_constant
-// for the argument in order to have the SCM for the fluid itself only
-// looked up once per run.
+// fetched from the respective fluid (in this case `%parser', cf
+// lily/lily-imports.cc) and cached for future accesses.
//
// Since fluids act as implicit function parameters, it can only be
// meaningfully employed for variables of automatic
inline SCM ly_symbol2scm (char const *x) { return scm_from_utf8_symbol ((x)); }
#endif
-/*
- we don't have to protect the result; it's already part of the
- exports list of the module.
-*/
-
-#define ly_lily_module_constant(x) \
- ({ \
- static SCM cached; \
- /* We store this one locally, since G++ -O2 fucks up else */ \
- SCM value = cached; \
- if (__builtin_constant_p ((x))) \
- { \
- if (!SCM_UNPACK (cached)) \
- value = cached = \
- scm_variable_ref (scm_c_module_lookup (global_lily_module, (x))); \
- } \
- else \
- value = \
- scm_variable_ref (scm_c_module_lookup (global_lily_module, (x))); \
- value; \
- })
-
/*
Adds the NAME as a Scheme function, and a variable to store the SCM
version of the function in the static variable NAME_proc
SCM ly_deep_copy (SCM);
SCM ly_truncate_list (int k, SCM lst);
-extern SCM global_lily_module;
-
string gulp_file_to_string (const string &fn, bool must_exist, int size);
SCM ly_string2scm (string const &s);
--- /dev/null
+/*
+ This file is part of LilyPond, the GNU music typesetter.
+
+ Copyright (C) 2015 by David Kastrup <dak@gnu.org>
+
+ LilyPond is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LilyPond is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef LILY_IMPORTS_HH
+#define LILY_IMPORTS_HH
+
+#include "lily-modules.hh"
+
+namespace Guile_user {
+ extern Scm_module module;
+ typedef Module_variable<module> Variable;
+
+ extern Variable plus;
+ extern Variable make_module;
+#if GUILEV2
+ extern Variable module_export_all_x;
+#endif
+ extern Variable module_export_x;
+ extern Variable module_public_interface;
+ extern Variable module_use_x;
+ extern Variable symbol_p;
+ extern Variable the_root_module;
+}
+
+namespace Display {
+ extern Scm_module module;
+ typedef Module_variable<module> Variable;
+
+ extern Variable value_to_lily_string;
+}
+
+namespace Lily {
+ extern Scm_module module;
+ typedef Module_variable<module> Variable;
+
+ extern Variable all_music_font_encodings;
+ extern Variable alterations_in_key;
+ extern Variable backend_testing;
+ extern Variable base_length;
+ extern Variable beam_exceptions;
+ extern Variable beat_structure;
+ extern Variable calc_repeat_slash_count;
+ extern Variable car_less;
+ extern Variable construct_chord_elements;
+ extern Variable default_time_signature_settings;
+ extern Variable hash_table_to_alist;
+ extern Variable interpret_markup_list;
+ extern Variable invalidate_alterations;
+ extern Variable key_signature_interface_alteration_positions;
+ extern Variable layout_extract_page_properties;
+ extern Variable lilypond_main;
+ extern Variable line_markup;
+ extern Variable f_location;
+ extern Variable lookup_font;
+ extern Variable lookup_markup_command;
+ extern Variable lookup_markup_list_command;
+ extern Variable ly_context_find;
+ extern Variable ly_context_set_property_x;
+ extern Variable ly_event_p;
+ extern Variable ly_make_event_class;
+ extern Variable ly_music_p;
+ extern Variable make_music;
+ extern Variable make_safe_lilypond_module;
+ extern Variable make_span_event;
+ extern Variable markup_p;
+ extern Variable markup_list_p;
+ extern Variable midi_program;
+#if !GUILEV2
+ extern Variable module_export_all_x;
+#endif
+ extern Variable f_parser;
+ extern Variable percussion_p;
+ extern Variable pure_chain_offset_callback;
+ extern Variable remove_stencil_warnings;
+ extern Variable scale_layout;
+ extern Variable scm_to_string;
+ extern Variable score_lines_markup_list;
+ extern Variable score_markup;
+ extern Variable scorify_music;
+ extern Variable span_bar_notify_grobs_of_my_existence;
+ extern Variable stencil_whiteout;
+ extern Variable stencil_whiteout_box;
+ extern Variable symbol_list_p;
+ extern Variable tremolo_get_music_list;
+ extern Variable type_name;
+ extern Variable volta_bracket_calc_hook_visibility;
+ extern Variable write_performances_midis;
+
+ extern Variable add_lyrics;
+ extern Variable argument_error;
+ extern Variable composed_markup_list;
+ extern Variable context_change;
+ extern Variable context_specification;
+ extern Variable event_chord;
+ extern Variable lyric_combine;
+ extern Variable lyric_event;
+ extern Variable multi_measure_rest;
+ extern Variable music_function;
+ extern Variable music_function_call_error;
+ extern Variable property_operation;
+ extern Variable repeat;
+ extern Variable repetition_chord;
+ extern Variable sequential_music;
+ extern Variable simultaneous_music;
+ extern Variable tempo;
+ extern Variable unrelativable_music;
+ extern Variable void_music;
+};
+
+#endif
--- /dev/null
+/*
+ This file is part of LilyPond, the GNU music typesetter.
+
+ Copyright (C) 2015 by David Kastrup <dak@gnu.org>
+
+ LilyPond is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LilyPond is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef LILY_MODULES_HH
+#define LILY_MODULES_HH
+
+#include "lily-guile.hh"
+
+class Scm_variable;
+
+class Scm_module
+{
+ const char *name_;
+ SCM module_;
+ class Variable_record;
+ Variable_record *variables_;
+ static void boot_init (void *);
+public:
+ void boot ();
+ void import ();
+ void register_variable (const char *name, Scm_variable *var);
+
+ Scm_module (const char *name);
+
+ operator SCM ()
+ {
+ assert (SCM_MODULEP (module_));
+ return module_;
+ }
+};
+
+class Scm_variable
+{
+ SCM var_;
+ friend Scm_module;
+ void boot (const char *name);
+ void import (SCM module, const char *name);
+public:
+ operator SCM & ()
+ {
+#if 0
+ // One could conceivably work with variables even before the
+ // module is initialized
+ return SCM_VARIABLEP (var_) ? *SCM_VARIABLE_LOC (var_) : var_;
+#endif
+#if DEBUG
+ assert (SCM_VARIABLEP (var_));
+#endif
+ return *SCM_VARIABLE_LOC (var_);
+ }
+ SCM operator () ()
+ {
+ return scm_call_0 (*this);
+ }
+ SCM operator () (SCM arg1)
+ {
+ return scm_call_1 (*this, arg1);
+ }
+ SCM operator () (SCM arg1, SCM arg2)
+ {
+ return scm_call_2 (*this, arg1, arg2);
+ }
+ SCM operator () (SCM arg1, SCM arg2, SCM arg3)
+ {
+ return scm_call_3 (*this, arg1, arg2, arg3);
+ }
+ SCM operator () (SCM arg1, SCM arg2, SCM arg3, SCM arg4)
+ {
+ return scm_call_4 (*this, arg1, arg2, arg3, arg4);
+ }
+ Scm_variable (Scm_module &m, const char *name, SCM value = SCM_UNDEFINED);
+};
+
+template <Scm_module &m>
+class Module_variable : public Scm_variable
+{
+public:
+ Module_variable (const char *name, SCM value = SCM_UNDEFINED)
+ : Scm_variable (m, name, value)
+ { }
+};
+
+#endif
class Scale;
class Scheme_hash_table;
class Scheme_engraver;
+class Scm_module;
+class Scm_variable;
class Score;
class Score_engraver;
class Score_performer;
#include "performer.hh"
#include "stream-event.hh"
#include "warn.hh"
+#include "lily-imports.hh"
#include "translator.icc"
if (key_ev_)
{
SCM pitchlist = key_ev_->get_property ("pitch-alist");
- SCM proc = ly_lily_module_constant ("alterations-in-key");
- SCM acc = scm_call_1 (proc, pitchlist);
+ SCM acc = Lily::alterations_in_key (pitchlist);
Pitch key_do (0,
scm_to_int (scm_caar (pitchlist)),
#include "output-def.hh"
#include "staff-symbol-referencer.hh"
#include "rational.hh"
+#include "lily-imports.hh"
struct Key_signature_interface
{
me->warning (_ ("alteration not found"));
else
{
- SCM proc = ly_lily_module_constant ("key-signature-interface::alteration-positions");
-
pos.set_empty ();
Stencil column;
- for (SCM pos_list = scm_call_3 (proc, scm_car (s), c0s, smob);
+ for (SCM pos_list = Lily::key_signature_interface_alteration_positions
+ (scm_car (s), c0s, smob);
scm_is_pair (pos_list); pos_list = scm_cdr (pos_list))
{
int p = scm_to_int (scm_car (pos_list));
#include "std-string.hh"
#include "version.hh"
#include "warn.hh"
+#include "lily-imports.hh"
/*
RH 7 fix (?)
for (; scm_is_pair(s); s = scm_cdr(s)) {
SCM predicate = scm_car(s);
- if (predicate == ly_lily_module_constant ("markup-list?"))
+ if (predicate == Lily::markup_list_p)
push_extra_token (here_input (), EXPECT_MARKUP_LIST);
- else if (predicate == ly_lily_module_constant ("markup?"))
+ else if (predicate == Lily::markup_p)
push_extra_token (here_input (), EXPECT_MARKUP);
else
push_extra_token (here_input (), EXPECT_SCM, predicate);
cs = SCM_CAR (cs);
}
- if (scm_is_eq (cs, ly_lily_module_constant ("ly:music?")))
+ if (scm_is_eq (cs, Lily::ly_music_p))
funtype = MUSIC_FUNCTION;
- else if (scm_is_eq (cs, ly_lily_module_constant ("ly:event?")))
+ else if (scm_is_eq (cs, Lily::ly_event_p))
funtype = EVENT_FUNCTION;
else if (ly_is_procedure (cs))
funtype = SCM_FUNCTION;
SCM
lookup_markup_command (string s)
{
- SCM proc = ly_lily_module_constant ("lookup-markup-command");
- return scm_call_1 (proc, ly_string2scm (s));
+ return Lily::lookup_markup_command (ly_string2scm (s));
}
SCM
lookup_markup_list_command (string s)
{
- SCM proc = ly_lily_module_constant ("lookup-markup-list-command");
- return scm_call_1 (proc, ly_string2scm (s));
+ return Lily::lookup_markup_list_command (ly_string2scm (s));
}
/* Shut up lexer warnings. */
#include "source-file.hh"
#include "version.hh"
#include "warn.hh"
+#include "lily-imports.hh"
/*
symbols/strings.
&& ly_is_procedure (type)
&& scm_is_false (scm_call_1 (type, val)))
{
- SCM typefunc = ly_lily_module_constant ("type-name");
- SCM type_name = scm_call_1 (typefunc, type);
+ SCM type_name = Lily::type_name (type);
warning (_f ("type check for `%s' failed; value `%s' must be of type `%s'",
ly_symbol2string (sym).c_str (),
SCM
ly_hash2alist (SCM tab)
{
- SCM func = ly_lily_module_constant ("hash-table->alist");
- return scm_call_1 (func, tab);
+ return Lily::hash_table_to_alist (tab);
}
/*
--- /dev/null
+/*
+ This file is part of LilyPond, the GNU music typesetter.
+
+ Copyright (C) 2015 by David Kastrup <dak@gnu.org>
+
+ LilyPond is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LilyPond is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "lily-imports.hh"
+
+namespace Guile_user {
+ Scm_module module ("guile-user");
+
+ Variable plus ("+");
+ Variable make_module ("make-module");
+#if GUILEV2
+ Variable module_export_all_x ("module-export-all!");
+#endif
+ Variable module_export_x ("module-export!");
+ Variable module_public_interface ("module-public-interface");
+ Variable module_use_x ("module-use!");
+ Variable symbol_p ("symbol?");
+ Variable the_root_module ("the-root-module");
+}
+
+namespace Display {
+ Scm_module module ("scm display-lily");
+
+ Variable value_to_lily_string ("value->lily-string");
+}
+
+namespace Lily {
+ Scm_module module ("lily");
+
+ Variable all_music_font_encodings ("all-music-font-encodings");
+ Variable alterations_in_key ("alterations-in-key");
+ Variable backend_testing ("backend-testing");
+ Variable base_length ("base-length");
+ Variable beam_exceptions ("beam-exceptions");
+ Variable beat_structure ("beat-structure");
+ Variable calc_repeat_slash_count ("calc-repeat-slash-count");
+ Variable car_less ("car<");
+ Variable construct_chord_elements ("construct-chord-elements");
+ Variable default_time_signature_settings ("default-time-signature-settings");
+ Variable hash_table_to_alist ("hash-table->alist");
+ Variable interpret_markup_list ("interpret-markup-list");
+ Variable invalidate_alterations ("invalidate-alterations");
+ Variable key_signature_interface_alteration_positions ("key-signature-interface::alteration-positions");
+ Variable layout_extract_page_properties ("layout-extract-page-properties");
+ Variable lilypond_main ("lilypond-main");
+ Variable line_markup ("line-markup");
+ Variable f_location ("%location");
+ Variable lookup_font ("lookup-font");
+ Variable lookup_markup_command ("lookup-markup-command");
+ Variable lookup_markup_list_command ("lookup-markup-list-command");
+ Variable ly_context_find ("ly:context-find");
+ Variable ly_context_set_property_x ("ly:context-set-property!");
+ Variable ly_event_p ("ly:event?");
+ Variable ly_make_event_class ("ly:make-event-class");
+ Variable ly_music_p ("ly:music?");
+ Variable make_music ("make-music");
+ Variable make_safe_lilypond_module ("make-safe-lilypond-module");
+ Variable make_span_event ("make-span-event");
+ Variable markup_p ("markup?");
+ Variable markup_list_p ("markup-list?");
+ Variable midi_program ("midi-program");
+#if !GUILEV2
+ Variable module_export_all_x ("module-export-all!");
+#endif
+ Variable f_parser ("%parser");
+ Variable percussion_p ("percussion?");
+ Variable pure_chain_offset_callback ("pure-chain-offset-callback");
+ Variable remove_stencil_warnings ("remove-stencil-warnings");
+ Variable scale_layout ("scale-layout");
+ Variable scm_to_string ("scm->string");
+ Variable score_lines_markup_list ("score-lines-markup-list");
+ Variable score_markup ("score-markup");
+ Variable scorify_music ("scorify-music");
+ Variable span_bar_notify_grobs_of_my_existence ("span-bar::notify-grobs-of-my-existence");
+ Variable stencil_whiteout ("stencil-whiteout");
+ Variable stencil_whiteout_box ("stencil-whiteout-box");
+ Variable symbol_list_p ("symbol-list?");
+ Variable tremolo_get_music_list ("tremolo::get-music-list");
+ Variable type_name ("type-name");
+ Variable volta_bracket_calc_hook_visibility ("volta-bracket::calc-hook-visibility");
+ Variable write_performances_midis ("write-performances-midis");
+
+ Variable add_lyrics ("add-lyrics");
+ Variable argument_error ("argument-error");
+ Variable composed_markup_list ("composed-markup-list");
+ Variable context_change ("context-change");
+ Variable context_specification ("context-specification");
+ Variable event_chord ("event-chord");
+ Variable lyric_combine ("lyric-combine");
+ Variable lyric_event ("lyric-event");
+ Variable multi_measure_rest ("multi-measure-rest");
+ Variable music_function ("music-function");
+ Variable music_function_call_error ("music-function-call-error");
+ Variable property_operation ("property-operation");
+ Variable repeat ("repeat");
+ Variable repetition_chord ("repetition-chord");
+ Variable sequential_music ("sequential-music");
+ Variable simultaneous_music ("simultaneous-music");
+ Variable tempo ("tempo");
+ Variable unrelativable_music ("unrelativable-music");
+ Variable void_music ("void-music");
+}
--- /dev/null
+/*
+ This file is part of LilyPond, the GNU music typesetter.
+
+ Copyright (C) 2015 by David Kastrup <dak@gnu.org>
+
+ LilyPond is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LilyPond is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "lily-modules.hh"
+
+struct Scm_module::Variable_record
+{
+ const char *name_;
+ Scm_variable *var_;
+ Variable_record *next_;
+ Variable_record (const char *name, Scm_variable *var, Variable_record *next_)
+ : name_ (name), var_ (var), next_ (next_)
+ { }
+};
+
+void
+Scm_module::register_variable (const char *name, Scm_variable *var)
+{
+ variables_ = new Variable_record (name, var, variables_);
+}
+
+Scm_module::Scm_module (const char *name)
+ : name_ (name), module_ (SCM_UNDEFINED), variables_ (0)
+{
+}
+
+void
+Scm_module::boot_init (void *arg)
+{
+ Scm_module *self = static_cast<Scm_module *> (arg);
+
+ // Establish variables first
+ for (Variable_record *p = self->variables_; p;)
+ {
+ Variable_record *next = p->next_;
+ p->var_->boot (p->name_);
+ delete p;
+ p = next;
+ }
+ self->variables_ = 0;
+}
+
+void
+Scm_module::boot ()
+{
+ assert (SCM_UNBNDP (module_));
+ module_ = scm_c_define_module (name_, boot_init, static_cast <void *> (this));
+}
+
+void
+Scm_module::import ()
+{
+ assert (SCM_UNBNDP (module_));
+ module_ = scm_c_resolve_module (name_);
+ for (Variable_record *p = variables_; p;)
+ {
+ Variable_record *next = p->next_;
+ p->var_->import (module_, p->name_);
+ delete p;
+ p = next;
+ }
+ variables_ = 0;
+}
+
+void
+Scm_variable::boot (const char *name)
+{
+ assert (!SCM_VARIABLEP (var_));
+ var_ = scm_c_define (name, var_);
+}
+
+void
+Scm_variable::import (SCM module, const char *name)
+{
+ assert (SCM_UNBNDP (var_));
+ var_ = scm_c_module_lookup (module, name);
+}
+
+
+Scm_variable::Scm_variable (Scm_module &m, const char *name, SCM value)
+ : var_ (value)
+{
+ assert (SCM_IMP (value));
+ m.register_variable (name, this);
+}
#include "program-option.hh"
#include "sources.hh"
#include "warn.hh"
+#include "lily-imports.hh"
LY_DEFINE (ly_parse_file, "ly:parse-file",
1, 0, 0, (SCM name),
"Return the lexer for @var{parser}, defaulting to current parser")
{
if (SCM_UNBNDP (parser))
- parser = scm_fluid_ref (ly_lily_module_constant ("%parser"));
+ parser = scm_fluid_ref (Lily::f_parser);
Lily_parser *p = LY_ASSERT_SMOB (Lily_parser, parser, 1);
return p->lexer_->self_scm ();
}
" lexical environment. If @var{location} is a valid location,"
" it becomes the source of all music expressions inside.")
{
- SCM parser = scm_fluid_ref (ly_lily_module_constant("%parser"));
+ SCM parser = scm_fluid_ref (Lily::f_parser);
Lily_parser *p = LY_ASSERT_SMOB (Lily_parser, parser, 0);
if (SCM_UNBNDP (closures))
2, 0, 0, (SCM symbol, SCM val),
"Bind @var{symbol} to @var{val} in current parser's module.")
{
- SCM parser = scm_fluid_ref (ly_lily_module_constant ("%parser"));
+ SCM parser = scm_fluid_ref (Lily::f_parser);
Lily_parser *p = LY_ASSERT_SMOB (Lily_parser, parser, 0);
LY_ASSERT_TYPE (ly_is_symbol, symbol, 1);
"Look up @var{symbol} in current parser's module."
" Return @code{'()} if not defined.")
{
- SCM parser = scm_fluid_ref (ly_lily_module_constant ("%parser"));
+ SCM parser = scm_fluid_ref (Lily::f_parser);
Lily_parser *p = LY_ASSERT_SMOB (Lily_parser, parser, 0);
LY_ASSERT_TYPE (ly_is_symbol, symbol, 1);
" for current parser. Can only be used in immediate"
" Scheme expressions (@code{$} instead of @code{#}).")
{
- SCM parser = scm_fluid_ref (ly_lily_module_constant ("%parser"));
+ SCM parser = scm_fluid_ref (Lily::f_parser);
Lily_parser *p = LY_ASSERT_SMOB (Lily_parser, parser, 0);
LY_ASSERT_TYPE (scm_is_string, ly_code, 1);
" @var{names} is an alist of symbols. This only has effect"
" if the current mode is notes.")
{
- SCM parser = scm_fluid_ref (ly_lily_module_constant ("%parser"));
+ SCM parser = scm_fluid_ref (Lily::f_parser);
Lily_parser *p = LY_ASSERT_SMOB (Lily_parser, parser, 0);
if (p->lexer_->is_note_state ())
"Return the base name of the output file. If @code{parser} is left off, use currently active parser.")
{
if (SCM_UNBNDP (parser))
- parser = scm_fluid_ref (ly_lily_module_constant ("%parser"));
+ parser = scm_fluid_ref (Lily::f_parser);
Lily_parser *p = LY_ASSERT_SMOB (Lily_parser, parser, 1);
"Display an error message and make current parser fail."
" Without a current parser, trigger an ordinary error.")
{
- SCM parser = scm_fluid_ref (ly_lily_module_constant ("%parser"));
+ SCM parser = scm_fluid_ref (Lily::f_parser);
Lily_parser *p = unsmob<Lily_parser> (parser);
"Clear error flag for @var{parser}, defaulting to current parser.")
{
if (SCM_UNBNDP (parser))
- parser = scm_fluid_ref (ly_lily_module_constant ("%parser"));
+ parser = scm_fluid_ref (Lily::f_parser);
Lily_parser *p = LY_ASSERT_SMOB (Lily_parser, parser, 1);
"Does @var{parser} (defaulting to current parser) have an error flag?")
{
if (SCM_UNBNDP (parser))
- parser = scm_fluid_ref (ly_lily_module_constant ("%parser"));
+ parser = scm_fluid_ref (Lily::f_parser);
Lily_parser *p = LY_ASSERT_SMOB (Lily_parser, parser, 1);
return scm_from_bool (p->error_level_ || p->lexer_->error_level_);
#include "warn.hh"
#include "main.hh"
#include "protected-scm.hh"
+#include "lily-imports.hh"
SCM
ly_make_module (bool safe)
{
/* Look up (evaluate) Scheme make-module function and call it */
- SCM maker = ly_lily_module_constant ("make-module");
- mod = scm_call_0 (maker);
+ mod = Guile_user::make_module ();
/*
Look up and call Guile module-export-all! or, when using
Guile V1.8, the compatible shim defined in lily.scm.
*/
- SCM module_export_all_x = ly_lily_module_constant ("module-export-all!");
- scm_call_1 (module_export_all_x, mod);
+#if GUILEV2
+ Guile_user::module_export_all_x (mod);
+#else
+ Lily::module_export_all_x (mod);
+#endif
/*
Evaluate Guile module "the-root-module",
N.B. this used to be "the-scm-module" and is deprecated in
Guile V1.9/2.0
*/
- SCM scm_module = ly_lily_module_constant ("the-root-module");
- ly_use_module (mod, scm_module);
- ly_use_module (mod, global_lily_module);
+
+ ly_use_module (mod, Guile_user::the_root_module);
+ ly_use_module (mod, Lily::module);
}
else
{
/* Evaluate and call make-safe-lilypond-module */
- SCM proc = ly_lily_module_constant ("make-safe-lilypond-module");
- mod = scm_call_0 (proc);
+ mod = Lily::make_safe_lilypond_module ();
}
return mod;
TODO - Replace inline evaluations (interpreted)
with guile API calls if these become available.
*/
- SCM scm_module_use = ly_symbol2scm ("module-use!");
- SCM scm_module_public_interface = ly_symbol2scm ("module-public-interface");
- SCM iface = scm_list_2 (scm_module_public_interface, used);
/*
Set up to interpret
'(module_use! <mod> (module-public-interface <used>))'
*/
- SCM expr = scm_list_3 (scm_module_use, mod, iface);
- /*
- Now return SCM value, this is the result of interpreting
- '(eval (module-use! <mod> (module-public-interface <used>)) "lily")'
- */
- return scm_eval (expr, global_lily_module);
+ return Guile_user::module_use_x (mod,
+ Guile_user::module_public_interface (used));
}
#define FUNC_NAME __FUNCTION__
void
ly_export (SCM module, SCM namelist)
{
- static SCM export_function;
- if (!export_function)
- export_function = scm_permanent_object (scm_c_lookup ("module-export!"));
-
- scm_call_2 (SCM_VARIABLE_REF (export_function), module, namelist);
+ Guile_user::module_export_x (module, namelist);
}
void
#include "string-convert.hh"
#include "version.hh"
#include "warn.hh"
+#include "lily-imports.hh"
/*
* Global options that can be overridden through command line.
// SCM result = scm_call_1 (
// scm_variable_ref (call_with_error_handling),
// scm_call_1 (ly_lily_module_constant ("lilypond-main"), files));
- SCM result = scm_call_1 (ly_lily_module_constant ("lilypond-main"), files);
- (void) result;
+
+ Lily::lilypond_main (files);
/* Unreachable. */
exit (0);
#include "program-option.hh"
#include "string-convert.hh"
#include "warn.hh"
+#include "lily-imports.hh"
#define PITCH_WHEEL_CENTER 0x2000
#define PITCH_WHEEL_SEMITONE 0X1000
Byte program_byte = 0;
bool found = false;
- SCM proc = ly_lily_module_constant ("midi-program");
- SCM program = scm_call_1 (proc, ly_symbol2scm (audio_->str_.c_str ()));
+ SCM program = Lily::midi_program (ly_symbol2scm (audio_->str_.c_str ()));
found = (scm_is_true (program));
if (found)
program_byte = (Byte) scm_to_int (program);
/*
Issue 2758:
Guile V2 onward has a scm_module_variable API module.
- Guile V1.8.7 only has a (module-variable) REPL function, however
- using ly_lily_module_constant ("module-variable") and calling
- the memoized result is slow.
+ Guile V1.8.7 only has a (module-variable) REPL function and we
+ can't import this via Scm_variable since that needs
+ ly_module_lookup itself.
*/
#if GUILEV1
return scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F);
#include "input.hh"
#include "music.hh"
#include "fluid.hh"
+#include "lily-imports.hh"
const char Music_function::type_p_name_[] = "ly:music-function?";
SCM
Music_function::call (SCM rest)
{
- Fluid location (ly_lily_module_constant ("%location"));
+ Fluid location (Lily::f_location);
// (car (ly:music-signature self_scm())) is the return type, skip it
SCM signature = scm_cdr (get_signature ());
if (scm_is_false (scm_call_1 (pred, arg)))
{
- scm_call_4 (ly_lily_module_constant ("argument-error"),
- location,
- scm_from_int (scm_ilength (args)),
- pred, arg);
+ Lily::argument_error (location,
+ scm_from_int (scm_ilength (args)),
+ pred, arg);
SCM val = scm_car (get_signature ());
val = scm_is_pair (val) ? scm_cdr (val) : SCM_BOOL_F;
return with_loc (val, location);
if (scm_is_true (scm_call_1 (pred, res)))
return with_loc (res, location, false);
- return scm_call_2 (ly_lily_module_constant ("music-function-call-error"),
- self_scm (), res);
+ return Lily::music_function_call_error (self_scm (), res);
}
#include "music-sequence.hh"
#include "score.hh"
#include "warn.hh"
+#include "lily-imports.hh"
/*
Music is anything that has (possibly zero) duration and supports
programming_error ("Not a music type");
Stream_event *e = new Stream_event
- (scm_call_1 (ly_lily_module_constant ("ly:make-event-class"), class_name),
+ (Lily::ly_make_event_class (class_name),
mutable_property_alist_);
Moment length = get_length ();
if (length.to_bool ())
Music *
make_music_by_name (SCM sym)
{
- SCM make_music_proc = ly_lily_module_constant ("make-music");
- SCM rv = scm_call_1 (make_music_proc, sym);
+ SCM rv = Lily::make_music (sym);
/* UGH. */
Music *m = unsmob<Music> (rv);
#include "skyline-pair.hh"
#include "system.hh"
#include "text-interface.hh"
+#include "lily-imports.hh"
/*
Returns the number of footnotes associated with a given line.
number_footnote_table = SCM_EOL;
SCM numbering_function = paper->c_variable ("footnote-numbering-function");
SCM layout = paper->self_scm ();
- SCM props = scm_call_1 (ly_lily_module_constant ("layout-extract-page-properties"),
- paper->self_scm ());
+ SCM props = Lily::layout_extract_page_properties (layout);
Real padding = robust_scm2double (paper->c_variable ("footnote-padding"), 0.0);
Real number_raise = robust_scm2double (paper->c_variable ("footnote-number-raise"), 0.0);
if (orig->is_broken ())
footnote_markup = orig->broken_intos_[0]->get_property ("footnote-text");
- SCM props = scm_call_1 (ly_lily_module_constant ("layout-extract-page-properties"),
- paper->self_scm ());
+ SCM props = Lily::layout_extract_page_properties (paper->self_scm ());
SCM footnote_stl = Text_interface::interpret_markup (paper->self_scm (),
props, footnote_markup);
Stencil
Page_layout_problem::get_footnote_separator_stencil (Output_def *paper)
{
- SCM props = scm_call_1 (ly_lily_module_constant ("layout-extract-page-properties"),
- paper->self_scm ());
+ SCM props = Lily::layout_extract_page_properties (paper->self_scm ());
SCM markup = paper->c_variable ("footnote-separator-markup");
#include "program-option.hh"
#include "page-marker.hh"
#include "ly-module.hh"
+#include "lily-imports.hh"
+
Paper_book::Paper_book ()
{
long page_nb = 0;
if (scm_is_pair (performances_))
{
- SCM proc = ly_lily_module_constant ("write-performances-midis");
-
- scm_call_3 (proc,
- performances (),
- output_channel,
- scm_from_long (*first_performance_number));
+ Lily::write_performances_midis (performances (),
+ output_channel,
+ scm_from_long (*first_performance_number));
*first_performance_number += scm_ilength (performances_);
}
{
if (scm_is_pair (performances_))
{
- SCM proc = ly_lily_module_constant ("write-performances-midis");
- scm_call_3 (proc,
- performances (),
- output,
- scm_from_long (*first_performance_number));
+ Lily::write_performances_midis (performances (),
+ output,
+ scm_from_long (*first_performance_number));
*first_performance_number += scm_ilength (performances_);
}
}
SCM page_properties
- = scm_call_1 (ly_lily_module_constant ("layout-extract-page-properties"),
- paper_->self_scm ());
+ = Lily::layout_extract_page_properties (paper_->self_scm ());
- SCM interpret_markup_list = ly_lily_module_constant ("interpret-markup-list");
SCM header = SCM_EOL;
SCM labels = SCM_EOL;
for (SCM s = scm_reverse (scores_); scm_is_pair (s); s = scm_cdr (s))
}
else if (Text_interface::is_markup_list (scm_car (s)))
{
- SCM texts = scm_call_3 (interpret_markup_list,
- paper_->self_scm (),
- page_properties,
- scm_car (s));
+ SCM texts = Lily::interpret_markup_list (paper_->self_scm (),
+ page_properties,
+ scm_car (s));
Prob *first = 0;
Prob *last = 0;
for (SCM list = texts; scm_is_pair (list); list = scm_cdr (list))
#include "modified-font-metric.hh"
#include "pango-font.hh"
#include "all-font-metrics.hh"
+#include "lily-imports.hh"
Real
output_scale (Output_def *od)
Output_def *
scale_output_def (Output_def *o, Real amount)
{
- SCM proc = ly_lily_module_constant ("scale-layout");
- SCM new_pap = scm_call_2 (proc, o->self_scm (), scm_from_double (amount));
+ SCM new_pap = Lily::scale_layout (o->self_scm (), scm_from_double (amount));
o = unsmob<Output_def> (new_pap);
o->protect ();
#include "scm-hash.hh"
#include "string-convert.hh"
#include "warn.hh"
+#include "lily-imports.hh"
Paper_outputter::Paper_outputter (SCM port, const string &format)
Enable errors for undefined stencil routines if
-dwarning-as-error is specified; else enable warnings.
*/
- SCM proc = ly_lily_module_constant ("backend-testing");
- scm_call_1 (proc, output_module_);
+ Lily::backend_testing (output_module_);
}
Paper_outputter::~Paper_outputter ()
expressions so that we start fresh with the next \book
block. --pmccarty
*/
- SCM proc = ly_lily_module_constant ("remove-stencil-warnings");
- scm_call_1 (proc, output_module_);
+ Lily::remove_stencil_warnings (output_module_);
}
}
#include "main.hh"
#include "paper-book.hh"
#include "source-file.hh"
+#include "lily-imports.hh"
/* Pass string to scm parser, read one expression.
Return result value and #chars read.
static SCM module = SCM_BOOL_F;
if (scm_is_false (module))
{
- SCM function = ly_lily_module_constant ("make-safe-lilypond-module");
- module = scm_gc_protect_object (scm_call_0 (function));
+ module = scm_gc_protect_object (Lily::make_safe_lilypond_module ());
}
return scm_eval (ps->form_, module);
Parse_start ps (form, i, safe, parser);
SCM ans = scm_c_with_fluid
- (ly_lily_module_constant ("%location"),
+ (Lily::f_location,
i.smobbed_copy (),
parse_protect_global ? protected_ly_eval_scm
: catch_protected_eval_body, (void *) &ps);
do { \
if (scm_is_eq (value, SCM_UNSPECIFIED)) \
break; \
- SCM s = scm_call_1 (ly_lily_module_constant ("value->lily-string"), \
- value); \
+ SCM s = Display::value_to_lily_string (value); \
char *p = scm_to_locale_string (s); \
fputs (p, file); \
free (p); \
#include "score.hh"
#include "text-interface.hh"
#include "warn.hh"
+#include "lily-imports.hh"
void
Lily_parser::parser_error (Input const *i, Lily_parser *parser, SCM *, const string &s)
#define LOWLEVEL_MAKE_SYNTAX(location, args) \
scm_c_with_fluid \
- (ly_lily_module_constant ("%location"), \
+ (Lily::f_location, \
parser->lexer_->override_input (location).smobbed_copy (), \
syntax_call, \
reinterpret_cast <void*> (args))
/* Syntactic Sugar. */
#define MAKE_SYNTAX(name, location, ...) \
LOWLEVEL_MAKE_SYNTAX (location, \
- scm_list_n (ly_lily_module_constant (name), \
+ scm_list_n (Lily::name, \
##__VA_ARGS__, SCM_UNDEFINED))
#define START_MAKE_SYNTAX(name, ...) \
- scm_list_n (ly_lily_module_constant (name), \
+ scm_list_n (Lily::name, \
##__VA_ARGS__, SCM_UNDEFINED)
#define FINISH_MAKE_SYNTAX(start, location, ...) \
scm_function_call:
SCM_FUNCTION function_arglist {
- $$ = MAKE_SYNTAX ("music-function", @$,
- $1, $2);
+ $$ = MAKE_SYNTAX (music_function, @$,
+ $1, $2);
}
;
// for empty rules, and the only token in the whole
// production, EMBEDDED_LILY, is synthetic and also
// contains no source location.
- $$ = MAKE_SYNTAX ("void-music", @$);
+ $$ = MAKE_SYNTAX (void_music, @$);
}
| identifier_init_nonumber
| embedded_lilypond_number
$3 = scm_cons ($2, $3);
if (unsmob<Music> ($1))
$3 = scm_cons ($1, $3);
- $$ = MAKE_SYNTAX ("sequential-music", @$, $3);
+ $$ = MAKE_SYNTAX (sequential_music, @$, $3);
}
| error {
parser->error_level_ = 1;
}
} else if (!unsmob<Score> ($$)) {
if (unsmob<Music> ($2)) {
- SCM scorify = ly_lily_module_constant ("scorify-music");
- $2 = scm_call_1 (scorify, $2);
+ $2 = Lily::scorify_music ($2);
}
if (unsmob<Score> ($2))
{
tempo_event:
TEMPO steno_duration '=' tempo_range {
- $$ = MAKE_SYNTAX ("tempo", @$, SCM_EOL, $2, $4);
+ $$ = MAKE_SYNTAX (tempo, @$, SCM_EOL, $2, $4);
}
| TEMPO scalar steno_duration '=' tempo_range {
- $$ = MAKE_SYNTAX ("tempo", @$, $2, $3, $5);
+ $$ = MAKE_SYNTAX (tempo, @$, $2, $3, $5);
}
| TEMPO scalar {
- $$ = MAKE_SYNTAX ("tempo", @$, $2);
+ $$ = MAKE_SYNTAX (tempo, @$, $2);
} %prec ':'
;
if (!unsmob<Music> ($$))
{
parser->parser_error (@1, _ ("music expected"));
- $$ = MAKE_SYNTAX ("void-music", @$);
+ $$ = MAKE_SYNTAX (void_music, @$);
}
}
;
repeated_music:
REPEAT simple_string unsigned_number music
{
- $$ = MAKE_SYNTAX ("repeat", @$, $2, $3, $4, SCM_EOL);
+ $$ = MAKE_SYNTAX (repeat, @$, $2, $3, $4, SCM_EOL);
}
| REPEAT simple_string unsigned_number music ALTERNATIVE braced_music_list
{
- $$ = MAKE_SYNTAX ("repeat", @$, $2, $3, $4, $6);
+ $$ = MAKE_SYNTAX (repeat, @$, $2, $3, $4, $6);
}
;
sequential_music:
SEQUENTIAL braced_music_list {
- $$ = MAKE_SYNTAX ("sequential-music", @$, $2);
+ $$ = MAKE_SYNTAX (sequential_music, @$, $2);
}
| braced_music_list {
- $$ = MAKE_SYNTAX ("sequential-music", @$, $1);
+ $$ = MAKE_SYNTAX (sequential_music, @$, $1);
}
;
simultaneous_music:
SIMULTANEOUS braced_music_list {
- $$ = MAKE_SYNTAX ("simultaneous-music", @$, $2);
+ $$ = MAKE_SYNTAX (simultaneous_music, @$, $2);
}
| DOUBLE_ANGLE_OPEN music_list DOUBLE_ANGLE_CLOSE {
- $$ = MAKE_SYNTAX ("simultaneous-music", @$, scm_reverse_x ($2, SCM_EOL));
+ $$ = MAKE_SYNTAX (simultaneous_music, @$, scm_reverse_x ($2, SCM_EOL));
}
;
SCM mods = SCM_EOL;
if (ctxmod)
mods = ctxmod->get_mods ();
- $$ = START_MAKE_SYNTAX ("context-specification", $2, $3, mods, SCM_BOOL_F);
+ $$ = START_MAKE_SYNTAX (context_specification, $2, $3, mods, SCM_BOOL_F);
}
| NEWCONTEXT symbol optional_id optional_context_mod {
Context_mod *ctxmod = unsmob<Context_mod> ($4);
SCM mods = SCM_EOL;
if (ctxmod)
mods = ctxmod->get_mods ();
- $$ = START_MAKE_SYNTAX ("context-specification", $2, $3, mods, SCM_BOOL_T);
+ $$ = START_MAKE_SYNTAX (context_specification, $2, $3, mods, SCM_BOOL_T);
}
;
| repeated_music
| music_bare
| LYRICSTO simple_string lyric_mode_music {
- $$ = MAKE_SYNTAX ("lyric-combine", @$, $2, SCM_EOL, $3);
+ $$ = MAKE_SYNTAX (lyric_combine, @$, $2, SCM_EOL, $3);
}
| LYRICSTO symbol '=' simple_string lyric_mode_music
{
- $$ = MAKE_SYNTAX ("lyric_combine", @$, $3, $2, $4);
+ $$ = MAKE_SYNTAX (lyric_combine, @$, $3, $2, $4);
}
;
Input i;
i.set_location (@1, @2);
$$ = FINISH_MAKE_SYNTAX ($1, i, $2);
- $$ = MAKE_SYNTAX ("add-lyrics", @$, $$, scm_reverse_x ($3, SCM_EOL));
+ $$ = MAKE_SYNTAX (add_lyrics, @$, $$, scm_reverse_x ($3, SCM_EOL));
} %prec COMPOSITE
| context_prefix contextable_music
{
| contexted_basic_music
| basic_music new_lyrics
{
- $$ = MAKE_SYNTAX ("add-lyrics", @$, $1, scm_reverse_x ($2, SCM_EOL));
+ $$ = MAKE_SYNTAX (add_lyrics, @$, $1, scm_reverse_x ($2, SCM_EOL));
} %prec COMPOSITE
;
symbol_list_part:
symbol_list_element
{
- SCM sym_l_p = ly_lily_module_constant ("symbol-list?");
- $$ = try_string_variants (sym_l_p, $1);
+ $$ = try_string_variants (Lily::symbol_list_p, $1);
if (SCM_UNBNDP ($$)) {
parser->parser_error (@1, _("not a symbol"));
$$ = SCM_EOL;
music_function_call:
MUSIC_FUNCTION function_arglist {
- $$ = MAKE_SYNTAX ("music-function", @$,
- $1, $2);
+ $$ = MAKE_SYNTAX (music_function, @$,
+ $1, $2);
}
;
mode_changing_head grouped_music_list {
if (scm_is_eq ($1, ly_symbol2scm ("chords")))
{
- $$ = MAKE_SYNTAX ("unrelativable-music", @$, $2);
+ $$ = MAKE_SYNTAX (unrelativable_music, @$, $2);
}
else
{
SCM mods = SCM_EOL;
if (ctxmod)
mods = ctxmod->get_mods ();
- $$ = MAKE_SYNTAX ("context-specification", @$, $1, SCM_EOL, mods, SCM_BOOL_T, $3);
+ $$ = MAKE_SYNTAX (context_specification, @$, $1, SCM_EOL, mods, SCM_BOOL_T, $3);
if (scm_is_eq ($1, ly_symbol2scm ("ChordNames")))
{
- $$ = MAKE_SYNTAX ("unrelativable-music", @$, $$);
+ $$ = MAKE_SYNTAX (unrelativable_music, @$, $$);
}
parser->lexer_->pop_state ();
}
context_change:
CHANGE symbol '=' simple_string {
- $$ = MAKE_SYNTAX ("context-change", @$, $2, $4);
+ $$ = MAKE_SYNTAX (context_change, @$, $2, $4);
}
;
music_property_def:
OVERRIDE grob_prop_path '=' scalar {
if (SCM_UNBNDP ($2))
- $$ = MAKE_SYNTAX ("void-music", @$);
+ $$ = MAKE_SYNTAX (void_music, @$);
else {
- $$ = MAKE_SYNTAX ("property-operation", @$,
+ $$ = MAKE_SYNTAX (property_operation, @$,
scm_car ($2),
ly_symbol2scm ("OverrideProperty"),
scm_cadr ($2),
}
}
| REVERT simple_revert_context revert_arg {
- $$ = MAKE_SYNTAX ("property-operation", @$,
+ $$ = MAKE_SYNTAX (property_operation, @$,
$2,
ly_symbol2scm ("RevertProperty"),
scm_car ($3),
}
| SET context_prop_spec '=' scalar {
if (SCM_UNBNDP ($2))
- $$ = MAKE_SYNTAX ("void-music", @$);
+ $$ = MAKE_SYNTAX (void_music, @$);
else
- $$ = MAKE_SYNTAX ("property-operation", @$,
+ $$ = MAKE_SYNTAX (property_operation, @$,
scm_car ($2),
ly_symbol2scm ("PropertySet"),
scm_cadr ($2),
}
| UNSET context_prop_spec {
if (SCM_UNBNDP ($2))
- $$ = MAKE_SYNTAX ("void-music", @$);
+ $$ = MAKE_SYNTAX (void_music, @$);
else
- $$ = MAKE_SYNTAX ("property-operation", @$,
+ $$ = MAKE_SYNTAX (property_operation, @$,
scm_car ($2),
ly_symbol2scm ("PropertyUnset"),
scm_cadr ($2));
{
// This is a bit of overkill but makes the same
// routine responsible for all symbol interpretations.
- $$ = try_string_variants (ly_lily_module_constant ("symbol?"),
- $1);
+ $$ = try_string_variants (Guile_user::symbol_p, $1);
if (SCM_UNBNDP ($$))
{
parser->parser_error (@1, (_ ("symbol expected")));
| CHORD_REPETITION optional_notemode_duration post_events {
Input i;
i.set_location (@1, @3);
- $$ = MAKE_SYNTAX ("repetition-chord", i,
+ $$ = MAKE_SYNTAX (repetition_chord, i,
$2, scm_reverse_x ($3, SCM_EOL));
} %prec ':'
| MULTI_MEASURE_REST optional_notemode_duration post_events {
Input i;
i.set_location (@1, @3);
- $$ = MAKE_SYNTAX ("multi-measure-rest", i, $2,
+ $$ = MAKE_SYNTAX (multi_measure_rest, i, $2,
scm_reverse_x ($3, SCM_EOL));
} %prec ':'
| tempo_event
chord_body:
ANGLE_OPEN chord_body_elements ANGLE_CLOSE
{
- $$ = MAKE_SYNTAX ("event-chord", @$, scm_reverse_x ($2, SCM_EOL));
+ $$ = MAKE_SYNTAX (event_chord, @$, scm_reverse_x ($2, SCM_EOL));
}
| FIGURE_OPEN figure_list FIGURE_CLOSE
{
- $$ = MAKE_SYNTAX ("event-chord", @$, scm_reverse_x ($2, SCM_EOL));
+ $$ = MAKE_SYNTAX (event_chord, @$, scm_reverse_x ($2, SCM_EOL));
}
;
event_function_event:
EVENT_FUNCTION function_arglist {
- $$ = MAKE_SYNTAX ("music-function", @$,
- $1, $2);
+ $$ = MAKE_SYNTAX (music_function, @$,
+ $1, $2);
}
;
SCM elts = ly_append2 ($1, scm_reverse_x ($2, SCM_EOL));
- $$ = MAKE_SYNTAX ("event-chord", @1, elts);
+ $$ = MAKE_SYNTAX (event_chord, @1, elts);
} else if (!unsmob<Pitch> ($1))
- $$ = MAKE_SYNTAX ("event-chord", @1, $1);
+ $$ = MAKE_SYNTAX (event_chord, @1, $1);
// A mere pitch drops through.
} %prec ':'
;
lyric_element_music:
lyric_element optional_notemode_duration post_events {
- $$ = MAKE_SYNTAX ("lyric-event", @$, $1, $2);
+ $$ = MAKE_SYNTAX (lyric_event, @$, $1, $2);
if (scm_is_pair ($3))
unsmob<Music> ($$)->set_property
("articulations", scm_reverse_x ($3, SCM_EOL));
markup_top:
markup_list {
- $$ = scm_list_2 (ly_lily_module_constant ("line-markup"), $1);
+ $$ = scm_list_2 (Lily::line_markup, $1);
}
| markup_head_1_list simple_markup
{
- $$ = scm_car (MAKE_SYNTAX ("composed-markup-list",
+ $$ = scm_car (MAKE_SYNTAX (composed_markup_list,
@2, $1, scm_list_1 ($2)));
}
| simple_markup {
sc->add_output_def (od);
od->unprotect ();
}
- $$ = scm_list_1 (scm_list_2 (ly_lily_module_constant ("score-lines-markup-list"), $4));
+ $$ = scm_list_1 (scm_list_2 (Lily::score_lines_markup_list, $4));
parser->lexer_->pop_state ();
}
;
markup_composed_list:
markup_head_1_list markup_uncomposed_list {
- $$ = MAKE_SYNTAX ("composed-markup-list",
+ $$ = MAKE_SYNTAX (composed_markup_list,
@2, $1, $2);
}
;
sc->add_output_def (od);
od->unprotect ();
}
- $$ = scm_list_2 (ly_lily_module_constant ("score-markup"), $4);
+ $$ = scm_list_2 (Lily::score_markup, $4);
parser->lexer_->pop_state ();
}
| MARKUP_FUNCTION markup_command_basic_arguments {
markup:
markup_head_1_list simple_markup
{
- $$ = scm_car (MAKE_SYNTAX ("composed-markup-list",
+ $$ = scm_car (MAKE_SYNTAX (composed_markup_list,
@2, $1, scm_list_1 ($2)));
}
| simple_markup {
SCM
Lily_parser::do_yyparse ()
{
- return scm_c_with_fluid (ly_lily_module_constant ("%parser"),
+ return scm_c_with_fluid (Lily::f_parser,
self_scm (),
do_yyparse_trampoline,
static_cast <void *>(this));
return args;
}
scm_set_cdr_x (scm_last_pair (args), SCM_EOL);
- MAKE_SYNTAX ("argument-error", loc, scm_length (args), pred,
+ MAKE_SYNTAX (argument_error, loc, scm_length (args), pred,
SCM_UNBNDP (disp) ? arg : disp);
scm_set_cdr_x (scm_last_pair (args), SCM_BOOL_F);
return args;
return simple;
} else if (parser->lexer_->is_lyric_state ()) {
if (Text_interface::is_markup (simple))
- return MAKE_SYNTAX ("lyric-event", loc, simple,
+ return MAKE_SYNTAX (lyric_event, loc, simple,
parser->default_duration_.smobbed_copy ());
} else if (parser->lexer_->is_chord_state ()) {
if (unsmob<Pitch> (simple))
return MAKE_SYNTAX
- ("event-chord",
+ (event_chord,
loc,
make_chord_elements (loc, simple,
parser->default_duration_.smobbed_copy (),
SCM
make_chord_elements (Input loc, SCM pitch, SCM dur, SCM modification_list)
{
- SCM chord_ctor = ly_lily_module_constant ("construct-chord-elements");
- SCM res = scm_call_3 (chord_ctor, pitch, dur, modification_list);
+ SCM res = Lily::construct_chord_elements (pitch, dur, modification_list);
for (SCM s = res; scm_is_pair (s); s = scm_cdr (s))
{
unsmob<Music> (scm_car (s))->set_spot (loc);
#include "music-iterator.hh"
#include "music-sequence.hh"
#include "warn.hh"
+#include "lily-imports.hh"
static const char *const CONTEXT_ONE = "one";
static const char *const CONTEXT_TWO = "two";
if (!mmrest_event_)
{
mmrest_event_ = new Stream_event
- (scm_call_1 (ly_lily_module_constant ("ly:make-event-class"),
- ly_symbol2scm ("multi-measure-rest-event")));
+ (Lily::ly_make_event_class (ly_symbol2scm ("multi-measure-rest-event")));
mmrest_event_->set_property ("duration", SCM_EOL);
mmrest_event_->unprotect ();
}
#include "moment.hh"
#include "music.hh"
#include "simple-music-iterator.hh"
+#include "lily-imports.hh"
class Partial_iterator : public Simple_music_iterator
{
// measurePosition when initializing.
Context *timing = unsmob<Context>
- (scm_call_2 (ly_lily_module_constant ("ly:context-find"),
- get_outlet ()->self_scm (),
- ly_symbol2scm ("Timing")));
+ (Lily::ly_context_find (get_outlet ()->self_scm (),
+ ly_symbol2scm ("Timing")));
if (!timing)
programming_error ("missing Timing in \\partial");
LY_ASSERT_SMOB (Context, ctx, 1);
LY_ASSERT_SMOB (Moment, length, 2);
Context *timing = unsmob<Context>
- (scm_call_2 (ly_lily_module_constant ("ly:context-find"),
- ctx,
- ly_symbol2scm ("Timing")));
+ (Lily::ly_context_find (ctx, ly_symbol2scm ("Timing")));
if (!timing) {
programming_error ("missing Timing in \\partial");
return SCM_UNSPECIFIED;
#include "input.hh"
#include "repeated-music.hh"
#include "sequential-iterator.hh"
+#include "lily-imports.hh"
class Percent_repeat_iterator : public Sequential_iterator
{
event_type = "DoublePercentEvent";
else
{
- slash_count
- = scm_call_1 (ly_lily_module_constant ("calc-repeat-slash-count"),
- child->self_scm ());
+ slash_count = Lily::calc_repeat_slash_count (child->self_scm ());
event_type = "RepeatSlashEvent";
}
#include "parse-scm.hh"
#include "string-convert.hh"
#include "warn.hh"
+#include "lily-imports.hh"
bool debug_skylines;
bool debug_property_callbacks;
get_help_string ()
{
SCM alist = ly_hash2alist (option_hash);
- SCM converter = ly_lily_module_constant ("scm->string");
vector<string> opts;
string opt_spec = String_convert::char_string (' ', INDENT)
+ ly_symbol2string (sym)
+ " ("
- + ly_scm2string (scm_call_1 (converter, val))
+ + ly_scm2string (Lily::scm_to_string (val))
+ ")";
if (opt_spec.length () + SEPARATION > HELP_INDENT)
#include "grob.hh"
#include "unpure-pure-container.hh"
#include "warn.hh"
+#include "lily-imports.hh"
MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Rest_collision, force_shift_callback_rest, 2, 1, "");
SCM
chain_offset_callback (rest,
Unpure_pure_container::make_smob
(Rest_collision::force_shift_callback_rest_proc,
- ly_lily_module_constant ("pure-chain-offset-callback")),
+ Lily::pure_chain_offset_callback),
Y_AXIS);
}
}
#include "item.hh"
#include "engraver.hh"
#include "pointer-group-interface.hh"
+#include "lily-imports.hh"
/**
SCM vis = bars_[0]->get_property ("break-visibility");
if (ly_is_equal (spanbar_->get_property ("break-visibility"), vis))
spanbar_->set_property ("break-visibility", vis);
- scm_call_1 (ly_lily_module_constant ("span-bar::notify-grobs-of-my-existence"), spanbar_->self_scm ());
+ Lily::span_bar_notify_grobs_of_my_existence (spanbar_->self_scm ());
spanbar_ = 0;
}
bars_.resize (0);
#include "international.hh"
#include "performer-group.hh"
#include "warn.hh"
+#include "lily-imports.hh"
/* Perform a staff. Individual notes should have their instrument
(staff-wide) set, so we override play_element ()
announce_element (Audio_element_info (instrument_, 0));
Audio_staff *audio_staff = get_audio_staff (voice);
audio_staff->add_audio_item (instrument_);
- SCM proc = ly_lily_module_constant ("percussion?");
- SCM drums = scm_call_1 (proc, ly_symbol2scm (instrument_string_.c_str ()));
+ SCM drums = Lily::percussion_p (ly_symbol2scm (instrument_string_.c_str ()));
audio_staff->percussion_ = to_boolean (drums);
}
#include "text-interface.hh"
#include "warn.hh"
#include "unpure-pure-container.hh"
+#include "lily-imports.hh"
System::System (System const &src)
: Spanner (src)
if (!Text_interface::is_markup (footnote_markup))
continue;
- SCM props = scm_call_1 (ly_lily_module_constant ("layout-extract-page-properties"),
- pscore_->layout ()->self_scm ());
+ SCM props =
+ Lily::layout_extract_page_properties (pscore_->layout ()->self_scm ());
SCM footnote_stl = Text_interface::interpret_markup (pscore_->layout ()->self_scm (),
props, footnote_markup);
#include "program-option.hh"
#include "international.hh"
#include "warn.hh"
+#include "lily-imports.hh"
static void
replace_special_characters (string &str, SCM props)
SCM encoding = ly_chain_assoc_get (ly_symbol2scm ("font-encoding"),
props,
SCM_BOOL_F);
- SCM music_encodings = ly_lily_module_constant ("all-music-font-encodings");
+ SCM music_encodings = Lily::all_music_font_encodings;
bool is_music = scm_is_true (scm_memq (encoding, music_encodings));
return fm->text_stencil (layout, str, is_music).smobbed_copy ();
bool
Text_interface::is_markup_list (SCM x)
{
- SCM music_list_p = ly_lily_module_constant ("markup-list?");
- return scm_is_true (scm_call_1 (music_list_p, x));
+ return scm_is_true (Lily::markup_list_p (x));
}
ADD_INTERFACE (Text_interface,
#include "translator-group.hh"
#include "global-context.hh"
#include "moment.hh"
+#include "lily-imports.hh"
void
Timing_translator::stop_translation_timestep ()
void
Timing_translator::initialize ()
{
- Context *timing = unsmob<Context> (scm_call_2 (ly_lily_module_constant ("ly:context-find"),
- context ()->self_scm (),
- ly_symbol2scm ("Timing")));
+ Context *timing = unsmob<Context>
+ (Lily::ly_context_find (context ()->self_scm (), ly_symbol2scm ("Timing")));
if (timing != context ())
{
context ()->add_alias (ly_symbol2scm ("Timing"));
// since it does not track changes of the variable. However,
// this is still better than nothing, and we already complained
// via a programming_error
- timeSignatureSettings = ly_lily_module_constant ("default-time-signature-settings");
+ timeSignatureSettings = Lily::default_time_signature_settings;
}
context ()->set_property ("timeSignatureSettings", timeSignatureSettings);
SCM beamExceptions = timing->get_property ("beamExceptions");
if (!scm_is_pair (beamExceptions))
{
- beamExceptions =
- scm_call_2 (ly_lily_module_constant ("beam-exceptions"),
- timeSignatureFraction,
- timeSignatureSettings);
+ beamExceptions = Lily::beam_exceptions (timeSignatureFraction,
+ timeSignatureSettings);
}
context ()->set_property ("beamExceptions", beamExceptions);
{
baseMoment =
Moment (ly_scm2rational
- (scm_call_2 (ly_lily_module_constant ("base-length"),
- timeSignatureFraction,
- timeSignatureSettings))).smobbed_copy ();
+ (Lily::base_length (timeSignatureFraction,
+ timeSignatureSettings))).smobbed_copy ();
}
context ()->set_property ("baseMoment", baseMoment);
if (!scm_is_pair (beatStructure))
{
beatStructure =
- scm_call_3 (ly_lily_module_constant ("beat-structure"),
- ly_rational2scm (unsmob<Moment> (baseMoment)->main_part_),
- timeSignatureFraction,
- timeSignatureSettings);
+ Lily::beat_structure (ly_rational2scm (unsmob<Moment> (baseMoment)->main_part_),
+ timeSignatureFraction,
+ timeSignatureSettings);
}
context ()->set_property ("beatStructure", beatStructure);
#include "music.hh"
#include "music-wrapper-iterator.hh"
#include "stream-event.hh"
+#include "lily-imports.hh"
/*
Iterates \times, by sending TupletSpanEvents at the start/end of each
Music *
Tuplet_iterator::create_event (Direction d)
{
- SCM ev_scm = scm_call_2 (ly_lily_module_constant ("make-span-event"),
- ly_symbol2scm ("TupletSpanEvent"),
- scm_from_int (d));
+ SCM ev_scm = Lily::make_span_event (ly_symbol2scm ("TupletSpanEvent"),
+ scm_from_int (d));
Music *mus = get_music ();
#include "directional-element-interface.hh"
#include "lookup.hh"
#include "tuplet-bracket.hh"
+#include "lily-imports.hh"
/*
this is too complicated. Yet another version of side-positioning,
else
str = "|";
- no_vertical_end |= ly_scm2bool (scm_call_1 (ly_lily_module_constant ("volta-bracket::calc-hook-visibility"),
- ly_string2scm (str)));
+ no_vertical_end |= ly_scm2bool (Lily::volta_bracket_calc_hook_visibility
+ (ly_string2scm (str)));
if (no_vertical_end || no_vertical_start)
{
#include "music.hh"
#include "sequential-iterator.hh"
#include "context.hh"
+#include "lily-imports.hh"
class Volta_repeat_iterator : public Sequential_iterator
{
if (to_boolean (get_outlet ()->get_property ("timing")))
{
for (SCM p = alt_restores_; scm_is_pair (p); p = scm_cdr (p))
- scm_apply_0 (ly_lily_module_constant ("ly:context-set-property!"),
+ scm_apply_0 (Lily::ly_context_set_property_x,
scm_car (p));
}
}