"Joao E. Pereira Jr" <[email protected]> writes: > On Sun, Jan 13, 2013 at 9:35 AM, David Kastrup <[email protected]> wrote: >> "Joao E. Pereira Jr" <[email protected]> writes: >> >>> Many of the tokens parser reads ask for Music object creation so it >>> calls MY_MUSIC_SYNTAX macro, as this object represents music content >>> and layout even a one note ly file can lead to a considerable number >>> of Music objects, so I deduce it plays an importante role in >>> architecture. A lot of Music objects are created, but is not clear how >>> they are stored in memory, or which data structure is used to handle >>> them. >> >> They are of type ly:music?, check out lily/include/music.hh for their >> structure. >> > > Suppose I have the following ly code { c d e }, I think that in > parsing 3 objects of ly:music? type will be produced and I'm wondering > where this 3 objects would be put into: an array, a vector, a list?
A list, stored in the 'elements property of another Music structure of type SequentialMusic. >> MY_MUSIC_SYNTAX creates protected Music data which will not get >> garbage collected because of an artificial extra reference to it. >> After calling unprotect, this reference is gone, and the garbage >> collector will collect the Scheme object once it can no longer detect >> any _other_ reference to its SCM descriptor, whether on the stack, or >> inside of some other SCM object reachable from the stack or otherwise >> protected. >> > > In C++ and Scheme terms of code, how can i use this artificial extra > reference? Not at all. It is just internal to the garbage collector. You can get your own SCM reference at any time by calling ->self_scm () on the Music pointer, or by calling ->unprotect () (which can only be called once) on the Music pointer. Having a Music pointer somewhere does not help against garbage protection. Having an SCM reference on the stack or in some Scheme structure known to the garbage collector does. > I'm trying to understand the flow of execution and how data is > organized and passed through compiler stages. In the iteration (I > didn't read iteration code yet) this Music objects should be > referenced in some way. Do you have some advice to clear this up? I don't understand your question. -- David Kastrup _______________________________________________ lilypond-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-devel
