Skip to content

Commit

Permalink
Wrote computed results to the .gaux file rather than measurements.
Browse files Browse the repository at this point in the history
  • Loading branch information
henryso committed Mar 19, 2016
1 parent 5eeeeb5 commit 7e0bcb1
Show file tree
Hide file tree
Showing 7 changed files with 169 additions and 111 deletions.
55 changes: 27 additions & 28 deletions src/gabc/gabc-notes-determination.l
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,18 @@ static char char_for_brace;
static unsigned int nbof_isolated_episema;
static char *notesmacros[10];
static char tempstr[256];
static int brace_var_counter = 0;
static int overbrace_var = 0, underbrace_var = 0;
static unsigned short overbrace_var = 0, underbrace_var = 0;
static const char *overbrace_var_kind;
static int before_ledger_type;
static char *before_ledger_length = NULL;
static int ledger_var[2] = { 0, 0 };
static unsigned short ledger_var[2] = { 0, 0 };
static unsigned char staff_lines;
static signed char highest_pitch;
static bool legacy_oriscus_orientation;
static unsigned short he_adjustment_index[2] = { 0, 0 };

typedef struct slur_info {
int var;
unsigned short var;
char shift;
gregorio_note *start;
} slur_info;
Expand Down Expand Up @@ -274,10 +273,10 @@ static void add_variable_ledger(const gregorio_sign_orientation type,
after_ledger_length = after_ledger;
}

ledger_var[type] = ++brace_var_counter;
ledger_var[type] = ++tex_position_id;
gregorio_snprintf(tempstr, sizeof tempstr,
"\\GreVarBraceSavePos{%d}{0}{1}"
"\\GreDrawAdditionalLine{%d}{\\GreVarBraceLength{%d}}"
"\\GreVarBraceSavePos{%hu}{0}{1}"
"\\GreDrawAdditionalLine{%d}{\\GreVarBraceLength{%hu}}"
"{%d}{%s}{%d}{%s}",
ledger_var[type], type, ledger_var[type], before_ledger_type,
before_ledger_length, after_ledger_type, after_ledger_length);
Expand All @@ -301,7 +300,7 @@ static void end_variable_ledger(const gregorio_sign_orientation type)
"%s-staff ledger line start"), typename, typename);
} else {
gregorio_snprintf(tempstr, sizeof tempstr,
"\\GreVarBraceSavePos{%d}{0}{2}", ledger_var[type]);
"\\GreVarBraceSavePos{%hu}{0}{2}", ledger_var[type]);
ledger_var[type] = 0;
gregorio_add_texverb_as_note(&current_note, gregorio_strdup(tempstr),
GRE_TEXVERB_GLYPH, &notes_lloc);
Expand Down Expand Up @@ -440,7 +439,7 @@ static void start_var_slur(void)
return;
}

slur[index].var = ++brace_var_counter;
slur[index].var = ++tex_position_id;
parse_slur_shift(&(slur[index].shift));
slur[index].start = current_note;
}
Expand Down Expand Up @@ -470,16 +469,16 @@ static void end_var_slur(void)
parse_slur_shift(&shift);

gregorio_snprintf(tempstr, sizeof tempstr,
"\\GreVarBraceSavePos{%d}{%c}{1}"
"\\GreSlur{%d}{%d}{%c}{\\GreVarBraceLength{%d}}{}{%d}",
"\\GreVarBraceSavePos{%hu}{%c}{1}"
"\\GreSlur{%d}{%d}{%c}{\\GreVarBraceLength{%hu}}{}{%d}",
slur[index].var, slur[index].shift,
slur[index].start->u.note.pitch + direction, direction,
slur[index].shift, slur[index].var,
current_note->u.note.pitch + direction);
gregorio_add_texverb_to_note(slur[index].start, gregorio_strdup(tempstr));

gregorio_snprintf(tempstr, sizeof tempstr,
"\\GreVarBraceSavePos{%d}{%c}{2}", slur[index].var, shift);
"\\GreVarBraceSavePos{%hu}{%c}{2}", slur[index].var, shift);
gregorio_add_texverb_to_note(current_note, gregorio_strdup(tempstr));


