speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 04/09] replace ECapLetRecogn with SPDCapitalLetters


From: Andrei Kholodnyi
Subject: [PATCH 04/09] replace ECapLetRecogn with SPDCapitalLetters
Date: Fri, 1 Oct 2010 23:50:59 +0200

both enums are identical, replace internal ECapLetRecogn enum with
public SPDCapitalLetters enum

moved SPDCapitalLetters declaration from libspeechd.h to speechd_types.h
to make it available for internal modules
---
 include/spd_utils.h        |    4 ++--
 include/speechd_types.h    |   13 ++++++-------
 src/api/c/libspeechd.h     |    6 ------
 src/common/spd_conv.c      |   18 +++++++++---------
 src/modules/espeak.c       |   10 +++++-----
 src/modules/festival.c     |    6 +++---
 src/modules/ivona.c        |   10 +++++-----
 src/modules/module_utils.h |    4 ++--
 src/server/configuration.c |    4 ++--
 src/server/parse.c         |    6 +++---
 src/server/set.c           |    4 ++--
 src/server/set.h           |    6 +++---
 src/server/speechd.h       |    2 +-
 13 files changed, 43 insertions(+), 50 deletions(-)

diff --git a/include/spd_utils.h b/include/spd_utils.h
index 11bdc00..80b0820 100644
--- a/include/spd_utils.h
+++ b/include/spd_utils.h
@@ -36,7 +36,7 @@ char* spd_punct2str(SPDPunctuation punct);
 SPDPunctuation spd_str2punct(char* str);
 char* spd_spell2str(ESpellMode spell);
 ESpellMode spd_str2spell(char* str);
-char* spd_cap2str(ECapLetRecogn recogn);
-ECapLetRecogn spd_str2cap(char* str);
+char* spd_cap2str(SPDCapitalLetters recogn);
+SPDCapitalLetters spd_str2cap(char* str);
 int spd_str2prio(char* str);
 #endif /* SPD_UTILS_H */
diff --git a/include/speechd_types.h b/include/speechd_types.h
index a6786db..87e0690 100644
--- a/include/speechd_types.h
+++ b/include/speechd_types.h
@@ -29,6 +29,12 @@ typedef enum {
     SPD_PUNCT_SOME = 2
 } SPDPunctuation;
 
