speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH 6/7] replace ENotification with SPDNotification


From: Andrei Kholodnyi
Subject: [PATCH 6/7] replace ENotification with SPDNotification
Date: Sat, 23 Oct 2010 20:57:09 +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    |   31 ++++++++++++++++++++-----------
 src/api/c/libspeechd.h     |   20 --------------------
 src/server/configuration.c |    2 +-
 src/server/set.c           |    8 ++++----
 src/server/speaking.c      |   14 +++++++-------
 src/server/speechd.h       |    2 +-
 6 files changed, 33 insertions(+), 44 deletions(-)

diff --git a/include/speechd_types.h b/include/speechd_types.h
index 3adbdad..d44554a 100644
--- a/include/speechd_types.h
+++ b/include/speechd_types.h
@@ -58,6 +58,26 @@ typedef struct {
     char *variant;   /* a not-well defined string describing dialect etc. */
 } SPDVoice;
 
+typedef enum {
+    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_INDEX_MARK,
+    SPD_EVENT_CANCEL,
+    SPD_EVENT_PAUSE,
+    SPD_EVENT_RESUME
+}SPDNotificationType;
+
 typedef enum
     {
        SORT_BY_TIME = 0,
@@ -73,15 +93,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 c7eecf3..e31ce2f 100644
--- a/src/api/c/libspeechd.h
+++ b/src/api/c/libspeechd.h
@@ -50,17 +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,
-
-    SPD_ALL = 0x3F
-}SPDNotification;
-
-typedef enum{
     SPD_IMPORTANT = 1,
     SPD_MESSAGE = 2,
     SPD_TEXT = 3,
@@ -69,15 +58,6 @@ typedef enum{
 }SPDPriority;
 
 typedef enum{
-    SPD_EVENT_BEGIN,
-    SPD_EVENT_END,
-    SPD_EVENT_INDEX_MARK,
-    SPD_EVENT_CANCEL,
-    SPD_EVENT_PAUSE,
-    SPD_EVENT_RESUME
-}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 08b4b3d..017dfd3 100644
--- a/src/server/configuration.c
+++ b/src/server/configuration.c
@@ -453,7 +453,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 = 0;
 
 #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 f455f5a..1142f55 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




reply via email to

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