speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH] create a library of common routines


From: William Hubbs
Subject: [PATCH] create a library of common routines
Date: Mon, 2 Aug 2010 15:25:47 -0500

This moves intl/ to src/common and turns that directory into a library
of common routines

This means that we can place other routines in this library also which
are shared between the server and the modules.
---
 Makefile.am                   |    2 +-
 configure.in                  |    2 +-
 doc/speech-dispatcher.texi    |    8 +-
 intl/def.h                    |   34 ---------
 intl/fdset.h                  |  161 ----------------------------------------
 intl/fdsetconv.c              |  165 -----------------------------------------
 intl/fdsetconv.h              |   31 --------
 src/Makefile.am               |    4 +-
 src/audio/Makefile.am         |    2 +-
 src/c/api/Makefile.am         |    2 +-
 src/c/clients/say/Makefile.am |    2 +-
 src/common/Makefile.am        |    5 +
 src/common/def.h              |   34 +++++++++
 src/common/fdset.h            |  161 ++++++++++++++++++++++++++++++++++++++++
 src/common/fdsetconv.c        |  165 +++++++++++++++++++++++++++++++++++++++++
 src/common/fdsetconv.h        |   31 ++++++++
 src/modules/Makefile.am       |   20 +++---
 src/modules/module_utils.c    |    1 -
 src/server/Makefile.am        |    4 +-
 src/server/config.c           |    2 +-
 src/server/output.c           |    2 -
 src/server/server.c           |    2 +-
 src/tests/Makefile.am         |    2 +-
 23 files changed, 422 insertions(+), 420 deletions(-)
 delete mode 100644 intl/def.h
 delete mode 100644 intl/fdset.h
 delete mode 100644 intl/fdsetconv.c
 delete mode 100644 intl/fdsetconv.h
 create mode 100644 src/common/Makefile.am
 create mode 100644 src/common/def.h
 create mode 100644 src/common/fdset.h
 create mode 100644 src/common/fdsetconv.c
 create mode 100644 src/common/fdsetconv.h

diff --git a/Makefile.am b/Makefile.am
index 5353ce9..cdc79be 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,6 +2,6 @@
 
 SUBDIRS= src config doc
 
