Skip to content

Commit

Permalink
Merge pull request #211 from henryso/refactor
Browse files Browse the repository at this point in the history
Refactor - Phase III
  • Loading branch information
eroux committed Apr 3, 2015
2 parents a319edb + 2722891 commit 43d961e
Show file tree
Hide file tree
Showing 13 changed files with 2,083 additions and 1,825 deletions.
11 changes: 11 additions & 0 deletions .indent.pro
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,14 @@
-T gregorio_word_position
-T gregorio_lyric_centering
-T gregorio_type
-T gregorio_shape
-T gregorio_bar
-T gregorio_sign
-T gregorio_space
-T gregorio_liquescentia
-T gregorio_h_episemus
-T gregorio_glyph_type
-T gregorio_word_position
-T gregorio_lyric_centering
-T gregorio_extra_info
-T gregorio_misc_element_info
395 changes: 197 additions & 198 deletions src/dump/dump.c

Large diffs are not rendered by default.

35 changes: 18 additions & 17 deletions src/dump/dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,39 @@
#ifndef DUMP_H
#define DUMP_H

void write_score (FILE *f, gregorio_score *score);
#include <struct.h>

const char *dump_key_to_char (int key);
void write_score(FILE *f, gregorio_score *score);

const char *dump_syllable_position (char pos);
const char *dump_key_to_char(int key);

const char *dump_type (char type);
const char *dump_syllable_position(gregorio_word_position pos);

const char *dump_bar_type (char element_type);
const char *dump_type(gregorio_type type);

const char *dump_space_type (char element_type);
const char *dump_bar_type(gregorio_bar element_type);

const char *dump_element_type (char element_type);
const char *dump_space_type(gregorio_space element_type);

const char *dump_liquescentia (char liquescentia);
const char *dump_liquescentia(gregorio_liquescentia liquescentia);

const char *dump_glyph_type (char glyph_type);
const char *dump_glyph_type(gregorio_glyph_type glyph_type);

const char *dump_shape (char shape);
const char *dump_shape(gregorio_shape shape);

const char *dump_signs (char signs);
const char *dump_signs(gregorio_sign signs);

const char *dump_rare_sign (char rare_sign);
const char *dump_special_sign(gregorio_sign rare_sign);

const char *dump_h_episemus_type (unsigned char h_episemus_type);
const char *dump_h_episemus_type(gregorio_h_episemus h_episemus_type);

void dump_write_characters (FILE *f, gregorio_character *current_character);
void dump_write_characters(FILE *f, gregorio_character *current_character);

const char *dump_style_to_string (unsigned char style);
const char *dump_style_to_string(grestyle_style style);

const char *dump_translation_type_to_string (unsigned char translation_type);
const char *dump_translation_type_to_string(gregorio_tr_centering
translation_type);

const char * dump_nlba_to_string (unsigned char no_linebreak_area);
const char *dump_nlba_to_string(gregorio_nlba no_linebreak_area);

#endif
28 changes: 12 additions & 16 deletions src/gabc/gabc-elements-determination.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ gregorio_element *gabc_det_elements_from_glyphs(gregorio_glyph *current_glyph)
}
// we must not cut after a zero_width_space
if (current_glyph->type == GRE_SPACE
&& current_glyph->glyph_type == SP_ZERO_WIDTH) {
&& current_glyph->u.misc.unpitched.info.space == SP_ZERO_WIDTH) {
if (!current_glyph->next) {
close_element(&current_element, first_glyph);
}
Expand All @@ -189,19 +189,15 @@ gregorio_element *gabc_det_elements_from_glyphs(gregorio_glyph *current_glyph)
// if statement to make neumatic cuts not appear in elements, as
// there is always one between elements
if (current_glyph->type != GRE_SPACE
|| current_glyph->glyph_type != SP_NEUMATIC_CUT)
|| current_glyph->u.misc.unpitched.info.space != SP_NEUMATIC_CUT)
// clef change or space other thant neumatic cut
{
if (!first_element) {
first_element = current_element;
}
gregorio_add_special_as_element(&current_element,
current_glyph->type,
current_glyph->glyph_type,
current_glyph->liquescentia,
current_glyph->texverb);
} else {

gregorio_add_misc_element(&current_element, current_glyph->type,
current_glyph->u.misc,
current_glyph->texverb);
}
first_glyph = current_glyph->next;
previous_glyph = current_glyph->next;
Expand Down Expand Up @@ -236,19 +232,19 @@ gregorio_element *gabc_det_elements_from_glyphs(gregorio_glyph *current_glyph)
}
break;
case G_ONE_NOTE:
if (current_glyph->first_note
&& (current_glyph->first_note->shape == S_STROPHA
|| current_glyph->first_note->shape == S_VIRGA
|| current_glyph->first_note->shape == S_VIRGA_REVERSA)) {
if (current_glyph->u.notes.first_note
&& (current_glyph->u.notes.first_note->u.note.shape == S_STROPHA
|| current_glyph->u.notes.first_note->u.note.shape == S_VIRGA
|| current_glyph->u.notes.first_note->u.note.shape == S_VIRGA_REVERSA)) {
// we determine the last pitch
char last_pitch;
gregorio_note *tmp_note;
tmp_note = previous_glyph->first_note;
tmp_note = previous_glyph->u.notes.first_note;
while (tmp_note->next) {
tmp_note = tmp_note->next;
}
last_pitch = tmp_note->pitch;
if (current_glyph->first_note->pitch == last_pitch) {
last_pitch = tmp_note->u.note.pitch;
if (current_glyph->u.notes.first_note->u.note.pitch == last_pitch) {
previous_glyph = current_glyph;
break;
}
Expand Down
Loading

0 comments on commit 43d961e

Please sign in to comment.