Dmytro, Thanks for the example. The "defined?" test is a key piece, and you saved me hunting through the Scheme manual for it. With that test, it's relatively easy to mimic the C preprocessor's "include guard" method. Variable scoping can be tricky in LilyPond, so I may have to fuss a bit to make sure that the appropriate variables are accessible when needed.
I'll try to do this when I get back from a trip in a couple of weeks, and I'll post my code. Thanks, Mike O'Donnell Dmytro O. Redchuk wrote: > У чт, 2010-01-21 у 11:47 -0600, Michael J. O'Donnell пише: > >> I am putting together a large choral score from bookparts for each >> number in the work. I like to be able to produce either a single number, >> or the whole score. The natural approach is to include style definitions >> in each of the files that I might set, including the file to format the >> whole score and the files to format individual numbers. Files to format >> individual numbers also include the style definitions. >> >> I find that repeated inclusion of the same definitions leads quickly to >> a segmentation fault. >> >> I can either add one more level of indirection, with one more file per >> number. Or, I can do some Scheme hacking, with a global variable to set >> showing inclusion (tricky, because the variable needs to be testable >> reliably even when it has never been set explicitly). >> > I am not sure, but probably you can use your own names for element style > definitions and check them with "(if (defined? ..." constructs?.. > > Probably, i simply don't knwo what's i'm talking about, but... It's a > chance to ask for me :-) > > For example, i use these in macro.lyi: > > % -----------------8<--------------------------- > globalStaffSize = #(if (defined? 'globalStaffSize) globalStaffSize 20) > > #(symbol-fset! 'barno-plain ly:text-interface::print) > #(symbol-fset! 'barno-boxed (make-stencil-boxer 0.1 0.33 > ly:text-interface::print)) > ourBarNumberStencil = > #(if (defined? 'ourBarNumberStencil) > (symbol-fref ourBarNumberStencil) > (symbol-fref 'barno-boxed)) > % -----------------8<--------------------------- > > And then i can use these in score templates: > > % -----------------8<--------------------------- > globalStaffSize = #22 > ourBarNumberStencil = #'barno-plain > % -----------------8<--------------------------- > > And later they will be used in appropriate places... > > >> But, I'd prefer to use a well-known standard method, if it exists. >> > Hardly believe this is a "standard method" thought :O) > > And i have not tried these with \bookpart, but "should work" i guess. > > And, please, as always --- any comments are welcome! > > >> Thanks, >> >> Mike O'Donnell >> > > _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user