-EXTRA_DIST= ChangeLog NEWS TODO AUTHORS COPYING INSTALL README intl/*.c 
intl/*.h build.sh version.sh
+EXTRA_DIST= ChangeLog NEWS TODO AUTHORS COPYING INSTALL README build.sh 
version.sh
 
 MAINTAINERCLEANFILES=configure
diff --git a/configure.in b/configure.in
index fa0ce93..590a469 100644
--- a/configure.in
+++ b/configure.in
@@ -344,5 +344,5 @@ AC_SUBST(ERROR_CFLAGS)
 AC_SUBST(RPATH)
 AC_SUBST(RDYNAMIC)
 
-AC_OUTPUT([Makefile src/Makefile src/server/Makefile src/modules/Makefile 
src/c/Makefile src/c/api/Makefile src/c/clients/Makefile 
src/c/clients/say/Makefile src/c/clients/spdsend/Makefile src/tests/Makefile 
src/audio/Makefile config/Makefile config/modules/Makefile 
config/clients/Makefile doc/Makefile src/python/Makefile])
+AC_OUTPUT([Makefile src/Makefile src/common/Makefile src/server/Makefile 
src/modules/Makefile src/c/Makefile src/c/api/Makefile src/c/clients/Makefile 
src/c/clients/say/Makefile src/c/clients/spdsend/Makefile src/tests/Makefile 
src/audio/Makefile config/Makefile config/modules/Makefile 
config/clients/Makefile doc/Makefile src/python/Makefile])
 
diff --git a/doc/speech-dispatcher.texi b/doc/speech-dispatcher.texi
index ff609ca..4abf18c 100644
--- a/doc/speech-dispatcher.texi
+++ b/doc/speech-dispatcher.texi
@@ -2648,7 +2648,7 @@ corresponding SSIP commands, except that they are written 
with small
 letters. @xref{Top,,Parameter Setting Commands,ssip, SSIP
 Documentation}.  The conversion between these string values and the
 corresponding C enum variables can be easily done using
- at file{intl/fdsetconv.c}.
+ at file{src/common/fdsetconv.c}.
 
 Not all of these parameters must be set and the value of the string
 arguments can also be @code{NULL}. If some of the parameters aren't
@@ -2830,7 +2830,7 @@ in order for us to be in a better legal position against 
possible intruders.
 @node The Skeleton of an Output Module, Output Module Functions, How to Write 
New Output Module, Output Modules
 @subsection The Skeleton of an Output Module 
 
-Each output module should include @file{intl/fdset.h} where the
+Each output module should include @file{fdset.h} where the
 SPDMsgSettings structure is defined to be able to handle the different
 speech synthesis settings.
 
@@ -3057,7 +3057,7 @@ differently, if the synthesizer supports it).
 
 Each output module should take care of setting the output device to
 the parameters from msg_settings (defined in module_utils.h) (See
-SPDMsgSettings in @file{intl/fdset.h}). However, it is not an error if
+SPDMsgSettings in @file{src/common/fdset.h}). However, it is not an error if
 some of these values are ignored. At least rate, pitch and language
 should be set correctly.
 
@@ -3070,7 +3070,7 @@ the name of the language according to RFC 1776 (en, cs, 
fr, ...). If the
 requested language is not supported by this synthesizer, it's ok to abort
 and return 0, because that's an error in user settings.
 
-Other parameters are defined in @code{SPDMsgSettings} in @file{intl/fdset.h}.
+Other parameters are defined in @code{SPDMsgSettings} in 
@file{src/common/fdset.h}.
 
 An easy way to set the parameters is using the UPDATE_PARAMETER() and
 UPDATE_STRING_PARAMETER() macros. @xref{Module Utils Functions and
diff --git a/intl/def.h b/intl/def.h
deleted file mode 100644
index cffde7c..0000000
--- a/intl/def.h
+++ /dev/null
@@ -1,34 +0,0 @@
-
-/*
- * def.h - Some global definitions for Speech Dispatcher
- *
- * Copyright (C) 2001, 2002, 2003 Brailcom, o.p.s.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this package; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * $Id: def.h,v 1.19 2006-07-11 16:12:26 hanke Exp $
- */
-
-/* some constants common for speech server and client part */
-
-#ifndef SPEECHD_DEF_I
-       #define SPEECHD_DEF_I
-
-#define SPEECHD_DEFAULT_PORT 6560
-
-#define SPEECHD_DEBUG 0
-
-#endif
diff --git a/intl/fdset.h b/intl/fdset.h
deleted file mode 100644
index 8b337dc..0000000
--- a/intl/fdset.h
+++ /dev/null
@@ -1,161 +0,0 @@
-
-/*
- * fdset.h - Settings for Speech Dispatcher
- *
- * Copyright (C) 2001, 2002, 2003 Brailcom, o.p.s.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this package; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * $Id: fdset.h,v 1.33 2008-06-09 10:28:08 hanke Exp $
- */
-
-#ifndef FDSET_H
-#define FDSET_H
-
-typedef enum 
-    {                  /* Type of voice */
-       NO_VOICE = 0,
-       MALE1 = 1,
-       MALE2 = 2,
-       MALE3 = 3,
-       FEMALE1 = 4,
-       FEMALE2 = 5,
-       FEMALE3 = 6,
-       CHILD_MALE = 7,
-       CHILD_FEMALE = 8
-    }EVoiceType;
-
-typedef enum
-    {
-       SORT_BY_TIME = 0,
-       SORT_BY_ALPHABET = 1
-    }ESort;
-
-typedef enum
-    {
-       MSGTYPE_TEXT = 0,
-       MSGTYPE_SOUND_ICON = 1,
-       MSGTYPE_CHAR = 2,
-       MSGTYPE_KEY = 3,
-       MSGTYPE_SPELL = 99
-    }EMessageType;
-
-typedef enum
-    {
-       RECOGN_NONE = 0,
-       RECOGN_SPELL = 1,
-       RECOGN_ICON = 2
-    }ECapLetRecogn;
-
-typedef enum
-    {
-       PUNCT_NONE = 0,
-       PUNCT_ALL = 1,
-       PUNCT_SOME = 2
-    }EPunctMode;
-
-typedef enum
-    {
-       SPELLING_OFF = 0,
-       SPELLING_ON = 1
-    }ESpellMode;
-
-typedef enum
-    {
-       NOTIFY_NOTHING = 0,
-       NOTIFY_BEGIN = 1,
-       NOTIFY_END = 2,
-       NOTIFY_IM = 4,
-       NOTIFY_CANCEL = 8,
-       NOTIFY_PAUSE = 16,
-       NOTIFY_RESUME = 32
-    }ENotification;
-
-typedef struct {
-  char* name;
-  char* language;
-  char* dialect;
-}VoiceDescription;
-
-
-typedef struct{
-    unsigned int uid;          /* Unique ID of the client */
-    int fd;                     /* File descriptor the client is on. */
-    int active;                 /* Is this client still active on socket or 
gone?*/
-    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) */
-    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 */
-    signed int volume;         /* Volume of voice from <-100;+100), 0 is the 
default */
-    EPunctMode punctuation_mode;       /* Punctuation mode: 0, 1 or 2
-                                   0   -       no punctuation
-                                   1   -       all punctuation
-                                   2   -       only user-selected punctuation 
*/
-    ESpellMode 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", ...) */
-    EVoiceType voice;           /* see EVoiceType definition above */
-    char *synthesis_voice;
-    ECapLetRecogn 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). */
-
-    int reparted;
-    unsigned int min_delay_progress;
-    int pause_context;          /* Number of words that should be repeated 
after a pause */
-    char* index_mark;           /* Current index mark for the message (only if 
paused) */
-
-    char* audio_output_method;
-    char* audio_oss_device;
-    char* audio_alsa_device;
-    char* audio_nas_server;
-    char* audio_pulse_server;
-    int audio_pulse_min_length;
-    int log_level;
-
-    /* TODO: Should be moved out */
-    unsigned int hist_cur_uid;
-    int hist_cur_pos;
-    ESort hist_sorted;
-
-}TFDSetElement;
-
-typedef struct{
-    char *pattern;
-    TFDSetElement val;
-}TFDSetClientSpecific;
-
-typedef struct{
-    signed int rate;
-    signed int pitch;
-    signed int volume;
-    
-    EPunctMode punctuation_mode;
-    ESpellMode spelling_mode;
-    ECapLetRecogn cap_let_recogn;
-
-    char* language;
-
-    EVoiceType voice;
-    char *synthesis_voice;
-}SPDMsgSettings;
-
-#endif /* not ifndef FDSET */
diff --git a/intl/fdsetconv.c b/intl/fdsetconv.c
deleted file mode 100644
index e98d32c..0000000
--- a/intl/fdsetconv.c
+++ /dev/null
@@ -1,165 +0,0 @@
-
-/*
- * fdsetconv.c - Conversion of types for Speech Dispatcher
- *
- * Copyright (C) 2001, 2002, 2003 Brailcom, o.p.s.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this package; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * $Id: fdsetconv.c,v 1.5 2007-06-21 20:09:45 hanke Exp $
- */
-
-#include "fdsetconv.h"
-
-char*
-EVoice2str(EVoiceType voice)
-{
-    char *str;
-
-    switch (voice)
-        {
-        case MALE1: str = strdup("male1"); break;
-        case MALE2: str = strdup("male2"); break;
-        case MALE3: str = strdup("male3"); break;
-        case FEMALE1: str = strdup("female1"); break;
-        case FEMALE2: str = strdup("female2"); break;
-        case FEMALE3: str = strdup("female3"); break;
-        case CHILD_MALE: str = strdup("child_male"); break;
-        case CHILD_FEMALE: str = strdup("child_female"); break;
-        default: str = NULL;
-        }
-
-    return str;
-}
-
-EVoiceType
-str2EVoice(char* str)
-{
-    EVoiceType voice;
-
-    if (!strcmp(str, "male1")) voice = MALE1;
-    else if (!strcmp(str, "male2")) voice = MALE2;
-    else if (!strcmp(str, "male3")) voice = MALE3;
-    else if (!strcmp(str, "female1")) voice = FEMALE1;
-    else if (!strcmp(str, "female2")) voice = FEMALE2;
-    else if (!strcmp(str, "female3")) voice = FEMALE3;
-    else if (!strcmp(str, "child_male")) voice = CHILD_MALE;
-    else if (!strcmp(str, "child_female")) voice = CHILD_FEMALE;
-    else voice = NO_VOICE;
-
-    return voice;
-}
-
-char*
-EPunctMode2str(EPunctMode punct)
-{
-    char *str;
-
-    switch (punct)
-        {
-        case PUNCT_NONE: str = strdup("none"); break;
-        case PUNCT_ALL: str = strdup("all"); break;
-        case PUNCT_SOME: str = strdup("some"); break;
-        default: str = NULL;
-        }
-
-    return str;
-}
-
-EPunctMode
-str2EPunctMode(char* str)
-{
-    EPunctMode punct;
-
-    if (!strcmp(str, "none")) punct = PUNCT_NONE;
-    else if (!strcmp(str, "all")) punct = PUNCT_ALL;
-    else if (!strcmp(str, "some")) punct = PUNCT_SOME;
-    else punct = -1;
-
-    return punct;
-}
-
-char*
-ESpellMode2str(ESpellMode spell)
-{
-    char *str;
-
-    switch (spell)
-        {
-        case SPELLING_ON: str = strdup("on"); break;
-        case SPELLING_OFF: str = strdup("off"); break;
-        default: str = NULL;
-        }
-
-    return str;
-}
-
-ESpellMode
-str2ESpellMode(char* str)
-{
-    ESpellMode spell;
-
-    if (!strcmp(str, "on")) spell = SPELLING_ON;
-    else if (!strcmp(str, "off")) spell = SPELLING_OFF;
-    else spell = -1;
-
-    return spell;
-}
-
-char*
-ECapLetRecogn2str(ECapLetRecogn 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;
-        default: str = NULL;
-        }
-
-    return str;
-}
-
-ECapLetRecogn
-str2ECapLetRecogn(char* str)
-{
-    ECapLetRecogn recogn;
-
-    if (!strcmp(str, "none")) recogn = RECOGN_NONE;
-    else if (!strcmp(str, "spell")) recogn = RECOGN_SPELL;
-    else if (!strcmp(str, "icon")) recogn = RECOGN_ICON;
-    else recogn = -1;
-
-    return recogn;
-}
-
-
-EVoiceType
-str2intpriority(char* str)
-{
-    int priority;
-
-    if (!strcmp(str, "important"))  priority = 1;
-    else if (!strcmp(str, "text")) priority = 2;
-    else if (!strcmp(str, "message")) priority = 3;
-    else if (!strcmp(str, "notification")) priority = 4;
-    else if (!strcmp(str, "progress")) priority = 5;
-    else priority = -1;
-
-    return priority;
-}
diff --git a/intl/fdsetconv.h b/intl/fdsetconv.h
deleted file mode 100644
index 240ca27..0000000
--- a/intl/fdsetconv.h
+++ /dev/null
@@ -1,31 +0,0 @@
-
-#include "fdset.h"
-
-#ifndef FDSETCONV_H
-#define FDSETCONV_H
-
-#include <stdio.h>
-#include <string.h>
-#include "fdset.h"
-
-char* EVoice2str(EVoiceType voice);
-
-EVoiceType str2EVoice(char* str);
-
-char* EPunctMode2str(EPunctMode punct);
-
-EPunctMode str2EPunctMode(char* str);
-
-char* ESpellMode2str(ESpellMode spell);
-
-ESpellMode str2ESpellMode(char* str);
-
-char* ECapLetRecogn2str(ECapLetRecogn recogn);
-
-ECapLetRecogn ECapLetRecognstr2ECapLetRecogn(char* str);
-
-EVoiceType str2intpriority(char* str);
-
-ECapLetRecogn str2ECapLetRecogn(char* str);
-
-#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index 666b92a..2dee049 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -10,7 +10,7 @@ python/*.py python/speechd/*.py python/Makefile.in 
python/speechd_config/*.py \
 python/speechd_config/spd-conf python/speechd_config/test.wav \
 python/speechd_config/speechd.desktop
 
-SUBDIRS=server audio c modules tests python
-DIST_SUBDIRS=server audio c modules tests python
+SUBDIRS=common server audio c modules tests python
+DIST_SUBDIRS=common server audio c modules tests python
 
 
diff --git a/src/audio/Makefile.am b/src/audio/Makefile.am
index 3b596f6..fad3711 100644
--- a/src/audio/Makefile.am
+++ b/src/audio/Makefile.am
@@ -1,6 +1,6 @@
 
 localedir = $(datadir)/locale
-inc_local = "-I$(top_srcdir)/intl/"
+inc_local = "-I$(top_srcdir)/src/common/"
 
 am_cflags = -DLOCALEDIR=\"$(localedir)\" -I/usr/include/ $(inc_local) 
@glib_include@
 
diff --git a/src/c/api/Makefile.am b/src/c/api/Makefile.am
index d8a1cbd..ab8cd23 100644
--- a/src/c/api/Makefile.am
+++ b/src/c/api/Makefile.am
@@ -1,6 +1,6 @@
 
 localedir = $(datadir)/locale
-inc_local = "-I$(top_srcdir)/intl/"
+inc_local = "-I$(top_srcdir)/src/common/"
 
 AM_CFLAGS = @ERROR_CFLAGS@ -DLOCALEDIR=\"$(localedir)\" -D_GNU_SOURCE 
-I/usr/include/ $(inc_local) @glib_include@ 
-DSPD_SPAWN_CMD=\""@prefix@/bin/speech-dispatcher"\"
 
diff --git a/src/c/clients/say/Makefile.am b/src/c/clients/say/Makefile.am
index 69ef570..47ee037 100644
--- a/src/c/clients/say/Makefile.am
+++ b/src/c/clients/say/Makefile.am
@@ -1,6 +1,6 @@
 
 localedir = $(datadir)/locale
-inc_local = "-I$(top_srcdir)/intl/"
+inc_local = "-I$(top_srcdir)/src/common/"
 c_api = $(top_srcdir)/src/c/api
 
 AM_CFLAGS = -DLOCALEDIR=\"$(localedir)\" -I/usr/include/ $(inc_local) 
@glib_include@ -I$(c_api)
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
new file mode 100644
index 0000000..a206efc
--- /dev/null
+++ b/src/common/Makefile.am
@@ -0,0 +1,5 @@
+## Process this file with automake to produce Makefile.in
+
+noinst_LTLIBRARIES = libcommon.la
+libcommon_la_CFLAGS = @ERROR_CFLAGS@
+libcommon_la_SOURCES = def.h fdset.h fdsetconv.c fdsetconv.h
diff --git a/src/common/def.h b/src/common/def.h
new file mode 100644
index 0000000..cffde7c
--- /dev/null
+++ b/src/common/def.h
@@ -0,0 +1,34 @@
+
+/*
+ * def.h - Some global definitions for Speech Dispatcher
+ *
+ * Copyright (C) 2001, 2002, 2003 Brailcom, o.p.s.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this package; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $Id: def.h,v 1.19 2006-07-11 16:12:26 hanke Exp $
+ */
+
+/* some constants common for speech server and client part */
+
+#ifndef SPEECHD_DEF_I
+       #define SPEECHD_DEF_I
+
+#define SPEECHD_DEFAULT_PORT 6560
+
+#define SPEECHD_DEBUG 0
+
+#endif
diff --git a/src/common/fdset.h b/src/common/fdset.h
new file mode 100644
index 0000000..8b337dc
--- /dev/null
+++ b/src/common/fdset.h
@@ -0,0 +1,161 @@
+
+/*
+ * fdset.h - Settings for Speech Dispatcher
+ *
+ * Copyright (C) 2001, 2002, 2003 Brailcom, o.p.s.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this package; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $Id: fdset.h,v 1.33 2008-06-09 10:28:08 hanke Exp $
+ */
+
+#ifndef FDSET_H
+#define FDSET_H
+
+typedef enum 
+    {                  /* Type of voice */
+       NO_VOICE = 0,
+       MALE1 = 1,
+       MALE2 = 2,
+       MALE3 = 3,
+       FEMALE1 = 4,
+       FEMALE2 = 5,
+       FEMALE3 = 6,
+       CHILD_MALE = 7,
+       CHILD_FEMALE = 8
+    }EVoiceType;
+
+typedef enum
+    {
+       SORT_BY_TIME = 0,
+       SORT_BY_ALPHABET = 1
+    }ESort;
+
+typedef enum
+    {
+       MSGTYPE_TEXT = 0,
+       MSGTYPE_SOUND_ICON = 1,
+       MSGTYPE_CHAR = 2,
+       MSGTYPE_KEY = 3,
+       MSGTYPE_SPELL = 99
+    }EMessageType;
+
+typedef enum
+    {
+       RECOGN_NONE = 0,
+       RECOGN_SPELL = 1,
+       RECOGN_ICON = 2
+    }ECapLetRecogn;
+
+typedef enum
+    {
+       PUNCT_NONE = 0,
+       PUNCT_ALL = 1,
+       PUNCT_SOME = 2
+    }EPunctMode;
+
+typedef enum
+    {
+       SPELLING_OFF = 0,
+       SPELLING_ON = 1
+    }ESpellMode;
+
+typedef enum
+    {
+       NOTIFY_NOTHING = 0,
+       NOTIFY_BEGIN = 1,
+       NOTIFY_END = 2,
+       NOTIFY_IM = 4,
+       NOTIFY_CANCEL = 8,
+       NOTIFY_PAUSE = 16,
+       NOTIFY_RESUME = 32
+    }ENotification;
+
+typedef struct {
+  char* name;
+  char* language;
+  char* dialect;
+}VoiceDescription;
+
+
+typedef struct{
+    unsigned int uid;          /* Unique ID of the client */
+    int fd;                     /* File descriptor the client is on. */
+    int active;                 /* Is this client still active on socket or 
gone?*/
+    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) */
+    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 */
+    signed int volume;         /* Volume of voice from <-100;+100), 0 is the 
default */
+    EPunctMode punctuation_mode;       /* Punctuation mode: 0, 1 or 2
+                                   0   -       no punctuation
+                                   1   -       all punctuation
+                                   2   -       only user-selected punctuation 
*/
+    ESpellMode 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", ...) */
+    EVoiceType voice;           /* see EVoiceType definition above */
+    char *synthesis_voice;
+    ECapLetRecogn 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). */
+
+    int reparted;
+    unsigned int min_delay_progress;
+    int pause_context;          /* Number of words that should be repeated 
after a pause */
+    char* index_mark;           /* Current index mark for the message (only if 
paused) */
+
+    char* audio_output_method;
+    char* audio_oss_device;
+    char* audio_alsa_device;
+    char* audio_nas_server;
+    char* audio_pulse_server;
+    int audio_pulse_min_length;
+    int log_level;
+
+    /* TODO: Should be moved out */
+    unsigned int hist_cur_uid;
+    int hist_cur_pos;
+    ESort hist_sorted;
+
+}TFDSetElement;
+
+typedef struct{
+    char *pattern;
+    TFDSetElement val;
+}TFDSetClientSpecific;
+
+typedef struct{
+    signed int rate;
+    signed int pitch;
+    signed int volume;
+    
+    EPunctMode punctuation_mode;
+    ESpellMode spelling_mode;
+    ECapLetRecogn cap_let_recogn;
+
+    char* language;
+
+    EVoiceType voice;
+    char *synthesis_voice;
+}SPDMsgSettings;
+
+#endif /* not ifndef FDSET */
diff --git a/src/common/fdsetconv.c b/src/common/fdsetconv.c
new file mode 100644
index 0000000..e98d32c
--- /dev/null
+++ b/src/common/fdsetconv.c
@@ -0,0 +1,165 @@
+
+/*
+ * fdsetconv.c - Conversion of types for Speech Dispatcher
+ *
+ * Copyright (C) 2001, 2002, 2003 Brailcom, o.p.s.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this package; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $Id: fdsetconv.c,v 1.5 2007-06-21 20:09:45 hanke Exp $
+ */
+
+#include "fdsetconv.h"
+
+char*
+EVoice2str(EVoiceType voice)
+{
+    char *str;
+
+    switch (voice)
+        {
+        case MALE1: str = strdup("male1"); break;
+        case MALE2: str = strdup("male2"); break;
+        case MALE3: str = strdup("male3"); break;
+        case FEMALE1: str = strdup("female1"); break;
+        case FEMALE2: str = strdup("female2"); break;
+        case FEMALE3: str = strdup("female3"); break;
+        case CHILD_MALE: str = strdup("child_male"); break;
+        case CHILD_FEMALE: str = strdup("child_female"); break;
+        default: str = NULL;
+        }
+
+    return str;
+}
+
+EVoiceType
+str2EVoice(char* str)
+{
+    EVoiceType voice;
+
+    if (!strcmp(str, "male1")) voice = MALE1;
+    else if (!strcmp(str, "male2")) voice = MALE2;
+    else if (!strcmp(str, "male3")) voice = MALE3;
+    else if (!strcmp(str, "female1")) voice = FEMALE1;
+    else if (!strcmp(str, "female2")) voice = FEMALE2;
+    else if (!strcmp(str, "female3")) voice = FEMALE3;
+    else if (!strcmp(str, "child_male")) voice = CHILD_MALE;
+    else if (!strcmp(str, "child_female")) voice = CHILD_FEMALE;
+    else voice = NO_VOICE;
+
+    return voice;
+}
+
+char*
+EPunctMode2str(EPunctMode punct)
+{
+    char *str;
+
+    switch (punct)
+        {
+        case PUNCT_NONE: str = strdup("none"); break;
+        case PUNCT_ALL: str = strdup("all"); break;
+        case PUNCT_SOME: str = strdup("some"); break;
+        default: str = NULL;
+        }
+
+    return str;
+}
+
+EPunctMode
+str2EPunctMode(char* str)
+{
+    EPunctMode punct;
+
+    if (!strcmp(str, "none")) punct = PUNCT_NONE;
+    else if (!strcmp(str, "all")) punct = PUNCT_ALL;
+    else if (!strcmp(str, "some")) punct = PUNCT_SOME;
+    else punct = -1;
+
+    return punct;
+}
+
+char*
+ESpellMode2str(ESpellMode spell)
+{
+    char *str;
+
+    switch (spell)
+        {
+        case SPELLING_ON: str = strdup("on"); break;
+        case SPELLING_OFF: str = strdup("off"); break;
+        default: str = NULL;
+        }
+
+    return str;
+}
+
+ESpellMode
+str2ESpellMode(char* str)
+{
+    ESpellMode spell;
+
+    if (!strcmp(str, "on")) spell = SPELLING_ON;
+    else if (!strcmp(str, "off")) spell = SPELLING_OFF;
+    else spell = -1;
+
+    return spell;
+}
+
+char*
+ECapLetRecogn2str(ECapLetRecogn 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;
+        default: str = NULL;
+        }
+
+    return str;
+}
+
+ECapLetRecogn
+str2ECapLetRecogn(char* str)
+{
+    ECapLetRecogn recogn;
+
+    if (!strcmp(str, "none")) recogn = RECOGN_NONE;
+    else if (!strcmp(str, "spell")) recogn = RECOGN_SPELL;
+    else if (!strcmp(str, "icon")) recogn = RECOGN_ICON;
+    else recogn = -1;
+
+    return recogn;
+}
+
+
+EVoiceType
+str2intpriority(char* str)
+{
+    int priority;
+
+    if (!strcmp(str, "important"))  priority = 1;
+    else if (!strcmp(str, "text")) priority = 2;
+    else if (!strcmp(str, "message")) priority = 3;
+    else if (!strcmp(str, "notification")) priority = 4;
+    else if (!strcmp(str, "progress")) priority = 5;
+    else priority = -1;
+
+    return priority;
+}
diff --git a/src/common/fdsetconv.h b/src/common/fdsetconv.h
new file mode 100644
index 0000000..240ca27
--- /dev/null
+++ b/src/common/fdsetconv.h
@@ -0,0 +1,31 @@
+
+#include "fdset.h"
+
+#ifndef FDSETCONV_H
+#define FDSETCONV_H
+
+#include <stdio.h>
+#include <string.h>
+#include "fdset.h"
+
+char* EVoice2str(EVoiceType voice);
+
+EVoiceType str2EVoice(char* str);
+
+char* EPunctMode2str(EPunctMode punct);
+
+EPunctMode str2EPunctMode(char* str);
+
+char* ESpellMode2str(ESpellMode spell);
+
+ESpellMode str2ESpellMode(char* str);
+
+char* ECapLetRecogn2str(ECapLetRecogn recogn);
+
+ECapLetRecogn ECapLetRecognstr2ECapLetRecogn(char* str);
+
+EVoiceType str2intpriority(char* str);
+
+ECapLetRecogn str2ECapLetRecogn(char* str);
+
+#endif
diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am
index 4d68489..08b8d89 100644
--- a/src/modules/Makefile.am
+++ b/src/modules/Makefile.am
@@ -1,12 +1,12 @@
 localedir = $(datadir)/locale
