|
Create a module variable access system for C++
This replaces the previous "memoizing" ly_lily_module_constant with a
rather rigid system for importing/exporting/accessing module variables.
As opposed to the system used by ly_lily_module_constant, access will
continue to go through the respective module variables, making it
possible to also write to the respective variables. In addition, this
ensures that any changes to the variables from the Scheme side will get
properly reflected in the C++ side, allowing for redefinitions when
debugging.
In a nutshell, ly_lily_module_constant ("ly:music?") would generally be
replaced with Lily::ly_music_p, a declaration of it looking like
extern Variable ly_music_p;
would be placed in namespace Lily in lily/include/lily-imports.hh, and a
corresponding definition
Variable ly_music_p ("ly:music?");
in namespace Lily in lily/lily-imports.cc . The type Scm_module where
variables are organized can use pre-existing modules (in which case it
is initialized by calling the member function import ()) or are can
bring up a fresh module (in which case it is initialized by calling the
member function boot ()). The startup is done in lily/guile-init.cc .
Since one of the most frequent uses of imported variables is for
function calls, the Scm_variable type (underlying the module-local
Variable type) has operator () defined to allow calling as a function.
So the previous
scm_call_1 (ly_lily_module_constant ("ly:music?"), x);
can now be expressed as
Lily::ly_music_p (x);
In order to avoid Srfi_1 import for a single function, also contains
Issue 4461: Don't use drop-right from (srfi srfi-1) in C++
It can perfectly amicably be replaced by more efficient code readily
available in the core.
Total comments: 3
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+664 lines, -264 lines) |
Patch |
|
M |
lily/chord-tremolo-iterator.cc
|
View
|
|
2 chunks |
+2 lines, -3 lines |
0 comments
|
Download
|
|
M |
lily/clef-engraver.cc
|
View
|
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
lily/context.cc
|
View
|
1
2
|
2 chunks |
+2 lines, -3 lines |
0 comments
|
Download
|
|
M |
lily/dispatcher.cc
|
View
|
1
2
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
lily/font-select.cc
|
View
|
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
lily/grob.cc
|
View
|
|
2 chunks |
+6 lines, -7 lines |
0 comments
|
Download
|
|
M |
lily/grob-closure.cc
|
View
|
|
2 chunks |
+2 lines, -3 lines |
0 comments
|
Download
|
|
M |
lily/guile-init.cc
|
View
|
1
2
|
3 chunks |
+7 lines, -4 lines |
0 comments
|
Download
|
|
M |
lily/include/fluid.hh
|
View
|
1
2
|
1 chunk |
+3 lines, -5 lines |
0 comments
|
Download
|
|
M |
lily/include/lily-guile.hh
|
View
|
|
1 chunk |
+0 lines, -2 lines |
0 comments
|
Download
|
|
M |
lily/include/lily-guile-macros.hh
|
View
|
|
1 chunk |
+0 lines, -22 lines |
0 comments
|
Download
|
|
A |
lily/include/lily-imports.hh
|
View
|
1
2
|
1 chunk |
+126 lines, -0 lines |
0 comments
|
Download
|
|
A |
lily/include/lily-modules.hh
|
View
|
|
1 chunk |
+99 lines, -0 lines |
3 comments
|
Download
|
|
M |
lily/include/lily-proto.hh
|
View
|
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
lily/key-performer.cc
|
View
|
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
lily/key-signature-interface.cc
|
View
|
|
2 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
lily/lexer.ll
|
View
|
|
4 chunks |
+7 lines, -8 lines |
0 comments
|
Download
|
|
M |
lily/lily-guile.cc
|
View
|
|
3 chunks |
+3 lines, -4 lines |
0 comments
|
Download
|
|
A |
lily/lily-imports.cc
|
View
|
1
2
|
1 chunk |
+118 lines, -0 lines |
0 comments
|
Download
|
|
A |
lily/lily-modules.cc
|
View
|
1
2
|
1 chunk |
+108 lines, -0 lines |
0 comments
|
Download
|
|
M |
lily/lily-parser-scheme.cc
|
View
|
|
11 chunks |
+11 lines, -10 lines |
0 comments
|
Download
|
|
M |
lily/ly-module.cc
|
View
|
|
5 chunks |
+14 lines, -23 lines |
0 comments
|
Download
|
|
M |
lily/main.cc
|
View
|
|
2 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
lily/midi-item.cc
|
View
|
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
lily/module-scheme.cc
|
View
|
|
1 chunk |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
lily/music.cc
|
View
|
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
lily/music-function.cc
|
View
|
1
2
|
4 chunks |
+6 lines, -7 lines |
0 comments
|
Download
|
|
M |
lily/page-layout-problem.cc
|
View
|
|
4 chunks |
+4 lines, -6 lines |
0 comments
|
Download
|
|
M |
lily/paper-book.cc
|
View
|
1
2
|
5 chunks |
+11 lines, -18 lines |
0 comments
|
Download
|
|
M |
lily/paper-def.cc
|
View
|
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
lily/paper-outputter.cc
|
View
|
1
2
|
3 chunks |
+3 lines, -4 lines |
0 comments
|
Download
|
|
M |
lily/parse-scm.cc
|
View
|
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
lily/parser.yy
|
View
|
1
2
|
38 chunks |
+61 lines, -65 lines |
0 comments
|
Download
|
|
M |
lily/part-combine-iterator.cc
|
View
|
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
lily/partial-iterator.cc
|
View
|
|
3 chunks |
+4 lines, -6 lines |
0 comments
|
Download
|
|
M |
lily/percent-repeat-iterator.cc
|
View
|
|
2 chunks |
+2 lines, -3 lines |
0 comments
|
Download
|
|
M |
lily/program-option-scheme.cc
|
View
|
|
3 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
lily/rest-collision.cc
|
View
|
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
lily/span-bar-engraver.cc
|
View
|
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
lily/staff-performer.cc
|
View
|
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
lily/system.cc
|
View
|
|
2 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
lily/text-interface.cc
|
View
|
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
lily/timing-translator.cc
|
View
|
|
5 chunks |
+11 lines, -15 lines |
0 comments
|
Download
|
|
M |
lily/tuplet-iterator.cc
|
View
|
|
2 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
lily/volta-bracket.cc
|
View
|
|
2 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
lily/volta-repeat-iterator.cc
|
View
|
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
Total messages: 8
|