From: Phil Holmes Date: Thu, 9 Jun 2016 11:06:07 +0000 (+0100) Subject: Merge remote branch 'origin/master' into release/unstable X-Git-Tag: release/2.19.43-1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=refs%2Ftags%2Frelease%2F2.19.43-1;hp=069849bc5b08acb4d278ffd7defb5f1d636d9540;p=lilypond.git Merge remote branch 'origin/master' into release/unstable --- diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index a560a25940..ab4f2a4ce4 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -27,8 +27,6 @@ #include "scm-hash.hh" #include "warn.hh" -const char * const All_font_metrics::type_p_name_ = 0; - Index_to_charcode_map const * All_font_metrics::get_index_to_charcode_map (const string &filename, int face_index, diff --git a/lily/book-scheme.cc b/lily/book-scheme.cc index cf35a7c1bd..af0cb62632 100644 --- a/lily/book-scheme.cc +++ b/lily/book-scheme.cc @@ -178,4 +178,4 @@ LY_DEFINE (ly_book_scores, "ly:book-scores", } -const char Book::type_p_name_[] = "ly:book?"; +const char * const Book::type_p_name_ = "ly:book?"; diff --git a/lily/box.cc b/lily/box.cc index 629b8010fa..6569493419 100644 --- a/lily/box.cc +++ b/lily/box.cc @@ -133,4 +133,4 @@ Box::print () /****************************************************************/ -const char Box::type_p_name_[] = "ly:box?"; +const char * const Box::type_p_name_ = "ly:box?"; diff --git a/lily/callback.cc b/lily/callback.cc deleted file mode 100644 index baab7b0614..0000000000 --- a/lily/callback.cc +++ /dev/null @@ -1,25 +0,0 @@ -/* - This file is part of LilyPond, the GNU music typesetter. - - Copyright (C) 2016 David Kastrup - - 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 . -*/ - -#include "callback.hh" - -const char * const Callback_wrapper::type_p_name_ = 0; -const char * const Callback2_wrapper::type_p_name_ = 0; -const char * const Callback0_wrapper::type_p_name_ = 0; -const char * const Method_instance::type_p_name_ = 0; diff --git a/lily/context-def.cc b/lily/context-def.cc index 3258297b49..402bd80b6e 100644 --- a/lily/context-def.cc +++ b/lily/context-def.cc @@ -82,7 +82,7 @@ Context_def::~Context_def () { } -const char Context_def::type_p_name_[] = "ly:context-def?"; +const char * const Context_def::type_p_name_ = "ly:context-def?"; int Context_def::print_smob (SCM port, scm_print_state *) const diff --git a/lily/context-mod.cc b/lily/context-mod.cc index a533da2cbd..892d692bbf 100644 --- a/lily/context-mod.cc +++ b/lily/context-mod.cc @@ -34,7 +34,7 @@ Context_mod::Context_mod (SCM mod_list) mods_ = scm_reverse (mod_list); } -const char Context_mod::type_p_name_[] = "ly:context-mod?"; +const char * const Context_mod::type_p_name_ = "ly:context-mod?"; int Context_mod::print_smob (SCM port, scm_print_state *) const diff --git a/lily/context-property.cc b/lily/context-property.cc index e0acae1455..6e22b2f808 100644 --- a/lily/context-property.cc +++ b/lily/context-property.cc @@ -66,7 +66,7 @@ class Grob_properties : public Simple_smob { public: SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; private: friend class Grob_property_info; friend SCM ly_make_grob_properties (SCM); @@ -97,7 +97,7 @@ private: cooked_ (alist), cooked_from_ (alist), nested_ (0) { } }; -const char Grob_properties::type_p_name_[] = "ly:grob-properties?"; +const char * const Grob_properties::type_p_name_ = "ly:grob-properties?"; SCM Grob_properties::mark_smob () const diff --git a/lily/context.cc b/lily/context.cc index d96382e968..7de61c5796 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -779,7 +779,7 @@ Context::mark_smob () const return properties_scm_; } -const char Context::type_p_name_[] = "ly:context?"; +const char * const Context::type_p_name_ = "ly:context?"; Global_context * Context::get_global_context () const diff --git a/lily/dispatcher.cc b/lily/dispatcher.cc index 8f938d6f91..b1b076759f 100644 --- a/lily/dispatcher.cc +++ b/lily/dispatcher.cc @@ -23,7 +23,7 @@ #include "warn.hh" #include "lily-imports.hh" -const char Dispatcher::type_p_name_[] = "ly:dispatcher?"; +const char * const Dispatcher::type_p_name_ = "ly:dispatcher?"; Dispatcher::~Dispatcher () { diff --git a/lily/duration.cc b/lily/duration.cc index 0b10019540..0c6fa4dd5f 100644 --- a/lily/duration.cc +++ b/lily/duration.cc @@ -136,7 +136,7 @@ Duration::to_string () const return s; } -const char Duration::type_p_name_[] = "ly:duration?"; +const char * const Duration::type_p_name_ = "ly:duration?"; int diff --git a/lily/font-metric.cc b/lily/font-metric.cc index f2b6a0e147..c9daa95f3e 100644 --- a/lily/font-metric.cc +++ b/lily/font-metric.cc @@ -112,7 +112,7 @@ Font_metric::print_smob (SCM port, scm_print_state *) const return 1; } -const char Font_metric::type_p_name_[] = "ly:font-metric?"; +const char * const Font_metric::type_p_name_ = "ly:font-metric?"; SCM Font_metric::font_file_name () const diff --git a/lily/grob-array.cc b/lily/grob-array.cc index ec0ee43e18..f5228dfd71 100644 --- a/lily/grob-array.cc +++ b/lily/grob-array.cc @@ -116,7 +116,7 @@ Grob_array::filter_map_assign (const Grob_array &src, filter_map (map_fun); } -const char Grob_array::type_p_name_[] = "ly:grob-array?"; +const char * const Grob_array::type_p_name_ = "ly:grob-array?"; SCM diff --git a/lily/grob-smob.cc b/lily/grob-smob.cc index 066b700a25..72949973b1 100644 --- a/lily/grob-smob.cc +++ b/lily/grob-smob.cc @@ -23,7 +23,7 @@ #include "warn.hh" -const char Grob::type_p_name_[] = "ly:grob?"; +const char * const Grob::type_p_name_ = "ly:grob?"; SCM Grob::mark_smob () const diff --git a/lily/include/all-font-metrics.hh b/lily/include/all-font-metrics.hh index f206a3b95d..a2d090a6df 100644 --- a/lily/include/all-font-metrics.hh +++ b/lily/include/all-font-metrics.hh @@ -48,7 +48,6 @@ class All_font_metrics : public Smob All_font_metrics (All_font_metrics const &); public: - static const char * const type_p_name_; // = 0 SCM mark_smob () const; Index_to_charcode_map const *get_index_to_charcode_map (const string &filename, diff --git a/lily/include/book.hh b/lily/include/book.hh index 3ea6c2c550..0a71a6b9e4 100644 --- a/lily/include/book.hh +++ b/lily/include/book.hh @@ -30,7 +30,7 @@ class Book : public Smob { public: SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Book (); SCM header_; Output_def *paper_; diff --git a/lily/include/box.hh b/lily/include/box.hh index 7d5745d696..d4a8655a42 100644 --- a/lily/include/box.hh +++ b/lily/include/box.hh @@ -12,7 +12,7 @@ class Box : public Simple_smob { public: - static const char type_p_name_[]; + static const char * const type_p_name_; private: Interval interval_a_[NO_AXES]; public: diff --git a/lily/include/callback.hh b/lily/include/callback.hh index 963f4eb59c..671140673f 100644 --- a/lily/include/callback.hh +++ b/lily/include/callback.hh @@ -48,7 +48,6 @@ class Callback_wrapper : public Simple_smob : trampoline_ (trampoline) { } // Private constructor, use only in make_smob public: - static const char * const type_p_name_; // = 0 LY_DECLARE_SMOB_PROC (&Callback_wrapper::call, 2, 0, 0) SCM call (SCM target, SCM arg) { @@ -77,7 +76,6 @@ class Callback2_wrapper : public Simple_smob : trampoline_ (trampoline) { } // Private constructor, use only in make_smob public: - static const char * const type_p_name_; // = 0 LY_DECLARE_SMOB_PROC (&Callback2_wrapper::call, 3, 0, 0) SCM call (SCM target, SCM arg1, SCM arg2) { @@ -102,7 +100,6 @@ class Callback0_wrapper : public Simple_smob : trampoline_ (trampoline) { } // Private constructor, use only in make_smob public: - static const char * const type_p_name_; // = 0 LY_DECLARE_SMOB_PROC (&Callback0_wrapper::call, 1, 0, 0) SCM call (SCM target) { @@ -153,7 +150,6 @@ class Method_instance : public Simple_smob { SCM method_, instance_; public: - static const char * const type_p_name_; // = 0 LY_DECLARE_SMOB_PROC (&Method_instance::call, 0, 0, 1) SCM call (SCM rest) { diff --git a/lily/include/context-def.hh b/lily/include/context-def.hh index c49fee1e30..b068e204c0 100644 --- a/lily/include/context-def.hh +++ b/lily/include/context-def.hh @@ -35,7 +35,7 @@ struct Context_def : public Smob { SCM mark_smob () const; int print_smob (SCM, scm_print_state *) const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Context_def (); private: /* diff --git a/lily/include/context-mod.hh b/lily/include/context-mod.hh index c9f0caa8fb..81b1f34e36 100644 --- a/lily/include/context-mod.hh +++ b/lily/include/context-mod.hh @@ -38,7 +38,7 @@ struct Context_mod : public Simple_smob { SCM mark_smob () const; int print_smob (SCM, scm_print_state *) const; - static const char type_p_name_[]; + static const char * const type_p_name_; private: SCM mods_; public: diff --git a/lily/include/context.hh b/lily/include/context.hh index 130a304f93..468f612061 100644 --- a/lily/include/context.hh +++ b/lily/include/context.hh @@ -33,7 +33,7 @@ class Context : public Smob public: SCM mark_smob () const; int print_smob (SCM, scm_print_state *) const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Context (); private: Scheme_hash_table *properties_dict () const; diff --git a/lily/include/dispatcher.hh b/lily/include/dispatcher.hh index f0eb30ba6d..98a8626fd8 100644 --- a/lily/include/dispatcher.hh +++ b/lily/include/dispatcher.hh @@ -29,7 +29,7 @@ class Dispatcher : public Smob public: int print_smob (SCM, scm_print_state *) const; SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Dispatcher (); private: /* Hash table. Each event-class maps to a list of listeners. */ diff --git a/lily/include/duration.hh b/lily/include/duration.hh index 7a57cf53af..6233fc1b2d 100644 --- a/lily/include/duration.hh +++ b/lily/include/duration.hh @@ -29,7 +29,7 @@ struct Duration : public Simple_smob { static SCM equal_p (SCM, SCM); int print_smob (SCM, scm_print_state *) const; - static const char type_p_name_[]; + static const char * const type_p_name_; Duration (); Duration (int, int); Duration (Rational, bool scale); diff --git a/lily/include/font-metric.hh b/lily/include/font-metric.hh index d74c8157ca..e385a1e7af 100644 --- a/lily/include/font-metric.hh +++ b/lily/include/font-metric.hh @@ -35,7 +35,7 @@ class Font_metric : public Smob public: int print_smob (SCM, scm_print_state *) const; SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Font_metric (); private: DECLARE_CLASSNAME (Font_metric); diff --git a/lily/include/grob-array.hh b/lily/include/grob-array.hh index 1a755fe661..ca925b4291 100644 --- a/lily/include/grob-array.hh +++ b/lily/include/grob-array.hh @@ -29,7 +29,7 @@ class Grob_array : public Simple_smob public: int print_smob (SCM, scm_print_state *) const; SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; private: vector grobs_; bool ordered_; diff --git a/lily/include/grob.hh b/lily/include/grob.hh index db51e02e73..a9408f09a2 100644 --- a/lily/include/grob.hh +++ b/lily/include/grob.hh @@ -32,7 +32,7 @@ class Grob : public Smob public: int print_smob (SCM, scm_print_state *) const; SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Grob (); private: DECLARE_CLASSNAME (Grob); diff --git a/lily/include/input.hh b/lily/include/input.hh index b77db2d66f..aab0d117a6 100644 --- a/lily/include/input.hh +++ b/lily/include/input.hh @@ -32,7 +32,7 @@ class Input : public Simple_smob char const *end_; Source_file *source_file_; public: - static const char type_p_name_[]; + static const char * const type_p_name_; int print_smob (SCM, scm_print_state *) const; static SCM equal_p (SCM, SCM); SCM mark_smob () const; diff --git a/lily/include/lily-imports.hh b/lily/include/lily-imports.hh index 97982895f5..d930f69cf9 100644 --- a/lily/include/lily-imports.hh +++ b/lily/include/lily-imports.hh @@ -58,8 +58,10 @@ namespace Lily { extern Variable beat_structure; extern Variable calc_repeat_slash_count; extern Variable car_less; + extern Variable chordmodifiers; extern Variable construct_chord_elements; extern Variable default_time_signature_settings; + extern Variable drum_pitch_names; extern Variable grob_compose_function; extern Variable grob_offset_function; extern Variable hash_table_to_alist; @@ -91,6 +93,7 @@ namespace Lily { #endif extern Variable f_parser; extern Variable percussion_p; + extern Variable pitchnames; extern Variable pure_chain_offset_callback; extern Variable remove_stencil_warnings; extern Variable scale_layout; diff --git a/lily/include/lily-lexer.hh b/lily/include/lily-lexer.hh index 0e001ec187..626d24efa6 100644 --- a/lily/include/lily-lexer.hh +++ b/lily/include/lily-lexer.hh @@ -36,7 +36,7 @@ class Lily_lexer : public Smob, public Includable_lexer public: int print_smob (SCM, scm_print_state *) const; SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Lily_lexer (); private: int lookup_keyword (const string&); diff --git a/lily/include/lily-parser.hh b/lily/include/lily-parser.hh index b08df7c7a4..e4ff2969b9 100644 --- a/lily/include/lily-parser.hh +++ b/lily/include/lily-parser.hh @@ -36,7 +36,7 @@ class Lily_parser : public Smob public: int print_smob (SCM, scm_print_state *) const; SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Lily_parser (); Lily_lexer *lexer_; Sources *sources_; diff --git a/lily/include/listener.hh b/lily/include/listener.hh index b9042ba301..a13fdc66e1 100644 --- a/lily/include/listener.hh +++ b/lily/include/listener.hh @@ -96,7 +96,7 @@ private: SCM callback_; SCM target_; public: - static const char type_p_name_[]; + static const char * const type_p_name_; Listener (SCM callback, SCM target) : callback_ (callback), target_ (target) { } diff --git a/lily/include/moment.hh b/lily/include/moment.hh index d84a992b40..c29032f99d 100644 --- a/lily/include/moment.hh +++ b/lily/include/moment.hh @@ -32,7 +32,7 @@ class Moment : public Simple_smob public: static SCM equal_p (SCM, SCM); int print_smob (SCM, scm_print_state *) const; - static const char type_p_name_[]; + static const char * const type_p_name_; Moment (); Moment (int m); diff --git a/lily/include/music-function.hh b/lily/include/music-function.hh index f2c349a3e1..80239a61aa 100644 --- a/lily/include/music-function.hh +++ b/lily/include/music-function.hh @@ -27,7 +27,7 @@ class Music_function : public Smob2 { public: - static const char type_p_name_[]; + static const char * const type_p_name_; int print_smob (SCM, scm_print_state *) const; SCM get_signature () const { return scm1 (); } SCM get_function () const { return scm2 (); } diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh index 810d230aac..bb095df718 100644 --- a/lily/include/music-iterator.hh +++ b/lily/include/music-iterator.hh @@ -63,7 +63,7 @@ class Music_iterator : public Smob public: int print_smob (SCM, scm_print_state *) const; SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Music_iterator (); protected: Moment music_length_; diff --git a/lily/include/music-output.hh b/lily/include/music-output.hh index dc1111b78a..208c01a831 100644 --- a/lily/include/music-output.hh +++ b/lily/include/music-output.hh @@ -31,7 +31,7 @@ class Music_output : public Smob public: int print_smob (SCM, scm_print_state *) const; SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Music_output (); private: DECLARE_CLASSNAME (Music_output); diff --git a/lily/include/output-def.hh b/lily/include/output-def.hh index 5de672e67a..8c188f2707 100644 --- a/lily/include/output-def.hh +++ b/lily/include/output-def.hh @@ -51,7 +51,7 @@ class Output_def : public Smob public: int print_smob (SCM, scm_print_state *) const; SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Output_def (); VIRTUAL_COPY_CONSTRUCTOR (Output_def, Output_def); diff --git a/lily/include/page-marker.hh b/lily/include/page-marker.hh index 02233d30a6..33f3a38c06 100644 --- a/lily/include/page-marker.hh +++ b/lily/include/page-marker.hh @@ -27,7 +27,7 @@ class Page_marker : public Smob { public: SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Page_marker (); private: SCM symbol_; /* either 'page-turn-permission or 'page-break-permission */ diff --git a/lily/include/paper-book.hh b/lily/include/paper-book.hh index b105cdb3de..9530c94b70 100644 --- a/lily/include/paper-book.hh +++ b/lily/include/paper-book.hh @@ -31,7 +31,7 @@ class Paper_book : public Smob { public: SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Paper_book (); private: SCM systems_; diff --git a/lily/include/paper-outputter.hh b/lily/include/paper-outputter.hh index 8683b4c6d1..cd1a5e2c92 100644 --- a/lily/include/paper-outputter.hh +++ b/lily/include/paper-outputter.hh @@ -33,7 +33,6 @@ class Paper_outputter : public Smob { public: - static const char * const type_p_name_; // = 0 SCM mark_smob () const; virtual ~Paper_outputter (); private: diff --git a/lily/include/pitch.hh b/lily/include/pitch.hh index daade82e81..dad2bc1246 100644 --- a/lily/include/pitch.hh +++ b/lily/include/pitch.hh @@ -38,7 +38,7 @@ public: static SCM equal_p (SCM, SCM); int print_smob (SCM, scm_print_state *) const; SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; private: int octave_; int notename_; diff --git a/lily/include/prob.hh b/lily/include/prob.hh index cb850555fb..a9a485b550 100644 --- a/lily/include/prob.hh +++ b/lily/include/prob.hh @@ -38,7 +38,7 @@ public: int print_smob (SCM, scm_print_state *) const; SCM mark_smob () const; static SCM equal_p (SCM, SCM); - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Prob (); private: DECLARE_CLASSNAME (Prob); diff --git a/lily/include/scale.hh b/lily/include/scale.hh index 7c990e5034..19cd175c79 100644 --- a/lily/include/scale.hh +++ b/lily/include/scale.hh @@ -26,7 +26,6 @@ struct Scale : public Smob { - static const char * const type_p_name_; // = 0 virtual ~Scale (); Scale (vector const &); Scale (Scale const &); diff --git a/lily/include/scm-hash.hh b/lily/include/scm-hash.hh index 241f316c4e..3453904f71 100644 --- a/lily/include/scm-hash.hh +++ b/lily/include/scm-hash.hh @@ -46,7 +46,6 @@ class Scheme_hash_table : public Smob1 { public: - static const char * const type_p_name_; // = 0 int print_smob (SCM, scm_print_state *) const; bool try_retrieve (SCM key, SCM *val); bool contains (SCM key) const; diff --git a/lily/include/score.hh b/lily/include/score.hh index b3ece8960a..a5918242f1 100644 --- a/lily/include/score.hh +++ b/lily/include/score.hh @@ -31,7 +31,7 @@ class Score : public Smob { public: SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Score (); private: SCM music_; diff --git a/lily/include/skyline-pair.hh b/lily/include/skyline-pair.hh index 6d7cea0ac2..f7946c1851 100644 --- a/lily/include/skyline-pair.hh +++ b/lily/include/skyline-pair.hh @@ -25,7 +25,7 @@ class Skyline_pair : public Simple_smob { public: - static const char type_p_name_[]; + static const char * const type_p_name_; private: Drul_array skylines_; diff --git a/lily/include/skyline.hh b/lily/include/skyline.hh index 21693420c8..43feb40761 100644 --- a/lily/include/skyline.hh +++ b/lily/include/skyline.hh @@ -51,7 +51,7 @@ struct Building class Skyline : public Simple_smob { public: - static const char type_p_name_[]; + static const char * const type_p_name_; private: list buildings_; Direction sky_; diff --git a/lily/include/smobs.hh b/lily/include/smobs.hh index 889d86a8ca..7ef46b23e4 100644 --- a/lily/include/smobs.hh +++ b/lily/include/smobs.hh @@ -120,7 +120,7 @@ debugging purposes. If the class does not define this function, the output will be # when printing. - - a static const type_p_name_[] string set to something like + - a static const * const type_p_name_ string set to something like "ly:grob?". When provided, an accordingly named function for checking for the given smob type will be available in Scheme. @@ -177,6 +177,7 @@ private: // Most default functions are do-nothings. void init() will // recognize their address when not overriden and will then refrain // altogether from passing the the respective callbacks to GUILE. + SCM mark_smob (void) const; static SCM mark_trampoline (SCM); // Used for calling mark_smob static size_t free_smob (SCM obj); @@ -185,11 +186,10 @@ private: static int print_trampoline (SCM, SCM, scm_print_state *); static void smob_proc_init (scm_t_bits) { }; - // type_p_name_ has to be defined in the Super class, either with a - // static const char [] string or as a null pointer of type const - // char *. We used to provide a default here for convenience, but - // battling the various conflicting C++ standards was too much of a - // hassle. + // Define type_p_name_ in the Super class as a const char * const. + // Without such definition it defaults to 0, producing no predicate. + + static const char * const type_p_name_; // = 0 // LY_DECLARE_SMOB_PROC is used in the Super class definition for // making a smob callable like a function. Its first argument is a diff --git a/lily/include/smobs.tcc b/lily/include/smobs.tcc index b8dfc1f67f..818c0900a5 100644 --- a/lily/include/smobs.tcc +++ b/lily/include/smobs.tcc @@ -113,6 +113,9 @@ Scm_init Smob_base::scm_init_ (init); template string Smob_base::smob_name_; +template +const char * const Smob_base::type_p_name_ = 0; + template void Smob_base::init () { diff --git a/lily/include/source-file.hh b/lily/include/source-file.hh index 6686389289..fc5bf2f541 100644 --- a/lily/include/source-file.hh +++ b/lily/include/source-file.hh @@ -40,7 +40,7 @@ class Source_file : public Smob public: int print_smob (SCM, scm_print_state *) const; SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Source_file (); private: vector newline_locations_; diff --git a/lily/include/spring.hh b/lily/include/spring.hh index fd01ca048c..d4ebee23cd 100644 --- a/lily/include/spring.hh +++ b/lily/include/spring.hh @@ -27,7 +27,7 @@ class Spring : public Simple_smob { public: static SCM equal_p (SCM, SCM); - static const char type_p_name_[]; + static const char * const type_p_name_; private: Real distance_; Real min_distance_; diff --git a/lily/include/stencil.hh b/lily/include/stencil.hh index 6ccb9252bb..8af67c0f76 100644 --- a/lily/include/stencil.hh +++ b/lily/include/stencil.hh @@ -59,7 +59,7 @@ class Stencil : public Simple_smob { public: SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; private: Box dim_; SCM expr_; diff --git a/lily/include/translator-dispatch-list.hh b/lily/include/translator-dispatch-list.hh index eb74e74cd6..b6124572fc 100644 --- a/lily/include/translator-dispatch-list.hh +++ b/lily/include/translator-dispatch-list.hh @@ -30,7 +30,6 @@ class Engraver_dispatch_list : public Simple_smob { vector dispatch_entries_; public: - static const char * const type_p_name_; // = 0 void apply (Grob_info); SCM static create (SCM trans_list, SCM iface_list, Direction); diff --git a/lily/include/translator-group.hh b/lily/include/translator-group.hh index 4ba2fe6523..d4500ef2b4 100644 --- a/lily/include/translator-group.hh +++ b/lily/include/translator-group.hh @@ -29,7 +29,7 @@ class Translator_group : public Smob public: SCM mark_smob () const; int print_smob (SCM, scm_print_state *) const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Translator_group (); private: void precompute_method_bindings (); diff --git a/lily/include/translator.hh b/lily/include/translator.hh index fd93a3e42f..dd0659bf50 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -91,7 +91,7 @@ class Translator : public Smob public: int print_smob (SCM, scm_print_state *) const; SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; virtual ~Translator (); private: void init (); diff --git a/lily/include/unpure-pure-container.hh b/lily/include/unpure-pure-container.hh index 92974fe8f0..7accff9a88 100644 --- a/lily/include/unpure-pure-container.hh +++ b/lily/include/unpure-pure-container.hh @@ -26,7 +26,7 @@ class Unpure_pure_container : public Smob2 { public: - static const char type_p_name_ []; + static const char * const type_p_name_; SCM unpure_part () const { return scm1 (); } // A container that has the same callback for both 'pure' and 'unpure' lookups // and which ignores the 'start' and 'end' columnns. diff --git a/lily/input-smob.cc b/lily/input-smob.cc index f9de264277..6f5fc18a54 100644 --- a/lily/input-smob.cc +++ b/lily/input-smob.cc @@ -25,7 +25,7 @@ /* Dummy input location for use if real one is missing. */ Input dummy_input_global; -const char Input::type_p_name_[] = "ly:input-location?"; +const char * const Input::type_p_name_ = "ly:input-location?"; SCM Input::mark_smob () const diff --git a/lily/lily-imports.cc b/lily/lily-imports.cc index adc9124fb7..62e58b603c 100644 --- a/lily/lily-imports.cc +++ b/lily/lily-imports.cc @@ -52,8 +52,10 @@ namespace Lily { Variable beat_structure ("beat-structure"); Variable calc_repeat_slash_count ("calc-repeat-slash-count"); Variable car_less ("car<"); + Variable chordmodifiers ("chordmodifiers"); Variable construct_chord_elements ("construct-chord-elements"); Variable default_time_signature_settings ("default-time-signature-settings"); + Variable drum_pitch_names ("drumPitchNames"); Variable grob_compose_function ("grob::compose-function"); Variable grob_offset_function ("grob::offset-function"); Variable hash_table_to_alist ("hash-table->alist"); @@ -85,6 +87,7 @@ namespace Lily { #endif Variable f_parser ("%parser"); Variable percussion_p ("percussion?"); + Variable pitchnames ("pitchnames"); Variable pure_chain_offset_callback ("pure-chain-offset-callback"); Variable remove_stencil_warnings ("remove-stencil-warnings"); Variable scale_layout ("scale-layout"); diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index 221d048cc0..6db0e653e5 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -369,7 +369,7 @@ Lily_lexer::add_lexed_char (int count) } -const char Lily_lexer::type_p_name_[] = "ly:lily-lexer?"; +const char * const Lily_lexer::type_p_name_ = "ly:lily-lexer?"; SCM Lily_lexer::mark_smob () const diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 3188974284..d2499d4c41 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -200,7 +200,7 @@ Lily_parser::parser_error (Input const &i, const string &s) error_level_ = 1; } -const char Lily_parser::type_p_name_[] = "ly:lily-parser?"; +const char * const Lily_parser::type_p_name_ = "ly:lily-parser?"; /**************************************************************** OUTPUT-DEF diff --git a/lily/listener.cc b/lily/listener.cc index 2a8d28d8cb..836f8cdc6f 100644 --- a/lily/listener.cc +++ b/lily/listener.cc @@ -19,4 +19,4 @@ #include "listener.hh" -const char Listener::type_p_name_[] = "ly:listener?"; +const char * const Listener::type_p_name_ = "ly:listener?"; diff --git a/lily/moment.cc b/lily/moment.cc index 81ab30e3ae..20c1f58a0b 100644 --- a/lily/moment.cc +++ b/lily/moment.cc @@ -44,7 +44,7 @@ Moment::Moment (Rational m) } -const char Moment::type_p_name_[] = "ly:moment?"; +const char * const Moment::type_p_name_ = "ly:moment?"; int diff --git a/lily/music-function.cc b/lily/music-function.cc index 969d5ff7b5..c252291736 100644 --- a/lily/music-function.cc +++ b/lily/music-function.cc @@ -24,7 +24,7 @@ #include "fluid.hh" #include "lily-imports.hh" -const char Music_function::type_p_name_[] = "ly:music-function?"; +const char * const Music_function::type_p_name_ = "ly:music-function?"; /* Print a textual represenation of the smob to a given port. */ int diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc index b89e92c28e..a7a06ff0d8 100644 --- a/lily/music-iterator.cc +++ b/lily/music-iterator.cc @@ -190,7 +190,7 @@ Music_iterator::get_music () const /****************************************************************/ -const char Music_iterator::type_p_name_[] = "ly:iterator?"; +const char * const Music_iterator::type_p_name_ = "ly:iterator?"; SCM Music_iterator::mark_smob () const diff --git a/lily/music-output.cc b/lily/music-output.cc index 7b89b853f6..9e8cc9ff9a 100644 --- a/lily/music-output.cc +++ b/lily/music-output.cc @@ -39,7 +39,7 @@ Music_output::derived_mark () const { } -const char Music_output::type_p_name_[] = "ly:music-output?"; +const char * const Music_output::type_p_name_ = "ly:music-output?"; SCM Music_output::mark_smob () const diff --git a/lily/note-performer.cc b/lily/note-performer.cc index a2ca6946e9..468210d20d 100644 --- a/lily/note-performer.cc +++ b/lily/note-performer.cc @@ -37,13 +37,14 @@ protected: void listen_note (Stream_event *); void listen_breathing (Stream_event *); + void listen_tie (Stream_event *); + void listen_articulation (Stream_event *); private: - vector note_evs_; + vector note_evs_, script_evs_; vector notes_; vector last_notes_; Moment last_start_; - }; void @@ -68,6 +69,10 @@ Note_performer::process_music () Stream_event *tie_event = 0; Moment len = get_event_length (n, now_mom ()); int velocity = 0; + + for (vsize j = script_evs_.size (); j--;) + articulations = scm_cons (script_evs_[j]->self_scm (), articulations); + for (SCM s = articulations; scm_is_pair (s); s = scm_cdr (s)) { Stream_event *ev = unsmob (scm_car (s)); @@ -124,6 +129,7 @@ Note_performer::stop_translation_timestep () notes_.clear (); note_evs_.clear (); + script_evs_.clear (); } void @@ -132,6 +138,18 @@ Note_performer::listen_note (Stream_event *ev) note_evs_.push_back (ev); } +void +Note_performer::listen_tie (Stream_event *ev) +{ + script_evs_.push_back (ev); +} + +void +Note_performer::listen_articulation (Stream_event *ev) +{ + script_evs_.push_back (ev); +} + void Note_performer::listen_breathing (Stream_event *ev) { @@ -160,6 +178,8 @@ Note_performer::boot () { ADD_LISTENER (Note_performer, note); ADD_LISTENER (Note_performer, breathing); + ADD_LISTENER (Note_performer, tie); + ADD_LISTENER (Note_performer, articulation); } ADD_TRANSLATOR (Note_performer, diff --git a/lily/output-def-scheme.cc b/lily/output-def-scheme.cc index 921f3dfcd5..65673c8a9e 100644 --- a/lily/output-def-scheme.cc +++ b/lily/output-def-scheme.cc @@ -132,7 +132,7 @@ LY_DEFINE (ly_output_find_context_def, "ly:output-find-context-def", } const char -Output_def::type_p_name_[] = "ly:output-def?"; +* const Output_def::type_p_name_ = "ly:output-def?"; LY_DEFINE (ly_paper_outputscale, "ly:paper-outputscale", 1, 0, 0, (SCM def), diff --git a/lily/page-marker.cc b/lily/page-marker.cc index 02b9c4ad19..af62bdc95e 100644 --- a/lily/page-marker.cc +++ b/lily/page-marker.cc @@ -40,7 +40,7 @@ Page_marker::~Page_marker () { } -const char Page_marker::type_p_name_[] = "ly:page-marker?"; +const char * const Page_marker::type_p_name_ = "ly:page-marker?"; SCM Page_marker::mark_smob () const diff --git a/lily/paper-book.cc b/lily/paper-book.cc index e23ef52777..3a672198b5 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -53,7 +53,7 @@ Paper_book::~Paper_book () { } -const char Paper_book::type_p_name_[] = "ly:paper-book?"; +const char * const Paper_book::type_p_name_ = "ly:paper-book?"; SCM Paper_book::mark_smob () const diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 471a36a41a..a72ea59ccd 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -40,8 +40,6 @@ using namespace std; #include "lily-imports.hh" -const char * const Paper_outputter::type_p_name_ = 0; - Paper_outputter::Paper_outputter (SCM port, const string &format) { file_ = port; diff --git a/lily/parser.yy b/lily/parser.yy index b8849e8f4a..1695aea625 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -387,8 +387,7 @@ prec levels in different prods */ start_symbol: lilypond | EMBEDDED_LILY { - SCM nn = parser->lexer_->lookup_identifier ("pitchnames"); - parser->lexer_->push_note_state (nn); + parser->lexer_->push_note_state (Lily::pitchnames); } embedded_lilypond { parser->lexer_->pop_state (); *retval = $3; @@ -824,8 +823,7 @@ context_mod_arg: embedded_scm | { - SCM nn = parser->lexer_->lookup_identifier ("pitchnames"); - parser->lexer_->push_note_state (nn); + parser->lexer_->push_note_state (Lily::pitchnames); } composite_music { @@ -1282,8 +1280,7 @@ output_def_body: { if (scm_is_pair ($1)) $1 = scm_car ($1); - SCM nn = parser->lexer_->lookup_identifier ("pitchnames"); - parser->lexer_->push_note_state (nn); + parser->lexer_->push_note_state (Lily::pitchnames); } music_or_context_def { parser->lexer_->pop_state (); @@ -1455,8 +1452,7 @@ simple_music: context_modification: WITH { - SCM nn = parser->lexer_->lookup_identifier ("pitchnames"); - parser->lexer_->push_note_state (nn); + parser->lexer_->push_note_state (Lily::pitchnames); } '{' context_mod_list '}' { parser->lexer_->pop_state (); @@ -2530,15 +2526,13 @@ mode_changed_music: mode_changing_head: NOTEMODE { - SCM nn = parser->lexer_->lookup_identifier ("pitchnames"); - parser->lexer_->push_note_state (nn); + parser->lexer_->push_note_state (Lily::pitchnames); $$ = ly_symbol2scm ("notes"); } | DRUMMODE { - SCM nn = parser->lexer_->lookup_identifier ("drumPitchNames"); - parser->lexer_->push_note_state (nn); + parser->lexer_->push_note_state (Lily::drum_pitch_names); $$ = ly_symbol2scm ("drums"); } @@ -2548,10 +2542,9 @@ mode_changing_head: $$ = ly_symbol2scm ("figures"); } | CHORDMODE { - SCM nn = parser->lexer_->lookup_identifier ("chordmodifiers"); - parser->lexer_->chordmodifier_tab_ = alist_to_hashq (nn); - nn = parser->lexer_->lookup_identifier ("pitchnames"); - parser->lexer_->push_chord_state (nn); + parser->lexer_->chordmodifier_tab_ = + alist_to_hashq (Lily::chordmodifiers); + parser->lexer_->push_chord_state (Lily::pitchnames); $$ = ly_symbol2scm ("chords"); } @@ -2563,8 +2556,7 @@ mode_changing_head: mode_changing_head_with_context: DRUMS { - SCM nn = parser->lexer_->lookup_identifier ("drumPitchNames"); - parser->lexer_->push_note_state (nn); + parser->lexer_->push_note_state (Lily::drum_pitch_names); $$ = ly_symbol2scm ("DrumStaff"); } @@ -2574,10 +2566,9 @@ mode_changing_head_with_context: $$ = ly_symbol2scm ("FiguredBass"); } | CHORDS { - SCM nn = parser->lexer_->lookup_identifier ("chordmodifiers"); - parser->lexer_->chordmodifier_tab_ = alist_to_hashq (nn); - nn = parser->lexer_->lookup_identifier ("pitchnames"); - parser->lexer_->push_chord_state (nn); + parser->lexer_->chordmodifier_tab_ = + alist_to_hashq (Lily::chordmodifiers); + parser->lexer_->push_chord_state (Lily::pitchnames); $$ = ly_symbol2scm ("ChordNames"); } | LYRICS @@ -3861,8 +3852,7 @@ markup_uncomposed_list: $$ = $2; } | SCORELINES { - SCM nn = parser->lexer_->lookup_identifier ("pitchnames"); - parser->lexer_->push_note_state (nn); + parser->lexer_->push_note_state (Lily::pitchnames); } '{' score_body '}' { Score *sc = unsmob ($4); sc->origin ()->set_spot (@$); @@ -3975,8 +3965,7 @@ simple_markup: $$ = make_simple_markup ($1); } | SCORE { - SCM nn = parser->lexer_->lookup_identifier ("pitchnames"); - parser->lexer_->push_note_state (nn); + parser->lexer_->push_note_state (Lily::pitchnames); } '{' score_body '}' { Score *sc = unsmob ($4); sc->origin ()->set_spot (@$); diff --git a/lily/pitch.cc b/lily/pitch.cc index e34562fecc..9e46bba70e 100644 --- a/lily/pitch.cc +++ b/lily/pitch.cc @@ -218,7 +218,7 @@ Pitch::down_to (int notename) notename_ = notename; } -const char Pitch::type_p_name_[] = "ly:pitch?"; +const char * const Pitch::type_p_name_ = "ly:pitch?"; SCM Pitch::mark_smob () const diff --git a/lily/prob.cc b/lily/prob.cc index 938f106861..d05a33e4f3 100644 --- a/lily/prob.cc +++ b/lily/prob.cc @@ -24,7 +24,7 @@ #include "profile.hh" -const char Prob::type_p_name_[] = "ly:prob?"; +const char * const Prob::type_p_name_ = "ly:prob?"; SCM Prob::equal_p (SCM sa, SCM sb) diff --git a/lily/scale.cc b/lily/scale.cc index d6f566b9ed..02c1dc5f8e 100644 --- a/lily/scale.cc +++ b/lily/scale.cc @@ -90,8 +90,6 @@ LY_DEFINE (ly_set_default_scale, "ly:set-default-scale", return SCM_UNSPECIFIED; } -const char * const Scale::type_p_name_ = 0; - int Scale::step_count () const { diff --git a/lily/scm-hash.cc b/lily/scm-hash.cc index 97af8f6cd5..0b1e0b4e25 100644 --- a/lily/scm-hash.cc +++ b/lily/scm-hash.cc @@ -21,8 +21,6 @@ #include -const char * const Scheme_hash_table::type_p_name_ = 0; - SCM Scheme_hash_table::make_smob () { diff --git a/lily/score.cc b/lily/score.cc index da48e8f103..d10023dd85 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -59,7 +59,7 @@ Score::~Score () { } -const char Score::type_p_name_[] = "ly:score?"; +const char * const Score::type_p_name_ = "ly:score?"; SCM Score::mark_smob () const diff --git a/lily/skyline-pair.cc b/lily/skyline-pair.cc index b3c2b96df4..bab43494a6 100644 --- a/lily/skyline-pair.cc +++ b/lily/skyline-pair.cc @@ -120,7 +120,7 @@ Skyline_pair::operator [] (Direction d) const return skylines_[d]; } -const char Skyline_pair::type_p_name_[] = "ly:skyline-pair?"; +const char * const Skyline_pair::type_p_name_ = "ly:skyline-pair?"; MAKE_SCHEME_CALLBACK (Skyline_pair, skyline, 2); diff --git a/lily/skyline.cc b/lily/skyline.cc index f46b2f3e84..6ef2069c39 100644 --- a/lily/skyline.cc +++ b/lily/skyline.cc @@ -802,7 +802,7 @@ Skyline::clear () /****************************************************************/ -const char Skyline::type_p_name_[] = "ly:skyline?"; +const char * const Skyline::type_p_name_ = "ly:skyline?"; MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Skyline, get_touching_point, 3, 1, "") SCM diff --git a/lily/source-file.cc b/lily/source-file.cc index 5a94927a7f..14fdf2beb3 100644 --- a/lily/source-file.cc +++ b/lily/source-file.cc @@ -362,7 +362,7 @@ Source_file::get_port () const /****************************************************************/ -const char Source_file::type_p_name_[] = "ly:source-file?"; +const char * const Source_file::type_p_name_ = "ly:source-file?"; SCM Source_file::mark_smob () const diff --git a/lily/spring-smob.cc b/lily/spring-smob.cc index 77b01bb158..a389df2efd 100644 --- a/lily/spring-smob.cc +++ b/lily/spring-smob.cc @@ -66,4 +66,4 @@ LY_DEFINE (ly_spring_set_inverse_stretch_strength_x, "ly:spring-set-inverse-stre return s->smobbed_copy (); } -const char Spring::type_p_name_[] = "ly:spring?"; +const char * const Spring::type_p_name_ = "ly:spring?"; diff --git a/lily/stencil.cc b/lily/stencil.cc index 3da1869541..0cf49296f0 100644 --- a/lily/stencil.cc +++ b/lily/stencil.cc @@ -44,7 +44,7 @@ Stencil::mark_smob () const return expr_; } -const char Stencil::type_p_name_[] = "ly:stencil?"; +const char * const Stencil::type_p_name_ = "ly:stencil?"; Interval Stencil::extent (Axis a) const diff --git a/lily/translator-dispatch-list.cc b/lily/translator-dispatch-list.cc index 40ca1b3a5d..eeee8d2483 100644 --- a/lily/translator-dispatch-list.cc +++ b/lily/translator-dispatch-list.cc @@ -21,8 +21,6 @@ #include "engraver.hh" -const char * const Engraver_dispatch_list::type_p_name_ = 0; - void Engraver_dispatch_list::apply (Grob_info gi) { diff --git a/lily/translator-group.cc b/lily/translator-group.cc index 972a487bf4..a9f1690f62 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -324,7 +324,7 @@ Translator_group::~Translator_group () } -const char Translator_group::type_p_name_[] = "ly:translator-group?"; +const char * const Translator_group::type_p_name_ = "ly:translator-group?"; int Translator_group::print_smob (SCM port, scm_print_state *) const diff --git a/lily/translator.cc b/lily/translator.cc index 5cd42703a1..bdc55f0f05 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -207,7 +207,7 @@ Translator::get_score_context () const return daddy_context_->get_score_context (); } -const char Translator::type_p_name_[] = "ly:translator?"; +const char * const Translator::type_p_name_ = "ly:translator?"; bool Translator::must_be_last () const diff --git a/lily/undead.cc b/lily/undead.cc index a328c66caf..4aed7a6023 100644 --- a/lily/undead.cc +++ b/lily/undead.cc @@ -24,7 +24,7 @@ class Undead : public Simple_smob public: int print_smob (SCM, scm_print_state *) const; SCM mark_smob () const; - static const char type_p_name_[]; + static const char * const type_p_name_; private: SCM object_; public: @@ -51,7 +51,7 @@ Undead::print_smob (SCM port, scm_print_state *) const return 1; } -const char Undead::type_p_name_[] = "ly:undead?"; +const char * const Undead::type_p_name_ = "ly:undead?"; LY_DEFINE (ly_make_undead, "ly:make-undead", 1, 0, 0, (SCM object), diff --git a/lily/unpure-pure-container.cc b/lily/unpure-pure-container.cc index 7a7d6d48d1..143b2fd47d 100644 --- a/lily/unpure-pure-container.cc +++ b/lily/unpure-pure-container.cc @@ -25,7 +25,6 @@ class Unpure_pure_call : public Smob1 { public: - static const char * const type_p_name_; // = 0 // Smob procedures unfortunately can only take at most 3 SCM // arguments. Otherwise we could use a "3, 0, 1" call signature and // not require an argument count check of our own. @@ -38,8 +37,6 @@ public: } }; -const char * const Unpure_pure_call::type_p_name_ = 0; - SCM Unpure_pure_container::pure_part () const { @@ -48,7 +45,7 @@ Unpure_pure_container::pure_part () const : scm2 (); } -const char Unpure_pure_container::type_p_name_[] = "ly:unpure-pure-container?"; +const char * const Unpure_pure_container::type_p_name_ = "ly:unpure-pure-container?"; LY_DEFINE (ly_make_unpure_pure_container, "ly:make-unpure-pure-container", 1, 1, 0, (SCM unpure, SCM pure), diff --git a/scm/chord-entry.scm b/scm/chord-entry.scm index 1d41c973e8..23601a8dea 100644 --- a/scm/chord-entry.scm +++ b/scm/chord-entry.scm @@ -18,6 +18,8 @@ ;; for define-safe-public when byte-compiling using Guile V2 (use-modules (scm safe-utility-defs) (ice-9 receive)) +(define-session-public chordmodifiers '()) + (define-public (construct-chord-elements root duration modifications) "Build a chord on root using modifiers in @var{modifications}. @code{NoteEvents} have duration @var{duration}. diff --git a/scm/define-music-display-methods.scm b/scm/define-music-display-methods.scm index 10aecbd1db..42637cd16c 100644 --- a/scm/define-music-display-methods.scm +++ b/scm/define-music-display-methods.scm @@ -89,8 +89,7 @@ expression." (define (pitch= pitch1 pitch2) (and (= (ly:pitch-notename pitch1) (ly:pitch-notename pitch2)) (= (ly:pitch-alteration pitch1) (ly:pitch-alteration pitch2)))) - (let* ((pitches (ly:parser-lookup 'pitchnames)) - (result (rassoc ly-pitch pitches pitch=))) + (let* ((result (rassoc ly-pitch pitchnames pitch=))) (and result (car result)))) (define-public (octave->lily-string pitch) @@ -860,7 +859,11 @@ Otherwise, return #f." num den (new-line->lily-string)) (format #f - "\\time #'~a ~a/~a~a" + ;; This is silly but the latter will also work for #f + ;; and other + (if (key-list? structure) + "\\time ~{~a~^,~} ~a/~a~a" + "\\time #'~a ~a/~a~a") structure num den (new-line->lily-string))))) diff --git a/scm/define-note-names.scm b/scm/define-note-names.scm index 5825967428..e7d208a511 100644 --- a/scm/define-note-names.scm +++ b/scm/define-note-names.scm @@ -33,11 +33,16 @@ ;;; Variable declaration -(define-public pitchnames '()) -(define-public default-language "") -(define-public previous-pitchnames #f) +(define-session-public pitchnames '()) +(define-session-public default-language "") +(define-session-public previous-pitchnames #f) -(define-public language-pitch-names +;;; A bit out of place, but we don't have a good place elsewhere in +;;; scm since it is only filled in ly/drumpitch-init.ly and we need it +;;; in (scm lily) in order to access it in ly/parser.yy. +(define-session-public drumPitchNames '()) + +(define-session-public language-pitch-names `( ;; Language: Nederlands --------------------------------------------; ;; Dutch note names -- LilyPond's default language. diff --git a/scm/lily.scm b/scm/lily.scm index ce3486cf3f..d1248cdd92 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -94,7 +94,16 @@ (ly:error (_ "call-after-session used after session start"))) (add-hook! after-session-hook thunk #t)) -(defmacro-public define-session (name value) +(define (make-session-variable name value) + (if (ly:undead? lilypond-declarations) + (ly:error (_ "define-session used after session start"))) + (let ((var (module-make-local-var! (current-module) name))) + (if (variable-bound? var) + (ly:error (_ "symbol ~S redefined") name)) + (variable-set! var value) + var)) + +(defmacro define-session (name value) "This defines a variable @var{name} with the starting value @var{value} that is reinitialized at the start of each session. A@tie{}session basically corresponds to one LilyPond file on the @@ -108,22 +117,23 @@ to their front or replacing them altogether, not by modifying parts of them. It is an error to call @code{define-session} after the first session has started." (define (add-session-variable name value) - (if (ly:undead? lilypond-declarations) - (ly:error (_ "define-session used after session start"))) - (let ((var (make-variable value))) - (module-add! (current-module) name var) - (set! lilypond-declarations (cons var lilypond-declarations)))) + (set! lilypond-declarations + (cons (make-session-variable name value) lilypond-declarations))) `(,add-session-variable ',name ,value)) -(defmacro-public define-session-public (name value) +(defmacro define-session-public (name value) "Like @code{define-session}, but also exports @var{name} into parser modules." (define (add-session-variable name value) - (if (ly:undead? lilypond-declarations) - (ly:error (_ "define-session-public used after session start"))) - (let ((var (make-variable value))) - (module-add! (current-module) name var) - (set! lilypond-exports (acons name var lilypond-exports)))) - `(,add-session-variable ',name ,value)) + (set! lilypond-exports + (acons name (make-session-variable name value) lilypond-exports))) + `(begin + ;; this is a bit icky: we place the variable right into every + ;; parser module so that both set! and define will affect the + ;; original variable in the (lily) module. However, we _also_ + ;; export it normally from (lily) for the sake of other modules + ;; not sharing the name space of the parser. + (,add-session-variable ',name ,value) + (export ,name))) (define (session-terminate) (if (ly:undead? lilypond-declarations)