-inc_local = "-I$(top_srcdir)/intl/"
+inc_local = "-I$(top_srcdir)/src/common/"
 
 SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
 SNDFILE_LIBS = @SNDFILE_LIBS@
 
 EXTRA_DIST = module_main.c module_utils_addvoice.c festival_client.c 
festival_client.h ivona_client.c dummy.c dummy-message.wav
 
-AM_CFLAGS = @ERROR_CFLAGS@ -DLOCALEDIR=\"$(localedir)\" 
-DDATADIR=\"$(snddatadir)\" -I/usr/include/ $(inc_local) @glib_include@ 
-L$(top_srcdir)/src/audio -I$(top_srcdir)/src/audio -I../../intl/ 
$(ibmtts_include) @SNDFILE_CFLAGS@ -D_GNU_SOURCE
+AM_CFLAGS = @ERROR_CFLAGS@ -DLOCALEDIR=\"$(localedir)\" 
-DDATADIR=\"$(snddatadir)\" -I/usr/include/ $(inc_local) @glib_include@ 
-L$(top_srcdir)/src/audio -I$(top_srcdir)/src/audio -I$(top_srcdir)/src/common/ 
$(ibmtts_include) @SNDFILE_CFLAGS@ -D_GNU_SOURCE
 
 modulebin_PROGRAMS = sd_dummy sd_generic sd_festival sd_cicero
 
