BUGS
- * first clef
+ * first clef isn't printed
SEVERELY LACKING:
INPUTLANGUAGE
- * lexer condition stack
-
- * lose the $ and @?
+ * lose the $ and @ ?
* figured bass?
* make spanner for staffsym
- * Lyric_req : Text_req, Rhythmic_req
+ * Lyric_req: Text_req, Rhythmic_req
* Lookup::tex_glissando, Lookup::tex_bracket,
Lookup::tex_cresc, Lookup::tex_decresc (use texbeam.cc as an
* C meter iso 4/4
- * textspanner: dir of beam.
+ * textspanner: center position
* script-spacing
* space rest.
- * use (char *) iso. String for communication between lexer and parser.
+ * use (char *) iso. String for communication between lexer and
+ parser.
* As vs. as notename.
* configure idealspacing: arithmetic spacing
- * fix symbols in parser.o: `Warning: size of symbol'
+ * fix linking: `Warning: size of symbol'
+
+BIGGISH PROJECT
+
+ * merge musical & non-musical column. Scrap Commands in favour
+ of Requests, and do multiparralel meters
DOC
* all errors
FUTURE
- * Command_req
-
- * scrap stem_request?
- * put requests on barcommands
+ * syntax: grouping 2*4 3*8.
+
+ * put scripts on barcommands
* glissando
* QLP for beams?
- * stacked slurs.
-
* revise calcideal
* eentje/tweetje
IDEAS
+ * voice terminate req.
+
+ * keep input in mem, store char* to define spots
+
+ * enter Requests directly
+
* itemcolumns
* check out PMX
Array<Request*> pre_reqs, post_reqs;
sstack<String> define_spots;
-
+extern bool want_beam;
Paperdef*default_paper();
+
%}
%token VOICE STAFF SCORE TITLE BAR NOTENAME OUTPUT
%token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS COMMAND
%token GEOMETRIC START_T DURATIONCOMMAND OCTAVECOMMAND
-o%token KEY CLEF MULTI TABLE CHORD VOICES
-%token PARTIAL RHYTHMIC MELODIC MUSIC LYRIC GROUPING CADENZA
+%token KEY CLEF MULTI TABLE CHORD VOICES
+%token PARTIAL MUSIC GROUPING CADENZA
%token END SYMBOLTABLES TEXID TABLE NOTENAMES SCRIPT TEXTSTYLE PLET
%token MARK GOTO
%token <id> IDENTIFIER
-%token <string> NEWIDENTIFIER
%token <string> PITCHMOD DURATION RESTNAME
%token <ii> NOTENAME
%token <real> REAL
;
declarable_identifier:
- NEWIDENTIFIER { $$ = $1; }
+ STRING { $$ = $1; }
| IDENTIFIER { $$ = new String($1->name); }
;
score_commands_body: { $$ = new Array<Input_command*>; }
| score_commands_body score_command {
- $$->add($2);
+ $$->push($2);
}
| score_commands_body position_command {
- $$->add($2);
+ $$->push($2);
}
;
staff_commands_body:
/* empty */ { $$ = new Array<Input_command*>; }
| staff_commands_body staff_command {
- $$->add($2);
+ $$->push($2);
}
| staff_commands_body position_command {
- $$->add($2);
+ $$->push($2);
}
;
staff_init:
IDENTIFIER { $$ = $1->staff(true); }
- | RHYTHMIC {
- $$ = new Input_staff("rhythmic");
- }
- | MELODIC {
- $$ = new Input_staff( "melodic");
- }
- | LYRIC {
- $$ = new Input_staff( "lyric");
+ | STRING {
+ $$ = new Input_staff(*$1);
+ delete $1;
}
;
assert(post_reqs.empty());
}
| post_requests post_request {
- post_reqs.add($2);
+ post_reqs.push($2);
}
;
| script_req
| textscript_req
;
+
close_request_parens:
'(' { $$='('; }
- |']' { $$ = ']' }
+ |']' { $$=']'; }
;
open_request_parens:
- ')' {$$=')'}
- |'[' {$$='['}
+ ')' { $$=')'; }
+ |'[' { $$='['; }
;
script_definition:
pre_requests:
| pre_requests pre_request {
- pre_reqs.add($2);
+ pre_reqs.push($2);
}
;
$$ = new Array<int>;
}
| pitch_list NOTENAME {
- $$->add($2[0]);
- $$->add($2[1]);
+ $$->push($2[0]);
+ $$->push($2[1]);
}
;
$$ = new Array<int>;
}
| int_list int {
- $$->add($2);
+ $$->push($2);
}
;
parse_file(String s)
{
*mlog << "Parsing ... ";
+ lexer = new My_flex_lexer;
#ifdef YYDEBUG
yydebug = !monitor.silence("InitParser") && check_debug;
+ lexer->set_debug( !monitor.silence("InitLexer") && check_debug);
#endif
- set_lexer();
lexer->new_input("symbol.ini");
yyparse();
#ifdef YYDEBUG
yydebug = !monitor.silence("Parser") && check_debug;
+ lexer->set_debug( !monitor.silence("Lexer") && check_debug);
#endif
lexer->new_input(s);
yyparse();
- kill_lexer();
+ delete lexer;
+ lexer = 0;
+
assert(define_spots.empty());
}
Symbol bs=(*symtables_)("beamslopes")->lookup("slope");
Array<String> args;
- args.add(sidx);
- args.add(widx);
+ args.push(sidx);
+ args.push(widx);
bs.tex = substitute_args(bs.tex,args);
int w = 2 << widx;
Real width = convert_dimen(w,"pt");
{
Symbol bs=(*symtables_)("beamslopes")->lookup("horizontal");
Array<String> args;
- args.add(print_dimen(height));
- args.add(print_dimen(width));
+ args.push(print_dimen(height));
+ args.push(print_dimen(width));
bs.tex = substitute_args(bs.tex,args);
bs.dim.x = Interval(0,width);
bs.dim.y = Interval(0,height);
--- /dev/null
+#include "rest.hh"
+#include "notehead.hh"
+#include "paper.hh"
+#include "debug.hh"
+#include "slur.hh"
+#include "request.hh"
+#include "complexwalker.hh"
+#include "complexstaff.hh"
+#include "voicegroup.hh"
+#include "register.hh"
+
+Voice_registers::Voice_registers(Complex_walker*c_l, Voice *v_p)
+ : head_reg_(c_l), slur_reg_(c_l)
+{
+ voice_l_ = v_p;
+}
+
+bool
+Voice_registers::try_request(Request * r_l)
+{
+ bool b = head_reg_.try_request(r_l);
+ if (!b)
+ b = slur_reg_.try_request(r_l);
+ return b;
+}
+
+void
+Voice_registers::announce_element(Staff_elem_info i)
+{
+ if (i.voice_l_ != voice_l_)
+ return;
+ if (i.origin_reg_l_ != &slur_reg_)
+ slur_reg_.acknowledge_element(i);
+}
+
+void
+Voice_registers::pre_move_processing()
+{
+ head_reg_.pre_move_processing();
+ slur_reg_.pre_move_processing();
+}
+void
+Voice_registers::post_move_processing()
+{
+ head_reg_.post_move_processing();
+ slur_reg_.post_move_processing();
+}
+
+void
+Voice_registers::process_requests()
+{
+ head_reg_.process_request();
+ slur_reg_.process_request();
+}
+
+/****************/
+
+Notehead_register::Notehead_register(Complex_walker*w_l)
+ :Request_register(w_l)
+{
+ note_l_ = 0;
+}
+
+bool
+Notehead_register::try_request(Request *req_l)
+{
+ if (req_l->note() || req_l->rest())
+ accepted_req_arr_.push(req_l);
+ else
+ return false;
+
+ return true;
+}
+
+void
+Notehead_register::process_request()
+{
+ Request* req_l = accepted_req_arr_.last();
+ if (req_l->note()) {
+ Notehead*n_p = new Notehead(8); // ugh
+ note_l_ = n_p;
+ n_p->set_rhythmic(req_l->rhythmic());
+ n_p->position = req_l->note()->height() + -2;
+ } else {
+ note_l_ = new Rest ( req_l->rhythmic()->balltype,
+ req_l->rhythmic()->dots);
+ if (req_l->rhythmic()->balltype <= 2)
+ note_l_->translate(
+ Offset(0,
+ 5 * walk_l_->staff()->paper()->internote()));
+ }
+ Staff_elem_info itinf(note_l_,req_l,this);
+ walk_l_->announce_element(itinf);
+}
+
+void
+Notehead_register::do_pre_move_process()
+{
+ if (note_l_) {
+ walk_l_->typeset_element(note_l_);
+ note_l_ = 0;
+ }
+}
+
+/****************/
+/****************/
+
+Slur_register::Slur_register(Complex_walker* w)
+ : Request_register(w)
+{
+}
+
+bool
+Slur_register::try_request(Request *req_l)
+{
+ if(!req_l->slur())
+ return false;
+
+ accepted_req_arr_.push(req_l);
+ return true;
+}
+
+void
+Slur_register::acknowledge_element(Staff_elem_info info)
+{
+ if (info.elem_p_->name() == String("Notehead")) {
+ Notehead *head_p =(Notehead*) info.elem_p_ ;// ugh
+ for (int i = 0; i < slur_l_stack_.size(); i++)
+ slur_l_stack_[i]->add(head_p );
+ for (int i = 0; i < end_slur_l_arr_.size(); i++)
+ end_slur_l_arr_[i]->add(head_p);
+ }
+}
+
+void
+Slur_register::process_request()
+{
+ Array<Slur*> start_slur_l_arr_;
+ for (int i=0; i< accepted_req_arr_.size(); i++) {
+ Slur_req* slur_req_l = accepted_req_arr_[i]->slur();
+ if (slur_req_l->spantype == Span_req::STOP) {
+ if (slur_l_stack_.empty())
+ error_t("can't find slur to end; ",
+ *walk_l_->col()->tdescription_);
+ end_slur_l_arr_.push(slur_l_stack_.pop());
+
+ } else if (slur_req_l->spantype == Span_req::START) {
+ Slur * s_p =new Slur;
+ start_slur_l_arr_.push(s_p);
+ walk_l_->announce_element(Staff_elem_info(s_p, slur_req_l, this));
+ }
+ }
+ for (int i=0; i < start_slur_l_arr_.size(); i++)
+ slur_l_stack_.push(start_slur_l_arr_[i]);
+}
+
+void
+Slur_register::do_pre_move_process()
+{
+ for (int i = 0; i < end_slur_l_arr_.size(); i++)
+ walk_l_->typeset_element(end_slur_l_arr_[i]);
+ end_slur_l_arr_.set_size(0);
+}
+
+Slur_register::~Slur_register()
+{
+ if (slur_l_stack_.size())
+ error("unterminated slur");
+}