aboutsummaryrefslogtreecommitdiff
path: root/src/ellinika/syllabificator.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ellinika/syllabificator.c')
-rw-r--r--src/ellinika/syllabificator.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/ellinika/syllabificator.c b/src/ellinika/syllabificator.c
index 97d3ce7..0e7b6c6 100644
--- a/src/ellinika/syllabificator.c
+++ b/src/ellinika/syllabificator.c
@@ -38,7 +38,13 @@ struct syllabificator {
((ph).code == PHON_I && (ph).count == 1 && \
!((ph).flags & (CHF_ACCENT_MASK|CHF_TREMA)))
-int
+#define NEXT_PHONEME(sp) do { \
+ (sp)->phon_cur++; \
+ if ((sp)->phon_cur == (sp)->phon_max) \
+ return 0; \
+ } while (0)
+
+static int
next_syllable(struct syllabificator *sp)
{
struct syllable *syl;
@@ -65,8 +71,8 @@ next_syllable(struct syllabificator *sp)
syl->phoneme_start = sp->phon_cur;
syl->phoneme_count = 1;
syl->flags = sp->phon[sp->phon_cur].flags;
-
- sp->phon_cur++;
+
+ NEXT_PHONEME(sp);
/* A diphthong forms a single syllable. */
if ((syl->flags & CHF_DIPHTHONG) && !(syl->flags & CHF_CONSONANT))
@@ -93,9 +99,7 @@ next_syllable(struct syllabificator *sp)
/* incorporate iota */;
syl->char_count += sp->phon[sp->phon_cur].count;
syl->phoneme_count++;
- sp->phon_cur++;
- if (sp->phon_cur == sp->phon_max)
- return 0;
+ NEXT_PHONEME(sp);
if (sp->phon[sp->phon_cur].flags & CHF_VOWEL)
syl->flags |= CHF_DIPHTHONG|CHF_IOTA;
}
@@ -105,10 +109,7 @@ next_syllable(struct syllabificator *sp)
syl->char_count += sp->phon[sp->phon_cur].count;
syl->phoneme_count++;
- sp->phon_cur++;
-
- if (sp->phon_cur == sp->phon_max)
- return 0;
+ NEXT_PHONEME(sp);
if (sp->phon[sp->phon_cur - 1].flags & CHF_VOWEL) {
/* If next phoneme is a consonant, incorporate it into the
@@ -118,7 +119,7 @@ next_syllable(struct syllabificator *sp)
(sp->phon[sp->phon_cur + 1].flags & CHF_CONSONANT))) {
syl->char_count += sp->phon[sp->phon_cur].count;
syl->phoneme_count++;
- sp->phon_cur++;
+ NEXT_PHONEME(sp);
}
}

Return to:

Send suggestions and report system problems to the System administrator.