[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: T3154 work - round 2 - question.
From: |
David Kastrup |
Subject: |
Re: T3154 work - round 2 - question. |
Date: |
Sun, 21 Jul 2013 10:07:27 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Ian Hulin <address@hidden> writes:
> However, the it looks like the \midi blocks still need to be stackable
Do they? It seems so far we got away without that?
> and I've just figured out the way you implemented the things for \paper¸
> and I think we could use a set of general procedures/method to handle
> output_def stacks, modelled on what you did for \paper.
Uh, I don't think I did anything much for \paper. I have not, as far as
I can see, touched any of the internal ways of organizing data. At best
I provided hooks into them. Or changed in the parser when what gets
copied from where in order to deal with problem reports.
> I.e.
> (<blah> could be one of papers, midis, or layouts)
> get_<blah> // used by parser to set up an initial output_def (though
> get_midi has a potential name clash with a method in Midi_walker::)
> These probably need to stay as separate functions for each output_def type.
>
> init_<blah> // initialize the stack using a parser variable
> push_<blah> // push an output def onto the stack using the
> // parser variable
> pop_<blah> // push an output def from the stack using the
> // parser variable
> set_<blah> // set the value of the topmost stack item.
We don't really have stacks for paper. There is something like a parent
setting somewhere and \paper is the parent for \layout or the other way
round, but that really only concerns lookup.
> void
> init_od_stack ( string od_type, Lily_parser *parser)
> {
> switch (od_type.c_str())
> {
> case 'paper':
> {
> //init_papers (parser);
> SCM stack_parser_var =
> parser->lexer_->lookup_identifier ("$papers");
> SCM default_parser_var =
> parser->lexer_->lookup_identifier ("$defaultpaper");
> SCM od_property_val = ly_symbol2scm ("is-paper");
> }
> break;
> case 'midi':
> {
> //init_midis (parser);
> SCM stack_parser_var =
> parser->lexer_->lookup_identifier ("$midis");
> SCM default_parser_var =
> parser->lexer_->lookup_identifier ("$defaultmidi");
> SCM od_property_val = ly_symbol2scm ("is-midi");
> }
> break;
> case 'layout':
> {
> //init_layouts (parser);
> SCM stack_parser_var =
> parser->lexer_->lookup_identifier ("$layouts");
> SCM default_parser_var =
> parser->lexer_->lookup_identifier ("$defaultlayout");
> SCM od_property_val = ly_symbol2scm ("is-layout");
> }
> break;
> }
> Output_def *my_output_def =
> ((stack_parser_var == SCM_UNDEFINED)
> || scm_is_null (stack_parser_var))
> ? 0 : unsmob_output_def (scm_car (stack_parser_var));
> my_output_def =
> my_output_def ? my_output_def
> : unsmob_output_def(default_parser_var);
>
> my_output_def =
> my_output_def ?
> dynamic_cast<Output_def *> (my_output_def->clone ())
> : new Output_def;
> my_output_def->set_variable (od_property_val, SCM_BOOL_T);
> return my_output_def;
> }
>
> WDYT?
That looks like you want to institute a completely new stack structure
running in parallel with the \layout/\paper duplicity.
Make no mistake: the current setup is an incoherent mess. But putting
stacks on top of the incoherent mess is not going to fix that.
So the main question is: what are you trying to do? What is the
ultimate goal?
--
David Kastrup