Expand Down Expand Up @@ -713,11 +712,11 @@ void gabc_det_notes_finish(void)
"previous overbrace"));
} else {
char_for_brace = gabc_notes_determination_text[4]-'0';
overbrace_var = ++brace_var_counter;
overbrace_var = ++tex_position_id;
overbrace_var_kind = "ob";
gregorio_snprintf(tempstr, sizeof tempstr,
"\\GreVarBraceSavePos{%d}{%d}{1}"
"\\GreOverBrace{\\GreVarBraceLength{%d}}{0pt}{0pt}{%d}",
"\\GreVarBraceSavePos{%hu}{%d}{1}"
"\\GreOverBrace{\\GreVarBraceLength{%hu}}{0pt}{0pt}{%d}",
overbrace_var, char_for_brace, overbrace_var, char_for_brace);
gregorio_add_texverb_to_note(current_note, gregorio_strdup(tempstr));
}
Expand All @@ -729,10 +728,10 @@ void gabc_det_notes_finish(void)
"previous underbrace"));
} else {
char_for_brace = gabc_notes_determination_text[4]-'0';
underbrace_var = ++brace_var_counter;
underbrace_var = ++tex_position_id;
gregorio_snprintf(tempstr, sizeof tempstr,
"\\GreVarBraceSavePos{%d}{%d}{1}"
"\\GreUnderBrace{\\GreVarBraceLength{%d}}{0pt}{0pt}{%d}",
"\\GreVarBraceSavePos{%hu}{%d}{1}"
"\\GreUnderBrace{\\GreVarBraceLength{%hu}}{0pt}{0pt}{%d}",
underbrace_var, char_for_brace, underbrace_var, char_for_brace);
gregorio_add_texverb_to_note(current_note, gregorio_strdup(tempstr));
}
Expand All @@ -744,11 +743,11 @@ void gabc_det_notes_finish(void)
"previous overbrace"));
} else {
char_for_brace = gabc_notes_determination_text[5]-'0';
overbrace_var = ++brace_var_counter;
overbrace_var = ++tex_position_id;
overbrace_var_kind = "ocb";
gregorio_snprintf(tempstr, sizeof tempstr,
"\\GreVarBraceSavePos{%d}{%d}{1}"
"\\GreOverCurlyBrace{\\GreVarBraceLength{%d}}{0pt}{0pt}{%d}{0}",
"\\GreVarBraceSavePos{%hu}{%d}{1}"
"\\GreOverCurlyBrace{\\GreVarBraceLength{%hu}}{0pt}{0pt}{%d}{0}",
overbrace_var, char_for_brace, overbrace_var, char_for_brace);
gregorio_add_texverb_to_note(current_note, gregorio_strdup(tempstr));
}
Expand All @@ -760,11 +759,11 @@ void gabc_det_notes_finish(void)
"previous overbrace"));
} else {
char_for_brace = gabc_notes_determination_text[6]-'0';
overbrace_var = ++brace_var_counter;
overbrace_var = ++tex_position_id;
overbrace_var_kind = "ocba";
gregorio_snprintf(tempstr, sizeof tempstr,
"\\GreVarBraceSavePos{%d}{%d}{1}"
"\\GreOverCurlyBrace{\\GreVarBraceLength{%d}}{0pt}{0pt}{%d}{1}",
"\\GreVarBraceSavePos{%hu}{%d}{1}"
"\\GreOverCurlyBrace{\\GreVarBraceLength{%hu}}{0pt}{0pt}{%d}{1}",
overbrace_var, char_for_brace, overbrace_var, char_for_brace);
gregorio_add_texverb_to_note(current_note, gregorio_strdup(tempstr));
}
Expand All @@ -782,7 +781,7 @@ void gabc_det_notes_finish(void)
} else {
char_for_brace = gabc_notes_determination_text[4]-'0';
gregorio_snprintf(tempstr, sizeof tempstr,
"\\GreVarBraceSavePos{%d}{%d}{2}", overbrace_var,
"\\GreVarBraceSavePos{%hu}{%d}{2}", overbrace_var,
char_for_brace);
overbrace_var = 0;
gregorio_add_texverb_to_note(current_note, gregorio_strdup(tempstr));
Expand All @@ -796,7 +795,7 @@ void gabc_det_notes_finish(void)
} else {
char_for_brace = gabc_notes_determination_text[4]-'0';
gregorio_snprintf(tempstr, sizeof tempstr,
"\\GreVarBraceSavePos{%d}{%d}{2}", underbrace_var,
"\\GreVarBraceSavePos{%hu}{%d}{2}", underbrace_var,
char_for_brace);
underbrace_var = 0;
gregorio_add_texverb_to_note(current_note, gregorio_strdup(tempstr));
Expand All @@ -815,7 +814,7 @@ void gabc_det_notes_finish(void)
} else {
char_for_brace = gabc_notes_determination_text[5]-'0';
gregorio_snprintf(tempstr, sizeof tempstr,
"\\GreVarBraceSavePos{%d}{%d}{2}", overbrace_var,
"\\GreVarBraceSavePos{%hu}{%d}{2}", overbrace_var,
char_for_brace);
overbrace_var = 0;
gregorio_add_texverb_to_note(current_note, gregorio_strdup(tempstr));
Expand All @@ -834,7 +833,7 @@ void gabc_det_notes_finish(void)
} else {
char_for_brace = gabc_notes_determination_text[6]-'0';
gregorio_snprintf(tempstr, sizeof tempstr,
"\\GreVarBraceSavePos{%d}{%d}{2}", overbrace_var,
"\\GreVarBraceSavePos{%hu}{%d}{2}", overbrace_var,
char_for_brace);
overbrace_var = 0;
gregorio_add_texverb_to_note(current_note, gregorio_strdup(tempstr));
Expand Down
3 changes: 1 addition & 2 deletions src/gregoriotex/gregoriotex-write.c
Original file line number Diff line number Diff line change
Expand Up @@ -3391,7 +3391,6 @@ static __inline void anticipate_event(gregorio_syllable *syllable,
char *const euouae_follows, char *const eol_forces_custos,
unsigned short *const next_euouae_id)
{
static unsigned short euouae_id = 0;
bool has_intervening_linebreak = false;

*euouae_follows = '\0';
Expand All @@ -3411,7 +3410,7 @@ static __inline void anticipate_event(gregorio_syllable *syllable,
scan_syllable_for_eol(syllable, eol_forces_custos);

if (syllable->euouae == EUOUAE_BEGINNING) {
*next_euouae_id = syllable->euouae_id = ++euouae_id;
*next_euouae_id = syllable->euouae_id = ++tex_position_id;
*euouae_follows = has_intervening_linebreak? '1' : '0';
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
#include "characters.h"
#include "support.h"

unsigned short tex_position_id = 0;

gregorio_clef_info gregorio_default_clef = {
/*.line =*/ 3,
/*.secondary_line =*/ 0,
Expand Down
1 change: 1 addition & 0 deletions src/struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,7 @@ typedef struct gregorio_hepisema_adjustment {
#define F_KEY 'f'
#define NO_KEY -5

extern unsigned short tex_position_id;
extern gregorio_clef_info gregorio_default_clef;

#define MONOPHONY 0
Expand Down
2 changes: 1 addition & 1 deletion tex/gregoriotex-signs.tex
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@
\pdfsavepos %
\kern.5\wd\gre@box@temp@sign %
\fi %
\directlua{gregoriotex.var_brace_note_pos(#1, #3)}%
\directlua{gregoriotex.save_length(#1, #3)}%
\fi %
\relax %
}%
Expand Down
4 changes: 2 additions & 2 deletions tex/gregoriotex-syllable.tex
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
\global\gre@lastendswithmorafalse %
\ifgre@boxing\else\ifgre@firstin@euouae %
\ifgre@raggedbreakbeforeeuouae %
\directlua{gregoriotex.save_pos(\the\gre@lasteuouaeindex,2)}%
\directlua{gregoriotex.save_euouae(\the\gre@lasteuouaeindex,2)}%
\fi %
\gre@firstin@euouaefalse %
\fi\fi %
Expand Down Expand Up @@ -821,7 +821,7 @@
\gre@usemanualeolcustos %
\fi %
\ifgre@raggedbreakbeforeeuouae %
\directlua{gregoriotex.save_pos(#1,1)}%
\directlua{gregoriotex.save_euouae(#1,1)}%
\ifcase#2\ifcase\directlua{gregoriotex.is_ypos_different(#1)}\relax%
\gre@newlinecommon{1}{1}%
\fi\fi %
Expand Down
Loading

0 comments on commit 7e0bcb1

Please sign in to comment.