Entering a \fullPage example delays execution until the next pagebreak (or even the second-to-next, depending on the odd/even-situation).
For this it saves the file name to an internal variable.
If one then enters another \fullPageMusicExample before the execution of the \afterpage command is completed this internal variable is reset to the new filename, and the first command tries to print the wrong file.
As a workaround this has to be documented.
But of course one should be able to enter examples like this, because the user can't know when the example actually will be included.
I think the filename should be saved to a FIFO-buffer instead of in a plain variable.
So when it comes to execution the function gets the first file name.
If the buffer isn't empty after execution the command should issue a new command to print the next example after the first one.
Depending on the odd/even configuration this may cause one page of text between them, and this should also be handled correctly.
Take as example:
Assume we're on an even page (4)
Enter a two-page example that should start with an even page
Then enter a three-page example that should start with an odd page
The result should be:
Text flows on page 4-5
Two-page example on p. 6-7
One page of text (8)
Three-page example on p. 9-11
This is actually quite complex and will require good testing.
Entering a \fullPage example delays execution until the next pagebreak (or even the second-to-next, depending on the odd/even-situation). For this it saves the file name to an internal variable.
If one then enters another \fullPageMusicExample before the execution of the \afterpage command is completed this internal variable is reset to the new filename, and the first command tries to print the wrong file.
As a workaround this has to be documented. But of course one should be able to enter examples like this, because the user can't know when the example actually will be included.
I think the filename should be saved to a FIFO-buffer instead of in a plain variable. So when it comes to execution the function gets the first file name. If the buffer isn't empty after execution the command should issue a new command to print the next example after the first one. Depending on the odd/even configuration this may cause one page of text between them, and this should also be handled correctly.
Take as example:
The result should be:
This is actually quite complex and will require good testing.