@@ -30,30 +30,30 @@ endif
 
 sd_flite_SOURCES = flite.c module_utils.c module_utils.h
 sd_flite_LDFLAGS = @RPATH@ '$(spdlibdir)'
-sd_flite_LDADD = -lsdaudio $(flite_kal) $(flite_basic) -lpthread -ldotconf 
@glib_libs@ @gthread_libs@
+sd_flite_LDADD = $(top_builddir)/src/common/libcommon.la -lsdaudio 
$(flite_kal) $(flite_basic) -lpthread -ldotconf @glib_libs@ @gthread_libs@
 
 sd_generic_SOURCES = generic.c module_utils.c module_utils.h
-sd_generic_LDADD = -lsdaudio -lpthread -ldotconf @glib_libs@ @gthread_libs@
+sd_generic_LDADD = $(top_builddir)/src/common/libcommon.la -lsdaudio -lpthread 
-ldotconf @glib_libs@ @gthread_libs@
 
 sd_festival_SOURCES = festival.c module_utils.c
 sd_festival_LDFLAGS = @RPATH@ '$(spdlibdir)'
-sd_festival_LDADD = -lsdaudio -lpthread -ldotconf @glib_libs@ @gthread_libs@ 
@EXTRA_SOCKET_LIBS@
+sd_festival_LDADD = $(top_builddir)/src/common/libcommon.la -lsdaudio 
-lpthread -ldotconf @glib_libs@ @gthread_libs@ @EXTRA_SOCKET_LIBS@
 
 sd_ibmtts_SOURCES = ibmtts.c module_utils.c module_utils.h
 sd_ibmtts_LDFLAGS = @RPATH@ '$(spdlibdir)'
