Unify terminology for stress

synthesize.h now contains the definitions STRESS_IS_... that should be used with code related to syllable stress.

Note that isBreak and other defines were renumbered so that stress definitions could have values 0-6.

Possible TODOs:
1. Unify with terms used with phonemes, i.e. keywords like isDiminished in compiledata.c and stress_type in phsource/phonemes
2. Add functionality and documentation about STRESS_IS_PRIORITY and STRESS_IS_EMPHASIZED
This commit is contained in:
Juho Hiltunen
2018-01-14 15:26:03 +02:00
parent 88315250ff
commit da287fb851
4 changed files with 136 additions and 131 deletions
+15 -13
View File
@@ -119,11 +119,11 @@ static keywtab_t k_properties[] = {
{ "isVelar", 0, CONDITION_IS_PLACE_OF_ARTICULATION | phPLACE_VELAR },
{ "isDiminished", 0, CONDITION_IS_OTHER | isDiminished },
{ "isUnstressed", 0, CONDITION_IS_OTHER | isUnstressed },
{ "isNotStressed", 0, CONDITION_IS_OTHER | isNotStressed },
{ "isStressed", 0, CONDITION_IS_OTHER | isStressed },
{ "isMaxStress", 0, CONDITION_IS_OTHER | isMaxStress },
{ "isDiminished", 0, CONDITION_IS_OTHER | STRESS_IS_DIMINISHED },
{ "isUnstressed", 0, CONDITION_IS_OTHER | STRESS_IS_UNSTRESSED },
{ "isNotStressed", 0, CONDITION_IS_OTHER | STRESS_IS_NOT_STRESSED },
{ "isStressed", 0, CONDITION_IS_OTHER | STRESS_IS_SECONDARY },
{ "isMaxStress", 0, CONDITION_IS_OTHER | STRESS_IS_PRIMARY },
{ "isPause2", 0, CONDITION_IS_OTHER | isBreak },
{ "isWordStart", 0, CONDITION_IS_OTHER | isWordStart },
@@ -260,10 +260,11 @@ static keywtab_t keywords[] = {
{ "InsertPhoneme", tINSTRN1, i_INSERT_PHONEME },
{ "AppendPhoneme", tINSTRN1, i_APPEND_PHONEME },
{ "IfNextVowelAppend", tINSTRN1, i_APPEND_IFNEXTVOWEL },
{ "ChangeIfDiminished", tINSTRN1, i_CHANGE_IF | isDiminished },
{ "ChangeIfUnstressed", tINSTRN1, i_CHANGE_IF | isUnstressed },
{ "ChangeIfNotStressed", tINSTRN1, i_CHANGE_IF | isNotStressed },
{ "ChangeIfStressed", tINSTRN1, i_CHANGE_IF | isStressed },
{ "ChangeIfDiminished", tINSTRN1, i_CHANGE_IF | STRESS_IS_DIMINISHED },
{ "ChangeIfUnstressed", tINSTRN1, i_CHANGE_IF | STRESS_IS_UNSTRESSED },
{ "ChangeIfNotStressed", tINSTRN1, i_CHANGE_IF | STRESS_IS_NOT_STRESSED },
{ "ChangeIfStressed", tINSTRN1, i_CHANGE_IF | STRESS_IS_SECONDARY },
{ "ChangeIfStressed", tINSTRN1, i_CHANGE_IF | STRESS_IS_PRIMARY },
{ "PauseBefore", tINSTRN1, i_PAUSE_BEFORE },
{ "PauseAfter", tINSTRN1, i_PAUSE_AFTER },
@@ -2045,10 +2046,11 @@ static int CompilePhoneme(int compile_phoneme)
case i_INSERT_PHONEME:
case i_REPLACE_NEXT_PHONEME:
case i_VOICING_SWITCH:
case i_CHANGE_IF | isDiminished:
case i_CHANGE_IF | isUnstressed:
case i_CHANGE_IF | isNotStressed:
case i_CHANGE_IF | isStressed:
case i_CHANGE_IF | STRESS_IS_DIMINISHED:
case i_CHANGE_IF | STRESS_IS_UNSTRESSED:
case i_CHANGE_IF | STRESS_IS_NOT_STRESSED:
case i_CHANGE_IF | STRESS_IS_SECONDARY:
case i_CHANGE_IF | STRESS_IS_PRIMARY:
value = NextItemBrackets(tPHONEMEMNEM, 0);
*prog_out++ = (keyword << 8) + value;
DecThenCount();