[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/09] replace ENotification with SPDNotification
From: |
Andrei Kholodnyi |
Subject: |
[PATCH 08/09] replace ENotification with SPDNotification |
Date: |
Fri, 1 Oct 2010 23:51:03 +0200 |
both enums are identical, replace internal ENotification enum with
public SPDNotification enum
moved SPDNotification declaration from libspeechd.h to speechd_types.h
to make it available for internal modules
moved SPDNotificationType declaration from libspeechd.h to speechd_types.h
---
include/speechd_types.h | 32 +++++++++++++++++++++-----------
src/api/c/libspeechd.h | 18 ------------------
src/server/configuration.c | 2 +-
src/server/set.c | 8 ++++----
src/server/speaking.c | 14 +++++++-------
src/server/speechd.h | 2 +-
6 files changed, 34 insertions(+), 42 deletions(-)
diff --git a/include/speechd_types.h b/include/speechd_types.h
index 3adbdad..be2e074 100644
--- a/include/speechd_types.h
+++ b/include/speechd_types.h
@@ -58,6 +58,27 @@ typedef struct {
char *variant; /* a not-well defined string describing dialect etc. */
} SPDVoice;
+typedef enum {
+ SPD_NONE = 0,
+ SPD_BEGIN = 1,
+ SPD_END = 2,
+ SPD_INDEX_MARKS = 4,
+ SPD_CANCEL = 8,
+ SPD_PAUSE = 16,
+ SPD_RESUME = 32,
+
+ SPD_ALL = 0x3f
+} SPDNotification;
+
+typedef enum {
+ SPD_EVENT_BEGIN,
+ SPD_EVENT_END,
+ SPD_EVENT_CANCEL,
+ SPD_EVENT_PAUSE,
+ SPD_EVENT_RESUME,
+ SPD_EVENT_INDEX_MARK
+} SPDNotificationType;
+
typedef enum
{
SORT_BY_TIME = 0,
@@ -73,15 +94,4 @@ typedef enum
MSGTYPE_SPELL = 99
}EMessageType;
-typedef enum
- {
- NOTIFY_NOTHING = 0,
- NOTIFY_BEGIN = 1,
- NOTIFY_END = 2,
- NOTIFY_IM = 4,
- NOTIFY_CANCEL = 8,
- NOTIFY_PAUSE = 16,
- NOTIFY_RESUME = 32
- }ENotification;
-
#endif /* not ifndef SPEECHD_TYPES */
diff --git a/src/api/c/libspeechd.h b/src/api/c/libspeechd.h
index eb7a04c..e31ce2f 100644
--- a/src/api/c/libspeechd.h
+++ b/src/api/c/libspeechd.h
@@ -50,15 +50,6 @@ typedef enum{
}SPDDataMode;
typedef enum{
- SPD_BEGIN = 1,
- SPD_END = 2,
- SPD_INDEX_MARKS = 4,
- SPD_CANCEL = 8,
- SPD_PAUSE = 16,
- SPD_RESUME = 32
-}SPDNotification;
-
-typedef enum{
SPD_IMPORTANT = 1,
SPD_MESSAGE = 2,
SPD_TEXT = 3,
@@ -67,15 +58,6 @@ typedef enum{
}SPDPriority;
typedef enum{
- SPD_EVENT_BEGIN,
- SPD_EVENT_END,
- SPD_EVENT_CANCEL,
- SPD_EVENT_PAUSE,
- SPD_EVENT_RESUME,
- SPD_EVENT_INDEX_MARK
-}SPDNotificationType;
-
-typedef enum{
SPD_MODE_SINGLE = 0,
SPD_MODE_THREADED = 1
}SPDConnectionMode;
diff --git a/src/server/configuration.c b/src/server/configuration.c
index 0a08beb..aed394e 100644
--- a/src/server/configuration.c
+++ b/src/server/configuration.c
@@ -452,7 +452,7 @@ load_default_global_set_options()
GlobalFDSet.min_delay_progress = 2000;
GlobalFDSet.pause_context = 0;
GlobalFDSet.ssml_mode = 0;
- GlobalFDSet.notification = NOTIFY_NOTHING;
+ GlobalFDSet.notification = SPD_NONE;
#ifdef __SUNPRO_C
/* Added by Willie Walker - default to OSS for Solaris */
diff --git a/src/server/set.c b/src/server/set.c
index 3d2df6f..b114597 100644
--- a/src/server/set.c
+++ b/src/server/set.c
@@ -408,9 +408,9 @@ set_debug_uid(int uid, int debug)
#define SET_NOTIFICATION_STATE(state) \
if (val) \
- settings->notification = settings->notification | NOTIFY_ ## state;
\
+ settings->notification = settings->notification | SPD_ ## state; \
else \
- settings->notification = settings->notification & (! NOTIFY_ ##
state);
+ settings->notification = settings->notification & (! SPD_ ## state);
int
set_notification_self(int fd, char *type, int val)
@@ -430,7 +430,7 @@ set_notification_self(int fd, char *type, int val)
}else if (!strcmp(type, "end")){
SET_NOTIFICATION_STATE(END);
}else if (!strcmp(type, "index_marks")){
- SET_NOTIFICATION_STATE(IM);
+ SET_NOTIFICATION_STATE(INDEX_MARKS);
}else if (!strcmp(type, "pause")){
SET_NOTIFICATION_STATE(PAUSE);
}else if (!strcmp(type, "resume")){
@@ -441,7 +441,7 @@ set_notification_self(int fd, char *type, int val)
{
SET_NOTIFICATION_STATE(END);
SET_NOTIFICATION_STATE(BEGIN);
- SET_NOTIFICATION_STATE(IM);
+ SET_NOTIFICATION_STATE(INDEX_MARKS);
SET_NOTIFICATION_STATE(CANCEL);
SET_NOTIFICATION_STATE(PAUSE);
SET_NOTIFICATION_STATE(RESUME);
diff --git a/src/server/speaking.c b/src/server/speaking.c
index 17a3ec9..5cf0083 100644
--- a/src/server/speaking.c
+++ b/src/server/speaking.c
@@ -627,23 +627,23 @@ is_sb_speaking(void)
if (!strcmp(index_mark, SD_MARK_BODY"begin")){
SPEAKING=1;
if (!settings->paused_while_speaking){
- if (settings->notification & NOTIFY_BEGIN)
+ if (settings->notification & SPD_BEGIN)
report_begin(current_message);
}else{
- if (settings->notification & NOTIFY_RESUME)
+ if (settings->notification & SPD_RESUME)
report_resume(current_message);
settings->paused_while_speaking = 0;
}
}else if (!strcmp(index_mark, SD_MARK_BODY"end")){
SPEAKING=0;
poll_count=1;
- if (settings->notification & NOTIFY_END)
+ if (settings->notification & SPD_END)
report_end(current_message);
speaking_semaphore_post();
}else if (!strcmp(index_mark, SD_MARK_BODY"paused")){
SPEAKING=0;
poll_count=1;
- if (settings->notification & NOTIFY_PAUSE)
+ if (settings->notification & SPD_PAUSE)
report_pause(current_message);
/* We don't want to free this message in speak() since we will
later copy it in resume() */
@@ -651,12 +651,12 @@ is_sb_speaking(void)
}else if (!strcmp(index_mark, SD_MARK_BODY"stopped")){
SPEAKING=0;
poll_count=1;
- if (settings->notification & NOTIFY_CANCEL)
+ if (settings->notification & SPD_CANCEL)
report_cancel(current_message);
speaking_semaphore_post();
}else if (index_mark != NULL){
if (strncmp(index_mark, SD_MARK_BODY, SD_MARK_BODY_LEN)){
- if (settings->notification & NOTIFY_IM)
+ if (settings->notification & SPD_INDEX_MARKS)
report_index_mark(current_message, index_mark);
}else{
MSG(5, "Setting current index_mark for the message to %s",
index_mark);
@@ -697,7 +697,7 @@ GList* queue_remove_message(GList *queue, GList *gl)
assert(gl != NULL);
assert(gl->data != NULL);
msg = (TSpeechDMessage*) gl->data;
- if (msg->settings.notification & NOTIFY_CANCEL)
+ if (msg->settings.notification & SPD_CANCEL)
report_cancel(msg);
mem_free_message(gl->data);
queue = g_list_delete_link(queue, gl);
diff --git a/src/server/speechd.h b/src/server/speechd.h
index d15a7f7..4f55aff 100644
--- a/src/server/speechd.h
+++ b/src/server/speechd.h
@@ -96,7 +96,7 @@ typedef struct{
char *synthesis_voice;
SPDCapitalLetters cap_let_recogn; /* Capital letters recognition:
(0 - off, 1 - on) */
- ENotification notification; /* Notification about start and stop of
messages, about reached
+ SPDNotification notification; /* Notification about start and stop of
messages, about reached
index marks and state (canceled, paused,
resumed). */
int reparted;
--
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 <=
- [PATCH 09/09] replace int ssml_mode with SPDDataMode, Andrei Kholodnyi, 2010/10/01
- [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