-sd_ibmtts_LDADD = -lsdaudio -lm -lpthread -ldotconf -libmeci @SNDFILE_LIBS@ 
@glib_libs@ @gthread_libs@
+sd_ibmtts_LDADD = $(top_builddir)/src/common/libcommon.la -lsdaudio -lm 
-lpthread -ldotconf -libmeci @SNDFILE_LIBS@ @glib_libs@ @gthread_libs@
 
 sd_cicero_SOURCES = cicero.c module_utils.c module_utils.h
-sd_cicero_LDADD = -lsdaudio -lpthread -ldotconf @glib_libs@ @gthread_libs@
+sd_cicero_LDADD = $(top_builddir)/src/common/libcommon.la -lsdaudio -lpthread 
-ldotconf @glib_libs@ @gthread_libs@
 
 sd_espeak_SOURCES = espeak.c module_utils.c module_utils.h
 sd_espeak_LDFLAGS = @RPATH@ '$(spdlibdir)'
-sd_espeak_LDADD = -lsdaudio -lespeak -ldotconf @glib_libs@ @SNDFILE_LIBS@ 
@gthread_libs@ @EXTRA_ESPEAK_LIBS@
+sd_espeak_LDADD = $(top_builddir)/src/common/libcommon.la -lsdaudio -lespeak 
-ldotconf @glib_libs@ @SNDFILE_LIBS@ @gthread_libs@ @EXTRA_ESPEAK_LIBS@
 
 sd_ivona_SOURCES = ivona.c module_utils.c module_utils.h
 sd_ivona_LDFLAGS = @RPATH@ '$(spdlibdir)'
