[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/09] replace int ssml_mode with SPDDataMode
From: |
Andrei Kholodnyi |
Subject: |
[PATCH 09/09] replace int ssml_mode with SPDDataMode |
Date: |
Fri, 1 Oct 2010 23:51:04 +0200 |
replace internal int ssml_mode with
public SPDDataMode enum
moved SPDDataMode declaration from libspeechd.h to speechd_types.h
to make it available for internal modules
---
include/speechd_types.h | 5 +++++
src/api/c/libspeechd.h | 5 -----
src/clients/say/options.c | 2 +-
src/clients/say/options.h | 3 ++-
src/clients/say/say.c | 6 ++++--
src/server/configuration.c | 2 +-
src/server/index_marking.c | 18 +++++++++---------
src/server/index_marking.h | 4 ++--
src/server/set.c | 6 +++---
src/server/set.h | 6 +++---
src/server/speechd.h | 2 +-
11 files changed, 31 insertions(+), 28 deletions(-)
diff --git a/include/speechd_types.h b/include/speechd_types.h
index be2e074..84dcca8 100644
--- a/include/speechd_types.h
+++ b/include/speechd_types.h
@@ -59,6 +59,11 @@ typedef struct {
} SPDVoice;
typedef enum {
+ SPD_DATA_TEXT = 0,
+ SPD_DATA_SSML = 1
+} SPDDataMode;
+
+typedef enum {
SPD_NONE = 0,
SPD_BEGIN = 1,
SPD_END = 2,
diff --git a/src/api/c/libspeechd.h b/src/api/c/libspeechd.h
index e31ce2f..fe4e217 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_DATA_TEXT = 0,
- SPD_DATA_SSML = 1
-}SPDDataMode;
-
-typedef enum{
SPD_IMPORTANT = 1,
SPD_MESSAGE = 2,
SPD_TEXT = 3,
diff --git a/src/clients/say/options.c b/src/clients/say/options.c
index 3e140b2..66aa23e 100644
--- a/src/clients/say/options.c
+++ b/src/clients/say/options.c
@@ -169,7 +169,7 @@ options_parse(int argc, char *argv[])
OPT_SET_STR(priority);
break;
case 'x':
- ssml_mode = 1;
+ ssml_mode = SPD_DATA_SSML;
break;
case 'N':
OPT_SET_STR(application_name);
diff --git a/src/clients/say/options.h b/src/clients/say/options.h
index d9e6b4e..6e9c490 100644
--- a/src/clients/say/options.h
+++ b/src/clients/say/options.h
@@ -22,6 +22,7 @@
*/
#include <getopt.h>
+#include "speechd_types.h"
signed int rate;
signed int pitch;
@@ -33,7 +34,7 @@ char *voice_type;
char *punctuation_mode;
char *priority;
int pipe_mode;
-int ssml_mode;
+SPDDataMode ssml_mode;
int spelling;
int wait_till_end;
int stop_previous;
diff --git a/src/clients/say/say.c b/src/clients/say/say.c
index 64b4bd8..70cb540 100644
--- a/src/clients/say/say.c
+++ b/src/clients/say/say.c
@@ -33,7 +33,9 @@
#include <semaphore.h>
#include <errno.h>
#include <getopt.h>
+
#include "libspeechd.h"
+#include "speechd_types.h"
#include "options.h"
@@ -64,7 +66,7 @@ int main(int argc, char **argv) {
voice_type = NULL;
punctuation_mode = NULL;
spelling = -2;
- ssml_mode = 0;
+ ssml_mode = SPD_DATA_TEXT;
wait_till_end = 0;
stop_previous = 0;
cancel_previous = 0;
@@ -142,7 +144,7 @@ int main(int argc, char **argv) {
}
}
- if (ssml_mode)
+ if (ssml_mode == SPD_DATA_SSML)
if(spd_execute_command(conn, "SET SELF SSML_MODE ON"))
printf("Failed to set SSML mode.\n");
diff --git a/src/server/configuration.c b/src/server/configuration.c
index aed394e..c9dcbf5 100644
--- a/src/server/configuration.c
+++ b/src/server/configuration.c
@@ -451,7 +451,7 @@ load_default_global_set_options()
GlobalFDSet.cap_let_recogn = SPD_CAP_NONE;
GlobalFDSet.min_delay_progress = 2000;
GlobalFDSet.pause_context = 0;
- GlobalFDSet.ssml_mode = 0;
+ GlobalFDSet.ssml_mode = SPD_DATA_TEXT;
GlobalFDSet.notification = SPD_NONE;
#ifdef __SUNPRO_C
diff --git a/src/server/index_marking.c b/src/server/index_marking.c
index 584b7bb..94e17b0 100644
--- a/src/server/index_marking.c
+++ b/src/server/index_marking.c
@@ -30,7 +30,7 @@
#include "index_marking.h"
void
-insert_index_marks(TSpeechDMessage *msg, int ssml_mode)
+insert_index_marks(TSpeechDMessage *msg, SPDDataMode ssml_mode)
{
GString *marked_text;
char* pos;
@@ -48,7 +48,7 @@ insert_index_marks(TSpeechDMessage *msg, int ssml_mode)
MSG2(5, "index_marking", "MSG before index marking: |%s|, ssml_mode=%d",
msg->buf, ssml_mode);
- if (!ssml_mode) g_string_printf(marked_text, "<speak>");
+ if (ssml_mode == SPD_DATA_TEXT) g_string_printf(marked_text, "<speak>");
pos = msg->buf;
while(pos){
@@ -57,21 +57,21 @@ insert_index_marks(TSpeechDMessage *msg, int ssml_mode)
u_char = g_utf8_get_char(character);
if (u_char == '<'){
- if (ssml_mode){
+ if (ssml_mode == SPD_DATA_SSML){
inside_tag = 1;
g_string_append_printf(marked_text, "%s", character);
}
else g_string_append_printf(marked_text, "<");
}
else if (u_char == '>'){
- if (ssml_mode){
+ if (ssml_mode == SPD_DATA_SSML){
inside_tag = 0;
g_string_append_printf(marked_text, "%s", character);
}
else g_string_append_printf(marked_text, ">");
}
else if (u_char == '&'){
- if (ssml_mode){
+ if (ssml_mode == SPD_DATA_SSML){
g_string_append_printf(marked_text, "%s", character);
}
else{
@@ -105,7 +105,7 @@ insert_index_marks(TSpeechDMessage *msg, int ssml_mode)
pos = g_utf8_find_next_char(pos, NULL);
}
- if (!ssml_mode) g_string_append_printf(marked_text, "</speak>");
+ if (ssml_mode == SPD_DATA_TEXT) g_string_append_printf(marked_text,
"</speak>");
g_free(msg->buf);
msg->buf = marked_text->str;
@@ -140,7 +140,7 @@ find_index_mark(TSpeechDMessage *msg, int mark)
/* Deletes all index marks from the given text */
char*
-strip_index_marks(char *buf, int ssml_mode)
+strip_index_marks(char *buf, SPDDataMode ssml_mode)
{
GString *str;
char *strret;
@@ -150,7 +150,7 @@ strip_index_marks(char *buf, int ssml_mode)
char *p;
char *p_old;
- if (ssml_mode)
+ if (ssml_mode = SPD_DATA_SSML)
str = g_string_new("<speak>");
else
str = g_string_new("");
@@ -175,7 +175,7 @@ strip_index_marks(char *buf, int ssml_mode)
if (*p == '>') p++;
}
- if (!ssml_mode){
+ if (ssml_mode == SPD_DATA_TEXT){
p = strstr(str->str, "</speak>");
if (p != NULL) *p = 0;
}
diff --git a/src/server/index_marking.h b/src/server/index_marking.h
index 8033209..d670a1e 100644
--- a/src/server/index_marking.h
+++ b/src/server/index_marking.h
@@ -33,7 +33,7 @@
#define SD_MARK_TAIL "\"/>"
/* Insert index marks into a message. */
-void insert_index_marks(TSpeechDMessage *msg, int ssml_mode);
+void insert_index_marks(TSpeechDMessage *msg, SPDDataMode ssml_mode);
/* Find the index mark specified as _mark_ and return the
rest of the text after that index mark. */
@@ -41,6 +41,6 @@ char* find_index_mark(TSpeechDMessage *msg, int mark);
/* Delete all index marks from _buf_ and return a newly
allocated string. */
-char* strip_index_marks(char *buf, int ssml_mode);
+char* strip_index_marks(char *buf, SPDDataMode ssml_mode);
#endif /* INDEX_MARKING_H */
diff --git a/src/server/set.c b/src/server/set.c
index b114597..3bf0672 100644
--- a/src/server/set.c
+++ b/src/server/set.c
@@ -357,17 +357,17 @@ set_pause_context_uid(int uid, int pause_context)
return 0;
}
-SET_SELF_ALL(int, ssml_mode)
+SET_SELF_ALL(SPDDataMode, ssml_mode)
int
-set_ssml_mode_uid(int uid, int ssml_mode)
+set_ssml_mode_uid(int uid, SPDDataMode ssml_mode)
{
TFDSetElement *settings;
settings = get_client_settings_by_uid(uid);
if (settings == NULL) return 1;
- set_param_int(&settings->ssml_mode, ssml_mode);
+ settings->ssml_mode = ssml_mode;
return 0;
}
diff --git a/src/server/set.h b/src/server/set.h
index e125eec..e93aa1a 100644
--- a/src/server/set.h
+++ b/src/server/set.h
@@ -47,7 +47,7 @@ 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, SPDCapitalLetters recogn);
int set_output_module_uid(int uid, char* output_module);
-int set_ssml_mode_uid(int uid, int ssml_mode);
+int set_ssml_mode_uid(int uid, SPDDataMode ssml_mode);
int set_pause_context_uid(int uid, int pause_context);
int set_debug_uid(int uid, int debug);
int set_debug_destination_uid(int uid, char *debug_destination);
@@ -67,7 +67,7 @@ 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, SPDCapitalLetters recogn);
-int set_ssml_mode_self(int fd, int ssml_mode);
+int set_ssml_mode_self(int fd, SPDDataMode ssml_mode);
int set_notification_self(int fd, char *type, int val);
int set_pause_context_self(int fd, int pause_context);
int set_debug_self(int fd, int debug);
@@ -86,7 +86,7 @@ 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(SPDCapitalLetters recogn);
-int set_ssml_mode_all(int ssml_mode);
+int set_ssml_mode_all(SPDDataMode ssml_mode);
int set_pause_context_all(int pause_context);
int set_debug_all(int debug);
int set_debug_destination_all(char *debug_destination);
diff --git a/src/server/speechd.h b/src/server/speechd.h
index 4f55aff..4b63068 100644
--- a/src/server/speechd.h
+++ b/src/server/speechd.h
@@ -79,7 +79,7 @@ typedef struct{
int paused; /* Internal flag, 1 for paused client or 0 for
normal. */
int paused_while_speaking;
EMessageType type; /* Type of the message (1=text, 2=icon,
3=char, 4=key) */
- int ssml_mode; /* SSML mode on (1)/off (0) */
+ SPDDataMode ssml_mode; /* SSML mode on (1)/off (0) */
int priority; /* Priority between 1 and 3 (1 - highest, 3 -
lowest) */
signed int rate; /* Speed of voice from <-100;+100>, 0 is the
default */
signed int pitch; /* Pitch of voice from <-100;+100>, 0 is the
default */
--
1.6.0.4
- [PATCH 01/09] remove flite_set_voice, Andrei Kholodnyi, 2010/10/01
- [PATCH 02/09] replace ibmtts_voice_enum_to_str with spd_voice2str, Andrei Kholodnyi, 2010/10/01
- [PATCH 03/09] replace EPunctMode with SPDPunctuation, Andrei Kholodnyi, 2010/10/01
- [PATCH 04/09] replace ECapLetRecogn with SPDCapitalLetters, Andrei Kholodnyi, 2010/10/01
- [PATCH 05/09] replace ESpellMode with SPDSpelling, Andrei Kholodnyi, 2010/10/01
- [PATCH 06/09] replace EVoiceType with SPDVoiceType, Andrei Kholodnyi, 2010/10/01
- [PATCH 07/09] replace VoiceDescription with SPDVoice, Andrei Kholodnyi, 2010/10/01
- [PATCH 08/09] replace ENotification with SPDNotification, Andrei Kholodnyi, 2010/10/01
- [PATCH 09/09] replace int ssml_mode with SPDDataMode,
Andrei Kholodnyi <=
- [PATCH 03/09] replace EPunctMode with SPDPunctuation, William Hubbs, 2010/10/02
- [PATCH 03/09] replace EPunctMode with SPDPunctuation, Andrei Kholodnyi, 2010/10/02
- [PATCH 03/09] replace EPunctMode with SPDPunctuation, William Hubbs, 2010/10/03
- [PATCH 03/09] replace EPunctMode with SPDPunctuation, Andrei Kholodnyi, 2010/10/03
- question about speech-dispatcher and speakup in maverick, mike cutie and maia, 2010/10/03
- [orca-list] question about speech-dispatcher and speakup in maverick, Bill Cox, 2010/10/03
- [orca-list] question about speech-dispatcher and speakup in maverick, Willem van der Walt, 2010/10/04
- [PATCH 03/09] replace EPunctMode with SPDPunctuation, William Hubbs, 2010/10/03
- [PATCH 03/09] replace EPunctMode with SPDPunctuation, Andrei Kholodnyi, 2010/10/04
[PATCH 02/09] replace ibmtts_voice_enum_to_str with spd_voice2str, William Hubbs, 2010/10/02