speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH 05/09] replace ESpellMode with SPDSpelling


From: Andrei Kholodnyi
Subject: [PATCH 05/09] replace ESpellMode with SPDSpelling
Date: Fri, 1 Oct 2010 23:51:00 +0200

both enums are identical, replace internal ESpellMode enum with
public SPDSpelling enum

moved SPDSpelling declaration from libspeechd.h to speechd_types.h
to make it available for internal modules
---
 include/spd_utils.h        |    4 ++--
 include/speechd_types.h    |   11 +++++------
 src/api/c/libspeechd.h     |    5 -----
 src/common/spd_conv.c      |   14 +++++++-------
 src/modules/festival.c     |    2 +-
 src/modules/ibmtts.c       |    2 +-
 src/modules/ivona.c        |    2 +-
 src/modules/module_utils.h |    4 ++--
 src/server/set.c           |    4 ++--
 src/server/set.h           |    6 +++---
 src/server/speechd.h       |    2 +-
 11 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/include/spd_utils.h b/include/spd_utils.h
index 80b0820..360f55f 100644
--- a/include/spd_utils.h
+++ b/include/spd_utils.h
@@ -34,8 +34,8 @@ char* spd_voice2str(EVoiceType voice);
 EVoiceType spd_str2voice(char* str);
 char* spd_punct2str(SPDPunctuation punct);
 SPDPunctuation spd_str2punct(char* str);
-char* spd_spell2str(ESpellMode spell);
-ESpellMode spd_str2spell(char* str);
+char* spd_spell2str(SPDSpelling spell);
+SPDSpelling spd_str2spell(char* str);
 char* spd_cap2str(SPDCapitalLetters recogn);
 SPDCapitalLetters spd_str2cap(char* str);
 int spd_str2prio(char* str);
diff --git a/include/speechd_types.h b/include/speechd_types.h
index 87e0690..6e24a75 100644
--- a/include/speechd_types.h
+++ b/include/speechd_types.h
@@ -35,6 +35,11 @@ typedef enum {
     SPD_CAP_ICON = 2
 } SPDCapitalLetters;
 