-sd_ivona_LDADD = -lsdaudio -ldumbtts -lpthread -ldotconf @glib_libs@ 
@SNDFILE_LIBS@ @gthread_libs@
+sd_ivona_LDADD = $(top_builddir)/src/common/libcommon.la -lsdaudio -ldumbtts 
-lpthread -ldotconf @glib_libs@ @SNDFILE_LIBS@ @gthread_libs@
 
 sd_dummy_SOURCES = dummy.c module_utils.c module_utils.h
 sd_dummy_LDFLAGS = @RPATH@ '$(spdlibdir)'
-sd_dummy_LDADD = -lsdaudio -lpthread -ldotconf @glib_libs@ @SNDFILE_LIBS@ 
@gthread_libs@
+sd_dummy_LDADD = $(top_builddir)/src/common/libcommon.la -lsdaudio -lpthread 
-ldotconf @glib_libs@ @SNDFILE_LIBS@ @gthread_libs@
diff --git a/src/modules/module_utils.c b/src/modules/module_utils.c
index 91be0a8..befe307 100644
--- a/src/modules/module_utils.c
+++ b/src/modules/module_utils.c
@@ -22,7 +22,6 @@
  */
 
 #include "fdsetconv.h"
-#include "fdsetconv.c"
 
 #include "module_utils.h"
 
