X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Ftranslator.icc;h=de754681f38c798b697273a5769a41346737c5dd;hb=a396a31d3d8df664dbadef65f0e807759d6b355e;hp=f6c815fabcd54838f621918ef6a346de1f2feb0c;hpb=0e5d83a9ceb4a143f83d22406d7eb816314ff9f7;p=lilypond.git diff --git a/lily/include/translator.icc b/lily/include/translator.icc index f6c815fabc..de754681f3 100644 --- a/lily/include/translator.icc +++ b/lily/include/translator.icc @@ -1,9 +1,20 @@ /* - translator.icc -- declare Translator glue wiring. + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 2005--2010 Han-Wen Nienhuys - (c) 2005--2009 Han-Wen Nienhuys + 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 . */ #ifndef TRANSLATOR_ICC @@ -21,7 +32,6 @@ A macro to automate administration of translators. */ #define ADD_THIS_TRANSLATOR(T) \ - translator_listener_record *T::listener_list_; \ SCM T::static_description_ = SCM_EOL; \ static void _ ## T ## _adder () \ { \ @@ -34,12 +44,15 @@ { \ return static_description_; \ } \ - ADD_GLOBAL_CTOR (_ ## T ## _adder); + ADD_GLOBAL_CTOR (_ ## T ## _adder); \ + /* end define */ -#define ADD_TRANSLATOR(classname, desc, grobs, read, write) \ +#define DEFINE_TRANSLATOR_LISTENER_LIST(T) \ + translator_listener_record *T::listener_list_; \ + /* end define */ + +#define DEFINE_ACKNOWLEDGERS(classname) \ Drul_array< vector > classname::acknowledge_static_array_drul_; \ - IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS (classname); \ - ADD_THIS_TRANSLATOR (classname); \ Engraver_void_function_engraver_grob_info \ classname::static_get_acknowledger (SCM sym) \ { \ @@ -50,12 +63,22 @@ { \ return generic_get_acknowledger (sym, &acknowledge_static_array_drul_[STOP]); \ } \ + /* end define */ + +#define DEFINE_TRANSLATOR_DOC(classname, desc, grobs, read, write) \ SCM \ classname::static_translator_description () const \ { \ return Translator::static_translator_description (grobs, desc, listener_list_, read, write); \ } +#define ADD_TRANSLATOR(classname, desc, grobs, read, write) \ + IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS (classname); \ + ADD_THIS_TRANSLATOR (classname); \ + DEFINE_TRANSLATOR_DOC(classname, desc, grobs, read, write) \ + DEFINE_ACKNOWLEDGERS(classname) \ + DEFINE_TRANSLATOR_LISTENER_LIST(classname) \ + #define IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS(T) \ void \ T::fetch_precomputable_methods (Translator_void_method_ptr ptrs[]) \ @@ -119,9 +142,10 @@ cl :: _internal_declare_ ## m () \ ADD_SCM_INIT_FUNC (cl ## _declare_event_ ## m, cl::_internal_declare_ ## m); \ \ Listener \ -cl :: _get_ ## m ## _listener (void *me) \ + cl :: _get_ ## m ## _listener (void *me, SCM unused) \ { \ cl *obj = (cl *) me; \ + (void) unused; \ return obj->GET_LISTENER (_listen_scm_ ## m); \ } \ \