+typedef enum {
+    SPD_SPELL_OFF = 0,
+    SPD_SPELL_ON = 1
+} SPDSpelling;
+
 typedef enum
     {                  /* Type of voice */
        NO_VOICE = 0,
@@ -65,12 +70,6 @@ typedef enum
 
 typedef enum
     {
-       SPELLING_OFF = 0,
-       SPELLING_ON = 1
-    }ESpellMode;
-
-typedef enum
-    {
        NOTIFY_NOTHING = 0,
        NOTIFY_BEGIN = 1,
        NOTIFY_END = 2,
diff --git a/src/api/c/libspeechd.h b/src/api/c/libspeechd.h
index ac13097..d58003c 100644
--- a/src/api/c/libspeechd.h
+++ b/src/api/c/libspeechd.h
@@ -45,11 +45,6 @@ extern "C" {
 /* --------------------- Public data types ------------------------ */
 
 typedef enum{
-    SPD_SPELL_OFF = 0,
-    SPD_SPELL_ON = 1
-}SPDSpelling;
-
-typedef enum{
     SPD_DATA_TEXT = 0,
     SPD_DATA_SSML = 1
 }SPDDataMode;
diff --git a/src/common/spd_conv.c b/src/common/spd_conv.c
index 533257a..221e505 100644
--- a/src/common/spd_conv.c
+++ b/src/common/spd_conv.c
@@ -99,27 +99,27 @@ spd_str2punct(char* str)
 }
 
 char*
-spd_spell2str(ESpellMode spell)
+spd_spell2str(SPDSpelling spell)
 {
     char *str;
 
     switch (spell)
         {
-        case SPELLING_ON: str = strdup("on"); break;
-        case SPELLING_OFF: str = strdup("off"); break;
+        case SPD_SPELL_ON: str = strdup("on"); break;
+        case SPD_SPELL_OFF: str = strdup("off"); break;
         default: str = NULL;
         }
 
     return str;
 }
 
-ESpellMode
+SPDSpelling
 spd_str2spell(char* str)
 {
-    ESpellMode spell;
+    SPDSpelling spell;
 
-    if (!strcmp(str, "on")) spell = SPELLING_ON;
-    else if (!strcmp(str, "off")) spell = SPELLING_OFF;
+    if (!strcmp(str, "on")) spell = SPD_SPELL_ON;
+    else if (!strcmp(str, "off")) spell = SPD_SPELL_OFF;
     else spell = -1;
 
     return spell;
diff --git a/src/modules/festival.c b/src/modules/festival.c
index 55ee27c..a87d857 100644
--- a/src/modules/festival.c
+++ b/src/modules/festival.c
@@ -338,7 +338,7 @@ module_speak(char *data, size_t bytes, EMessageType msgtype)
     festival_stop_request = 0;
 
     festival_message_type = msgtype;
-    if ((msgtype == MSGTYPE_TEXT) && (msg_settings.spelling_mode == 
SPELLING_ON))
+    if ((msgtype == MSGTYPE_TEXT) && (msg_settings.spelling_mode == 
SPD_SPELL_ON))
         festival_message_type = MSGTYPE_SPELL;
 
 
diff --git a/src/modules/ibmtts.c b/src/modules/ibmtts.c
index 826e9f3..a374143 100644
--- a/src/modules/ibmtts.c
+++ b/src/modules/ibmtts.c
@@ -586,7 +586,7 @@ module_speak(gchar *data, size_t bytes, EMessageType 
msgtype)
        }
     
     ibmtts_message_type = msgtype;
-    if ((msgtype == MSGTYPE_TEXT) && (msg_settings.spelling_mode == 
SPELLING_ON))
+    if ((msgtype == MSGTYPE_TEXT) && (msg_settings.spelling_mode == 
SPD_SPELL_ON))
         ibmtts_message_type = MSGTYPE_SPELL;
        
     /* Setting speech parameters. */
diff --git a/src/modules/ivona.c b/src/modules/ivona.c
index 3e5c1fd..56e34d8 100644
--- a/src/modules/ivona.c
+++ b/src/modules/ivona.c
@@ -202,7 +202,7 @@ module_speak(gchar *data, size_t bytes, EMessageType 
msgtype)
     }
     *ivona_message = module_strip_ssml(data);
     ivona_message_type = msgtype;
-    if ((msgtype == MSGTYPE_TEXT) && (msg_settings.spelling_mode == 
SPELLING_ON))
+    if ((msgtype == MSGTYPE_TEXT) && (msg_settings.spelling_mode == 
SPD_SPELL_ON))
         ivona_message_type = MSGTYPE_SPELL;
     
        
diff --git a/src/modules/module_utils.h b/src/modules/module_utils.h
index 5d35f46..efba38a 100644
--- a/src/modules/module_utils.h
+++ b/src/modules/module_utils.h
@@ -53,7 +53,7 @@ typedef struct{
     signed int volume;
 
     SPDPunctuation punctuation_mode;
-    ESpellMode spelling_mode;
+    SPDSpelling spelling_mode;
     SPDCapitalLetters cap_let_recogn;
 
     char* language;
@@ -96,7 +96,7 @@ int module_num_dc_options;
  msg_settings.pitch = 0;\
  msg_settings.volume = 0;\
  msg_settings.punctuation_mode = SPD_PUNCT_NONE;\
- msg_settings.spelling_mode = SPELLING_OFF;\
+ msg_settings.spelling_mode = SPD_SPELL_OFF;\
  msg_settings.cap_let_recogn = SPD_CAP_NONE;\
  msg_settings.language = NULL;\
  msg_settings.voice = MALE1;\
diff --git a/src/server/set.c b/src/server/set.c
index caad20c..185b53c 100644
--- a/src/server/set.c
+++ b/src/server/set.c
@@ -197,10 +197,10 @@ set_capital_letter_recognition_uid(int uid, 
SPDCapitalLetters recogn)
 }
 
 
-SET_SELF_ALL(ESpellMode, spelling)
+SET_SELF_ALL(SPDSpelling, spelling)
 
 int
-set_spelling_uid(int uid, ESpellMode spelling)
+set_spelling_uid(int uid, SPDSpelling spelling)
 {
     TFDSetElement *settings;
 
diff --git a/src/server/set.h b/src/server/set.h
index d383eb8..e125eec 100644
--- a/src/server/set.h
+++ b/src/server/set.h
@@ -40,7 +40,7 @@ int set_pitch_uid(int uid, int pitch);
 int set_volume_uid(int uid, int volume);
 int set_punct_mode_uid(int uid, int punct);
 int set_cap_let_recog_uid(int uid, int recog);
-int set_spelling_uid(int uid, ESpellMode spelling);
+int set_spelling_uid(int uid, SPDSpelling spelling);
 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);
@@ -60,7 +60,7 @@ int set_pitch_self(int fd, int pitch);
 int set_volume_self(int fd, int volume);
 int set_punct_mode_self(int fd, int punct);
 int set_cap_let_recog_self(int fd, int recog);
-int set_spelling_self(int fd, ESpellMode spelling);
+int set_spelling_self(int fd, SPDSpelling spelling);
 int set_output_module_self(int fd, char *output_module);
 int set_client_name_self(int fd, char *client_name);
 int set_voice_self(int fd, char *voice);
@@ -80,7 +80,7 @@ int set_pitch_all(int pitch);
 int set_volume_all(int volume);
 int set_punct_mode_all(int punct);
 int set_cap_let_recog_all(int recog);
-int set_spelling_all(ESpellMode spelling);
+int set_spelling_all(SPDSpelling spelling);
 int set_output_module_all(char* output_module);
 int set_voice_all(char *voice);
 int set_synthesis_voice_all(char *synthesis_voice);
diff --git a/src/server/speechd.h b/src/server/speechd.h
index 9398a50..6bf3ca8 100644
--- a/src/server/speechd.h
+++ b/src/server/speechd.h
@@ -88,7 +88,7 @@ typedef struct{
                                    0   -       no punctuation
                                    1   -       all punctuation
                                    2   -       only user-selected punctuation 
*/
-    ESpellMode spelling_mode;   /* Spelling mode: 0 or 1 (0 - off, 1 - on) */
+    SPDSpelling spelling_mode;   /* Spelling mode: 0 or 1 (0 - off, 1 - on) */
     char *client_name;         /* Name of the client. */
     char *language;             /* Selected language name. (e.g. "en", "cz", 
"fr", ...) */
     char *output_module;        /* Output module name. (e.g. "festival", 
"flite", "apollo", ...) */
-- 
1.6.0.4




reply via email to

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