diff --git a/src/server/Makefile.am b/src/server/Makefile.am
index 2f54450..107648b 100644
--- a/src/server/Makefile.am
+++ b/src/server/Makefile.am
@@ -2,9 +2,9 @@
 bin_PROGRAMS = speech-dispatcher
 speech_dispatcher_SOURCES = speechd.c speechd.h server.c server.h history.c 
history.h module.c module.h config.c config.h parse.c parse.h set.c set.h msg.h 
alloc.c alloc.h compare.c compare.h speaking.c speaking.h options.c options.h 
output.c output.h sem_functions.c sem_functions.h index_marking.c 
index_marking.h
 
-speech_dispatcher_LDADD = -ldotconf -lglib-2.0 -lgmodule-2.0 @glib_libs@ 
@gthread_libs@ -lpthread @EXTRA_SOCKET_LIBS@
+speech_dispatcher_LDADD=$(top_builddir)/src/common/libcommon.la -ldotconf 
-lglib-2.0 -lgmodule-2.0 @glib_libs@ @gthread_libs@ -lpthread 
@EXTRA_SOCKET_LIBS@
 speech_dispatcher_LDFLAGS = @RDYNAMIC@
 
-inc_local = -I$(top_srcdir)/intl/
+inc_local = -I$(top_srcdir)/src/common/
 localedir = $(datadir)/locale
 AM_CFLAGS = @ERROR_CFLAGS@ $(inc_local) -I$(localedir) @glib_include@ 