+typedef enum {
+    SPD_CAP_NONE = 0,
+    SPD_CAP_SPELL = 1,
+    SPD_CAP_ICON = 2
+} SPDCapitalLetters;
+
 typedef enum
     {                  /* Type of voice */
        NO_VOICE = 0,
@@ -59,13 +65,6 @@ typedef enum
 
 typedef enum
     {
-       RECOGN_NONE = 0,
-       RECOGN_SPELL = 1,
-       RECOGN_ICON = 2
-    }ECapLetRecogn;
-
-typedef enum
-    {
        SPELLING_OFF = 0,
        SPELLING_ON = 1
     }ESpellMode;
diff --git a/src/api/c/libspeechd.h b/src/api/c/libspeechd.h
index 1353377..ac13097 100644
--- a/src/api/c/libspeechd.h
+++ b/src/api/c/libspeechd.h
@@ -45,12 +45,6 @@ extern "C" {
 /* --------------------- Public data types ------------------------ */
 
 typedef enum{
-    SPD_CAP_NONE = 0,
-    SPD_CAP_SPELL = 1,
-    SPD_CAP_ICON = 2
-}SPDCapitalLetters;
-
-typedef enum{
     SPD_SPELL_OFF = 0,
     SPD_SPELL_ON = 1
 }SPDSpelling;
diff --git a/src/common/spd_conv.c b/src/common/spd_conv.c
index 4f516e6..533257a 100644
--- a/src/common/spd_conv.c
+++ b/src/common/spd_conv.c
@@ -126,29 +126,29 @@ spd_str2spell(char* str)
 }
 
 char*
-spd_cap2str(ECapLetRecogn recogn)
+spd_cap2str(SPDCapitalLetters recogn)
 {
     char *str;
 
     switch (recogn)
         {
-        case RECOGN_NONE: str = strdup("none"); break;
-        case RECOGN_SPELL: str = strdup("spell"); break;
-        case RECOGN_ICON: str = strdup("icon"); break;
+        case SPD_CAP_NONE: str = strdup("none"); break;
+        case SPD_CAP_SPELL: str = strdup("spell"); break;
+        case SPD_CAP_ICON: str = strdup("icon"); break;
         default: str = NULL;
         }
 
     return str;
 }
 
-ECapLetRecogn
+SPDCapitalLetters
 spd_str2cap(char* str)
 {
-    ECapLetRecogn recogn;
+    SPDCapitalLetters recogn;
 
-    if (!strcmp(str, "none")) recogn = RECOGN_NONE;
-    else if (!strcmp(str, "spell")) recogn = RECOGN_SPELL;
-    else if (!strcmp(str, "icon")) recogn = RECOGN_ICON;
+    if (!strcmp(str, "none")) recogn = SPD_CAP_NONE;
+    else if (!strcmp(str, "spell")) recogn = SPD_CAP_SPELL;
+    else if (!strcmp(str, "icon")) recogn = SPD_CAP_ICON;
     else recogn = -1;
 
     return recogn;
diff --git a/src/modules/espeak.c b/src/modules/espeak.c
index 7ff1a0f..11ff47f 100644
--- a/src/modules/espeak.c
+++ b/src/modules/espeak.c
@@ -158,7 +158,7 @@ static void espeak_set_rate(signed int rate);
 static void espeak_set_pitch(signed int pitch);
 static void espeak_set_volume(signed int volume);
 static void espeak_set_punctuation_mode(SPDPunctuation punct_mode);
-static void espeak_set_cap_let_recogn(ECapLetRecogn cap_mode);
+static void espeak_set_cap_let_recogn(SPDCapitalLetters cap_mode);
 
 #if 0
 static void espeak_set_pitch_range(signed int pitch_range);
@@ -686,17 +686,17 @@ espeak_set_punctuation_mode(SPDPunctuation punct_mode)
 }
 
 static void
-espeak_set_cap_let_recogn(ECapLetRecogn cap_mode)
+espeak_set_cap_let_recogn(SPDCapitalLetters cap_mode)
 {
        int espeak_cap_mode = 0;
        switch (cap_mode)  {
-       case RECOGN_NONE:
+       case SPD_CAP_NONE:
                espeak_cap_mode = EspeakCapitalPitchRise;
                break;
-       case RECOGN_SPELL:
+       case SPD_CAP_SPELL:
                espeak_cap_mode = 2;
                break;
-       case RECOGN_ICON:
+       case SPD_CAP_ICON:
                espeak_cap_mode = 1;
                break;
        }
diff --git a/src/modules/festival.c b/src/modules/festival.c
index 97b20af..55ee27c 100644
--- a/src/modules/festival.c
+++ b/src/modules/festival.c
@@ -142,7 +142,7 @@ void festival_set_voice(EVoiceType voice);
 void festival_set_synthesis_voice(char* synthesis_voice);
 void festival_set_language(char* language);
 void festival_set_punctuation_mode(SPDPunctuation punct);
-void festival_set_cap_let_recogn(ECapLetRecogn recogn);
+void festival_set_cap_let_recogn(SPDCapitalLetters recogn);
 void festival_set_volume(signed int volume);
 
 int init_festival_standalone();
@@ -844,11 +844,11 @@ festival_set_punctuation_mode(SPDPunctuation punct)
 }
 
 void
-festival_set_cap_let_recogn(ECapLetRecogn recogn)
+festival_set_cap_let_recogn(SPDCapitalLetters recogn)
 {
     char *recogn_mode;
 
-    if (recogn == RECOGN_NONE) recogn_mode = NULL;
+    if (recogn == SPD_CAP_NONE) recogn_mode = NULL;
     else recogn_mode = spd_cap2str(recogn);
     FestivalSetCapLetRecogn(festival_info, recogn_mode, NULL);
     g_free(recogn_mode);
diff --git a/src/modules/ivona.c b/src/modules/ivona.c
index bfdb463..3e5c1fd 100644
--- a/src/modules/ivona.c
+++ b/src/modules/ivona.c
@@ -68,7 +68,7 @@ static int ivona_get_msgpart(struct dumbtts_conf *conf, 
EMessageType type,
                      char *punct_some);
 static void ivona_set_volume(signed int volume);
 static void ivona_set_punctuation_mode(SPDPunctuation punct_mode);
-static void ivona_set_cap_let_recogn(ECapLetRecogn cap_mode);
+static void ivona_set_cap_let_recogn(SPDCapitalLetters cap_mode);
 
 static void* _ivona_speak(void*);
 
@@ -584,17 +584,17 @@ ivona_set_volume(signed int volume)
 }
 
 static void
-ivona_set_cap_let_recogn(ECapLetRecogn cap_mode)
+ivona_set_cap_let_recogn(SPDCapitalLetters cap_mode)
 {
        ivona_cap_mode = 0;
        switch (cap_mode)  {
-       case RECOGN_SPELL:
+       case SPD_CAP_SPELL:
                ivona_cap_mode = 2;
                break;
-       case RECOGN_ICON:
+       case SPD_CAP_ICON:
                ivona_cap_mode = 1;
                break;
-       case RECOGN_NONE:
+       case SPD_CAP_NONE:
                ivona_cap_mode = 0;
                break;
        }
diff --git a/src/modules/module_utils.h b/src/modules/module_utils.h
index 2a8a088..5d35f46 100644
--- a/src/modules/module_utils.h
+++ b/src/modules/module_utils.h
@@ -54,7 +54,7 @@ typedef struct{
 
     SPDPunctuation punctuation_mode;
     ESpellMode spelling_mode;
-    ECapLetRecogn cap_let_recogn;
+    SPDCapitalLetters cap_let_recogn;
 
     char* language;
 
@@ -97,7 +97,7 @@ int module_num_dc_options;
  msg_settings.volume = 0;\
  msg_settings.punctuation_mode = SPD_PUNCT_NONE;\
  msg_settings.spelling_mode = SPELLING_OFF;\
- msg_settings.cap_let_recogn = RECOGN_NONE;\
+ msg_settings.cap_let_recogn = SPD_CAP_NONE;\
  msg_settings.language = NULL;\
  msg_settings.voice = MALE1;\
  msg_settings.synthesis_voice = NULL;\
diff --git a/src/server/configuration.c b/src/server/configuration.c
index 980580a..a9ade25 100644
--- a/src/server/configuration.c
+++ b/src/server/configuration.c
@@ -190,7 +190,7 @@ GLOBAL_FDSET_OPTION_CB_INT(DefaultPauseContext, 
pause_context, 1, "")
 GLOBAL_FDSET_OPTION_CB_SPECIAL(DefaultPriority, priority, int, spd_str2prio)
 GLOBAL_FDSET_OPTION_CB_SPECIAL(DefaultVoiceType, voice, EVoiceType, 
spd_str2voice)
 GLOBAL_FDSET_OPTION_CB_SPECIAL(DefaultPunctuationMode, punctuation_mode, 
SPDPunctuation, spd_str2punct)
-GLOBAL_FDSET_OPTION_CB_SPECIAL(DefaultCapLetRecognition, cap_let_recogn, 
ECapLetRecogn, spd_str2cap)
+GLOBAL_FDSET_OPTION_CB_SPECIAL(DefaultCapLetRecognition, cap_let_recogn, 
SPDCapitalLetters, spd_str2cap)
 
 SPEECHD_OPTION_CB_STR_M(CommunicationMethod, communication_method)
 SPEECHD_OPTION_CB_STR_M(SocketPath, socket_path)
@@ -448,7 +448,7 @@ load_default_global_set_options()
     GlobalFDSet.language = g_strdup("en");
     GlobalFDSet.output_module = NULL;
     GlobalFDSet.voice = MALE1;
-    GlobalFDSet.cap_let_recogn = 0;
+    GlobalFDSet.cap_let_recogn = SPD_CAP_NONE;
     GlobalFDSet.min_delay_progress = 2000;
     GlobalFDSet.pause_context = 0;
     GlobalFDSet.ssml_mode = 0;
diff --git a/src/server/parse.c b/src/server/parse.c
index e89ac29..24c6594 100644
--- a/src/server/parse.c
+++ b/src/server/parse.c
@@ -549,9 +549,9 @@ parse_set(const char *buf, const int bytes, const int fd, 
const TSpeechDSock *sp
         NOT_ALLOWED_INSIDE_BLOCK();
         GET_PARAM_STR(recognition, 3, CONV_DOWN);
 
-        if(TEST_CMD(recognition, "none")) capital_letter_recognition = 
RECOGN_NONE;
-        else if(TEST_CMD(recognition, "spell")) capital_letter_recognition = 
RECOGN_SPELL;        
-        else if(TEST_CMD(recognition, "icon")) capital_letter_recognition = 
RECOGN_ICON;        
+        if(TEST_CMD(recognition, "none")) capital_letter_recognition = 
SPD_CAP_NONE;
+        else if(TEST_CMD(recognition, "spell")) capital_letter_recognition = 
SPD_CAP_SPELL;
+        else if(TEST_CMD(recognition, "icon")) capital_letter_recognition = 
SPD_CAP_ICON;
         else{
             g_free(recognition);
             return g_strdup(ERR_PARAMETER_INVALID);
diff --git a/src/server/set.c b/src/server/set.c
index ecb9327..caad20c 100644
--- a/src/server/set.c
+++ b/src/server/set.c
@@ -182,10 +182,10 @@ set_punctuation_mode_uid(int uid, SPDPunctuation 
punctuation)
      settings->name = set_param_str(settings->name, name);
 
 
-SET_SELF_ALL(ECapLetRecogn, capital_letter_recognition)
+SET_SELF_ALL(SPDCapitalLetters, capital_letter_recognition)
 
 int
-set_capital_letter_recognition_uid(int uid, ECapLetRecogn recogn)
+set_capital_letter_recognition_uid(int uid, SPDCapitalLetters recogn)
 {
     TFDSetElement *settings;
 
diff --git a/src/server/set.h b/src/server/set.h
index 1fbb45a..d383eb8 100644
--- a/src/server/set.h
+++ b/src/server/set.h
@@ -45,7 +45,7 @@ int set_output_module_self(int uid, char *output_module);
 int set_voice_uid(int uid, char *voice);
 int set_synthesis_voice_uid(int uid, char *synthesis_voice);
 int set_punctuation_mode_uid(int uid, SPDPunctuation punctuation);
-int set_capital_letter_recognition_uid(int uid, ECapLetRecogn recogn);
+int set_capital_letter_recognition_uid(int uid, SPDCapitalLetters recogn);
 int set_output_module_uid(int uid, char* output_module);
 int set_ssml_mode_uid(int uid, int ssml_mode);
 int set_pause_context_uid(int uid, int pause_context);
@@ -66,7 +66,7 @@ int set_client_name_self(int fd, char *client_name);
 int set_voice_self(int fd, char *voice);
 int set_synthesis_voice_self(int fd, char *synthesis_voice);
 int set_punctuation_mode_self(int fd, SPDPunctuation punctuation);
-int set_capital_letter_recognition_self(int fd, ECapLetRecogn recogn);
+int set_capital_letter_recognition_self(int fd, SPDCapitalLetters recogn);
 int set_ssml_mode_self(int fd, int ssml_mode);
 int set_notification_self(int fd, char *type, int val);
 int set_pause_context_self(int fd, int pause_context);
@@ -85,7 +85,7 @@ int set_output_module_all(char* output_module);
 int set_voice_all(char *voice);
 int set_synthesis_voice_all(char *synthesis_voice);
 int set_punctuation_mode_all(SPDPunctuation punctuation);
-int set_capital_letter_recognition_all(ECapLetRecogn recogn);
+int set_capital_letter_recognition_all(SPDCapitalLetters recogn);
 int set_ssml_mode_all(int ssml_mode);
 int set_pause_context_all(int pause_context);
 int set_debug_all(int debug);
diff --git a/src/server/speechd.h b/src/server/speechd.h
index cb094ee..9398a50 100644
--- a/src/server/speechd.h
+++ b/src/server/speechd.h
@@ -94,7 +94,7 @@ typedef struct{
     char *output_module;        /* Output module name. (e.g. "festival", 
"flite", "apollo", ...) */
     EVoiceType voice;           /* see EVoiceType definition above */
     char *synthesis_voice;
-    ECapLetRecogn cap_let_recogn;         /* Capital letters recognition: (0 - 
off, 1 - on) */
+    SPDCapitalLetters cap_let_recogn;         /* Capital letters recognition: 
(0 - off, 1 - on) */
 
     ENotification notification;        /* Notification about start and stop of 
messages, about reached
                                   index marks and state (canceled, paused, 
resumed). */
-- 
1.6.0.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]