-DSYS_CONF=\"@address@hidden" -DSND_DATA=\"@address@hidden" 
-DMODULEBINDIR=\"@address@hidden"  -DVERSION=\"@address@hidden" 
-DPACKAGE=\"@address@hidden"
diff --git a/src/server/config.c b/src/server/config.c
index 66cfa96..7211d13 100644
--- a/src/server/config.c
+++ b/src/server/config.c
@@ -26,7 +26,7 @@
 
 #include "speechd.h"
 #include "config.h"
-#include "intl/fdsetconv.h"
+#include <fdsetconv.h>
 
 static TFDSetClientSpecific *cl_spec_section;
 
diff --git a/src/server/output.c b/src/server/output.c
index fa5ba94..901756a 100644
--- a/src/server/output.c
+++ b/src/server/output.c
@@ -22,8 +22,6 @@
  */
 
 #include "output.h"
-
-#include "fdsetconv.c"
 #include "parse.h"
 
 #ifdef TEMP_FAILURE_RETRY      /* GNU libc */
diff --git a/src/server/server.c b/src/server/server.c
index 6b82473..42ab9c8 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -40,7 +40,7 @@ int last_message_id = 0;
  *          case it means we are reloading the message and the
  *          behavior is slightly different
  *   history_flag -- should this message be included in history?
- *   type -- type of the message (see intl/fdset.h)
+ *   type -- type of the message (see ../src/common/fdset.h)
  *   reparted -- if this is a preprocessed message reparted
  *             in more pieces
  * It returns 0 on success, -1 otherwise.
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
index cf5f322..088d942 100644
--- a/src/tests/Makefile.am
+++ b/src/tests/Makefile.am
@@ -1,6 +1,6 @@
 
 localedir = $(datadir)/locale
-inc_local = "-I$(top_srcdir)/intl/"
+inc_local = "-I$(top_srcdir)/src/common/"
 c_api = $(top_srcdir)/src/c/api
 
 AM_CFLAGS = -I$(c_api) -DLOCALEDIR=\"$(localedir)\" -I/usr/include/ 
$(inc_local) @glib_include@ -I../audio/
-- 
1.7.1




reply via email to

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